Proof is not the same as truth

We introduce formal systems, logical systems, and Peano arithmetic, carefully distinguishing the notions of provability and truth. Building on worked examples with BinarySum and its variants, we study soundness, completeness, and decidability, and prove that Peano arithmetic is semi-decidable but neither complete nor decidable — setting the stage for the incompleteness theorem.

33 min read

We must not believe those who today, with a philosophical bearing and a tone of authority, prophesy the downfall of culture and accept the ignorabimus. For us there is no ignorabimus, and in my opinion none in natural science either. In opposition to the foolish ignorabimus our answer is: we must know — we will know!

David Hilbert, as quoted in Vinnikov (1999)1

In this chapter we ask whether the concepts of proof and truth can be expressed algorithmically: is there an automatic way to prove theorems and verify mathematical statements? As we explained in Chapter 1, this was one of the central themes of early 20th-century mathematics.

Mathematics consists of deducing theorems from a certain list of axioms. To define this concept precisely, we turn to formal systems (Section 4.1).

However, we are especially interested in knowing whether the statements (or formulas) of a system are true. For this, we will need to define logical systems (Section 4.2).

Once we have distinguished provable from true, we ask about the relationship between these two concepts in a given logical system: from this we will understand the notions of soundness and completeness in Section 4.3, and finally we will ask whether we can algorithmically check if a formula is true—whether a logical system is decidable or not (see Chapter 3). Throughout this section we introduce multiple examples of logical systems that reinforce the concepts already mentioned, all revolving around a simple arithmetic operation.

Next, we introduce a logical system of special importance: Peano arithmetic (Section 4.4). This system is capable of proving a large number of number-theoretic theorems, so it will be especially interesting to know whether all its true statements are provable (this is precisely the First Incompleteness Theorem, which we prove in Chapter 5). To do this, we will find a way to translate the halting problem (Section 3.6) into a formula of this system.

Finally, we introduce further properties of the systems introduced in Section 4.5.

4.1 #Formal systems

Throughout this work we have presented multiple proofs, but what exactly is a proof? When we talk about proving something, we mean doing so mathematically. Unlike scientific proofs, mathematical proofs are exact and verifiable. In this way, we can ask whether a computer can perform proofs automatically.

To answer all these questions, we need to create a mathematical structure that allows us to formalize the concept of proof.

Definition4.1—Formal system

A formal system S\mathcal{S} is a triple S=(L,A,R)\mathcal{S} = (\mathcal{L}, \mathcal{A}, \mathcal{R}), where:

  • L\mathcal{L} is a formal language over some alphabet AA. Each element of L\mathcal{L} is called a well-formed formula (or formula).2
  • A\mathcal{A} is the set of axioms: a set of formulas from L\mathcal{L}.
  • R\mathcal{R} is the set of inference rules: a set of computable functions mapping formulas of L\mathcal{L} (premises) to formulas of L\mathcal{L} (derivations) (see Definition 3.9).

If, given two formulas ϕ1,ϕ2∈L\phi_1, \phi_2 \in \mathcal{L}, ϕ2\phi_2 is derived from ϕ1\phi_1, we use the notation ϕ1↦ϕ2\phi_1 \mapsto \phi_2. If ϕ2\phi_2 is derived from ϕ1\phi_1 in a finite number of derivations, we use the notation ϕ1↦∗ϕ2\phi_1 \xmapsto{*} \phi_2.

Let us see an example of a formal system that will be extremely useful in this chapter.

Formal system4.2—BinarySum\textbf{BinarySum}

Let BinarySum=(L,A,R)\textbf{BinarySum} = (\mathcal{L}, \mathcal{A}, \mathcal{R}) be the formal system composed of:

  • Language L\mathcal{L}: formed over the alphabet {0,1,+,=}\{\texttt{0}, \texttt{1}, \texttt{+}, \texttt{=}\}, recognized by the regular expression3
N(+N)∗=N(+N)∗N(\texttt{+}N)^* = N(\texttt{+}N)^*

where NN is an abbreviation for the regular expression 1(0∣1)∗\texttt{1}(\texttt{0}|\texttt{1})^*.

  • Axiom set A\mathcal{A}: consists of a single axiom,
A={1=1}\mathcal{A} = \{\texttt{1=1}\}
  • Inference rule set R\mathcal{R}: the following:
(R1)A=B↦1+A=1+B(R2)AN‾+N‾B↦AN0B(R3)A1‾+N0‾B↦AN1B\begin{matrix} \text{(R1)} & A\texttt{=}B & \mapsto & \texttt{1+}A\texttt{=}\texttt{1+}B \\ \text{(R2)} & A\underline{N}\texttt{+}\underline{N}B & \mapsto & AN\texttt{0}B \\ \text{(R3)} & A\texttt{\underline{1}+}\underline{N\texttt{0}}B & \mapsto & AN\texttt{1}B \end{matrix}

where we use the following notation: AA and BB are words over the alphabet {0,1,+,=}\{\texttt{0}, \texttt{1}, \texttt{+}, \texttt{=}\} and NN is a word obeying the regular expression 1(0∣1)∗\texttt{1}(\texttt{0}|\texttt{1})^*. The underlined parts are maximal matches of the regular expression for NN.

It is important to emphasize the notation used to describe the inference rules of BinarySum\textbf{BinarySum}, in particular the meaning of maximal match. A maximal match, in this case, is a substring that satisfies the regular expression for NN and cannot be extended in either direction. In the formula 100+11+1001=101, we have four maximal matches of this type: 100, 11, 1001, and 101, in that order.

It would be possible to describe these rules using regular expressions, but this would make the notation less simple and intuitive.

Once a formal system is defined, it is possible to prove (or demonstrate) some of its formulas, which we call theorems.

Definition4.3—Theorem and proof

Given a formal system S=(L,A,R)\mathcal{S} = (\mathcal{L}, \mathcal{A}, \mathcal{R}), a proof of a formula of S\mathcal{S} is a finite sequence of formulas of S\mathcal{S}, where each formula is either an axiom or follows from applying an inference rule to formulas appearing earlier in the sequence.

A formula ϕ∈L\phi \in \mathcal{L} is called a theorem (or provable formula) if there exists a proof in S\mathcal{S}.

Let us see an example of a theorem in BinarySum\textbf{BinarySum}.

Example4.4

Let 1+1+1=11 be a formula of BinarySum\textbf{BinarySum}. We show that it is a theorem:

Step Formula Justification
(F1) 1=1 (axiom)
↦\mapsto (F2) 1+1=1+1 (apply R1 to F1)
↦\mapsto (F3) 1+1=10 (apply R2 to F2)
↦\mapsto (F4) 1+1+1=1+10 (apply R1 to F3)
↦\mapsto (F5) 1+1+1=11 (apply R3 to F4)

