Lecture 4 CS 1813 – Discrete Mathematics

Slides:



Advertisements
Similar presentations
Introduction to Proofs
Advertisements

1 Introduction to Abstract Mathematics Valid AND Invalid Arguments 2.3 Instructor: Hayk Melikya
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 3 CS 1813 – Discrete Mathematics Truth Inference and the Logical Way.
Logic 3 Tautological Implications and Tautological Equivalences
TR1413: Discrete Mathematics For Computer Science Lecture 3: Formal approach to propositional logic.
TR1413: INTRO TO DISCRETE MATHEMATICS LECTURE 2: MATHEMATICAL INDUCTION.
Introduction to Proofs ch. 1.6, pg. 87,93 Muhammad Arief download dari
EE1J2 – Discrete Maths Lecture 5 Analysis of arguments (continued) More example proofs Formalisation of arguments in natural language Proof by contradiction.
Introduction to Python
Definitions. name :: Type answer :: Int name = expression answer = Definitions associate a name with a value of a certain type is of type greater.
Introduction to Proofs
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 18 CS 1813 – Discrete Mathematics Loops Without Invariants Are Like.
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 10 CS 1813 – Discrete Mathematics Quantify What? Reasoning with Predicates.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 7 CS 1813 – Discrete Mathematics Equational Reasoning Back to the Future:
Overview of the Haskell 98 Programming Language
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
CSE Winter 2008 Introduction to Program Verification January 31 proofs through simplification.
CS6133 Software Specification and Verification
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 3 The Foundations: Logic and Proof,
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 2 CS 1813 – Discrete Mathematics Proofs Propositions and Calculuses.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Of 38 lecture 13: propositional logic – part II. of 38 propositional logic Gentzen system PROP_G design to be simple syntax and vocabulary the same as.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 05 : Knowledge Base & First Order Logic.
Proof by Contradiction CS 270 Math Foundations of CS Jeremy Johnson.
Guards1. 2 Let’s test this function. Main> maxi Here is a trace of the function: n m maxi 3 2 Guards or conditions are used to express various cases.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 14 CS 1813 – Discrete Mathematics A Little Bit of Set Theory.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 CS 1813 – Discrete Mathematics Review of Predicate Calculus Set Theory Inductive.
March 23 rd. Four Additional Rules of Inference  Constructive Dilemma (CD): (p  q) (r  s) p v r q v s.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
August 31, 2005.
Methods of proof Section 1.6 & 1.7 Wednesday, June 20, 2018
PROGRAMMING IN HASKELL
CSE 3302 Programming Languages
PROGRAMMING IN HASKELL
Lecture 15 CS 1813 – Discrete Mathematics
Lecture 12 CS 1813 – Discrete Mathematics
Check It Out! Example 1 Write an indirect proof that a triangle cannot have two right angles. Step 1 Identify the conjecture to be proven. Given: A triangle’s.
Lecture 6 CS 1813 – Discrete Mathematics
Lecture 13 CS 1813 – Discrete Mathematics
7.1 Rules of Implication I Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic.
Sets and Logic…. Chapter 3
CS 1813 – Discrete Mathematics
The Foundations: Logic and Proofs
Lecture 16 CS 1813 – Discrete Mathematics
CS1502 Formal Methods in Computer Science
CS201: Data Structures and Discrete Mathematics I
Quizzes CS 1813 – Discrete Mathematics
Mathematical Reasoning
Logic Use mathematical deduction to derive new knowledge.
Methods of Proof. Methods of Proof Definitions A theorem is a valid logical assertion which can be proved using Axioms: statements which are given.
Lecture 1 CS 1813 – Discrete Mathematics
CS 270 Math Foundations of CS
Lecture 11 CS 1813 – Discrete Mathematics
Applied Discrete Mathematics Week 1: Logic
Propositional Logic.
Back to “Serious” Topics…
Computer Security: Art and Science, 2nd Edition
Lecture 5 CS 1813 – Discrete Mathematics
Logical Entailment Computational Logic Lecture 3
PROGRAMMING IN HASKELL
Lecture 8 CS 1813 – Discrete Mathematics
Foundations of Discrete Mathematics
COMP 1380 Discrete Structures I Thompson Rivers University
Mathematical Reasoning
5.6 Inequalities in Two Triangles and Indirect Proof
Logical and Rule-Based Reasoning Part I
CS201: Data Structures and Discrete Mathematics I
Chapter 8 Natural Deduction
Presentation transcript:

