Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Hedman. A First Course in Logic, 2004 (Oxford)

.pdf
Скачиваний:
139
Добавлен:
10.08.2013
Размер:
7.17 Mб
Скачать

100

Proof theory

One aim of resolution is to provide an automated proof system. Toward this aim, we consider variations of resolution such as SLD-resolution. We close this chapter with a section on Prolog, a programming language that implements SLD-resolution.

3.1 Formal proofs

Let ϕ be a first-order formula and let Γ be a set of first-order formulas. We use the notation Γ ϕ to express that ϕ can be formally derived from Γ. As with propositional logic, the definition of this notion consists of a list of several rules. For propositional logic, formal proofs were defined as sequences of statements each of which is justified by one of the rules in Tables 1.5 or 1.6. Changing the Roman letters to Greek letters yields Tables 3.1 and 3.2 below.

For first-order logic, this list of rules is incomplete. In contrast, if F and G are formulas of propositional logic and G is a consequence of F , then we can formally prove that G is a consequence of F using the rules of Table 1.5 or Table 1.6. This is the Completeness theorem for propositional logic. To obtain an analogous

Table 3.1 Rules for derivations

Premise

Conclusion

Name

 

 

 

ϕ is in Γ

Γ ϕ

Assumption

Γ ϕ and Γ Γ

Γ ϕ

Monotonicity

Γ ϕ

Γ ¬¬ϕ

Double negation

Γ ψ, Γ ϕ

Γ (ψ ϕ)

-Introduction

Γ (ψ ϕ)

Γ ψ

-Elimination

Γ (ψ ϕ)

Γ (ϕ ψ)

-Symmetry

Γ ϕ

Γ (ϕ ψ)

-Introduction

Γ (ψ ϕ),

 

 

Γ {ψ} θ, Γ {ϕ} θ

Γ θ

-Elimination

Γ (ψ ϕ)

Γ (ϕ ψ)

-Symmetry

Γ {ϕ} ψ

Γ (ϕ → ψ)

-Introduction

Γ (ϕ → ψ), Γ ϕ

F ψ

-Elimination

Γ ψ

Γ (ψ)

(, )-Introduction

Γ (ψ)

Γ ψ

(, )-Elimination

Γ ((ψ ϕ) θ)

Γ (ψ ϕ θ)

-Parentheses rule

Γ ((ψ ϕ) θ)

Γ (ψ ϕ θ)

-Parentheses rule

 

 

 

Proof theory

101

 

 

Table 3.2

More rules for derivations

 

 

 

 

Rules

 

 

Name

 

 

 

 

 

 

Γ (ϕ ψ) if and only if Γ ¬(¬ϕ ¬ψ)

-Definition

 

Γ (ϕ → ψ) if and only if Γ (¬ϕ ψ)

-Definition

 

Γ (ϕ ↔ ψ) if and only if both Γ (ϕ → ψ) and Γ (ψ → ϕ)

-Definition

 

Γ (x) if and only if Γ ¬x¬ϕ(x)

-Definition

 

 

Table 3.3 Yet more rules for derivations

 

 

 

Premise

Conclusion

Restriction

Name

 

 

 

 

 

Γ ϕ(t)

Γ (y)

t is a term and y is a

-Introduction

 

 

 

variable not in bnd(ϕ)

 

 

 

Γ ϕ(t0)

Γ (y)

(y) / bnd(ϕ) ant t0 is a

-Introduction

 

 

 

variable or a constant not

 

 

 

 

 

 

occurring in Γ

 

 

 

Γ θ → ψ

Γ xθ → xψ

none

-Distribution

Γ θ → ψ

Γ xθ → xψ

none

-Distribution

Γ Q1x(Q2)

Γ Q1xQ2

Each Qi is a quantifier

Q-Parentheses rule

None

Γ t = t

t is a term

Reflexivity

Γ ϕ(t), Γ t = t

Γ ϕ(t )

t and t are terms

Equality Substitution

result for first-order logic, we must add rules to this list pertaining to quantifiers and equality. For example, we certainly should include the definition of :

Γ (x) if and only if Γ ¬x¬ϕ(x).

This and other rules are listed in Table 3.2.

Table 3.3 contains rules regarding quantifiers and substitutions. Recall that ϕ(t) is the formula obtained by replacing each free occurrence of x in ϕ(x) with the term t (assuming t does not use variables in bnd(ϕ)). In the above rules, ϕ(x) may have free variables other than x. Also, we may use any letters in place of x and y. We demonstrate the rules in Table 3.3 with a couple of examples.

