Download - Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Transcript
Page 1: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Introduction to LogicRelational Proofs

Michael GeneserethComputer Science Department

Stanford University

Page 2: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

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

Logical Entailment

Page 3: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

p q r0 0 00 0 10 1 00 0 11 0 01 0 11 1 01 1 1

With n constants, there are 2n truth assignments.

Propositional Truth Assignments

Page 4: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

p(a,a) p(a,b) p(b,a) p(b,a) 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 1 o 0 0 … … … …

Many interpretations!

Truth Assignments

Page 5: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Given a few restrictions (described later), we have good news.

Good News: If Δ logically entails ϕ, then there is a finite proof of ϕ from Δ. And vice versa.

More Good News: If Δ logically entails ϕ, it is possible to find such a proof in finite time.

Good News

Page 6: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

More rules of inference

Examples

Soundness and completeness and decidability

Programme

Page 7: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Relational Proofs

Page 8: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Logical Rules of Inference

Negation IntroductionNegation Elimination

And IntroductionAnd Elimination

Or IntroductionOr Elimination

AssumptionImplication EliminationImplication Introduction

Biconditional IntroductionBiconditional Elimination

Page 9: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Universal IntroductionUniversal Elimination

Existential IntroductionExistential Elimination

Domain Closure

New Rules of Inference

Page 10: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Condition: ν does not occur free in ϕ and an active assumption

Universal Introduction (UI)

ϕ

∀ν.ϕ

Page 11: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Examples

Premise: hates(jane,x)Conclusion: ∀x.hates(jane,x)

Premise: hates(jane,jill)Conclusion: ∀x.hates(jane,jill)

Premise: hates(jane,y)Conclusion: ∀x.hates(jane,y)

Examples

Page 12: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

p(x) Assumption

q(x)∀x.q(x) UI

Disallowed Case

Page 13: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

p(x) Assumption

q(x)p(x) ⇒ q(x) II

∀y.(p(x) ⇒ q(x)) UI

Allowed Case

Page 14: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Condition: τ is substitutable for ν in ϕ

Universal Elimination (UE)

∀ν.ϕ[ν]

ϕ[τ]

Page 15: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Premise:∀x.hates(jane,x)

Conclusions:hates(jane,jill) x←jillhates(jane,jane) x←jane

hates(jane,x) x←xhates(jane,y) x←y

Examples

Page 16: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Premise:∀x.∃y.hates(x,y)

Conclusions:∃y.hates(jane,y) x←jane∃y.hates(y,y) x←y Wrong!!

More Examples

Page 17: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

An occurrence of a variable ν in ϕ captures a term τ if and only if τ contains a variable µ and the occurrence of ν lies in the scope of a quantifier of µ.

The occurrence of y in ∃x.hates(x,y) captures x.

Why? The occurrence of y lies in scope of quantifier of x.

Capture

Page 18: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

A term τ is substitutable for ν in ϕ if and only if no free occurrence of ν captures τ.

Some texts say “τ is free for ν in ϕ” instead of “τ is substitutable for ν in ϕ”.

mother(jane) is free for y in hates(jane,y).mother(x) is free for y in hates(jane,y).mother(x) is free for y in ∃z.hates(z,y).mother(x) is not free for y in ∃x.hates(x,y).mother(x) is free for y in (∀x.∃y.l(x,y) ∧ ∃z.h(z,y)).

Substitutability

Page 19: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Condition: τ is substitutable for ν in ϕ

Universal Elimination (UE)

∀ν.ϕ[ν]

ϕ[τ]

Page 20: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Condition: τ does not contain quantified variables

Existential Introduction (EI)

ϕ[τ]

∃ν.ϕ[ν]

Page 21: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Examples

Premise:hates(jill,jill)

Conclusions:∃x.hates(x,x)∃x.hates(jill,x)∃x.hates(x,jill)∃x.∃y.hates(x,y)

Examples

