3-computing
3-computing
COMPUTING
Mihai-Valentin DUMITRU
[email protected]
October 2024
In the introductory lecture, we discussed what “problems” are and classified them into two classes:
• “function problems” – those whose answer is some mathematical object other than a boolean, such as a
number, a set, a graph etc.
In the second lecture, we introduced the concept of Turing Machines and presented some particular examples of
machines that solve problems. The answer to a decision problem was given by transitioning to one of the final
states Y (a “yes” answer) or N (a “no” answer), while the answer to a function problem was given by encoding
the answer in the tape contents and transitioning to the final state H.
In all cases mentioned above, the computation ends by reaching a final state. But consider the following machine:
0 1 □
q1 q1 , 0, − q1 , 1, − q1 , □, −
The machine starts in the initial state q1 . Regardless of what symbol it reads, it remains in the same state, keeping
the head stationary. Its computation will never end: it can never reach any of the three final states.
This should evoke the more familiar concept of while (1) {} from a language like C. The machine performs
work: it goes through successive discrete stages, each time transitioning to a state, writing a symbol on the tape
and moving the tape head. It just so happens that the next state is always the same as the current one, the written
symbol is always the same as the read one and the movement direction of the head is to keep it stationary, so there
is no interesting effect for any transition.
However, if the machine above seems too odd, here’s one that moves the head and changes the contents of the
tape:
0 1 □
q1 q1 , 1, → q1 , 1, → q1 , 1, →
Regardless of the input, the machine will go on forever, writing one more 1 on the tape at each step. By analogy
with C, you can think of it as: while (1) { putchar("1"); }.
Here is one more example of a machine that goes on forever, but also changes state:
0 1 □
q1 q1 , 1, → q1 , 0, → q2 , □, ←
q2 q2 , 1, ← q2 , 0, ← q1 , □, →
This machine keeps going left-to-right, then right-to-left through the input, flipping symbols.
The three examples above always run forever, regardless of the input. But we can easily conceive of a machine
that halts for some inputs and doesn’t for others:
0 1 □
q1 q1 , 0, H q2 , 1, → q2 , 1, →
q2 q2 , 1, → q2 , 1, → q2 , 1, →
1
Analiza Algoritmilor Computing
This one halts in one transition for any input that begins with a 0, or goes on to write a never-ending sequence of
1s for any input that begins with 1, as well as for the empty input.
The key takeaway here is that, during its run, a machine can either make a finite number of transitions until it
reaches a final state, or make an infinite number of transitions, never reaching a final state. In the first case, we
say that the machine “halts”, in the other that it “doesn’t halt”.
We will now formalize the notion of a machine’s “run”.
These three elements together (tape contents, head position, state) uniquely characterize a computation step –
together, they form a “configuration”.
2
Analiza Algoritmilor Computing
Definition 3.2. The initial configuration of a Turing machine M = (Q, Σ, Γ, B, q1 , δ) on input w ∈ Σ∗ is:
• (ε, w, q1 ), for w ̸= ε
• (ε, B, q1 ), for w = ε
We shall call it C0M (w).
(ε, 10010, q1 )
The third element of the tuple tells us that the machine is in state q1 . There are no symbols to the left of the head,
hence the first element of the tuple is just the empty string, ε. The whole input is to the right of the head, except
for the first symbol which is right under it. To figure out the symbol currently read by the head, we need to inspect
the first symbol of the second element of the tuple; here, it is 1.
Looking at the transition table of isEven, we know that δ(q1 , 1) = (q1 , 1, →). So the next configuration is:
(1, 0010, q1 )
The state is still q1 , but the head moved one position right, so the first 1 symbol of the input is now to the left of
the head, which is positioned over a 0.
The machine then goes through the following configurations, until it transitions into a halting state.
(10, 010, q1 )
(100, 10, q1 )
(1001, 0, q1 )
(10010, □, q1 )
(1001, 0, q2 )
(1001, 0, Y )
3
Analiza Algoritmilor Computing
Remember that our machines are well-behaved and never advance more than one blank symbol outside the bounds
of the tape contents.
We now give formal definitions for “the result” of running a machine M on an input w.
• w, v ∈ Σ∗
∗
• ϕ ∈ Γ′
def
Definition 3.5. M [w] → T RU E = C0M (w) ⊢∗M (ϕ, µ, Y )
4
Analiza Algoritmilor Computing
Note 3.1. In many Computability textbooks, you may see this denoted by M (w) = T RU E, but we want to
emphasize here that M is not a function that maps w to a value, but a machine that performs computation
starting from w.
def
Definition 3.6. M [w] → F ALSE = C0M (w) ⊢∗M (ϕ, µ, N )
def
Definition 3.7. M [w] → v = C0M (w) ⊢∗M (ϕ, µ, H) and:
• ϕµ = v, if v ̸= ε
• ϕ = ε, µ = B, if v = ε
def
Definition 3.8. M [w] halts = M [w] → X ∨
M [w] → TRUE ∨
M [w] → FALSE
∗
where X ∈ Γ′
This is a generalization of the previous three definitions. If, on input w, M accepts or rejects or computes an output
v, we can say generically that “M halts on input w”. Otherwise we say that “M doesn’t halt on input w”.
Going forwards, it will be useful for us to have a short notation for this case:
def
Definition 3.9. M [w] →⊥ = M [w] doesn’t halt
(The symbol ⊥ is called a “bottom” and its usage here is a bastardization of its meaning in Type Theory.)
5 Accepting a problem
Note that the definition doesn’t say anything about the case in which f (w) = F ALSE. The machine could
transition to final state N , or H, or it could loop forever, it doesn’t matter.
def
Definition 3.11. f is acceptable = ∃M s.t. M accepts f
def
Definition 3.12. RE = {f | f is acceptable }
The name “RE” stands for “recursively-enumerable”, which is another term for “acceptable”. We use it here
(instead of something like A) because it’s the classical name for this set.
5
Analiza Algoritmilor Computing
6 Deciding a problem
def
Definition 3.14. f is decidable = ∃M s.t. M decides f
Note that for a problem to be decidable, there has to exist a Turing machine M which always halts and gives the
correct answer, whatever the input. M matches our intuition of what a “decision algorithm” is: a finite mechanistic
procedure that always provide an answer to a yes/no question, in a finite amount of time.
def
Definition 3.15. R = {f | f is decidable }
The name “R” stands for “recursive”, which is another term for “decidable”. Like RE, it’s a classic name.
At this point in the lecture, the concept of acceptance might seem artificial and meaningless. But we shall soon
prove (and provide examples) that there are decision problems for which there exist machines that can accept them
but there exist no machines that can decide them. Thus, acceptance is a notion worthy of study.
What’s more, we will also prove (and provide examples) that there are decision problems which are not acceptable:
no Turing Machine exists that can accept them.
7 Computing a problem
We move on from decision problems for a bit, and generalize the concept of “deciding”.
Definition 3.16. Let f : Σ∗1 → Σ∗2 be a function problem and M = (Q, Σ1 , Γ, B, q1 , δ) a Turing Machine:
def
M computes f = ∀w ∈ Σ∗1 , M [w] → f (w)
def
Definition 3.17. f is computable = ∃M s.t. M computes f
Note that, per our definitions, decidability is a special case of computability, applicable only to decision problems.
Similarly to what we said about acceptable and decidable problems, we will soon prove that there are some
function problems that are not computable.
Note 3.2. From now on, when talking generically about functions, we will use the informal term “solve” to
mean either “accept”, “decide” or “compute”, appropriately, based on context.
“The problems that are solvable by a mathematician with pen and paper are precisely those
computable by a Turing Machine.”
We can rephrase it in a way more relevant to our goals:
“The problems that are solvable by an algorithm are those that are computable by a Turing
Machine.”
This is a philosophical statement about reality, that asserts a correspondence between the intuitive concept of
“algorithm” and the formal concept of “Turing machine”. Because “algorithm” (or “solvable by an algorithm”) is
not a formally defined mathematical object, the Church-Turing thesis is not a mathematical statement; thus it can
be neither proven or disproven within the realm of mathematics.
6
Analiza Algoritmilor Computing
However, it can be analyzed, debated, doubted, accepted etc. At this point, you might find little reason to believe
this assertion that Turing Machine can solve any problem solvable by an algorithm, but there are some solid
arguments in support of it.
• It consists of a finite number of instructions, each expressible with a finite amount of symbols.
A problem that can be solved by an effective method is “effectively calculable”. Note that this is an intuitive,
informal concept.
There are at least three contemporaneous attempts at formalizing this notion:
• recursive functions
• Turing Machines
These three widely different models all started as an attempt to rigorously capture which problems are “effectively
calculable”. They were all shown to be equivalent to each other; that is, they identify precisely the same set of
problems.
Since then, many other models of computations (e.g. counter machines, RAM machines, Markov algorithms) were
designed for which it was proven that the set of problems computable in that model is R.
functions that Turing Machines cannot. However, while the models and results are mathematically sound, the computation they
describe could not be carried out by a human with pen and paper. For example, some models require performing an infinite number
of steps in a finite amount of time.
7
Analiza Algoritmilor Computing
Alan Turing described his machines in 1936, in “On computable numbers, with an application to the Entschei-
dungsproblem” [3] (which was only published in 1937). Because Church’s paper had been published one year
before, Turing added an appendix to his own, proving the equivalence between lambda-definable functions and
Turing-computable functions.
The Stanford Encyclopedia of Philosophy has an entry on the Church-Turing thesis [4]: its historical context, what
it claims and what it doesn’t, as well as a more detailed section on why to accept it. ‡
Bibliography
[1] Kurt Gödel. Kurt Gödel: Collected Works: Volume I: Publications 1929-1936. Vol. 1. Oxford University Press,
New York, 1986, pp. 338–371.
[2] Alonzo Church. “An unsolvable problem of elementary number theory”. In: American Journal of Mathematics
58.2 (1936), pp. 345–363.
[3] Alan Mathison Turing et al. “On computable numbers, with an application to the Entscheidungsproblem”.
In: J. of Math 58.345-363 (1936), p. 5.
[4] B. Jack Copeland. “The Church-Turing Thesis”. In: The Stanford Encyclopedia of Philosophy. Ed. by Edward
N. Zalta. Summer 2020. Metaphysics Research Lab, Stanford University, 2020.
‡ https://plato.stanford.edu/entries/church-turing/