Download presentation
Presentation is loading. Please wait.
Published byElmer Pitts Modified over 9 years ago
1
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett 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.Cynthia LeeCreative Commons Attribution- NonCommercial-ShareAlike 4.0 International Licensehttp://peerinstruction4cs.org
2
Today’s Topics: Propositional logic 1. Truth tables for basic logical connectives not, and, or, xor, implies 2. Truth table for new/made-up connectives 3. “Step-by-step” truth tables for complex propositional formulas 2
3
1. Truth table for basic logical connectives 3 not, and, or, xor, implies
4
Logical connectives mathJava/C++ andp qp && q orp qp || q xorp qp ^ q not p!p If/then, impliesp q If and only if, iffp q We will use the math notation 4
5
Logical connectives: Operator precedence OperatorPrecedence (not)1 (and) 2 (or) 3 (implies) 4 (iff) 5 5 As with programming, it is good practice to use parenthesis for clarity
6
OR is tricky in English OR pqp OR q FFF FTT TFT TTT XOR pqp XOR q FFF FTT TFT TTF 6 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
7
What does it mean: IMPLIES 7 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? A. You won the lottery and got an A+ B. You won the lottery and got a B+ C. You did not win the lottery and got an A+ D. You did not win the lottery and got a B+ E. None/More/Other
8
What does it mean: IMPLIES 8 Your roommate: “If you come to my party Friday, you will have fun” Under which of the following scenarios is your roommate a liar? A. You stayed home studying Friday and you did not have fun. B. You stayed home studying Friday and you had fun. C. You went to the party Friday and did not have fun. D. You went to the party Friday and you had fun. E. None/More/Other
9
Truth tables: IMPLIES pq pqpq FF FT TF TT A. T, F, F, T B. F, T, T, T C. F, F, F, T D. F, T, T, F E. None/more/other I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences?
10
2. Truth table for new/made- up connectives 10
11
Making our own connective: AtLeastOneOfTheseThree ALOOTT(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)? A. 5 rows, 4 columns B. 6 rows, 4 columns C. 7 rows, 4 columns D. 8 rows, 4 columns E. 9 rows, 4 columns 11 pqp OR q FFF FTT TFT TTT
12
Making our own connective: AtLeastOneOfTheseThree ALOOTT(p,q,r) 12 pqrALOOTT(p,q,r) FFF FFT FTF FTT TFF TFT TTF TTT Homework
13
3. “Step-by-step” truth tables for complex propositional formulas 13
14
Truth table for (p q) p 14 pq pqpq pp (p q) p FF FT TF TT
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.