cse 20: discrete mathematics 1. equivalence of logical
TRANSCRIPT
CSE 20: Discrete Mathematics for Computer ScienceProf. Miles Jones
Today’s Topics:1. Step-by-step equivalence proofs 2. Equivalence of logical operators
2
1. Step-by-Step Equivalence Proofs
3
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
Equivalence Rules Inference Rules:
6
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
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
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
Inference Rules:
10
p q p → q p∧(p→q) p∧(p→q)→q
T T T T TT F F F TF T T F TF F T F T
p ¬p q ¬q p → q ¬q∧(p→q) ¬q∧(p→q)→¬p
T F T F T F TT F F T F F TF T T F T F TF T F T T T T
p q p ∨ q p→(p ∨ q)
T T T TT F T TF T T TF F F T
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
2. Equivalence of Logical Operators
Do we really need IMPLIES and XOR?
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
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
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
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
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)
17
p q P NAND q
T T FT F TF T TF F T
p q P NOR q
T T FT F FF T FF F T
Using NAND to simulate the other connectives
18
p q P NAND q
T T FT F TF T TF F T
“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
Using NAND to simulate the other connectives
19
p q P NAND q
T T FT F TF T TF F T
“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
Using NAND to simulate the other connectives
20
p q P NAND q
T T FT F TF T TF F T
“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
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
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
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?