Recall the terminology for TM computation:
A language \(A\) is called Turing-recognizable (or Turing-acceptable, recursively enumerable, or
computably enumerable) if some Turing machine \(M\) recognizes it (\(L(M) = A\)).
A language \(A\) is called Turing-decidable if there exists a total Turing machine \(M\) (a decider) such that \(L(M) = A\). In other words \(M\) accepts all \(w \in A\) and rejects all \(w \notin A\).
def halt_recognizer(M, w):
"""
M: a Python function
(stand-in for a Turing machine)
w: an input string
"""
M(w)
return True
def M1(w):
count = 0
for c in w:
if c == 'a':
count += 1
return count > 5
w = 'abcabcaaabcaa'
halt_recognizer(M1, w) # returns True
def M2(w):
i = 0
while i < len(w):
if w[i] != 'c':
i += 1
return w
w = 'abcabcaaabcaa'
halt_recognizer(M2, w) # never returns...
Theorem (Turing): \(\probHALT\) is not decidable.
Once we prove this, we can use Turing reductions to show that many other problems are also undecidable.