, Unsatisfiability

I The of a propositional formula depends on truth CS311H: Discrete assignments to variables

I Example: p evaluates to true under under the assignment p = F Propositional Logic II and to false¬ under p = T

I Some formulas evaluate to true for every assignment, e.g., p p Instructor: I¸sıl Dillig ∨ ¬

I Such formulas are called tautologies or valid formulas

I Some formulas evaluate to false for every assignment, e.g., p p ∧ ¬

I Such formulas are called unsatisfiable formulas or contradictions

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 1/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 2/25

Interpretations Entailment

I To make satisfability/validity precise, we’ll define I Under an , every propositional formula evaluates interpretation of formula to T or F Formula F + Interpretation I = Truth value I An interpretation I for a formula F is a mapping from each propositional variables in F to exactly one truth value I We write I = F if F evaluates to true under I | I : p true, q false, { 7→ 7→ ···} I Similarly, I = F if F evaluates to false under I . 6| I Each interpretation corresponds to one row in the , n I : I = F if and only if I = F so 2 possible interpretations | 6| ¬

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 3/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 4/25

Examples Another Example

I Consider the formula F : p q p q ∧ → ¬ ∨ ¬

I Let I be the interpretation such that [p true, q false] 1 7→ 7→ I Let F1 and F2 be two propositional formulas I What does F evaluate to under I1?

I Suppose F1 evaluates to true under interpretation I I Thus, I = F 1 | I What does F2 F1 evaluate to under I ? I Let I be the interpretation such that [p true, q true] ∧ ¬ 2 7→ 7→

I What does F evaluate to under I2?

I Thus, I = F 2 6|

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 5/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 6/25

1 Satisfiability, Validity True/False Questions

Are the following statements true or false? I F is satisfiable iff there exists interpretation I s.t. I = F | I If a formula is valid, then it is also satisfiable. I F is valid iff for all interpretations I , I = F | I If a formula is satisfiable, then its negation is unsatisfiable. I F is unsatisfiable iff for all interpretations I , I = F 6| I If F1 and F2 are satisfiable, then F1 F2 is also satisfiable. I F is contingent if it is satisfiable, but not valid. ∧ I If F and F are satisfiable, then F F is also satisfiable. 1 2 1 ∨ 2

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 7/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 8/25

Duality Between Validity and Unsatisfiability Proving Validity

I Question: How can we prove that a propositional formula is a ? F is valid if and only if F is unsatisfiable ¬ I Exercise: Which formulas are tautologies? Prove your answer.

1. (p q) ( q p) I Proof: → ↔ ¬ → ¬ 2. (p q) p ∧ ∨ ¬

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 9/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 10/25

Proving Satisfiability, Unsatisfiability, Contingency Exercise

I Similarly, can prove satisfiability, unsatisfiability, contingency I Is (p q) (q p) valid, unsatisfiable, or contingent? using truth tables: → → → Prove your answer.

I Satisfiable: There exists a row where formula evaluates to true

I Unsatisfiable: In all rows, formula evaluates to false

I Contingent: Exists a row where formula evaluates to true, and another row where it evaluates to false

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 11/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 12/25

2 Implication Example

I Does p q imply p? Prove your answer. ∨ I Formula F implies F (written F F ) iff for all 1 2 1 ⇒ 2 interpretations I , I = F F | 1 → 2 F F iff F F is valid 1 ⇒ 2 1 → 2

I Caveat: F F is not a propositional logic formula; is 1 ⇒ 2 ⇒ not part of PL !

I Instead, F F is a semantic judgment, like satisfiability! 1 ⇒ 2

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 13/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 14/25

Equivalence Example

I Two formulas F1 and F2 are equivalent if they have same I Prove that p q and p q are equivalent truth value for every interpretation, e.g., p p and p → ¬ ∨ ∨

