Foundations Of Computer Science Lecture 3 - Cs.rpi.edu

Transcription

Foundations of Computer ScienceLecture 3Making Precise StatementsPropositionsCompound Propositions and Truth TablesPredicates and Quantifiers

Last Time1Sets, {3, 5, 11}2Sequences, 1001110013Graphs,BAEDC4FExamples of basic proofs. In 4 rounds of group dating, no one meets more than 12 people.x2 is even “is the same as” x is even.In any group of 6 people there is an orgy of 3 mutual friends or a war of 3 mutual enemies.Axiom:The Well-Ordering Principle 2 is not rational.Creator: Malik Magdon-IsmailMaking Precise Statements: 2 / 27Today

Today: Making Precise Statements1Making a precise statement: the proposition2Complicated precise statements: the compound propositionTruth tables3Claims about many thingsPredicatesQuantifiersProofs with quantifiersCreator: Malik Magdon-IsmailMaking Precise Statements: 3 / 27Statements can be Ambiguous

Statements can be Ambiguous12 2 4.Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27Propositions are t or f

Statements can be Ambiguous12 2 4.Creator: Malik Magdon-IsmailtMaking Precise Statements: 4 / 27Propositions are t or f

Statements can be Ambiguous12 2 4.22 2 5.Creator: Malik Magdon-IsmailtMaking Precise Statements: 4 / 27Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.fCreator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27(Can you have both?)Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.4if pigs can fly then you get an A.Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27(Can you have both?)Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.4if pigs can fly then you get an A.Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27(Can you have both?)(Pigs can’t fly. So, can you get an A?)Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.4if pigs can fly then you get an A.5There is one soulmate for every person.Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27(Can you have both?)(Pigs can’t fly. So, can you get an A?)Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.4if pigs can fly then you get an A.5There is one soulmate for every person.5(a)(Can you have both?)(Pigs can’t fly. So, can you get an A?)There is a single soul mate that every person shares.Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.4if pigs can fly then you get an A.5There is one soulmate for every person.5(a)There is a single soul mate that every person shares.5(b)every person has their own special soul mate.Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27(Can you have both?)(Pigs can’t fly. So, can you get an A?)Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.4if pigs can fly then you get an A.5There is one soulmate for every person.5(a)There is a single soul mate that every person shares.5(b)every person has their own special soul mate.(Can you have both?)(Pigs can’t fly. So, can you get an A?)Why is ambiguity bad? Proof!Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.4if pigs can fly then you get an A.5There is one soulmate for every person.5(a)There is a single soul mate that every person shares.5(b)every person has their own special soul mate.Why is ambiguity bad? Proof!We asked questions of our friends to prove 5(b).Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27(Can you have both?)(Pigs can’t fly. So, can you get an A?)A says Sue’s their soul mate;B says Joe’s their soul mate;C says Sue’s their soul mate;D’s soul mate is a red Porshe;E says Sue’s their soul mate;F says Sam’s their soul mate.Propositions are t or f

Statements can be Ambiguous12 2 4.t22 2 5.f3You may have cake or ice-cream.4if pigs can fly then you get an A.5There is one soulmate for every person.5(a)There is a single soul mate that every person shares.5(b)every person has their own special soul mate.Why is ambiguity bad? Proof!We asked questions of our friends to prove 5(b).Pop Quiz How to prove 5(a)?Creator: Malik Magdon-IsmailMaking Precise Statements: 4 / 27(Can you have both?)(Pigs can’t fly. So, can you get an A?)A says Sue’s their soul mate;B says Joe’s their soul mate;C says Sue’s their soul mate;D’s soul mate is a red Porshe;E says Sue’s their soul mate;F says Sam’s their soul mate.Propositions are t or f

Propositions are t or fWe use the letters p, q, r, s, . . . to represent propositions.p: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tTo get complex statements, combine basic propositions using logical connectors.Creator: Malik Magdon-IsmailMaking Precise Statements: 5 / 27Compound Propositions

Compound Propositionsp: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tConnectorSymbolnot pCreator: Malik Magdon-IsmailAn example in wordsMaking Precise Statements: 6 / 27Negation (not), p

Compound Propositionsp: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tConnectorSymbolnot pCreator: Malik Magdon-IsmailAn example in wordsit is not the case that (Porky the pig can fly)Making Precise Statements: 6 / 27Negation (not), p

Compound Propositionsp: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tConnectorSymbolnot pandp qCreator: Malik Magdon-IsmailAn example in wordsit is not the case that (Porky the pig can fly)Making Precise Statements: 6 / 27Negation (not), p

