0% found this document useful (0 votes)
135 views10 pages

Getting Around The Halting Problem

Let Θ(p,n) be a program that either loops or returns only true or false. The parameter p is the index of a program P and n is its input. Suppose that Θ(p,n) = true if and only if P halts on n. It follows that if Θ(P,n) = false then P does not halt on n. Let furthermore Θ’(n) = Θ(n,n) and Θ*() = Θ’(θ*). The claim is that in the class Θ there exists a program H such that H(h,h*) = false, that is, H proves that it does not prove that H* halts. This has implications for solving the liar paradox and for generalization of Gödel’s incompleteness theorem to formal systems other than PA.

Uploaded by

X.Y. Newberry
Copyright
© Attribution Non-Commercial ShareAlike (BY-NC-SA)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views10 pages

Getting Around The Halting Problem

Let Θ(p,n) be a program that either loops or returns only true or false. The parameter p is the index of a program P and n is its input. Suppose that Θ(p,n) = true if and only if P halts on n. It follows that if Θ(P,n) = false then P does not halt on n. Let furthermore Θ’(n) = Θ(n,n) and Θ*() = Θ’(θ*). The claim is that in the class Θ there exists a program H such that H(h,h*) = false, that is, H proves that it does not prove that H* halts. This has implications for solving the liar paradox and for generalization of Gödel’s incompleteness theorem to formal systems other than PA.

Uploaded by

X.Y. Newberry
Copyright
© Attribution Non-Commercial ShareAlike (BY-NC-SA)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

2022-09-09

Getting around the Halting Problem


by X.Y. Newberry

Abstract
There are numbers k and s and a URM program A(n,m) satisfying the following conditions.

1. If A(n,m) halts, then Cn(m) diverges.


2. For all n, Ck(n) = A(n,n) and Cs(n) = Ck(s).
3. A(k,s) halts and for all n, A(s,n) diverges.

Here Cn(_) is a program with index n in some exhaustive enumeration of all possible programs.

This has implications for solving the liar paradox and for generalization of Gödel’s incompleteness
theorem to formal systems other than PA.

1
1. Introduction
Let A’(n,m) be a program1) with the following property2)

A’(n,m)↓ → Cn(m)↑ (1.1)

that is, A’() detects in some cases that a program Cn() with input m does not halt. Here
Cn() is a program with index n in some exhaustive enumeration of all possible programs.
The downward arrow ‘↓’ indicates that the program halts, the upward arrow ‘↑’ indicates
that the program diverges.

Let us define Ck(n) =def A’(n,n), Cs() =def Ck(s). The existence of Cs() is guaranteed by the
Recursion Theorem. In pseudocode it looks as follows

C_k(n) {
A’(n,n)
}
Figure 1.1

and
C_s() {
C_k(s)
}
Figure 1.2

It is apparent that C_s() can be constructed in any general purpose programming


language. We know by the Halting Theorem that there is no program A’() such that

A’(n,m)↓ <--> Cn(m)↑ (1.2)

1 Such as URM program or a Turing machine performing operations on natural numbers. It could be a program in any
general purpose programming language with the proviso that word length and memory size are infinite.
2 The idea of such a program A() is due to Penrose [5]. This approach greatly simplifies matters.

2
The proof is usually by constructing a counterexample:

(1) Cs()↓ Assumption 1


(2) Ck(s)↓ From 1, figure 1.1
(3) A’(s,s)↓ From 2, figure 1.2
(4) Cs()↑ From 3, condition 1.1
(5) Cs()↑ RAA 1, 4, assumption 1 discharged
Proof 1.1

But Cs()↓ = Ck(s)↓ = A’(s, _)↓ are all equivalent. So we can analogically prove Ck(s)↑ and
A’(s,_)↑. So Cs() does not halt, but A’() does not know it.

The question arises if there is any other way A’(n,m) can express that Cs() does not halt.3)
It is a thesis of this paper that there is. In particular it is the program A(n,m) such that

a) A(k,s)↓
b) A(s,_ )↑

(The underscore in place of a parameter indicates ‘don’t care’.) The condition a) together
with (1.1) imply that Ck(s)↑. But if Ck(s) does not halt then Cs() cannot possibly halt either.
(Figure 1.2) Thus A(k,s)↓ expresses indirectly that Cs() does not halt. Seemingly we have
a contradiction: Cs() = Ck(s) and yet A(k,s)↓ & A(s,_ )↑. The key observation here is that
A(k,s)↓ does not contradict A(s,_ )↑. The former ‘says’ that Ck(s) does not halt, the latter
says nothing; it does not say that Cs() does halt. And since <k,s> and <s,_> are two
different parameter tuples A() is under no obligation to react identically to them.

