



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




This lecture covers the formal definition of a Turing machine and related concepts such as configuration and Turing decidable. It surveys a range of variant forms of Turing machines and shows for one of them (multi-tape) why it is equivalent to the basic model.
A Turing machine is a 7-tuple
(Q, Σ, Γ, δ, q 0 , qacc, qrej) ,
where
TM has a working space (i.e., tape) and its deterministic. It has a reading/writing head that can travel back and forth along the tape and rewrite the content on the tape. TM halts immediately when it enters the accept state (i.e., qacc) and then it accepts the input, or when the TM enters the reject state (i.e., qrej), and then it rejects the input.
Example 1.1 Here we describe a TM that takes it input on the tape, shifts it to the right by one character, and put a $ on the leftmost position on the tape. So, let Σ = {a, b} (but the machine we describe would work for any alphabet). Let
Q = {q 0 , qacc, qrej} ∪
qc
∣ c^ ∈^ Σ
Figure 1: A TM that shifts its input right by one position, and inserts $ in the beginning of the tape.
Now, the transitions function is
∀s ∈ Σ δ(q 0 , s) = (qs, $, R) ∀s, t ∈ Σ δ(qs, t) = (qt, s, R) ∀s ∈ Σ δ(qs, ) = (qacc, $, R). δ(q 0 , ) = (qacc, $, R)
The resulting machine is depicted in Figure 1, and here its pseudo-code: Shift Tape Right At first tape position, remember character and write $ At later positions, remember character on tape, and write previously remembered character. On blank, write remembered character and halt accepting.
2 Turing machine configurations
Consider a TM where the tape looks as follows,
Tape: α^ b~^ β^... w w The read/write head
3 The languages recognized by Turing machines
Definition 3.1 For a TM M and a string w, the Turing machine M accepts w if there is a sequence of configurations C 1 , C 2 ,... , Ck,
such that
Definition 3.2 The language of a TM M (i.e., Turing machine M ) is
L(M ) =
w
∣ M^ accepts^ w
The language L is called Turing recognizable.
Note, that if w ∈ L(M ) then M halts on w and accepts it. On the other hand, if w /∈ L(M ) then either M halts and rejects w, or M loops forever on the input w. Specifically, for an input w a TM can either
accept (and then it halts),
reject (and then it halts),
or be in infinite loop.
Definition 3.3 A TM that halts on all inputs is called a decider. As such, a language L is Turing decidable if there is a decider TM M , such that L(M ) = L.
The hierarchy of languages looks as follows:
Regular
Context free grammar Turing decidable Turing recognizable Not Turing recognizable.
4 Variations on Turing Machines
There are many variations on the definition of a Turing machine which do not change the languages that can be recognized. Well-known variations include doubly-infinite tapes, a stay-put option, non-determinism, and multiple tapes. Turing machines can also be built with very small alphabets by encoding symbol names in unary or binary.
What if we allow the Turing machine to have an infinite tape on both sides? It turns out the resulting machine is not stronger than the original machine. To see that, we will show that a doubly infinite tape TM can be simulated on the standard TM. So, consider a TM M that uses a doubly infinite tape. We will simulate this machine by a standard TM. Indeed, fold the tape of M over itself, such that location i ∈ [−∞, ∞] is mapped to location
h(i) =
2 |i| i ≤ 0 2 i − 1 i > 0.
on the usual tape. Clearly, now the doubly infinite tape becomes the usual one-sided infinite tape, and we can easily simulate the original machine on this new machine. Indeed, as long as we are far from the folding point on the tape, all we need to do is to just move in jumps of two (i.e., move L is mapped into move LL). Now, if we reach the beginning of the tape, we need to change between odd location and even location, but that’s also easy to do with a bit of care. We omit the easy but tedious details. Another approach would be to keep the working part of the doubly-infinite tape in its original order. When the machine tries to move off the lefthand end, push everything to the right to make more space.
Allowing the read/write head to stay in the same place is clearly not a significant extension, since we can easily simulate this ability by moving the head to the right, and then moving it back to the left. Formally, we allow transitions to be of the form
δ(q, c) = (q′, d, S),
where S denotes the command for the read/write head to stay where it is (rewriting the character on the tape from c to d).
This does not buy you anything, but the details are not trivial, and we will delay the discussion of this issue to later.
Consider a TM that has k tapes, where k > 1 is a some finite integer constant. Here each tape has its own read/write head, but there is only one finite control. The transition function of this machine, is a function
δ : Q × Γk^ → Q × Γk^ × {L, R, S}k^ ,
and the initial input is placed on the first tape.
By doing this shift-right operation to all the dotted $’s, we end up with a new tape that is guaranteed to have enough space if we decide to write new characters to any of the k tapes of N. Its easy to now verify that we can now simulate N on this Turing machine M , which uses a single tape. In particular, any language that N recognizes is also recognized by M , which is a standard TM, establishing the claim.