23
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

DeMorgan’s Laws ( p q ) ( p ) ( q ) ( p q ) ( p ) ( q )

  • Upload
    ady

  • View
    106

  • Download
    0

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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

Page 2: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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

Page 3: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

3

What is negation of implication?

( p q)

p (q)

( p q)

Page 4: DeMorgan’s Laws (  p    q  )  ( 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.

Page 5: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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.

Page 6: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

6

• Double negation: p p

p q = p q = p

1 0 1

0 1 0

Page 7: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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

Page 8: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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 /

Page 9: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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)

Page 10: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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

Page 11: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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

Page 12: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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)

Page 13: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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.

Page 14: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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

Page 15: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( 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

Page 16: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

16

4. [p F]p is a tautology

p F p

Rule of Contradiction Given: p F Conclude: p

Page 17: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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

Page 18: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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.

Page 19: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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)

Page 20: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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

Page 21: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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)

Page 22: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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) ]

Page 23: DeMorgan’s Laws (  p    q  )  ( p )  ( q ) ( p    q  )  ( p )  ( q )

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) ]