Example 3.1 We demonstrate the rules -Introduction and -Introduction. Suppose that Γ R(a, b) where R is a binary relation and a and b are constants that do not occur in Γ. Then we can derive each of the following sentences (along with many others) from Γ:

zR(a, z) by -Introduction

wR(w, b) by -Introduction

102

Proof theory

w zR(w, z) by -Introduction (twice), and

z wR(w, z) by -Introduction followed by -Introduction.

Suppose now that Γ R(f (b), b) where f is a unary function. Since f (b) is a term that is not a constant, we can derive from Γ the sentence zR(z, b) but not the sentence zR(z, b). Likewise, we cannot derive the sentence z wR(w, z) from Γ. However, we can derive each of the following sentences:

wR(f (w), w) by -Introduction

w zR(w, z) by -Introduction (twice), and

z wR(w, z) by -Introduction followed by -Introduction.

Example 3.2 We illustrate the usefulness of -Distribution. Suppose we want to formally prove that ¬xψ(x) is a consequence of x¬ψ(x). By -Definition, we know that

{x¬ψ(x)} ¬x¬¬ψ(x).

It remains to be shown that

{¬x¬¬ψ(x)} ¬xψ(x).

Using -Distribution, we can formally prove this in three steps. First, show that ψ(x) → ¬¬ψ(x) is a tautology. By the completeness of propositional logic, there exists a formal proof for this fact. Second, use -Distribution to obtain the valid implication (x) → x¬¬ψ(x). Third, by -Contrapositive (Exercise 1.12), ¬ ¬¬ψ(x) → ¬xψ(x) is also valid. We conclude that, if Γ x¬ψ(x) then Γ ¬xψ(x). This argument can be made into a formal proof defined as follows (see Proposition 3.7).

Definition 3.3 A formal proof in first-order logic is a finite sequence of statements of the form “X Y ” each of which follows from the previous statements by one of the rules we have listed (including the definition of and the rules in Tables 3.1–3.3). We say that ϕ can be derived from Γ if there is a formal proof concluding with the statement Γ ϕ.

Our first priority is to show that this notion of formal proof is sound. We must show that if ϕ can be derived from Γ, then ϕ is in fact a consequence of Γ. We restate this as the following theorem.

Theorem 3.4 (Soundness) If Γ ϕ then Γ |= ϕ.

Note: This theorem follows from the semantics of first-order logic (that is, the definition of “|=”) given in Section 2.3. When we say something is true “by the semantics” the reader is referred to this section.

Proof theory

103

Proof We check that each rule for deduction is sound. In Theorem 1.37 we verified each of the rules in Table 1.5. It follows that each of the rules in Table 3.1 are also sound. Moreover, -Definition and each of the rules in Table 3.2 are sound by the definition of the symbols. Reflexivity and Equality substitution are sound by the definition of =. The Q-Parentheses rule is one of our conventions regarding the use of parentheses. It remains to be shown that the first four rules of Table 3.3 are sound.

First, consider -Introduction. This rule states that if Γ ϕ(t), then Γ(x). To show that this rule is sound, we must verify that if Γ |= ϕ(t) then Γ |= (x). It su ces to show that, for any structure M , M |= ϕ(t) implies M |= (x). This follows immediately from the semantics of .

For -Introduction, suppose that Γ |= ϕ(c) where c is a constant that does not occur in Γ. Suppose that M is a V-structure that models Γ. For any element a of the underlying set UM of M , let Mc=a be the structure having underlying set UM that interprets c as a and interprets the other symbols of V in the same manner as M (if c V, then Mc=a is an expansion of M ). Since c does not occur in Γ, Mc=a models Γ (since M does). Since Γ |= ϕ(c), Mc=a |= ϕ(c). It follows that M |= ϕ(a). Since a is an arbitrary element from UM , M |= (x) by the semantics of . This shows that Γ |= (x) and verifies -Introduction.

Now consider -Distribution. Suppose that M |= θ → ψ and M |= . Let UM denote the universe of M . We want to show that M |= .

Case 1: x is not a free variable of θ. By the semantics of , θ is equivalent to . So if M |= , then M |= θ and, by the semantics of , M |= ψ. Now if x is not a free variable of ψ, then ψ ≡ xψ. Otherwise, M |= ψ(x) means

M|= (x) which means M |= ψ(a) for any a in UM . Either way, we see that

M|= as we wanted to show.

Case 2: x is a free variable of θ but not of ψ. In this case, M |= θ → ψ means M |= x(θ(x) → ψ). By the semantics of , M |= θ(a) → ψ for any a in UM . Since M |= , M |= θ(a) for some a UM . By the semantics of , M |= ψ. Finally, M |= since ψ ≡ xψ.

