0% found this document useful (0 votes)
142 views14 pages

Complexity Theory - Chapter 1 - Introduction

The document provides an introduction to Turing machines as a theoretical model of computation. It discusses how Turing machines can simulate any computation and defines the standard components of a Turing machine, including the finite control unit, tape, read/write head, states, and transition function. The key points are that Turing machines operate through discrete steps of reading/writing symbols on the tape and changing state based on the symbol and current state, allowing them to solve computational problems in a mathematically precise way.

Uploaded by

Maki Erku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views14 pages

Complexity Theory - Chapter 1 - Introduction

The document provides an introduction to Turing machines as a theoretical model of computation. It discusses how Turing machines can simulate any computation and defines the standard components of a Turing machine, including the finite control unit, tape, read/write head, states, and transition function. The key points are that Turing machines operate through discrete steps of reading/writing symbols on the tape and changing state based on the symbol and current state, allowing them to solve computational problems in a mathematically precise way.

Uploaded by

Maki Erku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

CHAPTER ONE

Turing Machine(TM)
1 Introduction to Computational Complexity
Throughout history people had a notion of a process of producing an output from a set of
inputs in a finite number of steps, and they thought of “computation” as “a person writing numbers
on a scratch pad following certain rules.”
After their success in defining computation, researchers focused on understanding what
problems are computable. They showed that several interesting tasks are inherently uncomputable:
No computer can solve them without going into infinite loops (i.e., never halting) on certain inputs.
Computational complexity theory focuses on issues of computational efficiency — quantifying the
amount of computational resources required to solve a given task. We will quantify the efficiency of
an algorithm by studying how its number of basic operations scales as we increase the size of the
input.
Consider the following hypothetical question: First, Is it harder to multiply than to add?
Second, why? We can see that there is no algorithm for multiplication computationaly as simple as
that of addition, and this proves of something a stumbling block. For multiplication of two n-digit
numbers there are two methods (algorithms): Repeated addition and Grade-School algorithm. For
this discussion, let the basic operations be addition and multiplication of single digits. (In other
settings, we may wish to throw in division as a basic operation.)
Using repeated addition: to compute a · b, just add a to itself b − 1 times. The grade-school
algorithm for computing 577 · 423 is illustrated below:
577
423
1731
1154
2308
244071
Though the repeated addition algorithm is perhaps simpler than the grade-school algorithm,
we somehow feel that the latter is better. Indeed, it is much more efficient. For example,
multiplying 577 by 423 using repeated addition requires 422 additions, whereas doing it with the
grade-school algorithm takes 3 multiplications of a number by a single digit and 3 additions.
In the case of multiplication and addition the size of the input is the number of digits in the
numbers. The number of basic operations used to multiply two n-digit numbers (i.e., numbers
between 10n−1and 10n) is at most 2n2 for the grade-school algorithm and at least n10n−1for repeated
addition.
The huge difference between the two algorithms is apparent: Even for 11-digit numbers, a
simple pocket calculator running the grade-school algorithm would beat the best supercomputer
running the repeated addition algorithm. We see that the efficiency of an algorithm is to a
considerable extent much more important than the technology used to execute it.
Computation is a mathematically precise notion. We will typically measure the
computational efficiency of an algorithm as the number of basic operations it performs as a function
of its input length. That is, the efficiency of an algorithm can be captured by a function T from the
1
set N of natural numbers to itself, i.e., T: N→N, such that T(n) is equal to the maximum number of
basic operations that the algorithm performs on inputs of length n. For the grade-school algorithm
we have at most T(n) = 2n2and for repeated addition at least T(n) = n10n-1.
Throughout history people have been solving computational tasks using a wide variety of
methods, ranging from intuition and “eureka” moments to mechanical devices such as abacus or
sliderules to modern computers. How can we find a simple mathematical model that captures all of
these ways to compute?
Surprisingly enough, it turns out that there is a simple mathematical model that suffices for
studying many questions about computation and its efficiency—the Turing machine. It suffices to
restrict attention to this single model since it seems able to simulate all physically realizable
computational methods with little loss of efficiency. Thus the set of “efficiently solvable”
computational tasks is at least as large for the Turing machine as for any other method of
computation. One possible exception is the quantum computer model, but we do not currently
know if it is physically realizable. In the following sections we discuss about the theoretical
computational model of computing – the Turing Machine(TM).

2 Standard Turing Machine(TM)


