0% found this document useful (0 votes)
9 views

Turing

The document discusses Turing machines, which are a model of computation that has an infinite memory tape and a finite set of states. A Turing machine is defined as a 7-tuple that describes its states, alphabet, transition function, and initial/accepting/rejecting states. Turing machines can simulate any computer and are used in theoretical arguments about computation. The document provides examples of Turing machine definitions, configurations, computations, and special types of Turing machines like deciders and recognizers.

Uploaded by

Demon arise
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Turing

The document discusses Turing machines, which are a model of computation that has an infinite memory tape and a finite set of states. A Turing machine is defined as a 7-tuple that describes its states, alphabet, transition function, and initial/accepting/rejecting states. Turing machines can simulate any computer and are used in theoretical arguments about computation. The document provides examples of Turing machine definitions, configurations, computations, and special types of Turing machines like deciders and recognizers.

Uploaded by

Demon arise
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Turing Machines

Introduction

In this lecture we look at the Turing machine model of computation. A Turing machine is a kind of
automaton that is more powerful than a PDA since it has an infinite memory with less restriction on
how the memory is accessed. Turing machines are just as powerful as the computers we use today.
We’ll give some justification for this statement in a later section. Although Turing machines can
seem very difficult to work with in practice, they have the following theoretical advantages.

Turing machines can be easily described in the abstract (as a 7-tuple), which makes them preferable
to work with when developing a theoretical argument about general computation.

Turing machines highlight the two features that yield general computation: a finite control together
with full memory access

Turing machines closely resemble PDA’s by definition, yet are caple of deciding a much wider class
of languages. This suggests the need to examine other sub-computing paradigms other than
those that restrict memory access; hence the recent interest in algebraic models of computation.

Other models of general computation.

Emil Post’s Post Production Systems

Stephen Kleene’s Kleene Recursive Functions

Shepherdson/Sturgis Unlimited Register Machines (URMs)

Alonzo Church λ-calculus

1
Figure 1:

Turing machine definition

A Turing machine consists of a 7-tuple (Q, Σ, Γ, δ, q0 , qa , qr ) where

Q a finite set of states

Σ the finite input alphabet, not including the blank symbol t

Γ the finite tape alphabet, where Σ ⊂ Γ and t ∈ Γ

δ a transition function δ that, given the current state and the tape symbol being read, determines
the machine’s next state, the next tape symbol to be written, and the direction for the tape
head to move. In other words,

δ : Q × Γ → Q × Γ × {L, R}.

q0 ∈ Q the initial state

qa the accepting state

qr the rejecting state

It helps to think of a Turing machine as consisting of a one-way infinite tape (i.e. array) of symbols
from Γ, where at the beginning of the computation the tape consists of input symbols w1 · · · wn ,
followed by an infinite sequence of t symbols. The machine head reads one tape cell and moves
either right or left according to δ. Before moving, it first writes a new symbol on the cell being read.

2
Example 1. The following is a state diagram for a Turing machine that halts in the accept state on
some input iff the input has the form w#w, where w ∈ {0, 1}∗ .

q1

1
R →
x,

#→R
x,
→ R
0

0, 1 → R q2 q8 x→R q3 0, 1 → R

t→R
#→R #→R

x→R q4 qa q5 x→R

0 L

x, x,
L →
1

q6 0, 1, x → L

#→L

q7 0, 1 → L
x→R

3
q1 : x-out the next bit of the left word, or move to q8 if there are no remaining bits

q2 ,q3 ,q6 : look for the pound symbol

q8 : check if there is a remaining bit to the right of #, and accept iff there are no remaining bits

q4 ,q5 : look for the next bit to the right of #, and continue if it matches the previous one x’d out to
the left of #

q7 : search for the nearest x left of #

Simplifying conventions

1. If δ(q, s) is undefined, then we take it to mean δ(q, s) = (qr , s, R) which results in a rejecting
computation.