2. Formalization
Theorem 1: There are numbers k and s and a program A(n,m) satisfying the following
conditions.

1. If A(n,m)↓, then Cn(m)↑.


2. For all n, Ck(n) = A(n,n) and Cs(n) = Ck(s).
3. A(k,s)↓ and for all n, A(s,n)↑.
Here Cn(∙) is a program with index n in some exhaustive enumeration of all possible
programs.

3 Never say never!

3
Proof: Let K denote the halting problem, that is, K = {e : Ce(e) ↓}. It is known that the
complement of K, K, is productive and therefore contains an infinite recursively
enumerable (r.e.) subset. Let f be a recursive function such that f(0), f(1), f(2), . . . is a
one-one enumeration of an infinite r.e. subset of K.

Define a partial-recursive function A(x,y), and numbers k, s such that for all n

⎧ 1 if ∃n(x = y = f(n) ≠ s) ∨ (x = k & y = s);


A(x,y) = ⎨
⎩ ↑ otherwise.

⎧ 1 if A(x,x) = 1
Ck(x) = ⎨
⎩ ↑ otherwise.

By the Recursion Theorem, there are infinitely many s’ such that for all y, Cs’(y) = Ck(s’).
Fix one such s’, say s, such that s ≠ k. The function f enumerates many functions that do
not halt on their own input (hopefully all of them except the equivalents of s.)

The definition is seemingly circular: A refers to Ck while Ck is defined in terms of A. In fact


it is a recursive definition: by the Recursion Theorem A obtains its own description from
which it derives the description of Ck.

We may now verify Conditions 1, 2 and 3 as follows.

Condition 1: By the definition of A, A(x,y)↓ only if one of the following holds: (a) x = y =
f(n) ≠ s, or (b) (x = k & y = s). In case (a), one has by the definition of f that f(n) ∈ K, that
is, Cf(n)(f(n))↑. In case (b), since s has been chosen such that s≠ k, by the definition of
Ck(x), Ck(x)↑ if x≠ y.

Condition 2: For all n, Ck(n) = A(n,n) is immediate by the definition of Ck. Furthermore, by
the choice of s, for all y, Cs(y) = Ck(s).

Condition 3: It follows from the definition of A that A(k,s)↓= 1, and for all y, A(s,y)↑
since s≠ k. QED 4)

4 This is a modified version of a proof suggested by a referee.

4
There is a compilable, executable version of another program in Appendix A written in
C, which satisfies the same conditions as A() above. It perhaps constitutes an alternative
proof.

3. Analogy with Arithmetic


Let Pi(x) be an at most one place arithmetic predicate with index i. Then ∃xPi(x) iff
the following program halts:

Prog_i {
x := 0
loop {
if P_i(x) then exit loop
x := x+1
}
}

Thus proving ~∃xPi(x) is equivalent to proving that the corresponding program does
not halt. There certainly does exist a program Φ that proves ~∃xPi(x) iff Peano
Arithmetic proves it.

The subset of {Pi}

{Pj | “~∃xPj (j)” provable in PA}

is recursively enumerable, and thus a counterpart of the range of f(n) from the
previous section.

Let Prf(x,y) be the proof predicate of PA meaning that x is a proof of y, where x, y


