The Shœstring Foundation Weblog
https://pestilenz.org/~bauerm/shoestring
Miscellaneous ByproductsenGödel's Incompleteness proof Incompletely implemented
https://pestilenz.org/~bauerm/shoestring/2015/03/25#goedel
<p>
Gödel proved<label for="sn-goedel" class="margin-toggle sidenote-number"></label>
<input type="checkbox" id="sn-goedel" class="margin-toggle"><span class="sidenote">
<a href="https://doi.org/10.1007%2FBF01700692"><em>Über formal unentscheidbare Sätze der Principia Mathematica und verwandter Systeme</em></a></span>
the incompleteness of minimal logic combined with
minimal arithmetic. He was careful to point out that every step
in the proof is constructive. So one would assume that the whole
process up to the unprovable theorem about numbers could be implemented.
The original paper in fact has a point by point implementation in
Gödels's own notation of primitive recursion. Porting this to
Scheme seemed viable.
</p>
<p>
Gödel has a curious programming style, specially when it
comes to performance. For example, after definition of <code>Pr(n)</code>
as the n-th prime number, <code>l(n)</code> as the number of encoded numbers in
n, and <code >n Gl x</code> as the n-th coded number
in the number x, he defines the concatenation of terms x and y as
</p>
<blockquote>
<pre>
<code>
x * y =
ε z { z ≤ [Pr((l(x)+l(y)))]<sup>x+y</sup> &
(n) [n≤l(x) → n Gl z = n Gl x ] &
(n) [0 < n ≤ l(y) → (n+l(x)) Gl z = n Gl y ]}
</code>
</pre>
</blockquote>
which translates as :
<blockquote>
<p>
<em> To get the concatenation of x and y, find the first number z, starting from 1, such that z is smaller than the
<code>len(x) + len(y)</code>-th prime taken to the (x+y)-th power, and such that for all n less than <code>len(x)</code>
the n-th term in z is the n-th term in x, and such that for all n less than <code>len(y)</code>,
the (n+<code>len(x)</code>)-th term in z is the n-th term in y</em>
</p>
</blockquote>
<p>
Remember that the n-th encoded term k in x is the factor (n-th prime)<sup>k</sup> of x, so
this algorithm will try an incredible number of wrong candidates before reaching a likely candidate.
</p>
<p>
While implementing Gödel's proof in a kind of Test Driven Development I had to
stop at point 22 in the original paper, because from that point on even trivial tests will not
finish before the sun burns out. For an explanation, see <br/>
end of
<a href="https://pestilenz.org/~bauerm/shoestring/goedel.scm">code</a>.
</p>