Case 3: x is a free variable of both θ and ψ. Here M |= θ → ψ means M |= x(θ(x) → ψ(x)). This means that, for all a in UM , M |= θ(a) → ψ(a). Since M |= it follows that M |= θ(a) for some a in UM . Hence M |= ψ(a). Again by the semantics of , M |= .

The verification of -Distribution is similar and is left as Exercise 3.4.

Corollary 3.5 If both {ϕ} ψ and {ψ} ϕ, then ϕ ≡ ψ.

The Completeness theorem for first-order logic states that the converse of Theorem 3.4 is true. If ϕ is a consequence of Γ, then we can formally prove that it is a consequence. The rules for derivations we have given form a complete

104

Proof theory

set of rules for first-order logic. It follows that the converse of Corollary 3.5 holds as well. However, the Completeness theorem will not be proved until the next chapter. For this reason, we presently do not assume that the converses of Theorem 3.4 and Corollary 3.5 hold. In the present chapter, just because two formulas are equivalent does not mean that we can formally prove that they are equivalent. For this, we again use the terminology “provably equivalent” previously defined in Section 1.5.

For the remainder of this section, we verify various instances of the converses of Theorem 3.4 and Corollary 3.5. For example, by the semantics of , ϕ(t) is a consequence of (x) for any term t. We now show that ϕ(t) can be formally derived from (x).

Proposition 3.6 For any formula ϕ(x) and any term t, {xϕ(x)} ϕ(t).

Proof We use proof by Contradiction as defined in Example 1.36. Premise: Γ (x)

Conclusion: Γ ϕ(t)

Statement

Justification

 

 

 

1.

Γ (x)

Premise

2.

Γ {¬ϕ(t)} xϕ(x)

Monotonicity applied to 1

3.

Γ {¬ϕ(t)} ¬x¬ϕ(x)

-Definition applied to 2

4.

Γ {¬ϕ(t)} ¬ϕ(t)

Assumption

5.

Γ {¬ϕ(t)} x¬ϕ(x)

-Introduction applied to 4

6.

Γ ¬¬ϕ(t)

Proof by Contradiction applied to 3 and 5

7.

Γ ϕ(t)

Double negation (from Example 1.43) applied to 6

Recall that M |= ϕ(x1, . . . , xn) means the same as M |=y1 · · · ynϕ(y1, . . . , yn). This is how the symbol |= was defined in section 2.3 for formulas having free variables. It follows that the formula ϕ(x1, . . . , xn) is equivalent to the sentence y1 · · · ynϕ(y1, . . . , yn). By Proposition 3.6 and - Introduction, they are provably equivalent. We next show that the two formulas from Example 3.2 are provably equivalent.

Proposition 3.7 The formulas x¬ϕ(x) and ¬xϕ(x) are provably equivalent for any formula ϕ(x).

Proof Example 3.2 provides proof that {x¬ϕ(x)} ¬xϕ(x). We now provide a formal proof for the converse.

Premise: Γ ¬xϕ(x)

Conclusion: Γ x¬ϕ(x)

 

Proof theory

105

 

 

 

Statement

Justification

 

 

 

 

 

1.

Γ {¬¬ϕ(x)} ¬¬ϕ(x)

Assumption

 

2.

Γ {¬¬ϕ(x)} ϕ(x)

Example 1.43

 

3.

Γ ¬¬ϕ(x) → ϕ(x)

-Introduction applied to 2

 

4.

Γ x¬¬ϕ(x) → xϕ(x)

-Distribution applied to 3

 

5.

Γ ¬ xϕ(x) → ¬ x¬¬ϕ(x)

-Contrapositive (Exercise 1.12)

 

6.

Γ ¬ xϕ(x)

Premise

 

7.

Γ ¬ x¬¬ϕ(x)

-Elimination applied to 5 and 6

 

8.

Γ x¬ϕ(x)

-Definition

 

By the semantics , (x) ≡ yϕ(y) (ϕ(x) holds for each element x of some model if and only if ϕ(y) holds for each element y of that same model). We show that (x) and (y) are provably equivalent.

Corollary 3.8 Let x and y be variables that do not occur in the formula ϕ(z). Then (x) and (y) are provably equivalent.

Proof By Proposition 3.6, {xϕ(x)} ϕ(t) for any term t. In particular, {xϕ(x)} ϕ(y). By -Introduction, {xϕ(x)} + (y). Likewise (switching the roles of x and y), we see that {yϕ(y)} xϕ(x).

Likewise, we have the following.

Corollary 3.9 Let x and y be variables that do not occur in formula ϕ(z). Then(x) and (y) are provably equivalent.

