**Unformatted text preview: **CS173 Discrete Mathematical Structures
Cinda Heeren Siebel Center rm 2213 [email protected] Ofc hr: Wed, 9:3011:30a Announcements Sections begin next week! Register at http://compass.uiuc.edu See http://www.cs.uiuc.edu/class/cs173 for all details. Homework #1 due Sunday, 01/22, 8a. Email to section leader, or slide under door of section leader's office (though building may be locked). 05/12/09 Homework
Details: Weekly homework assigned Mon eve, due following Sun, 8a. No late homework accepted. Written solutions must be your own. Graded by your section leader. Returned in section Email to section leaders with the following file name: INCLUDE YOUR SECTION LEADER'S NAME in the document!!! 173_graderinitials_hwk#_netid.extension 05/12/09 Miscellaneous Text: Rosen
QuickTimeu TIFFneeded to seeand adecompressor are (Uncompressed) picture. this RF devices: (in bookstores) Automated attendance Class participation (for fun and feedback) Class keys: Register for course at http://www.einstruction.com Section M: J16787I481 Section Q: K16788G535 Web: http://www.cs.uiuc.edu/class/cs173 IRC chat room: http://www.quickfire.org/cs173 Class wiki: https://wwws.cs.uiuc.edu/wiki/cs173/ 05/12/09 Propositional Logic - say a bit...
This week we're using propositional logic as a foundation for formal proofs. Propositional logic is also the key to writing good code...you can't do any kind of conditional (if) statement without understanding the condition you're testing. All the logical connectives we've discussed are also found in hardware and are called "gates." 05/12/09 A Witch! QuickTime and a H.263 decompressor are needed to see this picture. 05/12/09 Propositional Logic - for next time...
I will assume you know the definitions of the "famous" logical equivalences found on Rosen page 24. Bring a cheat sheet of them to class. 05/12/09 Propositional Logic - 2 more defn...
A tautology is a proposition that's always TRUE. A contradiction is a proposition that's always FALSE. p p p p T F
05/12/09 p p F F F T T T Propositional Logic - an unfamous if NOT (blue AND NOT red) OR red then... (p q) q p q (p q) q (p q) q (p q) q p (q q) p q DeMorgan's Double negation Associativity Idempotent 05/12/09 Propositional Logic - one last proof
[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 Show that [p (p q)] q is a tautology. We use to show that [p (p q)] q T.
substitution for distributive uniqueness identity substitution for DeMorgan's associative excluded middle domination [(p p) (p q)] q 05/12/09 Predicate Logic - everybody loves somebody
Proposition, YES or NO? 3 + 2 = 5 YES X + 2 = 5 NO X + 2 = 5 for any choice of X in {1, 2, 3} X + 2 = 5 for some X in {1, 2, 3} YES YE S 05/12/09 Predicate Logic - everybody loves somebody
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. 05/12/09 ... Predicates
Define: EP(x) = "x eats pizza at least once a week." Universe of Discourse x is a student in cs173 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(Ariel) is.
05/12/09 ... Alicia eats pizza at least once a week. Predicates
Suppose Q(x,y) = "x > y" Proposition, YES or NO? Q(x,y) NO Q(3,4) YES Q(x,9)
NO Predicate, YES or NO? Q(x,y) YES Q(3,4) NO Q(x,9)
YES 05/12/09 Predicates - the universal quantifier
Another way of changing a predicate into a proposition. Suppose P(x) is a predicate on some universe of discourse.
Ex. B(x) = "x is carrying a backpack," x is set of cs173 students. The universal quantifier of P(x) is the proposition: "P (x) is true fo r a ll x in th e unive rs e o f d is c o urs e ." We write it x P (x) , a nd s a y "fo r a ll x, P (x) " x P (x) is T R UE if P (x) is true fo r e ve ry s ing le x. x P (x) is FALS E if th e re is a n x fo r wh ic h P (x) is fa ls e . 05/12/09 x B(x) ? Predicates - the universal quantifier
B(x) = "x is we a ring s ne a ke rs ." L(x) = "x is a t le a s t 2 1 ye a rs o ld ." Y (x) = "x is le s s th a n 2 4 y e a rs o ld ." Are either of these propositions true? ) ) x (Y(x) B(x)) x (Y(x) L(x)) Universe of discourse is people in this room. A: only a is true B: only b is true C: both are true D: neither is true 05/12/09 Predicates - the existential quantifier
Another way of changing a predicate into a proposition. Suppose P(x) is a predicate on some universe of discourse.
Ex. C(x) = "x has a candy bar," x is set of cs173 students. The existential quantifier of P(x) is the proposition: "P (x) is true fo r s o m e x in th e unive rs e o f d is c o urs e ." We write it x P (x) , a nd s a y "fo r s o m e x, P (x) " x P (x) is T R UE if th e re is a n x fo r wh ic h P (x) is true . x P (x) is FALS E if P (x) is fa ls e fo r e ve ry s ing le x. 05/12/09 x C (x) ? Predicates - the existential quantifier
B(x) = "x is we a ring s ne a ke rs ." L(x) = "x is a t le a s t 2 1 ye a rs o ld ." Y (x) = "x is le s s th a n 2 4 y e a rs o ld ." Are either of these propositions true? ) ) x B(x) x (Y(x) L(x)) Universe of discourse is people in this room. A: only a is true B: only b is true C: both are true D: neither is true 05/12/09 Predicates - more examples
L(x) = "x is a lion." F(x) = "x is fierce." C(x) = "x drinks coffee."
All lions are fierce.
Universe of discourse is all creatures. x (L(x) Some lions don't drink coffee. F(x)) x (L(x) C(x)) Some fierce creatures don't drink coffee. x (F(x) C(x))
05/12/09 Predicates - more examples
B(x) = "x is a hummingbird." L(x) = "x is a large bird." H(x) = "x lives on honey." R(x) = "x is richly colored." All hummingbirds are richly colored. No large birds live on honey.
Universe of discourse is all creatures. x (B(x) R(x)) x (L(x) H(x)) Birds that do not live on honey are dully colored. x (H(x) R(x)) 05/12/09 Predicates - quantifier negation
Not all large birds live on honey. x P(x) means "P(x) is true for every x." What about x P(x) ? x P(x)
Not ["P(x) is true for every x."] "There is an x for which P(x) is not true." x (L(x) H(x)) So, x P(x) is the same as x P(x). x (L(x) H(x))
05/12/09 Predicates - quantifier negation
No large birds live on honey. x P(x) means "P(x) is true for some x." What about x P(x) ? x P(x)
Not ["P(x) is true for some x."] "P(x) is not true for all x." x (L(x) H(x)) So, x P(x) is the same as x P(x). x (L(x) H(x))
05/12/09 Predicates - quantifier negation
So, x P(x) is the same as x P(x). So, x P(x) is the same as x P(x). General rule: to negate a quantifier, move negation to the right, changing quantifiers as you go. 05/12/09 Predicates - quantifier negation
No large birds live on honey. x (L(x) H(x)) x (L(x) H(x)) x (L(x) H(x)) x (L(x) H(x)) Negation rule DeMorgan's Subst for What's wrong with this proof?
05/12/09 ...

View
Full
Document