Mathematical Logic For Computer Science-Chp.08
Mathematical Logic For Computer Science-Chp.08
Figure 8.1 is a closed semantic tableau for the negation of the valid formula
The formulas to which rules are applied are underlined, while the sets of constants
C(n) in the labels of each node are implicit.
Let us turn the tree upside down and in every node n replace U (n), the set of
formulas labeling the node n, by Ū (n), the set of complements of the formulas in
U (n). The result (Fig. 8.2) is a Gentzen proof for the formula.
Here is the classification of quantified formulas into γ - and δ-formulas:
γ γ (a) δ δ(a)
Definition 8.1 The Gentzen system G is a deductive system. Its axioms are sets of
formulas U containing a complementary pair of literals. The rules of inference are
the rules given for α- and β-formulas in Sect. 3.2, together with the following rules
for γ - and δ-formulas:
U ∪ {γ , γ (a)} U ∪ {δ(a)}
, .
U ∪ {γ } U ∪ {δ}
The rule for δ-formulas can be applied only if the constant a does not occur in any
formula of U .
The γ -rule can be read: if an existential formula and some instantiation of it are
true, then the instantiation is redundant.
The δ-rules formalizes the following frequently used method of mathematical
reasoning: Let a be an arbitrary constant. Suppose that A(a) can be proved. Since
a was arbitrary, the proof holds for ∀xA(x). In order to generalize from a specific
constant to for all, it is essential that a be an arbitrary constant and not one of the
constants that is constrained by another subformula.
Fig. 8.3 Gentzen proof: use rules for γ -formulas followed by rules for δ-formulas
Example 8.2 The proof of ∃x∀yp(x, y) → ∀y∃xp(x, y) in Fig. 8.3 begins with the
axiom obtained from the complementary literals ¬ p(a, b) and p(a, b). Then the
rule for the γ -formulas is used twice:
U, ¬ ∀yp(a, y), ¬ p(a, b) U, ∃xp(x, b), p(a, b)
, .
U, ¬ ∀yp(a, y) U, ∃xp(x, b)
Once this is done, it is easy to apply rules for the δ-formulas because the constants
a and b appear only once so that the condition in the rule is satisfied:
U, ∃xp(x, b) U, ¬ ∀yp(a, y)
, .
U, ∀y∃xp(x, y) U, ¬ ∃x∀y∃xp(x, y)
A final application of the rule for the α-formula completes the proof.
Definition 8.4 The axioms of the Hilbert system H for first-order logic are:
Axiom 1 (A → (B → A)),
Axiom 2 (A → (B → C)) → ((A → B) → (A → C)),
Axiom 3 (¬ B → ¬ A) → (A → B),
Axiom 4 ∀xA(x) → A(a),
Axiom 5 ∀x(A → B(x)) → (A → ∀xB(x)).
Axioms 1, 2, 3 and the rule of inference MP are generalized to any formulas in first-
order logic so all of the theorems and derived rules of inference that we proved in
Chap. 3 can be used in first-order logic.
Example 8.5
∀xp(x) → (∃y∀xq(x, y) → ∀xp(x))
is an instance of Axiom 1 in first-order logic and:
In the proofs in this chapter, we will not bother to give the details of deductions
that use propositional reasoning because these are easy to understand. The notation
PC will be used for propositional deductions.
8.2 Hilbert System H 159
Any occurrence of ∀xA(x) can be replaced by A(a) for any a. If A(x) is true
whatever the assignment of a domain element of an interpretation I to x, then
A(a) is true for the domain element that I assigns to a.
The generalization rule of inference states that if a occurs in a formula, we may
bind all occurrences of a with the quantifier. Since a is arbitrary, that is the same as
saying that A(x) is true for all assignments to x.
There is a reason that the generalization rule was given only for formulas that
can be proved without a set of assumptions U :
A(a)
.
∀xA(x)
Example 8.7 Suppose that we were allowed to apply generalization to A(a) A(a)
to obtain A(a) ∀xA(x) and consider the interpretation:
(Z , {even(x)}, {2}).
The assumption A(a) is true but ∀xA(x) is not, which means that generalization is
not sound as it transforms A(a) |= A(a) into A(a) |= ∀xA(x).
Proof The proof is by induction on the length of the proof of U ∪ {A} B. We must
show how to obtain a proof of U A → B that does not use the deduction rule. The
proof for propositional logic (Theorem 3.14) is modified to take into account the
new axioms and generalization.
The modification for the additional axioms is trivial.
Consider now an application of the generalization rule, where, without loss of
generality, we assume that the generalization rule is applied to the immediately pre-
ceding formula in the proof:
i U ∪ {A} B(a)
i+1 U ∪ {A} ∀xB(x) Generalization
By the condition on the generalization rule in the presence of assumptions, a does
not appear in either U or A.
The proof that the deduction rule is sound is as follows:
i U ∪ {A} B(a)
i U A → B(a) Inductive hypothesis, i
i +1 U ∀x(A → B) Generalization, i
i +2 U ∀x(A → B) → (A → ∀xB) Axiom 5
i +3 U A → ∀xB MP, i + 1, i + 2
The fact that a does not appear in U is used in line i + 1 and the fact that a does
not appear in A is used in line i + 2.
Theorem 8.13 (Soundness and completeness) The Hilbert system H is sound and
complete.
Proof
1. ∀x¬ A(x) → ¬ A(a) Axiom 4
2. A(a) → ¬ ∀x¬ A(x) PC 1
3. A(a) → ∃xA(x) Definition ∃
Proof
1. ∀xA(x) ∀xA(x) Assumption
2. ∀xA(x) A(a) Axiom 4
3. ∀xA(x) A(a) → ∃xA(x) Theorem 8.14
4. ∀xA(x) ∃xA(x) MP 2, 3
5. ∀xA(x) → ∃xA(x) Deduction
162 8 First-Order Logic: Deductive Systems
Proof
1. ∀x(A(x) → B(x)), ∀xA(x) ∀xA(x) Assumption
2. ∀x(A(x) → B(x)), ∀xA(x) A(a) Axiom 4
3. ∀x(A(x) → B(x)), ∀xA(x) ∀x(A(x) → B(x)) Assumption
4. ∀x(A(x) → B(x)), ∀xA(x) A(a) → B(a) Axiom 4
5. ∀x(A(x) → B(x)), ∀xA(x) B(a) PC 2, 4
6. ∀x(A(x) → B(x)), ∀xA(x) ∀xB(x) Gen. 5
7. ∀x(A(x) → B(x)) ∀xA(x) → ∀xB(x) Deduction
8. ∀x(A(x) → B(x)) → (∀xA(x) → ∀xB(x)) Deduction
A(a) → B(a)
.
∀xA(x) → ∀xB(x)
The next theorem was previously proved in the Gentzen system. Make sure that
you understand why Axiom 5 can be used.
Proof
1. A(a, b) → ∃xA(x, b) Theorem 8.14
2. ∀yA(a, y) → ∀y∃xA(x, y) Gen 1
3. ¬ ∀y∃xA(x, y) → ¬ ∀yA(a, y) PC 2
4. ∀x(¬ ∀y∃xA(x, y) → ¬ ∀yA(x, y)) Gen. 3
5. (∀x(¬ ∀y∃xA(x, y) → ¬ ∀yA(x, y)))→
(¬ ∀y∃xA(x, y) → ∀x¬ ∀yA(x, y)) Axiom 5
6. ¬ ∀y∃xA(x, y) → ∀x¬ ∀yA(x, y) MP 4, 5
7. ¬ ∀x¬ ∀yA(x, y) → ∀y∃xA(x, y) PC 6
8. ∃x∀yA(x, y) → ∀y∃xA(x, y) Definition of ∃
Theorem 8.19 Let A be a formula that does not have x as a free variable.
Proof
1. ∀xA(x) → A(a) Axiom 4
2. ∀y(∀xA(x) → A(y)) Gen. 1
3. ∀xA(x) → ∀yA(y) Axiom 5
4. ∀yA(y) → ∀xA(x) Similarly
5. ∀xA(x) ↔ ∀yA(y) PC 3, 4
Theorem 8.21 Let B be a formula that does not have x as a free variable.
Proof
1. ∀x(A(x) → B) ∀x(A(x) → B) Assumption
2. ∀x(A(x) → B) ∀x(¬ B → ¬ A(x)) Exercise
3. ∀x(A(x) → B) ¬ B → ∀x¬ A(x) Axiom 5
4. ∀x(A(x) → B) ¬ ∀x¬ A(x) → B PC 3
5. ∀x(A(x) → B) ∃xA(x) → B Definition of ∃
6. ∀x(A(x) → B) → (∃xA(x) → B) Deduction
For a proof that the rule is sound, see Mendelson (2009, Proposition 2.10).
We use the C-Rule to give a more intuitive proof of Theorem 8.18.
Proof
1. ∃x∀yA(x, y) ∃x∀yA(x, y) Assumption
2. ∃x∀yA(x, y) ∀yA(a, y) C-Rule
3. ∃x∀yA(x, y) A(a, b) Axiom 4
4. ∃x∀yA(x, y) ∃xA(x, b) Theorem 8.14
5. ∃x∀yA(x, y) ∀y∃xA(x, y) Gen. 4
6. ∃x∀yA(x, y) → ∀y∃xA(x, y) Deduction
The conditions in the C-rule are necessary. The first condition is similar to the
condition on the deduction rule. The second condition is needed so that a formula
that is true for one specific constant is not generalized for all values of a variable.
Without the condition, we could prove the converse of Theorem 8.18, which is not
a valid formula:
1. ∀x∃yA(x, y) ∀x∃yA(x, y) Assumption
2. ∀x∃yA(x, y) ∃yA(a, y) Axiom 4
3. ∀x∃yA(x, y) A(a, b) C-rule
4. ∀x∃yA(x, y) ∀xA(x, b) Generalization (illegal!)
5. ∀x∃yA(x, y) ∃y∀xA(x, y) Theorem 8.14
6. ∀x∃yA(x, y) → ∃y∀xA(x, y) Deduction
8.6 Summary 165
8.6 Summary
Gentzen and Hilbert deductive systems were defined for first-order logic. They are
sound and complete. Be careful to distinguish between completeness and decid-
ability. Completeness means that every valid formula has a proof. We can discover
the proof by constructing a semantic tableau for its negation. However, we cannot
decide if an arbitrary formula is valid and provable.
8.8 Exercises
8.1 Prove in G :
∀x(p(x) → q(x)) → (∃xp(x) → ∃xq(x)),
∃x(p(x) → q(x)) ↔ (∀xp(x) → ∃xq(x)).
8.8 Prove Theorem 8.19 in H . Let A be a formula that does not have x as a free
variable.
∀x(A → B(x)) ↔ (A → ∀xB(x)),
∃x(A → B(x)) ↔ (A → ∃xB(x)).
8.9 Let A be a formula built from the quantifiers and the Boolean operators ¬ , ∨, ∧
only. A , the dual of A is obtained by exchanging ∀ and ∃ and exchanging ∨ and ∧.
Prove that A iff ¬ A .
166 8 First-Order Logic: Deductive Systems
References
E. Mendelson. Introduction to Mathematical Logic (Fifth Edition). Chapman & Hall/CRC, 2009.
R.M. Smullyan. First-Order Logic. Springer-Verlag, 1968. Reprinted by Dover, 1995.