Compound Propositionsp: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tConnectorSymbolnot pandp qCreator: Malik Magdon-IsmailAn example in wordsit is not the case that (Porky the pig can fly)(Porky the pig can fly) and (You got an A)Making Precise Statements: 6 / 27Negation (not), p

Compound Propositionsp: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tConnectorSymbolnot pandp qorp qCreator: Malik Magdon-IsmailAn example in wordsit is not the case that (Porky the pig can fly)(Porky the pig can fly) and (You got an A)Making Precise Statements: 6 / 27Negation (not), p

Compound Propositionsp: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tConnectorSymbolnot pandp q(Porky the pig can fly) and (You got an A)orp q(Porky the pig can fly) or (You got an A)Creator: Malik Magdon-IsmailAn example in wordsit is not the case that (Porky the pig can fly)Making Precise Statements: 6 / 27Negation (not), p

Compound Propositionsp: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tConnectorSymbolnot pandp q(Porky the pig can fly) and (You got an A)orp q(Porky the pig can fly) or (You got an A)if. . . then. . .p qCreator: Malik Magdon-IsmailAn example in wordsit is not the case that (Porky the pig can fly)Making Precise Statements: 6 / 27Negation (not), p

Compound Propositionsp: Porky the pig can fly.fq : You got an A.t?r: Kilam is an American.t?s: 42 is even.tConnectorSymbolnot pandp q(Porky the pig can fly) and (You got an A)orp q(Porky the pig can fly) or (You got an A)if. . . then. . .p qif (Porky the pig can fly) then (You got an A)Creator: Malik Magdon-IsmailAn example in wordsit is not the case that (Porky the pig can fly)Making Precise Statements: 6 / 27Negation (not), p

Negation (not), pThe negation p is t when p is f, and the negation p is f when p is t.Creator: Malik Magdon-IsmailMaking Precise Statements: 7 / 27Conjunction (and), p q

Negation (not), pThe negation p is t when p is f, and the negation p is f when p is t.“Porky the pig can fly” is fCreator: Malik Magdon-IsmailMaking Precise Statements: 7 / 27Conjunction (and), p q

Negation (not), pThe negation p is t when p is f, and the negation p is f when p is t.“Porky the pig can fly” is fSo,it is not the case that (Porky the pig can fly) is tCreator: Malik Magdon-IsmailMaking Precise Statements: 7 / 27Conjunction (and), p q

Conjunction (and), p qBoth p and q must be t for p q to be t; otherwise p q is f.Creator: Malik Magdon-IsmailMaking Precise Statements: 8 / 27Disjunction (or), p q

Conjunction (and), p qBoth p and q must be t for p q to be t; otherwise p q is f.“Porky the pig can fly” is fCreator: Malik Magdon-IsmailMaking Precise Statements: 8 / 27Disjunction (or), p q

Conjunction (and), p qBoth p and q must be t for p q to be t; otherwise p q is f.“Porky the pig can fly” is fWe don’t know whether “You got an A”.Creator: Malik Magdon-IsmailMaking Precise Statements: 8 / 27Disjunction (or), p q

Conjunction (and), p qBoth p and q must be t for p q to be t; otherwise p q is f.“Porky the pig can fly” is fWe don’t know whether “You got an A”.It does not matter.Creator: Malik Magdon-IsmailMaking Precise Statements: 8 / 27Disjunction (or), p q

Conjunction (and), p qBoth p and q must be t for p q to be t; otherwise p q is f.“Porky the pig can fly” is fWe don’t know whether “You got an A”.It does not matter.(Porky the pig can fly) (You got an A) is fCreator: Malik Magdon-IsmailMaking Precise Statements: 8 / 27Disjunction (or), p q

Disjunction (or), p qBoth p and q must be f for p q to be f; otherwise p q is t.Creator: Malik Magdon-IsmailMaking Precise Statements: 9 / 27Truth Tables

Disjunction (or), p qBoth p and q must be f for p q to be f; otherwise p q is t.“Porky the pig can fly” is fCreator: Malik Magdon-IsmailMaking Precise Statements: 9 / 27Truth Tables

Disjunction (or), p qBoth p and q must be f for p q to be f; otherwise p q is t.“Porky the pig can fly” is fWe don’t know whether “You got an A”.Creator: Malik Magdon-IsmailMaking Precise Statements: 9 / 27Truth Tables