Note that, although it is not in the definition, proofs of theorems are usually accompanied by notes that help verify the proof. The companion repository provides binary_addition.py with is_theorem to generate proofs. To test whether a formula is a theorem in any of the systems in this chapter, specify the system name followed by the formula.

Below are some examples of using this function:

>>> from binary_addition import is_theorem
>>> is_theorem('BinarySum', '1+1+1=11')
    (F1) 1=1            (Axioma)
 -> (F2) 1+1=1+1        (R1)
 -> (F3) 1+1+1=1+1+1   (R1)
 -> (F4) 1+1+1=1+10     (R2)
 -> (F5) 1+1+1=11       (R3)
'theorem'
>>> is_theorem('BinarySum', '11+1=10')
'not proved within the first 109322 generated formulas'
>>> is_theorem('BinarySum', 'ill-formed')
'ill-formed formula'
>>> is_theorem('NonexistentSystem', 'whatever')
'system does not exist'

The proof of 1+1+1=11 performed by is_theorem is different from that of Example 4.4. This is perfectly possible: a theorem can have several proofs. This fact is evident from Definition 4.3 itself: a formula is a theorem if "there exists a proof".

4.2 #Logical systems

As the name suggests, the BinarySum\textbf{BinarySum} system is intended to check formulas of binary addition. In this way, a word like 11 represents the number 33, and a formula like 1+1+1=11 represents that 1+1+1=31+1+1=3. Note that this allows us to recognize whether a formula of BinarySum\textbf{BinarySum} is true: we simply interpret it as an arithmetic formula and declare it true if it is a correct arithmetic formula. In this way, formulas like 10+1=11 are true, while others like 11+1=10 are not.

In the previous section, we intentionally did not mention the concept of truth: a formal system has no notion of certainty. This is because the definitions of theorem and true formula are completely different.

Theorems depend only on syntax: "Can we prove a theorem from certain axioms and inference rules?" Truth, however, depends on semantics: "Is this formula true when interpreted by giving certain meaning to its symbols?"

By definition, formal systems depend only on syntax. In this section, we introduce logical systems, which are nothing more than formal systems to which we add a semantics. When we add the arithmetic semantics we have discussed to the formal system BinarySum\textbf{BinarySum}, we obtain the logical system BinarySumLogical\textbf{BinarySumLogical}.

Logical system4.5—BinarySumLogical\textbf{BinarySumLogical}

Let BinarySumLogical\textbf{BinarySumLogical} be the logical system obtained by adding arithmetic semantics to the formal system BinarySum\textbf{BinarySum}.

A formula in BinarySumLogical\textbf{BinarySumLogical} is true if it is correct when viewed as a formula of binary number addition.

Formally, we can define these systems as:

Definition4.6—Logical system

A logical system G=(S,I)\mathcal{G} = (\mathcal{S}, \mathcal{I}) consists of a formal system S=(L,A,R)\mathcal{S} = (\mathcal{L}, \mathcal{A}, \mathcal{R}) and a semantics or truth assignment I\mathcal{I}, where I\mathcal{I} is a function assigning to formulas of L\mathcal{L} an interpretation, which is a value from the set {true,false}\{\text{true}, \text{false}\}.

The truth assignment need not be computable (Definition 3.9) and may be defined for all formulas or for a subset of them.4

Once we incorporate a truth assignment into a formal system, we can say when a formula is true. We make this precise in the following definition:

Definition—True formula and false formula

Given a logical system G=(S,I)\mathcal{G} = (\mathcal{S}, \mathcal{I}) with S=(L,A,R)\mathcal{S} = (\mathcal{L}, \mathcal{A}, \mathcal{R}), we say that the formula ϕ∈L\phi \in \mathcal{L} is true if I(ϕ)\mathcal{I}(\phi) is well defined and I(ϕ)=true\mathcal{I}(\phi) = \text{true}. Otherwise, we say the formula is false.

Let us see examples of true and false formulas for BinarySumLogical\textbf{BinarySumLogical}.

Example4.7

Let 1+1+1=11 be a formula of BinarySumLogical\textbf{BinarySumLogical}. Clearly, this formula is true since the following arithmetic operation is correct in the binary numeral system:

1+1+1=111+1+1=11

The file binary_addition.py also provides a function to check the truth of formulas in logical systems, called is_true. An example:

>>> from binary_addition import is_true
>>> is_true('BinarySumLogical', '1+1+1=11')
True
>>> is_true('BinarySumLogical', '11+1=10')
False
>>> is_true('BinarySumLogical', 'ill-formed')
False
>>> is_true('BinarySum', '1+1+1=11')
'system does not exist or is not a logical system'

We will introduce more logical systems obtained by adding (Logical system 4.8) and removing (Logical system 4.9) rules from BinarySumLogical\textbf{BinarySumLogical}.

Logical system4.8—BinarySumLogicalBroken\textbf{BinarySumLogicalBroken}

Let BinarySumLogicalBroken\textbf{BinarySumLogicalBroken} be the logical system obtained by adding the following inference rule to BinarySumLogical\textbf{BinarySumLogical}:

(R1b)A=B↦1+A=B\begin{matrix} \text{(R1b)} & A\texttt{=}B & \mapsto & \texttt{1+}A\texttt{=}B \end{matrix}
Logical system4.9—BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted}

Let BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted} be the logical system obtained by removing inference rule (R3) from BinarySumLogical\textbf{BinarySumLogical}.

These systems are especially interesting, since in them we can find both provable formulas that are not true (Example 4.10) and true formulas that are not provable (Example 4.11).

Example4.10

The formula 1+1=1 is a theorem and is not true in BinarySumLogicalBroken\textbf{BinarySumLogicalBroken}.

Clearly, 1+1=11+1=1 is not a correct binary addition operation, and therefore it is not a true formula. However, it is a theorem because we can prove it directly from the axiom using the new rule (R1b) introduced.

from binary_addition import is_theorem, is_true
is_theorem('BinarySumLogicalBroken', '1+1=1')
(F1) 1=1    (Axioma)
-> (F2) 1+1=1  (R1b)
'theorem'
is_true('BinarySumLogicalBroken', '1+1=1')
False
Example4.11

The formula 1+10=11 is not a theorem and is true in BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted}.

The formula is true since 1+10=111+10=11 is a correct binary addition operation. However, it is not a theorem because, having removed (R3), we cannot replace 0 with 1.

