introduction to logic natural deductionintrologic.stanford.edu/lectures/lecture_05.pdfnatural...

40
Introduction to Logic Natural Deduction Michael Genesereth Computer Science Department Stanford University

Upload: others

Post on 24-Jan-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Introduction to LogicNatural Deduction

Michael GeneserethComputer Science Department

Stanford University

Page 2: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Example - Transitivity

1. p ⇒ q Premise2. q ⇒ r Premise3. (q ⇒ r) ⇒ (p ⇒ (q ⇒ r)) IC4. (p ⇒ (q ⇒ r)) IE: 2, 35. (p ⇒ (q ⇒ r)) ⇒ ((p ⇒ q) ⇒ (p ⇒ r)) ID6. (p ⇒ q) ⇒ (p ⇒ r) IE: 4, 57. p ⇒ r IE: 1, 6

Given (p ⇒ q) and (q ⇒ r), prove (p ⇒ r).

Page 3: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Structured Proofs

Page 4: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Making Assumptions e.g. assume p

Applying Ordinary Rules of Inference to derive conclusions e.g. derive q

Discharging Assumptions leading to implications e.g. conclude p ⇒ q

Natural Deduction

Page 5: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Conditional Proofs

Page 6: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

In a conditional proof, it is permissible to make an arbitrary assumption or hypothetical in a nested proof. The assumption need not be in the original premise set.

Such assumptions can be used within the nested proof. However, they may not be used outside of the subproof in which they appear.

Making Assumptions

Page 7: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Example

Page 8: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

An ordinary rule of inference applies to a proof at any level of nesting if and only there is an instance of the rule in which all of the premises occur earlier in the nested proof or in some “superproof” of the nested proof.

Importantly, it is not permissible to apply an ordinary rule of inference to premises in subproofs of a nested proof or in other subproofs of a superproof of a nested proof.

Ordinary Rules of Inference

Page 9: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Example

Page 10: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Bad Proof

XX

Page 11: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Bad Proof

XX

Page 12: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

A structured rule of inference is a pattern of reasoning consisting of one or more schemas, called premises, and one or more additional schemas, called conclusions, in which one of the premises is a condition of the form φ ⊢ ψ.

This schema is called Implication Introduction.

Structured Rules of Inference

φ ⊢ ψφ ⇒ ψ

Page 13: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

A structured rule of inference applies to a nested proof if and only there is an instance of the rule in which all of the premises are satisfied.

A premise that is an ordinary schema is satisfied if and only if it occurs earlier in the nested proof or in any “superproof” of that nested subproof.

A premise of the form φ ⊢ ψ is satisfied if and only if the nested proof has φ as an assumption and terminates in ψ.

Structured Rule Application

Page 14: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

A structured proof of a conclusion from a set of premises is a sequence of (possibly nested) sentences terminating in an occurrence of the conclusion at the top level of the proof. Each step in the proof must be either (1) a premise (at the top level), (2) an assumption, or (3) the result of applying an ordinary or structured rule of inference to earlier items in the sequence (subject to the constraints given above).

Structured Proof

Page 15: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Fitch

Page 16: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Negation Introduction (NI):

Negation Elimination (NE):

Negations

φ ⇒ χφ ⇒ ¬χ¬φ

¬¬φφ

Page 17: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

And Introduction (AI):

And Elimination (AE):

Conjunctions

φψφ ∧ ψ

φ ∧ ψφψ

Page 18: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Or Introduction (BI):

Or Elimination (BE):

Disjunctions

φφ ∨ ψ

φ ∨ ψφ ⇒ χψ ⇒ χχ

Page 19: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

And Introduction (AI):

Implications Elimination (AE):

Implications

φ ⊢ ψφ ⇒ ψ

φ ⇒ ψφψ

Page 20: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Biconditional Introduction (BI):

Biconditional Elimination (BE):

Equivalences / Biconditionals

φ ⇒ ψψ ⇒ φφ ⇔ ψ

φ ⇔ ψφ ⇒ ψψ ⇒ φ

Page 21: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Transitivity - Hilbert Proof

1. p ⇒ q Premise2. q ⇒ r Premise3. (q ⇒ r) ⇒ (p ⇒ (q ⇒ r)) IC4. (p ⇒ (q ⇒ r)) IE: 2, 35. (p ⇒ (q ⇒ r)) ⇒ ((p ⇒ q) ⇒ (p ⇒ r)) ID6. (p ⇒ q) ⇒ (p ⇒ r) IE: 4, 57. p ⇒ r IE: 1, 6

Given (p ⇒ q) and (q ⇒ r), prove (p ⇒ r).

Page 22: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Transitivity - Fitch Proof

Given (p ⇒ q) and (q ⇒ r), prove (p ⇒ r).

Page 23: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Reflexivity - Hilbert Proof

1. p ⇒ (p ⇒ p) IC2. p ⇒ ((p ⇒ p) ⇒ p) IC3 p ⇒ ((p ⇒ p) ⇒ p) ⇒ ((p ⇒ (p ⇒ p)) ⇒ (p ⇒ p)) ID4 (p ⇒ (p ⇒ p)) ⇒ (p ⇒ p) IE: 2, 45. (p ⇒ p) IE: 1, 4

Prove (p ⇒ p).

Page 24: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Reflexivity - Fitch Proof

1. | p Assumption2. p ⇒p Implication Introduction: 1, 1

Prove (p ⇒ p).

Page 25: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Inconsistency - Hilbert Proof

