E N D
Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.Based on a work at http://peerinstruction4cs.org.Permissions beyond the scope of this license may be available at http://peerinstruction4cs.org. CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett
Today’s Topics: Propositional logic • Truth tables for basic logical connectives • not, and, or, xor, implies • Truth table for new/made-up connectives • “Step-by-step” truth tables for complex propositional formulas
1. Truth table for basic logical connectives not, and, or, xor, implies
Logical connectives mathJava/C++ • and p q p && q • or p q p || q • xor p q p ^ q • not p !p • If/then, implies p q • If and only if, iff p q • We will use the math notation
Logical connectives: Operator precedence • As with programming, it is good practice to use parenthesis for clarity
OR is tricky in English OR XOR Birthday party host: “Do you want some cake OR ice-cream?” YOU CAN HAVE BOTH (imagine it is rude to have nothing) Diner breakfast special: “Pancake, two eggs and bacon XOR sausage.” YOU MUST PICK EXACTLY ONE
What does it mean: IMPLIES • Prof Lee says: “If you win the CA state lottery between now and the end of quarter, you will get an A+ in this class.” 4 months later… under which of the following scenarios is Prof. Lee a liar? • You won the lottery and got an A+ • You won the lottery and got a B+ • You did not win the lottery and got an A+ • You did not win the lottery and got a B+ • None/More/Other
What does it mean: IMPLIES • Your roommate: “If you come to my party Friday, you will have fun” Under which of the following scenarios is your roommate a liar? • You stayed home studying Friday and you did not have fun. • You stayed home studying Friday and you had fun. • You went to the party Friday and did not have fun. • You went to the party Friday and you had fun. • None/More/Other
Truth tables: IMPLIES I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences? T, F, F, T F, T, T, T F, F, F, T F, T, T, F None/more/other
Making our own connective: AtLeastOneOfTheseThreeALOOTT(p,q,r) • Let’s make a truth table for ALOOTT. How many rows and columns should be in our truth table (ignoring header row)? • 5 rows, 4 columns • 6 rows, 4 columns • 7 rows, 4 columns • 8 rows, 4 columns • 9 rows, 4 columns
Making our own connective: AtLeastOneOfTheseThreeALOOTT(p,q,r) Homework
3. “Step-by-step” truth tables for complex propositional formulas