Disjunction (or), p qBoth p and q must be f for p q to be f; otherwise p q is t.“Porky the pig can fly” is fWe don’t know whether “You got an A”.Now it matters.Creator: Malik Magdon-IsmailMaking Precise Statements: 9 / 27Truth Tables

Disjunction (or), p qBoth p and q must be f for p q to be f; otherwise p q is t.“Porky the pig can fly” is fWe don’t know whether “You got an A”.Now it matters.(Porky the pig can fly) (You got an A) is t or f(Depends on whether you got an A.)Creator: Malik Magdon-IsmailMaking Precise Statements: 9 / 27Truth Tables

Disjunction (or), p qBoth p and q must be f for p q to be f; otherwise p q is t.“Porky the pig can fly” is fWe don’t know whether “You got an A”.Now it matters.(Porky the pig can fly) (You got an A) is t or f(Depends on whether you got an A.)Pop Quiz: “You can have cake” or “You can have ice-cream.” Can you have both?Creator: Malik Magdon-IsmailMaking Precise Statements: 9 / 27Truth Tables

Truth TablespftCreator: Malik Magdon-IsmailMaking Precise Statements: 10 / 27Implication (if. . . then. . . ), p q

Truth TablesCreator: Malik Magdon-Ismailp pfttfMaking Precise Statements: 10 / 27Implication (if. . . then. . . ), p q

Truth TablesCreator: Malik Magdon-Ismailpq pffttftftttffMaking Precise Statements: 10 / 27Implication (if. . . then. . . ), p q

Truth TablesCreator: Malik Magdon-Ismailpq pffttftftttffp qMaking Precise Statements: 10 / 27Implication (if. . . then. . . ), p q

Truth TablesCreator: Malik Magdon-Ismailpq pp qffttftftttffffftMaking Precise Statements: 10 / 27Implication (if. . . then. . . ), p q

Truth TablesCreator: Malik Magdon-Ismailpq pp qffttftftttffffftMaking Precise Statements: 10 / 27p qImplication (if. . . then. . . ), p q

Truth TablesCreator: Malik Magdon-Ismailpq pp qp qffttftftttffffftftttMaking Precise Statements: 10 / 27Implication (if. . . then. . . ), p q

Truth Tablespq pp qp qffttftftttffffftftttThe truth table defines the “meaning” of these logical connectors.Creator: Malik Magdon-IsmailMaking Precise Statements: 10 / 27Implication (if. . . then. . . ), p q

Implication (if. . . then. . . ), p qif “Porky the pig can fly” then “You got an A.”Creator: Malik Magdon-IsmailMaking Precise Statements: 11 / 27(t/f?)Adding New Information: p is t

Implication (if. . . then. . . ), p qif “Porky the pig can fly” then “You got an A.”(t/f?)Suppose T . Since pigs can’t fly, does it mean you can’t get an A?Creator: Malik Magdon-IsmailMaking Precise Statements: 11 / 27Adding New Information: p is t

Implication (if. . . then. . . ), p qif “Porky the pig can fly” then “You got an A.”(t/f?)Suppose T . Since pigs can’t fly, does it mean you can’t get an A?if “n2 is even”, then “n is even.”Creator: Malik Magdon-Ismail(t)Making Precise Statements: 11 / 27Adding New Information: p is t

Implication (if. . . then. . . ), p qif “Porky the pig can fly” then “You got an A.”(t/f?)Suppose T . Since pigs can’t fly, does it mean you can’t get an A?if “n2 is even”, then “n is even.”(t)Suppose n2 is even. Can we conclude n 6 5?Creator: Malik Magdon-IsmailMaking Precise Statements: 11 / 27Adding New Information: p is t

Implication (if. . . then. . . ), p qif “Porky the pig can fly” then “You got an A.”(t/f?)Suppose T . Since pigs can’t fly, does it mean you can’t get an A?if “n2 is even”, then “n is even.”(t)Suppose n2 is even. Can we conclude n 6 5?if “it rained last night” then “the grass is wet.”Creator: Malik Magdon-IsmailMaking Precise Statements: 11 / 27(t)Adding New Information: p is t

Implication (if. . . then. . . ), p qif “Porky the pig can fly” then “You got an A.”(t/f?)Suppose T . Since pigs can’t fly, does it mean you can’t get an A?if “n2 is even”, then “n is even.”(t)Suppose n2 is even. Can we conclude n 6 5?if “it rained last night” then “the grass is wet.”(t)p : it rained last nightq : the grass is wetp qCreator: Malik Magdon-IsmailMaking Precise Statements: 11 / 27Adding New Information: p is t