For thousands of years, the term “computation” was understood to mean application of
mechanical rules to manipulate numbers, where the person/machine doing the manipulation is
allowed a scratch pad on which to write the intermediate results. The Turing machine is a concrete
embodiment of this intuitive notion. It can be also viewed as the equivalent of any modern
programming language — albeit one with no built-in prohibition on its memory size.
Here we describe this model informally as follows. Let f be a function that takes a string of
bits (i.e., a member of the set {0,1}*) and outputs either 0 or 1. An algorithm for computing f is a set
of mechanical rules, such that by following them we can compute f(x) given any input x ∈ {0,1}*.
The set of rules being followed is fixed (i.e., the same rules must work for all possible inputs)
though each rule in this set may be applied arbitrarily many times. Each rule involves one or more
of the following “elementary” operations:
1. Read a bit of the input.
2. Read a bit (or possibly a symbol from a slightly larger alphabet, say a digit in the set {0, . . .
, 9}) from the scratch pad or working space we allow the algorithm to use.
Based on the values read,
1. Write a bit/symbol to the scratch pad.
2. Either stop and output 0 or 1, or choose a new rule from the set that will be applied next.
Finally, the running time is the number of these basic operations performed. We measure it
in asymptotic terms, so we say a machine runs in time T(n) if it performs at most T(n) basic
operations time on inputs of length n.
In automata theory course we have seen that neither finite automata nor pushdown automata
can be regarded as truly general models for computers, since they are not capable of recognizing
even such simple languages as {anbncn : n ≥ 0}. In this course we take up the study of devices that
can recognize this and many more complicated languages. Although these devices, called Turing
2
machines named after their inventor Alan Turing (1912-1954), are more general than the automata
previously studied, their basic appearance is similar to those automata.
A Turing machine consists of a finite control, a tape, and a head that can be used for
reading or writing on that tape. The formal definitions of Turing machines and their operation are in
the same mathematical style as those used for finite and pushdown automata. So in order to gain the
additional computational power and generality of function that Turing machines possess, we shall
not move to an entirely new sort of model for a computer.
The important points to remember by way of introduction are that Turing machines are
designed to satisfy simultaneously these three criteria:
(a) They should be automata; that is, their construction and function should be in the same
general spirit as the devices/machines previously studied.
(b) They should be as simple as possible to describe, define formally, and reason about.
(c) They should be as general as possible in terms of the computations they can carry out.
Now let us look more closely at these machines. In essence, a Turing machine consists of a
finite-state control unit and a tape (see Figure 1). Communication between the two is provided by a
single Read/Write head, which reads symbols from the tape and is also used to change the symbols
on the tape. The control unit operates in discrete steps; at each step it performs two functions in a
way that depends on its current state and the tape symbol currently scanned by the read/write head:
1. Put the control unit in a new state.
2. Either:
(a) Write a symbol in the tape square currently scanned, replacing the one already there; or
(b) Move the read/write head one tape square to the left or right.

.... □ □ a b a a □ □ .....
Tape

Read/Write head
(Moves in both directions)
q0

h
Finite Control
q1

q3
q2

Figure 1: A Turing Machine consisting of a Tape, R/W head and a finite control.

Formal Definition of a Standard Turing Machine


Definition: A Turing machine M is a 7-tuple, namely (Q, , , δ, □, s, H), where

Q is a finite nonempty set of states;

3
  is a finite nonempty set of tape symbols;
□  is the blank symbol; □ 
 is a nonempty set of input symbols and is subset of and □ ;
