discrete mathematics. propositional logic 10/8/2015 what’s a proposition? propositionsnot...

19
Discrete Mathematics

Upload: felicia-welch

Post on 16-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Discrete Mathematics

Page 2: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic

04/21/23

What’s a proposition?

Propositions Not Propositions

3 + 2 = 32 Bring me coffee!

CS173 is Bryan’s favorite class.

CS173 is her favorite class.

Every cow has 4 legs. 3 + 2

There is other life in the universe.

Do you like Cake?

A proposition is a declarative statement that’s either TRUE or FALSE (but not both).

Page 3: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - negation

04/21/23

Suppose p is a proposition. The negation of p is written p and has meaning:

“It is not the case that p.”

Ex. CS173 is NOT Bryan’s favorite class.

Truth table for negation:p p

TF

FT

Notice that p is a

proposition!

Page 4: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - conjunction

04/21/23

Conjunction corresponds to English “and.”

p q is true exactly when p and q are both true.

Ex. Amy is curious AND clever.

Truth table for conjunction:

p q p q

TTFF

TFTF

TFFF

Page 5: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - disjunction

04/21/23

Disjunction corresponds to English “or.”

p q is when p or q (or both) are true.

Ex. Michael is brave OR nuts.

Truth table for disjunction:

p q p q

TTFF

TFTF

TTTF

Page 6: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - logical equivalence

04/21/23

To answer, we need the notion of “logical equivalence.”

p is logically equivalent to q if their truth tables are the same. We write p

q.

Page 7: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - implication

04/21/23

Implication: p q corresponds to English “if p then q,” or “p implies q.”

If it is raining then it is cloudy.If there are 200 people in the room, then I am the Easter Bunny.

If p then 2+2=4.

Truth table for implication:

p q p q

TTFF

TFTF

TFTT

Page 8: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - logical equivalence

04/21/23

Challenge: Try to find a proposition that is equivalent to p q, but that uses only the connectives , , and .

p q p q

TTFF

TFTF

TFTT

p q p q p

TTFF

TFTF

FFTT

TFTT

Page 9: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Logical equivalence

04/21/23

Page 10: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - proof of 1 famous

04/21/23

Distributivity: p (q r) (p q) (p r)

p q r q r p (q r) p q p r (p q) (p r)

T T T T T T T T

T T F F T T T T

T F T F T T T T

T F F F T T T T

F T T T T T T T

F T F F F T F F

F F T F F F T F

F F F F F F F F

I could say “prove a law

of distributivi

ty.”

Page 11: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - special definitions

04/21/23

Contrapositives: p q and q p Ex. “If it is noon, then I am hungry.”

“If I am not hungry, then it is not noon.”

Converses: p q and q p Ex. “If it is noon, then I am hungry.”

“If I am hungry, then it is noon.”Inverses: p q and p q

Ex. “If it is noon, then I am hungry.” “If it is not noon, then I am not

hungry.”

One of the pair of

propositions is equivalent.

p q q p

Page 12: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - 2 more defn…

04/21/23

A tautology is a proposition that’s always TRUE.

A contradiction is a proposition that’s always FALSE.

p p p p p p

T F

F T

T

T

F

F

Page 13: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic

04/21/23

(p q) q p q

(p q) q

(p q) q(p q) qp (q q)p q

DeMorgan’s

Involution

AssociativityIdempotent

Page 14: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Propositional Logic - one last proof

04/21/23

Show that [p (p q)] q is a tautology. We use to show that [p (p q)] q T.

substitution for

[p (p q)] q

[(p p) (p q)] q

[p (p q)] q

[ F (p q)] q (p q) q (p q) q (p q) q p (q q ) p T T

distributive

complement

identity

substitution for DeMorgan’s

associative

Complement

Identity

Page 15: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Predicate Logic - everybody loves somebody

04/21/23

Proposition?3 + 2 = 5X + 2 = 5X + 2 = 5 for any choice of X in {1, 2, 3}X + 2 = 5 for some X in {1, 2, 3}

YES

NO

YES

YES

Page 16: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Predicate Logic

04/21/23

Alicia eats pizza at least once a week.Garrett eats pizza at least once a week.

Allison eats pizza at least once a week.

Gregg eats pizza at least once a week.Ryan eats pizza at least once a week.Meera eats pizza at least once a week.Ariel eats pizza at least once a week.

Page 17: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Predicates

04/21/23

Alicia eats pizza at least once a week.

Define:EP(x) = “x eats pizza at least once a week.”Universe of Discourse - x is a student in CSER1209

A predicate, or propositional function, is a function that takes some variable(s) as arguments and returns True or False.

Note that EP(x) is not a proposition, EP(Alicia) is.

Page 18: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

Predicates

04/21/23

Suppose Q(x,y) = “x > y”

Proposition?Q(x,y)Q(3,4)Q(x,9)

NO

YES

NO

Predicate?Q(x,y)Q(3,4)Q(x,9)

YES

NO

YES

Page 19: Discrete Mathematics. Propositional Logic 10/8/2015 What’s a proposition? PropositionsNot Propositions 3 + 2 = 32Bring me coffee! CS173 is Bryan’s favorite

THANK YOU