Skip to content

12.3 Recursively Enumerable Sets

Sets that can be enumerated by algorithms and their role in semi-decidability and computability theory.

A set is recursively enumerable if there is an algorithm that can list its elements.

The older name is recursively enumerable, often abbreviated as r.e. The modern name is computably enumerable, often abbreviated as c.e. Both terms refer to the same idea.

A set ANA \subseteq \mathbb{N} is recursively enumerable if there is a Turing machine that prints exactly the elements of AA:

A=a0,a1,a2,a3, A = {a_0, a_1, a_2, a_3, \dots}

The machine may run forever. It does not need to print the elements in order. It may also print the same element more than once, although duplicates can be removed by another computable procedure.

Enumeration

The simplest way to understand an r.e. set is by listing.

For example, the set of even natural numbers is r.e.:

0,2,4,6,8, 0, 2, 4, 6, 8, \dots

The set of prime numbers is also r.e.:

2,3,5,7,11,13, 2, 3, 5, 7, 11, 13, \dots

These examples are not only r.e.; they are computable. Given a number nn, we can decide whether nn is even or prime.

The important point is that r.e. sets may be harder than computable sets. An r.e. set can be listable without being decidable.

Semi-Decidability

There is another equivalent way to define r.e. sets.

A set AA is recursively enumerable if there is a machine MM such that:

xAM(x) eventually accepts x \in A \quad \Longrightarrow \quad M(x) \text{ eventually accepts}

and:

xAM(x) either rejects or runs forever x \notin A \quad \Longrightarrow \quad M(x) \text{ either rejects or runs forever}

Usually, we simplify this by saying:

xAM(x) eventually accepts x \in A \quad \Longleftrightarrow \quad M(x) \text{ eventually accepts}

The machine must accept members of AA. For nonmembers, it has no obligation to halt.

This is called semi-decidability. Positive answers can be confirmed. Negative answers may remain unresolved forever.

Decidable Versus Recursively Enumerable

Every decidable set is recursively enumerable.

If AA is decidable, then we can enumerate it by checking:

0,1,2,3, 0,1,2,3,\dots

For each number nn, run the decision procedure for AA. If it says yes, print nn.

So:

A decidableA recursively enumerable A \text{ decidable} \quad \Longrightarrow \quad A \text{ recursively enumerable}

The converse fails. Some r.e. sets are not decidable.

The standard example is the halting set:

K=e:program e halts on input e K = {e : \text{program } e \text{ halts on input } e}

This set is r.e. because we can simulate programs step by step. Whenever program ee halts on input ee, we eventually discover that and print ee.

But KK is not decidable. There is no algorithm that always decides whether an arbitrary program halts on its own code.

Thus:

K is r.e. K \text{ is r.e.}

but:

K is not computable K \text{ is not computable}

Why the Halting Set Is Enumerable

The enumeration of KK uses dovetailing.

Instead of running one program forever, we run many computations in stages:

  • stage 00: run program 00 for 00 steps
  • stage 11: run programs 0,10,1 for 11 step
  • stage 22: run programs 0,1,20,1,2 for 22 steps
  • stage 33: run programs 0,1,2,30,1,2,3 for 33 steps

Whenever a computation halts, we print its program index.

This guarantees that every halting computation is eventually found. A nonhalting computation simply never contributes an output.

Complements

If AA is decidable, then both AA and its complement are r.e.

The complement is:

A=NA \overline{A} = \mathbb{N} \setminus A

If we can decide membership in AA, then we can also decide membership in A\overline{A}.

A key theorem says the converse is true:

A is computableA is r.e. and A is r.e. A \text{ is computable} \quad \Longleftrightarrow \quad A \text{ is r.e. and } \overline{A} \text{ is r.e.}

The idea is simple. Run the enumerator for AA and the enumerator for A\overline{A} in parallel. Given input xx, wait until xx appears in one of the two lists. Since every number belongs to exactly one of them, it must eventually appear in one list. Then we can decide correctly.

This theorem shows why r.e. is weaker than decidable. An r.e. set gives a way to eventually confirm membership, but it may give no way to confirm nonmembership.

Domains of Partial Computable Functions

Recursively enumerable sets also arise as domains.

A partial computable function may be defined on some inputs and undefined on others:

φ(x) \varphi(x)\downarrow

means that φ(x)\varphi(x) is defined, or equivalently, the computation halts.

The domain is:

$$ \operatorname{dom}(\varphi)

{x : \varphi(x)\downarrow} $$

Every such domain is r.e. We can enumerate the inputs on which the computation halts.

Conversely, every r.e. set is the domain of some partial computable function.

So r.e. sets are exactly the possible halting domains of partial computable functions.

Relation to Turing Degrees

R.e. sets are central in degree theory because they form a natural class of noncomputable sets.

The computable r.e. sets have degree:

0 \mathbf{0}

The halting set has degree:

0 \mathbf{0'}

Between them, there can be r.e. sets of intermediate Turing degree:

0<Tdeg(A)<T0 \mathbf{0} <_T \deg(A) <_T \mathbf{0'}

This is the content of Post’s problem, discussed next.