G → F - Paul Egré

Also called “tableau method”: • An analytic proof method : complex formulas are decomposed into simpler formulas. • Link with proof by reductio : to prove that F ...
130KB taille 9 téléchargements 49 vues
Introduction to Logic

1

Interim Summary Yesterday, we saw: • The syntax and semantics of propositional logic • Definitions of logical validity, satisfiability, logical consequence • Propositional logic is decidable

EALING 2005

´ e P. Egr´

Introduction to Logic

2

Back to the exercises 1. If John comes to the party, then Mary will not be happy: (j → ¬m) 2. Unless John comes to the party, Mary will not be happy: (j ∨ ¬m), or (¬j → ¬m) 3. If Bill jumps and Mary doesn’t make a leap, Sam will have to do a gigantic step: ((b ∧ ¬m) → s)

EALING 2005

´ e P. Egr´

Introduction to Logic

3

Peirce’s law p

q

(((p → q) → p)



p)

1

1

1

1

1

1

0

1

1

1

0

1

0

1

0

0

0

0

1

0

EALING 2005

´ e P. Egr´

Introduction to Logic

4

p

q

r

(((p ↔ q)



(¬r → p))

1

1

1

1

1

1

(p ∧ q ∧ r)

1

1

0

1

1

1

(p ∧ q ∧ ¬r)

1

0

1

0

0

1

1

0

0

0

0

1

0

1

1

0

0

1

0

1

0

0

0

0

0

0

1

1

1

1

0

0

0

1

0

0

(¬p ∧ ¬q ∧ r)

Resulting DNF: (p ∧ q ∧ r) ∨ (p ∧ q ∧ ¬r) ∨ (¬p ∧ ¬q ∧ r) EALING 2005

´ e P. Egr´

Introduction to Logic

5

Sheffer stroke p

q

(p|q)

(p|p)

(¬p|¬q)

1

1

0

0

1

1

0

1

0

1

0

1

1

1

1

0

0

1

1

0

EALING 2005

´ e P. Egr´

Introduction to Logic

6

3. Trees

EALING 2005

´ e P. Egr´

Introduction to Logic

7

The tree method Also called “tableau method”: • An analytic proof method : complex formulas are decomposed into simpler formulas • Link with proof by reductio : to prove that F follows from F1 , ..., Fn , show that ¬F is inconsistent with all of F1 , ..., Fn . Lemma : Γ |= F iff Γ ∪ {¬F } is not satisfiable.

EALING 2005

´ e P. Egr´

Introduction to Logic

a.

8

F ∧G F

F ∨G

F →G

F ↔G

F

¬F

F

¬F

G

¬G

B

G

G b.

¬(F ∧ G) ¬F

c.

¬(F ∨ G)

¬(F → G)

¬F

F

F

¬F

¬G

¬G

¬G

G

¬G

¬¬F

(F ∧ G ∧ H)

F

F G

¬(F ↔ G)

(F ∨ G ∨ H) F

G

H

H EALING 2005

´ e P. Egr´

Introduction to Logic

9

Construction of the tree 1. To prove that F1 , . . . , Fn |= H, build the root tree F1 ... Fn ¬H 2. Extend the root tree by applying the branching rules to the first root formula, and iterate until no further extension can be done from that formula (mark it then). 3. If a branch contains a formula and its negation : close if off (by ×) 4. Repeat step 2 from branches that are still open with the next root formula. EALING 2005

´ e P. Egr´

Introduction to Logic

10

5. Stop when all branches are closed, or when all root formulas have been used.

EALING 2005

´ e P. Egr´

Introduction to Logic

11

A simple example Is is the case that: p |= p ∨ q ? p ¬(p ∨ q)

EALING 2005

´ e P. Egr´

Introduction to Logic

12

A simple example Is is the case that: p |= p ∨ q ? p ¬(p ∨ q) ¬p ¬q

EALING 2005

´ e P. Egr´

Introduction to Logic

13

A simple example Is is the case that: p |= p ∨ q ? p ¬(p ∨ q) ¬p ¬q

EALING 2005

´ e P. Egr´

Introduction to Logic

14

A simple example Is is the case that: p |= p ∨ q ? p ¬(p ∨ q) ¬p ¬q ×

EALING 2005

´ e P. Egr´

Introduction to Logic

15

Adequation Theorem • (soundness) if all the branches of the tree are closed : then F, G |= H. • (completeness) If one of the branches is still open, F, G 2 H.

EALING 2005

´ e P. Egr´

Introduction to Logic

16

Soundness of the method Def. call a branch satisfiable if the formulas on that branch are jointly satisfiable. Fact 1 : a closed branch contains a formula and its negation, so a closed branch is not satisfiable. Fact 2 : If a branch extension rule is applied to a satisfiable branch, then one of the extended branches is satisfiable (induction on the rules). Corollary: if all branches are closed, none of the branches is satisfiable (fact 1), and so the root formulas F, G, ¬H are not jointly satisfiable (fact 2), ie F, G |= H. EALING 2005

´ e P. Egr´

Introduction to Logic

17

Example Show that (¬p ∨ ¬q) follows from (p → r), (q → s), (¬r ∨ ¬s)

EALING 2005

´ e P. Egr´

Introduction to Logic

18

(p → r) (q → s) (¬r ∨ ¬s)

EALING 2005

´ e P. Egr´

Introduction to Logic

19

(p → r) (q → s) (¬r ∨ ¬s) ¬(¬p ∨ ¬q)

EALING 2005

´ e P. Egr´

Introduction to Logic

20

(p → r) (q → s) (¬r ∨ ¬s) ¬(¬p ∨ ¬q)



¬¬p ¬¬q

EALING 2005

´ e P. Egr´

Introduction to Logic

21

(p → r)



(q → s) (¬r ∨ ¬s) ¬(¬p ∨ ¬q)



¬¬p ¬¬q ¬p

r

×

EALING 2005

´ e P. Egr´

Introduction to Logic

22



(p → r)



(q → s)

(¬r ∨ ¬s) ¬(¬p ∨ ¬q)



¬¬p ¬¬q ¬p ×

r ¬q

s

× EALING 2005

´ e P. Egr´

Introduction to Logic

EALING 2005

23

´ e P. Egr´

Introduction to Logic

24

(p → r) (q → s) (¬r ∨ ¬s)

√ √ √ √

¬(¬p ∨ ¬q) ¬¬p ¬¬q ¬p ×

r ¬q ×

EALING 2005

s ¬r

¬s

×

×

´ e P. Egr´

Introduction to Logic

25

Completeness Idea : an open branch corresponds to an assignment which satisfies all the root formulas. Let B be an open branch, and Γ the set of formulae associated with B. For every atom A, define a valuation s such that s(A) = 1 iff A ∈ Γ. Lemma : for every formula F , if F ∈ Γ, s(F ) = 1, and if ¬F ∈ Γ, s(F ) = 0. Proof : by induction. (i) Atomic case : If F is an atom A. If A is in Γ, s(A) = 1. If ¬A is in Γ, then A is not in Γ (B is an open branch), so s(A) = 0, and s(¬A) = 1. (ii) Complex cases are straightforward due to the branch extension rules. EALING 2005

´ e P. Egr´

Introduction to Logic

26

Does (p ∧ q), (¬p → r) |= r ?

EALING 2005

´ e P. Egr´

Introduction to Logic

27

(p ∧ q) (¬p → r) ¬r

EALING 2005

´ e P. Egr´

Introduction to Logic

28

(p ∧ q)



(¬p → r) ¬r p q

EALING 2005

´ e P. Egr´

Introduction to Logic

29



(p ∧ q) (¬p → r)



¬r p q ¬¬p

r ×

EALING 2005

´ e P. Egr´

Introduction to Logic

30



(p ∧ q) (¬p → r)



¬r p q ¬¬p

r

p

×

Consider s such that s(p) = s(q) = 1, and s(A) = 0 for all other atoms A. In particular s(r) = 0. Check that all formulae on the branch are satisfied by s. EALING 2005

´ e P. Egr´

Introduction to Logic

31

Application to tautologies How to check whether a formula F is a tautology or not? Just build the tree for ¬F ! If all branches are closed, it is a tautology. If there is an open branch, it means that ¬F is satisfiable, and so that F is not valid.

EALING 2005

´ e P. Egr´

Introduction to Logic

32

Example Show that : |= (p → (q → p)

EALING 2005

´ e P. Egr´

Introduction to Logic

33

¬(p → (q → p)

EALING 2005

´ e P. Egr´

Introduction to Logic

34

¬(p → (q → p) p ¬(q → p)

EALING 2005

´ e P. Egr´

Introduction to Logic

35

¬(p → (q → p) p q→p q ¬p

EALING 2005

´ e P. Egr´

Introduction to Logic

36

¬(p → (q → p) p q→p q ¬p ×

EALING 2005

´ e P. Egr´

Introduction to Logic

37

What Completeness means • Call a formula F “provable by the tree method” if the tree obtained from ¬F is closed. Notation : ` F • Likewise : let us write Γ ` F to mean that the tree for Γ ∪ {¬F } is closed. We have established that for a finite set of formulae Γ: If Γ ` F , then Γ |= F If Γ |= F , then Γ ` F

(soundness) (completeness)

In particular : ` F iff |= F A completeness result equates a semantic notion (validity) with a procedural notion (“provable by the tree method”). EALING 2005

´ e P. Egr´

Introduction to Logic

38

Why soundness? • Completeness tells us : |= φ ⇒ ` φ ; if something is a validity, the procedure should recognize it (we don’t want to lose validities). • Soundness : 2 φ ⇒0 φ: the procedure should not output more formulas than there are validities (we don’t want to overgenerate) Imagine a procedure which would blindly answer “φ is valid” to the question whether φ is valid : it is complete (and cheap!), but not sound.

EALING 2005

´ e P. Egr´

Introduction to Logic

39

Terminology N.B. The adjective “complete” is predicated of different things: • a proof procedure is said to be complete: a proof procedure that is sound and complete relative to the semantics of the logic. • by extension, a logic is sometimes said to be complete or incomplete : one means that there is, or isn’t, for this logic, a complete proof procedure.

EALING 2005

´ e P. Egr´

Introduction to Logic

40

Complete theories • Let us define a theory as a set of sentences. A theory Γ is also said to be complete if for every sentence F of the language, either Γ |= F or Γ |= ¬F . ex : Γ={p, (p ∧ q)} is incomplete with respect to a language that contains at least three atoms p, q, and r , for it does not entail r, nor ¬r. To show that Γ 2 r, and Γ 2 ¬r, show that Γ ∪ {r} and Γ ∪ {¬r} are satisfiable.

EALING 2005

´ e P. Egr´

Introduction to Logic

41

Problem : what happens when a set of formulae is infinite? It can very well happen that Γ is infinite, and that Γ |= F . However, it would not make sense to apply the tree method to an infinite number of formulas: the procedure would never terminate!

EALING 2005

´ e P. Egr´

Introduction to Logic

42

Compactness Lemma (compactness): if every finite subset of a set of formulae Γ is satisfiable, then Γ is satisfiable. Corollary : If F is a logical consequence of a set of formulae Γ, then it is a consequence of some finite subset of Γ. Suppose Γ |= F but there is no finite subset Γ0 ⊆ Γ such that Γ0 |= F . Then for every finite Γ0 , Γ0 ∪ {¬F } is satisfiable ; by compactness, Γ ∪ {¬F } is satisfiable : contradiction.

EALING 2005

´ e P. Egr´

Introduction to Logic

43

Idea of the proof: Take Γ = {F1 , F2 , ...}. Let Γn = {F1 , ..., Fn }. Since every finite subset of Γ is satisfiable, so is every Γn .Each Γn is satisfied by an assignment sn defined on Atn , the ordered sequence of all atoms occurring in formulas of Γn . The idea is to construct an assignment s for the whole Γ, on the basis of the si . Build a tree for F1 , extend it by the tree for F2 , and so on : we get an infinite tree, that necessarily has an infinite open branch giving an assignment for all the formulas. Consequence: Suppose Γ |= φ. Then there is a finite subset Γ0 of Γ such that Γ |= φ; and by completeness, Γ0 ` φ. Since Γ0 ⊆ Γ, Γ ` φ. EALING 2005

´ e P. Egr´

Introduction to Logic

44

Summary Propositional logic enjoys a lot of nice properties: • (completeness) There is a sound and complete procedure for validity : the procedure recognizes all and only the valid formulas. • (decidability) Propositional logic is decidable : if φ is valid, not only is there a procedure to say that it is valid, but if φ is not valid, there is also a procedure to say that it is not valid. • (compactness) Propositional logic is compact : if φ is a logical consequence of a set of formulas, it is a logical consequence of a finite set of those formulas. EALING 2005

´ e P. Egr´

Introduction to Logic

45

Comparisons `T φ

T accepts φ (says “yes”)

aT φ

T rejects φ (says “no”)

0T φ

T does not accept φ (does not say “yes”)

• If a logic is decidable, is it complete? Yes If L is decidable, then there is a procedure T such that whenever |=L φ, `T φ (completeness). Moreover, whenever 2L φ, aT φ, so assuming the procedure is consistent, 0T φ (soundness). Hence the logic has a complete proof procedure. • If a logic is complete, is it decidable? Not necessarily If it is complete, there is a procedure T such that |=L φ iff `T φ. In particular, 2 φ, then 0T φ, but EALING 2005

´ e P. Egr´

Introduction to Logic

46

not necessarily aT φ. ex : first-order logic is complete, but undecidable.

EALING 2005

´ e P. Egr´

Introduction to Logic

47

Glimpses beyond • There exist other methods of proof for propositional logic: e.g., axiomatic systems (Frege), natural deduction (Gentzen, Prawitz), sequent calculus (Gentzen), resolution (Robinson). • We won’t have time to study them, but the important point is that they are not all analytic. However, one can establish close correspondences between these systems and the tree method.

EALING 2005

´ e P. Egr´

Introduction to Logic

48

Exercises 1. Use the tree method to determine whether the following formulae are tautologies: ((p → q) → p) → p) ((p → ¬p) → ¬p ((p ∨ q) → r) → (p → r) ∧ (q → r) ((p ∨ q) → r) → (p → r)

EALING 2005

´ e P. Egr´

Introduction to Logic

49

2. (from van Dalen) Define the relation F ≺ G (F asymmetrically entails G) iff |= F → G but 2 G → F . a. Give an example of two formulae F and G such that F ≺G b. Construct an infinite sequence of formulae such that each formula in the sequence asymmetrically entails the next one. c. Show that given two formulae F and G such that F ≺ G, one can find a formula H such that F ≺ H ≺ G.

EALING 2005

´ e P. Egr´