1. p Premise2. ¬p Premise3 ¬p ⇒ (¬q ⇒ ¬p) IC4 ¬q ⇒ ¬p IE: 3, 25. (¬q ⇒ ¬p) ⇒ (p ⇒ q) IR6. p ⇒ q IE: 5, 47. q IE: 6, 1

Given p and ¬p, prove q.

Page 26: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Inconsistency - Fitch Proof

Given p and ¬p, prove q.

1. p Premise2. ¬p Premise3 | ¬q Assumption4 | p Reiteration: 15. ¬q ⇒ p Implication Introduction: 3, 46. | ¬q Assumption7. | ¬p Reiteration: 28. ¬q ⇒ ¬p Implication Introduction: 6, 7 9. ¬¬q Negation Introduction: 5, 810. q Negation Elimination: 9

Page 27: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Negation Elimination - Hilbert Proof

1 ¬¬p ⇒ (¬¬¬¬p ⇒ ¬¬p) IC2. (¬¬¬¬p ⇒ ¬¬p) ⇒ (¬p ⇒ ¬¬¬p) IR4. ¬¬p ⇒ (¬p ⇒ ¬¬¬p) Transitivity: 1, 25. (¬p ⇒ ¬¬¬p) ⇒ (¬¬p ⇒ p) IR6. ¬¬p ⇒ (¬¬p ⇒ p) Transitivity: 4, 57. (¬¬p ⇒ (¬¬p ⇒ p)) ⇒

((¬¬p ⇒ ¬¬p) ⇒ (¬¬p ⇒ p))ID

8. (¬¬p ⇒ ¬¬p) ⇒ (¬¬p ⇒ p) IE: 7, 69. ¬¬p ⇒ ¬¬p Reflexivity10. ¬¬p ⇒ p IE: 8, 9

Prove (¬¬p ⇒ p).

Page 28: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Prove (¬¬p ⇒ p).

Negation Elimination - Fitch Proof

1 | ¬¬p Assumption2. | p Negation Elimination: 14. ¬¬p ⇒ p Implication Introduction: 1, 2

Page 29: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Negation Introduction - Hilbert Proof

1. p ⇒ p Reflexivity2. ¬p ⇒ ¬p Reflexivity3. p ⇒ ¬¬p Contradiction: 1, 2

Prove (p ⇒ ¬¬p).

Page 30: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Negation Introduction - Fitch Proof

1. | p Assumption2. | | ¬p Assumption3. | | p Reiteration: 14. | ¬p ⇒ p

ppp¬p Implication Introduction: 2, 3

5. | | ¬p Assumption6. | ¬p ⇒ ¬p Implication Introduction: 5, 57. | ¬¬p Negation Introduction: 4, 68. p ⇒ ¬¬p Implication Introduction: 1, 7

Prove (p ⇒ ¬¬p).

Page 31: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Soundness and Completeness

Page 32: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

A set of premises Δ logically entails a conclusion ϕ (Δ |= ϕ) if and only if every interpretation that satisfies Δ also satisfies ϕ.

If there exists a proof of a sentence φ from a set Δ of premises using the rules of inference in R, we say that φ is provable from Δ using R (written Δ ⊢R φ).

Logical Entailment and Provability

Page 33: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

A proof system is sound if and only if every provable conclusion is logically entailed.

If Δ ⊢ φ, then Δ ⊨ φ.

A proof system is complete if and only if every logical conclusion is provable.

If Δ ⊨ φ, then Δ ⊢ φ.

Soundness and Completeness

Page 34: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Theorem: Fitch is sound and complete for Propositional Logic.

Δ |= ϕ if and only if Δ ⊢Fitch φ.

Upshot: The truth table method and the proof method succeed in exactly the same cases!

Fitch

Page 35: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Practical Matters

Page 36: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Tip 1: If the goal has the form (φ ⇒ ψ), it is often good to assume φ and prove ψ and then use Implication Introduction to derive the goal.

Reasoning Tips

1. q Premise

2. | p Assumption

3. | q Reiteration: 1

4. p ⇒ q IE: 2, 3

Page 37: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Tip 2: If the goal has the form (φ ∧ ψ), prove φ and then prove ψ and then use And Introduction to derive (φ ∧ ψ).

Tip 3: If the goal has the form (φ ∨ ψ), try to prove φ or prove ψ (but we do not need to prove both), then use Or Introduction to disjoin with anything else.

Reasoning Tips

Page 38: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Tip 4: If the goal has the form ¬φ, (a) assume φ and derive the sentence (φ ⇒ ψ), (b) assume φ again and derive the sentence ¬ψ leading to (φ ⇒ ¬ψ), and (c) use Negation Introduction to derive ¬φ as desired.

Tip 5: To prove any sentence φ, assume ¬φ, prove a contradiction as just discussed, thereby deriving ¬¬φ, and then apply Negation Elimination to get φ.

Reasoning Tips

Page 39: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary

Tip 6: Given a premise of the form (φ ⇒ ψ) and a goal ψ, try proving φ and then use Implication Elimination to derive ψ.

Tip 7: Given a premise (φ ∨ ψ) and our goal is to prove χ, try proving (φ ⇒ χ) and (ψ ⇒ χ) and use Or Elimination to derive χ.

Reasoning Tips

Page 40: Introduction to Logic Natural Deductionintrologic.stanford.edu/lectures/lecture_05.pdfNatural Deduction Conditional Proofs In a conditional proof, it is permissible to make an arbitrary