Lecture 2 Soundness and completeness of propositional logic February 9, 2004 1
Overview Review of natural deduction. Soundness and completeness. Semantics of propositional formulas. Soundness proof. Completeness proof. 2
Propositional formulas Grammar: φ ::= p ( φ) (φ φ) (φ φ) (φ φ) Precedence rules: >, > Example: (p ((q ( r)) q)) p (q r q) 3
Natural deduction Rules for reasoning about formulas. Introduction rules: Connective in the conclusion. Example: φ. ψ -i φ ψ Elimination rules: Connective in a premise. Example: φ φ ψ ψ -e 4
Basic rules Introduction φ ψ -i φ ψ φ ψ φ Elimination φ ψ -e 1 ψ -e 2 φ φ ψ -i 1 ψ φ ψ -i 2 φ ψ φ. χ ψ. χ -e χ φ. ψ -i φ φ ψ ψ -e φ ψ φ. -i φ φ -e φ no rule φ -e φ φ -e 5
Sequents φ 1,..., φ n ψ Formula ψ can be proved from formulas φ 1,..., φ n. Use introduction rules to construct the goal formula. Use elimination rules to extract information from the premises. Example: p q, r s p r q s Introduction Elimination φ φ ψ -i 1 ψ φ ψ -i 2 φ ψ φ. χ ψ. χ -e χ φ. ψ -i φ φ ψ ψ -e φ ψ 6
Proof 1. p r assumption 2. p assumption 3. p q premise 4. q -e : 2, 3 5. q s -i 1 : 4 6. r assumption 7. r s premise 8. s -e : 6, 7 9. q s -i 2 : 8 10. q s -e : 2 9 11. p r q s -i : 1 10 Observe: -i 1 used in first subproof. -i 2 used in second subproof. Rules and proof steps must match exactly. What can be proved, given this constraint? 7
Reasoning vs. reality Reasoning: argument based on observations and derivational rules. Reality: reality. How does reasoning relate to reality? Soundness: reasoning derives only true statements. Completeness: reasoning derives all true statements. 8
Soundness, completeness, and auto mechanics Reality: the fan belt is broken. Mechanics diagnosis: 9
Soundness, completeness, and propositional logic For natural deduction, Soundness: a formula that is provable is true. Completeness: every true formula is provable. What is a true formula? 10
Semantics A formula is either true T or false F. The meaning depends on the meaning of the subterms. Examples: [[φ]] = T implies [[ φ]] = F [[p]] = T and [[q]] = F implies [[p q]] = T 11
Truth tables The value of a formula for all possible inputs. Basic connectives: T F φ φ F T T F φ ψ φ ψ T T T T F F F T F F F F φ ψ φ ψ T T T T F T F T T F F F φ ψ φ ψ T T T T F F F T T F F T Other tables define other functions. 12
Meaning of a formula Begin with the meanings of atoms. Compute the value bottom-up. Example: (p q) (p r) p q r p q p r (p q) (p r) T T T T T F T F T T F F F T T F T F F F T F F F Tautology: Always true. Contradiction: always false. 13
Semantic entailment φ 1,... φ n = ψ ψ true when φ 1,... φ n are true. 1. Compute truth tables of the φ 1,... φ n. 2. Collect lines where φ 1,... φ n are all true. 3. Evaluate ψ in these cases. 14
Example p (q r), r, p = q p q r q r p (q r) r p T T T T T F T T T F F F T T T F T T T F T T F F T T T T F T T T T F F F T F F T T F F F T T T F F F F F T T T F All true when [[p]] = T, [[q]] = [[r]] = F. p q r q T F F T Thus, p (q r), r, p = q 15
Soundness and completeness Relate provability to semantic entailment. Soundness: φ 1,..., φ n ψ implies that φ 1,..., φ n = ψ. Completeness: φ 1,..., φ n = ψ implies that φ 1,..., φ n ψ. 16
Soundness Theorem: Let φ 1,..., φ n and ψ be propositional logic formulas. Then, if φ 1,..., φ n ψ, then φ 1,..., φ n = ψ. Proof idea: each proof step is justified by truth tables. 17
Proof: inductive definition φ : premise is a proof of Φ φ, where φ Φ. Let: α i prove Φ φ i β j prove Φ, ψ j χ j For any rule: φ 1... φ m ψ ψ 1. χ 1... ψ n. χ n Then proves Φ ψ. α 1,..., α m, β 1,..., β m, ψ Soundness proof: by induction on the structure of the proof of φ 1,..., φ n ψ. 18
Base case Proof: φ : premise Proves: Φ φ, where φ Φ Show: Φ = φ Evaluate φ for truth table lines where Φ are all T. Since φ Φ, clearly φ is T. 19
Induction case Proof: α 1,..., α m, β 1,..., β n, ψ Proves: Φ ψ Show: Φ = ψ There is a rule: φ 1... φ m ψ ψ 1. χ 1... ψ n. χ n Induction hypothesis: α i proves Φ φ i implies Φ = φ i. β j proves Φ, ψ j χ j implies Φ, ψ 1 χ j. Proceed by cases on the possible rules. 20
Rule: -i φ ψ φ ψ -i Proof contains: Φ φ, Φ ψ By induction: Φ = φ, Φ = ψ Evaluate φ ψ when [[φ]] = [[ψ]] = T: φ ψ φ ψ T T T Thus, Φ = φ ψ. 21
Rule: -e φ φ -e Proof contains Φ φ, Φ φ By induction: Φ = φ, Φ = φ Truth table for φ Φ never all T. φ φ F T T F Thus, trivially: Φ = NB: Truth table for : F 22
Rule: -e φ -e Proof contains: Φ. By induction: Φ =. Truth table for : Φ never all T. F Thus, trivially: Φ = φ 23
Rule -i φ. ψ -i φ ψ Proof contains: Φ, φ ψ. By induction: Φ, φ = ψ. Show: when Φ all true, so is φ ψ. φ ψ φ ψ T T T T F F φ ψ φ ψ F T T F F T Potential problem when [[φ]] = T and [[ψ]] = F. But, by induction, if Φ all true and [[φ]] = T, then [[ψ]] = T. Thus, Φ = φ ψ. 24
Completeness Theorem: Let φ 1,..., φ n and ψ be propositional logic formulas. Then, if φ 1,..., φ n = ψ, then φ 1,..., φ n ψ. Proof idea: construct a proof from a truth table. 25
Completeness proof structure 1. Eliminate premises: φ 1, φ 2,..., φ n = ψ implies = φ 1 (φ 2... (φ n ψ)). 2. Show provability: = φ 1 (φ 2... (φ n ψ)) implies φ 1 (φ 2... (φ n ψ)). 3. Reintroduce premises: φ 1 (φ 2... (φ n ψ)) implies φ 1, φ 2,..., φ n ψ. 26
Eliminating premises Theorem: If φ 1, φ 2,..., φ n = ψ, then = φ 1 (φ 2... (φ n ψ)). Proof: By induction on n. Base case: n = 0. Clearly = ψ implies = ψ. Induction case: We showed Ψ, φ = ψ implies Ψ = φ ψ. Thus, φ 1, φ 2,..., φ n = ψ implies φ 1,... φ n 1 = φ n ψ. By induction, = φ 1 (φ 2... (φ n ψ)) 27
Showing provability Theorem: Let φ be a formula such that p 1, p 2,..., p n are its only propositional atoms. Let l be any line in φ s truth table. For any atom or formula α, let γ l (α) be α if the truth table entry in line l for α is T, and α if the truth table entry for α is F. Then, γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) γ l (φ) is provable. 28
Example (p r) (q s) A truth table line: p q r s p r q s (p r) (q s) T F T T T F F Constructed sequent: p, q, r, s ((p r) (q s)) Another truth table line: p q r s p r q s (p r) (q s) F T F T F T T Constructed sequent: p, q, r, s (p r) (q s) 29
Proof Induction on the structure of φ. Base case: φ p. Truth table: p T F p T F γ l (p) γ l (p) p p, or p p: Proof of p p: Proof of p p: Thus, γ l (p) γ l (p). 1. p premise 2. p 1 1. p premise 2. p 1 30
Negation φ ψ Possible truth table lines: ψ ψ F T T F If [[ψ]] = F and [[ ψ]] = T: Show γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) ψ By induction, since [[ψ]] = F: γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) ψ 31
Negation, continued If [[ψ]] = T and [[ ψ]] = F: Show γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) ψ By induction, since [[ψ]] = T: γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) ψ To prove γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) ψ: First prove γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) ψ. Use -i. 32
Implication φ φ 1 φ 2 Proof strategy: Consider possible truth values of φ 1 φ 2. Use induction to find proofs of γ l (φ 1 ) and γ l (φ 2 ). Construct a proof of γ l (φ 1 φ 2 ). φ 1 φ 2 φ 1 φ 2 T T T T F F F T T F F T Four lines, so four cases. 33
Use of the induction hypothesis Consider φ 1, φ 2 : Propositional atoms of φ 1 : a 1,..., a x. Propositional atoms of φ 2 : b 1,..., b y. Atoms of φ 1 φ 2 = {a 1,..., a x } {b 1,..., b y }. Thus, a truth table line for φ 1 φ 2 also gives meaning to φ 1 and φ 2. 34
Using the induction hypothesis For a truth table line l for φ 1 φ 2, by induction: γ l (a 1 ),..., γ l (a x ) γ l (φ 1 ) γ l (b 1 ),..., γ l (b y ) γ l (φ 2 ) Our goal: γ l (a 1 ),..., γ l (a x ), γ l (b 1 ),..., γ l (b y ) γ l (φ 1 φ 2 ) Proof structure: Proof of γ l (a 1 ),..., γ l (a x ) γ l (φ 1 ). Proof of γ l (b 1 ),..., γ l (b y ) γ l (φ 2 ). Extend these sequents to include all premises. γ l (φ 1 ) γ l (φ 2 ) : -i Derive γ l (φ 1 φ 2 ) from γ l (φ 1 ) γ l (φ 2 ). 35
Cases φ 1 is T, φ 2 is T, and φ is T: Show φ 1 φ 2 implies φ 1 φ 2. φ 1 is T, φ 2 is F, and φ is F: Show φ 1 φ 2 implies (φ 1 φ 2 ). φ 1 is F, φ 2 is T, and φ is T: Show φ 1 φ 2 implies φ 1 φ 2. φ 1 is F, φ 2 is F, and φ is T: Show φ 1 φ 2 implies φ 1 φ 2. Conjunction and disjunction similar. 36
Combining sequents We have a complete collection of sequents: γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) γ l (φ) Note: = φ implies l.γ l (φ) = φ. We want to prove: φ Proof idea: Use the Law of the Excluded Middle. 37
Example (p q) q Constructed sequents: p, q (p q) q. p, q (p q) q. p, q (p q) q. p, q (p q) q. Consider p, q (p q) q and p, q (p q) q. Proof of p (p q) q: 1. q q LEM 2. q assumption 3 proof of p, q (p q) q 4. q assumption 5 proof of p, q (p q) q 6. (p q) q -e : 1 5 38
Proof idea Goal: Reduce γ l (p 1 ), γ l (p 2 ),..., γ l (p n ) φ to φ. Proof by induction on n. Find pairs of sequents that only differ in γ l (p n ). Use LEM to prove a single sequent without either γ l (p n ) in premises. 39
Reintroducing premises Theorem: If φ 1 (φ 2... (φ n ψ)), then φ 1, φ 2,..., φ n ψ. Proof idea: Convert φ 1 (φ 2... (φ n ψ)) to φ 1 φ 2... (φ n ψ), and proceed by induction. Problem: Theorem not general enough. Restatement: If Φ φ 1 (φ 2... (φ n ψ)), then Φ, φ 1, φ 2,..., φ n ψ. 40
Proof Given a proof of: Φ φ 1 (φ 2... (φ n ψ)) Prove: Φ, φ 1 φ 2... (φ n ψ) Proof of Φ φ 1 (φ 2... (φ n ψ)) φ 1 : premise φ 2... (φ n ψ) : -e By induction, Φ, φ 1, φ 2,..., φ n ψ. Take Φ = to prove the original theorem. 41
Summary: completeness 1. Eliminate premises: φ 1, φ 2,..., φ n = ψ implies = φ 1 (φ 2... (φ n ψ)). 2. Show provability: = φ 1 (φ 2... (φ n ψ)) implies φ 1 (φ 2... (φ n ψ)). 3. Reintroduce premises: φ 1 (φ 2... (φ n ψ)) implies φ 1, φ 2,..., φ n ψ. 42