Logic and Proofs Jeff Edmonds York University Lecture 1 Propositional Logic And, Or, Not, Implies Predicates and Quantifiers boys b, Loves(b) Quick Examples Notation Truth Tables What This Logic Is and Is Not Venn Diagrams Tautologies, Equivs, Proofs Arguing Our Rules/Lemmas • And vs Or • Implies • Deduction • Cases • Contradiction • Distributive • Review Example Proofs • Tautologies, Equivs, Proofs • Axiom Schema (Darwin) • Prove No Racism Objects, Predicates, & Relations & Order of Quantifiers: vs Quantifiers and Games Humans are Mortal Reals Formal Proofs Systems (More EECS1090): Review Things cut out (More EECS1090): Puzzle 1. All snakes are reptiles 2. Some reptiles hatch their eggs themselves Animals Reptiles Snakes Hatch Themselves Can we conclude: Some snakes hatch their eggs themselves? Y/N No: It could be all the reptiles that hatch themselves are not snakes. A single counter example suffices. Puzzle 1. All snakes are reptiles 2. All reptiles are animals and lay eggs 3. Many snakes only have one lung Animals Lay Eggs Reptiles Snakes Can we conclude: Some animals that lay eggs only have one lung. Yes: Proof by example/picture does not suffice. One lung Puzzle 1. All snakes are reptiles 2. All reptiles are animals and lay eggs 3. Many snakes only have one lung Animals Lay Eggs Reptiles Snakes One lung Similar to many questions in course/degree/life • Read question in English • Assign variables to each atomic true/false logical proposition/statement/assertion. • Translate what you know and the question into logic. • Solve the logic using logic rules, formal, and informal proofs • Translate solution back to English. Puzzle 1. All snakes are reptiles 2. All reptiles are animals and lay eggs 3. Many snakes only have one lung Animals Lay Eggs Reptiles Snakes X One lung exists Goal: x, animal(x) & eggs(x) & onelung(x) forall 1. ∀x, snake(x) reptile(x) 2. ∀x, reptile(x) (animal(x) & eggs(x)) 3. x, snake(x) & onelung(x) 4. Let X be such that snake(X) & onelung(X) 5. snake(X) 6. reptile(X) 7. animal(X) & eggs(X) 8. animal(X) & eggs(X) & onelung(X) 9. x, animal(x) & eggs(x) & onelung(x) Some animals that lay eggs only have one lung. Given Given Given By 3 By 4 By 1 & 5 By 2 & 6 By 5 & 7 By 8 In English Puzzle 1. All snakes are reptiles 2. All reptiles are animals and lay eggs 3. Many snakes only have one lung Animals Lay Eggs Reptiles Snakes One lung Similar to many questions in course/degree/life • Read question in English • Assign variables to each atomic true/false logical proposition/statement/assertion. • Translate what you know and the question into logic. • Solve the logic using logic rules, formal, and informal proofs • Translate solution back to English. Quick Examples You can have (ham and eggs)or porridge You can have coffee and(eggs or porridge) Aaaaaah! Restaurants: exclusive or Logic: inclusive or Quick Examples True/False Variables: L1 “Mrs Peacock loves Colonel Mustard” L2 “Colonel Mustard loves Miss Scarlet” K “it happened in the kitchen” P “Mrs Peacock committed the murder”. Quick Examples If L1 “Mrs Peacock loves Colonel Mustard” and L “Colonel Mustard loves Miss Scarlet” 2 and K “it happened in the kitchen” then P “Mrs Peacock committed the murder”. L1and L2 and KP If all on left are true, then that on right is true. Quick Examples If L1 “Mrs Peacock loves Colonel Mustard” and L “Colonel Mustard loves Miss Scarlet” 2 and K “it happened in the kitchen” then P “Mrs Peacock committed the murder”. L1and L2 and KP P and and or or K (L1 L2 K ) ≡ L1 L2 These can’t all At least one of these be true. must be false Notation Proof System Notation: Variables (true/false) • P, Q Formulas (true/false) • α, β: α and β are true. • αβ: is shaped like A for And. α or β are true (or both) a bucket to put anything • αβ: Not α. • α • αβ: If α, then β. hound dog • α iff β: α if and only β. hound dog Exclusive or (not both). Parity. • αβ: “Meta” Notation: ie not within the proof system. • αβ: If α is a line in the proof, then β can be the next line. • α⊢β: If α is an axiom, then β can be proved. i.e. αα1α2…β • α⊧β: If α, then β. (αβ states our universe having has property. α⊧β states true in every universe.) Notation Instead of Φ ≡ x y ⌐(αβ) γδωµπσ Γ = {Φ, } Feel free to write Forall x exits y -(a or b) --> g & d & w & u & p & s Multiplication and Addition Tables Sometimes, we evaluate a formula given a specific assignment. Evaluate with x=2 and y=3. (x+y)y (2+3)3 5 3 15 x y (x+y)y 2 3 15 Multiplication and Addition Tables (x+y)y (2+4)4 6 4 24 Evaluate with x=2 and y=4. x y (x+y)y 2 3 15 4 24 2 Multiplication and Addition Tables Sometimes, (x+y)y we want to know ≡ how it does on ALL (xy) + (yy) ∞ assignments. Distributive Sometimes, Law we use this is our reasoning about life. x y (x+y)y 2 3 15 This 24 2 4Equivalence … is a Tautology/Valid (ie always true) Operator's Truth Tables Q Q and T P F T T F F F F P Sometimes, we evaluate a formula given a specific assignment. Evaluate with A=T and B=F. Sometimes, we want to know how it does on 2n ALL assignments. or T F T T T F T F or Q not P implies T F F T P T F T T F F T T and (AB) (AB) (TF) (TF) T F F A B T T T F F T F F (AB) (AB) F Operator's Truth Tables Q Q and T P F T T F F F F P or T F T T T F T F or Evaluate with A=T and B=T. not P implies T F F T P T F T T F F T T and (AB) (AB) (TT) (TT) Knowing T thatT at leastTone is true, does not imply that both are true. Sometimes, we want to know how it does on ALL 2n assignments. Q A B (AB) (AB) T T T T F F F T F F F T Sometimes, we use this is our reasoning about life. Operator's Truth Tables Q Q and T P F T T F F F F P or T F T T T F T F or not P Evaluate with A=T and B=F. implies T F F T P T F T T F F T T and (AB) (AB) and Q A B (AB) (AB) T T T T F F F T F F F T A B (AB) (AB) T T T F F T F F or (AB) (AB) (TF) (TF) F T T T Operator's Truth Tables Q Q and T P F T T F F F F P or T F T T T F T F or not P implies T F F T P T F T T F F T T and (AB) (AB) and Q A B (AB) (AB) T T T T F F F T F F F T A B (AB) (AB) T T T or (AB) (AB) Knowing that both are true, implies that at least one is true. T F F ThisT is a T Tautology/Valid T T true) F always (ie F Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T T T F T T F T F F T T F F T F T F T T F T F F F T T F F Connectors: , , , , iff, , … • And (PQ): P and Q are both true. – It is raining and I am wet Q P T F T T F F F F Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T T T F T T F T F F T T F F T F T F T T F T F F F T T F F Connectors: , , , , iff, , … • And (PQ…R): All of P, Q, and R are true. – It is raining and I am wet and I am outside – We don’t add brackets because ((PQ)R) = (P(QR)) Q P T F T T F F F F Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T T T F T T F T F F T T F F T F T F T T F T F F F T T F F Connectors: , , , , iff, , … • And (PQ…R): All of P, Q, and R are true. • Or (PQ…R): At least one of P, Q, and R are true. Q P T F T F T T F T T T F F F F T F Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T T T F T T F T F F T T F F T F T F T T F T F F F T T F F Connectors: , , , , iff, , … • And (PQ…R): All of P, Q, and R are true. • Or (PQ…R): At least one of P, Q, and R are true. • Negation (P): Has the flipped true/false value. P T F T F T T F T T T T F F F F F T F F T Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ TT T T F T T F TF F T T F F T F T F T T F T F F F T T F F Connectors: , , , , iff, , … • And (PQ…R): All of P, Q, and R are true. • Or (PQ…R): At least one of P, Q, and R are true. • Negation (P): Has the flipped true/false value. • Implies (PQ): If P is true then so is Q. Q P T F T F T T F T T T T F F F F T F F T F F T T F T F F T Possibilities: • P being true causes Q to be true • Q being true causes P to be true • R being true causes P and Q to be true • Impossible for P and Q. • Coincident In statistics, the mantra is “Correlation Causation” Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T T T F T T F T F F T T F F T F T F T T F T F F F T T F F Connectors: , , , , iff, , … • And (PQ…R): All of P, Q, and R are true. • Or (PQ…R): At least one of P, Q, and R are true. • Negation (P): Has the flipped true/false value. • Implies (PQ): If P is true then so is Q. – If P is false, then (PQ) is true no matter what Q is. Q “hound” “dog” P T F T F T T F T T T T F F F F T F F T F F T T F T F T T is true even if “hound”. Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T=T T T F T T F T F F T T F F T F T F T T F T F=F F F T T F Connectors: , , , , iff, , … • And (PQ…R): All of P, Q, and R are true. • Or (PQ…R): At least one of P, Q, and R are true. • Negation (P): Has the flipped true/false value. • Implies (PQ): If P is true then so is Q. • If and only if (P iff Q): P and Q are both true or both false. Q P T F T F T T F T T T T F F F F T F F T F iff T F F T T F T T F T F T T F F T Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T T T F T T F T F F T T F F T F T F T T F T F F F T T F F Connectors: , , , , iff, , … • Exclusive-Or (PQ): One has be true but not both. You can have eggs or porridge But not both! Q P T F T F T T F T T T T F F F F T F F T F iff T F T F F T T F T T F T F T T F T T F F T F T F Operator's Truth Tables And Or P Q PQ PQ T=T T F All combinations F T F=F 2 1 1 0 Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T F T T F F T T F F T F T T F T F F T T F Connectors: , , , , iff, , … • Exclusive-Or (PQ): One has be true but not both. P and Q have the opposite values. – Parity (PQ…R): The number of true variables is odd. Q P T F T F T T F T T T T F F F F T F F T F iff T F T F F T T F T T F T F T T F T T F F T F T F Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T T T F T T F T F F T T F F T F T F T T F T F F F T T F F Connectors: , , , , iff, , … • Exclusive-Or (PQ): One has be true but not both. P and Q have the opposite values. – Parity (PQ…R): The number of true variables is odd. This is because if you flip the value of any of these variables, the result always changes. We love this function because it is sensitive to each variable. P T F T F T T F T T T T F F F F T F F T F iff T F T F F T T F T T F T F T T F T T F F T F T F Operator's Truth Tables And Or P Q PQ PQ All combinations Not Implies If and only if Exclusive Or Q PQ P iff Q PQ T T T T F T T 0 T F F T T F F 1 F T F T T F 1 F F F T T 0 F Connectors: , , , , iff, , … • Exclusive-Or (PQ): One has be true but not both. P and Q have the opposite values. – Parity (PQ…R): The number of true variables is odd. – Boolean Addition: 1+0+1+1+0 = 3 =mod2 1 Translate truth to 1 and false to 0. The # of truth is 1+0+1+1+0 = 3 T F +mod2 1 Taken mod2 is the 1 T F T 1 0 # is odd. F T F 0 1 0 1 0 Electronic circuits Values: • 0 ≈ False ≈ off ≈ 0 volts • 1 ≈ True ≈ on ≈ 5 volts Gates: Can compute any Boolean function: Boolean strings: What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. Eg: “All people are created equal” “We are all equal, just some of us are more equal than others.” I like this as a statement about inequity But even more as a joke about logic. In Propositional Logic, each formula/variable evaluates to true/false. These are combined with Not, And, Or, Implies, and Iff Sentences are equivalent , , , , iff ≡ 32 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. In contrast, Predicate Logic (next topic) talks about the properties of objects. Parent(x,y) ≡ “x is y’s parent” Daughter(y,x) iff Parent(x,y)Female(y) 33 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α≡ You may talk about But this has no place in this class! β≡ α is either true or false or independent of what we know. Not knowing is cause by not knowing which universe/model/ interpretation/assignment we are in. In each of these, α is either true or false. 34 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α≡ You may talk about β≡ α is either true or false or independent of what we know. There is no gray. But this has no place in this class! 35 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α≡ You may talk about β≡ α is either true or false or independent of what we know. Hoping will not help. But this has no place in this class! 36 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α≡ You may talk about β≡ α is either true or false or independent of what we know. We won’t consider different people with different beliefs. And we are never wrong. But this has no place in this class! 37 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α≡ You may talk about β≡ α is either true or false or independent of what we know. There are no probability distributions. And hence no “likely”? But this has no place in this class! 38 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α≡ You may talk about But this has no place in this class! β≡ α is either true or false or independent of what we know. There is no time. The answer does not change. And hence no “now” or “later”. 39 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α≡ You may talk about β≡ It is not possible that and β is false and αβ is true. and This is by definition of . When you don’t know you can say “maybe”. 40 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α≡ You may talk about β≡ αβ means: “If is α true, then so is β.” But ….. there is no sense of causality. AAAAAH ! This is the confusing one! But this has no place in this class! 41 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. β α α β or αβ T F T T T T T T T F T F T F F T T F F F Just like the table that states 4+3=7, we have table for αβ. αβ means: “If is α true, then so is β.” But ….. there is no sense of causality. 42 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. α β αβ T T T T F F F T F F β T α F Just like the table that states 4+3=7, we have table for αβ. And for αβ. αβ means: “If is α true, then so is β.” But ….. there is no sense of causality. 43 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. β T α T F T F α β αβ T T T F F T F F T If α=β=T, then αβ is clearly true. This is the example, αβ was meant for. αβ means: “If is α true, then so is β.” But ….. there is no sense of causality. 44 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. β α α β αβ T F T T T T F T F F F T F F F T If α=T and β=F, then αβ is clearly false. This is another example, αβ was meant for. αβ means: “If is α true, then so is β.” But ….. there is no sense of causality. 45 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. β α α β αβ and αβ T F T T T T T F T F F F T ? F T T ? F F F T ? F F T T ? If α=F, then αβ is ???. We don’t know about β. The statement αβ is not useful. But let’s make αβ true. This table is the definition of . If the bottom two are F, Then this operation would be And. αβ means: “If is α true, then so is β.” But ….. there is no sense of causality. 46 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. β α α β αβ Hound Dog HoundDog T F T T T T T T T T F T F F T F F F T T F T T F T T F F T F F T If α=F, then αβ is ???. We don’t know about β. The statement αβ is not useful. But let’s make αβ true. This table is the definition of . αβ means: “If is α true, then so is β.” But ….. there is no sense of causality. No problem! That makes sense. 47 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. β α α β αβ Elephant Pink ElephantPink T F T T T T T T T T F T F F T F F F T T F T T F T T F F T F F T If α=F, then αβ is ???. We don’t know about β. But Let’s make αβ true. This table is the definition of . It is all about the table. If Elephant=Pink=F, then ElephantPink is True. αβ means: “If is α true, then so is β.” But ….. there is no sense of causality. AAAAAH ! This is the confusing one! 48 What Our Logic Is and Is Not Max( A ) “preCond: Input is array A[1..n] of n values.” i=1 m = A[1] loop “loop-invariant: m is max in {A[1]..A[i]}” exit when (i=n) m = max(m,A[i+1]) i=i+1 endloop return(m) “postCond: return max in {A[1]..A[n]}” My boss wants me to write code. He gives me: The contract is preCond postCond Preconditions: Any assumptions that must be true about the input instance. Postconditions: Any statement of what must be true when the algorithm/program returns. I give him: 49 What Our Logic Is and Is Not Max( A ) “preCond: Input is array A[1..n] of n values.” i=1 m = A[1] loop “loop-invariant: m is max in {A[1]..A[i]}” exit when (i=n) m = max(m,A[i+1]) i=i+1 endloop return(m) “postCond: return max in {A[1]..A[n]}” My boss wants me to write code. He gives me: The contract is preCond postCond T T If the client gives us an input that meets the precondition and my program gives an output that meets the postcondition, then everyone is happy. 50 What Our Logic Is and Is Not Max( A ) “preCond: Input is array A[1..n] of n values.” i=1 m = A[1] loop “loop-invariant: m is max in {A[1]..A[i]}” exit when (i=n) m = max(m,A[i+1]) i=i+1 endloop return(m) “postCond: return max in {A[1]..A[n]}” My boss wants me to write code. He gives me: The contract is preCond postCond F F If the client gives us an input that does NOT meet the precondition and my program gives an output that does NOT meet the postcondition, then my boss can’t be mad. My code meets the contract. 51 What Our Logic Is and Is Not Max( A ) My boss wants me to write code. “preCond: He gives me: Input is array A[1..n] The contract is of n values.” preCond postCond i=1 T F m = A[1] The only way to break my contract is if loop the input that meets the precondition “loop-invariant: and my output does NOT meet the postcondition. m is max in {A[1]..A[i]}” exit when (i=n) m = max(m,A[i+1]) i=i+1 endloop return(m) “postCond: return max in {A[1]..A[n]}” 52 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. • An Assignment will tell us the True/False value of all our variables • A Model M will tell us if we are dealing with reals or integers or people. Together we will call this a Universe. There are many possibilities. 53 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. But I don’t know what is true. In a given universe Each sentence is either true or false not both 54 What Our Logic Is and Is Not In English, a Proposition is a statement or assertion. But I don’t know what is true. That is because you do not know which universe we are in. 55 What Our Logic Is and Is Not α β α is true or false β is true or false This gives 4 possibilities. α,β = T,F T,T αβ T T T T F F F T T F F T F,T F,F 56 What Our Logic Is and Is Not α β In which is αβ true? “If is α true, then so is β” can be confusing because people think of causality. α,β = T,F T,T αβ T T T T F F F T T F F T F,T F,F 57 What Our Logic Is and Is Not α β Suppose I tell you αβ. α,β = F,T T,F Instead, use the T,T operation’s table. “It is not true that F α is true β is not.” αβ = T αβ T T T T F F F T T F F T F,F T T 58 What Our Logic Is and Is Not α β Telling you α is true, eliminates other possibilities. α,β = T,F T,T αβ T T T T F F F T T F F T F,T F,F T T F αβ = T 59 What Our Logic Is and Is Not α β In all the worlds remaining possible, β is true. α,β = T,F T,T αβ T T T T F F F T T F F T F,T F,F T T F αβ = T 60 What Our Logic Is and Is Not Modus Ponens: From α and αβ, conclude β. α β “If is α true, then so is β” Hey we still do use this! From this we can conclude …. α,β = T,F T,T αβ T T T T F F F T T F F T F,T F,F T T F αβ = T 61 What Our Logic Is and Is Not Modus Ponens: From α and αβ, conclude β. α β This sentence is said to be a tautology/valid because it is true in every universe. α,β = T,F T,T αβ T T T T F F F T T F F T F,T F,F T T F αβ = T 62 What Our Logic Is and Is Not Modus Ponens: From α and αβ, conclude β. α β This sentence is said to be a tautalogy/valid because it is true in every universe. α,β = T,F T,T αβ T T T T F F F T T F F T F,T F,F T T F αβ = T 63 Different Ways of Expressing p→q if p, then q if p, q p implies q p is sufficient for q q if p q whenever p q follows from p q when p p only if q q is necessary for p ??? Says ¬q→¬p which is the same as p→q Converses of each other. 64 64 Different Ways of Expressing p→q if p, then q if p, q p implies q p is sufficient for q a sufficient condition for q is p q if p q whenever p q follows from p q when p p only if q q is necessary for p a necessary condition for p is q 65 65 Different Ways of Expressing p↔q (p→q) and (q→p). p if and only if q p iff q p is necessary and sufficient for q. p implies q and the converse and conversely. The converse of p→q is q→p. 66 66 Dude! You will be starting with things that are A good martial arts student will attentively repeat each fundamental technique many times. Don’t tune out when a concept is taught more than once. The better students listen carefully in order to refine and develop their understanding. 67 Venn Diagrams α α=T β=F β α=T α=F β=T β=T (αβ) = F (αβ) = T (αβ) = T α = F, β = F, (αβ) = T α β αβ T T T T F F F T T F F T Let this denote the set of all universes/possibilities/people/objects/…. Let this denote those in which α is true. Let this denote those in which is β true. This gives the same four possibilities as in the table. 68 α Venn Diagrams α β β and αβ α α β β Set intersection ie only if both For every object, Obj in set αβ iff in α and in β. Otherwise, falls out of cup . For every universe, αβ is true iff α and β are true. Otherwise, falls out of cup . 69 α Venn Diagrams α β β αβ β For every universe, αβ is true iff α or β are true. Stays in cup . For every object, Obj in set αβ iff in α or in β. Stays in cup . or α α β Set union ie if either 70 ¬α Venn Diagrams α ¬β β and ¬α¬β Which area is green in both iff ¬(αβ) Which area is pictures green in at above? least one or picture? ¬α¬β iff ¬(αβ) De Morgan's Law α α β β Set intersection ie only if both α β Set union ie if either 71 Venn Diagrams and and α¬β α β ¬(α¬β) α β α β and ¬(α¬β) In addition to knowing ¬(α¬β), iff αβ suppose we also know α. We can conclude β. For every object, obj in set α iff in β. α This could be the set of universes I which I am a hound, Or the set of hounds. subset hound dog hound dog 72 Venn Diagrams and and α¬β α β ¬(α¬β) α β and ¬(α¬β) α In addition to knowing ¬(α¬β), iff αβ α iff βα suppose we also know α. iff ¬β¬α We can conclude β. Contrapositive In addition to knowing ¬(α¬β), suppose we also know ¬β. We can conclude ¬α. β subset hound dog hound dog 73 αβ iff ¬β¬α Contrapositive • American Dream ≡ “If you are a good person, then you will be rich. ≡ “If you are not rich, then you are not a good person. 74 or ¬αβ Venn Diagrams and α β ¬(α¬β) β α and ¬(α¬β) In addition to knowing ¬(α¬β), iff αβ iff βα suppose we also know α. iff ¬β¬α We can conclude β. or iff ¬αβ DeMorgan α β subset hound dog hound dog 75 Venn Diagrams In addition to knowing αβ, suppose we also know βγ. We can conclude αγ. Transitivity and ¬(α¬β) iff αβ iff βα iff ¬β¬α or iff ¬αβ γ α β subset hound dog hound dog 76 For every object, Venn Diagrams it is in both or in neither In addition to knowing αβ, in α iif in β. suppose we also know βα. We can conclude β iff α. For every universe, both are true or neigher α is true iff β is true. Equivalence βα α αβ β α β and subset β iff α α β subset hound dog hound dog equal sets 77 Tautologies, Equivalences, & Proofs • Tautology: A proposition that is true under every assignment. or Example: p¬p. • Contradiction: A proposition that is false under every assignment. and Example: p¬p • Satisfiable: A propositions that is true under at least one assignment. p T F ¬p F T p∨¬p T T p∧¬p F F 78 78 Tautologies, Equivalences, & Proofs • Equivalent, p≡q: Two propositions that have same true/false under every assignment. p↔q is a tautology. 2# variables cells!!! > # atoms in the universe. p T T q T F ¬p F F F F T F T T Equivalent Not Equivalent q→p ¬p ∨ q p → q T F T F T T T T T T F T 79 79 Tautologies, Equivalences, & Proofs A Hilbert Style Proof is a sequence of formulas. Hilbert 1920 1. 2. 3. 4. 5. 6. 7. n. 1 2 3 4 5 6 …. • Each line is either: – i Axiomslogical Axiomsnon-logical Logical Axioms: Axiomslogical • A set of formulas that has already been proved to always be true. Non-Logical Axioms Γ: • A set of formulas that have been given by the problem to tbe problem true. 80 Tautologies, Equivalences, & Proofs A Hilbert Style Proof is a sequence of formulas. Hilbert 1920 1. 2. 3. 4. 5. 6. 7. 1 2 3 4 5 6 n. …. • Each line is either: – i Axiomslogical Axiomsnon-logical – Follows from a lemma/rule of the form: “If i and j are lines of your proof, then you can add k as a line of your proof.” – Each such line k should be documented where it came from. • The last line of the proof is our theorem . 81 Tautologies, Equivalences, & Proofs Eval/Build Separating And αβ → α Selecting Or αβ & α → Eval/Build β Cases αβ, αγ, & βγ → γ Modus Ponens α & αβ β → Cases αβ, αγ, & βγ → αβ → → (βγ) α&β β γ α α & β → αγ (αβ) Excluded Middle αα & (αα) Deduction α→β Assume α, prove β Eval/Build β α α & β γβ → αγ → (αβ) → In every possible universe, if the Left-Hand-Side Transitivityis true, then so is & theβγ Right-Hand-Side. αβ → αγ These are very → By Contradiction: From α(β&β), α. importantInconsistent: and we will detail later. From study β and β,them inanything. → 82 Tautologies, Equivalences, & Proofs Here are some very useful equivalences Equivalence α→β & β→α iff α iff β Double Negation: α iff α Commutative: αβ iff βα and αβ iff βα Distributive: γ(αβ) iff (γα)(γβ) and γ(αβ) iff (γα)(γβ) Contrapositive αβ iff βα iff ¬αβ De Morgan's Law ¬(αβ) iff ¬α¬β 83 Tautologies, Equivalences, & Proofs Eval/Build Separating And αβ → α Selecting Or αβ & α → Eval/Build β Cases αβ, αγ, & βγ → γ Modus Ponens α & αβ β → Cases αβ, αγ, & βγ → αβ → → (βγ) α&β β γ Equivalence α→β & β→α iff α iff β Transitivity αβ & βγ → αγ α α & β → αγ (αβ) Excluded Middle αα & (αα) Deduction α→β Assume α, prove β Eval/Build β α α & β γβ → αγ → (αβ) → Contrapositive αβ iff βα iff ¬αβ De Morgan's Law ¬(αβ) iff ¬α¬β → By Contradiction: From α(β&β), α. Double Negation: α iff α anything. Commutative: αβ iff βα and αβ iff βα Inconsistent: From β and β, Distributive: γ(αβ) iff (γα)(γβ) and γ(αβ) iff (γα)(γβ) → 84 And Or Proof Techniques/Lemmas Using: Proving: From: From: Conclude: Conclude: Eval/Build Separating And α&β αβ αβ α&β β (βγ) Tautologies, Equivalences, & Proofs And : Or : Selecting Or αβ & α Cases αβ, αγ, & βγ Implies : Modus Ponens α & αβ Cases αβ, αγ, & βγ Eval/Build β γ β γ Equivalence α→β & β→α α iff β Transitivity αβ & βγ αγ α α & β αγ (αβ) Excluded Middle αα & (αα) Deduction α→β Assume α, prove β Eval/Build β α α & β γβ αγ (αβ) Contrapositive αβ iff βα iff ¬αβ De Morgan's Law ¬(αβ) iff ¬α¬β By Contradiction: From α(β&β), conclude α. Double Negation: α iff α Commutative: αβ iff βα and αβ iff βα Inconsistent: From β and β, conclude anything. Distributive: γ(αβ) iff (γα)(γβ) and γ(αβ) iff (γα)(γβ) 85 And Or Proof Techniques/Lemmas Using: Proving: From: From: Conclude: Conclude: Eval/Build Separating And α&β αβ αβ α&β β (βγ) Tautologies, Equivalences, & Proofs And : Or : Selecting Or αβ & α Cases αβ, αγ, & βγ Implies : Modus Ponens α & αβ Cases αβ, αγ, & βγ Eval/Build β γ β γ α α & β αγ (αβ) Excluded Middle αα & (αα) Deduction α→β Assume α, prove β Eval/Build β α α & β γβ αγ (αβ) Each lemma/rule has the form: Equivalence Contrapositive “Ifα→β i and are lines of your proof, j & β→α α iff β αβ iff βα iff ¬αβ then youTransitivity can add k as a line of your proof.” αβ & βγ αγ De Morgan's Law ¬(αβ) iff ¬α¬β By Contradiction: From α(β&β), conclude α. Double Negation: α iff α Commutative: αβ iff βα and αβ iff βα Inconsistent: From β and β, conclude anything. Distributive: γ(αβ) iff (γα)(γβ) and γ(αβ) iff (γα)(γβ) 86 Arguing Our Rules/Lemmas Proofs of this date back thousands of years. 4 (½ ab) + c2 = (a+b)2 = a2 + 2ab + b2 a2 + b2 = c2 Babylon and Egypt Pythagoras (400 BC) (1900 B.C.). “Let there be proofs” And it was good. Euclid (300 BC) A Proof System: • Is a mechanical method of proving that some formula is true. 87 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. “I am doing logic”and “I love logic” αβ α β Non-Logical Axiom There is not much you can PROVE to be true without starting with some assumptions. Such assumptions are called Non-Logical Axioms. We don’t prove them. But our conclusion is only as strong as they are. 88 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. “I am doing logic”and “I love logic” αβ α β Non-Logical Axiom At each step in the proof, you can add any line that follows from the previous lines. There is an implied “implies” { previous lines} next line. 89 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. “I am doing logic”and “I love logic” 2. “I am doing logic” αβ α β α Non-Logical Axiom What follows from this single line? Give me a weaker statement ie one that is guaranteed to be true within every universe in which the first is true. Exactly! 90 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. αβ α β α “I am doing logic”and “I love logic” “I am doing logic” Non-Logical Axiom Separating And: 1 It is good to use established rules in your proof. and Separating And: From αβ, conclude α. • If both are true, then each must be true individually. It is good to label each line with the rule used. That was fun. Let’s do it again. 91 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. 3. “I am doing logic”and “I love logic” “I am doing logic” or “I am doing logic” “I love logic” αβ α αβ α β Non-Logical Axiom Separating And: 1 Our next line must follow from a combination of previous. Give a new line that is a weakening of the second. ie true within every universe in which the second is true. 92 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. 3. “I am doing logic”and “I love logic” “I am doing logic” or “I am doing logic” “I love logic” αβ α αβ α β Non-Logical Axiom Separating And: 1 Evaluating/Building: 2 Our next line must follow from a combination of previous. Give a new line that is a weakening of the second. ie true within every universe in which the second is true. Evaluating/Building: or • From α alone, conclude αγ. If I know α=T, I can evaluate αγ to be true. From α, I can build αγ.93 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. 3. and “I love logic” “I am doing logic” or “I am doing logic” or and “I love logic” “I am doing logic” αβ αβ α αβ αβ α β Non-Logical Axiom Separating And: 1 Evaluating/Building: 2 Could we turn this around? Are these legal proof steps? Oops. No. In the first, we only know at least one is true. We do not know which. The other’s require knowing that you are doing logic. 94 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” F T αβ T α α F αβ F F β 1. 2. 3. T F “I am doing logic” or “I love logic” F logic” “I am doing and T F “I am doing logic” “I love logic” T F F Non-Logical Axiom XXXX XXXX Could we turn this around? Are these legal proof steps? The universe in which I love it, but don’t do it has the first true and others false. Hence, the second two do not follow from the first. 95 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” T F αβ T α α T αβ F T β 1. 2. 3. F T “I am doing logic” or “I love logic” T logic” “I am doing and F T “I am doing logic” “I love logic” T T F Non-Logical Axiom XXXX XXXX Could we turn this around? Are these legal proof steps? The universe in which I do it, but don’t love it has the first two true and third false. Hence, the third does not follow from the first two. 96 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. αβ or “I am doing logic” “I love logic” α β Non-Logical Axiom If each line of the proof is weaker, how do we prove strong statements? We have our new lines follow from two or more previous lines. 97 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. 3. αβ & β α or “I am doing logic” “I love logic” “I love logic” “I am doing logic” α β Non-Logical Axiom Non-Logical Axiom Selecting Or: 1 & 2 What follows from these two lines? Exactly! Selecting Or: From αβ and β, conclude α. • If at least one of α and β is true, and β is not, then α must be. 98 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” And α β αβ 1. 2. 3. or “I am doing logic” “I love logic” “I love logic” “I am doing logic” Or αβ T T T T T F F T F T F T F F F F 99 Arguing Our Rules/Lemmas And vs Or α ≡ “I am doing logic” β ≡ “I love logic” And α β αβ 1. 2. 3. or “I am doing logic” “I love logic” “I love logic” “I am doing logic” And Or And : Or : Or αβ T T T T T F F T F T F T F F F F Proof Techniques/Lemmas Using: Proving: From: From: Conclude: Conclude: Eval/Build Separating And α&β αβ αβ α&β α (αγ) Selecting Or αβ & α Eval/Build β α α & β αγ (αβ) 100 Arguing Our Rules/Lemmas Implies α ≡ “I am doing logic” β ≡ “I love logic” If 1. 2. 3. α β αβ T T T T F F F T T F F then “I love logic” “I am doing logic” “I love logic” “I am doing logic” T αβ &α β α α β Non-Logical Axiom Non-Logical Axiom Modus Ponens: 1 & 2 What follows from these two lines? Exactly! Modus Ponens: From α and αβ, conclude β. • If α is true and α ensures β, then β must be true. 101 Arguing Our Rules/Lemmas Implies α ≡ “I am doing logic” β ≡ “I love logic” If 1. 2. α β αβ T T T T F F F T T F F T then F F “I love logic” “I am doing logic” T F logic” F “I love F F αβ T α αF F β Non-Logical Axiom Non-Logical Axiom XXXX ???? Does the second line follow from the first? Oops. No. It says “IF I love logic”. It does not say that I love it. The universe in which I do it, but don’t love it has the first true and second false. 102 Arguing Our Rules/Lemmas Implies α ≡ “I am doing logic” β ≡ “I love logic” If 1. 2. α β αβ T T T T F F F T T F T αβ T α T F βα F F F T then T F “I love logic” “I am doing logic” T F T “I am doing logic” “I love logic” F β Non-Logical Axiom XXXX What follows from this single line? Oops. No. hounddog does not imply doghound The universe in which I do it, but don’t love it has the first true and second false. Hence, the second does not follow from the first. 103 Arguing Our Rules/Lemmas Implies α ≡ “I am doing logic” β ≡ “I love logic” αβ βα 1. 2. “I love logic” “I am doing logic” “I am doing logic” “I love logic” α β Non-Logical Axiom Contrapositive What follows from this single line? Exactly! Contrapositive: From αβ, conclude βα. • If α ensures β and β is not true, then α can’t be. Otherwise β would be. 104 Arguing Our Rules/Lemmas Implies α ≡ “I am doing logic” β ≡ “I love logic” αβ βα 1. 2. “I love logic” “I am doing logic” “I am doing logic” “I love logic” α β Non-Logical Axiom Contrapositive If you want to know the truth, I will tell you. Dude! You will tell me whether I want to you to or not. When β=T, γβ is vacuously true. 105 Arguing Our Rules/Lemmas Implies α ≡ “I am doing logic” β ≡ “I love logic” αβ βα 1. 2. “I love logic” “I am doing logic” “I am doing logic” “I love logic” α β Non-Logical Axiom Contrapositive There will be no racism, when hell freezes over. Dude! Hell, by definition, Hell will never freeze over. Hence, you are implying that there will always be racism. Minimally, you are saying a vacuous statement. When α=F, αγ is vacuously true. 106 Arguing Our Rules/Lemmas Implies α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. α β αβ T T T T F F F T T F F T “I love logic” “I am doing logic” “I am doing logic” “I love logic” Non-Logical Axiom The nextContrapositive rules will define this table. Proof Techniques/Lemmas Proving: From: From: Conclude: Conclude: Eval/Build β Modus Ponens γβ α αγ α & αβ β Using: Implies : α & β Equivalence α→β & β→α α iff β Transitivity αβ & βγ αγ (αβ) Contrapositive ¬αβ iff βα iff αβ Transitivity αβ & βγ αγ 107 Evaluate/Build And More complex things. Or P Q PQ PQ T T T T Not Implies Q PQ F T T F F T F T F T T F F F T F T F Only F Let’splug understand the following concepts into andplaces see the equivalence between them. needed. Evaluate Formula From value α=F, Evaluate [(αβ) (βγ)] [αγ] ? ? [F?] T T Proof Techniques/Lemmas Proving: From: Conclude: Eval/Build α&β β αβ (βγ) Eval/Build α α & β αγ (αβ) Eval/Build β α α & β γβ αγ (αβ) Build Formulas in Proofs 1. 2. 3. α Proved before αγ Eval/Build : 1 [(αβ) (βγ)] [αγ] Eval/Build : 2 108 Evaluate/Build Sometimes the proof forms a tree. And Or P Q PQ PQ T T T T Not Implies Q PQ F T T F F T F T F T T F F F T F T (Tβ) (Fγ) T T T α&β β αβ (βγ) Eval/Build α α & β F αγ (αβ) Eval/Build β α α & β Let’s understand the following concepts and see the equivalence between them. Evaluate Formula From value α=T, Evaluate (αβ) (αγ) Proof Techniques/Lemmas Proving: From: Conclude: Eval/Build γβ αγ (αβ) Build Formulas in Proofs 1. 2. 3. 4. α αβ αγ (αβ) (αγ) Proved before Eval/Build : 1 Eval/Build : 1 Eval/Build : 1 109 Arguing Our Rules/Lemmas Deduction α ≡ “I am doing logic” β ≡ “I love logic” From: Implies : α Using: Proof Techniques/Lemmas Conclude: Modus Ponens α & αβ β From: β Proving: Conclude: Deduction α→β Assume α, prove β 110 Arguing Our Rules/Lemmas Deduction α ≡ “I am doing logic” β ≡ “I love logic” β α Deduction: Assume α, prove β, conclude α→β. If α is false, then α→β is automatically true. We temporally assume α is true, and with this we need to prove β is true. α β αβ T T T T F F F T T F F T 111 Arguing Our Rules/Lemmas Deduction α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. 3. 4. 5. Deduction Goal: “I love logic” “I am doing logic” “I love logic” “If I love x” “I do x” “I am doing logic” “I love logic” “I am doing logic” α β Assumption Non-Logical Axiom Modus Ponens: 2 & 3 Deduction Conclusion Deduction Format: Deduction Goal: αβ It is indented ______ α Assumption to remind ______ … within this scope ______ β Proved somehow αβ Deduction Conclusion is α assumed. 112 Arguing Our Rules/Lemmas Cases The set of all people α ≡ “I am doing logic” β ≡ “I love logic” α I want to prove “I love logic”. There are two cases. Do you love it in the day? Do you love it in the night? β γ If α is true, then so is γ. If β is true, then γ. Either α or β is true. Hence, γ is true. Cases Goal: γ. Cases α & β. 1. Given: 2. α or β, ie, these cover all the cases 3. Case 1: Assume α and prove γ. 4. Case 2: Assume β and prove γ. 5. Case 3: Assume ??? 6. Conclude γ. 113 Arguing Our Rules/Lemmas Cases α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. 3. 4. 5. Cases Goal: “I love logic”. “Daytime” or “Nighttime” “Daytime” “I love logic” “Nighttime” “I love logic” “I love logic” Cases “Daytime” or “Nighttime” Proved somehow. Proved somehow. Proved somehow. Cases 2, 3, 4 Cases Goal: γ. Cases α & β. 1. Given: 2. α or β, ie, these cover all the cases 3. Case 1: Assume α and prove γ. 4. Case 2: Assume β and prove γ. This is a rule just 5. Conclude γ. like the others. 114 Arguing Our Rules/Lemmas Cases α ≡ “I am doing logic” β ≡ “I love logic” 1. 2. 3. 4. 5. Cases Goal: “I love logic”. “Daytime” or “Nighttime” “Daytime” “I love logic” “Nighttime” “I love logic” “I love logic” From: Implies : Cases “Daytime” or “Nighttime” Proved somehow. Proved somehow. Proved somehow. Cases 2, 3, 4 Proof Techniques/Lemmas Using: Proving: From: Conclude: Conclude: Cases αβ, αγ, & βγ γ Deduction α→β Assume α, prove β It feels natural to merge cases and deduction into one process.. 115 Arguing Our Rules/Lemmas Cases α ≡ “I am doing logic” β ≡ “I love logic” Cases Goal: γ. 1. αβ 2. Case 1: 3. α 4. …. 5. γ 6. Case 2: 7. β 8. …. 9. γ 10. γ Or tighten it up a bit. Cases α & β Proved somehow Assumption Proved somehow Assumption Proved somehow Cases Conclusion 1, 5, 9 116 Arguing Our Rules/Lemmas Cases α ≡ “I am doing logic” β ≡ “I love logic” Cases Goal: γ. 1. αβ 2. Case α: 3. 4. …. 5. γ 6. Case β: 7. 8. …. 9. γ 10. γ Or tighten it up a bit. Cases α & β Proved somehow Assumption Proved somehow Assumption Proved somehow Cases Conclusion 1, 5, 9 117 Arguing Our Rules/Lemmas Cases α ≡ “I am doing logic” β ≡ “I love logic” Cases Goal: γ. 1. α1α2…αn 2. Case α1: 3. … 4. Case α2: 5. … 6. Case α3: 7. 8. … 9. Case αn: 10. γ Or tighten it up a bit. Cases α1, α2, …, & αn Proved somehow Assumption Assumption Assumption Assumption Cases Conclusion 118 Arguing Our Rules/Lemmas Cases 1. 2. 3. 4. 5. 6. 7. 8. 9. Cases Goal: “I love logic”. “Daytime” or “Nighttime” Case “Daytime”: … “I love logic” Case 2: “Nighttime” … “I love logic” “I love logic” Cases “Daytime” or “Nighttime” Proved somehow Assumption Proved somehow Assumption Proved somehow Cases Conclusion 119 Arguing Our Rules/Lemmas Cases 1. 2. 3. 4. 5. 6. 7. 8. 9. Cases Goal: “Everyone is rich”. “America” or “Europe” Case “America”: … “Everyone is rich” Case “Europe”: … “Everyone is rich” “Everyone is rich” Cases “America” or “Europe” Proved somehow Assumption Proved somehow Assumption Proved somehow Cases Conclusion What??? There are more cases! 120 Arguing Our Rules/Lemmas Contradiction Contradiction: ββ. • In our logic, β can’t be both true and false. This is called a contradiction. 121 Arguing Our Rules/Lemmas Contradiction By Contradiction: From α(β&β), conclude α. This is a classic technique for proving α. • “By way of contradiction assume the opposite”, ie α. • From it, prove a contradiction. • Hence, the initial assumption must be false, ie is α true. Proof of Proof By Contradiction: 1. 2. 3. 4. α (β&β) (β&β) α (β&β) α Proved somehow Contra Positive from 1 Excluded middle Modus Pontus from 2&4 122 Arguing Our Rules/Lemmas Contradiction The Greeks only knew about integers and fractions. These were called rational. They did not know about decimals x = 1.41421356237… But they could not express √2 as a fraction. But how do you prove that a fraction representation DOES NOT EXIST? If we assumed the opposite, then we have √2 = n/d to work with. 123 Arguing Our Rules/Lemmas Proof that √2 is irrational.Contradiction Let α be “√2 is irrational”. Let β be “the number of 2 divisors in 2d2=n2 is even” Goal αβ By way of contradiction assume α, i.e “√2 is rational”. By definition of rational, √2 = n/d for integers n&d. Rearrange 2d2=n2 Every integer can be uniquely factored into primes. Eg 12=223 Repeatedly divide n by 2 until the remaining value is odd. This gives n=2kr for some int k and some odd r. n2=22kr2, giving the number of 2 divisors in it is even. Hence β. Hence αβ 124 Arguing Our Rules/Lemmas Proof that √2 is irrational.Contradiction Let α be “√2 is irrational”. Let β be “the number of 2 divisors in 2d2=n2 is even” Goal αβ By way of contradiction assume α, i.e “√2 is rational”. By definition of rational, √2 = n/d for integers n&d. Rearrange 2d2=n2 Every integer can be uniquely factored into primes. Eg 12=223 Repeatedly divide d by 2 until the remaining value is odd. This gives d=2k'r' for some int k and some odd r. 2d2 =22k'+1r'2, giving the num of 2 divisors in it is odd. Hence β. Hence αβ 125 Arguing Our Rules/Lemmas Proof that √2 is irrational.Contradiction Let α be “√2 is irrational”. Let β be “n&d are not both even” We proved αβ and αβ Hence α(β&β) Because α proves a contradiction, α must be wrong. Hence, α must be true. Ie “√2 is irrational”. 126 Arguing Our Rules/Lemmas Contradiction The Greeks knew about primes 2, 3, 5 ,7, … There seems to be a lot of them. But how do you prove that there are an INFINITE number of them. If we assumed the opposite, then we have a maximum to work with. 127 Arguing Our Rules/Lemmas Contradiction Proof that there are an infinite number of primes. Let α be “there are an infinite number of primes”. Let β be “p is the maximum prime” Goal αβ By way of contradiction assume α, i.e “finite number”. Hence, there must be a maximum prime p. Hence β. Hence αβ 128 Arguing Our Rules/Lemmas Contradiction Proof that there are an infinite number of primes. Let α be “there are an infinite number of primes”. Let β be “p is the maximum prime” Goal αβ Let n = p!+1 = p(p-1)(p-2)…1 + 1 Every integer can be factored into primes, eg 12 = 223. What are the prime factors of n? Is p a factor of n? No, the remainder of n/p is 1. Is p-1 a factor of n? No, the remainder of n/(p-1) is 1. Nothing p or less is a factor of n. 129 Arguing Our Rules/Lemmas Contradiction Proof that there are an infinite number of primes. Let α be “there are an infinite number of primes”. Let β be “p is the maximum prime” Goal αβ Hence, n must have a prime factor bigger than p. Hence, there is a prime bigger than p. Hence β. Hence αβ 130 Arguing Our Rules/Lemmas Contradiction Proof that there are an infinite number of primes. Let α be “there are an infinite number of primes”. Let β be “p is the maximum prime” We proved αβ and αβ Hence α(β&β) Because α proves a contradiction, α must be wrong. Hence, α must be true. Ie “there are an infinite number of primes”. Note we gave an algorithm for constructing bigger and bigger and bigger primes. Never ending. 131 Arguing Our Rules/Lemmas Contradiction By Contradiction: From α(β&β), conclude α. This is a classic technique for proving α. • “By way of contradiction assume the opposite”, ie α. • From it, prove a contradiction. • Hence, the initial assumption must be false, ie is α true. It is useful when assuming the contradiction allows you to assume the existence of some object. But this technique is way over used. Please avoid it by proving directly. 132 Arguing Our Rules/Lemmas Distributive A Tautology is a formula that evaluates to true under every setting of the variables. Proof: A tautology can be proved by checking every setting of the variables. • Distributive: x(y+z) = (xy)+(xz) Area Area xy y+z x(y+z) z xz x y 133 Arguing Our Rules/Lemmas Distributive A Tautology is a formula that evaluates to true under every setting of the variables. Proof: A tautology can be proved by checking every setting of the variables. • Distributive: x(y+z) x+(yz) 2+(11) 3 = (xy)+(xz) = (x+y)(x+z) = (2+1)(2+1) = 9 134 Arguing Our Rules/Lemmas Distributive A Tautology is a formula that evaluates to true under every setting of the variables. Proof: A tautology can be proved by checking every setting of the variables. • Distributive: x(y+z) x+(yz) P(QR) P(QR) = (xy)+(xz) = (x+y)(x+z) iff (PQ)(PR) iff (PQ)(PR) P Q R P(QR) (PQ)(PR) P Q R P(QR) (PQ)(PR) T T T T T T T T T T T T F T T T T F T T T F T T T T F T T T T F F F F T F F T T F T T F F F T T T T F T F F F F T F T T F F T F F F F T T T F F F F F F F F F F 135 Arguing Our Rules/Lemmas Distributive A Tautology is a formula that evaluates to true under every setting of the variables. Proof: A tautology can be proved by checking every setting of the variables. • Distributive: x(y+z) = (xy)+(xz) x+(yz) = (x+y)(x+z) P(QR) iff (PQ)(PR) Between P and others is . 136 Arguing Our Rules/Lemmas Distributive A Tautology is a formula that evaluates to true under every setting of the variables. Proof: A tautology can be proved by checking every setting of the variables. • Distributive: x(y+z) = (xy)+(xz) x+(yz) = (x+y)(x+z) P(QR) iff (PQ)(PR) Between Q and R is . 137 Rules/Lemmas The goal is to proveArguing Our Distributive Distributive: γ(αβ) iff (γα)(γβ) γ(αβ) iff (γα)(γβ) γ (αβ) α β γ α β = γ (γα) γ(αβ) α β (γβ) α β γ α γ (γα)(γβ) α β β γ = (αβ) α β γ α (γα) α γ = (γβ) β α γ γ (γα)(γβ) α β β γ Compare areas. Same γ(αβ) α β β γ γ = γ Compare areas. Same 138 Without Loss of Generality Generality means that something is true in General, i.e. in all situations. i.e. a Tautology. In proof by cases: You must prove ALL of the cases. But if two of the cases are the same except that something symmetric has been stitched, then you can say: “Without Loss of Generality we will consider the first case and ignore the second.” Prove: min(x, y) = (x + y − |x − y|)∕2 Here x and y are symmetric, so we can say “Without Loss of Generality assume x − y ≥ 0, then (x + y − |x − y|)∕2 = (x + y − x + y|)∕2 = (2y)∕2 = y = min(x, y) 139 And Or And : Or : Proof Techniques/Lemmas Using: Proving: From: From: Conclude: Conclude: Eval/Build Separating And α&β αβ αβ α&β β (βγ) Selecting Or αβ & α Cases αβ, αγ, & βγ Implies : Modus Ponens α & αβ Cases αβ, αγ, & βγ Eval/Build β γ β γ Equivalence α→β & β→α α iff β Transitivity αβ & βγ αγ α α & β αγ (αβ) Excluded Middle αα & (αα) Deduction α→β Assume α, prove β Eval/Build β α α & β γβ αγ (αβ) Contrapositive αβ iff βα iff ¬αβ De Morgan's Law ¬(αβ) iff ¬α¬β By Contradiction: From α(β&β), conclude α. Double Negation: α iff α Commutative: αβ iff βα and αβ iff βα Inconsistent: From β and β, conclude anything. Distributive: γ(αβ) iff (γα)(γβ) and γ(αβ) iff (γα)(γβ) 140 141 142 143 144 145 146 Tautologies, Equivalences, & Proofs • Equivalent, p≡q: Two math formulas that have same real value under every assignment. (x+y)2 – x2 - y2 + 2x = (x2 + 2xy + y2) – x2 - y2 + 2x = 2xy + 2x = 2x (y+1) 147 Tautologies, Equivalences, & Proofs • Equivalent, p≡q: Two propositions that have same true/false under every assignment. p T T q T F ¬p F F F F T F T T Equivalent Not Equivalent q→p ¬p ∨ q p → q T F T F T T T T T T F T 148 148 Tautologies, Equivalences, & Proofs • Equivalent, p≡q: propositions have same true/false under every assignment. Equivalence α→β & β→α α iff β Double Negation: α iff α Commutative: αβ iff βα and αβ iff βα Distributive: γ(αβ) iff (γα)(γβ) and γ(αβ) iff (γα)(γβ) Contrapositive αβ iff βα iff ¬αβ De Morgan's Law ¬(αβ) iff ¬α¬β 149 Key Logical Equivalences 1 Identity Laws: p T p, pF p Domination Laws: Idempotent laws: Double Negation Law: Negation Laws: pT T, pF F p p p, pp p Absorption Laws: © McGraw Hill LLC p p p p T , p p F p p q p p p q p 150 More Logical Equivalences TABLE 7 Logical Equivalences Involving Conditional Statements. p q p q p q q p p q p q p q p q p q p q p q p r p q r p r q r p q r p q p r p q r p r q r p q r © McGraw Hill LLC TABLE 8 Logical Equivalences Involving Biconditional Statements. p q p q q p p q p q p q p q p q p q p q 151 Tautologies, Equivalences, & Proofs p p q is logically equivalent to p q Example: Show that Solution: p p q p p q p p q p p q by the second De Morgan law by the first De Morgan law by the double negation law p p p q by the second distributive law F p q because p q F p q p p F by the commutative law for disjunction By the identity law for F 152 152 Tautologies, Equivalences, & Proofs Example: Show that p q p q is a tautology. Solution: p q p q p q p q p q p q p p q q by truth table for → by the first De Morgan law by associative and commutative laws laws for disjunction T T by truth tables T by the domination law 153 153 Tautologies, Equivalences, & Proofs • Disjunctive Normal Form (DNF): Or of Ands and or (p¬q) (r¬st) ¬q • Conjunctive Normal Form (CNF): And of Os and (p¬q) (r¬st) ¬q or • Every formula can be put uniquely into DNF (CNF) (pq)r (¬p¬q) ¬r No clause is the subset of another. or (pq) (pqr) and and 154 Tautologies, Equivalences, & Proofs • Disjunctive Normal Form (DNF): Or of Ands and or (p¬q) (r¬st) ¬q • Conjunctive Normal Form (CNF): And of Os and (p¬q) (r¬st) ¬q or • Every formula can be put uniquely into DNF (CNF) (pq)r (¬p¬q) ¬r • One proof that two formula are equivalent is to put both into DNF and then compare. Time ≥ # clauses ≥ 2# variables ≥ # atoms in the universe. eg pqr…t 155 Tautologies, Equivalences, & Proofs • Disjunctive Normal Form (DNF): Or of Ands and or (p¬q) (r¬st) ¬q • Conjunctive Normal Form (CNF): And of Os and (p¬q) (r¬st) ¬q or • Finding a satisfying assignment for CNF is hard, because for each clause must choose one. But this is hard because you must be consistent with T/F values. • Finding a satisfying assignment for DNF is easy, because only one clause needs to be satisfied. • Finding a falsifying assignment for DNF is hard. Our goal is to find faster ways to prove things. 156 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. “dolphins nurse young” “dolphins are mammals” “dolphins are mammals” “dolphins are warm blooded” “dolphins nurse young” I would like to generalize to animals I have never seen before. Proof Axioms 1. “dolphins nurse young” “dolphins are mammals” 2. “dolphins are mammals” “dolphins are warm blooded” 3. “dolphins nurse young” Modus Ponens: 1&3 4. “dolphins are mammals” Modus Ponens: 2&4 5. “dolphins are warm blooded” 157 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. “x nurse young” “x are mammals” “x are mammals” “x are warm blooded” “dolphins nurse young” Any objects x can be plugged in. I would like to generalize to animals I have never seen before. An axiom schema is a formula in the metalanguage of an axiomatic system, in which one or more schematic variables appear. These variables, which are metalinguistic constructs, stand for any term or subformula of the system, which may or may not be required to satisfy certain conditions. 158 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. “x nurse young” “x are mammals” “x are mammals” “x are warm blooded” “dolphins nurse young” Any objects x can be plugged in. I would like to generalize to animals I have never seen before. Meta-proof 1. “x nurse young” “x are mammals” 2. “x are mammals” “x are warm blooded” 3. “x nurse young” “x are warm blooded” Axiom Axiom Transitivity 159 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. 4. “x nurse young” “x are mammals” “x are mammals” “x are warm blooded” “dolphins nurse young” “humans nurse young” Learning is fun: 1. “humans nurse young” 2. “humans nurse young” “humans are mammals” 3. “humans are mammals” 4. “humans are mammals” “humans are warm blooded” 5. “humans are warm blooded” Axiom Axiom Modus Ponens: 1&2 Axiom Modus Ponens: 3&4 160 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. 4. “x nurse young” “x are mammals” “x are mammals” “x are warm blooded” “dolphins nurse young” “humans nurse young” But these are not true for lizards! α β αβ T T T T F F F T T F F T Yes, they are! 161 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. 4. 5. “x nurse young” “x are mammals” “x are mammals” “x are warm blooded” “dolphins nurse young” “humans nurse young” “lizards are warm blooded” Learning is fun: 1. “lizards are warm blooded” 2. “lizards are mammals” “lizards are warm blooded” 3. “lizards are warm blooded” “lizards are mammals” 4. “lizards are mammals” 5. “lizards nurse young” Axiom Axiom Contra Positive: 2 Modus Ponens: 1&3 And so on … 162 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. 4. 5. “x nurse young” “x are mammals” “x are mammals” “x are warm blooded” “dolphins nurse young” “humans nurse young” hound dog “lizards nurse young” dog hound dog hound hound dog Learning is fun: 1. “lizards nurse young” 2. “lizards nurse young” “lizards are mammals” 3. Oops we are stuck! Axiom Contra Positive Converse Axiom Axiom 163 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. 4. 5. iff“x are mammals” “x nurse young” “x are mammals” “x are warm blooded” “dolphins nurse young” “humans nurse young” hound dog “lizards nurse young” dog hound dog hound hound dog Learning is fun: 1. “lizards nurse young” 2. “lizards nurse young” “lizards are mammals” 3. Oops we are stuck! 4. “lizards are mammals” “lizards nurse young” 5. “lizards nurse young” “lizards are mammals” 6. “lizards are mammals” Axiom Contra Positive Converse Axiom Axiom Axiom Contra Positive: 4 Modus Ponens: 1&5 164 Axiom Schema Non-Logical Axioms Γ: 1. 2. 3. 4. 5. 6. iff “x are mammals” “x nurse young” “x are mammals”iff??“x are warm blooded” “dolphins nurse young” “humans nurse young” “birds are mammals” “birds are warm blooded” Learning is fun: 165 Example: Prove No Racism I will prove “I will get a million dollars” “a world without racism” 166 Example: Prove No Racism α ≡ “I fail” β ≡ “My mom is unhappy” 167 Example: Prove No Racism 1. 2. “I fail” “My mom is unhappy” [“I fail” “My mom is unhappy”] “I fail” Clear Parse Tree “I fail” “My mom is unhappy” “I fail” What does this mean??? In this line 2, what is the most important connector? Root of parse tree ie the last one that is applied. What is the Left and Right-HandSide of this ? 168 Example: Prove No Racism 1. 2. “I fail” “My mom is unhappy” [“I fail” “My mom is unhappy”] “I fail” Clear Clear What does this mean??? The line says “If Left-Hand-Side, then Right-HandSide”. Oh yes: If my mother would be unhappy if I fail, then I will be sure not to fail! 169 Example: Prove No Racism 1. 2. 3. “I fail” “My mom is unhappy” [“I fail” “My mom is unhappy”] “I fail” α β “I fail” Clear Clear How do we use this? Modus Ponens: From α and αβ, conclude β. • If α is true and α ensures β, then β must be true. Look we already know the LHS, ie α. Hence, we can conclude the RHS, ie β. 170 Example: Prove No Racism 1. 2. 3. 4. 5. “I fail” “My mom is unhappy” [“I fail” “My mom is unhappy”] “I fail” “I fail” α “I study” “I fail” β “I fail” “I study” Clear Clear Modus Ponens 2&3 Clear Contrapositive Contrapositive: From αβ, conclude βα. • If α ensures β and β is not true, then α can’t be. Otherwise β would be. 171 Example: Prove No Racism 1. 2. 3. 4. 5. 6. 7. “I fail” “My mom is unhappy” [“I fail” “My mom is unhappy”] “I fail” “I fail” “I study” “I fail” “I fail” “I study” “I study” “I study” Clear Clear Modus Ponens 2&3 Clear Contrapositive Modus Ponens 3&5 Double Negation Double Negation: From α, conclude α. • In our logic, something is either true or false. The middle is excluded. If something is not (not true), then it must be true. 172 Example: Prove No Racism 1. 2. 3. 4. 5. 6. 7. “I study” Remember this. We will need it later. 173 Example: Prove No Racism 1. 2. 3. 4. “I am sick” “I study” β α “I am sick” “I party” β “I study”γ “I party” “I am sick” “I study” Clear Clear Clear Transitivity 2&3 Transitivity: From αβ and βγ, conclude αγ. • If I can travel from α to β and from β to γ then I can travel from α to γ. 174 Example: Prove No Racism 1. “I am sick” “I study” 2. 3. 4. “I am sick” “I study” 5. or “I am sick” “I am sick” Excluded Middle or Excluded Middle: ββ. • In our logic, something can’t be neither true nor false. The universe must decide. 175 Example: Prove No Racism 1. 2. 3. 4. γ α “I am sick” “I study” 5. γ β “I am sick” “I study” β αor “I am sick” “I am sick” 6. “I study” By Cases 5,1,4 or By Cases: From αβ, αγ, and βγ, conclude γ. 1. Given: There are only two cases α & β. 2. Case 1: Assume α and prove γ. 3. Case 2: Assume β and prove γ. 4. Conclude γ. 176 Example: Prove No Racism 1. 2. 3. “I study” “I study” “I study”and “I study” Proved on 1st page Proved on 2nd page Build/Evaluate 1&2 Evaluating/Building: and • From both α and α´, conclude αα´. 177 Example: Prove No Racism 1. 2. 3. “I study” “I study” “I study”and “I study” 4. “a world without racism” 5. qed Latin for quod "Which was to be demonstrated." This does not make any sense. Try again! Inconsistent: From β and β, conclude anything. • A funny twist of our logic is that once you have proved a contradiction, from it you can conclude anything you want. 178 Example: Prove No Racism 1. (“I study” “I study”) 2. (“I study” “I study”) “a world without racism” “I study” “I study” “a world without racism” 3. 4. Excluded Middle Can’t be both true and false. Evaluate/Build : 1 From α, conclude αanything Proved on previous page of proof Modus Ponens 2&3 179 Example: Prove No Racism This proof must have it’s flaws. One of these assumptions was probably wrong: • [“I fail” “My mom is unhappy”] “I fail” • “I am sick” “I party” 180 Example: Prove No Racism Because they are illogical. No Such assumptions are called Non-Logical Axioms: • [“I fail” “My mom is unhappy”] “I fail” We don’t prove them. But we choose to assume that they are true. 181 Example: Prove No Racism Because they are illogical. No Such assumptions are called Non-Logical Axioms: • [“I fail” “My mom is unhappy”] “I fail” We don’t prove them. But we choose to assume that they are true. 182 Predicates and Quantifiers boys b, Loves(b) 183 Objects, Predicates, & Relations Predicates: boy(x), father(x), ... is True if and only if object x has stated property. Relations: loves(b,g), fatherOf(x,y), ... is True if and only if objects have stated relation. Defining: fatherOf(x,y)exist ≡ “x is y’s father”. father(x) ≡ y fatherOf(x,y) daughter(y,x) iff father(x,y)girl(y) 184 Objects, Predicates, & Relations Predicate logic can only say these stupid things. Why should I care? Actually, it is hugely expressive. • Math: For mathematical statement that you want to understand and prove, it is best to first write it as a Predicate logic sentence. • Proof: Sometimes the mechanics of the proof just falls out. • All Computation: There is a Predicate logic sentence over the integers (+,) Compute(J,I,y) ≡ “J(I)=y”, for every Java program J, ie Compute(J,I,y) is true iff J(I) outputs y. • Halting Problem: There is another Halt(J,I) ≡ “J(I) halts”, which is not itself computable. • Hard: The bad news is that this means that there is no algorithm determining whether such a sentence is true. 185 Objects, Predicates, & & Relationsg Loves(b,g) People need to love and be loved. Sam Mary Bob Beth T T John Marilyn Monroe T T Fred Ann b T T T T Loves(Sam,Mary) = False Loves(Sam,Beth) = True “There exists a boy that loves Mary” exist b, Loves(b,Mary) False b, Loves(b,Beth) True Sorry “Every boy loves Beth” this is heteronormative. all b, Loves(b,Beth) False b, Loves(b,MM) 186 True & g, [b, Loves(b, g)] b, [g, Loves(b, g)] loop g{girls} (checking true for some) loop b{boys} (checking true for all) Loves(b,g) loop b{boys} (checking true for all) loop g{girls} (checking true for some) Loves(b,g) g g T T b T T T b T T T 187 g, [b, Loves(b, g)] b g T T T T T b T Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) Loves(b,g) g g g g g g g T T b And Or Or Or Or Or Or And And And And And b b b b b b, [g, Loves(b, g)] & 188 vs In all three examples, every boy loves a girl. The difference? Sam Mary Bob Fred Beth Marilyn Monroe Ann Sam Mary Bob Beth Marilyn Monroe Ann John One girl John Fred T T T T T T T T T T T T T Could be a separate girl. Sam Mary Bob Beth Marilyn Monroe Ann John Fred His special woman. T T T T 189 vs “There is a girl for all boys to love.” “There is a inverse (eg 1/3) for all reals.” Not clear. Sam Mary Bob Fred Beth Marilyn Monroe Ann Sam Mary Bob Beth Marilyn Monroe Ann John One girl John Fred T T T T T T T T T T T T T Could be a separate girl. “For each boy, there is a girl.” “For each person, there is God.” Sam Mary Bob Beth Marilyn Monroe Ann John Fred His special woman. T T T T 190 vs This statement is “about” girls. The existence of one that is “loved by everyone”. b,[g, Loves(b, g) ] Mary Bob Fred Beth Marilyn Monroe Ann Sam Mary Bob Beth Marilyn Monroe Ann John One girl g,[b, Loves(b, g)] Sam John Fred T T T T T T T T T T T T T Could be a separate girl. This statement is “about” boys. Each of them “loves someone.” Sam Mary Bob Beth Marilyn Monroe Ann John Fred His special woman. T T T T 191 vs This creates a function p=p(v). Sam Fred p Beth Ann b, g, Loves(b, g) Sam Mary Bob Beth Marilyn Monroe Ann John Fred His special woman. T T T T 192 vs Sam Mary Bob Beth Marilyn Monroe Ann John One girl Fred T T T T A:g, b, Loves(b, g) B:b, g, Loves(b, g) Prove A B If there is one girl that is loved by every boy, Then every boy loves at least that girl. 193 vs “There is a politician that is loved by everyone.” Sam Bob John Trudeau Fred politician, voters, Loves(v, p) voters, politician, Loves(v, p) Sam “Every voter loves some politician.” Bob John Scheer Trudeau Fred 194 vs x, y, y=f(x) This only says that f is a function that is defined on the whole domain. y, x, y=f(x) This also says that that f is the constant function. 195 vs I want you to feel physical pain when you see ∀Inputs x, ∃Java Program J, J(x)=P(x) 196 vs I want you to feel physical pain when you see ∀Inputs x, ∃Java Program J, J(x)=P(x) We want to say that there is a Java program J, that solves problem P, on every input I. Problem P: • Input: x • Output: x2 Input: x Code: int J( x ) return(xx) 197 vs I want you to feel physical pain when you see ∀Inputs x, ∃Java Program J, J(x)=P(x) But what you are saying is that each input value can have its own Java program! Problem P: • Input: x • Output: x2 Input: 1 2 Code: int J1( x ) return(1) 3 int J2( x ) return(4) int J3( x ) return(9) 4 … int J4( x ) return(16) … Instead ∃Java Program J, ∀Inputs x, J(x)=P(x) Input: x Code: int J( x ) return(xx) 198 Quantifiers and Games x, y, y>x Let’s understand this deeply For All integer x, there Exists a y that is bigger. No matter how many people are in the hot tub, x? y is bigger. you can always fit one more. 0? 1 is bigger. 1? 2 is bigger. 2? 3 is bigger. 3? 4 is bigger. … The integers go on forever. 199 Quantifiers and Games Say, I have a game for you. We will each choose an integer. You win if yours is bigger. I am so nice. I will even let you go first. Easy. I choose a trillion trillion. Well done. That is big! But I choose a trillion trillion and one so I win. Good game. Let me try again. I will win this time! 200 Quantifiers and Games You laugh but this is a very important game in theoretical computer science. You choose the size of your Java program. Then I choose the size of the input. Likely |I| >> |J| So you better be sure your Java program can handle such long inputs. 201 Quantifiers and Games Assuring In Predicate logic, we can state that I win the game: all exist x, y, y>x I'm an oracle. Let me help. If I assure you that all all boys love, ie, b, Loves(b), then anyone can give me his favorite boy b and I assure him that Loves(b) is true. What about Bob ? Sure, he is a lover. 202 Quantifiers and Games Assuring In Predicate logic, we can state that I win the game: all exist x, y, y>x I'm an oracle. Let me help.existIf I assure you that some boy loves, ie, b, Loves(b), then I will provide my favorite boy b and I assure you that Loves(b) is true. Bob He is a lover. 203 Quantifiers and Games Assuring In Predicate logic, we can state that I win the game: all exist x, y, y>x I'm an oracle. Letallmeexist help. If I assure you that x, [y, y>x], then anyone can give me his favorite integer x exist and I assure y, y>x is true. I choose a x = trillion trillion. exist I assure y, y>x. So I will provide my favorite integer y and I assure you that y >x is true. y = trillion trillion and one Yes y >x 204 Quantifiers and Games Assuring Proving In Predicate logic, we can state that I win the game: all exist x, y, y>x I'm a prover. To prove, all I need to do is play the role of the oracle. For you to prove that all all boys love, ie, b, Loves(b), then, as the adversary, I give you my favorite boy b and you must prove Loves(b) is true. For me to prove that exist some boy loves, ie, b, Loves(b), then I will construct my favorite boy b and prove that Loves(b) is true. 205 Quantifiers and Games Assuring Proving In Predicate logic, we can state that I win the game: all exist x, y, y>x all exist I will prove x, [y, y>x]. I choose a x = trillion trillion. exist I will prove y, y>x. I construct y = trillion trillion and one I will prove y>x. Surprisingly that completes the proof. all exist The proof of x, y, y>x. Let x be an arbitrary integer. Let y = x+1 Note y = x+1 >x And this completes the proof. 206 Quantifiers and Games Assuring Proving Understanding this game is important! 207 Humans are Mortal Prove: ∀x, Human(x)Mortal(x) Human(Socrates) } Mortal(Socrates) “All humans are mortal” “Socrates is human” hence “Socrates is mortal” Aristotle (384–322 BC) https://en.wikipedia.org/wiki/Syllogism 208 Humans are Mortal Prove: ∀x, Human(x)Mortal(x) Human(Socrates) } Mortal(Socrates) I want to prove (AB)C As an oracle, I will help. If AB is false, then (AB)C is automatically true. Hence, by deduction, we will pretend that AB is true. During this period of pretending, I will help by assuring you that AB is true. This means that each A and B are true. 209 Humans are Mortal Prove: ∀x, Human(x)Mortal(x) Human(Socrates) } Mortal(Socrates) I assure you that ∀x, Human(x)Mortal(x) I assure you that Human(Socrates). My goal is to prove Mortal(Socrates). But I am stuck so I will ask my oracles about who Socrates is. 210 Humans are Mortal Prove: ∀x, Human(x)Mortal(x) Human(Socrates) } Mortal(Socrates) I assure you that ∀x, Human(x)Mortal(x) I am ready for you to give me an x. I give the oracle x=Socrates. I assure you that Human(Socrates)Mortal(Socrates) I assure you that Human(Socrates). I use modus ponens to get Mortal(Socrates). Excellent. My task is done. 211 Humans are Mortal Prove: ∀x, Human(x)Mortal(x) Human(Socrates) } Mortal(Socrates) Formal Proof: 1. Deduction Goal: AB C 2. AB 3. A 4. B Assumption Separating And 5. ∀x, Human(x)Mortal(x) 6. Human(Socrates)Mortal(Socrates) 7. Human(Socrates) 8. Mortal(Socrates) 9. AB C A Remove ∀ B Modus Ponens Deduction Conclude 212 Prove: x, y, x+y=0 Reals What does this “mean”? For every x, there is a y such that x+y=0 You can give me more meaning than this! You get a mark of zero for this! 213 Prove: x, y, x+y=0 Reals Build understanding by building the statement backwards. What does each subsequence say about ** value of free variables, * set of values of outer quantifier. 2 -2 x+y=0 “x and y add to zero” “y is the negative of x”. ½ is the multiplicative inverse of 2. -2 is the additive inverse of 2. “y is the additive inverse of x”. You can give me more meaning than this! Maybe some more “formal math” (that you don’t know) 214 Reals Prove: x, y, x+y=0 true Or condensed to x+y(x)=0 y, x, x+y=0 false Or condensed to x+g =0 y, x, x+y=x true Or condensed to x+0=x Build understanding by building the statement backwards. What does each subsequence say about ** value of free variables, * set of values of outer quantifier. 2 -2 x+y=0 “y is the additive inverse of x”. y, x+y=0 “x has an additive inverse”. x, y, x+y=0 “Every real has an additive inverse”. x+y=0 “x is the additive inverse of y”. x, x+y=0 “Every real is an additive inverse of y. y, x, x+y=0 “Some real has every real as an inverse”. x+y=x “Adding y does not change x”. x, x+y=x “Adding y makes no changes”. y, x, x+y=x “There is an additive zero”. 215 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Proof of x, y, x+y=0: 1. Let x be an arbitrary real number. 2. Let y = -x 3. The relation is true. x+y = x + (-x) = 0 4. Prover can always win. Hence, the statement is true. 5. “Every real number has an additive inverse.” 216 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Proof of y, x, x+y=0: The order the players go REALY matters. 217 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Proof of y, x, x+y=0 1. Let y be ??? 2. Let x be arbitrary, eg -y+1 3. The relation is false. x+y = (-y+1) + y = 1 ≠ 0 4. Adversary can always win. Hence, the statement is false. 218 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Negations: [y, x, x+y=0] y, [x, x+y=0] y, x, [x+y=0] y, x, x+y≠0 If there is not a y for which it is true, then for all y it is not true. De Morgan's Law ¬(αβ) iff ¬α¬β Or = And If it is not the case that it is true for all x, then there is a x for which it is not. 219 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Negations: [yDogs …] yDogs [y≤x …] y≤x We are still talking about dogs and values at most x. De Morgan's Law ¬(αβ) iff ¬α¬β Or = And 220 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Proof of y, x, x+y=0 1. Let y be ??? 2. Let x be arbitrary, eg -y+1 3. The relation is false. x+y = (-y+1) + y = 1 ≠ 0 4. Adversary can always win. Hence, the statement is false. 221 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Proof of y, x, x+y≠0: 1. Let y be ???arbitrary 2. Let x be arbitrary, eg -y+1 3. The relation is true. x+y = (-y+1) + y = 1 ≠ 0 4. Prover can always win. Hence, the statement is true. 222 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Proof of y, x, x+y=x: 1. Let y be 0 2. x+y = x + 0 = x No. For Jeff, you MUST play the game. 223 Reals Prove: x, y, x+y=0 y, x, x+y=0 y, x, x+y≠0 y, x, x+y=x true false true true (additive inverse) (all additive inverses) (not all additive inverses) (additive zero) Proof of y, x, x+y=x: 1. Let y be 0 2. Let x be arbitrary 3. The relation is true. x+y = x + 0 = x 4. Prover can always win. Hence, the statement is true. 5. “There exists an additive zero.” 224 Reals A: x, y, x+y=0 true (additive inverse) B: true (additive zero) x, x+0=x C: a,b,c, (a=b) (a+c=b+c) D: [ a,b,c, (a+c=b+c) (a=b) ] Here is a counter example. [2+infinity=5+infinity] but 2 and 5 are not equal. •Here is another counter example (with multiplying). [22=52] mod 6 because 52=10=4 mod 6. but 2 and 5 are not equal. 225 Reals A: x, y, x+y=0 true (additive inverse) B: true (additive zero) x, x+0=x C: a,b,c, (a=b) (a+c=b+c) D: [ a,b,c, (a+c=b+c) (a=b) ] Formal Proof: 1. Deduction Goal: ABC D 2. ABC 3. Goal: Proof D 4. Let a, b, & c be arbitrary 5. Prove (a+c=b+c) (a=b) 6. ABC D Assumption See later Deduction Conclude 226 Reals A: x, y, x+y=0 true (additive inverse) B: true (additive zero) x, x+0=x C: a,b,c, (a=b) (a+c=b+c) D: [ a,b,c, (a+c=b+c) (a=b) ] Formal Proof: 1. Deduction Goal: (a+c=b+c) (a=b) 2. a+c = b+c Assumption 3. c+(-c) = 0 By oracle A I give you c. I give you c = -c. A: 227 Reals A: x, y, x+y=0 true (additive inverse) B: true (additive zero) x, x+0=x C: a,b,c, (a=b) (a+c=b+c) D: [ a,b,c, (a+c=b+c) (a=b) ] Formal Proof: 1. Deduction Goal: (a+c=b+c) (a=b) 2. a+c = b+c Assumption 3. c+(-c) = 0 By oracle A 4. a+c+(-c) = b+c+(-c) By (2) and oracle C I give you a = a+c b = b+c c = -c I let you add –c onto both sides of a+c = b+c C: 228 Reals A: x, y, x+y=0 true (additive inverse) B: true (additive zero) x, x+0=x C: a,b,c, (a=b) (a+c=b+c) D: [ a,b,c, (a+c=b+c) (a=b) ] Formal Proof: 1. Deduction Goal: (a+c=b+c) (a=b) 2. a+c = b+c Assumption 3. c+(-c) = 0 By oracle A 4. a+c+(-c) = b+c+(-c) By (2) and oracle C 5. a+0 = b+0 By (3) & (4) 6. a = b By oracle B I give you a. I give you a+0 = a I give you b. I give you b+0 = b B: 229 Reals A: x, y, x+y=0 true (additive inverse) B: true (additive zero) x, x+0=x C: a,b,c, (a=b) (a+c=b+c) D: [ a,b,c, (a+c=b+c) (a=b) ] Formal Proof: 1. Deduction Goal: (a+c=b+c) (a=b) 2. a+c = b+c Assumption 3. c+(-c) = 0 By oracle A 4. a+c+(-c) = b+c+(-c) By (2) and oracle C 5. a+0 = b+0 By (3) & (4) 6. a = b By oracle B 7. (a+c=b+c) (a=b) Deduction Conclude 230 Reals Hey Adversary, You can dictate your worst , Require it to be as small as you like. As long as I can counter with an even smaller . You are on. The heart of calculous is 231 Reals Continuous: x, I claim this function is continuous, i.e, it does not change values suddenly. Is it continuous at value x? Oh yes. f x 232 Reals Continuous: x, I’m not convinced. The value of f seems to be changing. Well, it is not constant. Ok. I will allow some change. Besides, your x' is too far from your x. I am only talking about local change. f(x') f f(x) x x' 233 Reals Continuous: x, >0, >0, x'[x-,x+], |f(x')-f(x)|≤ I will not allow f to change by more than my chosen . Ok. I can honour that. But then you can’t change x by more than . Ok. I will choose x'[x-,x+], Then I reassure you that |f(x')-f(x)|≤ f f(x) x' x 234 Reals Continuous: Consider the function f(x) = x2 Prove: x, >0, >0, x'[x-,x+], |f(x')-f(x)|≤ Let x>0 be arbitrary. Let >0 be arbitrary. Let = / (2x+ . Let x'≤x+ be arbitrary. |f(x')-f(x)| = |(x' 2 - x2| ≤ |(x+ 2 - x2| = |2x+2| = |(2x+)| = This choice looks strange, Don’t panic. butprove, you will it isthe just what we need. To justsee play game. f f(x) x' x 235 Reals Continuous: Consider the function below. Prove: x, >0, >0, x'[x-,x+], |f(x')-f(x)|≤ neg: x, >0, >0, x'[x-,x+], |f(x')-f(x)|> Let x=5. Let =0.0001. Let be arbitrary. It could be .000000000000000000000001 Let x' = x+ = 5+ [x-,x+] |f(x')-f(x)| = |f(5+ – f(5)| ≤ |3.0002-3| = 0.0002 > 0.0001 = f(5.1) = 3.0002 f f(5) = 3 x=5 236 Formal Proof Systems xP x P c for an arbitrary c xP x P c for some element c P c for an arbitrary c xP x P c for some element c xP x OK, but "arbitrary" vs "some" not well defined. The line P(c) will mean different things in different contexts. The book admits that it can cause faulty proofs. 237 237 Review Don’t panic. Deeply understand everything in this review and you will be fine for the midterm. 238 238 Review A for And is OR → is Implies ¬ is Not is parity T is for True F is for False Contrapositive αβ iff βα iff ¬αβ Be sure to know the truth tables for each of these operation. Given a T/F assignment of the variables know how to evaluate any expression. Know how to manipulate expressions using the rules in the purple table. De Morgan's Law ¬(αβ) iff ¬α¬β Double Negation: α iff α Commutative: αβ iff βα and αβ iff βα Distributive: γ(αβ) iff (γα)(γβ) and γ(αβ) iff (γα)(γβ) 239 239 Review A for And is OR → is Implies ¬ is Not is parity T is for True F is for False Translate between English and Math. if p, then q if p, q p implies q p is sufficient for q q if p q whenever p q follows from p q when p 240 p only if q q is necessary for p 240 Review A tautology is a sentence that is true under every setting of the variables. If you made a table with a row for each T/F assignment of the variables p, r, q, …. the number of rows would be 2# of variables. We don’t want to check them all. That is why we have proofs. 241 241 Review Recall, a proof is a sequence of statements, where each statement is - either an axiom, i.e. known to be true - or follows from previous lines using some rule taught in class, i.e., from the purple table. Each such rule has the form: From α & β conclude γ. If you already have lines in your proof of the form α & β. then you can add the line of the form γ to your proof. Number the lines of your proof 1, 2, 3, ... For each, give the name of the rule you use to prove that line. If you are using previous lines to prove this line, then give those line numbers. Do not skip steps. (Except for dropping ¬¬) Be sure to indent appropriately. Learn and understand all the rules in the purple table. 242 242 And Or And : Or : Proof Rules/Lemmas Techniques/Lemmas Arguing Our Using: Proving: From: Conclude: Separating And αβ α&β Selecting Or αβ & α Cases αβ, αγ, & βγ Implies : Modus Ponens α & αβ Cases αβ, αγ, & βγ From: Conclude: Eval/Build α&β β αβ (βγ) Eval/Build β γ β γ Equivalence α→β & β→α α iff β Transitivity αβ & βγ αγ α α & β αγ (αβ) Excluded Middle αα & (αα) Deduction α→β Assume α, prove β Eval/Build β α α & β γβ αγ (αβ) Contrapositive αβ iff βα iff ¬αβ De Morgan's Law ¬(αβ) iff ¬α¬β By Contradiction: From α(β&β), conclude α. Double Negation: α iff α Commutative: αβ iff βα and αβ iff βα Inconsistent: From β and β, conclude anything. Distributive: γ(αβ) iff (γα)(γβ) and γ(αβ) iff (γα)(γβ) 243 244 245 246 247 248 249 Review is A for forAll is E for Exists Be sure to know what these mean and the difference between and 250 250 Quantifiers and Games Assuring In Predicate logic, we can state that I win the game: all exist x, y, y>x I'm an oracle. Letallmeexist help. If I assure you that x, [y, y>x], then anyone can give me his favorite integer x exist and I assure y, y>x is true. I choose a x = trillion trillion. exist I assure y, y>x. So I will provide my favorite integer y and I assure you that y >x is true. y = trillion trillion and one Yes y >x 251 Quantifiers and Games Assuring Proving In Predicate logic, we can state that I win the game: all exist x, y, y>x I'm a prover. To prove, all I need to do is play the role of the oracle. 252 Quantifiers and Games Assuring Proving In Predicate logic, we can state that I win the game: all exist x, y, y>x all exist I will prove x, [y, y>x]. I choose a x = trillion trillion. exist I will prove y, y>x. I construct y = trillion trillion and one I will prove y>x. Surprisingly that completes the proof. all exist The proof of x, y, y>x. Let x be an arbitrary integer. Let y = x+1 Note y = x+1 >x And this completes the proof. 253 Negations Negations: [y, x, x+y=0] y, [x, x+y=0] y, x, [x+y=0] y, x, x+y≠0 If there is not a y for which it is true, then for all y it is not true. De Morgan's Law ¬(αβ) iff ¬α¬β Or = And If it is not the case that it is true for all x, then there is a x for which it is not. [yDogs …] yDogs [y≤x …] y≤x We are still talking about dogs and values at most x. 254 255 End (deleted stuff) 256 Arguing Our Rules/Lemmas Cases I want to prove that all toys are fun. I want to play 20-Questions. I choose a secret toy. I don’t know which toy truck you have. But all of these are fun. No Alive? (in the game) Yes Machine? Yes No Wheels on road? Yes No Truck? No Yes Fun 257 Arguing Our Rules/Lemmas Cases I want to prove that all toys are fun. I want to play 20-Questions. I choose a secret toy. Again! I don’t know which toy mammal you have. But all of these are fun. No Alive? (in the game) Yes Machine? Yes No Wheels on road? Yes No Truck? No Modeled after real animal? No Yes Mammal? No Yes Yes Fun Fun 258 Arguing Our Rules/Lemmas Cases I want to prove that all toys are fun. I want to play 20-Questions. I choose a secret toy. I know I have proved ALL toys fun because each and every toy would follow some path down to a leaf at which time there is a proof that it is fun. No Again! Alive? (in the game) Yes Machine? Modeled after real animal? No Yes Mammal? Yes No Wheels on road? Yes No Truck? No Fly? Yes No Yes Fun Fun Fun Fun Fun No Yes Robot? No Yes Fun Fun Fun Fun 259 Arguing Our Rules/Lemmas Contradiction We want to prove: n2 is even n is even To do this we assume “n2 is even”. But this is hard to use. Let’s proof the contrapositive: n is odd n2 is odd (It is not really proof by contradiction, but we need it.) 260 Arguing Our Rules/Lemmas Contradiction Prove: n is odd n2 is odd Assume n is odd So n=2k+1 for some int k. So n2 = (2k+1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1 = 2k' + 1 which is odd. 261 Arguing Our Rules/Lemmas Proof that √2 is irrational.Contradiction Let α be “√2 is irrational”. Let β be “n&d are not both even” Goal αβ By way of contradiction assume α, i.e “√2 is rational”. By definition of rational, √2 = n/d for integers n&d. If n&d are both even, cancel. Hence, we can assume “n&d are not both even” Hence β. Hence αβ 262 Arguing Our Rules/Lemmas Proof that √2 is irrational.Contradiction Let α be “√2 is irrational”. Let β be “n&d are not both even” Goal αβ Again assume α giving √2 = n/d 2d2=n2 n2 is even n is even 2d2=(2k)2 d2=2k2 d2 is even d is even Hence β. Hence αβ 263 Arguing Our Rules/Lemmas Proof that √2 is irrational.Contradiction Let α be “√2 is irrational”. Let β be “n&d are not both even” We proved αβ and αβ Hence α(β&β) Because α proves a contradiction, α must be wrong. Hence, α must be true. Ie “√2 is irrational”. 264