We leave the proof of Corollary 3.9 to the reader (see Exercise 3.7).

Corollary 3.10 For any formula ϕ(x), {xϕ(x)} xϕ(x).

Proof {xϕ(x)} ϕ(x) by Proposition 3.6.

(x)} xϕ(x) by -Introduction.

Putting these two facts together, we see that {xϕ(x)} xϕ(x).

By the semantics of first-order logic, we know that (x) is a consequence of (x) (if ϕ(x) holds for all elements of in a certain structure, then it holds for some elements in that structure). Corollary 3.10 states that we can formally prove this. Note that (x) is not a consequence of (x). So these formulas are not equivalent. However, if (and only if) the variable x has no free occurences

106

Proof theory

in ψ, then and are equivalent formulas. Moreover, they are provably equivalent.

Proposition 3.11 Let x be a variable that does not occur as a free variable in the formula ψ. Then ψ, , and are provably equivalent.

Proof We demonstrate that {ψ} xψ and {xψ} ψ. The proposition then follows from Corollary 3.10 which implies {xψ} xψ.

First we show that {ψ} xψ

Premise: Γ ψ and c is a constant that does not occur in Γ

Conclusion: Γ

Statement

Justification

 

 

 

1.

Γ ψ

Premise

2.

Γ (ψ ¬(x = x))

-Introduction applied to 1

3.

Γ (¬(x = x) ψ)

-Symmetry applied to 2

4.

Γ (x = x) → ψ

-Definition applied to 3

5.

Γ x(x = x) → xψ

-Distribution applied to 4

6.

Γ (c = c)

Reflexivity

7.

Γ x(x = x)

-Introduction applied to 6

8.

Γ

-Elimination applied to 5 and 7

Next, we show that {xψ} ψ

Premise: Γ

Conclusion: Γ ψ

Statement

Justification

 

 

 

1.

Γ

Premise

2.

Γ {¬ψ} xψ

Monotonicity applied to 1

3.

Γ {¬ψ} ¬ψ

Assumption

4.Γ {¬ψ} x¬ψ The previous proof applied to 3

5.Γ {¬ψ} ¬xψ Example 3.2 applied to 4

6.

Γ ¬¬ψ

Proof by Contradiction applied to 2 and 5

7.

Γ ψ

Double negation (from Example 1.43) applied to 6

Proof theory

107

Proposition 3.12 The formulas x(ϕ(x) ψ(x))

and (x) (x) are

provably equivalent.

 

Proof We leave the verification of this as Exercise 3.8.

It is not true that x(ϕ(x) ψ(x)) and (x) (x) are provably equivalent. We can show that {x(ϕ(x) ψ(x))} xϕ(x) (x), but not the converse. However, if (and only if) x does not occur as a free variable of ψ, the converse is true.

Proposition 3.13 If x does not occur as a free variable of ψ, then (x) and x(ϕ(x) ψ) are provably equivalent.

Proof We only prove this equivalence in one direction. The other direction is straight forward and is left as Exercise 3.13.

Premise: Γ (x)

Conclusion: Γ x(ϕ(x) ψ)

Statement

Justification

 

 

 

1.

Γ (x)

Premise

2.

Γ

-Elimination applied to 1

3.

Γ ψ

Proposition 3.11 applied to 2

4.

Γ ¬ϕ(x) ψ

-Introduction and -symmetry applied to 3

5.

Γ ¬ϕ(x) ϕ(x)

Tautology rule (Example 1.32)

6.

Γ (¬ϕ(x) ϕ(x)) (¬ϕ(x) ψ)

-Introduction applied to 4 and 5

7.

Γ ¬ϕ (ϕ(x) ψ)

-Distributivity (Proposition 1.46) applied to 6

8.

Γ ϕ(x) (ϕ(x) ψ)

-Definition applied to 7

9.

Γ (x) → x(ϕ(x) ψ)

-Distribution applied to 8

10.

Γ (x)

-Symmetry and -Elimination applied to 1

11.

Γ x(ϕ(x) ψ)

-Elimination applied to 9 and 10

The previous propositions can be generalized as follows.

Proposition 3.14 Let x1, x2, . . . , xn be variables that occur free in the formula ϕ but not in the formula ψ. Let Q1, . . . , Qn be quantifiers (that is, for each i, Qi is either or ). Then the following two formulas are provably equivalent:

Q1x1Q2x2 · · · Qnxnϕ(x1, x2, . . . , xn) ψ, and

Q1x1Q2x2 · · · Qnxn(ϕ(x1, x2, . . . , xn) ψ).

108

Proof theory

Proof We prove this by induction on n. We use the following claim.