Page 22: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Conditions: ϕ is a closed sentence τ is not an existing constant - Skolem constant

Closed Existential Elimination (EE)

∃ν.ϕ[ν]

ϕ[ [τ] ]

Page 23: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Premise: ∃y.hates(jane,y)Conclusion: hates(jane,[c]) Okay

Premise: ∃y.hates(y,y)Conclusion: hates([c],[c]) Okay

Premise: ∃y.hates(x,y)Conclusion: hates(x,[c]) No!!!

Example

Page 24: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Conditions: ϕ is an open sentence τ is not an existing constant - Skolem function

Open Existential Elimination (EE)

∃ν.ϕ[ν1,…,νn,ν]

ϕ[ [π(ν1,…,νn)] ]

Page 25: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Premise: ∃y.hates(x,y)Conclusion: hates(x, [f(x)] ) Okay

Example

Page 26: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

φ[σ1]…φ[σn]

∀υ.φ[υ]

Domain Closure

Page 27: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Premise: ∃y.hates(jane,y)Conclusion: hates(jane,[c]) Okay

Premise: ∃y.hates(y,y)Conclusion: hates([c],[c]) Okay

Premise: ∃y.hates(x,y)Conclusion: hates(x,[c]) No!!!

Example

Page 28: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

φ[a]φ[b]φ[c]φ[d]

∀x.φ[x]

Example

Page 29: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Example - Lovers

Page 30: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Everybody loves somebody. Everybody loves a lover. Show that Jack loves Jill.

Lovers

Page 31: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Everybody loves somebody. Everybody loves a lover. Show that Jack loves Jill.

Premises: ∀y.∃z.loves(y,z) ∀x.∀y.(∃z.loves(y,z) ⇒ loves(x,y))

Conclusion: loves(jack,jill)

Lovers

Page 32: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Everybody loves somebody. Everybody loves a lover. Show that Jack loves Jill.

1. ∀y.∃z.loves(y,z) Premise

2. ∀x.∀y.(∃z.loves(y,z) ⇒ loves(x,y)) Premise

3. ∃z.loves(jill,z) UE: 1

4. ∀y.(∃z.loves(y,z) ⇒ loves(jack,y)) UE: 2

5. ∃z.loves(jill,z) ⇒ loves(jack,jill) UE: 4

6. loves(jack,jill) IE: 5, 3

Proof

Page 33: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

General Lovers

Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.

Premises: ∀y.∃z.loves(y,z) ∀x.∀y.(∃z.loves(y,z) ⇒ loves(x,y))

Conclusion: ∀x.∀y.loves(x,y)

General Lovers

Page 34: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Everybody loves somebody. Everybody loves a lover. Show that everybody loves evrrybody.

1. ∀y.∃z.loves(y,z) Premise2. ∀x.∀y.(∃z.loves(y,z) ⇒ loves(x,y)) Premise3. ∃z.loves(y,z) UE: 14. ∀y.(∃z.loves(y,z) ⇒ loves(x,y)) UE: 25. ∃z.loves(y,z) ⇒ loves(x,y) UE: 46. loves(x,y) IE: 5, 37. ∀y.loves(x,y) UI: 68. ∀x.∀y.loves(x,y) UI: 7

Proof

Page 35: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Example - Harry and Ralph

Page 36: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Harry and Ralph

Every horse can outrun every dog. Some greyhounds can outrun every rabbit. Harry is a horse. Ralph is a rabbit. Prove that Harry can outrun Ralph.

Harry and Ralph

Page 37: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Harry and Ralph

Every horse can outrun every dog. Some greyhounds can outrun every rabbit. Harry is a horse. Ralph is a rabbit. Prove that Harry can outrun Ralph.

Premises: ∀x.∀y.(h(x) ∧ d(x) ⇒ f(x,y)) ∃y.(g(y) ∧ ∀z.(r(z) ⇒ f(y,z))) ∀x.(g(x) ⇒ d(x)) ∀x.∀y.∀z.(f(y,z) ∧ f(y,z) ⇒ f(x,z)) h(harry) r(ralph)

