1 DeMorgan’s Laws ( p q ) (p) (q) (p q ) (p) (q) pq) p q (p) (q) 0 0 0 1 0 1 1 1 1 0 1 1 1 (Peter is tall and fat) Peter is not tall Peter is not fat (cucumbers are green or seedy) cucumbers are not green cucumbers are not seedy
Jan 06, 2016
1
DeMorgan’s Laws ( p q ) (p) (q)
(p q ) (p) (q)
p q pq (pq) p q (p) (q)
1 1 1 0 0 0 0
1 0 0 1 0 1 1
0 1 0 1 1 0 1
0 0 0 1 1 1 1
(Peter is tall and fat) Peter is not tall Peter is not fat
(cucumbers are green or seedy) cucumbers are not green cucumbers are not seedy
2
Other important logical equivalences
pq ( p q) (proof by contradiction)
p q pq p p q
1 1 1 0 1
1 0 0 0 0
0 1 1 1 1
0 0 1 1 1
p q
3
What is negation of implication?
( p q)
p (q)
( p q)
4
pq q p
converse of pq
pq p q
inverse of pq
p q pq q p
1 1 1 1
1 0 0 1
0 1 1 0
0 0 1 1
p q p q
0 0 1
0 1 1
1 0 0
1 1 1
An integer is divisible by 4 it is divisible by 2.
An integer is divisible by 2 it is divisible by 4.
An integer is not divisible by 4 it is not divisible by 2.
5
pq ( q) ( p)
contrapositive of pq
p q pq q p ( q) ( p)
1 1 1 0 0 1
1 0 0 1 0 0
0 1 1 0 1 1
0 0 1 1 1 1
Contrapositive law
An integer is no divisible by 2 it is not divisible by 4.
6
• Double negation: p p
p q = p q = p
1 0 1
0 1 0
7
•Commutativity
p q q p
p q q p
•Associativity
p (q r) (p q ) r
p (q r) (p q ) ra (b c) = (a b) c
a + (b + c) = (a + b) +c
a b = b a
a +b = b + a
8
p (q r) (p q ) r
?
p q r p q q r p (q r) (p q ) r
1 1 1 1 1 1 1
1 1 0 1 1 1 1
1 0 1 0 1 1 1
1 0 0 0 0 0 0
0 1 1 0 1 0 1
0 1 0 0 1 0 0
0 0 1 0 1 0 1
0 0 0 0 0 0 0
p (q r) (p q ) r /
9
•Distributivity p (q r) (p q ) ( p r) p (q r) (p q ) ( p r)
Analogy with algebra is not complete!
a (b+c) = a b +a ca +b c = (a + b) (a +c)
10
• Identityp F p p T p
•Domination p T T p F F• Inverse
p p F p p T
• Idempotent
p p p p p p
11
• Absorption laws
p (p q) p
p (p q) p
q = T p (p q) p (p T) p p p
q = F p (p q) p (p F) p F p
12
Example: Use the laws of logic to show that the following expression is a tautology[(pq) (q r)] [p (q r)]
Take the left-hand side and perform equivalent transformations:(pq) (q r) (p q) (q r))………………...equivalence ( p q) (q r)……………….DeMorgan’s law ( ( p q) q ) r)…………….associative law ( ( p q ) ( q q)) r)………distributive law ( ( p q ) T) r)………………inverse law ( p q ) r)……………………...identity law ( p (q r))……………………..associative law p (q r)
13
Deduction Rules (Inference rules)
Suppose H1 H2 ... Hn C is a tautology, where H1, H2, ... Hn are hypotheses and C is a conclusion. Then, given that all hypotheses are true,the conclusion is always true, or it is a valid argument.
H1
H2
… Hn
C
H1 H2 ... Hn C is called an inference rule.
14
Examples:1. [ p and (pq)] q is a tautology (check in truth table)
Modus Pones: Given that p and pq are both true Conclude: q
p pq q
15
2. [(pq) q] p is a tautology, which leads to:Modus Tolens (proof by contradiction)
3. Syllogism: Given: pq, q r Conclude: pr
pq q p
pq q r pr
Given: pq, q Conclude: p
16
4. [p F]p is a tautology
p F p
Rule of Contradiction Given: p F Conclude: p
17
Predicates :
p(x): x is a prime number.q(x): x > 2r(x): x is an odd number
These predicates are not propositions, because they can be true of false depending on x (unbound variable).
p(2) is true, but p(4) is falseq(3) is true, but q(1) is false
18
Quantifiers. Universal quantifier x p(x) "for all x p(x) is true"
"for any (every) x p(x) is true"
For any x 2x is even. (universe of discourse is all integers ).
When the domain (universe of discourse) is finite, x p(x) is equivalent to p(0)p(1)p(2)…p(n).
All students in this class are CS majors.
19
Existential quantifier x p(x) "there exists (at least one) x such that p(x) is true"
" for some x p(x) is true"
There exists a student in this class who likes discrete mathematics.
x p(x). In this case the universe consists of students in this class and p(x) is the proposition "Student x likes discrete mathematics".
x p(x) p(x1)p(x2)…p(x70)
20
Proposition true false
x p(x) p(x) is true for every x There is an x for which p(x) is false
x p(x) There is an x for which p(x) is false for every x p(x) is false
21
Find negations of statements including quantifiers.(x p(x))(All books are interesting) = There exists at least one book that is not interesting (x p(x))(Some people like mathematics.)= Everybody dislikes mathematics
Negating Quantifiers
(x p(x)) x p(x)( x p(x)) x p(x)
22
Compound statements with existential quantifier
x[ p(x)q(x) ] [x p(x)][x q(x) ]
[x p(x)][x q(x) ] x[ p(x)q(x) ]/
x[ p(x) q(x) ] [x p(x)] [x q(x) ]
[x p(x)] [x q(x) ] x[ p(x) q(x) ]
23
Compound statements with universal quantifier
x[ p(x)q(x) ] [x p(x)][x q(x) ]
[x p(x)][x q(x) ] x[ p(x)q(x) ]
x[ p(x)q(x) ] [x p(x)] [x q(x) ] /
[x p(x)] [x q(x) ] x[ p(x)q(x) ]