title | filename | chapternum |
---|---|---|
Is every theorem provable? |
lec_09_godel |
11 |
- More examples of uncomputable functions that are not as tied to computation.
- Gödel's incompleteness theorem - a result that shook the world of mathematics in the early 20th century.
"Take any definite unsolved problem, such as ... the existence of an infinite number of prime numbers of the form $2^n + 1$. However unapproachable these problems may seem to us and however helpless we stand before them, we have, nevertheless, the firm conviction that their solution must follow by a finite number of purely logical processes..."
"...This conviction of the solvability of every mathematical problem is a powerful incentive to the worker. We hear within us the perpetual call: There is the problem. Seek its solution. You can find it by pure reason, for in mathematics there is no ignorabimus.", David Hilbert, 1900.
"The meaning of a statement is its method of verification.", Moritz Schlick, 1938 (aka "The verification principle" of logical positivism)
The problems shown uncomputable in chapcomputable{.ref}, while natural and important, still intimately involved NAND-TM programs or other computing mechanisms in their definitions. One could perhaps hope that as long as we steer clear of functions whose inputs are themselves programs, we can avoid the "curse of uncomputability". Alas, we have no such luck.
In this chapter we will see an example of a natural and seemingly "computation free" problem that nevertheless turns out to be uncomputable: solving Diophantine equations. As a corollary, we will see one of the most striking results of 20th century mathematics: Gödel's Incompleteness Theorem, which showed that there are some mathematical statements (in fact, in number theory) that are inherently unprovable. We will actually start with the latter result, and then show the former.
::: {.nonmath} The marquee result of this chapter is Gödel's Incompleteness Theorem, which states that for every proof system, there are some statements about arithmetic that are true but unprovable in this system. But more than that we will see a deep connection between uncomputability and unprovability. For example, the uncomputability of the Halting problem immediately gives rise to the existence of unprovable statements about Turing machines. To even state Gödel's Incompleteness Theorem we will need to formally define the notion of a "proof system". We give a very general definition, that encompasses all types of "axioms + inference rules" systems using in logic and math. We will then build up the machinery to encode computation using arithmetic that will enable us to prove Gödel's Theorem. :::
"And what are these …vanishing increments? They are neither finite quantities, nor quantities infinitely small, nor yet nothing. May we not call them the ghosts of departed quantities?", George Berkeley, Bishop of Cloyne, 1734.
The 1700's and 1800's were a time of great discoveries in mathematics but also of several crises.
The discovery of calculus by Newton and Leibnitz in the late 1600's ushered a golden age of problem solving.
Many longstanding challenges succumbed to the new tools that were discovered, and mathematicians got ever better at doing some truly impressive calculations.
However, the rigorous foundations behind these calculations left much to be desired.
Mathematicians manipulated infinitesimal quantities and infinite series cavalierly, and while most of the time they ended up with the correct results, there were a few strange examples (such as trying to calculate the value of the infinite series
In the beginning of the 20th century, there was an effort to replicate this effort, in greater rigor, to all parts of mathematics. The hope was to show that all the true results of mathematics can be obtained by starting with a number of axioms, and deriving theorems from them using logical rules of inference. This effort was known as the Hilbert program, named after the influential mathematician David Hilbert.
Alas, it turns out the results we've seen dealt a devastating blow to this program, as was shown by Kurt Gödel in 1931:
For every sound proof system
Before proving godethminformal{.ref}, we need to define "proof systems" and even formally define the notion of a "mathematical statement". In geometry and other areas of mathematics, proof systems are often defined by starting with some basic assumptions or axioms and then deriving more statements by using inference rules such as the famous Modus Ponens, but what axioms shall we use? What rules? We will use an extremely general notion of proof systems, not even restricting ourselves to ones that have the form of axioms and inference.
Mathematical statements. At the highest level, a mathematical statement is simply a piece of text, which we can think of as a string
"The number $2$,$696$,$635$,$869$,$504$,$783$,$333$,$238$,$805$,$675$,$613$, $588$,$278$,$597$,$832$,$162$,$617$,$892$,$474$,$670$,$798$,$113$ is prime".
Mathematical statements do not have to involve numbers. They can assert properties of any other mathematical object including sets, strings, functions, graphs and yes, even programs. Thus, another example of a mathematical statement is the following:^[It is unknown whether this statement is true or false.]
::: {.quote}
The following Python function halts on every positive integer n
def f(n):
if n==1: return 1
return f(3*n+1) if n % 2 else f(n//2)
::: \
Proof systems. A proof for a statement $x\in {0,1}^$ is another piece of text $w\in {0,1}^$ that certifies the truth of the statement asserted in
-
(Effectiveness) Given a statement
$x$ and a proof$w$ , there is an algorithm to verify whether or not$w$ is a valid proof for$x$ . (For example, by going line by line and checking that each line follows from the preceding ones using one of the allowed inference rules.) -
(Soundness) If there is a valid proof
$w$ for$x$ then$x$ is true.
These are quite minimal requirements for a proof system.
Requirement 2 (soundness) is the very definition of a proof system: you shouldn't be able to prove things that are not true. Requirement 1 is also essential. If there is no set of rules (i.e., an algorithm) to check that a proof is valid then in what sense is it a proof system? We could replace it with a system where the "proof" for a statement
We formally define proof systems as an algorithm 4=2+2
) but if
::: {.definition title="Proof systems" #proofsystemsdef}
Let
-
(Effectiveness) For every
$x,w \in {0,1}^*$ ,$V(x,w)$ halts with an output of either$0$ or$1$ . -
(Soundness) For every
$x\not\in \mathcal{T}$ and$w\in {0,1}^*$ ,$V(x,w)=0$ .
A true statement
::: { .bigidea #proofsystems} A proof is just a string of text whose meaning is given by a verification algorithm. :::
Our first formalization of godethminformal{.ref} involves statements about Turing machines.
We let
::: {.theorem title="Gödel's Incompleteness Theorem: computational variant" #godethmtakeone}
There does not exist a complete proof system for
If we had such a complete and sound proof system then we could solve the
::: {.proof data-ref="godethmtakeone"}
Assume for the sake of contradiction that there was such a proof system
INPUT: Turing machine $M$
OUTPUT: $1$ $M$ -if halts on the input $0$; $0$ otherwise.
for{$n=1,2,3,\ldots$}
for{$w\in \{0,1\}^n$}
if{$V(\text{"$M$ halts on $0$"},w)=1$}
return $1$
endif
if{$V(\text{"$M$ does not halt on $0$"},w)=1$}
return $0$
endif
endfor
endfor
If
::: {.remark title="The Gödel statement (optional)" #godelstmtrem}
One can extract from the proof of godethmtakeone{.ref} a procedure that for every proof system
One can see that if $x^$ is true, then it does not have a proof, but if it is false then (assuming the proof system is sound) then it cannot have a proof, and hence $x^$ must be both true and unprovable.
One might wonder how is it possible to come up with an $x^$ that satisfies a condition such as godeleq{.eqref} where the same string $x^$ appears on both the right-hand side and the left-hand side of the equation.
The idea is that the proof of godethmtakeone{.ref} yields a way to transform every statement
The following sentence repeated twice, the second time in quotes, is not provable in the formal system
$V$ . "The following sentence repeated twice, the second time in quotes, is not provable in the formal system$V$ ."
In the argument above we actually showed that $x^$ is true, under the assumption that $V$ is sound. Since $x^$ is true and does not have a proof in
There is something "unsatisfying" about godethmtakeone{.ref}.
Sure, it shows there are statements that are unprovable, but they don't feel like "real" statements about math.
After all, they talk about programs rather than numbers, matrices, or derivatives, or whatever it is they teach in math courses.
It turns out that we can get an analogous result for statements such as "there are no positive integers
To make this more precise, let us define the notion of quantified integer statements:
A quantified integer statement is a well-formed statement with no unbound variables involving integers, variables, the operators
We often care deeply about determining the truth of quantified integer statements.
For example, the statement that Fermat's Last Theorem is true for
The twin prime conjecture, that states that there is an infinite number of numbers
The claim (mentioned in Hilbert's quote above) that are infinitely many primes of the form
$$
\begin{gathered}
\forall_{n\in\N}\exists_{p\in\N} (p>n) \wedge PRIME(p) \wedge \
\left(\forall_{k\in\N} (k \neq 2 ; \wedge ; PRIME(k)) \Rightarrow \neg DIVIDES(k,p-1)\right)
\end{gathered}
\label{eqinfprimespowertwoplusone}
$$
where
::: {.remark title="Syntactic sugar for quantified integer statements" #synsugarqisrem}
To make our statements more readable, we often use syntactic sugar and so write
Much of number theory is concerned with determining the truth of quantified integer statements. Since our experience has been that, given enough time (which could sometimes be several centuries) humanity has managed to do so for the statements that it cared enough about, one could (as Hilbert did) hope that eventually we would be able to prove or disprove all such statements. Alas, this turns out to be impossible:
::: {.theorem title="Gödel's Incompleteness Theorem for quantified integer statements" #godelthmqis}
Let
-
$V$ is not sound: There exists a false statement
$x$ and a string$w\in {0,1}^*$ such that$V(x,w)=1$ .
or
-
$V$ is not complete: There exists a true statement
$x$ such that for every$w\in {0,1}^*$ ,$V(x,w)=0$ . :::
godelthmqis{.ref} is a direct corollary of the following result, just as godethmtakeone{.ref} was a direct corollary of the uncomputability of
Let
Since a quantified integer statement is simply a sequence of symbols, we can easily represent it as a string. For simplicity we will assume that every string represents some quantified integer statement, by mapping strings that do not correspond to such a statement to an arbitrary statement such as
::: { .pause }
Please stop here and make sure you understand why the uncomputability of
In the rest of this chapter, we will show the proof of godelthmqis{.ref}, following the outline illustrated in godelstructurefig{.ref}.
Many of the functions people wanted to compute over the years involved solving equations.
These have a much longer history than mechanical computers.
The Babylonians already knew how to solve some quadratic equations in 2000BC, and the formula for all quadratics appears in the Bakhshali Manuscript that was composed in India around the 3rd century.
During the Renaissance, Italian mathematicians discovered generalization of these formulas for cubic and quartic (degrees
However, the fact that there is no closed-form formula does not mean we can not solve such equations. People have been solving higher degree equations numerically for ages. The Chinese manuscript Jiuzhang Suanshu from the first century mentions such approaches. Solving polynomial equations is by no means restricted only to ancient history or to students' homework. The gradient descent method is the workhorse powering many of the machine learning tools that have revolutionized Computer Science over the last several years.
But there are some equations that we simply do not know how to solve by any means.
For example, it took more than 200 years until people succeeded in proving that the equation
Alas, this turned out not to be the case for Diophantine equations. In 1970, Yuri Matiyasevich, building on a decades long line of work by Martin Davis, Hilary Putnam and Julia Robinson, showed that there is simply no method to solve such equations in general:
::: {.theorem title="MRDP Theorem" #MRDP-thm}
Let
Then
As usual, we assume some standard way to express numbers and text as binary strings. The constant
::: {.remark title="Active code vs static data" #codevsstaticrem} The difficulty in finding a way to distinguish between "code" such as NAND-TM programs, and "static content" such as polynomials is just another manifestation of the phenomenon that code is the same as data. While a fool-proof solution for distinguishing between the two is inherently impossible, finding heuristics that do a reasonable job keeps many firewall and anti-virus manufacturers very busy (and finding ways to bypass these tools keeps many hackers busy as well). :::
We will not prove the MRDP Theorem (MRDP-thm{.ref}).
However, as we mentioned, we will prove the uncomputability of
::: { .pause } If you find the last sentence confusing, it is worthwhile to reread it until you are sure you follow its logic. We are so accustomed to trying to find solutions for problems that it can sometimes be hard to follow the arguments for showing that problems are uncomputable. :::
Our proof of the uncomputability of
-
We will first use a reduction from the Halting problem to show that deciding the truth of quantified mixed statements is uncomputable. Quantified mixed statements involve both strings and integers. Since quantified mixed statements are a more general concept than quantified integer statements, it is easier to prove the uncomputability of deciding their truth.
-
We will then reduce the problem of quantified mixed statements to quantifier integer statements.
We define quantified mixed statements as statements involving not just integers and the usual arithmetic operators, but also string variables as well.
::: {.definition title="Quantified mixed statements" #QMS-def}
A quantified mixed statement is a well-formed statement with no unbound variables involving integers, variables, the operators
For example, the true statement that for every string
Quantified mixed statements are more general than quantified integer statements, and so the following theorem is potentially easier to prove than QIS-thm{.ref}:
Let
The idea behind the proof is similar to that used in showing that one-dimensional cellular automata are Turing complete (onedimcathm{.ref}) as well as showing that equivalence (or even "fullness") of context free grammars is uncomputable (fullnesscfgdef{.ref}).
We use the notion of a configuration of a NAND-TM program as in configtmdef{.ref}.
Such a configuration can be thought of as a string i
.
It can be shown that if i
.
In particular, every value
::: {.proof data-ref="QMS-thm"} The proof is obtained by a reduction from the Halting problem. Specifically, we will use the notion of a configuration of a Turing machines (configtmdef{.ref}) that we have seen in the context of proving that one dimensional cellular automata are Turing complete. We need the following facts about configurations:
-
For every Turing machine
$M$ , there is a finite alphabet$\Sigma$ , and a configuration of$M$ is a string$\alpha \in \Sigma^*$ . -
A configuration
$\alpha$ encodes all the state of the program at a particular iteration, including the array, scalar, and index variables. -
If
$\alpha$ is a configuration, then$\beta = NEXT_P(\alpha)$ denotes the configuration of the computation after one more iteration.$\beta$ is a string over$\Sigma$ of length either$|\alpha|$ or$|\alpha|+1$ , and every coordinate of$\beta$ is a function of just three coordinates in$\alpha$ . That is, for every$j\in {0,\ldots,|\beta|-1}$ ,$\beta_j = MAP_P(\alpha_{j-1},\alpha_j,\alpha_{j+1})$ where$MAP_P:\Sigma^3 \rightarrow \Sigma$ is some function depending on$P$ . -
There are simple conditions to check whether a string
$\alpha$ is a valid starting configuration corresponding to an input$x$ , as well as to check whether a string$\alpha$ is a halting configuration. In particular these conditions can be phrased as quantified mixed statements. -
A program
$M$ halts on input$x$ if and only if there exists a sequence of configurations$H = (\alpha^0,\alpha^1,\ldots,\alpha^{T-1})$ such that (i)$\alpha^0$ is a valid starting configuration of$M$ with input$x$ , (ii)$\alpha^{T-1}$ is a valid halting configuration of$P$ , and (iii)$\alpha^{i+1} = NEXT_P(\alpha^i)$ for every$i\in {0,\ldots,T-2}$ .
We can encode such a sequence
If we can encode the statement
-
Let
$\alpha,\beta \in {0,1}^*$ be two strings that encode configurations of$M$ . We can define a quantified mixed predicate$NEXT(\alpha,\beta)$ that is true if and only if$\beta = NEXT_M(\beta)$ (i.e.,$\beta$ encodes the configuration obtained by proceeding from$\alpha$ in one computational step). Indeed$NEXT(\alpha,\beta)$ is true if for every$i \in {0,\ldots,|\beta|}$ which is a multiple of$\ell$ ,$\beta_{i,\ldots,i+\ell-1} = MAP_M(\alpha_{i-\ell,\cdots,i+2\ell-1})$ where$MAP_M:{0,1}^{3\ell} \rightarrow {0,1}^\ell$ is the finite function above (identifying elements of$\Sigma$ with their encoding in${0,1}^\ell$ ). Since$MAP_M$ is a finite function, we can express it using the logical operations$AND$ ,$OR$,$NOT$ (for example by computing$MAP_M$ with$NAND$ 's). -
Using the above we can now write the condition that for every substring of
$H$ that has the form$\alpha ENC(;) \beta$ with$\alpha,\beta \in {0,1}^\ell$ and$ENC(;)$ being the encoding of the separator "$;$", it holds that$NEXT(\alpha,\beta)$ is true. -
Finally, if
$\alpha^0$ is a binary string encoding the initial configuration of$M$ on input$0$ , checking that the first$|\alpha^0|$ bits of$H$ equal$\alpha_0$ can be expressed using$AND$ ,$OR$, and$NOT$ 's. Similarly checking that the last configuration encoded by$H$ corresponds to a state in which$M$ will halt can also be expressed as a quantified statement.
Together the above yields a computable procedure that maps every Turing machine
::: {.remark title="Alternative proofs" #alternativeproofs}
There are several other ways to show that
We now show how to prove QIS-thm{.ref} using QMS-thm{.ref}.
The idea is again a proof by reduction.
We will show a transformation of every quantifier mixed statement
To remove string-valued variables from a statement, we encode every string by a pair integer.
We will show that we can encode a string
-
$n=|x|$ -
There is a quantified integer statement
$COORD(X,i)$ that for every$i<n$ , will be true if$x_i=1$ and will be false otherwise.
This will mean that we can replace a "for all" quantifier over strings such as $\forall_{x\in {0,1}^}$ with a pair of quantifiers over integers of the form $\forall_{X\in \N}\forall_{n\in\N}$ (and similarly replace an existential quantifier of the form $\exists_{x\in {0,1}^}$ with a pair of quantifiers
The above shows that proof of QIS-thm{.ref} all boils down to finding the right encoding of strings as integers, and the right way to implement
There is a sequence of prime numbers
Using primeseq{.ref} we can encode a $x\in{0,1}^$ by the numbers $(X,n)$ where $X = \prod_{x_i=1} p_i$ and $n=|x|$.
We can then define the statement $COORD(X,i)$ as
$$
COORD(X,i) = \exists_{p\in\N} PSEQ(p,i) \wedge DIVIDES(p,X)
$$
where $DIVIDES(a,b)$, as before, is defined as $\exists_{c\in\N} a\times c = b$.
Note that indeed if $X,n$ encodes the string $x\in {0,1}^$, then for every
Thus all that is left to conclude the proof of QIS-thm{.ref} is to prove primeseq{.ref}, which we now proceed to do.
::: {.proof data-ref="primeseq"}
The sequence of prime numbers we consider is the following:
We fix
To sum up we have shown that for every quantified mixed statement
- Uncomputable functions include also functions that seem to have nothing to do with NAND-TM programs or other computational models such as determining the satisfiability of Diophantine equations.
- This also implies that for any sound proof system (and in particular every finite axiomatic system)
$S$ , there are interesting statements$X$ (namely of the form "$F(x)=0$" for an uncomputable function$F$ ) such that$S$ is not able to prove either$X$ or its negation.
::: {.exercise title="Gödel's Theorem from uncomputability of
::: {.exercise title="Proof systems and uncomputability" #proofsanduncomputex }
Let
-
Prove that
$FINDPROOF$ is uncomputable. -
Prove that there exists a Turing machine
$V$ such that$V$ halts on every input $x,v$ but the function$FINDPROOF_V$ defined as$FINDPROOF_V(x) = FINDPROOF(V,x)$ is uncomputable. See footnote for hint.^[Hint: think of$x$ as saying "Turing machine$M$ halts on input$u$ " and$w$ being a proof that is the number of steps that it will take for this to happen. Can you find an always-halting$V$ that will verify such statements?] :::
Let
For every representation of logical statements as strings, we can define an axiomatic proof system to consist of a finite set of strings
::: {.exercise title="Post Corrrespondence Problem" #postcorrespondenceproblemex}
In the Post Correspondence Problem the input is a set
Use this fact to provide a direct proof that
::: {.exercise title="Uncomputability of puzzle" #puzzleex}
Let
-
Prove that
$PUZZLE$ is uncomputable. -
Give a reduction from
$PUZZLE$ to$QMS$ . :::
::: {.exercise title="MRDP exercise" #MRDPexe}
The MRDP theorem states that the problem of determining, given a
Use the MRDP Theorem to prove that this problem is uncomputable. That is, show that the function
::: {.exercise title="The Busy Beaver problem" #buseybeaverex} In this question we define the NAND-TM variant of the busy beaver function.
-
We define the function
$T:{0,1}^* \rightarrow \mathbb{N}$ as follows: for every string$P\in {0,1}^*$ , if$P$ represents a NAND-TM program such that when$P$ is executed on the input$0$ (i.e., the string of length 1 that is simply$0$ ), a total of$M$ lines are executed before the program halts, then$T(P)=M$ . Otherwise (if$P$ does not represent a NAND-TM program, or it is a program that does not halt on$0$ ),$T(P)=0$ . Prove that$T$ is uncomputable. -
Let
$TOWER(n)$ denote the number $\underbrace{2^{2^{2^{{\iddots}^2}}}}{n\text{ times}}$ (that is, a "tower of powers of two" of height $n$). To get a sense of how fast this function grows, $TOWER(1)=2$, $TOWER(2)=2^2=4$, $TOWER(3)=2^{2^2}=16$, $TOWER(4) = 2^{16} = 65536$ and $TOWER(5) = 2^{65536}$ which is about $10^{20000}$. $TOWER(6)$ is already a number that is too big to write even in scientific notation. Define $NBB:\mathbb{N} \rightarrow \mathbb{N}$ (for "NAND-TM Busy Beaver") to be the function $NBB(n) = \max{P\in {0,1}^n} T(P)$ where$T:\mathbb{N} \rightarrow \mathbb{N}$ is the function defined in Item 1. Prove that$NBB$ grows faster than$TOWER$ , in the sense that$TOWER(n) = o(NBB(n))$ (i.e., for every$\epsilon>0$ , there exists$n_0$ such that for every$n>n_0$ ,$TOWER(n) < \epsilon \cdot NBB(n)$ .).^[You will not need to use very specific properties of the$TOWER$ function in this exercise. For example,$NBB(n)$ also grows faster than the Ackerman function. You might find Aaronson's blog post on the same topic to be quite interesting, and relevant to this book at large. If you like it then you might also enjoy this piece by Terence Tao.] :::
As mentioned before, Gödel, Escher, Bach [@hofstadter1999] is a highly recommended book covering Gödel's Theorem. A classic popular science book about Fermat's Last Theorem is [@singh1997fermat].
Cantor's are used for both Turing and Gödel's theorems.
In a twist of fate, using techniques originating from the works of Gödel and Turing, Paul Cohen showed in 1963 that Cantor's Continuum Hypothesis is independent of the axioms of set theory, which means that neither it nor its negation is provable from these axioms and hence in some sense can be considered as "neither true nor false" (see [@cohen2008set]).
The Continuum Hypothesis is the conjecture that for every subset
Thanks to Alex Lombardi for pointing out an embarrassing mistake in the description of Fermat's Last Theorem. (I said that it was open for exponent 11 before Wiles' work.)