Automata Theory & Computability [18CS54 CBCS]
MODULE 4
Algorithms and Decision Procedures for CFLs: Decidable questions, Un-decidable questions.
Turing Machine: Turing machine model, Representation, Language acceptability by TM, design of
TM, Techniques for TM construction. Variants of Turing Machines (TM), The model of Linear
Bounded automata. Textbook 1: Ch 14: 14.1, 14.2, Textbook 2: Ch 9.1 to 9.8
Algorithms and Decision Procedures for CFLs
4.1 The Decidable and undecidable Questions
Membership
Given a context free language L and a string w, there exists a decision procedure that answers
the questions, is w in L?
• Two alternative approaches to solve this problem
1 Use a Grammar
2 Use a PDA
1. Using a Grammar to Decide
• Algorithm for deciding whether a string w is in a language L:
decideCFLusingGrammar(L: CFL, w: string) =
1. If L is specified as a PDA, use PDAtoCFG to construct a grammar G such that L( G ) = L (M ).
2. If L is specified as a grammar G, simply use G.
3. If w =ε then if SG is nullable then accept, otherwise reject.
4. If w ≠ ε then:
4.1. From G, construct G' such that L(G')=L(G)-{ε} and G' is in Chomsky normal form.
4.2. If G derives w, it does so in (2 * |w| - 1) steps. Try all derivations in G of that number of
steps. If one of them derives w, accept. Otherwise reject.
The running time of decideCFLusingGrammar can be analyzed as follows: We assume that the time
required to build G' is constant, since it does not depend on w. Let n = |w|. Let g be the search-
branching factor of G', defined to be the maximum number of rules that share a left-hand side. Then
the number of derivations of length 2n – 1 is bounded by g2n - 1, and it takes at most 2n - 1 steps to
check each one. So the worstcase running time of decideCFLusingGrammar is 0(n2n).
2. Using a PDA to Decide
It is also possible to solve the membership problem using PDAs.
A two-step approach. :
• We first show that, for every context-free language L, it is possible to build a PDA that accepts
L-{ε} and that has no ε-transitions.
• Then we show that every PDA with no ε-transitions is guaranteed to halt.
• While not all PDAs halt, it is possible for any context-free language L, to craft a PDA M that is
guaranteed to halt on all inputs and that accepts all strings in L and rejects all strings that are
not in L.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 1
Automata Theory & Computability [18CS54 CBCS]
cfgtoPDAnoeps( G: context-free grammar) =
1.Convert G to Greibach normal form, producing G'.
2. From G' build the PDA M.
Step 2 can be implemented as follows
4.2 Halting Behavior of PDAs without ε-Transitions
Theorem: Let M be a PDA that contains no transitions of the form ((q1, ε, s1), (q2, s2)). i.e. no ε-
transitions. Consider the operation of M on input w∈ Σ*. M must halt and either accept or reject
w. Let n = |w|.
We make three additional claims:
a) Each individual computation of M must halt within n steps.
b) The total number of computations pursued by M must be less than or equal to bn, where b is the
maximum number of competing transitions from any state in M.
c) The total number of steps that will be executed by all computations of M is bounded by nbn.
Proof:
a) Since each computation of M must consume one character of w at each step and M will halt
when it runs out of input, each computation must halt within n steps.
b) M may split into at most b branches at each step in a computation. The number of steps in a
computation is less than or equal to n. So the total number of computations must be less than or
equal to bn.
c) Since the maximum number of computations is bn and the maximum length of each is n, the
maximum number of steps that can be executed before all computations of M halt is nbn.
So a second way to answer the question, "Given a context-free language L and a string w, is w in
L ?" is to execute the following algorithm:
decideCFLusingPDA(L: CFL, w: string) =
1. If L is specified as a PDA, use PDAtoCFG, to construct a grammar G such that L (G) = L (M).
2. If L is specified as a grammar G, simply use G.
3. If w = ε then if SG is nullable then accept, otherwise reject.
4. If w ≠ ε then:
4.1. From G, construct G' such that L (G') = L(G)-{ε} and G' is in Greibach normal form.
4.2. From G' construct, using cfgtoPDAnoeps, a PDA M' such that L(M') = L(G') and M'
has no ε-transitions.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 2
Automata Theory & Computability [18CS54 CBCS]
4.3. We have proved previously that, all paths of M' are guaranteed to halt within a finite
number of steps. So run M' on w, Accept if M' accepts and reject otherwise.
4.3 Emptiness and Finiteness
Theorem: Decidability of Emptiness and Finiteness
Theorem: Given a context-free language L, there exists a decision procedure that answers each
of the following questions:
1. Given a context-free language L, is L =⦰?
2. Given a context-free language L, is L infinite?
Since we have proven that there exists a grammar that generates L iff there exists a PDA that accepts
it, these questions will have the same answers whether we ask them about grammars or about PDAs.
Proof :
decideCFLempty( G: context-free grammar) =
1. Let G' = removeunproductive (G).
2. If S is not present in G' then return True else return False.
decideCFLinfinite(G: context-free grammar) =
1. Lexicographically enumerate all strings in Σ* of length greater than bn and less than or equal to
bn+1+ bn.
2. If, for any such string w, decideCFL(L, w) returns True then return True. L is infinite.
3. If, for all such strings w, decideCFL(L, w) returns False then return False. L is not infinite.
4.4 Turing Machine(TM)
• The Turing machine was invented in 1936 by Alan Turing, who called it an "a-machine"
(automatic machine). A Turing machine is a mathematical model of computation that defines
an abstract machine.
• A Turing machine is very powerful (abstract) machines that could simulate any modern day
computer. Why to design such a machine? If a problem cannot be “solved” even using a TM,
then it implies that the problem is undecidable. TM helps us to deal with Computability and
Decidability of a given problem.
• Church-Turing Thesis: Any algorithm that can be performed on any computing machine can be
performed on a Turing machine as well.
• The Turing machine provides an ideal theoretical model of a computer.
• Turing machines are useful in several ways:
▪ As an automaton, the Turing machine is the most general model; it accepts type-0
languages.
▪ It can also be used for computing functions. It turns out to be a mathematical model of
partial recursive functions.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 3
Automata Theory & Computability [18CS54 CBCS]
▪ Turing machines are also used for determining the undecidability of certain languages
and measuring the space and time complexity of problems.
• Turing assumed that while computing, a person writes symbols on a one-dimensional paper
(instead of a two dimensional paper as is usually done) which can be viewed as a tape divided into
cells. One scans the cells one at a time and usually performs one of the three simple operations,
namely:
(i) writing a new symbol in the cell being currently scanned,
(ii) moving to the cell left of the present cell, and
(iii) moving to the cell right of the present cell.
4.4.1 Turing machine model
The Turing machine can be thought of as finite control connected to a R/W head. It has one
tape which is divided into a number of cells. The block diagram of the basic model for the Turing
machine is given below:
Figure : Turing machine model
• Each cell can store only one symbol.
• The input to and the output from the finite state automaton are affected by the R/W head which can
examine one cell at a time.
• In one move, the machine examines the present symbol under the R/W head on the tape and the
present state of an automaton to determine:
a. a new symbol to be written on the tape in the cell under the R/W head,
b. a motion of the R/W head along the tape: either the head moves one cell left (L), or one cell
right (R).
c. the next state of the automaton, and
d. whether to halt or not.
Definition of TM: Turing machine M is a 7-tuple, namely (Q, Σ, 𝚪, 𝛅, q0, b, F), where
1. Q is a finite nonempty set of states.
2. 𝚪 is a finite nonempty set of tape symbols,
3. b ∈𝚪 is the blank
4. Σ is a nonempty set of input symbols and is a subset of 𝚪 and b ∉ Σ.
5. 𝛅 is the transition function 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.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 4
Automata Theory & Computability [18CS54 CBCS]
6. q0∈ Q is the initial state, and
7. F⊆ Q is the set of final states.
Note: The acceptability of a string is decided by the reachability from the initial state to some final
state. So the final states are also called the accepting states. 𝛅 may not be defined for some elements of
Q X 𝚪.
4.5 Representation of Turing Machines
We can describe a Turing machine employing
(i) Instantaneous descriptions using move-relations.
(ii) Transition table, and
(iii) Transition diagram (Transition graph).
4.5.1 Instantaneous Descriptions (ID)
Definition: An ID of a Turing machine M is a string 𝛼𝛽𝛾, where 𝛽 is the present state of M, the entire
input string is split as 𝛼𝛾, the first symbol of 𝛾 is the current symbol a under the R/W head and 𝛾 has
all the subsequent symbols of the input string, and the string 𝛼 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 below Figure
Figure : Snapshot of Turing machine
The present symbol under the R/W head is a1. The present state is q3. so a1 is written to the right of q3.
The non blank symbols to the left of a1 form the string a4a1a2a1a2a2, which is written to the left of q3.
The sequence of nonblank symbols to the right of a1 is a4a2. Thus The ID is as given in below Figure
Figure: Representation of Instantaneous Descriptions
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 5
Automata Theory & Computability [18CS54 CBCS]
Moves in TM:
Suppose (q, Xi) = (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 Xi is X1X2…Xi-1qXiXi+1…Xn, where q
is the current state,Tape head is pointing to Xi, X1X2…Xi-1XiXi+1…Xn are the current tape symbols.
◼ (q,Xi) = (p,Y,R) is same as:
X1…Xi-1qXi…Xn |---- X1…Xi-1YpXi+1…Xn
◼ (q,Xi) = (p,Y,L) is same as:
X1…Xi-1qXi…Xn |---- X1…pXi-1YXi+1…Xn
4.5.2 Transition Table
The definition of 𝛅 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.
Example
Consider, for example, a Turing machine with five states q1,..., q5 where q1 is the initial state and q5
is the (only) final state. The tape symbols are 0, 1 and b.
The transition table given in describes 𝛅:
TABLE: Transition Table of Turing Machine
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 6
Automata Theory & Computability [18CS54 CBCS]
4.5.3 Transition Diagram
In transition diagrams, the states are represented by vertices. Directed edges are used to represent
transition of states. The labels are triples of the form (𝛼, 𝛽, 𝛾) where 𝛼, 𝛽 ∈ 𝚪 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 diagram in Figure below:
Figure: Transition Diagram of TM
4.6 Language Acceptability by TURING MACHINES
Let us consider the Turing machine, M = (Q, Σ, 𝚪, 𝛅, q0, b, F). A string w in Σ* is said to be
accepted by M if q0w |-*--- 𝛼1p𝛼2 for some P ∈ F and 𝛼1, 𝛼2 ∈𝚪*.
Example: Consider the Turing machine M described by the table below. Describe the processing of (a)
OIL (b) 0011, (c) 001 using IDs. Which of the above strings are accepted by M?
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 7
Automata Theory & Computability [18CS54 CBCS]
4.7 Design of Turing Machines
Basic guidelines for designing a Turing machine:
1. 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.
2. 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.
Example: Design a Turing machine to recognize all strings consisting of an even number of 1's.
The construction is made by defining moves in the following manner:
(a) ql is the initial state. M enters the state q2 on scanning 1 and writes b.
(b) If M is in state q2 and scans 1, it enters ql and writes b.
(c) ql is the only accepting state.
Symbolically
M = ({ql, q2}, {1, b}, {1, b}, 𝛅, q, b, {ql}) where 𝛅 is defined by
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 8
Automata Theory & Computability [18CS54 CBCS]
The computation sequence of 11:- Thus, q111 ├ bq2 1 ├ bbq1
As ql is an accepting state. 11 is accepted. q1111 ├ bq211 ├ bb q11 ├ bbbq2
As q2 is not an accepting state, 111 is not accepted by M.
NOTE: FOR REAMINING PROBLEMS ON DESIGNING TM REFER THE PPT
4.8 Description of TURING MACHINES
In the examples discussed so far, the transition function 𝛅 was described as a partial function (function
𝛅: Q x 𝚪→ Q x 𝚪 x {L, R} is not defined for all (q, )) by spelling out the current state, the input symbol,
the resulting state, the tape symbol replacing the input symbol and the movement of R/W head to the
left or right. We can call this a formal description of a TM. Just as we have the machine language and
higher level languages for a computer, we can have a higher level of description, called the
implementation description. In this case we describe the movement of the head, the symbol stored etc.
in English.
For example, a single instruction like 'move to right till the end of the input string' requires several
moves. A single instruction in the implementation description is equivalent to several moves of a
standard TM. At a higher level we can give instructions in English language even without specifying
the state or transition function. This is called a high-level description.
4.9 Techniques for TM Construction
Some high level conceptual tools are given to make TM easier. The Turing machine so far
discussed is the standard Turing Machine.
4.9.1 Turing Machine with Stationary Head
In the definition of a TM we defined 𝛅 (q, a) as (q', y, D) where D = L or R. So the head
moves to the left or right after reading an input symbol. Suppose, we want to include the option that
the head can continue to be in the same cell for some input symbol. Then we define 𝛅 (q, a) as (q', y,
S). This means that the TM, on reading the input symbol a, changes the state to q' and writes y in the
current cell in place of a and continues to remain in the same cell. In terms of IDs, wqax ├ wq'yx
Of course, this move can be simulated by the standard TM with two moves, namely
wqax ├ wyq''x ├ wq'yx
That is, 𝛅 (q, a) = (q', y, S) is replaced by 𝛅 (q, a) = (q", y, R) and 𝛅 (q", X) = (q, y, L) for any tape
symbol X. Thus in this model 𝛅 (q, a) = (q', y, D) where D =L. R or S.
4.9.2 Storage In The State
• A state is used, whether it is of a FA or PDA or TM, to 'remember' things.
• A state can be used to store a symbol as well. So the state becomes a pair (q, a) where q is the
state (in the usual sense) and a is the tape symbol stored in (q, a). So the new set of states
becomes Q x r.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 9
Automata Theory & Computability [18CS54 CBCS]
EXAMPLE : Construct a TM that accepts the language 0 1* + 1 0*.
4.9.3 Multiple Track Turing Machine
In the case of TM defined earlier, a single tape was used. In a multiple track TM. a single tape
is assumed to be divided into several tracks. Now the tape alphabet is required to consist of k-tuples of
tape symbols, k being the number of tracks. Hence the only difference between the standard TM and
the TM with multiple tracks is the set of tape symbols. In the case of the standard Turing machine,
tape symbols are elements of 𝚪; in the case of TM with multiple track, it is 𝚪k. The moves are defined
in a similar way. The below diagram shows the Multiple Track TM.
FIGURE: Multiple Track Turing Machine
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 10
Automata Theory & Computability [18CS54 CBCS]
E.g., TM for {wcw | w {0,1}* } But w/o modifying original input string Using Multiple Track
Turing Machine
4.9.4 Subroutines
We know that subroutines are used in computer languages, when some task has to be done
repeatedly. We can implement this facility for TMs as well.
First a TM program for the subroutine is written. This will have an initial state and a 'return' state.
After reaching the return state, there is a temporary halt. For using a subroutine, new states are
introduced. When there is a need for calling the subroutine, moves are affected to enter the initial state
for the subroutine (when the return state of the subroutine is reached) and to return to the main
program of TM.
Example of subroutines:
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 11
Automata Theory & Computability [18CS54 CBCS]
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 12
Automata Theory & Computability [18CS54 CBCS]
4.10 Variants of Turing machines (TM)
The Turing machine we have introduced has a single tape δ(q, a) is either a single triple (p, y, D),
where D = R or L, or is not defined. We introduce two new models of TM:
(i) a TM with more than one tape
(ii) a TM where δ(q, a) ={(p1, y1, D1 ), (p2, y2, D2 ), ….. (pr, yr, Dr )}.
The first model is called a multitape TM and the second a nondeterministic TM.
4.10.1 Multitape Turing machines
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 Γ of tape symbols, a new symbol b not in Γ called the blank symbol.
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 x Γk into Q x Γk x {L, R, S} Γk . We use implementation description to
define δ . Figure below represents a multitape TM.
A move depends on the current state and k tape symbols under k tape heads.
Figure : Multitape Turing machine.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 13
Automata Theory & Computability [18CS54 CBCS]
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.
Theorem: Every language accepted by a multitape TM is acceptable by some single-tape TM
Proof: Suppose a language L is accepted by a k-tape TM M. We simulate M with a single-tape TM
with 2k tracks. The second. fourth, ..., (2k)th tracks hold the contents of the k-tapes. The first. third, ...
, (2k - l)th tracks hold a head marker (a symbol say X) to indicate the position of the respective tape
head.
We give an 'implementation description' of the simulation of M with a single tape TM M1 We give it
for the case k =2.
Figure below can be used to visualize the simulation. The symbols A2 and B5 are the current symbols
to be scanned and so the head marker X is above the two symbols.
Figure : Simulation of Multitape TM
Initially the contents of tapes 1 and 2 of M are stored in the second and fourth tracks of M1. The
headmarkers of the first and third tracks are at the cells containing the first symbol.
To simulate a move of M, the 2k-track TM M1 has to visit the two headmarkers and store the scanned
symbols in its control. Keeping track of the headmarkers visited and those to be visited is achieved by
keeping a count and storing it in the finite control of M1. Note that the finite control of M1 has also
the information about the states of M and its moves. After visiting both head markers M1 knows the
tape symbols being scanned by the two heads of M.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 14
Automata Theory & Computability [18CS54 CBCS]
Now M1 revisits each of the headmarkers:
(i) It changes the tape symbol in the corresponding track of M1 based on the information
regarding the move of M corresponding to the state (of M) and the tape symbol in the
corresponding tape M.
(ii) It moves the headmarkers to the left or right.
(iii) M1 changes the state of M in its control.
This is the simulation of a single move of M. At the end of this, M1 is ready to implement its next
move based on the revised positions of its headmarkers and the changed state available in its control.
M1 accepts a string w if the new state of M, as recorded in its control at the end of the processing of w,
is a final state of M.
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.
Theorem: If M1 is the single-tape TM simulating multitape TM M, then the time taken by M1 to
simulate n moves of M is O(n2).
Proof Let M be a k-tape TM. After n moves of M, the head markers of M1 will be separated by 2n
cells or less. (At the worst, one tape movement can be to the left by n cells and another can be to the
right by n cells. In this case the tape headmarkers are separated by 2n cells. In the other cases, the 'gap'
between them is less). To simulate a move of M, the TM M1 must visit all the k headmarkers. If M
starts with the leftmost headmarker, M1 will go through all the headmarkers by moving right by at
most 2n cells. To simulate the change in each tape, M1 has to move left by at most 2n cells. To
simulate changes in k tapes, it requires at most two moves in the reverse direction for each tape.
Thus the total number of moves by M1 for simulating one move of M is atmost 4n + 2k. (2n moves to
right for locating all headmarkers, 2n + 2k moves to the left for simulating the change in the content of
k tapes.) So the number of moves of M1 for simulating n moves of M is n(4n + 2k). As the constant k
is independent of n, the time taken by M1 is O((n2).
4.10.2 Nondeterministic Turing machines
In the case of standard Turing machines (deterministic TM), δ(q, a) was defined (for some elements of
Q x Γ as an element of Q x Γ x {L , R}. Now we extend the definition of δ. In a nondeterministic TM,
δ (ql, a) is defined as a subset of Q x Γ x {L, R}.
Defnition : A nondeterministic Turing machine is a 7-tuple (Q, Σ , Γ , δ , q0, b, F) where
Q is a finite nonempty set of states
Σ is a finite nonempty set of input symbols
b ∈ Γ is called the blank symbol
Γ is a nonempty set of tape symbols.
q0 is the initial state.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 15
Automata Theory & Computability [18CS54 CBCS]
F ⊆ Q is the set of final states.
δ is a partial function from Q x Γ into the power set of Q x Γ x {L. R}.
THEOREM : if M is a nondeterministic TM, there is a deterministic TM M’ such that T(M) =
T(M)'
Proof: We construct M1 as a multitape TM. Each symbol in the input string leads to a change
in ID. M1 should be able to reach all IDs and stop when an ID containing a final state is reached. So
the first tape is used to store IDs of M as a sequence and also the state of M. These IDs are separated
by the symbol * (included as a tape symbol). The current ID is known by marking an x along with the
ID-separator * (The symbol * marked with x is a new tape symbol.)
All IDs to the left of the current one have been explored already and so can be ignored
subsequently. Note that the current ID is decided by the current input symbol of w. Figure illustrates
the deterministic TM M1
Figure: The deterministic TM simulating M.
To process the current ID, M1 performs the following steps.
1. M1 examines the state and the scanned symbol of the current ID. Using the knowledge of moves
of M stored in the finite control of M1, M1 checks whether the state in the current ID is an
accepting state of M. In this case M1 accepts and stops simulating M.
2. If the state q say in the current ID xqay, is not an accepting state of M1 and δ (q, a) has k triples,
M1 copies the ID xqay in the second tape and makes k copies of this ID at the end of the
sequence of IDs in tape 2.
3. M1 modifies these k IDs in tape 2 according to the k choices given by δ(q, a).
4. M1 returns to the marked current ID, erases the mark x and marks the next ID-separator * with x
(to the * which is to the left of the next ID to be processed). Then M1 goes back to step 1.
M1 stops when an accepting state of M is reached in step 1.
• Now M1 accepts an input string W only when it is able to find that M has entered an accepting
state, after a finite number of moves. This is clear from the simulated sequence of moves of M1
(ending in step 1).
• We have to prove that M1 will eventually reach an accepting ID (that is, an ID having an
accepting state of M) if M enters an accepting ID after n moves. Note each move of M is
simulated by several moves of M1
• Let m be the maximum number of choices that M has for various (q, a)'s. (It is possible to find
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 16
Automata Theory & Computability [18CS54 CBCS]
m since we have only finite number of pairs in Q x r.) So for each initial ID of M, there are at
most m IDs that M can reach after one move, at most m2 IDs that M can reach after two moves.
and so on. So corresponding to n moves of M, there are at most 1 + m + m2 + ... + mn moves of
M1. Hence the number of IDs to be explored by M1 is at most nmn.
• We assume that M1 explores these IDs. These IDs have a tree structure having the initial ID as
its root. We can apply breadth-first search of the nodes of the tree. If M reaches an accepting
ID after n moves, then M1 has to search atmost nmn IDs before reaching an accepting ID. So. if
M accepts W, then M1also accepts W (eventually). Hence T(M) = T(M1).
4.11 The model of linear bounded automaton
This model is important because
(a) the set of context-sensitive languages is accepted by the model and
(b) the infinite storage is restricted in size but not in accessibility to the storage in comparison with
the Turing machine model.
It is called the linear bounded automaton (LBA) because a linear function is used to restrict (to
bound) the length of the tape.
A linear bounded automaton is a nondeterministic Turing machine which has a single tape
whose length is not infinite but bounded by a linear function. The models can be described
formally by the following set format:M = (Q, Σ , Γ , δ , q0, b, ¢ , $, F).
All the symbols have the same meaning as in the basic model of Turing machines with the difference
that the input alphabet Σ contains two special symbols ¢ and $. ¢ is called the left-end marker which
is entered in the leftmost cell of the input tape and prevents the R/W head from getting off the left end
of the tape. $ is called the right-end marker which is entered in the rightmost cell of the input tape
and prevents the R/W head from getting off the right end of the tape. Both the endmarkers should not
appear on any other cell within the input tape, and the R/W head should not print any other symbol
over both the endmarkers.
Let us consider the input string w with |w| = n - 2. The input string w can be recognized by an LBA if
it can also be recognized by a Turing machine using no more than kn cells of input tape, where k is a
constant specified in the description of LBA. The value of k does not depend on the input string but is
purely a property of the machine. Whenever we process any string in LBA, we shall assume that the
input string is enclosed within the endmarkers ¢ and $.
The above model of LBA can be represented by the block diagram shown below:
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 17
Automata Theory & Computability [18CS54 CBCS]
Figure : Linear Bounded Automaton
There are two tapes: one is called the input tape, and the other, working tape.
On the input tape the head never prints and never moves to the left. On the working tape the head can
modify the contents in any way, without any restriction.
In the case of LBA, an ID is denoted by (q, w, k), where q ∈ Q, w ∈ Γ and k is some integer between
1 and n. The transition of IDs is similar except that k changes to k - 1 if the R/W head moves to the left
and to k + 1 if the head moves to the right.
The language accepted by LBA is defined as the set
{w ∈ (Σ - {¢, $})* | (qo, ¢w$, 1) |--* (q, α , i)
for some q ∈ F and for some integer i between 1 and n}
Note: As a null string can be represented either by the absence of input string or by a completely blank
tape, an LBA may accept the null string,
If L is a context-sensitive language, then L is accepted by a linear bounded automaton. The converse is
also true.
Ms.HN, Ms.KR & Ms.SSK, Dept. of ISE, RNSIT 2021-2022 Page 18