Claim If θ(x) and ψ(x) are provably equivalent, then so are Q1(x) and

Q1(x).

Proof of Claim If θ(x) and ψ(x) are provably equivalent, then θ(x) → ψ(x). By -Distribution or -Distribution (depending on which quantifier is Q1), we have Q1(x) → Q1(x). Likewise, Q1(x) → Q1(x). The claim follows.

We now prove the proposition. If n = 1 then this follows from Proposition 3.12 or 3.13 (depending on which quantifier is Q1). Suppose now that n = m+1. Our induction hypothesis implies that the following two formulas are provably equivalent:

Q2x2 · · · Qm+1xm+1ϕ(x1, x2, . . . , xm+1) ψ, and

Q2x2 · · · Qm+1xm+1(ϕ(x1, x2, . . . , xm+1) ψ).

It follows from the claim that the following two formulas are provably equivalent:

Q1x1(Q2x2 · · · Qm+1xm+1ϕ(x1, x2, . . . , xm+1) ψ), and

Q1x1(Q2x2 · · · Qnxn(ϕ(x1, x2, . . . , xn) ψ)).

The former of these, again by Proposition 3.12 or 3.13, is provably equivalent with

Q1x1Q2x2 · · · Qm+1xm+1ϕ(x1, x2, . . . , xm+1) ψ.

The latter of the above two formulas, by the Q-Parentheses rule, is provably equivalent with

Q1x1Q2x2 · · · Qm+1xm+1(ϕ(x1, x2, . . . , xm+1) ψ).

This completes the induction step and the proposition follows.

Similarly, we have the following.

Proposition 3.15 Let Q1, . . . , Qn denote quantifiers. For each i, let Qi denote

the quantifier that is not Qi. That is, for each i, {Qi, Qi} = { , }. For any formula ϕ(x1, . . . , xn),

¬Q1x1 · · · Qnxnϕ(x1, . . . , xn) is provably equivalent to

Q1x1 · · · Qnxn¬ϕ(x1, . . . , xn).

Proof It su ces to show that both

¬ x1ϕ(x1) is provably equivalent to x1¬ϕ(x1), and

¬ x1ϕ(x1) is provably equivalent to x1¬ϕ(x1) (see Example 3.2).

Proof theory

109

The proposition can then be proved by induction on n in a similar manner to Proposition 3.14. We leave the details as Exercise 3.15.

It follows from the previous propositions that any formula is provably equivalent to a formula in which the quantifiers preceed all other fixed symbols. Informally, the quantifiers can be “pulled out in front” of any formula. We make this idea precise and prove it in the following section.

3.2 Normal forms

One of our goals in this chapter is to develop resolution for first-order logic. Recall that, in propositional logic, we needed to have the formulas in CNF before we could proceed with resolution. Likewise, in first-order logic the formulas will need to be in a nice form. In this section, we define what we mean by “nice.”

3.2.1 Conjunctive prenex normal form.

Definition 3.16 A formula ϕ is in prenex normal form (PNF) if it has the form Q1x1 · · · Qnxnψ where each Qi is a quantifier (either or ) and ψ is a quantifierfree first-order formula. Moreover, if ψ is a conjunction of disjunctions of literals (atomic or negated atomic formulas), then ϕ is in conjunctive prenex normal form.

So a formula is in prenex normal form if all of its quantifiers are in front.

Example 3.17 y x(f (x) = y) is in PNF, and ¬ x yP (x, y, z) and x y ¬P (x, y, z) x yQ(x, y, z) are not.

Theorem 3.18 For any formula of first-order logic, there exists an equivalent formula in conjunctive prenex normal form.

Proof Let ϕ be an arbitrary formula. First we show that there exists an equivalent formula ϕ in prenex normal form. We prove this by induction on the complexity of ϕ.

If ϕ is atomic, then ϕ is already in PNF, so we can just let ϕ be ϕ. Suppose ψ and θ are formulas and there exist ψ and θ in PNF such that

ψ ≡ ψ and θ ≡ θ . Clearly, if ϕ ≡ ψ then we can let ϕ be ψ . To complete the induction step, we must consider three cases corresponding to ¬, , and .

First, suppose ϕ is the formula ¬ψ. Then ϕ ≡ ¬ψ . Since ψ is in PNF, ψ has the form Q1x1 · · · Qmxmψ0 for some quantifier-free formula ψ0 and quantifiers Q1, . . . , Qm. So ϕ ≡ ¬Q1x1 · · · Qmxmψ0. By Proposition 3.15, this is equivalent

to Q1x1 · · · Qmxm¬ψ0 where {Qi, Qi} = { , }. This formula is in PNF, and so it may serve as ϕ .