I More precisely, formulas F1 and F2 are equivalent, written F F or F F , iff: 1 ≡ 2 1 ⇔ 2 F F iff F F is valid 1 ⇔ 2 1 ↔ 2

I , not part of PL syntax; they are semantic judgments! ≡ ⇔

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 15/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 16/25

Important Equivalences Commutativity and Distributivity Laws

I Commutative Laws: p q q p p q q p I Some important equivalences are useful to know! ∨ ≡ ∨ ∧ ≡ ∧

I Distributivity Law #1: (p (q r)) (p q) (p r) I Law of double negation: p p ∨ ∧ ≡ ∨ ∧ ∨ ¬¬ ≡ I Distributivity Law #2: (p (q r)) (p q) (p r) I Identity Laws: p T p p F p ∧ ∨ ≡ ∧ ∨ ∧ ∧ ≡ ∨ ≡ I Associativity Laws: p (q r) (p q) r I Domination Laws: p T T p F F ∨ ∨ ≡ ∨ ∨ ∨ ≡ ∧ ≡ p (q r) (p q) r ∧ ∧ ≡ ∧ ∧ I Idempotent Laws: p p p p p p ∨ ≡ ∧ ≡ I Absorption #1: p (p q) p ∧ ∨ ≡ I Negation Laws: p p F p p T ∧ ¬ ≡ ∨ ¬ ≡ I Absorption #2: p (p q) p ∨ ∧ ≡

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 17/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 18/25

3 De Morgan’s Laws Why are These Equivalences Useful?

I Let cs311 be the ”John took CS311” and cs312be the proposition ”John took CS312” I Use known equivalences to prove that two formulas are equivalent by rewriting one formula to another I In simple English what does (cs311 cs312) mean? ¬ ∧ I Examples: Prove following formulas are equivalent: I DeMorgan’s law expresses exactly this equivalence! 1. (p ( p q)) and p q ¬ ∨ ¬ ∧ ¬ ∧ ¬ I De Morgan’s Law #1: (p q) ( p q) ¬ ∧ ≡ ¬ ∨ ¬ 2. (p q) and p q ¬ → ∧ ¬ I De Morgan’s Law #2: (p q) ( p q) ¬ ∨ ≡ ¬ ∧ ¬

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 19/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 20/25

Formalizing English in Logic Example, cont

I We can use logic to prove correctness of English arguments. ”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 I For example, consider the : → ∧ ¬ → ¬

I If Joe drives fast, he gets a speeding ticket. I How can we prove this argument is valid?

I Joe did not get a ticket. I Can do this in two ways:

1. Use truth table to show formula is tautology I Therefore, Joe did not drive fast.

2. Use known equivalences to rewrite formula to true I Let f be the proposition ”Joe drives fast”, and t be the proposition ”Joe gets a ticket” I Let’s use equivalences

I How do we encode this argument as a logical formula?

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 21/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 22/25

Another Example Example, cont.

I Can also use to logic to prove an argument is not valid.

I Suppose your friend George make the following argument:

I If Jill carries an umbrella, it is raining. ”If Jill carries an umbrella, it is raining. Jill is not carrying an umbrella. Therefore it is not raining.”: ((u r) u) r I Jill is not carrying an umbrella. → ∧ ¬ → ¬

I How can we prove George’s argument is invalid? I Therefore it is not raining.

I Let’s use logic to prove George’s argument doesn’t hold water.

I Let u = ”Jill is carrying an umbrella”, and r = ”It is raining”

I How do we encode this argument in logic?

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 23/25 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 24/25

4 Summary

I A formula is valid if it is true for all interpretations.

I A formula is satisfiable if it is true for at least one interpretation.

I A formula is unsatisfiable if it is false for all interpretations.

I A formula is contingent if it is true in at least one interpretation, and false in at least one interpretation.

I Two formulas F and F are equivalent, written F F , if 1 2 1 ≡ 2 F F is valid 1 ↔ 2

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Propositional Logic II 25/25

5