230 likes | 364 Views
p q p q ( p q ) 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
E N D
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 DeMorgan’s Laws ( p q ) (p) (q) (p q ) (p) (q) (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
p q pqp p q • 1 1 1 0 1 • 1 0 0 0 0 • 0 1 1 1 1 • 0 0 1 1 1 Other important logical equivalences pq ( p q) (proof by contradiction) p q
What is negation of implication? ( p q) ( p q) p (q)
pq q p pq p q converse of pq 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.
contrapositive ofpq pq ( q) ( p) Contrapositive law • p q pqq 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 An integer is no divisible by 2 it is not divisible by 4.
Double negation:p p p q = p q = p 1 0 1 0 1 0
a b = b a a +b = b + a a (b c)= (a b) c a + (b + c) = (a + b) +c • Commutativity • p q q p • p q q p • Associativity • p (q r) (p q ) r • 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 / ? p (q r) (p q ) r
Distributivity • p (q r) (p q ) ( p r) • p (q r) (p q ) ( p r) a (b+c) = a b +a c a +b c = (a + b) (a +c) Analogy with algebra is not complete!
Identity • p F p p T p • Domination • p T Tp F F • Inverse • p p F p p T • Idempotent • p p p p p p
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
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) (qr) (pq) (qr))………………...equivalence ( p q) (q r)……………….DeMorgan’s law ( ( p q) q ) r)…………….associative law ( ( pq) ( q q)) r)………distributive law ( (pq ) T) r)………………inverse law ( pq ) r)……………………...identity law (p(q r))……………………..associative law p (qr)
Deduction Rules (Inference rules) Suppose H1 H2 ... HnC is a tautology, whereH1, 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 ... HnC is called an inference rule.
p pq q • Examples: • [ p and (pq)] q is a tautology (check in truth table) Modus Pones: Given that p and pq are both true Conclude: q
pq q p pq q r pr 2. [(pq) q] p is a tautology, which leads to: Modus Tolens(proof by contradiction) Given: pq, q Conclude: p 3. Syllogism: Given: pq, q r Conclude: pr
p F p 4. [p F]p is a tautology Rule of Contradiction Given: p F Conclude: p
Predicates : p(x): x is a prime number. q(x): x > 2 r(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 false q(3) is true, but q(1) is false
Quantifiers. Universal quantifier xp(x) "for all x p(x) is true" "for any (every) xp(x) is true" For any x 2x is even. (universe of discourse is all integers ). When the domain (universe of discourse) is finite, xp(x) is equivalent to p(0)p(1)p(2)…p(n). All students in this class are CS majors.
Existential quantifier xp(x) "there exists (at least one) x such that p(x) is true" " for some xp(x) is true" There exists a student in this class who likes discrete mathematics. xp(x). In this case the universe consists of students in this class and p(x) is the proposition "Student x likes discrete mathematics". xp(x) p(x1)p(x2)…p(x70)
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
Negating Quantifiers Find negations of statements including quantifiers. (xp(x)) (All books are interesting) = There exists at least one book that is not interesting (xp(x)) (Some people like mathematics.) = Everybody dislikes mathematics (x p(x)) x p(x) ( x p(x)) x p(x)
x[ p(x)q(x) ] / Compound statements with existential quantifier x[ p(x)q(x) ] [xp(x)][xq(x) ] [xp(x)][xq(x) ] x[ p(x) q(x) ] [xp(x)] [xq(x) ] [xp(x)] [xq(x) ] x[ p(x) q(x) ]
[xp(x)] [xq(x) ] / Compound statements with universal quantifier x[ p(x)q(x) ] [xp(x)][xq(x) ] [xp(x)][xq(x) ] x[ p(x)q(x) ] x[ p(x)q(x) ] [xp(x)] [xq(x) ] x[ p(x)q(x) ]