are Gödel numbers. Then the program Φ proves ∃xPrf((x,y) iff PA so proves for a
given y.

Now let

~∃x∃z(Prf(x,z) & Diag(k,z)) (G)

be Gödel’s sentence, where Diag(k,z) is satisfied only by z = ⌜G⌝, while G is none other
than the Gödel number of G itself. Program Φ cannot prove G. And since in classical logic

~(∃x)Prf(x, ⌜G⌝ ) (H)

5
is equivalent to G, Φ cannot prove H either.

However in Strawson’s Logic of Presuppositions G ≠ H! More about this in [3], [4], [6].
Using this logic we ought to be able to extend the proof predicate and in fact obtain

~(∃x)Prf*(x, ⌜G*⌝ ) (H*)

Note that if ~(∃x)Prf*(x, ⌜G*⌝ ) then it cannot be the case that

∃x∃z(Prf*(x,z) & Diag(k*,z)) (G’)

for G’ is equivalent to (∃x)Prf*(x, ⌜G*⌝ ) even in the Logic of Presuppositions! The


reason being that (∃x)Prf*(x, ⌜G*⌝ ) is the presupposition of both G’ and its
negation G*. [3]

We observe the following analogy:

Computability Logic

~∃x(Prf*(x, ⌜G*⌝)
Self-reference Cs() G*
External reference Ck(s)

Table 3.1

Program A() does not explicitly ‘know’ that Cs() does not halt, but it does know that
Ck(s) does not halt. And while Strawson based arithmetic does not ‘know’ that G* is
the case it nevertheless does know that H* is the case. And all the information we
are interested in is already contained in H*.

6
4. The Liar Paradox
Consider the following two-line puzzle:
Line 1: This sentence is not true.
Line 2: "This sentence is not true" is not true.
The standard evaluation rule for a sentence of the form ‘The sentence X is true’ is
roughly this:

(*) Go to the sentence X and evaluate it. If that sentence is true, so is ‘The sentence X is
true’ , else the latter is false.

When we apply the above rule to line 1 we end up in an infinite loop. The
sentence cannot be evaluated, and hence is not true (and not false.) When we
apply it to line 2 we already know that "This sentence is not true" is not true,
and therefore the line 2 sentence is true. The “go-to” command makes the referring
by ‘The sentence ...’ operationally explicit.5)

Another way of putting it is this: Y = This sentence is not true. Then


Y is not true,
~T(Y) is true.
Although Y and ~T(Y) appear to say the same thing, they do not. The former is
self-referential, the latter is not. We observe an analogy

Computability Logic Liar


Self-reference Cs() G* Y
External reference Ck(s) ~∃x(Prf*(x, ⌜G*⌝) ~T(Y)

Table 4.1

More about this in [2].

5 All the above is a paraphrase of a paragraph in [1].

7
APPENDIX A: A() fragment
A reasonable strategy for A() to determine if C_s() does not halt is to call C_s() itself.
For C_s() is a program that is supposed to halt if C_s() does not halt. So A() can as
well ask it. And after all C_s() = C_k(s) = A(s,s) are computationally equivalent. In
this case when A() is called with s it will go into infinite recursion. The program
below will actually compile and execute.

8
#include <stdio.h>
#define DEPTH (1000)
#define INITIALIZE level = 0; k = (unsigned int)C_k; \
s = (unsigned int)C_s;
#define LEVEL_INC if ( checkStack() ) return;
#define LEVEL_DEC level--;

static int level = 0; // Tracks # of iterations


unsigned int k, s; // Addresses of C_k and C_s

void C_s(); // Forward declaration

int checkStack(void) {
level++;
if (level >= DEPTH){
printf("Almost got there. Have run out of stack.\n\n");
level--; // Alternative return, decrease level
return 1;
}
return 0;
}

// If A(n,m) halts then C_n(m) does NOT halt.


void A(unsigned int n, unsigned int m) {
LEVEL_INC // We are tracking the depth of recursion
// . . . . .
if (n == s) C_s();
// . . . . .
if (n == k && m == s) {
// Analyze what happens when A() calls C_s()
// Does C_s() have a base case?
printf("Program C_%u( %u ) does NOT halt.\n\n", n, m);
}
// . . . . .
LEVEL_DEC
}

void C_k(unsigned int n) {


A(n,n);
}

void C_s() {
C_k(s);
}

int main(int argc, char *argv[])


{
INITIALIZE // macro

A(k,s); // Does C_k(s) halt? No.


C_k(s); // Does C_s() halt? No answer.
A(s,0); // Does C_s() halt? No answer.

return 0;
}

9
Bibliography
[1] Gaifman, H. (2000) Pointers to propositions. In: A. Chapuis & A. Gupta, eds.
Circularity, Definition, and Truth, New Delhi: Indian Council of Philosophical Research:
79–121, Available at:
https://www.researchgate.net/publication/265448054_POINTERS_TO_PROPOSITIONS, p. 3
[Accessed 31 Aug 2020]

[2] Newberry, X.Y. (2016) Notes on Gaifman’s Solution of The Liar Paradox, The Reasoner,
Volume 4, Number 2
https://cdn-researchkent.pressidium.com/reasoning/wp-content/uploads/sites/
1804/2019/06/TheReasoner-42-screen.pdf

[3] Newberry, X.Y. (2015) The Diagonal Lemma Fails in Aristotelian Logic, The Reasoner
Volume 10, Number 1, https://blogs.kent.ac.uk/thereasoner/files/2015/01/TheReasoner-
101-1.pdf
https://www.scribd.com/document/362318420/The-Diagonal-Lemma-Fails-in-Aristotelian-
Logic

[4] Newberry, X.Y. (2019) Truth-relevant Logic – Propositional Calculus,


https://www.scribd.com/document/443340610/Truth-relevant-Logic-Propositional-Calculus

[5] Penrose, R. (1994) Shadows of the Mind, Oxford, Oxford University Press, pp. 73-75

[6] Strawson, P.F. (1952) Introduction to Logical Theory, London, Methuen, pp. 163-179

Copyright © X.Y. Newberry 2021 - 2022

10

You might also like