Enumerator (computer science)
An enumerator is an automaton that lists, possibly with repetitions, elements of some set S, which it is said to enumerate. A set enumerated by some enumerator is said to be recursively enumerable. An enumerator is equivalent to a Turing machine.
Formal definition
An enumerator is usually represented as a 2-tape Turing machine. One working tape, and one print tape. It can be defined by a 7-tuple, following the notation of a Turing machine: where
- is a finite, non-empty set of states.
- is a finite, non-empty set of the output / print alphabet
- is a finite, non-empty set of the working tape alphabet
- is the transition function.
- is the start state
- is the print state.
- is the reject state with
Equivalence of Enumerator and Turing Machines
A language over a finite alphabet is Turing Recognizable if and only if it can be enumerated by an enumerator. This shows Turing recognizable languages are also recursively enumerable.
Proof
A Turing Recognizable language can be Enumerated by an Enumerator
Consider a Turing Machine and the language accepted by it be . Since the set of all possible strings over the input alphabet i.e. the Kleene Closure is a countable set, we can enumerate the strings in it as etc. Then the Enumerator enumerating the language will follow the steps:
1 for i = 1,2,3,... 2 Run with input strings for -steps 3 If any string is accepted, then print it.
Now the question comes whether every string in the language will be printed by the Enumerator we constructed. For any string in the language the TM will run finite number of steps(let it be for ) to accept it. Then in the -th step of the Enumerator will be printed. Thus the Enumerator will print every string recognizes but a single string may be printed several times.
An Enumerable Language is Turing Recognizable
It's very easy to construct a Turing Machine that recognizes the enumerable language . We can have two tapes. On one tape we take the input string and on the other tape, we run the enumerator to enumerate the strings in the language one after another. Once a string is printed in the second tape we compare it with the input in the first tape. If its a match, then we accept the input, else reject.
References
Sipser, Michael (2012). Introduction to the Theory of Computation - International Edition. ISBN 978-1-133-18781-3.