     # CSE 20: Discrete Mathematics Truth tables for basic ... - Truth...¢  Truth tables for basic logical

• View
1

0

Embed Size (px)

### Text of CSE 20: Discrete Mathematics Truth tables for basic ... - Truth...¢  Truth tables for...

• CSE 20: Discrete Mathematics for Computer Science    Prof. Miles Jones

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

1. Truth table for basic logical connectives

3

not, and, or, xor, implies

Logical connectives

math Java/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

4

• Logical connectives: Operator precedence

Operator Precedence ¬ (not) 1 ∧ (and) 2 ∨ (or) 3 → (implies) 4 ↔ (iff) 5

5

! As with programming, it is good practice to use parenthesis for clarity

Truth tables:  AND ∧

p q p∧q F F ? F T ? T F ? T T ?

I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences?

Is it:

A. F,F,F,F B. F,T,T,T C. T,T,T,F D. F,F,F,T E. None/More/Other

Truth tables:  AND ∧

p q p∧q F F F F T F T F F T T T

I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences?

Is it:

A. F,F,F,F B. F,T,T,T C. T,T,T,F D. F,F,F,T E. None/More/Other

Truth tables:  AND ∧ OR ∨

p q p∧q F F F F T F T F F T T T

p q p∨q F F F F T T T F T T T T

I’m interested in seeing if this makes intuitive sense to you – can you explain why each output makes sense, using example sentences?

• OR is tricky in English

OR p q p OR q F F F F T T T F T T T T

XOR p q p XOR q F F F F T T T F T T T F

9

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

Implies ! p→ q ! p implies q ! if p then q ! q when p ! q if p

10

What does it mean: IMPLIES

11

! I say: “If you win the 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 am I 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

What does it mean: IMPLIES

12

! 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

• Truth tables: IMPLIES p q p→q F F F T T F T T

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?

Truth tables: IMPLIES p q p→q F F T F T T T F F T T T

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?

Truth tables: IMPLIES p q p→q F F T F T T T F F T T T

T, F, F, T F, T, T, T F, F, F, T F, T, T, F None/more/other

A false statement implies anything!!!!!!!

Implies ! p=I hit my thumb with a hammer ! q=my thumb hurts ! p → q= If I hit my thumb with a hammer

then my thumb hurts.

16

p q p→q F F T F T T T F F T T T

• 2. Truth table for new/made- up connectives

17

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

18

p q p OR q

F F F

F T T

T F T

T T T

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

19

p q p OR q

F F F

F T T

T F T

T T T

N variables ! 2N rows (ignoring header row)

Making our own connective: AtLeastOneOfTheseThree  ALOOTT(p,q,r)

20

p q r ALOOTT(p,q,r)

F F F

F F T

F T F

F T T

T F F

T F T

T T F

T T T

Homework

• 3. “Step-by-step” truth tables for complex propositional formulas

21

Truth table for (p→q)∧¬p

22

p q p→q ¬p (p→q)∧¬p F F F T T F T T

Truth table for (p→q)∧¬p

23

p q p→q ¬p (p→q)∧¬p F F T F T T T F F T T T

Truth table for (p→q)∧¬p

24

p q p→q ¬p (p→q)∧¬p F F T T F T T T T F F F T T T F

• Truth table for (p→q)∧¬p

25

p q p→q ¬p (p→q)∧¬p F F T T T F T T T T T F F F F T T T F F

Truth table for ¬q→(p^q)

26

p q ¬q p∧q ¬q→(p∧q) F F T F F F T F F T T F T F F T T F T T

Truth table for ¬pORq

27

p q ¬p ¬pORq F F T T F T T T T F F F T T F T

Truth table for ¬p∧q

28

p q ¬p ¬p∧q F F T T F T T T T F F F T T F T

¬p∧q is logically equivalent to p→q!!!!!

• All possible truth tables for two variables

29

¬∧ → ¬p ¬q ¬⊕ ¬∨ ∨ ⊕ q p ∧ ∧ ∧p q 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

F F T T T T T T T T F F F F F F F F F T T T T T F F F F T T T T F F F F T F T T F F T T F F T T F F T T F F T T T F T F T F T F T F T F T F T F ##### Combinational logic „ Logic functions, truth tables, and switches
Documents ##### COS1521 - number systems, Boolean algebra, Karnaugh maps, truth tables and basic logic circuit drawings,
Documents ##### Why Truth Tables? We will learn several ways to evaluate arguments for validity. * Proofs * Truth Tables * Trees
Documents ##### Deductive Arguments: Basic Truth Tables 2018-01-11آ  Truth Table for AND â€¢Letâ€™s say that one day
Documents ##### [ PROPOSITIONAL LOGIC] - KopyKitab .[ PROPOSITIONAL LOGIC] ... Truth tables: Truth table is a
Documents ##### ECE 331 – Digital System Design Basic Logic Functions, Truth Tables, and Standard Logic Gates
Documents Documents