Recursive enumerability and the halting problem
Build fair searches, prove halting undecidable, and distinguish missing evidence from a negative answer.
On this page
The question for today
What you’ll understand
- Relate computable enumeration to semidecision and finite witnesses.
- Use dovetailing to prevent a divergent search from blocking other searches.
- Prove the diagonal halting set undecidable and its complement not computably enumerable.
Some sets permit reliable positive discovery without a reliable negative stopping rule. A halting computation leaves a finite trace that can be checked; a computation that has not halted may still halt later. Computable enumerability captures this asymmetry. We will specify fair simultaneous search, derive the halting contradiction using a total hypothetical decider, and show why enumerating both sides of a set would remove the asymmetry entirely.
A computably enumerable set supplies finite positive witnesses
A subset of the natural numbers is computably enumerable, abbreviated c.e., if a program can list its members, allowing repetition and arbitrary delays; the empty listing is allowed. Equivalently, membership has a semidecider that halts affirmatively exactly on members, or the set is the domain of a partial computable function. These equivalences use dovetailing when infinitely many candidate inputs or witnesses must be searched. Merely knowing that a set is countable does not give an effective listing.
Fix an effective machine numbering and a computable pairing function. The two-input halting set contains pairs whose first component describes a machine that halts on the second component. Its witnesses are bounded computation records, checked by simulating a specified finite number of steps. We also use the diagonal set K of indices e for which machine e halts on input e. Both sets are c.e.; their definitions must not be silently interchanged with the set of all total programs.
Dovetailing allocates finite time fairly
To search infinitely many computations, at stage s simulate the first s candidate computations for s steps each and report every discovered success. Repeated work is harmless; every genuinely halting candidate eventually receives enough simulation time. A more efficient scheduler may retain configurations between stages, but fairness is the essential property. Running the first computation until it halts before starting the next is not fair, because one divergent input can block all later discoveries.
If both A and its complement are c.e., decide membership by running their semideciders in alternation. Exactly one eventually accepts, because every input lies on one side. Return the corresponding Boolean answer when it does. This proves a total decision procedure, even without a uniform time bound. It also gives a useful test: an undecidable c.e. set cannot have a c.e. complement.
Diagonalization defeats a total halting decider
Suppose a total computable Hstar correctly decides whether machine e halts on input e. Construct a machine D that, on input x, loops forever if Hstar(x) says yes and halts if it says no. Because Hstar is total, D reaches the chosen branch on every input. Let d be an index of D. If Hstar(d) says yes, D(d) loops; if it says no, D(d) halts. Either answer contradicts correctness, so no such total decider exists.
The construction is about an effective enumeration containing the newly constructed program, not about a particular program literally reading its own source code. A universal simulator and ordinary program composition suffice. Since K is c.e. and undecidable, its complement is not c.e. Long unsuccessful experiments cannot refute membership uniformly. In special finite-state systems, a proved finite state bound can establish nonreachability; arbitrary Turing computations have no corresponding universal finite cutoff.
Work it through
A fair schedule discovers late successes past a divergent program
Three programs A,B,C have fixed inputs. A first halts after four transitions, B never halts, and C first halts after two. At stage s simulate each of the three from its initial configuration for s transitions. Determine the first discovery stages and compare with sequential execution A then B then C.
At stage one no program has completed its required finite trace. At stage two, C has halted and is reported. B has consumed only a finite budget and therefore cannot block C.
Stage three adds no new success. At stage four A is discovered. Repeated reports of C can be suppressed by keeping a finite record of previous discoveries; this does not affect which successes are eventually found.
Sequential execution discovers A after four transitions, then spends forever in B and never starts C. The fair schedule reports C at stage two and A at stage four. Extending to stage-s searches of the first s programs preserves eventual discovery for every halting member.
Fairness changes discovery order and prevents divergent runs from blocking other witnesses. It never turns an unfinished run into a certified negative answer.
The living notebook
Explore the model
Interactive lab · modular
A finite state bound can certify a special nonreachability claim
Pause and Reset, set modulus 7 and step 2, then take seven Steps: residues are 0,2,4,6,1,3,5,0, so every residue appears. Reset for a fresh comparison and set both modulus 8 and step 2. Its four-state orbit is 0,2,4,6,0 and never reaches an odd residue; prove this by parity or closure. The bound comes from this known finite model, not a general halting test. Each Step is one addition, and edits retain the elapsed clock.
- Residue r0
- 0
- Orbit period · m/gcd(m,a)
- 12
- Distinct residues visited
- 1 of 12
Addition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forFinite closure can justify a negative claim in a specified model; arbitrary unsuccessful waiting cannot.
Pause & reason
Check your understanding
Your turn
Try it yourself
Use to encode the machine/input pair (3,2). Then prove that a hypothetical enumerator for the nonhalting pairs, together with the known halting-pair enumerator, would decide whether the pair encoded by any input halts.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Compute the pairing number directly. Run the two enumerations in alternating finite stages and watch for the input code.
Compare with the solution
The pair code is . For an arbitrary valid pair code z, dovetail the two enumerations until one prints z. Exactly one must eventually print it, because the pair either halts or does not halt. Return the corresponding answer, giving a total halting decider and hence a contradiction. This argument does not decide whether the particular pair (3,2) halts without knowing the chosen machine numbering; seventeen is only its declared syntactic code.
Keep the idea
Take it with you
- Computable enumerability guarantees discoverable positive witnesses, not total membership decisions.
- Dovetailing prevents one divergent computation from blocking unrelated witnesses.
- The halting contradiction excludes a uniform total decider and forces the complement not to be c.e.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.