M384 · Logic · Week 14

Completeness and the Limits of First-Order Logic

Day 1: new constants, witnesses and Lindenbaum's Lemma. Day 2: the term model, the Truth Lemma, the Completeness Theorem and the Compactness Theorem. Day 3: Turing machines and the undecidability of first-order logic.

Goals for this week

By the end of this week you will be able to:

Day 1: Witnesses and Lindenbaum's Lemma

Today we begin the proof of the Completeness Theorem. As in propositional logic, we build a model of every consistent set. The new difficulty is that a model needs objects.

1. The plan

The Soundness Theorem (Theorem 13.22) says: if \(\Gamma\vdash\varphi\), then \(\Gamma\models\varphi\). This week we prove the converse, the Completeness Theorem: if \(\Gamma\models\varphi\), then \(\Gamma\vdash\varphi\). Throughout the week \(\Gamma\) is a set of sentences, as in the Soundness Theorem.

We prove the contrapositive, and the plan is the plan of Week 10 (Figure 1).

  1. If \(\Gamma\nvdash\varphi\), then \(\Gamma\cup\{\neg\varphi\}\) is consistent.
  2. Every consistent set of sentences can be extended to a maximally consistent set \(\Gamma'\).
  3. From \(\Gamma'\) we read off a structure \(\mathcal A\) in which exactly the members of \(\Gamma'\) are true (the Truth Lemma).
  4. Then \(\mathcal A\) is a model of \(\Gamma\) in which \(\varphi\) is false, so \(\Gamma\not\models\varphi\).
Γ ⊬ φ no deduction exists Γ ∪ {¬φ} is consistent Proposition 14.2 Γ′ ⊇ Γ ∪ {¬φ} maximally consistent, with witnesses (Day 1) new constants term model 𝒜 of Γ′ domain: classes of closed terms (Day 2) Γ ⊭ φ 𝒜 ⊨ Γ and 𝒜 ⊭ φ
Figure 1. The plan of the completeness proof. The two highlighted steps contain what is new compared with Week 10.

In Week 10 step 3 was easy: a valuation only has to assign truth values, and \(p\) was made true exactly when \(p\in\Gamma'\). A structure needs a domain. The only objects that a set of sentences provides are the terms of its language, so the domain will be made of closed terms. Two things can go wrong.

Example 14.1: two obstacles
(a) Missing witnesses. Take the signature with a unary relation symbol \(P\) and a constant symbol \(c\), and \(\Gamma=\{\exists x\,P(x),\ \neg P(c)\}\). The set is consistent: it has a model with two elements. The only closed term is \(c\). A structure whose only element is named by \(c\) must make \(P(c)\) false, and then \(\exists x\,P(x)\) is false too. The sentence \(\exists x\,P(x)\) says that an object exists, and the language has no term for it.
(b) Two terms for one object. Take two constant symbols \(c,d\) and \(\Gamma=\{c=d\}\). The closed terms \(c\) and \(d\) are different terms, and in every model of \(\Gamma\) they have the same value. So the elements of the domain cannot be the terms themselves.

The remedy for (a) is to add new constant symbols to the language and to use them as names for the objects that existential sentences require. This is today's subject. The remedy for (b) is to take classes of terms as elements; this is done on Day 2.

2. Consistency of sets of sentences

Definition 13.17 and Lemma 13.18 are the definitions and facts of Week 10 with the new \(\vdash\). The propositional facts about consistency were proved from the Deduction Theorem, and for sentences the Deduction Theorem holds without a condition (Corollary 13.15). So they carry over.

Proposition 14.2: consistency facts from Week 10

Let \(\Gamma\) be a set of sentences and \(\varphi\) a sentence.

(a) If \(\Gamma\nvdash\varphi\), then \(\Gamma\cup\{\neg\varphi\}\) is consistent.
(b) If \(\Gamma\) is consistent, then \(\Gamma\cup\{\varphi\}\) or \(\Gamma\cup\{\neg\varphi\}\) is consistent.
(c) Every subset of a consistent set is consistent.

Proof. These are Proposition 10.4, Proposition 10.5(b) and Proposition 10.1(b). Their proofs use (L1) to (L3), MP and the Deduction Theorem for the assumptions \(\varphi\) and \(\neg\varphi\). Both are sentences, so Corollary 13.15 applies in place of Theorem 9.9. □

Consistency refers to deductions, and a deduction is a sequence of formulas of a fixed language. When the language matters we say "consistent in \(\mathcal L(\mathcal S)\)".

3. New constants

Let \(\mathcal S\) be a signature. We assume from now on that \(\mathcal S\) has finitely many symbols, or that its symbols can be listed as a sequence; all signatures of this course are of this kind. Let

\(\mathcal S'=\mathcal S\cup\{d_1,d_2,d_3,\dots\}\)

where \(d_1,d_2,\dots\) are new constant symbols. Nothing is assumed about a new constant. The next lemma says that for this reason a new constant behaves in deductions like a variable.

Lemma 14.3: a new constant behaves like a variable

Let \(\Gamma\) be a set of formulas, \(\psi\) a formula and \(d\) a constant symbol that occurs neither in \(\Gamma\) nor in \(\psi\). If \(\Gamma\vdash\psi[d/x]\), then \(\Gamma\vdash\forall x\,\psi\).

Proof. Let \(\chi_1,\dots,\chi_n\) be a deduction of \(\psi[d/x]\) from \(\Gamma\). Choose a variable \(z\) that occurs nowhere in this deduction and not in \(\psi\). For a formula \(\chi\) write \(\chi^z\) for the result of replacing every occurrence of \(d\) in \(\chi\) by \(z\). We show that \(\chi_1^z,\dots,\chi_n^z\) is again a deduction from \(\Gamma\), by going through the cases of Definition 13.2.

  • \(\chi_i\in\Gamma\). The constant \(d\) does not occur in \(\chi_i\), so \(\chi_i^z=\chi_i\).
  • \(\chi_i\) is an instance of (L1) to (L9). Then \(\chi_i^z\) is an instance of the same scheme, with \(\varphi^z,\psi^z,\chi^z\) in the roles of \(\varphi,\psi,\chi\).
  • \(\chi_i\) is an instance \(\forall y\,\varphi\to\varphi[t/y]\) of (L10). Then \(\chi_i^z\) is \(\forall y\,\varphi^z\to\varphi^z[t^z/y]\). The term \(t^z\) is free for \(y\) in \(\varphi^z\): its variables are those of \(t\) and possibly \(z\), and no quantifier of \(\varphi^z\) binds \(z\), because \(z\) is new. So \(\chi_i^z\) is an instance of (L10). The case (L14) is the same.
  • \(\chi_i\) is an instance of (L11) or (L15). The side condition says that a variable \(y\) is not free in a certain formula. Replacing \(d\) by \(z\) adds free occurrences of \(z\) only, and \(z\) is different from \(y\). So the side condition still holds.
  • \(\chi_i\) is an instance of (L12) or (L13). (L12) contains no constant. In (L13) the atomic formula may contain \(d\); after the replacement it is still atomic, and \(\varphi'^z\) still results from \(\varphi^z\) by replacing occurrences of \(x\) by \(y\).
  • MP and Gen. \((\varphi\to\chi)^z\) is \(\varphi^z\to\chi^z\), and \((\forall y\,\varphi)^z\) is \(\forall y\,\varphi^z\). So a line obtained by MP or Gen is still obtained by MP or Gen from the same earlier lines.

The last line is \((\psi[d/x])^z\). Since \(d\) does not occur in \(\psi\), this is \(\psi[z/x]\). Hence \(\Gamma\vdash\psi[z/x]\). The free occurrences of \(z\) in \(\psi[z/x]\) stand exactly where \(x\) was free in \(\psi\), so \(x\) is free for \(z\) in \(\psi[z/x]\), and \(\psi[z/x][x/z]\) is \(\psi\). By Lemma 13.6(a), \(\Gamma\vdash\psi\), and Gen gives \(\Gamma\vdash\forall x\,\psi\). □

Example 14.4: the lemma in a small case

Let \(\Gamma=\{\forall x\,(P(x)\to Q(x)),\ \forall x\,P(x)\}\) and let \(d\) be a new constant. A deduction of \(Q(d)\) from \(\Gamma\):

1\(\forall x\,(P(x)\to Q(x))\)(assump.)2\(\forall x\,P(x)\)(assump.)3\(\forall x\,(P(x)\to Q(x))\to(P(d)\to Q(d))\)(L10)4\(P(d)\to Q(d)\)(1,3 MP)5\(\forall x\,P(x)\to P(d)\)(L10)6\(P(d)\)(2,5 MP)7\(Q(d)\)(4,6 MP)

Replace \(d\) by a new variable \(z\) on every line. Lines 1 and 2 do not change. Lines 3 and 5 become the instances of (L10) with \(t:=z\), and lines 4, 6 and 7 are still obtained by MP. The result is a deduction of \(Q(z)\) from \(\Gamma\), and Gen gives \(\forall z\,Q(z)\), from which \(\forall x\,Q(x)\) follows. Compare Example 13.4: there the same deduction was written with the variable \(x\) in the place of \(d\).

The condition that \(d\) does not occur in \(\Gamma\) is needed. From \(\{P(c)\}\) we can deduce \(P(c)\), and we cannot deduce \(\forall x\,P(x)\).

Corollary 14.5: new constants do not destroy consistency

If a set \(\Gamma\) of sentences of \(\mathcal L(\mathcal S)\) is consistent in \(\mathcal L(\mathcal S)\), then it is consistent in \(\mathcal L(\mathcal S')\).

Proof. Suppose there are deductions of \(\varphi\) and of \(\neg\varphi\) from \(\Gamma\) in \(\mathcal L(\mathcal S')\). Only finitely many new constants occur in them. Replace each of them, in both deductions, by its own new variable. As in the proof of Lemma 14.3, the results are deductions from \(\Gamma\); they contain no new constants, so they are deductions in \(\mathcal L(\mathcal S)\), and they end in a formula and its negation. So \(\Gamma\) is inconsistent in \(\mathcal L(\mathcal S)\). □

4. Witnesses

In an ordinary proof, after showing that an object with a property exists, we say "let \(d\) be such an object" and continue with \(d\). The next lemma says that this step never leads to a contradiction, provided that \(d\) is a new name.

Lemma 14.6: adding a witness

Let \(\Gamma\) be a consistent set of sentences and \(\exists x\,\psi\) a sentence with \(\Gamma\vdash\exists x\,\psi\). Let \(d\) be a constant symbol that occurs neither in \(\Gamma\) nor in \(\psi\). Then \(\Gamma\cup\{\psi[d/x]\}\) is consistent.

Proof. Suppose \(\Gamma\cup\{\psi[d/x]\}\) is inconsistent. We show that then \(\Gamma\) is inconsistent.

  1. By Lemma 13.18 an inconsistent set deduces every formula, so \(\Gamma,\psi[d/x]\vdash\neg\exists x\,\psi\).
  2. \(\psi[d/x]\) is a sentence. By Corollary 13.15, \(\Gamma\vdash\psi[d/x]\to\neg\exists x\,\psi\).
  3. The variable \(x\) is not free in \(\neg\exists x\,\psi\), so this formula is \((\psi\to\neg\exists x\,\psi)[d/x]\). The constant \(d\) does not occur in \(\psi\to\neg\exists x\,\psi\) or in \(\Gamma\). By Lemma 14.3, \(\Gamma\vdash\forall x\,(\psi\to\neg\exists x\,\psi)\).
  4. \(\forall x\,(\psi\to\neg\exists x\,\psi)\to(\exists x\,\psi\to\neg\exists x\,\psi)\) is an instance of (L15), because \(x\) is not free in \(\neg\exists x\,\psi\). By MP, \(\Gamma\vdash\exists x\,\psi\to\neg\exists x\,\psi\).
  5. With \(\Gamma\vdash\exists x\,\psi\) and MP, \(\Gamma\vdash\neg\exists x\,\psi\).

So \(\Gamma\) deduces \(\exists x\,\psi\) and its negation. □

Steps 3 and 4 are the pattern "Gen, then (L15)" of Example 13.8, with Lemma 14.3 doing the work of Gen for the constant \(d\).

Example 14.7: a witness must be new
(a) Let \(\Gamma=\{\exists x\,P(x),\ \neg P(c)\}\) as in Example 14.1(a), and let \(d_1\) be a new constant. By Lemma 14.6, \(\Gamma\cup\{P(d_1)\}\) is consistent. This can be confirmed by a model (Corollary 13.23(b)): domain \(\{0,1\}\), \(c\) interpreted as \(0\), \(d_1\) interpreted as \(1\), and \(P\) interpreted as \(\{1\}\).
(b) With the old constant \(c\) as the witness the conclusion fails: \(\Gamma\cup\{P(c)\}\) contains \(P(c)\) and \(\neg P(c)\), so it is inconsistent. The lemma does not apply, because \(c\) occurs in \(\Gamma\).
Definition 14.8: the witness property

A set \(\Gamma'\) of sentences has the witness property if for every sentence \(\exists x\,\psi\) in \(\Gamma'\) there is a closed term \(t\) with \(\psi[t/x]\in\Gamma'\). The term \(t\) is called a witness for \(\exists x\,\psi\).

For example, \(\{\exists x\,P(x),\ \neg P(c),\ P(d_1)\}\) has the witness property, with the witness \(d_1\). The set \(\{\exists x\,P(x),\ \neg P(c)\}\) does not have it.

5. Lindenbaum's Lemma with witnesses

Definition 14.9: maximally consistent sets of sentences

A set \(\Gamma\) of sentences of a language \(\mathcal L\) is maximally consistent (in \(\mathcal L\)) if \(\Gamma\) is consistent and \(\Gamma\cup\{\varphi\}\) is inconsistent for every sentence \(\varphi\) of \(\mathcal L\) that is not in \(\Gamma\).

This is Definition 10.6 for sentences. The two basic properties have the same proofs as in Week 10 (Propositions 10.8 and 10.9), with Proposition 14.2 in place of Proposition 10.5. If \(\Gamma\) is maximally consistent, then for all sentences \(\varphi\):

Example 14.10: the sentences true in a structure

Let \(\mathcal B\) be a structure in which every element is the value of a closed term, and let \(\mathrm{Th}(\mathcal B)\) be the set of all sentences that are true in \(\mathcal B\). Then \(\mathrm{Th}(\mathcal B)\) is maximally consistent and has the witness property.

It is consistent because it has a model (Corollary 13.23(b)). For every sentence \(\varphi\), either \(\varphi\) or \(\neg\varphi\) is true in \(\mathcal B\), so one of them is in the set; a consistent set with this property is maximally consistent (Proposition 10.8).
For the witness property, let \(\exists x\,\psi\) be true in \(\mathcal B\). Then \(\mathcal B\models\psi[\bar b/x]\) for some element \(b\). By assumption \(b\) is the value of a closed term \(t\), and by Lemma 13.19, \(\mathcal B\models\psi[t/x]\). So \(\psi[t/x]\) is in the set.
The completeness proof goes in the opposite direction: it starts from a set with these two properties and constructs the structure.

The sentences of \(\mathcal L(\mathcal S')\) can be listed as \(\varphi_1,\varphi_2,\varphi_3,\dots\) so that every sentence appears. The argument is the one of Lemma 10.12: list the symbols of \(\mathcal S'\) and the variables in one sequence; for each \(n\) there are finitely many sentences with at most \(n\) symbols that use only the first \(n\) symbols of this sequence; list these finite sets one after the other.

Lemma 14.11: Lindenbaum's Lemma with witnesses

Let \(\Gamma\) be a consistent set of sentences of \(\mathcal L(\mathcal S)\). Then there is a set \(\Gamma'\supseteq\Gamma\) of sentences of \(\mathcal L(\mathcal S')\) that is maximally consistent in \(\mathcal L(\mathcal S')\) and has the witness property.

Proof. Fix a list \(\varphi_1,\varphi_2,\dots\) of all sentences of \(\mathcal L(\mathcal S')\). Define \(\Gamma_0=\Gamma\), and for \(n\ge0\):

  • if \(\Gamma_n\cup\{\varphi_{n+1}\}\) is inconsistent, then \(\Gamma_{n+1}=\Gamma_n\);
  • if \(\Gamma_n\cup\{\varphi_{n+1}\}\) is consistent and \(\varphi_{n+1}\) does not begin with \(\exists\), then \(\Gamma_{n+1}=\Gamma_n\cup\{\varphi_{n+1}\}\);
  • if \(\Gamma_n\cup\{\varphi_{n+1}\}\) is consistent and \(\varphi_{n+1}\) is \(\exists x\,\psi\), then \(\Gamma_{n+1}=\Gamma_n\cup\{\varphi_{n+1},\ \psi[d/x]\}\), where \(d\) is the first of \(d_1,d_2,\dots\) that occurs neither in \(\Gamma_n\) nor in \(\varphi_{n+1}\).

Such a \(d\) always exists: no new constant occurs in \(\Gamma_0\), and each stage adds at most two sentences, so only finitely many new constants occur in \(\Gamma_n\cup\{\varphi_{n+1}\}\). Let \(\Gamma'=\bigcup_{n\ge0}\Gamma_n\).

Claim 1: each \(\Gamma_n\) is consistent. \(\Gamma_0\) is consistent in \(\mathcal L(\mathcal S')\) by Corollary 14.5. Suppose \(\Gamma_n\) is consistent. In the first two cases \(\Gamma_{n+1}\) is consistent by its definition. In the third case \(\Gamma_n\cup\{\exists x\,\psi\}\) is consistent, it deduces \(\exists x\,\psi\), and \(d\) occurs neither in it nor in \(\psi\). By Lemma 14.6, \(\Gamma_{n+1}\) is consistent.

Claim 2: \(\Gamma'\) is consistent. As in Lemma 10.13: two deductions of \(\psi\) and \(\neg\psi\) from \(\Gamma'\) use finitely many members of \(\Gamma'\), and these all lie in one \(\Gamma_N\), which would then be inconsistent.

Claim 3: \(\Gamma'\) is maximally consistent. Let \(\varphi\notin\Gamma'\) be a sentence, say \(\varphi=\varphi_k\). It was not added at stage \(k\), so \(\Gamma_{k-1}\cup\{\varphi_k\}\) is inconsistent, and so is the larger set \(\Gamma'\cup\{\varphi\}\).

Claim 4: \(\Gamma'\) has the witness property. Let \(\exists x\,\psi\in\Gamma'\), say \(\exists x\,\psi=\varphi_k\). The set \(\Gamma_{k-1}\cup\{\varphi_k\}\) is a subset of \(\Gamma'\), so it is consistent. Hence at stage \(k\) the third case applied, and \(\psi[d/x]\) was added for some constant \(d\). □

Example 14.12: the first stages of the construction

Signature: \(P\) and \(c\) as in Example 14.1(a), and \(\Gamma=\{\exists x\,P(x),\ \neg P(c)\}\). Suppose the list of sentences of \(\mathcal L(\mathcal S')\) begins with

\(\varphi_1=P(c),\quad\varphi_2=\exists x\,P(x),\quad\varphi_3=\neg P(d_1),\quad\varphi_4=(c=d_1).\)

StageSentenceDecisionResult
1\(P(c)\)\(\Gamma_0\cup\{P(c)\}\) contains \(P(c)\) and \(\neg P(c)\): inconsistent. Skip.\(\Gamma_1=\Gamma\)
2\(\exists x\,P(x)\)Already in \(\Gamma_1\), so adding it keeps the set consistent. It begins with \(\exists\): add a witness. The first new constant not yet used is \(d_1\).\(\Gamma_2=\Gamma\cup\{P(d_1)\}\)
3\(\neg P(d_1)\)\(\Gamma_2\) contains \(P(d_1)\): inconsistent. Skip.\(\Gamma_3=\Gamma_2\)
4\(c=d_1\)From \(c=d_1\) and \(P(d_1)\) we deduce \(P(c)\) (Proposition 13.10(b), (d)); with \(\neg P(c)\) this is inconsistent. Skip.\(\Gamma_4=\Gamma_2\)

After four stages the set says that there is an object with the name \(d_1\), that it has the property \(P\), and, since \(c=d_1\) was skipped, the final set \(\Gamma'\) will contain \(\neg(c=d_1)\): the witness is different from \(c\). The obstacle of Example 14.1(a) is gone.

Exercise 1: one stage of the construction

Self-check only. Nothing here counts towards your grade.

The signature has unary relation symbols \(P,Q\) and a constant symbol \(c\). At some stage the set is \(\Gamma_n=\{\forall x\,(P(x)\to Q(x)),\ \neg Q(c),\ \exists x\,P(x),\ P(d_1)\}\). For each candidate for \(\varphi_{n+1}\) choose what the construction of Lemma 14.11 does.

(a) Skipped. From \(\forall x\,(P(x)\to Q(x))\) and \(P(c)\) we deduce \(Q(c)\), and \(\neg Q(c)\) is in \(\Gamma_n\).

(b) Added, with a witness. \(\Gamma_n\cup\{\exists x\,\neg Q(x)\}\) is consistent: it has the model with domain \(\{0,1\}\), \(c\) and \(d_1\) interpreted as \(0\) and \(1\), \(P\) as \(\{1\}\) and \(Q\) as \(\{1\}\). The sentence begins with \(\exists\), and \(d_1\) is already used, so \(\neg Q(d_2)\) is added.

(c) Added, without a witness. \(Q(d_1)\) is deducible from \(\Gamma_n\), so adding it keeps the set consistent. It does not begin with \(\exists\).

(d) Skipped. \(\Gamma_n\) deduces \(Q(d_1)\), and from \(c=d_1\) and \(Q(d_1)\) we deduce \(Q(c)\).

(e) Added, without a witness. The sentence \(\neg\exists x\,(P(x)\wedge\neg Q(x))\) is deducible from \(\forall x\,(P(x)\to Q(x))\), so the set stays consistent. The sentence begins with \(\neg\), not with \(\exists\).

6. Membership rules

In Week 10 the membership rules (Proposition 10.10) said that membership in a maximally consistent set follows the truth table of each connective. Now there are two more rules, for the quantifiers. One deduction is needed first.

Lemma 14.13: a failed universal statement has a counterexample

For every formula \(\psi\): \(\ \vdash\neg\forall x\,\psi\to\exists x\,\neg\psi\).

Proof.

1\(\neg\psi\to\exists x\,\neg\psi\)(L14)2\((\neg\psi\to\exists x\,\neg\psi)\to(\neg\exists x\,\neg\psi\to\neg\neg\psi)\)(Lemma 9.5(e))3\(\neg\exists x\,\neg\psi\to\neg\neg\psi\)(1,2 MP)4\(\neg\neg\psi\to\psi\)(Lemma 9.5(c))5\(\neg\exists x\,\neg\psi\to\psi\)(3,4 HS)6\(\forall x\,(\neg\exists x\,\neg\psi\to\psi)\)(5 Gen)7\(\forall x\,(\neg\exists x\,\neg\psi\to\psi)\to(\neg\exists x\,\neg\psi\to\forall x\,\psi)\)(L11)8\(\neg\exists x\,\neg\psi\to\forall x\,\psi\)(6,7 MP)9\((\neg\exists x\,\neg\psi\to\forall x\,\psi)\to(\neg\forall x\,\psi\to\neg\neg\exists x\,\neg\psi)\)(Lemma 9.5(e))10\(\neg\forall x\,\psi\to\neg\neg\exists x\,\neg\psi\)(8,9 MP)11\(\neg\neg\exists x\,\neg\psi\to\exists x\,\neg\psi\)(Lemma 9.5(c))12\(\neg\forall x\,\psi\to\exists x\,\neg\psi\)(10,11 HS)

Line 1 is (L14) with \(t:=x\). Line 7 is an instance of (L11) because \(x\) is not free in \(\neg\exists x\,\neg\psi\). □

This is the deduction that corresponds to the law \(\neg\forall x\,\varphi\equiv\exists x\,\neg\varphi\) of Proposition 12.27. The idea is on lines 1 to 8: if nothing is a counterexample, then \(\psi\) holds for an arbitrary \(x\), hence for all \(x\).

Proposition 14.14: membership rules

Let \(\Gamma'\) be a set of sentences of \(\mathcal L(\mathcal S')\) that is maximally consistent and has the witness property. Let \(\varphi,\psi\) be sentences, and let \(\theta\) be a formula with no free variable other than \(x\). "Closed term" means closed term of \(\mathcal L(\mathcal S')\).

(a) \(\neg\varphi\in\Gamma'\) if and only if \(\varphi\notin\Gamma'\).
(b) \(\varphi\to\psi\in\Gamma'\) if and only if \(\varphi\notin\Gamma'\) or \(\psi\in\Gamma'\).
(c) \(\varphi\wedge\psi\in\Gamma'\) if and only if \(\varphi\in\Gamma'\) and \(\psi\in\Gamma'\).
(d) \(\varphi\vee\psi\in\Gamma'\) if and only if \(\varphi\in\Gamma'\) or \(\psi\in\Gamma'\).
(e) \(\exists x\,\theta\in\Gamma'\) if and only if \(\theta[t/x]\in\Gamma'\) for some closed term \(t\).
(f) \(\forall x\,\theta\in\Gamma'\) if and only if \(\theta[t/x]\in\Gamma'\) for every closed term \(t\).

Proof. (a), (b) and (c) are proved as in Proposition 10.10. Each proof shows \(\Gamma'\vdash\chi\) for a sentence \(\chi\) and concludes \(\chi\in\Gamma'\).

(d) In Week 10, \(\vee\) was an abbreviation. Now it is a symbol with the axioms (L7) to (L9), and the rule needs a new proof. (\(\Leftarrow\)) If \(\varphi\in\Gamma'\), then (L7) and MP give \(\Gamma'\vdash\varphi\vee\psi\); if \(\psi\in\Gamma'\), use (L8). (\(\Rightarrow\)) Suppose \(\varphi\vee\psi\in\Gamma'\), \(\varphi\notin\Gamma'\) and \(\psi\notin\Gamma'\). By (a), \(\neg\varphi\in\Gamma'\) and \(\neg\psi\in\Gamma'\). Let \(\chi\) be any sentence. By Lemma 9.5(a) and MP, \(\Gamma'\vdash\varphi\to\chi\) and \(\Gamma'\vdash\psi\to\chi\). The instance \((\varphi\to\chi)\to((\psi\to\chi)\to((\varphi\vee\psi)\to\chi))\) of (L9) and MP three times give \(\Gamma'\vdash\chi\). This holds for every \(\chi\), so \(\Gamma'\) is inconsistent, a contradiction.

(e) (\(\Rightarrow\)) This is the witness property. (\(\Leftarrow\)) Let \(\theta[t/x]\in\Gamma'\). A closed term is free for \(x\) in every formula, so \(\theta[t/x]\to\exists x\,\theta\) is an instance of (L14). By MP, \(\Gamma'\vdash\exists x\,\theta\), so \(\exists x\,\theta\in\Gamma'\).

(f) (\(\Rightarrow\)) Let \(\forall x\,\theta\in\Gamma'\) and let \(t\) be a closed term. Then \(\forall x\,\theta\to\theta[t/x]\) is an instance of (L10), and MP gives \(\theta[t/x]\in\Gamma'\). (\(\Leftarrow\)) We prove the contrapositive. Let \(\forall x\,\theta\notin\Gamma'\). By (a), \(\neg\forall x\,\theta\in\Gamma'\). By Lemma 14.13 and MP, \(\Gamma'\vdash\exists x\,\neg\theta\), so \(\exists x\,\neg\theta\in\Gamma'\). By the witness property there is a closed term \(t\) with \(\neg\theta[t/x]\in\Gamma'\). By (a), \(\theta[t/x]\notin\Gamma'\). So not every closed term \(t\) has \(\theta[t/x]\in\Gamma'\). □

Rules (e) and (f) are the clauses of Definition 12.23 for \(\exists\) and \(\forall\), with "closed term" in place of "element" and "\(\in\Gamma'\)" in place of "true". The directions (e)(\(\Rightarrow\)) and (f)(\(\Leftarrow\)) are the two places where the witness property is used.

Warning: rule (f) fails without witnesses

In the signature of Example 14.1(a) the set \(\{P(c),\ \neg\forall x\,P(x)\}\) is consistent: it has a model with two elements. Extend it to a set \(\Delta\) that is maximally consistent in \(\mathcal L(\mathcal S)\), without new constants. The only closed term is \(c\), and \(P(c)\in\Delta\). So \(P(t)\in\Delta\) for every closed term \(t\), and still \(\forall x\,P(x)\notin\Delta\).

Example 14.15: deciding membership with the rules

Let \(\Gamma'\) be maximally consistent with the witness property, in a signature whose closed terms are the constants \(c,d_1,d_2,\dots\) only. Suppose \(P(c)\notin\Gamma'\), and \(P(d_i)\in\Gamma'\) for every \(i\).

(a) \(\exists x\,P(x)\in\Gamma'\), by rule (e) with \(t:=d_1\).
(b) \(\forall x\,P(x)\notin\Gamma'\), by rule (f): the closed term \(c\) has \(P(c)\notin\Gamma'\).
(c) \(\forall x\,(P(x)\vee\neg P(x))\in\Gamma'\). By rule (f) we must check \(P(t)\vee\neg P(t)\in\Gamma'\) for every closed term \(t\). For \(t=d_i\) it holds by rule (d), since \(P(d_i)\in\Gamma'\). For \(t=c\): \(P(c)\notin\Gamma'\), so \(\neg P(c)\in\Gamma'\) by rule (a), and rule (d) applies again.
(d) \(\exists x\,\neg P(x)\to\neg P(c)\in\Gamma'\), by rule (b), because \(\neg P(c)\in\Gamma'\).
Exercise 2: is the sentence in \(\Gamma'\)?

Self-check only. Nothing here counts towards your grade.

The signature has a unary relation symbol \(P\), a binary relation symbol \(E\) and no function symbols. The set \(\Gamma'\) is maximally consistent and has the witness property. Its closed terms are the constants \(c,d_1,d_2\) (to keep the exercise finite, suppose there are no other constants). Among the atomic sentences without \(=\), exactly the following five are in \(\Gamma'\):

\(P(c),\quad P(d_1),\quad E(c,d_1),\quad E(d_1,d_2),\quad E(d_2,d_2),\)

Every other atomic sentence without \(=\), for example \(P(d_2)\) or \(E(c,c)\), is not in \(\Gamma'\). Decide for each sentence whether it is in \(\Gamma'\), using Proposition 14.14.

(a) In \(\Gamma'\): \(P(d_2)\notin\Gamma'\), so \(\neg P(d_2)\in\Gamma'\) by (a), and (e) applies with \(t:=d_2\).

(b) In \(\Gamma'\): by (f), check \(\exists y\,E(t,y)\) for \(t=c,d_1,d_2\). The witnesses are \(d_1\), \(d_2\), \(d_2\).

(c) Not in \(\Gamma'\): by (e) we would need a closed term \(t\) with \(E(s,t)\in\Gamma'\) for all \(s\). No term works: \(E(c,c)\), \(E(d_1,d_1)\) and \(E(c,d_2)\) are not in \(\Gamma'\).

(d) In \(\Gamma'\): for \(t=c\) and \(t=d_1\) the consequent \(\exists y\,E(t,y)\wedge\neg E(t,t)\) is in \(\Gamma'\); for \(t=d_2\) the antecedent \(P(d_2)\) is not in \(\Gamma'\), so the implication is, by (b).

(e) Not in \(\Gamma'\): \(\forall x\,P(x)\notin\Gamma'\) because \(P(d_2)\notin\Gamma'\), and \(\exists x\,E(x,c)\notin\Gamma'\) because no atomic sentence \(E(t,c)\) is in \(\Gamma'\). By (d) the disjunction is not in \(\Gamma'\).

(f) In \(\Gamma'\): \(\forall x\,E(x,x)\notin\Gamma'\) since \(E(c,c)\notin\Gamma'\); by (a) its negation is in \(\Gamma'\).

Day 2: The Term Model, Completeness and Compactness

Today we turn a maximally consistent set with witnesses into a structure, read truth off membership, and obtain the Completeness Theorem and the Compactness Theorem.

7. The term model

Throughout today \(\Gamma'\) is a set of sentences of \(\mathcal L(\mathcal S')\) that is maximally consistent and has the witness property, as provided by Lemma 14.11. "Closed term" means closed term of \(\mathcal L(\mathcal S')\), and "rule (a)" to "rule (f)" are the membership rules of Proposition 14.14.

The domain of the structure will be made of the closed terms of \(\mathcal L(\mathcal S')\). There is at least one, the constant \(d_1\). Two closed terms must give the same element when \(\Gamma'\) says that they are equal.

Definition 14.16: the relation \(\sim\)

For closed terms \(s,t\) of \(\mathcal L(\mathcal S')\) we write \(s\sim t\) if the sentence \(s=t\) is in \(\Gamma'\).

Lemma 14.17: \(\sim\) respects everything
(a) \(\sim\) is an equivalence relation on the closed terms.
(b) If \(s_1\sim t_1,\dots,s_n\sim t_n\) and \(f\) is a function symbol of arity \(n\), then \(f(s_1,\dots,s_n)\sim f(t_1,\dots,t_n)\).
(c) If \(s_1\sim t_1,\dots,s_n\sim t_n\) and \(r\) is a relation symbol of arity \(n\), then \(r(s_1,\dots,s_n)\in\Gamma'\) if and only if \(r(t_1,\dots,t_n)\in\Gamma'\).

Proof. (a) Reflexive: \(\vdash t=t\) by Proposition 13.10(a), so \(t=t\in\Gamma'\). Symmetric: if \(s=t\in\Gamma'\), then Proposition 13.10(b) and MP give \(\Gamma'\vdash t=s\), so \(t=s\in\Gamma'\). Transitive: if \(s=t\) and \(t=r\) are in \(\Gamma'\), then Proposition 13.10(c) and MP twice give \(s=r\in\Gamma'\).

(b) We change one argument at a time. For the first argument, let \(\varphi\) be the atomic formula \(f(s_1,s_2,\dots,s_n)=f(z,s_2,\dots,s_n)\). Then \(\varphi[s_1/z]\) is \(f(s_1,\dots,s_n)=f(s_1,\dots,s_n)\), which is in \(\Gamma'\) by (a), and \(\varphi[t_1/z]\) is \(f(s_1,s_2,\dots,s_n)=f(t_1,s_2,\dots,s_n)\). By Proposition 13.10(d) and MP twice, the second sentence is in \(\Gamma'\). So \(f(s_1,s_2,\dots,s_n)\sim f(t_1,s_2,\dots,s_n)\). In the same way we replace \(s_2\) by \(t_2\), and so on; transitivity connects the steps.

(c) Again one argument at a time, with the atomic formula \(r(z,s_2,\dots,s_n)\): if \(r(s_1,s_2,\dots,s_n)\in\Gamma'\) and \(s_1=t_1\in\Gamma'\), then Proposition 13.10(d) gives \(r(t_1,s_2,\dots,s_n)\in\Gamma'\). The converse direction uses \(t_1\sim s_1\). □

We write \([t]\) for the equivalence class of \(t\), the set of all closed terms \(s\) with \(s\sim t\). So \([s]=[t]\) if and only if \(s=t\in\Gamma'\).

Definition 14.18: the term model

The term model of \(\Gamma'\) is the \(\mathcal S'\)-structure \(\mathcal A\) with

  • domain \(A=\{[t]: t\text{ a closed term of }\mathcal L(\mathcal S')\}\);
  • \(c^{\mathcal A}=[c]\) for each constant symbol \(c\) (including the new constants);
  • \(f^{\mathcal A}([t_1],\dots,[t_n])=[f(t_1,\dots,t_n)]\) for each function symbol \(f\);
  • \(([t_1],\dots,[t_n])\in r^{\mathcal A}\) iff \(r(t_1,\dots,t_n)\in\Gamma'\), for each relation symbol \(r\).

The last two clauses refer to the terms \(t_i\), and the same class has many members. By Lemma 14.17(b) and (c) the result does not depend on which members are chosen, so the definition makes sense. The domain is not empty.

Lemma 14.19: every closed term names its own class

For every closed term \(t\) of \(\mathcal L(\mathcal S')\): \(\ [\![t]\!]_{\mathcal A}=[t]\).

Proof. By induction on \(t\). For a constant, \([\![c]\!]_{\mathcal A}=c^{\mathcal A}=[c]\). For \(t=f(t_1,\dots,t_n)\): \([\![t]\!]_{\mathcal A}=f^{\mathcal A}([\![t_1]\!]_{\mathcal A},\dots,[\![t_n]\!]_{\mathcal A}) =f^{\mathcal A}([t_1],\dots,[t_n])=[f(t_1,\dots,t_n)]\), by Definition 12.21, the induction hypothesis and Definition 14.18. □

So every element of \(\mathcal A\) is the value of a closed term. This is the situation of Example 14.10.

Example 14.20: a term model with two elements

Signature: a constant symbol \(c\), a unary function symbol \(f\) and a unary relation symbol \(P\). Suppose \(\Gamma'\) contains

\(f(f(c))=c,\qquad\neg(f(c)=c),\qquad P(c),\qquad\neg P(f(c)),\qquad d_i=c\ \text{ for every }i.\)

(a) The classes. The closed terms are built from \(c\) and the \(d_i\) by applying \(f\). Since \(d_i\sim c\), Lemma 14.17(b) gives \(f(d_i)\sim f(c)\), and so on, so every closed term is equivalent to one of \(c,f(c),f(f(c)),\dots\). From \(f(f(c))\sim c\) we get \(f(f(f(c)))\sim f(c)\), then \(f(f(f(f(c))))\sim f(f(c))\sim c\), and so on. So every closed term is equivalent to \(c\) or to \(f(c)\). These two are not equivalent, because \(\neg(f(c)=c)\in\Gamma'\) and \(\Gamma'\) is consistent. The domain is \(A=\{[c],[f(c)]\}\) (Figure 2).
(b) The interpretations. \(f^{\mathcal A}([c])=[f(c)]\) and \(f^{\mathcal A}([f(c)])=[f(f(c))]=[c]\). \(P^{\mathcal A}=\{[c]\}\), since \(P(c)\in\Gamma'\) and \(P(f(c))\notin\Gamma'\). All constants \(c,d_1,d_2,\dots\) are interpreted as \([c]\).
(c) A sentence. Is \(\forall x\,(P(x)\to\neg P(f(x)))\) true in \(\mathcal A\)? For the element \([c]\): \([c]\in P^{\mathcal A}\) and \(f^{\mathcal A}([c])=[f(c)]\notin P^{\mathcal A}\), so the implication holds. For \([f(c)]\): it is not in \(P^{\mathcal A}\), so the implication holds. The sentence is true in \(\mathcal A\). The Truth Lemma below says that it must therefore be a member of \(\Gamma'\).
closed terms, grouped by ∼ the term model 𝒜 c, f(f(c)), d₁, d₂, f(f(d₁)), … f(c), f(f(f(c))), f(d₁), f(d₂), … [c] [f(c)] in P not in P f f
Figure 2. The term model of Example 14.20. Each element is a class of closed terms that \(\Gamma'\) declares equal. The function \(f^{\mathcal A}\) exchanges the two elements, and \(P^{\mathcal A}\) contains the class of \(c\) only.
Exercise 3: classes of closed terms

Self-check only. Nothing here counts towards your grade.

Signature: a constant symbol \(c\) and a unary function symbol \(f\). Write \(f^k(c)\) for \(f\) applied \(k\) times to \(c\), so \(f^0(c)\) is \(c\). The set \(\Gamma'\) contains

\(f^3(c)=c,\qquad\neg(f(c)=c),\qquad d_i=c\ \text{ for every }i.\)

Decide for each pair of terms whether they are in the same class, and enter the number of elements of the term model.

From \(f^3(c)\sim c\) and Lemma 14.17(b), \(f^{k+3}(c)\sim f^k(c)\) for every \(k\). So \(f^m(c)\) and \(f^n(c)\) are in the same class when \(m-n\) is divisible by \(3\), and every closed term is equivalent to one of \(c\), \(f(c)\), \(f^2(c)\).

These three are pairwise inequivalent. If \(f^2(c)\sim c\), apply \(f\): \(f^3(c)\sim f(c)\), so \(c\sim f(c)\), which contradicts \(\neg(f(c)=c)\in\Gamma'\). If \(f^2(c)\sim f(c)\), apply \(f\): \(f^3(c)\sim f^2(c)\), so \(c\sim f^2(c)\), which was just excluded. And \(f(c)\not\sim c\) is given.

So (a) no, (b) no, (c) yes, (d) yes, (e) no, and the term model has \(3\) elements.

8. The Truth Lemma

Lemma 14.21: the Truth Lemma

Let \(\mathcal A\) be the term model of \(\Gamma'\). For every sentence \(\varphi\) of \(\mathcal L(\mathcal S')\): \[\mathcal A\models\varphi\quad\text{if and only if}\quad\varphi\in\Gamma'.\]

Proof. By induction on the number of connectives and quantifiers in \(\varphi\).

\(\varphi\) is \(r(t_1,\dots,t_n)\). \(\mathcal A\models r(t_1,\dots,t_n)\) iff \(([\![t_1]\!]_{\mathcal A},\dots,[\![t_n]\!]_{\mathcal A})\in r^{\mathcal A}\) iff \(([t_1],\dots,[t_n])\in r^{\mathcal A}\) (Lemma 14.19) iff \(r(t_1,\dots,t_n)\in\Gamma'\) (Definition 14.18).

\(\varphi\) is \(t_1=t_2\). \(\mathcal A\models t_1=t_2\) iff \([\![t_1]\!]_{\mathcal A}=[\![t_2]\!]_{\mathcal A}\) iff \([t_1]=[t_2]\) iff \(t_1=t_2\in\Gamma'\).

\(\varphi\) is \(\neg\psi\), \(\psi\to\chi\), \(\psi\wedge\chi\) or \(\psi\vee\chi\). As in Lemma 10.16. For example, \(\mathcal A\models\neg\psi\) iff \(\mathcal A\not\models\psi\) iff \(\psi\notin\Gamma'\) (induction hypothesis) iff \(\neg\psi\in\Gamma'\) (rule (a)). The other three use rules (b), (c) and (d).

\(\varphi\) is \(\forall x\,\theta\).

\(\mathcal A\models\forall x\,\theta\)
iff\(\mathcal A\models\theta[\bar a/x]\) for every \(a\in A\)Definition 12.23
iff\(\mathcal A\models\theta[t/x]\) for every closed term \(t\)Lemmas 14.19 and 13.19
iff\(\theta[t/x]\in\Gamma'\) for every closed term \(t\)induction hypothesis
iff\(\forall x\,\theta\in\Gamma'\)rule (f)

For the second step: every element \(a\) of \(A\) is \([t]\) for a closed term \(t\), and \([t]\) is the value of \(t\); by Lemma 13.19 the sentences \(\theta[\bar a/x]\) and \(\theta[t/x]\) have the same truth value in \(\mathcal A\). For the third step: \(\theta[t/x]\) is a sentence of \(\mathcal L(\mathcal S')\) with one quantifier fewer than \(\varphi\).

\(\varphi\) is \(\exists x\,\theta\). The same chain with "some" in place of "every" and rule (e) in place of rule (f). □

As in Week 10 the proof is short because the membership rules did the work. Each case of the induction is one membership rule, and the two quantifier cases are the two places where witnesses are needed.

9. The Completeness Theorem

Theorem 14.22: consistent sets have models

Every consistent set \(\Gamma\) of sentences of \(\mathcal L(\mathcal S)\) has a model.

Proof. By Lemma 14.11 there is a set \(\Gamma'\supseteq\Gamma\) of sentences of \(\mathcal L(\mathcal S')\) that is maximally consistent and has the witness property. Let \(\mathcal A\) be its term model. By the Truth Lemma every member of \(\Gamma'\) is true in \(\mathcal A\), in particular every member of \(\Gamma\). The structure \(\mathcal A\) is an \(\mathcal S'\)-structure. Forget the interpretations of \(d_1,d_2,\dots\); what remains is an \(\mathcal S\)-structure with the same domain, and the sentences of \(\Gamma\), which do not contain the new constants, have the same truth values in it. □

Theorem 14.23: the Completeness Theorem

Let \(\Gamma\) be a set of sentences and \(\varphi\) a formula. If \(\Gamma\models\varphi\), then \(\Gamma\vdash\varphi\).

Proof. First let \(\varphi\) be a sentence. We prove the contrapositive. Suppose \(\Gamma\nvdash\varphi\). By Proposition 14.2(a), \(\Gamma\cup\{\neg\varphi\}\) is consistent. By Theorem 14.22 it has a model \(\mathcal A\). Then \(\mathcal A\models\Gamma\) and \(\mathcal A\not\models\varphi\), so \(\Gamma\not\models\varphi\).

Now let \(\varphi\) have the free variables \(x_1,\dots,x_n\). By Definition 12.25, \(\Gamma\models\varphi\) means \(\Gamma\models\forall x_1\cdots\forall x_n\,\varphi\). By the first part, \(\Gamma\vdash\forall x_1\cdots\forall x_n\,\varphi\). Now (L10) with \(t:=x_i\) and MP, applied \(n\) times, remove the quantifiers: \(\Gamma\vdash\varphi\). □

Corollary 14.24: \(\vdash\) and \(\models\) are the same relation

Let \(\Gamma\) be a set of sentences and \(\varphi\) a formula.

(a) \(\Gamma\vdash\varphi\) if and only if \(\Gamma\models\varphi\).
(b) \(\varphi\) is deducible without assumptions if and only if \(\varphi\) is valid.
(c) \(\Gamma\) is consistent if and only if \(\Gamma\) has a model.

Proof. (a) is Theorem 13.22 together with Theorem 14.23, and (b) is the case \(\Gamma=\varnothing\). (c) is Corollary 13.23(b) together with Theorem 14.22. □

The theorem was proved by Kurt Gödel in 1929. The proof given here, with new constants as witnesses, is due to Leon Henkin (1949).

What the theorem says about mathematics

A theorem of group theory is a sentence that is true in every group, that is, a sentence \(\varphi\) with \(\Gamma_{\mathrm{gr}}\models\varphi\). A proof in group theory is, when all steps are written out, a deduction from \(\Gamma_{\mathrm{gr}}\). Soundness says that what is proved is true in every group. Completeness says that every sentence that is true in every group has a proof, and the fifteen axiom schemes and two rules of Definition 13.1 are enough for it. No further logical principle is ever needed. The same holds for every theory given by first-order axioms.

Example 14.25: using the theorem in both directions
(a) A deduction that exists. Example 12.30 showed \(\Gamma_{\mathrm{gr}}\models\forall x\,\forall y\,\forall z\,(x\cdot y=x\cdot z\to y=z)\) by an argument about an arbitrary group. By the Completeness Theorem there is a Fitch deduction of this sentence from the group axioms. We have not written it, and we do not need to.
(b) A deduction that does not exist. By Example 13.24(b), neither commutativity nor its negation is deducible from \(\Gamma_{\mathrm{gr}}\). In terms of sets: \(\Gamma_{\mathrm{gr}}\) together with commutativity is consistent, and \(\Gamma_{\mathrm{gr}}\) together with the negation of commutativity is consistent. By Corollary 14.24(c) this is the statement that there are commutative groups and non-commutative groups.
(c) Consistency by a model, inconsistency by a deduction. To show that a set of sentences is consistent, give a model. To show that it is inconsistent, it is enough to show that it has no model. For example, \(\{\forall x\,\exists y\,E(x,y),\ \exists x\,\forall y\,\neg E(x,y)\}\) has no model: the element promised by the second sentence has no arrow leaving it, and the first sentence demands one. So the set is inconsistent, and a deduction of a contradiction from it exists.

The model built in Theorem 14.22 is small. The closed terms of \(\mathcal L(\mathcal S')\) can be listed in a sequence, so the domain of the term model is finite or can be listed as \(a_1,a_2,a_3,\dots\). Hence every consistent set of sentences (in a signature of the kind we consider) has a model whose domain is finite or listable. This is the Löwenheim–Skolem Theorem.

10. The Compactness Theorem

A deduction has finitely many lines, so it uses finitely many assumptions (Lemma 10.25; the proof is the same for first-order deductions). With Corollary 14.24 this becomes a statement about models, exactly as in Week 10.

Theorem 14.26: the Compactness Theorem

A set \(\Gamma\) of sentences has a model if and only if every finite subset of \(\Gamma\) has a model.

Proof. (\(\Rightarrow\)) A model of \(\Gamma\) is a model of every subset. (\(\Leftarrow\)) Suppose \(\Gamma\) has no model. By Corollary 14.24(c), \(\Gamma\) is inconsistent: \(\Gamma\vdash\psi\) and \(\Gamma\vdash\neg\psi\) for some \(\psi\). The two deductions use finitely many members of \(\Gamma\); let \(\Gamma_0\) be the set of these. Then \(\Gamma_0\) is a finite inconsistent subset of \(\Gamma\), and by Corollary 13.23(b) it has no model. □

Corollary 14.27

If \(\Gamma\models\varphi\), then there is a finite set \(\Gamma_0\subseteq\Gamma\) with \(\Gamma_0\models\varphi\).

Proof. \(\Gamma\vdash\varphi\) by completeness; the deduction uses a finite \(\Gamma_0\subseteq\Gamma\), so \(\Gamma_0\vdash\varphi\); then \(\Gamma_0\models\varphi\) by soundness. □

The statement of the Compactness Theorem mentions no deductions, and its proof depends on them. Its first application answers the question left open at the end of Week 12. Recall the sentence \(\lambda_{\ge n}\), which is true in a structure exactly when the domain has at least \(n\) elements.

Theorem 14.28: finiteness cannot be expressed
(a) If a set \(\Sigma\) of sentences has finite models with arbitrarily many elements, then \(\Sigma\) has an infinite model.
(b) There is no set of sentences whose models are exactly the finite structures.
(c) There is no single sentence whose models are exactly the infinite structures.

Proof. (a) Let \(\Gamma=\Sigma\cup\{\lambda_{\ge n}:n\ge1\}\). A finite subset \(\Gamma_0\) of \(\Gamma\) contains finitely many of the sentences \(\lambda_{\ge n}\); let \(N\) be the largest \(n\) that occurs. By assumption \(\Sigma\) has a finite model with at least \(N\) elements, and this is a model of \(\Gamma_0\). By the Compactness Theorem \(\Gamma\) has a model \(\mathcal A\). It is a model of \(\Sigma\), and it satisfies \(\lambda_{\ge n}\) for every \(n\), so it is infinite.

(b) Such a set would have finite models of every size, and by (a) an infinite model.

(c) If \(\sigma\) were true exactly in the infinite structures, then \(\neg\sigma\) would be true exactly in the finite ones, which contradicts (b). □

So the infinite set \(\{\lambda_{\ge n}:n\ge1\}\) of Week 12 cannot be replaced by one sentence, and for "finite" not even an infinite set of sentences is enough.

Example 14.29: finite subsets with models

Signature: constant symbols \(c_1,c_2,c_3,\dots\) and a binary relation symbol \(<\). Let \(\Gamma\) consist of the axioms of a strict linear order (irreflexive, transitive, any two different elements are comparable) and the sentences \(c_{n+1}<c_n\) for all \(n\ge1\).

(a) A finite subset \(\Gamma_0\) mentions finitely many of the constants, say only \(c_1,\dots,c_N\). It has a model with domain \(\{1,\dots,N\}\) and the usual order: interpret \(c_n\) as \(N+1-n\) for \(n\le N\), and the other constants as \(1\).
(b) By the Compactness Theorem \(\Gamma\) has a model: a linear order with an infinite descending sequence \(c_1>c_2>c_3>\cdots\). In this case a model is also easy to give directly, for example the integers with \(c_n\) interpreted as \(-n\). The point of the theorem is that the check in (a) is all that is ever required.
Remark: a non-standard model of arithmetic

This remark is not needed for the homework. Let \(\mathrm{Th}(\mathcal N)\) be the set of all sentences of \(\mathcal L(\mathcal S_{\mathrm{ar}})\) that are true in the natural numbers \(\mathcal N\). Add one new constant symbol \(c\), and let \[\Gamma=\mathrm{Th}(\mathcal N)\cup\{0<c,\ \ 1<c,\ \ 1+1<c,\ \ (1+1)+1<c,\ \dots\}.\] A finite subset of \(\Gamma\) contains finitely many of the new sentences, and it is true in \(\mathcal N\) when \(c\) is interpreted as a large enough number. By the Compactness Theorem \(\Gamma\) has a model \(\mathcal M\). Every sentence that is true in the natural numbers is true in \(\mathcal M\), and \(\mathcal M\) has an element, the value of \(c\), that is larger than \(0,1,2,3,\dots\). So no set of first-order sentences, not even the set of all true ones, describes the natural numbers completely.

Exercise 4: what compactness gives

Self-check only. Nothing here counts towards your grade.

Choose the correct statement in each item.

(a) \(\Gamma\) has a model. Every finite subset contains \(\lambda_{\ge n}\) for finitely many \(n\) and is true in a large enough finite structure, or in any infinite one. The models of \(\Gamma\) are the infinite structures.

(b) \(\Gamma\) has no model, and the finite subset \(\{\lambda_{\ge3},\ \neg\lambda_{\ge2}\}\) already has none. The theorem is not needed to see this, but it guarantees that such a finite subset exists whenever there is no model.

(c) Some finite subset entails \(\varphi\). This is Corollary 14.27. A deduction uses finitely many assumptions.

(d) \(\Sigma\) has an infinite model, by Theorem 14.28(a). It may have finite models as well, and it does.

Day 3: Undecidability

Today we show that no algorithm decides whether a first-order sentence is valid. The proof translates the run of a Turing machine into first-order sentences.

11. Decision problems

A decision problem is a question with a yes-or-no answer for each input from an infinite collection of inputs. An algorithm decides the problem if for every input it stops after finitely many steps with the correct answer. If such an algorithm exists, the problem is decidable.

Example 14.30: one decidable problem and one open question
(a) Input: a propositional formula. Question: is it a tautology? This problem is decidable. The truth table of the formula has finitely many rows, and each row is computed mechanically (Week 7).
(b) Input: a first-order sentence. Question: is it valid? There is no truth table: a sentence has infinitely many structures, of every size. But the Completeness Theorem gives half of an algorithm. A deduction is a finite sequence of formulas, and whether a given sequence is a deduction can be checked mechanically, line by line. So a machine can produce all deductions without assumptions one after the other, in order of length, and print the last line of each. By soundness everything it prints is valid, and by completeness every valid sentence is printed sooner or later.
This machine confirms that a valid sentence is valid. Given a sentence that is not valid, it runs forever and never says "no". To decide validity we would also need a way to recognise the sentences that are not valid.

Hilbert and Ackermann asked in 1928 for an algorithm that decides the validity of first-order sentences; this is the Entscheidungsproblem, the decision problem. In 1936 Alonzo Church and Alan Turing proved, independently, that there is none. To prove that no algorithm exists, one first needs a precise definition of "algorithm". Turing's definition is the following.

12. Turing machines

Definition 14.31: Turing machine

A Turing machine \(M\) consists of

  • a finite set \(Q\) of states, with an initial state \(q_0\) and an accepting state \(q_{\mathrm{acc}}\);
  • a finite alphabet \(\Sigma\) of letters, one of which is the blank \(\sqcup\);
  • a transition table \(\delta\): for some pairs \((q,a)\) of a state \(q\ne q_{\mathrm{acc}}\) and a letter \(a\), an entry \(\delta(q,a)=(r,b,D)\) with a state \(r\), a letter \(b\) and a direction \(D\), which is R (right) or L (left).

The machine works on a tape that is divided into cells. The tape has a first cell and continues to the right without end. Each cell holds one letter. A head stands on one cell. If the machine is in state \(q\), the head reads the letter \(a\), and \(\delta(q,a)=(r,b,D)\), then the machine writes \(b\) into the cell, moves the head one cell in direction \(D\), and goes into state \(r\). A head on the first cell that is told to move left stays where it is. If the table has no entry for \((q,a)\), the machine stops.

At every moment only finitely many cells have been used; all cells further to the right are blank. So the whole situation can be written down with two strings.

Definition 14.32: configurations and steps

A configuration is a triple \((q,u,v)\) of a state \(q\) and two strings \(u,v\) of letters. It describes the following situation (Figure 3): the machine is in state \(q\); \(u\) lists the cells to the left of the head, starting next to the head and going left; \(v\) lists the cell under the head and the cells to its right, as far as they have been used. If \(v\) is the empty string \(\varepsilon\), the head stands on a blank cell that has not been used yet.

The table entry \(\delta(q,a)=(r,b,D)\) allows the following steps, for all strings \(u,v\) and all letters \(c\):

EntrySituationStep
\((r,b,\mathrm R)\)the head reads \(a\)\((q,\ u,\ av)\ \Rightarrow\ (r,\ bu,\ v)\)
\((r,b,\mathrm L)\)the head reads \(a\), with \(c\) to its left\((q,\ cu,\ av)\ \Rightarrow\ (r,\ u,\ cbv)\)
\((r,b,\mathrm L)\)the head reads \(a\) on the first cell\((q,\ \varepsilon,\ av)\ \Rightarrow\ (r,\ \varepsilon,\ bv)\)

If \(a\) is the blank, the same entry also applies when \(v\) is empty, because an unused cell is blank:

EntrySituationStep
\((r,b,\mathrm R)\)the head is on an unused cell\((q,\ u,\ \varepsilon)\ \Rightarrow\ (r,\ bu,\ \varepsilon)\)
\((r,b,\mathrm L)\)unused cell, with \(c\) to its left\((q,\ cu,\ \varepsilon)\ \Rightarrow\ (r,\ u,\ cb)\)
\((r,b,\mathrm L)\)unused first cell\((q,\ \varepsilon,\ \varepsilon)\ \Rightarrow\ (r,\ \varepsilon,\ b)\)

The initial configuration for an input string \(w\) is \((q_0,\varepsilon,w)\): the input is written at the beginning of the tape and the head is on the first cell. A configuration is reachable (for the input \(w\)) if it can be obtained from the initial configuration by finitely many steps, possibly none. \(M\) accepts \(w\) if a configuration with the state \(q_{\mathrm{acc}}\) is reachable.

a b b a b ⊔ ⊔ … head, state q u = ba, read leftwards v = bab configuration (q, ba, bab)
Figure 3. A tape and its configuration. The cells to the left of the head contain \(a,b\) in tape order; \(u\) lists them starting next to the head, so \(u=ba\). The head cell and the used cells to its right give \(v=bab\).

With \(u\) written in this order, the letter next to the head is the first letter of \(u\), and a step changes \(u\) and \(v\) only at their beginnings. For a given configuration at most one step is possible, so the machine is deterministic.

Example 14.33: a small machine

The machine \(M_1\) has the alphabet \(\{a,\sqcup\}\), the states \(q_0,q_1,q_{\mathrm{acc}}\) and three table entries:

\(\delta(q_0,a)=(q_1,a,\mathrm R),\qquad\delta(q_1,a)=(q_{\mathrm{acc}},a,\mathrm R),\qquad \delta(q_1,\sqcup)=(q_0,a,\mathrm L).\)

(a) Input \(aa\). \((q_0,\varepsilon,aa)\Rightarrow(q_1,a,a)\Rightarrow(q_{\mathrm{acc}},aa,\varepsilon)\). The machine reads two letters \(a\) and accepts.
(b) Input \(a\). \((q_0,\varepsilon,a)\Rightarrow(q_1,a,\varepsilon)\). Now the head is on an unused cell, which is blank; the third entry applies with \(c=a\): \((q_1,a,\varepsilon)\Rightarrow(q_0,\varepsilon,aa)\). From here the machine continues as in (a). So \(M_1\) accepts \(a\), in four steps.
(c) Empty input. The initial configuration is \((q_0,\varepsilon,\varepsilon)\). The head reads a blank, and there is no entry for \((q_0,\sqcup)\). The machine stops at once. The only reachable configuration is the initial one, so \(M_1\) does not accept the empty input.

Every algorithm that has ever been proposed can be carried out by a Turing machine, and "decidable by an algorithm" is understood as "decidable by a Turing machine that always stops". The basic negative result is the following.

Theorem 14.34 (Turing, 1936): the acceptance problem is undecidable

There is no algorithm that, given a Turing machine \(M\) and an input \(w\), decides whether \(M\) accepts \(w\).

This theorem is used without proof

The proof belongs to a course on computability. Its idea fits into four sentences. A Turing machine is a finite table, so it can be written down as a string and given as an input to a machine. If an algorithm decided acceptance, we could build a machine \(D\) that, given the table of a machine \(M\), accepts exactly when \(M\) does not accept its own table. Now give \(D\) its own table: \(D\) accepts it exactly when \(D\) does not accept it. This is impossible, so the algorithm does not exist.

13. A machine as a set of sentences

Fix a Turing machine \(M\) and an input \(w\). We describe the run of \(M\) on \(w\) in a first-order language. The signature \(\mathcal S_M\) has

Every string has a closed term. For a string \(s\) we write \(\underline{s}\) for its term: \(\underline{\varepsilon}\) is \(e\), and \(\underline{as}\) is \(f_a(\underline{s})\). For example, \(\underline{bab}\) is \(f_b(f_a(f_b(e)))\). The intended reading of \(R_q(\underline u,\underline v)\) is: the configuration \((q,u,v)\) is reachable.

Definition 14.35: the sentences of \(M\) and \(w\)

\(\Gamma_{M,w}\) is the following finite set of sentences of \(\mathcal L(\mathcal S_M)\).

  • The start sentence \(R_{q_0}(e,\underline{w})\).
  • For each table entry \(\delta(q,a)=(r,b,\mathrm R)\): the sentence \[\forall x\,\forall y\,(R_q(x,f_a(y))\to R_r(f_b(x),y)),\] and, if \(a\) is the blank, also \(\forall x\,(R_q(x,e)\to R_r(f_b(x),e))\).
  • For each table entry \(\delta(q,a)=(r,b,\mathrm L)\): for every letter \(c\) the sentence \[\forall x\,\forall y\,(R_q(f_c(x),f_a(y))\to R_r(x,f_c(f_b(y)))),\] the sentence \(\forall y\,(R_q(e,f_a(y))\to R_r(e,f_b(y)))\), and, if \(a\) is the blank, also \(\forall x\,(R_q(f_c(x),e)\to R_r(x,f_c(f_b(e))))\) for every letter \(c\) and \(R_q(e,e)\to R_r(e,f_b(e))\).

The acceptance sentence is \(\alpha:=\exists x\,\exists y\,R_{q_{\mathrm{acc}}}(x,y)\).

Each sentence is one row of the tables in Definition 14.32, with variables \(x,y\) for the strings \(u,v\). The set is finite because the table and the alphabet are finite.

Example 14.36: the sentences of the machine \(M_1\)

For the machine of Example 14.33 and the input \(aa\), the set \(\Gamma_{M_1,aa}\) has nine sentences.

FromSentence
start\(R_{q_0}(e,f_a(f_a(e)))\)
\(\delta(q_0,a)=(q_1,a,\mathrm R)\)\(\sigma_1:\ \forall x\,\forall y\,(R_{q_0}(x,f_a(y))\to R_{q_1}(f_a(x),y))\)
\(\delta(q_1,a)=(q_{\mathrm{acc}},a,\mathrm R)\)\(\sigma_2:\ \forall x\,\forall y\,(R_{q_1}(x,f_a(y))\to R_{q_{\mathrm{acc}}}(f_a(x),y))\)
\(\delta(q_1,\sqcup)=(q_0,a,\mathrm L)\)\(\forall x\,\forall y\,(R_{q_1}(f_a(x),f_\sqcup(y))\to R_{q_0}(x,f_a(f_a(y))))\)
\(\forall x\,\forall y\,(R_{q_1}(f_\sqcup(x),f_\sqcup(y))\to R_{q_0}(x,f_\sqcup(f_a(y))))\)
\(\forall y\,(R_{q_1}(e,f_\sqcup(y))\to R_{q_0}(e,f_a(y)))\)
\(\forall x\,(R_{q_1}(f_a(x),e)\to R_{q_0}(x,f_a(f_a(e))))\)
\(\forall x\,(R_{q_1}(f_\sqcup(x),e)\to R_{q_0}(x,f_\sqcup(f_a(e))))\)
\(R_{q_1}(e,e)\to R_{q_0}(e,f_a(e))\)

The two right-moving entries read \(a\), which is not the blank, and give one sentence each. The left-moving entry reads the blank and gives six: the letter \(c\) to the left of the head can be \(a\) or \(\sqcup\), or the head is on the first cell; and each of these three cases occurs with a used and with an unused head cell.

Exercise 5: from a table entry to a sentence

Self-check only. Nothing here counts towards your grade.

The alphabet is \(\{a,b,\sqcup\}\). For each table entry and situation choose the sentence of Definition 14.35 that describes it.

(a) The step is \((q,u,av)\Rightarrow(r,bu,v)\): the letter \(a\) is removed from the front of \(v\), and the written letter \(b\) is put in front of \(u\), because after the move it is the cell next to the head on the left. The sentence is \(\forall x\,\forall y\,(R_q(x,f_a(y))\to R_r(f_b(x),y))\).

(b) The step is \((q,bu,av)\Rightarrow(r,u,bbv)\) for \(c=b\): the head moves onto the cell that held \(c=b\), so \(c\) leaves \(u\) and goes to the front of \(v\), followed by the written letter \(b\). The sentence is \(\forall x\,\forall y\,(R_q(f_b(x),f_a(y))\to R_r(x,f_b(f_b(y))))\).

(c) The head is on an unused cell, so \(v\) is empty and its term is \(e\). The step is \((q,u,\varepsilon)\Rightarrow(r,au,\varepsilon)\), and the sentence is \(\forall x\,(R_q(x,e)\to R_r(f_a(x),e))\).

Exercise 6: the terms of a configuration

Self-check only. Nothing here counts towards your grade.

The alphabet is \(\{a,b,\sqcup\}\). For each tape, enter the terms \(\underline u\) and \(\underline v\) of its configuration \((q,u,v)\). Type fa(fb(e)) for \(f_a(f_b(e))\) and e for the constant \(e\).

(a) This is the tape of Figure 3: \(u=ba\) and \(v=bab\), so \(\underline u=f_b(f_a(e))\) and \(\underline v=f_b(f_a(f_b(e)))\).

(b) The head is on the first cell, so \(u\) is empty: \(\underline u=e\) and \(\underline v=f_a(f_a(f_b(e)))\).

(c) The head is on the first unused cell, so \(v\) is empty. To the left of the head are \(a,a,b\) in tape order, so \(u=baa\): \(\underline u=f_b(f_a(f_a(e)))\) and \(\underline v=e\).

14. Acceptance is a first-order consequence

Lemma 14.37: one step is one short deduction

If \((q,u,v)\Rightarrow(r,u',v')\) is a step of \(M\), then \(\ \Gamma_{M,w}\vdash R_q(\underline u,\underline v)\to R_r(\underline{u'},\underline{v'})\).

Proof. Take a step by an entry \((r,b,\mathrm R)\) with a used head cell: \((q,u,av)\Rightarrow(r,bu,v)\). The set \(\Gamma_{M,w}\) contains the sentence \(\sigma=\forall x\,\forall y\,(R_q(x,f_a(y))\to R_r(f_b(x),y))\).

1\(\sigma\)(assump.)
2\(\sigma\to\forall y\,(R_q(\underline u,f_a(y))\to R_r(f_b(\underline u),y))\)(L10), \(t:=\underline u\)
3\(\forall y\,(R_q(\underline u,f_a(y))\to R_r(f_b(\underline u),y))\)(1,2 MP)
4\(\forall y\,(R_q(\underline u,f_a(y))\to R_r(f_b(\underline u),y))\to(R_q(\underline u,f_a(\underline v))\to R_r(f_b(\underline u),\underline v))\)(L10), \(t:=\underline v\)
5\(R_q(\underline u,f_a(\underline v))\to R_r(f_b(\underline u),\underline v)\)(3,4 MP)

The terms \(\underline u\) and \(\underline v\) are closed, so lines 2 and 4 are instances of (L10). By the definition of the terms, \(f_a(\underline v)\) is \(\underline{av}\) and \(f_b(\underline u)\) is \(\underline{bu}\). So line 5 is \(R_q(\underline u,\underline{av})\to R_r(\underline{bu},\underline v)\). The other five kinds of steps are treated in the same way with their sentences; a sentence with one quantifier needs (L10) once, and the sentence without quantifiers is already the implication. □

Theorem 14.38: the reduction

For every Turing machine \(M\) and every input \(w\), the following are equivalent.

(a) \(M\) accepts \(w\).
(b) \(\Gamma_{M,w}\vdash\alpha\).
(c) \(\Gamma_{M,w}\models\alpha\).

Proof. (a) \(\Rightarrow\) (b). Let \((q_0,\varepsilon,w)=C_0\Rightarrow C_1\Rightarrow\cdots\Rightarrow C_n\) be the steps that lead to a configuration \(C_n=(q_{\mathrm{acc}},u,v)\). Write \(\rho_i\) for the sentence \(R_q(\underline s,\underline t)\) that belongs to \(C_i=(q,s,t)\). Then \(\rho_0\) is the start sentence, a member of \(\Gamma_{M,w}\). By Lemma 14.37, \(\Gamma_{M,w}\vdash\rho_i\to\rho_{i+1}\) for each \(i\), and MP gives \(\Gamma_{M,w}\vdash\rho_1\), then \(\rho_2\), and finally \(\Gamma_{M,w}\vdash R_{q_{\mathrm{acc}}}(\underline u,\underline v)\). Two instances of (L14) with the closed terms \(\underline v\) and \(\underline u\), \[R_{q_{\mathrm{acc}}}(\underline u,\underline v)\to\exists y\,R_{q_{\mathrm{acc}}}(\underline u,y) \qquad\text{and}\qquad \exists y\,R_{q_{\mathrm{acc}}}(\underline u,y)\to\exists x\,\exists y\,R_{q_{\mathrm{acc}}}(x,y),\] and MP twice give \(\Gamma_{M,w}\vdash\alpha\).

(b) \(\Rightarrow\) (c) is the Soundness Theorem.

(c) \(\Rightarrow\) (a). Consider the following \(\mathcal S_M\)-structure \(\mathcal A\). Its domain is the set of all strings of letters. The constant \(e\) is interpreted as the empty string, and \(f_a^{\mathcal A}(s)=as\). So the value of the term \(\underline s\) is the string \(s\). Finally, \[(u,v)\in R_q^{\mathcal A}\quad\text{iff}\quad\text{the configuration }(q,u,v)\text{ is reachable for the input }w.\] Every member of \(\Gamma_{M,w}\) is true in \(\mathcal A\). The start sentence says that \((q_0,\varepsilon,w)\) is reachable, which is true with no steps. Take the sentence \(\forall x\,\forall y\,(R_q(x,f_a(y))\to R_r(f_b(x),y))\) of an entry \((r,b,\mathrm R)\). Its truth in \(\mathcal A\) means: for all strings \(u,v\), if \((q,u,av)\) is reachable, then \((r,bu,v)\) is reachable. This holds, because \((q,u,av)\Rightarrow(r,bu,v)\) is a step. The other sentences are true for the same reason: each of them was written down from a row of Definition 14.32.

So \(\mathcal A\) is a model of \(\Gamma_{M,w}\). By (c), \(\mathcal A\models\alpha\). This means that there are strings \(u,v\) with \((u,v)\in R_{q_{\mathrm{acc}}}^{\mathcal A}\), that is, a reachable configuration with the state \(q_{\mathrm{acc}}\). So \(M\) accepts \(w\). □

The two halves of the proof use the two sides of logic. If the machine accepts, we write a deduction, and the deduction is a copy of the computation. If the machine does not accept, the structure \(\mathcal A\) is a countermodel.

Example 14.39: a computation as a deduction

The machine \(M_1\) accepts \(aa\) in two steps (Example 14.33(a)). The deduction of \(\alpha\) from \(\Gamma_{M_1,aa}\) uses the start sentence and the sentences \(\sigma_1,\sigma_2\) of Example 14.36. We write \(\underline a\) for \(f_a(e)\) and \(\underline{aa}\) for \(f_a(f_a(e))\), and \(R_{\mathrm{acc}}\) for \(R_{q_{\mathrm{acc}}}\).

1\(R_{q_0}(e,\underline{aa})\)(assump.)
2\(\sigma_1\)(assump.)
3\(\sigma_2\)(assump.)
4\(\sigma_1\to\forall y\,(R_{q_0}(e,f_a(y))\to R_{q_1}(f_a(e),y))\)(L10)
5\(\forall y\,(R_{q_0}(e,f_a(y))\to R_{q_1}(f_a(e),y))\)(2,4 MP)
6\(\forall y\,(R_{q_0}(e,f_a(y))\to R_{q_1}(f_a(e),y))\to(R_{q_0}(e,\underline{aa})\to R_{q_1}(\underline a,\underline a))\)(L10)
7\(R_{q_0}(e,\underline{aa})\to R_{q_1}(\underline a,\underline a)\)(5,6 MP)
8\(R_{q_1}(\underline a,\underline a)\)(1,7 MP)
9\(\sigma_2\to\forall y\,(R_{q_1}(\underline a,f_a(y))\to R_{\mathrm{acc}}(f_a(\underline a),y))\)(L10)
10\(\forall y\,(R_{q_1}(\underline a,f_a(y))\to R_{\mathrm{acc}}(f_a(\underline a),y))\)(3,9 MP)
11\(\forall y\,(R_{q_1}(\underline a,f_a(y))\to R_{\mathrm{acc}}(f_a(\underline a),y))\to(R_{q_1}(\underline a,\underline a)\to R_{\mathrm{acc}}(\underline{aa},e))\)(L10)
12\(R_{q_1}(\underline a,\underline a)\to R_{\mathrm{acc}}(\underline{aa},e)\)(10,11 MP)
13\(R_{\mathrm{acc}}(\underline{aa},e)\)(8,12 MP)
14\(R_{\mathrm{acc}}(\underline{aa},e)\to\exists y\,R_{\mathrm{acc}}(\underline{aa},y)\)(L14)
15\(\exists y\,R_{\mathrm{acc}}(\underline{aa},y)\)(13,14 MP)
16\(\exists y\,R_{\mathrm{acc}}(\underline{aa},y)\to\exists x\,\exists y\,R_{\mathrm{acc}}(x,y)\)(L14)
17\(\exists x\,\exists y\,R_{\mathrm{acc}}(x,y)\)(15,16 MP)

Lines 1, 8 and 13 are the three configurations \((q_0,\varepsilon,aa)\), \((q_1,a,a)\), \((q_{\mathrm{acc}},aa,\varepsilon)\) of the computation. Lines 4 to 8 are the first step and lines 9 to 13 the second, each with five lines as in Lemma 14.37. On line 6 the term for \(y\) is \(\underline a\), and \(f_a(\underline a)\) is \(\underline{aa}\); on line 11 the term for \(y\) is \(e\), and \(f_a(e)\) is \(\underline a\). Lines 14 to 17 say that an accepting configuration exists.

For the empty input the situation is the opposite (Example 14.33(c)). In the structure \(\mathcal A\) of the proof, only the pair of two empty strings is in \(R_{q_0}^{\mathcal A}\), and \(R_{q_1}^{\mathcal A}\) and \(R_{q_{\mathrm{acc}}}^{\mathcal A}\) are empty. All sentences of \(\Gamma_{M_1,\varepsilon}\) are true in it and \(\alpha\) is false. So \(\Gamma_{M_1,\varepsilon}\nvdash\alpha\).

15. The undecidability of first-order logic

Theorem 14.40 (Church, Turing, 1936)

There is no algorithm that decides whether a first-order sentence is valid.

Proof. Let \(\gamma_1,\dots,\gamma_k\) be the members of \(\Gamma_{M,w}\), and let \[\Phi_{M,w}:=(\gamma_1\wedge\cdots\wedge\gamma_k)\to\alpha.\] A structure is a model of \(\Gamma_{M,w}\) exactly when the conjunction is true in it. So \(\Gamma_{M,w}\models\alpha\) if and only if \(\Phi_{M,w}\) is valid, and by Theorem 14.38, \[M\text{ accepts }w\quad\text{if and only if}\quad\models\Phi_{M,w}.\] The sentence \(\Phi_{M,w}\) can be written down mechanically from the table of \(M\) and the string \(w\). Suppose an algorithm decided validity. Then the following would be an algorithm for the acceptance problem: given \(M\) and \(w\), write down \(\Phi_{M,w}\) and decide whether it is valid. This contradicts Theorem 14.34. □

Corollary 14.41
(a) There is no algorithm that decides, for a finite set \(\Gamma\) of sentences and a sentence \(\varphi\), whether \(\Gamma\vdash\varphi\).
(b) There is no machine that prints exactly the sentences that are not valid.

Proof. (a) With \(\Gamma=\varnothing\) such an algorithm would decide whether \(\vdash\varphi\), which is the same as validity (Corollary 14.24(b)).

(b) By Example 14.30(b) a machine can print all valid sentences. If a second machine printed all sentences that are not valid, we could decide validity: given \(\varphi\), run both machines side by side and wait until \(\varphi\) appears in one of the two lists. □

Table 1 collects what the last three weeks have shown about a theory given by a set \(\Gamma\) of first-order axioms, such as the theory of groups.

WeekResultWhat it says about mathematics
12the language; \(\Gamma\models\varphi\)A statement of a theory is a first-order sentence. A theorem is a sentence that is true in every model of the axioms.
13deductions; SoundnessA proof is a deduction from the axioms. What is proved is true in every model.
14CompletenessWhat is true in every model has a proof. Proof and truth in all models have the same extent.
14CompactnessA theorem depends on finitely many axioms. Some properties, such as being finite, cannot be expressed by first-order axioms.
14UndecidabilityNo algorithm decides whether a sentence has a proof. A machine can check a proof; it cannot replace the search for one.
Table 1. First-order logic and mathematical proof.

If a theorem is true, a proof of it exists, and a machine that prints all deductions will find it in the end. If a statement is not a theorem, no general method reveals this. Finding a proof, or a structure that refutes the statement, is left to the mathematician.

Homework 14

Instructions

  • Write your full name in the box below before you start.
  • Show your work. For every answer give the reasons, not only the result. A deduction needs a justification on every line; a structure needs its domain and the interpretation of every symbol, and a check that it works; when you use a lemma or a theorem of the notes, name it.
  • This homework covers Weeks 13 and 14. Question 1 is about the deductions and the Soundness Theorem of Week 13.
  • Each question has two answer modes, Type and Write by hand. In Write by hand mode the text boxes are replaced by a drawing area where you can write with a pen, a finger or a mouse. For each question, only the answer in the selected mode goes into the PDF. Switching modes does not delete what you entered in the other mode.
  • The symbol buttons under a text box insert symbols at the cursor. In the deduction boxes, write one formula and its justification per line; the buttons below the box add and remove lines.
  • To submit, press Save homework as PDF, save the PDF and upload it to Canvas.
  • Your answers are saved automatically in this browser. If you open this page on a different computer or in a different browser, they will not be there.

Question 1: deductions and soundness20 points

(a) (10 points) Write a Fitch deduction that shows \(\ \forall x\,(P(x)\to Q(x))\vdash\exists x\,\neg Q(x)\to\exists x\,\neg P(x)\). You may use (L1) to (L15), MP, Gen, HS and the lemmas of Week 9. Check the side conditions of the quantifier axioms you use and state them next to the line.
(b) (10 points) For each claim decide whether it holds. If it holds, justify it: either by a deduction, or by an argument about an arbitrary model together with the theorem that allows you to conclude. If it does not hold, give a structure with at most three elements and the theorem that allows you to conclude.
  1. \(\exists x\,\forall y\,E(x,y)\vdash\forall y\,\exists x\,E(x,y)\)
  2. \(\forall x\,\exists y\,E(x,y)\vdash\exists x\,E(x,x)\)
ClaimHolds? (yes / no)If not: domainIf not: interpretation of E
(i)
(ii)

Question 2: witnesses20 points

The signature has unary relation symbols \(P,Q\) and a constant symbol \(c\).

(a) (8 points) Let \(\Gamma=\{\exists x\,P(x),\ \exists x\,\neg P(x)\}\). Show that \(\Gamma\) is consistent. Then explain why no structure in which every element is the value of a closed term of this signature can be a model of \(\Gamma\), and say which step of the completeness proof removes this difficulty.
(b) (8 points) Let \(\Delta=\{\forall x\,(P(x)\to Q(x)),\ \exists x\,P(x)\}\) and let \(d\) be a new constant symbol. Suppose that \(\Delta\cup\{P(d)\}\) were inconsistent. Follow the proof of Lemma 14.6 for this \(\Delta\) and \(\psi:=P(x)\): write the formula obtained at each of the five steps and name the lemma, corollary or axiom that gives it. Then confirm by a structure that \(\Delta\cup\{P(d)\}\) is in fact consistent.
(c) (4 points) Give a consistent set \(\Theta\) of sentences of this signature with \(\Theta\vdash\exists x\,Q(x)\) such that \(\Theta\cup\{Q(c)\}\) is inconsistent. Which hypothesis of Lemma 14.6 fails?

Question 3: membership rules20 points

Let \(\Gamma'\) be a maximally consistent set of sentences with the witness property, as in Proposition 14.14.

(a) (10 points) Let \(\theta\) and \(\eta\) be formulas with no free variable other than \(x\). Using only the membership rules (a) to (f), prove: \[\exists x\,(\theta\vee\eta)\in\Gamma'\quad\text{if and only if}\quad \exists x\,\theta\in\Gamma'\ \text{ or }\ \exists x\,\eta\in\Gamma'.\] Then decide whether the corresponding statement for \(\forall\) holds, \[\forall x\,(\theta\vee\eta)\in\Gamma'\quad\text{if and only if}\quad \forall x\,\theta\in\Gamma'\ \text{ or }\ \forall x\,\eta\in\Gamma',\] and say for each direction which rule gives it or why it can fail.
(b) (10 points) Lemma 14.13 gives \(\vdash\neg\forall x\,\psi\to\exists x\,\neg\psi\). Write a Fitch deduction for the converse direction, \(\ \vdash\exists x\,\neg\psi\to\neg\forall x\,\psi\). You may use (L1) to (L15), MP, Gen, HS and the lemmas of Week 9.

Question 4: a term model by hand25 points

Signature: a constant symbol \(c\), a unary function symbol \(g\) and a binary relation symbol \(E\). Let \(\Gamma'\) be a maximally consistent set of sentences of \(\mathcal L(\mathcal S')\) with the witness property that contains

\(g(g(g(c)))=g(c),\qquad\neg(g(g(c))=c),\qquad\neg(g(c)=c),\qquad\neg(g(g(c))=g(c)),\qquad d_i=c\ \text{ for every }i,\)

and, among the atomic sentences \(E(s,t)\) with \(s,t\) from \(c,\ g(c),\ g(g(c))\), exactly \(E(c,g(c))\), \(E(g(c),g(g(c)))\) and \(E(g(g(c)),g(c))\).

(a) (8 points) Determine the equivalence classes of the closed terms under \(\sim\). For each class give two further members besides its shortest one, and explain with Lemma 14.17 why every closed term lies in one of your classes.
(b) (8 points) Write down the term model \(\mathcal A\): the value of \(g^{\mathcal A}\) on each element and the pairs of \(E^{\mathcal A}\). Name each element by the shortest term in its class.
Element\(g^{\mathcal A}\) of this elementElements it is \(E^{\mathcal A}\)-related to
1st
2nd
3rd
(c) (9 points) For each of the two sentences, first decide from Definition 12.23 whether it is true in \(\mathcal A\). Then decide, independently and using only the membership rules of Proposition 14.14, whether it is in \(\Gamma'\). Compare with the Truth Lemma.
  1. \(\forall x\,E(x,g(x))\)
  2. \(\exists x\,\forall y\,\neg E(y,x)\)

Question 5: compactness15 points

Signature: a binary relation symbol \(E\). A structure is called connected in at most \(n\) steps if for all elements \(a,b\) there are \(k\le n\) and elements \(a=a_0,a_1,\dots,a_k=b\) with \((a_i,a_{i+1})\in E^{\mathcal A}\) for all \(i<k\).

(a) (6 points) For \(n=2\), write a sentence \(\pi_2\) that is true in a structure exactly when the structure is connected in at most \(2\) steps. Describe in words how \(\pi_n\) is built for general \(n\).
(b) (9 points) A structure is connected if it is connected in at most \(n\) steps for some \(n\) that may depend on the two elements: for all \(a,b\) there is a path from \(a\) to \(b\). Show that there is no set \(\Sigma\) of sentences whose models are exactly the connected structures. Hint: add two new constant symbols \(c,d\) and the sentences "there is no path of length at most \(n\) from \(c\) to \(d\)" for \(n=0,1,2,\dots\), and use the Compactness Theorem.