from binary_addition import is_theorem, is_true
is_theorem('BinarySumLogicalRestricted', '1+10=11')
'not proved within the first 154639 generated formulas'
is_true('BinarySumLogicalRestricted', '1+10=11')
True

It is important to note that the function is_theorem cannot prove that a formula is not provable due to the way we designed it. The code above does not prove that 1+10=11 is not a theorem—the proof of this example does.

4.3 #Soundness, completeness, and decidability

We have found logical systems in which there are true formulas that are not provable, and vice versa. This leads us to the definition of two important properties of logical systems.

Definition4.12—Soundness

A logical system is sound if all its theorems are true. Otherwise, we say it is unsound.

Definition4.13—Completeness

A logical system is (semantically) complete5 if all true formulas are theorems. Otherwise, we say it is incomplete.

Let us see whether the logical systems we have presented so far are sound and complete. A summary of all results can be seen in Table 4.1.

Proving that BinarySumLogical\textbf{BinarySumLogical} is sound and complete is a matter of checking the axiom and each inference rule against the intended meaning of binary addition. A sketch is enough to see the idea; the full arguments are Proposition 4.14 and Proposition 4.15 below.

Proposition

The logical system BinarySumLogical\textbf{BinarySumLogical} is sound and complete.

Proof

Sketch. The only axiom is 1=1, which is true. Each of (R1)–(R3) preserves truth of binary addition identities: (R1) adds one on both sides, (R2) replaces N+NN+N by the even number N0N0, and (R3) replaces 1+N01+N0 by the odd number N1N1. Conversely, every true identity can be reduced to a sum of ones by reversing those rules, and that sum is derived from the axiom by (R1). The detailed proofs are given below.

∎
Proposition4.14

The logical system BinarySumLogical\textbf{BinarySumLogical} is sound.

Proof

To prove soundness, we verify that all inference rules map true formulas to true formulas. First, the axiom 1=1 is true, since indeed 1=11=1.

Now we check each rule.

(R1) A=B↦1+A=1+BA\texttt{=}B \mapsto \texttt{1+}A\texttt{=}\texttt{1+}B

If AA and BB are binary numbers and we assume the formula A=BA\texttt{=}B is true, then A=BA=B. Therefore, the formula 1+A=1+B\texttt{1+}A\texttt{=1+}B is true, since 1+A=1+B1+A=1+B.

(R2) AN‾+N‾B↦AN0BA\underline{N}\texttt{+}\underline{N}B \mapsto AN\texttt{0}B

The maximal matches on NN mean we must verify that, given a binary number NN, if N+NN\texttt{+}N is true then N0N\texttt{0} is true, i.e. we must show N+N=N0N\texttt{+}N=N\texttt{0}.

A binary number NN is represented by mm digits (each 00 or 11): N=nm−1 nm−2 ... n1 n0N=n_{m-1}\:n_{m-2}\:...\:n_1\:n_0, satisfying:

N=nm−1⋅2m−1+nm−2⋅2m−2+...+n1⋅2+n0N = n_{m-1}\cdot2^{m-1} + n_{m-2}\cdot2^{m-2}+...+n_1\cdot2+n_0

It suffices to observe that:

N+N=2N=nm−1⋅2m+nm−2⋅2m−1+...+n1⋅22+n0⋅2N+N=2N=n_{m-1}\cdot2^{m} + n_{m-2}\cdot2^{m-1}+...+n_1\cdot2^2+n_0\cdot 2

and that the number N+NN+N corresponds exactly to the binary string nm−1 nm−2 ... n1 n0 0=N0n_{m-1}\:n_{m-2}\:...\:n_1\:n_0\:0=N\texttt{0}.

(R3) A1‾+N0‾B↦AN1BA\texttt{\underline{1}+}\underline{N\texttt{0}}B \mapsto AN\texttt{1}B

Analogously to the previous rule, we verify that:

1+N0=N0+1=nm−1⋅2m+nm−2⋅2m−1+...+n1⋅22+n0⋅2+1=N11+N\texttt{0}=N\texttt{0}+1=n_{m-1}\cdot2^{m} + n_{m-2}\cdot2^{m-1}+...+n_1\cdot2^2+n_0\cdot 2+1=N\texttt{1}
∎
Proposition4.15

The logical system BinarySumLogical\textbf{BinarySumLogical} is complete.

Proof

We show that every true formula is a theorem. Every true formula ϕ\phi has the form:

ϕ=N1+N2+...+Nk=M1+M2+...+Ml\phi=N_1\texttt{+}N_2\texttt{+}...\texttt{+}N_k\texttt{=}M_1\texttt{+}M_2\texttt{+}...\texttt{+}M_l

where each Ni,MjN_i, M_j (for all i∈{1,...,k}i\in\{1,...,k\}, j∈{1,...,l}j\in\{1,...,l\}) is a binary number (matching the regular expression 1(0|1)*\texttt{1(0|1)}^\texttt{*}), and the following arithmetic identity holds:

N1+N2+...+Nk=M1+M2+...+MlN_1+N_2+...+N_k=M_1+M_2+...+M_l

Our goal is to prove that ϕ\phi is a theorem. We first prove the following key claim: given a binary number nn that is a maximal match of the regular expression 1(0|1)*\texttt{1(0|1)*}, it can be derived from the sum of nn ones, i.e.:

A1+1+...+1⏟nB↦∗An‾BA\underbrace{\texttt{1+1+}...\texttt{+1}}_{n}B\xmapsto{*}A\underline{n}B

Assuming this claim, we have:

ψ=1+...+1⏟N1+1+...+1⏟N2+...+1+...+1⏟Nk=1+...+1⏟M1+...+1+...+1⏟Ml↦∗ϕ\psi=\underbrace{\texttt{1+...+1}}_{N_1}\texttt{+}\underbrace{\texttt{1+...+1}}_{N_2}\texttt{+}...\texttt{+}\underbrace{\texttt{1+...+1}}_{N_k}\texttt{=}\underbrace{\texttt{1+...+1}}_{M_1}\texttt{+}...\texttt{+}\underbrace{\texttt{1+...+1}}_{M_l}\xmapsto{*}\phi

Since N1+N2+...+Nk=M1+M2+...+Ml=nN_1+N_2+...+N_k=M_1+M_2+...+M_l=n, we get:

ψ=1+1+...+1⏟n=1+1+...+1⏟n\psi=\underbrace{\texttt{1+1+}...\texttt{+1}}_{n}\texttt{=}\underbrace{\texttt{1+1+}...\texttt{+1}}_{n}

and clearly ψ\psi can be obtained by applying rule (R1) n−1n-1 times to the axiom 1=1\texttt{1=1}, so:

1=1↦∗ψ=1+1+...+1⏟n=1+1+...+1⏟n↦∗ϕ\texttt{1=1}\xmapsto{*}\psi=\underbrace{\texttt{1+1+}...\texttt{+1}}_{n}\texttt{=}\underbrace{\texttt{1+1+}...\texttt{+1}}_{n}\xmapsto{*}\phi

Since 1=1↦∗ϕ\texttt{1=1}\xmapsto{*}\phi and 1=1 is an axiom, ϕ\phi is a theorem.

It remains to prove the claim that:

A1+1+...+1⏟nB↦∗An‾BA\underbrace{\texttt{1+1+}...\texttt{+1}}_{n}B\xmapsto{*}A\underline{n}B

Let mm be a positive binary number. The case m=1m=1 is immediate; for m>1m>1, there are two cases.

If m>1m>1 is odd, it can be written with kk digits as m=bk−1 bk−2 ... b1 1m=b_{k-1}\:b_{k-2}\:...\:b_1\:\texttt{1}. Suppose a formula φ\varphi of BinarySumLogical\textbf{BinarySumLogical} contains mm as a maximal match of 1(0|1)*\texttt{1(0|1)*}, i.e. φ=A m‾ B\varphi=A\:\underline{m}\:B. Then φ\varphi can be derived from a formula φ′\varphi' via rule (R3), φ′↦φ\varphi'\mapsto\varphi, where:

φ′=A 1+bk−1 bk−2 ... b1 0‾ B\varphi'=A\:\texttt{1+}\underline{b_{k-1}\:b_{k-2}\:...\:b_1\:\texttt{0}}\:B

If mm is even, it can be expressed as the sum p+pp+p for some positive binary pp. If φ=A m‾ B\varphi=A\:\underline{m}\:B contains mm as a maximal match, then φ′↦φ\varphi'\mapsto\varphi via rule (R2), where:

φ′=A p‾+p‾ B\varphi'=A\:\underline{p}\texttt{+}\underline{p}\:B

With this in hand, every positive integer mm occurring in a formula of BinarySumLogical\textbf{BinarySumLogical} can be reduced to the sum of mm ones: given φ=A m‾ B\varphi=A\:\underline{m}\:B,

A 1+1+...+1⏟m B↦∗φA\:\underbrace{\texttt{1+1+}...\texttt{+1}}_{m}\:B\xmapsto{*}\varphi

This holds because every positive natural number mm can be reduced to the sum of mm ones by recursively applying the above operations: divide by 22 when even (using R2 in reverse), or subtract 11 when odd (using R3 in reverse).

∎

Since the other logical systems are "obtained" from BinarySumLogical\textbf{BinarySumLogical}, the following propositions are much simpler to prove. As is evident, Example 4.10 and Example 4.11 prove that BinarySumLogicalBroken\textbf{BinarySumLogicalBroken} is unsound and that BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted} is incomplete, respectively.

Let us see these propositions next.

Proposition

The logical system BinarySumLogicalBroken\textbf{BinarySumLogicalBroken} is complete and unsound.

Proof

It is easy to see that this system is complete from the completeness of BinarySumLogical\textbf{BinarySumLogical}. We observe that both logical systems have the same semantics, that is, they have the same true formulas. Thus, a true formula ϕ\phi in BinarySumLogical\textbf{BinarySumLogical} is also true in BinarySumLogicalBroken\textbf{BinarySumLogicalBroken}.

Let us see whether ϕ\phi is a theorem in BinarySumLogicalBroken\textbf{BinarySumLogicalBroken}. By the completeness of BinarySumLogical\textbf{BinarySumLogical}, ϕ\phi is a theorem in that system. But since BinarySumLogicalBroken\textbf{BinarySumLogicalBroken} has all the rules of BinarySumLogical\textbf{BinarySumLogical} (and one more), ϕ\phi is also a theorem in BinarySumLogicalBroken\textbf{BinarySumLogicalBroken}.

However, the logical system is unsound. In Example 4.10 we saw a formula that is a theorem and is not true.

∎
Proposition

The logical system BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted} is incomplete and sound.

Proof

The incompleteness of this system follows from Example 4.11. Soundness follows from the soundness of BinarySumLogical\textbf{BinarySumLogical}.

Let ϕ\phi be a theorem of BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted}. Since BinarySumLogical\textbf{BinarySumLogical} has all the rules of BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted} (and one more), ϕ\phi is a theorem in BinarySumLogical\textbf{BinarySumLogical}. From the soundness of BinarySumLogical\textbf{BinarySumLogical}, ϕ\phi is true. But since BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted} has the same semantics, ϕ\phi will also be true in this system.

∎

The logical systems BinarySumLogicalBroken\textbf{BinarySumLogicalBroken} and BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted} were obtained by modifying the syntax of BinarySumLogical\textbf{BinarySumLogical}. We now introduce the last system of this type, which arises from modifying the semantics of BinarySumLogicalBroken\textbf{BinarySumLogicalBroken}.

Logical system4.16—BinarySumLogicalFixed\textbf{BinarySumLogicalFixed}

Let BinarySumLogicalFixed\textbf{BinarySumLogicalFixed} be the logical system obtained from BinarySumLogicalBroken\textbf{BinarySumLogicalBroken} by modifying its semantics. We interpret formulas as formulas of binary number addition, but the symbol = will be interpreted as "greater than or equal to" (≥\geq).

In this last logical system we could have modified the symbol = to >=. However, we do not do so intentionally, to remember that syntax and semantics are independent—we can assign whatever truth value we wish.

Let us see a simple illustrative example of a true formula and a false formula.

Example4.17

The formula 1+1=1 is true in BinarySumLogicalFixed\textbf{BinarySumLogicalFixed}, while 1=1+1 is false.

from binary_addition import is_true
is_true('BinarySumLogicalFixed', '1+1=1')
True
is_true('BinarySumLogicalFixed', '1=1+1')
False

By modifying the semantics, we have managed to "fix" the BinarySumLogicalBroken\textbf{BinarySumLogicalBroken} system, as its name suggests. Indeed, BinarySumLogicalFixed\textbf{BinarySumLogicalFixed} is complete and sound.

Proposition

The logical system BinarySumLogicalFixed\textbf{BinarySumLogicalFixed} is complete and sound.

Proof

It is straightforward to see that this logical system is sound. It suffices to observe that rule (R1b) allows us to prove statements like 1+1=1. This rule always adds more 1s to the left of = than to the right. Thus, in every theorem of the system the left-hand side of the equality will be greater than or equal to the right-hand side, matching the definition of the truth assignment (semantics).

