Announcements CS311H: Discrete Mathematics Propositional Logic II Instructor: Işıl Dillig First homework assignment out today! Due in one week, i.e., before lecture next Wed 09/13 Remember: Due before lecture starts! Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 1/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 2/36 Converse of a Implication Inverse of an Implication Recall implication p q when does it evaluate to false? The converse of an implication p q is q p. What is the converse of If I am a CS major, then I can program? What is the converse of If I get an A in CS311, then I am smart? Note: It is possible for a implication to be true, but its converse to be false, e.g., F T is true, but converse false The inverse of an implication p q is p q. What is the inverse of If I am a CS major, then I can program? What is the inverse of If I get an A in CS311, then I am smart? Note: It is possible for a implication to be true, but its inverse to be false. F T is true, but inverse is false Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 3/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 4/36 Contrapositive of Implication Conditional and its Contrapositive The contrapositive of an implication p q is q p. What is the contrapositive of If I am a CS major, then I can program? What is the contrapositive of If I get an A in CS311, then I am smart? Question: Is it possible for an implication to be true, but its contrapositive to be false? A conditional p q and its contrapositive q p always have the same truth value. Proof: We consider all four possible cases: p = T, q = T : Both T T and F F are true p = T, q = F : Both T F and T F are false p = F, q = T : Both F T and F T are true p = F, q = F : Both F F and T T are true Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 5/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 6/36 1
Question Summary Conditional is of the form p q Consider a conditional p q Is it possible that its converse is true, but inverse is false? Converse: q p Inverse: p q Contrapositive: q p Conditional and contrapositive have same truth value Inverse and converse always have same truth value Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 7/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 8/36 Biconditionals Operator Precedence A biconditional p q is the proposition p if and only if q. The biconditional p q is true if p and q have same truth value, and false otherwise. Exercise: Construct a truth table for p q Question: How can we express p q using the other boolean connectives? Given a formula p q r, do we parse this as (p q) r or p (q r)? Without settling on a convention, formulas without explicit paranthesization are ambiguous. To avoid ambiguity, we will specify precedence for logical connectives. Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 9/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 10/36 Operator Precedence, cont. Operator Precedence Example Negation ( ) has higher precedence than all other connectives. Question: Does p q mean (i) (p q) or (ii) ( p) q? Conjunction ( ) has next highest predence. Question: Does p q q mean (i) (p q) r or (ii) p (q r)? Disjunction ( ) has third highest precedence. Next highest is precedence is, and lowest precedence is Which is the correct interpretation of the formula p q r q r (A) ((p (q r)) q) ( r) (B) ((p q) r) q) ( r) (C) (p (q r)) (q ( r)) (D) (p ((q r) q)) ( r) Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 11/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 12/36 2
Validity, Unsatisfiability Interpretations The truth value of a propositional formula depends on truth assignments to variables Example: p evaluates to true under under the assignment p = F and to false under p = T Some formulas evaluate to true for every assignment, e.g., p p Such formulas are called tautologies or valid formulas Some formulas evaluate to false for every assignment, e.g., p p To make satisfability/validity precise, we ll define interpretation of formula An interpretation I for a formula F is a mapping from each propositional variables in F to exactly one truth value I : {p true, q false, } Each interpretation corresponds to one row in the truth table, so 2 n possible interpretations Such formulas are called unsatisfiable formulas or contradictions Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 13/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 14/36 Entailment Examples Consider the formula F : p q p q Under an interpretation, every propositional formula evaluates to T or F Formula F + Interpretation I = Truth value We write I = F if F evaluates to true under I Similarly, I = F if F evaluates to false under I. Theorem: I = F if and only if I = F Let I 1 be the interpretation such that [p true, q false] What does F evaluate to under I 1? Thus, I 1 = F Let I 2 be the interpretation such that [p true, q true] What does F evaluate to under I 2? Thus, I 2 = F Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 15/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 16/36 Another Example Satisfiability, Validity Let F 1 and F 2 be two propositional formulas Suppose F 1 evaluates to true under interpretation I What does F 2 F 1 evaluate to under I? F is satisfiable iff there exists interpretation I s.t. I = F F is valid iff for all interpretations I, I = F F is unsatisfiable iff for all interpretations I, I = F F is contingent if it is satisfiable, but not valid. Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 17/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 18/36 3
True/False Questions Duality Between Validity and Unsatisfiability Are the following statements true or false? If a formula is valid, then it is also satisfiable. F is valid if and only if F is unsatisfiable If a formula is satisfiable, then its negation is unsatisfiable. If F 1 and F 2 are satisfiable, then F 1 F 2 is also satisfiable. Proof: If F 1 and F 2 are satisfiable, then F 1 F 2 is also satisfiable. Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 19/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 20/36 Proving Validity Proving Satisfiability, Unsatisfiability, Contingency Question: How can we prove that a propositional formula is a tautology? Similarly, can prove satisfiability, unsatisfiability, contingency using truth tables: Exercise: Which formulas are tautologies? Prove your answer. 1. (p q) ( q p) Satisfiable: There exists a row where formula evaluates to true Unsatisfiable: In all rows, formula evaluates to false 2. (p q) p Contingent: Exists a row where formula evaluates to true, and another row where it evaluates to false Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 21/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 22/36 Exercise Implication Is (p q) (q p) valid, unsatisfiable, or contingent? Prove your answer. Formula F 1 implies F 2 (written F 1 F 2 ) iff for all interpretations I, I = F 1 F 2 F 1 F 2 iff F 1 F 2 is valid Caveat: F 1 F 2 is not a propositional logic formula; is not part of PL syntax! Instead, F 1 F 2 is a semantic judgment, like satisfiability! Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 23/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 24/36 4
Example Equivalence Does p q imply p? Prove your answer. Two formulas F 1 and F 2 are equivalent if they have same truth value for every interpretation, e.g., p p and p More precisely, formulas F 1 and F 2 are equivalent, written F 1 F 2 or F 1 F 2, iff: F 1 F 2 iff F 1 F 2 is valid, not part of PL syntax; they are semantic judgments! Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 25/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 26/36 Example Important Equivalences Some important equivalences are useful to know! Prove that p q and p q are equivalent Law of double negation: p p Identity Laws: p T p p F p Domination Laws: p T T p F F Idempotent Laws: p p p p p p Negation Laws: p p F p p T Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 27/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 28/36 Commutativity and Distributivity Laws De Morgan s Laws Commutative Laws: p q q p p q q p Distributivity Law #1: (p (q r)) (p q) (p r) Distributivity Law #2: (p (q r)) (p q) (p r) Associativity Laws: p (q r) (p q) r p (q r) (p q) r Let cs311 be the proposition John took CS311 and cs312 be the proposition John took CS312 In simple English what does (cs311 cs312) mean? DeMorgan s law expresses exactly this equivalence! De Morgan s Law #1: (p q) ( p q) De Morgan s Law #2: (p q) ( p q) When you push negations in, becomes and vice versa Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 29/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 30/36 5
Why are These Equivalences Useful? Formalizing English Arguments in Logic We can use logic to prove correctness of English arguments. Use known equivalences to prove that two formulas are equivalent i.e., rewrite one formula into another using known equivalences Examples: Prove following formulas are equivalent: 1. (p ( p q)) and p q 2. (p q) and p q For example, consider the argument: If Joe drives fast, he gets a speeding ticket. Joe did not get a ticket. Therefore, Joe did not drive fast. Let f be the proposition Joe drives fast, and t be the proposition Joe gets a ticket How do we encode this argument as a logical formula? Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 31/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 32/36 Example, cont Another Example Can also use to logic to prove an argument is not valid. If Joe drives fast, he gets a speeding ticket. Joe did not get a ticket. Therefore, he did not drive fast. : ((f t) t) f How can we prove this argument is valid? Can do this in two ways: 1. Use truth table to show formula is tautology 2. Use known equivalences to rewrite formula to true Suppose your friend George make the following argument: If Jill carries an umbrella, it is raining. Jill is not carrying an umbrella. Therefore it is not raining. Let s use logic to prove George s argument doesn t hold water. Let u = Jill is carrying an umbrella, and r = It is raining How do we encode this argument in logic? Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 33/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 34/36 Example, cont. Summary A formula is valid if it is true for all interpretations. If Jill carries an umbrella, it is raining. Jill is not carrying an umbrella. Therefore it is not raining. : ((u r) u) r How can we prove George s argument is invalid? A formula is satisfiable if it is true for at least one interpretation. A formula is unsatisfiable if it is false for all interpretations. A formula is contingent if it is true in at least one interpretation, and false in at least one interpretation. Two formulas F 1 and F 2 are equivalent, written F 1 F 2, if F 1 F 2 is valid Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 35/36 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 36/36 6