Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few...

Post on 08-Nov-2020

5 views 0 download

Transcript of Introduction to Logic Relational Proofsintrologic.stanford.edu/lectures/lecture_09.pdfGiven a few...

Introduction to LogicRelational Proofs

Michael GeneserethComputer Science Department

Stanford University

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

Logical Entailment

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

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

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

More rules of inference

Examples

Soundness and completeness and decidability

Programme

Relational Proofs

Logical Rules of Inference

Negation IntroductionNegation Elimination

And IntroductionAnd Elimination

Or IntroductionOr Elimination

AssumptionImplication EliminationImplication Introduction

Biconditional IntroductionBiconditional Elimination

Universal IntroductionUniversal Elimination

Existential IntroductionExistential Elimination

Domain Closure

New Rules of Inference

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

Universal Introduction (UI)

ϕ

∀ν.ϕ

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

p(x) Assumption

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

Disallowed Case

p(x) Assumption

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

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

Allowed Case

Condition: τ is substitutable for ν in ϕ

Universal Elimination (UE)

∀ν.ϕ[ν]

ϕ[τ]

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

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

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

More Examples

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

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

Condition: τ is substitutable for ν in ϕ

Universal Elimination (UE)

∀ν.ϕ[ν]

ϕ[τ]

Condition: τ does not contain quantified variables

Existential Introduction (EI)

ϕ[τ]

∃ν.ϕ[ν]

Examples

Premise:hates(jill,jill)

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

Examples

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

Closed Existential Elimination (EE)

∃ν.ϕ[ν]

ϕ[ [τ] ]

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

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

Open Existential Elimination (EE)

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

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

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

Example

φ[σ1]…φ[σn]

∀υ.φ[υ]

Domain Closure

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

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

∀x.φ[x]

Example

Example - Lovers

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

Lovers

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

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

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

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

Example - Harry and Ralph

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

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

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

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)

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)

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)

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)

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)

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)

Soundness and Completeness

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

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

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