2. We assume the tape has a buffer symbol $ to the left of the first cell, and that helps indicate
when the head has run off the left side of the tape. In this case the next step is always for the
head to move right to the first tape cell.

4
Given Turing machine M , a configuration for M is a vector ~κ which represents the current state
of the machine, along with its tape contents and tape-head location. Moreover, ~κ has the form
~κ = $c1 · · · cj−1 qcj · · · ck , and is interpreted as follows.

• M is in state q.

• The tape head is reading cell cj .

• The i th tape cell contains symbol ci ∈ Γ, for all 1 ≤ i ≤ k.

• Either k = j or ck is the last cell of the tape that contains a non-blank symbol.

5
Example 2. Given the two Turing-machine tapes below, provide configuration vectors for each tape.
Assume in both cases the machine is in state q3 .


$ t 0 1 t t 1 t ···


$ 1 0 1 t t t t ···

6
Special Turing machine configurations

Initial Configuration has the form ~κ = $q0 w1 · · · wn , where w is the input word

Final Configuration any configuration ~κ = $c1 · · · cj−1 qcj · · · ck , where q is either qa or qr . In


the former case we call it an accepting configuration, while in the latter case we call it a
rejecting configuration.

Turing machine computation

Let M = (Q, Σ, Γ, δ, q0 , qa , qr ) be a Turing machine. Then the Turing machine computation of


M on input w consists of a (possibly infinite) sequence S(M, w) of configurations ~κ0~κ1 , . . . which is
recursively defined as follows.

Base case ~κ0 = $q0 w1 · · · wn is the initial configuration.

Recursive case Assume that ~κi = $c1 · · · cj−1 qcj · · · ck has been defined, q 6∈ {qa , qr }, and δ(q, cj ) =
(q̂, a, D).

Case 1: D=R. Then


~κi+1 = $c1 · · · cj−1 aq̂cj+1 · · · ck
if j < k, and
~κi+1 = $c1 · · · ck−1 aq̂t
if j = k
Case 2: D=L. Then
~κi+1 = $c1 · · · q̂cj−1 acj+1 · · · ck
if j > 1, and
~κi+1 = $q̂ac2 · · · ck
if j = 1.

Moreover, the computation of M on input w is said to be a finite computation if and only if |S(M, w)|
is finite. In this case we say that M halts on input w. Notice also that in this case the final
configuration of S(M, w) must either be accepting or rejecting, in which case we either call S(M, w)
an accepting computation, or a rejecting computation, and say that M accepts or rejects the
input. The language L accepted by M , denoted L(M ), consists of all words w from Σ∗ for which
M accepts w. Such a language is said to be Turing recognizable or recursively enumerable.
Moreover, if M halts on all of its inputs, then L(M ) is said to be Turing decidable or recursive.

7
Example 3. Provide the state diagram for a Turing machine M that accepts all binary words having
an equal number of zeros and ones. Show the computation of M on input 0110.

Solution.

x→R

t→L qa
a

1
R →
x, x,
→ R
0

0, x → R b $→R c 1, x → R

1 L

x, x,
L →
0

0, 1, x → L

8
Example 3 Continued.

Computation of M on input 0110.

1. $a0110

2. $xb110

3. $dxx10

4. d$xx10

5. $axx10

6. $xax10

7. $xxa10

8. $xxxc0

9. $xxdxx

10. $xdxxx

11. $dxxxx

12. d$xxxx

13. $axxxx

14. $xaxxx

15. $xxaxx

16. $xxxax

17. $xxxxat

18. $xxxqa x

9
Special Kinds of Turing Machines
Decider A Turing machine is a decider iff it halts on all inputs.

Recognizer A Turing machine is a recognizer iff it halts on all inputs that it accepts.

Multitape A multitape Turing machine has more than one tape along with a head for each
tape. Moreover, its transition function simultaneously controls each of its heads. Indeed, if
M has k > 0 tapes, then its transition function δ accepts k + 1 inputs (one state and k read
symbols) and provides a (2k + 1)-tuple output (one next state, k write symbols, and k head
directions).

