III. Elementary Logic The Language of Mathematics While we use our natural language to transmit our mathematical ideas, the language has some undesirable features which are not acceptable in mathematics. Alice saw a man with a telescope. Two sisters were reunited after 10 years in the checkout line at King Soopers. The mayor said that bus passengers should be belted. To avoid such problems, the language used in mathematics is more restrictive than the natural language of which it is a part. Propositions and Connectives ● ● A Proposition (or statement) is a sentence that is either true or false (without additional information). The logical connectives are defined by truth tables (but have English language counterparts) . Logic Math English Conjunction ∧ and Disjunction ∨ or (inclusive) Negation ~ not Conditional ⇒ if ... then ... Biconditional ⇔ if and only if Truth Tables P T T F F Q T F T F P ∧Q T F F F P T T F F P T T F F Q T F T F P ⇔Q T F F T Q T F T F P T T F F P ∨Q T T T F P ¬P T F F T Q T F T F P ⇒Q T F T T Logical Equivalence ● The truth table for ~ (P ∧ (Q ∨ P)). P T T F F Q Q∨ P T T F T T T F F P ∧Q∨ P ¬ P ∧Q∨ P T F T F F T F T Two statements are equivalent (logically equivalent) if they have the same truth table values. ● P ⇒ Q ≡ ~ (P ∧ ~ Q) P T T F F Q ¬Q T F F T T F F T P ∧¬Q ¬ P ∧¬Q P ⇒ Q F T T T F F F T T F T T Logical Equivalence ● A denial is a statement equivalent to the negation of a statement. The negation of P ⇒ Q is ~ (P ⇒ Q). A denial of P ⇒ Q is P ∧ ~ Q. ● For 2 logical variables there are 16 ways to combine them, but we can get all of them with combinations of conjunction, disjunction and negation. In fact, we can get them all with just one symbol (nand | ). P T T F F Q T F T F P∣Q F T T T On a real mythical island ... ● If I am telling the truth, then he is a truth teller (What tribes?) Let P := I am telling the truth & Q := he is a truth teller. There are 3 truth values involved, P, Q and P⇒Q If the speaker is a liar, then P would be false. If P is false then P⇒Q is true, and the liar would be speaking the truth!! If the speaker is a truth teller, then P is true and P⇒Q is true, so Q is true and both natives are from the truth telling tribe. On a real mythical island ... ● Gold on island iff I am a truth teller (Which tribe? is there Gold?) P := Gold on island Q := I am a truth teller If speaker is a truth teller, then Q is true and P ⇔Q is true so there is gold on the island. If speaker is a liar, then Q is false and P⇔Q is false, so P must be true, there is gold on the island. So there is gold on the island, but we don't know which tribe the speaker is from! On a real mythical island ... ● Two natives, tall and short. Are you a truth teller? Goom! says the tall one. Other says, He says yes, but he is a liar. (What tribes?) Notice that "Goom" must be "yes". If the short native is a truth teller, then the tall one is a liar (by the truth of the compound P ∧ Q). If the short native is a liar, then the tall one is a truth teller, since the claim that he is a liar must be false. ... we can only say that they are from different tribes. On a real mythical island ... ● Classic: A native stands at a road intersection. What single question can you ask to determine if the road will lead to the village? If I were to ask you if this road leads to the village, would you say "yes"? NB: Truth values of these logical forms have nothing to do with meaning!!!! (content) ... that is a philosophical concept, not a mathematical one. Problem: 1 C B 2 You see the four cards above. Every card has a number on one side and a letter on the other side. Which of these cards must be turned over to determine the truth of the statement: If a card has a B on one side, then it has a 2 on the other side. Tautologies and Contradictions: A tautology is a statement which is always true. A contradiction is a statement which is always false. These are all tautologies: ● A ∨ (B ∧ C) ⇔ (A ∨ B) ∧ (A ∨ C) Distributive Law ● ~ (A ∨ B) ⇔ ~A ∧ ~B ● P ⇔ ~(~ P) DeMorgan's Law Law of the Excluded Middle Tautologies and Contradictions: ● (A ∨ ~ A) ⇒ (B ∧ ~B) a contradiction A T T F F ● B T F T F A∨¬ A B∧¬B A∨¬ A⇒ B∧¬B T F F T F F T F F T F F (P ∧ (P ⇒ Q)) ⇒ Q modus ponens, a tautology P T T F F Q T F T F P ⇒Q T F T T P ∧ P ⇒ Q P ∧ P ⇒ Q⇒ Q T T F T F T F T Tautologies and Contradictions: ● P T T T T F F F F P ⇒ (Q ⇒ R) ⇔ (P ∧ Q) ⇒ R a tautology Q T T F F T T F F R T F T F T F T F P ⇒ Q ⇒ R P ∧Q⇒ R P ⇒ Q ⇒ R⇔ P ∧Q⇒ R T T T F F T T T T T T T T T T T T T T T T T T T Contrapositive The contrapositive of the statement if P then Q is if ~Q then ~P. An implication and its contrapositive are logically equivalent, so one can always be used in place of the other. P T T F F Q T F T F P ⇒ Q ¬Q ⇒ ¬P T T F F T T T T ¬P ⇒ ¬Q Q ⇒ P T T T T F F T T Inverse Converse Transitivity of Implication ● (P ⇒ Q) ∧ (Q ⇒ R) ⇒ (P ⇒ R) P T T T T F F F F ● Q T T F F T T F F R T F T F T F T F P ⇒ Q Q ⇒ R P ⇒ R P ⇒ Q∧Q ⇒ R⇒ P ⇒ R T T T T T F F T F T T T F T F T T T T T T F T T T T T T T T T T Reading from Martin Gardner if time permits. Predicates A predicate (open sentence) is a sentence containing one or more variables which becomes a proposition upon replacement of the variables. Examples: The integer x is even. y = 5. Triangle ABC is isosceles. Universal and Existential quantifiers A predicate is not a proposition, it does not have a truth value. One can however use quantifiers to make propositions about predicates. For instance, the universal quantifier (∀) is used to say that a given predicate is true for all possible values of its variables. This is a proposition, since it is either true or false. Similarly, the existential quantifier (∃) is used to say that there is some value of the variables which makes the predicate a true statement. Quantified Statements Let x be a real number. x2 – 1 = 0 is not a proposition, it is a predicate. "There exists an x so that x2 – 1 = 0" is a proposition (true) "For all x, x2 – 1 = 0" is also a proposition (false). These are written as: (∃x ∈ ℝ) (x2 – 1 = 0) and (∀x ∈ ℝ) (x2 – 1 = 0). Counterexample To prove a universally quantified statement to be false, all that is needed is one set of values for the variables which makes the predicate a false proposition. Such an example is called a counterexample. For example, consider (∀x ∈ ℝ) (x2 – 1 = 0). 2 is a counterexample since 2 is a real number and 22 – 1 = 3 ≠ 0 More Examples ● ● ● ● ● ● ● ∃x ∃ y (x + y = 0) ∀x ∀y (x + y = 0) ∀x ∃y ( x + y = 0) ∃x ∀y (x + y = 0) True False : Counterexample x = 1, y = 2 True : let y = -x False All poobahs are zots. ∀x (P(x) ⇒ Z(x)) Some poobahs are zots. ∃x (P(x) ∧ Z(x)) Everybody has a friend who is always honest. ∀x ∃y (F(x,y) ∧ ∀t H(y,t)) Denials of quantified statements A denial of a quantified statement is obtained by switching the quantifier (changing for all to there exists, or vice versa) and negating the predicate. ● Not all poobahs are zots. ~ ∀x (P(x) ⇒ Z(x)) ≡ ∃x (P(x) ∧ ~Z(x)) ● Not some poobahs are zots. ∼ ∃x (P(x) ∧ Z(x)) ≡ ∀x(~P(x) ∨ ~Z(x)) ● Not everybody has a friend who is always honest. ∼ ∀x ∃y (F(x,y) ∧ ∀t H(y,t)) ≡ ∃x ∀y (∼F(x,y) ∨ ∃t ∼H(y,t)) There is someone, all of whose friends are sometimes not honest. Denials ● A sequence {xn} is Cauchy iff for each ε > 0 there is a natural number N so that if n,m > N then | xn - xm | < ε. (∀ε>0)(∃Ν∈ℕ)(n,m > N ⇒ | xn - xm | < ε) ● What does it mean for a sequence not to be Cauchy? ~ (∀ε>0)(∃Ν∈ℕ)(n,m > N ⇒ | xn - xm | < ε) ≡ (∃ε>0)(∀Ν∈ℕ)(n,m > N ∧ | xn - xm | ≥ ε) Τhere is a positive number ε so that no two terms of the sequence are closer than ε apart. Logical Arguments Starting with one or more statements that are assumed to be true (the premises), a chain of reasoning which leads to a statement (the conclusion) is called a valid argument. Note that this is a logic concept, it is only the "logical form" of the statements and not their "meaning" which is important. Example: If turtles can sing, then artichokes can fly. If artichokes can fly, then turtles can sing and dogs can't play chess. Dogs can play chess if and only if turtles can sing. Therefore, turtles can't sing. The first three lines are the premises, and the last line is the conclusion. Is this a valid argument? Logical Arguments Let S = "turtles can sing", A = "artichokes can fly" and D = "dogs can play chess". The given statements can now be written symbolically as: If turtles can sing, then artichokes can fly. S ⇒ A If artichokes can fly, then turtles can sing and dogs can't play chess. A ⇒ (S∧~D) Dogs can play chess if and only if turtles can sing. D ⇔ S By transitivity, the first two implications give S ⇒ (S∧~D). But, since S and D are logically equivalent, this means that S ⇒ (D∧~D), which is a contradiction. Since a true statement cannot imply a contradiction, we must have that S is false, i.e., ~S is true - turtles can not sing. Another Example There is an astronomer who is not nearsighted. Everyone who wears glasses is nearsighted. Furthermore, everyone either wears glasses or wears contact lenses. Therefore, some astronomer wears contact lenses. Let the universe of discourse be P the set of all people. If x is a person (x in P) then let A(x) be the predicate that x is an astronomer. Similarly, use the following predicates: N(x) means x is nearsighted. G(x) means x wears glasses. C(x) means x wears contact lenses. Another Example ∃x (A(x) ∧ ~N(x)) There is an astronomer who is not nearsighted. ∀x (G(x) ⇒ N(x)) Everyone who wears glasses is nearsighted. ∀x (G(x) ∨ C(x)) everyone either wears glasses or wears contact lenses. By the first premise, there is an astronomer who is not nearsighted. Let's call her Alice. That is, A(Alice) and ~N(Alice) are true propositions. The contrapositive of the second premise is ∀x(~N(x) ⇒ ~G(x)), and as this must hold for Alice, we have ~G(Alice) is true. By the third premise, if ~G(x) then C(x) must be true, i.e., C(Alice) is true. So, there is an astronomer (namely, Alice) who wears contact lenses, and we see that ∃x (A(x) ∧ C(x)) is a true proposition.