Lecture 4 CS 1813 – Discrete Mathematics Lecture 4 - CS 1813 Discrete Math, University of Oklahoma 9/20/2018 Lecture 4 CS 1813 – Discrete Mathematics Inference Rules, Dude CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Definitions of Variables in Haskell double-hyphen starts comment x = 3 -- defines x to be three xs = [4, 2, 9, 1] -- defines xs to be a sequence first letter in variable: lowercase andCommutes = Theorem [A `And` B] (B `And` A) -- defines andCommutes to be a Theorem proofAndCommutes = -- variable def’d to be Proof (Assume(A `And` B) {---------------------}`AndER` B, Assume(A `And` B) {---------------------}`AndEL` A) {--------------------------------------}`AndI` (B `And` A) infix alternative x `f` y means f x y indent to continue definition {- comment -} embedded comment CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Using Haskell from Windows Lecture 4 - CS 1813 Discrete Math, University of Oklahoma 9/20/2018 Using Haskell from Windows importing tools module Lecture04 where import Stdm cp = check_proof comm = Theorem [A `And` B] (B `And` A) proofComm = (Assume(A `And` B) {-------------------------}`AndER` B, Assume(A `And` B) {------------------------}`AndEL` A) {-------------------------------------}`AndI` (B `And` A) Notepad window def’n saves typing Green indicates cmd from user Prelude> :cd DMs05 Prelude> :cd Lectures Prelude> :load lecture04.hs Reading file "lecture04.hs": Reading file "Stdm.lhs": Hugs session for: C:\HUGS98\lib\Prelude.hs Stdm.lhs lecture04.hs Main> cp comm proofComm The proof is valid Hugs Session Demo of proof checker software. During a session using the Hugs interpreter, I prepare my Haskell code in a file with a .hs extension, and I keep this file open under Notepad. I start an interactive Hugs session using winhugs.exe. In the window for the interactive session, I change to the directory containing my Haskell code (:cd directory). Warning: the winhugs.exe program does not seem to support backing up in the directory structure. If you need to back up, close the session and start again. This directory containing the .hs file with the Haskell code must also contain the Stdm.lhs file that specifies a Haskell module implementing the tools supplied through the textbook’s website. I then load the .hs file containing my Haskell code. If there are syntax errors in the code, I correct them in the Notepad window, save the file, and reload (:reload). When I have successfully loaded a .hs file, I issue proof-checking commands using the theorems and proofs defined in the .hs file. CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Incorrect Proof of Theorem Theorem ( Commutes) a  b |– b  a Proof a  b {EL} a a  b {ER} b  {I} b  a Conclusion not in proper form (b and a in wrong positions to match I rule) a b  {I} a  b I rule CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Another Theorem and Proof a  b, ac, bd |– c  d Proof a ab  {E} b E rule Modus Ponens a  b {EL} a a  b {ER} b ac bd What if this is on the right and this is on the left?  {E}  {E} c d  {I} c  d CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Theorem and Proof in Proof-Checker Notation Lecture 4 - CS 1813 Discrete Math, University of Oklahoma 9/20/2018 Theorem and Proof in Proof-Checker Notation proof = ((Assume(A `And` B) {------------------------- }`AndEL` A, Assume(A `Imp` C)) {-------------------------------------------}`ImpE` C, (Assume(A `And` B) {------------------------ }`AndER` B, Assume(B `Imp` D)) {-----------------------------------------}`ImpE` D) {-------------------------------------------------------------------------}`AndI` (C `And` D) theorem = Theorem [A `And` B, A `Imp` C, B `Imp` D] (C `And` D) premises (Proof, Proof) {-----------}`AndI` Prop conclusion At this point, again go to the Haskell session with lecture04.hs and again demonstrate use of proof checker. CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Inference Rules We’ve Used in Proofs a  b  {EL} a EL rule And Elimination Left a  b  {ER} b ER rule And Elimination Right Implication Elimination a ab  {E} b E rule Modus Ponens Latin name: a b  {I} a  b I rule And Introduction How these rules work: If you have proofs of the propositions above the line (or if they are premises of the theorem you are trying to prove), you can infer the proposition below the line. CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Implication Introduction a different kind of animal a |– b  {I} ab I rule If there is a proof of proposition b when you assume proposition a , then you can infer the proposition ab . What’s Different? The assumed proposition, a, need not be a premise of the theorem Nor does it have to be proved from the premises Temporary Admission The assumption a is temporarily “admitted” into the proof Later, when the {I} rule is invoked, the assumption a is discharged What! You can assume anything you want? Where’s the logic in that? The conclusion of the rule doesn’t require a to be true, or b either It only requires that if a were true, then b would also be true What happens to assumptions that aren’t discharged? They become premises of the theorem (“permanent inmates” so to speak) CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

How Implication Introduction Is Used Theorem (Implication Introduction Example) |– P  Q  Q Proof This proves the theorem P  Q |– Q At this point the proof admits, temporarily, the extra assumption P  Q Applying I discharges the P  Q assumption P  Q {ER} Q  {I} P  Q  Q Implication Introduction a |– b  {I} ab I rule Applying the I rule with a = P  Q and b = Q We have proved P  Q |– Q So, we can infer P  Q  Q CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

CS 1813 Discrete Mathematics, Univ Oklahoma Implication Chain Rule Settle in – it’s going to be proofs, proofs, and more proofs Theorem (Implication Chain Rule) ab, bc |– ac Suppose, somehow, we could find a proof for: a |– c Then the I rule would lead to the conclusion ac Strategy in a nutshell Assume a Prove: a |– c Conclude ac (by applying the I rule) proof remaining assumptions a ab {E} b assumption temporarily admitted discharged bc {E} c {I} ac conclusion by I CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Getting the Parens and Commas Right in Proof-Checker Notation {IL} a  b (a  b)  False {E} False {I} a  False a ( ) ( ( ) ( ) ( Assume A {---------------}`OrIL` ( ) A `Or` B , Assume((A `Or` B) `Imp` FALSE) ) {--------------------------------------------------------------}`ImpE` ( ) FALSE {--------------------------------------------------------------------}`ImpI` ( ) A `Imp` FALSE ) CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Maybe an Easier Way get syntax right, step by step {IL} a  b (a  b)  False {E} False {I} a  False a Step-by-step method aOrb = A `Or` B Main> check_proof thm prfThm The proof is valid Hugs Session hyp = aOrb `Imp` FALSE concl = A `Imp` FALSE thm = Theorem [hyp] concl prf1 = OrIL (Assume A) aOrb prf2 = ImpE (prf1, Assume hyp) FALSE prfThm = ImpI prf2 concl CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

CS 1813 Discrete Mathematics, Univ Oklahoma End of Lecture CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page