Conclusion: f(harry,ralph)

Harry and Ralph

Page 38: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Harry and Ralph

Every horse can outrun every dog. Some greyhound can outrun every rabbit. Harry is a horse. Ralph is a rabbit. Prove that Harry can outrun Ralph.

1. ∀x.∀y.(h(x) ∧ d(x) ⇒ f(x,y)) Premise

2. ∃y.(g(y) ∧ ∀z.(r(z) ⇒ f(y,z))) Premise

3. ∀x.(g(x) ⇒ d(x)) Premise

4. ∀x.∀y.∀z.(f(y,z) ∧ f(y,z) ⇒ f(x,z)) Premise

5. h(harry) Premise

6. r(ralph) Premise

Harry and Ralph

Page 39: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Harry and Ralph (continued)7. g([c]) ∧ ∀z.(r(z) ⇒ f([c],z)) EE: 2

8. g([c]) AE: 7

9. ∀z.(r(z) ⇒ f([c],z)) AE: 7

Harry and Ralph (continued)

Page 40: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

7. g([c]) ∧ ∀z.(r(z) ⇒ f([c],z)) EE: 2

8. g([c]) AE: 7

9. ∀z.(r(z) ⇒ f([c],z)) AE: 7

10. r(ralph) ⇒ f([c],ralph) UE: 9

11. f([c],ralph) IE: 10, 6

Harry and Ralph (continued)

Page 41: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

7. g([c]) ∧ ∀z.(r(z) ⇒ f([c],z)) EE: 2

8. g([c]) AE: 7

9. ∀z.(r(z) ⇒ f([c],z)) AE: 7

10. r(ralph) ⇒ f([c],ralph) UE: 9

11. f([c],ralph) IE: 10, 6

12. g([c]) ⇒ d([c]) UE: 3

13. d([c]) IE: 12, 8

Harry and Ralph (continued)

Page 42: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

7. g([c]) ∧ ∀z.(r(z) ⇒ f([c],z)) EE: 2

8. g([c]) AE: 7

9. ∀z.(r(z) ⇒ f([c],z)) AE: 7

10. r(ralph) ⇒ f([c],ralph) UE: 9

11. f([c],ralph) IE: 10, 6

12. g([c]) ⇒ d([c]) UE: 3

13. d([c]) IE: 12, 8

14. ∀y.(h(harry) ∧ d([c]) ⇒ f(harry,[c])) UE: 1

15. h(harry) ∧ d([c]) ⇒ f(harry,[c]) UE: 14

16. h(harry) ∧ d([c]) AI: 5, 13

17. f(harry,[c]) IE: 15, 16

Harry and Ralph (continued)

Page 43: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

18. ∀y.∀z.(f(harry,y) ∧ f(y,z) ⇒ f(harry,z)) UI: 4

19. ∀z.(f(harry,[c]) ∧ f([c],z) ⇒ f(harry,z)) UI: 18

20. f(harry,[c]) ∧ f([c],z) ⇒ f(harry,z) UI: 19

Harry and Ralph (continued)

Page 44: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

18. ∀y.∀z.(f(harry,y) ∧ f(y,z) ⇒ f(harry,z)) UI: 4

19. ∀z.(f(harry,[c]) ∧ f([c],z) ⇒ f(harry,z)) UI: 18

20. f(harry,[c]) ∧ f([c],z) ⇒ f(harry,z) UI: 19

21. f(harry,[c]) ∧ f([c],ralph) AI: 17, 11

22. f(harry,ralph) IE: 20, 21

Harry and Ralph (continued)

Page 45: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Soundness and Completeness

Page 46: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

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 47: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

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 48: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails

Theorem: Fitch is sound and complete for Relational Logic.

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

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

Fitch

Page 49: Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few restrictions (described later), we have good news. Good News: If Δ logically entails