s is the initial state; s Q
H is the set of halting/final states; H ⊆
δ is the transition function, is a function from Q to Q {L, R}, that is
a mapping (q, x) onto (q', y, D) where D denotes the direction of movement
of R/W head: D = L or R according as the movement is to the left or right.
Note: (1) The acceptability of a string is decided by the reach ability from the initial state to some
final state. So the final states are also called the accepting states.
(2)  may not be defined for some elements of Q .
Example-1: Consider the following Turing Machine
M = (Q, , , δ, □, s, H), where
Q = {q0, q1, h},
a, □
∑ = {a},
s = q0,
H = {h},
And δ (the transition function) is given by the following table.

q, σ δ(q, σ)

q0 a (q1, □, R)
q0 □ (h, □)
q1 a (q0, □, R )
q1 □ (q0, □,L)
Table 1: for the transition table
When M is started in its initial state q0, it scans its head to the right, changing all a's to □'s as it
goes, until it finds a tape square already containing □; then it halts. (Changing a nonblank symbol to
the blank symbol will be called erasing the nonblank symbol.) To be specific, suppose that M is
started with its head scanning the first of four a's, the last of which is followed by a □. Then M will
go back and forth between states q0 and q1 four times, alternately changing an a to a □ and moving
the head right; the first and fourth lines of the table for δ are the relevant ones during this sequence
of moves. At this point, M will find itself in state q0 scanning □ and, according to the second line of
the table, will halt.
Example2: Consider the Turing machine defined by

4
And

If this Turing machine is started in state q0 with the symbol a under the read-write head, the
applicable transition rule is δ (q0,a)= (q0,b,R). Therefore, the read-write head will replace a with b,
then move right on the tape. The machine will remain in state q0. Any subsequent a will also be
replaced with a b, but b's will not be modified. When the machine encounters the first blank, it will
move left one cell, and then halt in final state q1.
The figure 2 below shows several stages of the process for a simple initial configuration.

Figure 2: A sequence of moves.


As before, we can use transition graphs to represent Turing machines. Now we label the edges of
the graph with three items: the current tape symbol, the symbol that replaces it, and the direction in
which the read-write head is to move. The Turing machine in Example 2 is represented by the
transition graph in Figure3 below.

5
Figure 3: Transition graph
We now formalize the operation of a Turing machine. As we have the “productions” as the
control theme of a grammar, the “transitions” or “moves” are the central theme of a Turing
machine. These transitions are given as a table or list of 5-tuples, where each tuple has the form:
(current-state, symbol-read, symbol-written, direction, next-state)
Creating such a list is called “implementation description” or “programming” of a Turing machine.
A Turing machine is often defined to start with the read/write head positioned over the first
(leftmost) input symbol.
To specify the status of a Turing machine computation, we need to specify the state, the
contents of the tape, and the position of the head. Since all but a finite initial portion of the tape will
be blank, the contents of the tape can be specified by a finite string. These considerations lead us to
the following ways of describing Turing Machines.
Since one can make several different definitions of a Turing machine, it is worthwhile to summarize
the main features of our model, which we will call a standard Turing machine:
1. The Turing machine has a tape that is unbounded in both directions, allowing any number of
left and right moves.
2. The Turing machine is deterministic in the sense that δ defines at most one move for each
configuration.
3. There is no special input file. We assume that at the initial time the tape has some specified
content. Some of this may be considered input. Similarly, there is no special output device.
Whenever the machine halts, some or all of the contents of the tape may be viewed as
output.

Representation of Turing Machines


We can describe a Turing machine by employing (i) instantaneous descriptions using move-
relations (├ ). (ii) Transition table. And (iii) transition diagram (transition graph).

Representation of TM by Instantaneous Descriptions:


'Snapshots' of a Turing machine in action can be used to describe a Turing machine. These
give 'instantaneous descriptions' of a Turing machine. So an ID of a Turing machine is defined in
terms of the entire input string and the current state.
Definition: An ID of a Turing machine M is a string x1qx2, where q is the present state of M,

6
the entire input string is split as x1x2 , the first symbol of x2 is the current symbol a under the R/W
head and x2 has all the subsequent symbols of the input string, and the string x2 is the substring of
the input string formed by all the symbols to the left of a.
Example: A snapshot of Turing machine is shown in figure below. Obtain the instantaneous
description.
x1 x2

..... □ □ a4 a1 a2 a1 a2 a2 a a4 a2 □ □ .......
Tape

R/W head

State
q

Figure 4: A Snapshot of Turing Machine


Solution:
The present symbol under the R/W head is a. The present state is q. So a is written to the
right of q. The nonblank symbols to the left of a form the string a4a1a2a1a2a2, which is written to the
left of q. The sequence of nonblank symbols to the right of a is a4a2. Thus the ID is as given in the
figure below.

a4a1a2a1a2a2 q a a4a2

left sequence right sequence

Present state Symbol under R/W head

Figure 5: Representation of ID

Note: (1) For constructing the ID, we simply insert the current state in the input string to the left of
the symbol under the R/W head.
(2) We observe that the blank symbol may occur as part of the left or right substring.
The instantaneous description gives only a finite amount of information to the right and left of the
read-write head. The unspecified part of the tape is assumed to contain all blanks; normally such
blanks are irrelevant and are not shown explicitly in the instantaneous description. If the position of
blanks is relevant to the discussion, however, the blank symbol may appear in the instantaneous
description. For example, the instantaneous description q ω indicates that the read-write head is on
the cell to the immediate left of the first symbol of w and that this cell contains a blank.
Moves in Turing Machine
As in the case of pushdown automata, δ(q, x) induces a change in ID of the Turing Machine.
We call this change in ID a move.
Suppose δ(q, xj) = (p, y, L). The input string to be processed is x1x2 . . . xn, and the present
symbol under the R/W head is xi. So the ID before processing xiis
x1 x2 . . . xi-1 q xi . . . xn
After processing xi, the resulting ID is

7
x1 x2 . . . xi-2 p xi-1 y xi+1. . . xn
This change of ID is represented by
x1 x2 . . . xi-1 q xi . . . xn ├ x1 x2 . . . xi-2 p xi-1 y xi+1. . . xn
If i = 1, the resulting ID is py x2 x3. . . xn .
Suppose δ(q, xj) = (p, y, L), then the change of ID is represented by
x1 x2 . . . xi-1 q xi . . . xn ├ x1 x2 . . . xi-1 y p xi+1. . . xn
If i = n, the resulting ID is x1 x2 . . . xn-1 y p □ .

We can denote an ID by Ij for some j. Ij├ Ik defines a relation among IDs. So the symbol ├*
denotes the reflexive – transitive closure of the relation ├. In particular, Ij├* Ij. Also, if I1├* In,
then we can split this as I1 ├ I2 ├ I3 ├ . . . . ├ In for some IDs, I2, . . . , In-1.

Note: The description of moves by IDs is very much useful to represent the processing of input
strings.

Representation of TM by Transition Table:


We give the definition of transition function δ in the form of a table called the transition
table. If δ(q, a) = (γα β), we write αβγ under the α– column and in the q–row. So if we get
αβγ in the table, it means that αis written in the current cell, β gives the movement of the head (L
or R) and γ denotes the new state into which the Turing machine enters.
Consider, for example, a Turing machine with five states q1, ..., q5, where ql is the initial
state and q5 is the (only) final state. The tape symbols (are 0, 1 and □. The transition table given
in the Table below describes δ.
Present State Tape Symbol
□ 0 1
→q1 1 L q2 0 R q1 -
q2 □ R q3 0 L q2 1 L q2
q3 - □ R q4 □ R q5
q4 0 R q5 0 R q4 1 R q4
0 L q2
q5

Table 1: Transition Table of a Turing Machine


Note: The initial state is marked with → and the final state is marked with .

Example 3: Consider the TM description given in Table 1. Draw the computation sequence of
the input string 00.
Solution:

8
We describe the computation sequence in terms of the contents of the tape and the current
state. If the string in the tape is a1a2 . . . aj aj+1 . . . am and the TM in state q is to read aj+ 1, then we
write a1a2 . . . aj q aj+1 . . . am
For the input string 00□, we get the following sequence:
q100□├ 0q10□├ 00q1□├ 0q201├ q2001
├ q2□001├□q3001 ├□□q401├ □□0q41├ □□01q4□
├ □□010q5├□□01q200├□□0q2100├ □□q20100
├ □q2□0100 ├ □□q30100 ├ □□□q4100 ├ □□□1q400
├ □□□10q40 ├ □□□100q4□ ├ □□□1000q5□
├ □□□100q200 ├ □□□10q2000 ├ □□□1q20000
├ □□□q210000 ├ □□q2□10000 ├ □□□q310000 ├ □□□□q50000

Representation of TM by Transition Diagram:


We can use the transition systems (diagrams) to represent Turing machines. The states are
represented by vertices. Directed edges are used to represent transition of states. The labels are
triples of the form α,β,γ, where α,βΓ (where Γ is set of tape symbols)and  γ{L, R}.
When there is a directed edge from qi to qj with label α,β,γ,, it means that

δ(qi,α ) = (qj, β,γ)


During the processing of an input string, suppose the Turing machine enters qi and the R/W
head scans the (present) symbol . As a result the symbol is α written in the cell under the R/W
head. The R/W head moves to the left or to the right depending on γ, and the new state is qj.
Every edge in the transition system can be represented by a 5-tuple (qi,α,β,γ, qj ). So each
Turing machine can be described by the sequence of 5-tuples representing all the directed edges.
The initial state is indicated by → and any final state is marked with .
Example: M is a Turing machine represented by the transition system in figure below. Obtain
the computation sequence of M for processing the input string 0011.

(□, □, R)

(y, y, R)
(y, y, R) (y, y, L)
(x, x, R) (□,□,R)
(0, x, R)
q2 q3 q5 q6
q1
(1, y, L)

(x, x, R) (0, 0, R) (0, 0, L)


q4

Figure 4: Transition Diagram for M.


(0, 0, L)

9
Solution: The initial tape input is □0011□. Let us assume that M is in state qj and the R/W head
scans 0 (the first 0). We can represent this as in Figure 5.

□ 0 0 1 1 □
Tape
R/W head
State
q
Figure 5: TM processing 0011
The figure can be represented by

□0011□
q1
From Figure 4 we see that there is a directed edge from q1 to q2 with the label (0. x, R). So
the current symbol 0 is replaced by x and the head moves right. The new state is q2. Thus. we get

□x 011□
q2
The change brought about by processing the symbol 0 can be represented as

(0, x, R)
□0011□ □x011□
q1 q2
The entire computation sequence reads as follows:

(0, x, R) (0, 0, R)
□0011□ □x 011□ □x 011□
q1 q2 q2

(1, y, L) (0, 0, L) (x, x, R)


□x0y1□ □x0y1□ □x0y1□
q3 q4 q1

(0, x, R) (y, y, R) (1, y, L)


□xxy1□ □xxy1□ □xxyy□
q2 q2 q3

(y, y, L) (x, x, R) (y, y, R)


□xxyy□ □xxyy□ □xxyy□
q3 q5 q5

(y, y, R) (□, □,
□xxyy□ □xxyy□□
q5 q6

10
3 Construction of Turing Machine(TM)
Designing a Turing machine to solve a problem is an interesting task. It is somewhat similar
to programming. Given a problem, different Turing machines can be constructed to solve it. But we
would like to have a Turing machine which does it in a simple and efficient manner. Like we learn
some techniques of programming to deal with alternatives, loops etc, it is helpful to understand
some techniques in Turing machine construction, which will help in designing simple and efficient
Turing machines. It should be noted that we are using the word ‘efficient’ in an intuitive manner
here.

Variants of Turing Machines


N-Track Turing Machine
An N-track Turing Machine is one in which each square of the tape holds an ordered n-tuple
of symbols from the tape alphabet. This can be thought of as a Turing machine with multiple tape
heads, all of which move in lock-step mode.
“N-Track Turing machines are equivalent to standard Turing machines”.
Semi-Infinite Tape Turing Machine
A Turing machine may have a “semi-infinite tape”, the nonblank input is at the extreme left
end of the tape and it is infinite in length to the right.
“Turing machines with semi-infinite tape are equivalent to Standard Turing machines”.
Offline Turing Machine
An “Offline Turing Machine” has two tapes. One tape is read-only and contains the input,
the other is read-write and is initially blank.
“Offline Turing machines are equivalent to Standard Turing machines”.
Multi-tape Turing Machine
A “Multi-tape Turing Machine” has a finite number of tapes, each with its own
independently controlled tape head. A multitape TM has a finite set Q of states, an initial state q0, a
subset F of Q called the set of final states, a set P of tape symbols, a new symbol b not in P called
the blank symbol. (We assume that and b)
There are k tapes, each divided into cells. The first tape holds the input string w. Initially, all
the other tapes hold the blank symbol.
Initially the head of the first tape (input tape) is at the left end of the input w. All the other
heads can be placed at any cell initially.
 is a partial function from Qk into Qk{L, R, S}k. We use implementation
description to define . Figure 6 represents a multitape TM. A move depends on the current state
and k tape symbols under k tape heads.

11
Finite
Control

..... .....

..... .....

...... ......
Figure 6: Multitape Turing machine
In a typical move:
(i) M enters a new state.
(ii) On each tape, a new symbol is written in the cell under the head.
(iii) Each tape head moves to the left or right or remains stationary. The heads move
independently: some move to the left, some to the right and the remaining heads
do not move.
The initial ID has the initial state q0, the input string w in the first tape (input tape), empty
strings of b's in the remaining k - 1 tapes. An accepting ID has a final state, some strings in each of
the k tapes.
“Multi-tape Turing Machines are equivalent to Standard Turing Machines”.
Excercise: Prove that, Every language accepted by a multitape TM is acceptable by some
single-tape TM (that is, the standard TM).
Excercise: Prove that, If M1 is the single-tape TM simulating multitape TM M, then the time
taken by M1 to simulate n moves of M is (n2).

Nondeterministic Turing Machines


In the case of standard Turing machines (hereafter we refer to this machine as deterministic
TM), (q, a) was defined (for some elements of Qas an element of Q{L, R}. Now we
extend the definition of . In a nondetemlinistic TM,(q1, a) is defined as a subset of Q {L, R}.
Defmition: A nondeterministic Turing machine is a 7-tuple (Q, q0, □, F) where
1. Q is a finite nonempty set of states
2.  is a finite nonempty set of tape symbols
3. □ is called the blank symbol
4.  is a nonempty subset of called the set of input symbols. We assume that □ .
5. q0 is the initial state
6. F  Q is the set of final states
7.  is a partial function from Q into the power set of Q{L, R}.

12
Note: If q  Q and x  and (q, x) = {(ql, y1, D1), (q2, y2, D2), . . ., (qn, yn, Dn)} then the NDTM
can chose anyone of the actions defined by (qi, yi, Di) for i = 1, 2, . . ., n.
We can also express this in terms of ├ (move) relation. If (q, x) = {(qi, yi, Di) i = 1, 2, . . .,
n} then the ID zqxw can change to anyone of the n IDs specified by the n-element set (q, x).
Suppose (q, x) = {(q1, y1, L), (q2, y2, R), (q3, y3, L)}. Then
z1z2 . . . zkqxzk+1 . . . zn├z1z2 . . . zk-1q1zky1zk+1. . . zn
or z1z2 . . . zkqxzk+1 . . . zn├ z1z2 . . . zky2q2zk+1. . . zn
or z1z2 . . . zkqxzk+1 . . . zn├ z1z2 . . . zk-1q3zky3zk+1. . . zn
So on reading the input symbol, the NDTM M whose current ID is z1z2 . . . zkqxzk+1 . . . zn
can change to any one of the three IDs given earlier.
Remark: When (q, x) = {(qi, yi, Di) i = 1, 2, . . ., n} the NDTM chooses any one of the n
triples totally (that is, it cannot take a state from one triple, another tape symbol from a second triple
and a third D(L or R) from a third triple, etc.)
Definition: w is accepted by a nondeterministic TM M if q0w├* xqfy for some final
state qf.
Note: As in the case of NDFA, an ID of the fonn xqy (for some q F) may be reached as the result
of applying the input string w. But w is accepted by M as long as there is some sequence of
moves leading to an ID with an accepting state. It does not matter that there are other
sequences of moves leading to an ID with a nonfinal state or TM halts without processing
the entire input string.
Excercise: Prove that, If M is a nondeterministic TM, there is a deterministic TM M1 such that
T(M) = T(M1).
Definition: Let M be a TM and w an input string. The running time of M on input w, is
the number of steps that M takes before halting. If M does not halt on an input string w, then the
running time of M on w is infinite.
Note: Some TMs may not halt on all inputs of length n. But we are interested in computing the
running time, only when the TM halts.
Definition: The time complexity of TM M is the function T(n), n being the input size,
where T(n) is defined as the maximum of the running time of M over all inputs w of size n.
Techniques in Construction of Turing Machines
The basic guidelines for designing a Turing machine are:
i) The fundamental objective in scanning a symbol by the R/W head is to know what
to do in the future. The machine must remember the past symbols scanned. The
Turing machine can remember this by going to the next unique state.
ii) The number of states must be minimized. This can be achieved by changing the
states only when there is a change in the written symbol or when there is a change
in the movement of the R/W head.

13
Exercises
1. Design a Turing machine to recognize all strings consisting of an even number of 1's.
2. Design a Turing machine over {1, □}which can compute a concatenation function over Σ =
{1}. If a pair of words (w1, w2) is the input. the output has to be w1w2.
3. Design a TM that accepts {0n1n | n ≥ 1}.
4. Design a Turing machine M to recognize the language {1n2n3n | n ≥ 1}.
5. Design a Turing machine that accepts the set of all even palindromes over {0,1}.
6. Design a Turing machine to add two given integers.
7. Design a TM that copies strings of l's? Find the computation sequence for the input w = 111.
8. Design a TM that reads a string in {0, 1}* and erases the rightmost symbol.

14

You might also like