Implication (if. . . then. . . ), p qif “Porky the pig can fly” then “You got an A.”(t/f?)Suppose T . Since pigs can’t fly, does it mean you can’t get an A?if “n2 is even”, then “n is even.”(t)Suppose n2 is even. Can we conclude n 6 5?if “it rained last night” then “the grass is wet.”(t)p : it rained last nightq : the grass is wetp qWhat does it mean for this common-sense implication to be true?Creator: Malik Magdon-IsmailMaking Precise Statements: 11 / 27Adding New Information: p is t

Implication (if. . . then. . . ), p qif “Porky the pig can fly” then “You got an A.”(t/f?)Suppose T . Since pigs can’t fly, does it mean you can’t get an A?if “n2 is even”, then “n is even.”(t)Suppose n2 is even. Can we conclude n 6 5?if “it rained last night” then “the grass is wet.”(t)p : it rained last nightq : the grass is wetp qWhat does it mean for this common-sense implication to be true?What can you conclude? Did it rain last night? Is the grass wet?Creator: Malik Magdon-IsmailMaking Precise Statements: 11 / 27Adding New Information: p is t

Adding New Information to a True Implication: p is tif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWeather report in morning paper: rain last night.Creator: Malik Magdon-IsmailMaking Precise Statements: 12 / 27 new informationAdding New Information: q is t

Adding New Information to a True Implication: p is tif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWeather report in morning paper: rain last night. new informationif (it rained last night) then (the grass is wet) tIt rained last night (from the weather report)tIs the grass wet?Creator: Malik Magdon-IsmailYES!Making Precise Statements: 12 / 27Adding New Information: q is t

Adding New Information to a True Implication: p is tif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWeather report in morning paper: rain last night.if (it rained last night) then (the grass is wet) tIt rained last night (from the weather report)tIs the grass wet?YES! new informationp q tpt qtFor a true implication p q , when p is t, you can conclude q is t.Creator: Malik Magdon-IsmailMaking Precise Statements: 12 / 27Adding New Information: q is t

Adding New Information to a True Implication: q is tif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWhile picking up the morning paper, you see wet grass.Creator: Malik Magdon-IsmailMaking Precise Statements: 13 / 27 new informationAdding New Information p is f

Adding New Information to a True Implication: q is tif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWhile picking up the morning paper, you see wet grass. new informationif (it rained last night) then (the grass is wet) tThe grass is wet (from walking outside)tDid it rain last night?Creator: Malik Magdon-IsmailMaking Precise Statements: 13 / 27Adding New Information p is f

Adding New Information to a True Implication: q is tif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWhile picking up the morning paper, you see wet grass.if (it rained last night) then (the grass is wet) tThe grass is wet (from walking outside)tDid it rain last night? new informationp q tqt pt or fFor a true implication p q , when q is t, you cannot conclude p is t.Creator: Malik Magdon-IsmailMaking Precise Statements: 13 / 27Adding New Information p is f

Adding New Information to a True Implication: p is fif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWeather report in morning paper: no rain last night.Creator: Malik Magdon-IsmailMaking Precise Statements: 14 / 27 new informationAdding New Information p is f

Adding New Information to a True Implication: p is fif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWeather report in morning paper: no rain last night.if (it rained last night) then (the grass is wet) tIt rained last night (from the weather report)fIs the grass wet? new informationp q tpf qt or fFor a true implication p q , when p is f, you cannot conclude q is f.Creator: Malik Magdon-IsmailMaking Precise Statements: 14 / 27Adding New Information p is f

Adding New Information to a True Implication: q is fif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWhile picking up the paper, you see dry grass.Creator: Malik Magdon-IsmailMaking Precise Statements: 15 / 27 new informationNew Information (Summary)

Adding New Information to a True Implication: q is fif “it rained last night” then “the grass is wet.”p : it rained last nightq : the grass is wetp qWhile picking up the paper, you see dry grass.if (it rained last night) then (the grass is wet) tIt grass is wet (from walking outside)fDid it rain last night? new informationp q tqf pfFor a true implication p q , when q is f, you can conclude p is f.Creator: Malik Magdon-IsmailMaking Precise Statements: 15 / 27New Information (Summary)