Sketch. Soundness of (R1b) is immediate: it only adds ones on the left of =, which we interpret as ≥\geq. Completeness uses the same reduction to sums of ones as BinarySumLogical\textbf{BinarySumLogical}, then applies (R1b) enough times to make up the difference n−mn-m. The detailed argument is Proposition 4.18 below.

∎
Proposition4.18

The logical system BinarySumLogicalFixed\textbf{BinarySumLogicalFixed} is complete.

Proof

We use the result obtained in the previous proposition. Every true formula ϕ\phi has the form:

ϕ=N1+N2+...+Nk=M1+M2+...+Ml\phi=N_1\texttt{+}N_2\texttt{+}...\texttt{+}N_k\texttt{=}M_1\texttt{+}M_2\texttt{+}...\texttt{+}M_l

where each Ni,MjN_i, M_j is a binary number (matching 1(0|1)*\texttt{1(0|1)}^\texttt{*}) and the following holds:

N1+N2+...+Nk≥M1+M2+...+MlN_1+N_2+...+N_k\geq M_1+M_2+...+M_l

Denote both sides as nn and mm respectively:

n=N1+N2+...+Nk,m=M1+M2+...+Mln=N_1+N_2+...+N_k, \qquad m=M_1+M_2+...+M_l

Since n≥mn\geq m, there exists p≥0p\geq 0 such that n=m+pn=m+p. By the previous proposition:

ψ=1+...+1⏟p+1+...+1⏟m=1+...+1⏟m↦∗ϕ\psi=\underbrace{\texttt{1+...+1}}_{p}\texttt{+}\underbrace{\texttt{1+...+1}}_{m}\texttt{=}\underbrace{\texttt{1+...+1}}_{m}\xmapsto{*}\phi

It now suffices to observe that:

1=1⟼∗(1)1+...+1⏟m=1+...+1⏟m⟼∗(2)ψ↦∗ϕ\texttt{1=1}\underset{(1)}{\overset{*}{\longmapsto}}\underbrace{\texttt{1+...+1}}_{m}\texttt{=}\underbrace{\texttt{1+...+1}}_{m}\underset{(2)}{\overset{*}{\longmapsto}}\psi\xmapsto{*}\phi

where step (1)(1) applies rule (R1) m−1m-1 times and step (2)(2) applies rule (R1b) pp times.

∎

As a summary, we see in the following table the completeness and soundness of the systems presented (along with other information we will see later).

Sound Complete Decidable
BinarySumLogical\textbf{BinarySumLogical} (rules R1, R2, R3) yes yes yes
BinarySumLogicalBroken\textbf{BinarySumLogicalBroken} (rules R1, R1b, R2, R3) no yes yes
BinarySumLogicalRestricted\textbf{BinarySumLogicalRestricted} (rules R1, R2) yes no yes
BinarySumLogicalFixed\textbf{BinarySumLogicalFixed} (rules R1, R1b, R2, R3 and a different semantics) yes yes yes
Peano\textbf{Peano} assumed no no
Table 4.1. Soundness, completeness, and decidability of the logical systems in this chapter.

In addition to the properties of soundness and consistency, we can introduce a computational property: decidability. We already know what decidable means for a decision problem: that we can solve it with a program that always halts and has the correct output. For a logical system G\mathcal{G} we can define a decision problem, IsTrueG\textsc{IsTrue}_\mathcal{G}.

Problem4.19—IsTrueG_\mathcal{G}
  • Input: a formula ϕ\phi of G\mathcal{G}.
  • Output: yes if I(ϕ)\mathcal{I}(\phi) is well defined and I(ϕ)=true\mathcal{I}(\phi) = \text{true}, and no otherwise.

For each logical system G\mathcal{G} we obtain a different decision problem. Once this problem is defined, it is natural to define the decidability of a logical system through the decidability of the problem.

Definition4.20—Decidability of a logical system

We say that a logical system G\mathcal{G} is decidable if the decision problem IsTrueG\textsc{IsTrue}_\mathcal{G} is decidable.

Thus, a logical system is decidable if there exists a program that decides whether a formula is true or not. It is important to note that some authors define a system as decidable when the problem IsTheoremS\textsc{IsTheorem}_\mathcal{S} (which we define next) is decidable. As we have seen, truth and proof are different concepts, and we will always refer to truth when asking whether a logical system is decidable.

Problem4.21—IsTheoremS_\mathcal{S}
  • Input: a formula ϕ\phi of S\mathcal{S}.
  • Output: yes if ϕ\phi is a theorem of S\mathcal{S}, and no otherwise.

Let us see whether the logical systems we have introduced in this chapter are decidable. In the case of BinarySumLogical\textbf{BinarySumLogical}, it is straightforward to create a program capable of checking whether the inserted formulas are well formed, and of checking whether the arithmetic operation is correct. In fact, this program is implemented: it is the function is_true from binary_addition.py:

>>> from binary_addition import is_true
>>> is_true('BinarySumLogical', '1+1+1=11')
True
>>> is_true('BinarySumLogical', '11+1=10')
False

In the case of the remaining logical systems, creating programs that decide them is equally straightforward. The implementations of these programs are likewise in is_true. Below are more examples of running this function on the remaining logical systems.

>>> from binary_addition import is_true
>>> is_true('BinarySumLogical', '11=1+1')
False
>>> is_true('BinarySumLogicalBroken', '11=1+1')
False
>>> is_true('BinarySumLogicalRestricted', '11=1+1')
False
>>> is_true('BinarySumLogicalFixed', '11=1+1')
True

4.4 #Peano arithmetic

The logical systems we have explored are of little use. What we want is to work with logical systems that allow us to prove interesting results in mathematics. Mathematicians, logicians, and philosophers have studied many logical systems since the late 19th century, but two stand out for their importance: the Zermelo–Fraenkel axioms, of set theory, and Peano arithmetic, of number theory. In this section we focus on the latter, since Peano arithmetic contains formulas about integers, addition, multiplication, etc.

We call Peano\textbf{Peano} the logical system of Peano arithmetic. You can find the complete description of this system in Peano arithmetic. In Figure 4.22 you can find some details of that description.

Note4.22—Some details of Peano\textbf{Peano}

Peano arithmetic consists of logical symbols such as ∀\forall, ∃\exists, ∨\vee, ∧\wedge, ¬\neg, ==, ⇒\Rightarrow, and   ⟺  \iff. The axioms and inference rules of Peano\textbf{Peano} allow deducing properties of the natural numbers. These are represented from 00 via the successor function SS, so that 11 is S(0)S(0), 22 is S(S(0))S(S(0)), etc. In general, S(n)S(n) represents n+1n+1 for a natural n∈Nn \in \mathbb{N}.