Nondeterministic A nondeterministic Turing machine is one whose δ-transition function is


now defined as
δ : Q × Γ → P(Q × Γ × {L, R}),
meaning that, for a given configuration, there could be more than one next configuration.

Enumerator An enumerator Turing machine M starts with a blank tape, and has an extra
write-only tape on which it is capable of writing a potentially infinite set L of words. In this
case we say that L is enumerated by M .

Universal A Turing machine U is said to be universal iff for any input hM, wi, where M is a
Turing machine and w is some input word for M , then U (w) = M (w). Note: here we are
restricting M so that its input alphabet is the same as U ’s. Examples of universal Turing
machines include a computer operating system and a human who is capable of following a
Turing-machine computation using pencil and paper.

Transducer A Turing machine T is called a transducer if it serves the purpose of computing a


function f : Σ∗ → Σ∗ , where Σ is the machine’s input alphabet. The main difference between
a transducer and a decider is that, instead of having accept and reject states qa and qr , T has
a single halt state qh . Similar to a decider, on input w ∈ Σ∗ , the computation begins with
an initial configuration and produces a sequence of configurations by folllowing T ’s transition
function. If the halt state is never reached, then f (w) is undefined. Otherwise, f (w) is defined
by examining the final halting configuration, and setting f (w) equal to the longest tape prefix
in Σ∗ . For example, if the final configuration has tape contents 01100010tt01101t · · · , then
f (w) = 01100010, since t 6∈ Σ. In other words, the output ends with the first instance of a
blank cell.

10
Example 4. Provide a program for a Turing machine that starts with a blank input tape and
proceeds to generate eight different configurations, with each configuration having the form wq3 t,
where w ∈ {0, 1}3 and no two configurations have the same binary word.

11
Church-Turing Thesis

The Church-Turing Thesis states that any problem that can be solved via some step-by-step
algorithm can be solved by a Turing machine.

Because of the Church-Turing thesis, we may use other algorithmic means besides the Turing machine
to describe an algorithm. With that said, there are occasions when we will need to work with Turing
machines. One such occasion occurs when we need to be more precise about how many computation
steps or how much memory is being used by the algorithm. Such quantities can be readily computed
for a Turing machine. Another occasion occurs when we need to provde something about an arbitrary
program or algorithm. In this case we may assume that the program is described by a Turing machine.

12
Exercises
1. Provide the state diagram for a Turing machine M that accepts all binary palindromes. Provide
the sequence of configurations that comprises the computation of M on input 01110.

2. Provide the state diagram for a Turing machine that accepts all inputs of the form x#y, where
x, y ∈ {0, 1}+ , |x| = |y|, and x ≥ y when x and y are viewed as binary numbers.

3. Provide the state diagram for a Turing machine that accepts the language

L = {x = y + z|x, y, z ∈ {0, 1}+ and x = y + z}.

For example 101 = 11 + 10 ∈ L since

(5)2 = (3)2 + (2)2 .

4. Provide the state diagram for a Turing machine that accepts the language

L = {x = y + z|x, y, z ∈ {0, 1}+ and x = y − z}.

For example 11 = 101 − 10 ∈ L since

(3)2 = (5)2 + (2)2 .

5. Provide the state diagram for a Turing machine that, on input x ∈ {0, 1}+ , replaces x with x
1’s. Here, we are thinking of x as a binary number. For example, $1001 would be replaced with
$111111111, while $00 is replaced with $.

6. For the Turing machine M with state diagram shown below, draw the computation tree
T (M, 001). Is this an accepting computation? Explain.
0 → 1, L
0 → 1, R
0→R
a b c
0 → 1, L
L 1
1 → 0, R

1, →
t→L

→ R 1→R
0

1→R
d e f
0→R
1 → 0, L

13

You might also like