Implication: Inferences When New Information ComesFor a true implication p q :When p is t, you can conclude that q is t.When q is t, you cannot conclude p is t.When p is f, you cannot conclude q is f.When q is f, you can conclude p is f.Creator: Malik Magdon-IsmailMaking Precise Statements: 16 / 27Falsifying an Implication

Implication: Inferences When New Information ComesFor a true implication p q :When p is t, you can conclude that q is t.When q is t, you cannot conclude p is t.When p is f, you cannot conclude q is f.When q is f, you can conclude p is f.if (Porky the pig can fly) then (You got an A) Creator: Malik Magdon-Ismail{zf}Making Precise Statements: 16 / 27 {zcan be t or f (phew)}Falsifying an Implication

Falsifying “if (it rained last night) then (the grass is wet)”You are a scientist collecting data to verify that the implication is valid (true).Creator: Malik Magdon-IsmailMaking Precise Statements: 17 / 27Implication is Important

Falsifying “if (it rained last night) then (the grass is wet)”You are a scientist collecting data to verify that the implication is valid (true).One night it rained. That morning the grass was dry.Creator: Malik Magdon-IsmailMaking Precise Statements: 17 / 27 new informationImplication is Important

Falsifying “if (it rained last night) then (the grass is wet)”You are a scientist collecting data to verify that the implication is valid (true).One night it rained. That morning the grass was dry. new informationWhat do you think about the implication now?Creator: Malik Magdon-IsmailMaking Precise Statements: 17 / 27Implication is Important

Falsifying “if (it rained last night) then (the grass is wet)”You are a scientist collecting data to verify that the implication is valid (true).One night it rained. That morning the grass was dry. new informationWhat do you think about the implication now?This is a falsifying scenario.if (it rains) then (the grass is wet) not tp q is f only when p is t and q is f. In all other cases p q is t.Creator: Malik Magdon-IsmailMaking Precise Statements: 17 / 27Implication is Important

Implication is Extremely Important, p qAll these are p q (p “it rained last night” and q “the grass is wet”):If it rained last night then the grass is wet.Creator: Malik Magdon-IsmailMaking Precise Statements: 18 / 27if p then qExample

Implication is Extremely Important, p qAll these are p q (p “it rained last night” and q “the grass is wet”):If it rained last night then the grass is wet.It rained last night implies the grass is wet.Creator: Malik Magdon-IsmailMaking Precise Statements: 18 / 27if p then qp implies qExample

Implication is Extremely Important, p qAll these are p q (p “it rained last night” and q “the grass is wet”):If it rained last night then the grass is wet.It rained last night implies the grass is wet.It rained last night only if the grass is wet.Creator: Malik Magdon-IsmailMaking Precise Statements: 18 / 27if p then qp implies qp only if qExample

Implication is Extremely Important, p qAll these are p q (p “it rained last night” and q “the grass is wet”):If it rained last night then the grass is wet.It rained last night implies the grass is wet.It rained last night only if the grass is wet.The grass is wet if it rained last night.Creator: Malik Magdon-IsmailMaking Precise Statements: 18 / 27if p then qp implies qp only if qq if pExample

Implication is Extremely Important, p qAll these are p q (p “it rained last night” and q “the grass is wet”):If it rained last night then the grass is wet.It rained last night implies the grass is wet.It rained last night only if the grass is wet.The grass is wet if it rained last night.The grass is wet whenever it rains.if p then qp implies qp only if qq if pq whenever pTruth Tables:Creator: Malik Magdon-Ismailpq pp qp qp qffttftftttffffftftttttftMaking Precise Statements: 18 / 27Example

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwherep : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Creator: Malik Magdon-IsmailMaking Precise Statements: 19 / 27pqrffffttttffttffttftftftftEquivalent Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwherep : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Creator: Malik Magdon-IsmailMaking Precise Statements: 19 / 27pqr (p q)ffffttttffttffttftftftftffttttttEquivalent Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwherep : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Creator: Malik Magdon-IsmailMaking Precise Statements: 19 / 27pqr (p q) (p q) t Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwherep : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Creator: Malik Magdon-IsmailMaking Precise Statements: 19 / 27pqr(p q) rffffttttffttffttftftftftttftftftEquivalent Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rYou are thirsty: q is t.Creator: Malik Magdon-Ismailwherep : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Making Precise Statements: 19 / 27pqr(p q) rffffttttffttffttftftftftttftftftEquivalent Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwhereYou are thirsty: q is t. In both cases r is t.(you visit the cafeteria)Creator: Malik Magdon-Ismailp : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Making Precise Statements: 19 / 27pqr(p q) rffffttttffttffttftftftftttftftftEquivalent Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwhereYou are thirsty: q is t. In both cases r is t.(you visit the cafeteria)You did visit the cafeteria: r is t.Creator: Malik Magdon-Ismailp : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Making Precise Statements: 19 / 27pqr(p q) rffffttttffttffttftftftftttftftftEquivalent Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwhereYou are thirsty: q is t. In both cases r is t.(you visit the cafeteria)You did visit the cafeteria: r is t.Are you hungry? We don’t know.Are you thirsty? We don’t know.(You accompanied your hungry friend (row 2).)Creator: Malik Magdon-Ismailp : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Making Precise Statements: 19 / 27pqr(p q) rffffttttffttffttftftftftttftftftEquivalent Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwhereYou are thirsty: q is t. In both cases r is t.(you visit the cafeteria)You did visit the cafeteria: r is t.Are you hungry? We don’t know.Are you thirsty? We don’t know.(You accompanied your hungry friend (row 2).)You did not visit the cafeteria: r is f.Creator: Malik Magdon-Ismailp : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Making Precise Statements: 19 / 27pqr(p q) rffffttttffttffttftftftftttftftftEquivalent Compound Statements

