Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.

Similar presentations


Presentation on theme: "CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett."— Presentation transcript:

1 CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett

2 Today’s Topics: 1. Step-by-step equivalence proofs 2. Equivalence of logical operators 2

3 1. Step-by-Step Equivalence Proofs 3

4 Two ways to show two propositions are equivalent 1. Using a truth table  Make a truth table with a column for each variable, formula  Equivalent iff the T/F values in each row are identical between the two columns 2. Using known logical equivalences  Step-by-step, proof-style approach  Equivalent iff it is possible to evolve one to the other using only the known logical equivalence properties 4

5 Equivalence Rules

6 Inference Rules: 6

7 Logical Equivalences 1. (p ∧ q ∧ r) ∨ (p ∧ ¬q ∧ ¬r) ∨ (¬p ∧ q ∧ r) ∨ (¬p ∧ ¬q ∧ ¬r) ≡(p ∧ (q ∧ r)) ∨ (p ∧ (¬q ∧ ¬r)) ∨ (¬p ∧ (q ∧ r)) ∨ (¬p ∧ (¬q ∧ ¬r)) 2. ≡ (p ∧ ((q ∧ r) ∨ (¬q ∧ ¬r))) ∨ (¬p ∧ ((q ∧ r) ∨ (¬q ∧ ¬r))) a) Substitute s = (q ∧ r) ∨ (¬q ∧ ¬r) gives (p ∧ s) ∨ (¬p ∧ s) b) ≡ (s ∧ p) ∨ (s ∧ ¬p) c) ≡ s ∧ (p ∨ ¬p) d) ≡ s ∧ t e) ≡ s, substitute back for s gives: 3. ≡ (q ∧ r) ∨ (¬q ∧ ¬r) Which law is NOT used? A.Commutative B.Associative C.Distributive D.Identity E.DeMorgan’s 7

8 Legal steps in proof sequences  Consider the following simplification step (modus ponens) p  (p  q)  q Why is it correct to use it? A. Because p is necessary for q B. Because p is sufficient for q C. Because (p  (p  q))  q is a contradiction D. Because (p  (p  q))  q is a tautology E. None/other

9 Legal steps in proof sequences  A simplification step (formula 1)  (formula 2) is a correct step, if the formula (formula 1)  (formula 2) is a tautology  Equivalently, if we assume formula 1 is correct, then we can deduce that formula 2 is correct

10 Applications of proof sequences  Formal verification: a proof that a certain program, or a certain circuit, works correctly  Express the statement “the circuit works correctly” as a formal propositional formula, and then prove it  Typical formulas have millions of inputs, so cannot hope to prove by truth tables. The only way is to find clever ways of building proof sequences

11 2. Equivalence of Logical Operators Do we really need IMPLIES and XOR? 11

12 Are all the logical connectives really necessary?  You already know that IMPLIES is not necessary  p → q ≡ ¬p ∨ q  What about IFF? A. Replace with ¬(¬p ∨ ¬q) B. Replace with (¬p ∧ ¬q) ∨ (p ∧ q) C. Replace with ¬(p ∧ q) ∧ (p ∨ q) D. Replace with something else E. IFF is necessary 12

13 Are all the logical connectives really necessary?  You already know that IMPLIES is not necessary  p → q ≡ ¬p ∨ q  What about XOR? A. Replace with ¬(¬p ∨ ¬q) B. Replace with (¬p ∧ ¬q) ∨ (p ∧ q) C. Replace with ¬(p ∧ q) ∧ (p ∨ q) D. Replace with something else E. XOR is necessary 13

14 Are all the logical connectives really necessary?  You already know that IMPLIES is not necessary  p → q ≡ ¬p ∨ q  What about AND? A. Replace with ¬(¬p ∨ ¬q) B. Replace with (¬p ∧ ¬q) ∨ (p ∧ q) C. Replace with ¬(p ∧ q) ∧ (p ∨ q) D. Replace with something else E. AND is necessary 14

15 Are all the logical connectives really necessary?  Not necessary:  IF  IFF  XOR  AND  We can replicate all these using just two:  OR  NOT  Can we get it down to just one?? A.YES, just OR B.YES, just NOT C.NO, there must be at least 2 connectives D.Other 15

16 It turns out, yes, you can manage with just one!  But it is one we haven’t learned yet:  NAND (NOT AND)  Another option is NOR (NOT OR)  Their truth tables look like this:  Ex: p OR q ≡ (p NAND p) NAND (q NAND q) 16 pqP NAND q TTF TFT FTT FFT pqP NOR q TTF TFF FTF FFT

17 Using NAND to simulate the other connectives 17 pqP NAND q TTF TFT FTT FFT “NOT p” is equivalent to A. p NAND p B. (p NAND p) NAND p C. p NAND (p NAND p) D. NAND p E. None/more/other

18 Using NAND to simulate the other connectives 18 pqP NAND q TTF TFT FTT FFT “p AND q” is equivalent to A. p NAND q B. (p NAND p) NAND (q NAND q) C. (p NAND q) NAND (p NAND q) D. None/more/other

19 Using NAND to simulate the other connectives 19 pqP NAND q TTF TFT FTT FFT “p OR q” is equivalent to A. p NAND q B. (p NAND p) NAND (q NAND q) C. (p NAND q) NAND (p NAND q) D. None/more/other

20 Can we just use AND, OR?  We saw we can use OR,NOT as primitive connectives – they generate all the rest  Similarly, we can just use NAND  Can we just use AND, OR? A. Yes B. No

21 Monotone predicates  A predicate is monotone if replacing an input variable from F to T can never change the value of the predicate from T to F  Example: AND; OR; At least one out of three  But not: NOT; NAND

22 Monotone predicates  Theorem: a predicate is monotone if and only if it can be described using just AND,OR connectives  We will see the proof in later sessions, after we learn a bit about how to prove theorems  Can you prove it yourself now?


Download ppt "CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett."

Similar presentations


Ads by Google