The inference rules include classical logical formulas, such as modus ponens: given aa and a⇒ba \Rightarrow b, we can deduce bb.

In this system we can produce very interesting formulas about arithmetic. We see some of them below.

Example4.23—Peano formulas

Some formulas of Peano\textbf{Peano} (expressed in natural language):6

  1. (PF1) 1+1=21 + 1 = 2.
  2. (PF2) For every integer xx, x2+1>0x^2 + 1 > 0.
  3. (PF3) 22 and 55 are divisors of 3030.
  4. (PF4) 1313 is prime.
  5. (PF5) Let f(x)=x2+1f(x) = x^2 + 1. Then f3(0)=5f^3(0) = 5.7
  6. (PF6) If n>2n > 2, there are no positive integers x,y,zx, y, z such that xn+yn=znx^n + y^n = z^n (Fermat's Last Theorem).
  7. (PF7) Let f(x)=x+2f(x) = x + 2. Then, for every positive integer yy there exists a positive integer xx such that f(x)=yf(x) = y.

To work with Peano\textbf{Peano} in Python programs, we need to find a way to encode the various symbols, which we specify in Table 4.2.

Symbol Encoding Description
¬(p)\neg(p) NO (p) Negation
(p)∨(q)(p) \vee (q) (p) O (q) Disjunction
∀x:p\forall x : p FORALL (x) : (p) Universal quantifier
S(a)S(a) S(a) Successor
∃x:p\exists x : p EXISTS (x) : (p) Existential quantifier
(p)⇒(q)(p) \Rightarrow (q) (p) => (q) Implication
(p)  ⟺  (q)(p) \iff (q) (p) <=> (q) Biconditional
(p)=(q)(p) = (q) (p) = (q) Equality
Table 4.2. A way to translate the symbols of Peano arithmetic into strings.

For example, consider the statement "there do not exist integers xx and yy such that 2x=y2x = y and y=3y = 3", which can be represented in Peano\textbf{Peano} as ¬∃x,y:S(S(0))⋅x=y∧y=S(S(S(0)))\neg\exists x, y : S(S(0)) \cdot x = y \wedge y = S(S(S(0))) and admits the following string encoding:

NO EXISTE x,y : S(S(0))*x = y Y y = S(S(S(0)))

The formulas of Peano\textbf{Peano}, being from a logical system, can be true or false. In Example 4.23, the first six formulas (from (PF1) to (PF6)) are true,89 while the last one (formula (PF7)) is false.

To be able to prove whether a formula of Peano\textbf{Peano} is true, we need it to be closed: this occurs when all its variables are quantified by a "for all" (∀\forall) or an "exists" (∃\exists).10 An example is ∀x,y:x=y∧x+S(0)=y+S(0)\forall x,y : x = y \wedge x + S(0) = y + S(0), which is a closed formula since xx and yy are quantified, while x=y∧x+S(0)=y+S(0)x = y \wedge x + S(0) = y + S(0) is not a closed formula. This distinction is important because, if a formula is not closed, we cannot know whether it is true. We will only consider closed formulas in Peano\textbf{Peano} from here on.

Once we accept that Peano arithmetic can express mathematical statements like those in Example 4.23, we can continue to express the outputs of a program in Peano\textbf{Peano}. The following proposition shows how to do this for a concrete set of formulas about the programs we will need later.11

Proposition4.24

Let PP be a computer program (or a Turing machine).12 The statement HH given by

"PP halts on the empty input"

can be translated into an equivalent formula ϕH\phi_H in Peano\textbf{Peano}. (Here, by "equivalent" we mean that HH is true if and only if ϕH\phi_H is true.)

Proof

We sketch the proof, since carrying it out with strict rigor would be long and tedious.

In this case, it is simpler to prove this via Turing machines. Recall that we can define each moment of the machine's execution by a configuration. In the case of a single-tape Turing machine, we can easily encode any configuration: we can use an encoding similar to that specified in Proposition 2.21, adding the character ^ to indicate the head position. As an example, an encoding of a configuration from Example 2.11 is specified below:

qR  :  X X X X a        ⟶        q_R : X X ˆX X aq_R\;:\;X\:X\:\boxed{X}\:X\:a \;\;\;\; \longrightarrow \;\;\;\; \texttt{q\_R : X X \^{}X X a}

Likewise, we can encode strings as numbers in a binary string (a word over the alphabet {0,1}\{\texttt{0}, \texttt{1}\}). Thus, it is reasonable to assume that the configuration of a Turing machine can be represented by a number as a binary string. The transition function of the Turing machine takes one of these configurations in binary as input string, and outputs the new configuration, encoded in the same way. From this point of view, the transition function is a function from integers to integers. We call this function Step\text{Step}, since evaluating this function once is equivalent to one step of computation on the Turing machine. Note that the function Step\text{Step} can be written using Peano arithmetic: it is nothing more than a simple function that depends on a few bits of input.

Suppose c0c_0 is the integer representing the initial configuration of the machine. After one step of computation, the configuration of the machine will be Step(c0)\text{Step}(c_0), and after two steps, Step(Step(c0))\text{Step}(\text{Step}(c_0)). We can abbreviate this as Step2(c0)\text{Step}^2(c_0). After nn steps, the configuration of the machine will be Stepn(c0)\text{Step}^n(c_0). It is important to emphasize that each of the configurations can be expressed using Peano arithmetic.

On the other hand, it is evident that the statement

"PP halts on the empty input"

is equivalent to

"There exists a natural nn such that Stepn(c0)\text{Step}^n(c_0) is a halting configuration"

By halting configuration we mean that the Turing machine cannot continue executing transitions: it has halted. Checking this is also straightforward. We write a function Halted\text{Halted} that takes an integer mm as input and outputs 00 or 11. Halted(m)=1\text{Halted}(m) = 1 if configuration mm is a halting configuration, and Halted(m)=0\text{Halted}(m) = 0 otherwise.

Writing this function in Peano\textbf{Peano} is not difficult either: already in Definition 2.7 we said that a machine halts if there is no transition defined for the configuration it is in. It is evident that we can translate this statement into a formula of Peano arithmetic.

Thus, we have proved that Halted(Stepn(c0))\text{Halted}(\text{Step}^n(c_0)) is a formula of Peano\textbf{Peano} for a natural n∈Nn \in \mathbb{N} and a binary c0c_0. Therefore, the statement:

"There exists a natural nn such that Halted(Stepn(c0))=1\text{Halted}(\text{Step}^n(c_0)) = 1"

can also be translated into a formula of Peano\textbf{Peano}. This statement is equivalent to the previous ones, and this formula is precisely the ϕH\phi_H we seek.

∎

From the previous proof, it is evident that the construction of ϕH\phi_H from HH is carried out in a completely algorithmic way, which could in principle be implemented by a Python program. Let such a program be halting_to_peano.py. The code for this work does not provide a program that implements this, since doing so is a complex task.13 However, in the rest of this chapter, we will import the main function halting_to_peano when necessary.

We will next define two important decision problems: IsPeanoTheorem and IsPeanoTrue.14

Problem4.25—IsPeanoTheorem
  • Input: a formula ϕ\phi of Peano\textbf{Peano}.
  • Output: yes if ϕ\phi is a well-formed, closed formula in Peano\textbf{Peano} and is a theorem of Peano\textbf{Peano}; no otherwise.
Problem4.26—IsPeanoTrue
  • Input: a formula ϕ\phi of Peano\textbf{Peano}.
  • Output: yes if ϕ\phi is a well-formed, closed, and true formula of Peano\textbf{Peano}; no otherwise.

Given a statement ϕ\phi in Peano\textbf{Peano}, the above problems ask whether ϕ\phi is provable and/or true. It turns out that both problems are undecidable. The undecidability of IsPeanoTrue tells us, via Definition 4.20, that Peano\textbf{Peano} is not decidable (as we already anticipated in Table 4.1).11

Proposition4.27

Peano\textbf{Peano} is undecidable.

Proof

We proceed by the reduction HaltsOnEmpty\textsc{HaltsOnEmpty} (Problem 3.25) ≤TIsPeanoTrue\leq_T \textsc{IsPeanoTrue}.

We prove that this reduction is implemented in Program 4.1. The main function has as input a program PP. Using Proposition 4.24, we convert the statement H=“P halts on the empty input”H = \text{``P halts on the empty input''} into an equivalent formula ϕH\phi_H in Peano arithmetic. It is important to note that halting_to_peano is a computable function, as we commented earlier. Clearly, PP halts if and only if ϕH\phi_H is true, which proves the reduction. The result follows from Proposition 3.22.

∎
from is_true_peano import is_true_peano  # oracle
from halting_to_peano import halting_to_peano          # NOT an oracle
 
def halting_on_empty_to_is_true_peano(program):
halts_in_peano = halting_to_peano(program)
return is_true_peano(halts_in_peano)
Proposition4.28

IsPeanoTheorem is undecidable.

Proof

Similarly to Proposition 4.27, we use the reduction HaltsOnEmpty≤TIsPeanoTheorem\textsc{HaltsOnEmpty} \leq_T \textsc{IsPeanoTheorem}.

Before this, we must appreciate a property of statements of the form "PP halts on the empty input". Let us call such a statement H(P)H(P),15 and we will show that for any program PP, if ϕH(P)\phi_{H(P)} is true in Peano\textbf{Peano}, then it is a theorem in Peano\textbf{Peano}. It is important to note that this is not the case for all formulas (if it were, Peano\textbf{Peano} would be complete).

The reason this holds precisely for formulas ϕH(P)\phi_{H(P)} is because we simply need to simulate PP until it halts, something we can define using Peano arithmetic: we simply compute Halted(Stepn(c0))\text{Halted}(\text{Step}^n(c_0)) for each n∈Nn \in \mathbb{N} incrementally, until the result is 11.

We can now perform the reduction using Program 4.1, replacing is_true_peano with is_theorem_peano. As true formulas of the type ϕH(P)\phi_{H(P)} are theorems, the reduction is correct.

∎

The case of IsPeanoTheorem is less severe, since the problem is in fact semi-decidable (see Definition 3.20). This means we can write a program that checks whether a formula is a theorem (if the formula is not a theorem, the program need not halt).11

Proposition4.29

IsPeanoTheorem is semi-decidable.

Proof

It is easy to see that Program 4.2 makes IsPeanoTheorem semi-decidable. The idea is to iterate over all possible strings until we see whether one of them is a proof of the input formula.

We import the function is_proof_peano, which given a formula and a proof in Peano\textbf{Peano} checks whether the proof proves that the formula is a theorem. Clearly, this function is not an oracle. In fact, its implementation is straightforward: it suffices to check whether each formula in the proof is an axiom or follows from earlier formulas through the inference rules of the system, checking that the last formula matches the formula we want to prove.

In the loop we iterate over all strings to see whether they are a proof of formula. These strings are enumerated in shortlex order: first all strings of length 11 are enumerated in lexicographic order, then those of length 22, etc. This ordering is provided by the function next_string from utilities.

If formula is a theorem, its proof will eventually be found and the program will return yes. Otherwise, the program will not halt, but this is not a problem, since we intend to show the semi-decidability of the problem, which does not require the program to halt for negative instances.

∎
Program4.2—is_theorem_peano.py
import utilities
from is_proof_peano import is_proof_peano  # NOT an oracle
 
def is_theorem_peano(formula):
proof = ''
 
while True:
if is_proof_peano(proof, formula) == 'yes':
return 'yes'
proof = utilities.next_string(proof)

The fact that IsPeanoTheorem is semi-decidable is extremely important, and is due to a syntactic property of Peano\textbf{Peano}: it is recursively axiomatizable.

Definition4.30—Recursively axiomatizable

A formal system S\mathcal{S} is recursively axiomatizable if its axioms are recursively enumerable, that is, if there exists a program that enumerates its axioms.16

Saying that a logical system G\mathcal{G} is recursively axiomatizable is nothing more than saying that the problem IsTheoremG\textsc{IsTheorem}_\mathcal{G} is semi-decidable. This property is fundamental for the proof we will carry out of the First Incompleteness Theorem (Theorem 5.2), since if Peano\textbf{Peano} were not recursively axiomatizable, we could not use the function is_theorem_peano.

The problem IsTheorem bears a strong relation to the Entscheidungsproblem (see Chapter 1). This problem seeks to find a general algorithm that, given a mathematical statement, determines whether it is a theorem. By Proposition 4.28, IsPeanoTheorem is undecidable, which proves the Entscheidungsproblem in the particular case of Peano arithmetic. The argument we have carried out is similar to the one Turing made in 17.

Finally, since Peano\textbf{Peano} is a logical system, we can ask about its soundness and completeness. The question of whether Peano\textbf{Peano} is complete is the central object of this work, and will be treated in Chapter 5.

Asking about the soundness of Peano\textbf{Peano} is a complex question. In this work, we assume its soundness, since it is reasonable that the theorems of Peano\textbf{Peano} are true.18

4.5 #Syntactic completeness and consistency

Logic books are extremely inconsistent19 in defining properties of logical systems (even in defining what a formal system and a logical system are). So far, we have defined the properties of soundness, (semantic) completeness, and decidability. There is another definition of completeness that depends only on syntax, and is therefore applicable to formal systems.20

Definition4.31—Syntactic completeness

Let S\mathcal{S} be a formal system. Whenever possible,21 we say that S\mathcal{S} is syntactically complete if, for every formula ϕ\phi of S\mathcal{S}, either ϕ\phi or ¬ϕ\neg\phi is a theorem.22

For this definition, the formal language must include a well-defined notion of negation (¬\neg). This is the case in first-order theories such as Peano arithmetic and Zermelo–Fraenkel set theory, but negation is also available in other logical languages.

For this class of systems it is also possible to define a new property: consistency. Again, we can define two types of consistency, a syntactic one and a semantic one.

Definition4.32—Syntactic consistency

Let S\mathcal{S} be a formal system. Whenever possible, we say that S\mathcal{S} is syntactically consistent if, for every formula ϕ\phi of S\mathcal{S}, it is not possible that both ϕ\phi and ¬ϕ\neg\phi are theorems.

Definition4.33—Semantic consistency

Let G\mathcal{G} be a logical system. Whenever possible, we say that G\mathcal{G} is semantically consistent if, for every formula ϕ\phi of G\mathcal{G}, it is not possible that both ϕ\phi and ¬ϕ\neg\phi are true.

In other words, a system is consistent if it does not give rise to contradictory proofs or truths. In a sound and complete system, a formula is syntactically consistent if and only if it is semantically consistent.

It is important to make an observation regarding the definitions of syntactic completeness and consistency: although we defined them for formal systems, it is straightforward to extend this definition to logical systems, taking into account their syntax.

Thus, we say that a logical system G\mathcal{G} is syntactically complete if, given a formula ϕ\phi of G\mathcal{G}, ϕ\phi or ¬ϕ\neg\phi are theorems. Analogously, G\mathcal{G} is syntactically consistent if it is not possible that both ϕ\phi and ¬ϕ\neg\phi are theorems.

The definitions we have made so far (not including that of decidability) are summarized in Figure 4.34.

Note4.34—Properties of logical systems defined in this chapter

Let G\mathcal{G} be a logical system and ϕ\phi a formula of G\mathcal{G}.

G sound      :      ϕ theorem⇒ϕ true\mathcal{G}\text{ sound} \;\;\;:\;\;\; \phi\text{ theorem}\Rightarrow\phi\text{ true}

(Definition 4.12)

G (semantically) complete      :      ϕ true⇒ϕ theorem\mathcal{G}\text{ (semantically) complete} \;\;\;:\;\;\; \phi\text{ true}\Rightarrow\phi\text{ theorem}

(Definition 4.13)

G syntactically complete*      :      ϕ or ¬ϕ are theorems\mathcal{G}\text{ syntactically complete*} \;\;\;:\;\;\; \phi\text{ or }\neg\phi\text{ are theorems}

(Definition 4.31)

G syntactically consistent*      :      ϕ and ¬ϕ are not both theorems\mathcal{G}\text{ syntactically consistent*} \;\;\;:\;\;\; \phi\text{ and }\neg\phi\text{ are not both theorems}

(Definition 4.32)

G semantically consistent      :      ϕ and ¬ϕ are not both true\mathcal{G}\text{ semantically consistent} \;\;\;:\;\;\; \phi\text{ and }\neg\phi\text{ are not both true}

(Definition 4.33)

*definition also applicable to formal systems

Footnotes

  1. Vinnikov, V. (1999). We shall know: Hilbert's apology. Mathematical Intelligencer, 21(1):42–46.

    ↩
  2. Whenever we speak of formulas we mean well-formed formulas.

    ↩
  3. Here the symbol + is a literal, not the operator ++.

    ↩
  4. When a formula is not well defined or does not have a defined interpretation, we can assume it is false.

    ↩
  5. Later we introduce the notion of syntactic completeness (Definition 4.31). Whenever we call a system complete without specifying, we refer to its semantic completeness.

    ↩
  6. They can be translated straightforwardly to Peano arithmetic. For example, (PF2) is ∀x:x2+1>0\forall x : x^2+1>0, and (PF6) is ∀n>2:¬∃x,y,z>0:xn+yn=zn\forall n>2 : \neg\exists x,y,z>0 : x^n+y^n=z^n. Although comparison and exponentiation operations are not initially defined in Peano\textbf{Peano}, we can define them via formulas of the system.

    ↩
  7. f3f^3 means iterating ff three times: f3(x)=f(f(f(x)))f^3(x)=f(f(f(x))).

    ↩
  8. Fermat's Last Theorem has special historical relevance: it was formulated in 1637 and was not resolved until 1995 by Andrew Wiles.

    ↩
  9. Wiles, A. (1995). Modular elliptic curves and Fermat's Last Theorem. Annals of Mathematics, 141(3):443–551.

    ↩
  10. Recall that in Definition 4.6 we said that the truth assignment may be defined for a subset of the formulas.

    ↩
  11. MacCormick, J. (2018). What Can Be Computed? Princeton University Press.

    ↩ ↩2 ↩3
  12. We prove the equivalence in the Theorem 2.23.

    ↩
  13. Henderson, J. (2013). Gödel's First Incompleteness Theorem in Python. https://github.com/johnyf/godel_py

    ↩
  14. Note that IsPeanoTheorem=IsTheoremPeano\textsc{IsPeanoTheorem} = \textsc{IsTheorem}_{\textbf{Peano}} and IsPeanoTrue=IsTruePeano\textsc{IsPeanoTrue} = \textsc{IsTrue}_{\textbf{Peano}} (see Problem 4.21 and Problem 4.19).

    ↩
  15. We use HH from English halting.

    ↩
  16. If S\mathcal{S} is infinite, the program will run forever.

    ↩
  17. Turing, A.M. (1937). On computable numbers, with an application to the Entscheidungsproblem. Proceedings of the London Mathematical Society, 42(1):230–265.

    ↩
  18. You can see those axioms in Peano arithmetic.

    ↩
  19. Note the irony.

    ↩
  20. Kleene, S.C. (1971). Introduction to Metamathematics. North-Holland.

    ↩
  21. That is, that the notion of negation (¬\neg) is well defined in the formal system.

    ↩
  22. It is possible that both ϕ\phi and ¬ϕ\neg\phi are theorems.

    ↩