Example:if (you are hungry or you are thirsty) then you visit the cafeteria(p q) rwhereYou are thirsty: q is t. In both cases r is t.(you visit the cafeteria)You did visit the cafeteria: r is t.Are you hungry? We don’t know.Are you thirsty? We don’t know.(You accompanied your hungry friend (row 2).)You did not visit the cafeteria: r is f.p and q are both f.(You are neither hungry nor thirsty.)Creator: Malik Magdon-Ismailp : you are hungryq : you are thirstyr : you visit the cafeteria1.2.3.4.5.6.7.8.Making Precise Statements: 19 / 27pqr(p q) rffffttttffttffttftftftftttftftftEquivalent Compound Statements

Equivalent Compound Statementspffttqftftp qttft q pttft p qttftq ptfttrains wet grassdry grass no rainno rain wet grasswet grass raineqveqvp q q p p qCreator: Malik Magdon-IsmailMaking Precise Statements: 20 / 27Proving an Implication

Equivalent Compound Statementspffttqftftp qttft q pttft p qttftq ptfttrains wet grassdry grass no rainno rain wet grasswet grass raineqveqvp q q p p qOrder is very important: p q and q p do not mean the same thing.if I’m dead, then my eyes are closedCreator: Malik Magdon-Ismailvs.if my eyes are closed, then I’m deadMaking Precise Statements: 20 / 27Proving an Implication

Equivalent Compound Statementspffttqftftp qttft q pttft p qttftq ptfttrains wet grassdry grass no rainno rain wet grasswet grass raineqveqvp q q p p qOrder is very important: p q and q p do not mean the same thing.if I’m dead, then my eyes are closedvs.if my eyes are closed, then I’m deadPop Quiz 3.5. Compound propositions are used for program control flow, especially if. . . then. . . .if(x 0 k (y 1 && x y))Execute some instructions.if(x 0 k y 1)Execute some instructions.Use truth-tables to show that both do the same thing. Which do you prefer and why?Creator: Malik Magdon-IsmailMaking Precise Statements: 20 / 27Proving an Implication

Proving an Implication: Reasoning Without Factsif (n2 is even) then (n is even).p : n2 is evenq : n is evenp qpqp qffttftftttftWhat is n? How to prove?Creator: Malik Magdon-IsmailMaking Precise Statements: 21 / 27Quantifiers

Proving an Implication: Reasoning Without Factsif (n2 is even) then (n is even).p : n2 is evenq : n is evenp qpqp qffttftftttftWhat is n? How to prove?We must show that the highlighted row cannot occur.Creator: Malik Magdon-IsmailMaking Precise Statements: 21 / 27Quantifiers

Proving an Implication: Reasoning Without Factsif (n2 is even) then (n is even).p : n2 is evenq : n is evenp qpqp qffttftftttftWhat

Last Time 1 Sets, {3,5,11} 2 Sequences, 100111001 3 Graphs, C A D B E F 4 Examples of basic proofs. In 4 rounds of group dating, no one meets more than 12 people. x2 is even “is the same as” x is even. In any group of 6 people there is an orgy of 3 mutual friends or a war of 3 mutual enemies. Axiom: The Well-Ordering Principle 2 is not