0% found this document useful (0 votes)
21 views33 pages

Unit - 5 Svce

FLAT

Uploaded by

2022it.r71
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)
21 views33 pages

Unit - 5 Svce

FLAT

Uploaded by

2022it.r71
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/ 33

SVCE TIRUPATI

TABLE OF CONTENTS – UNIT 1


S. NO CONTENTS PAGE NO.
1 COURSE OBJECTIVES 3
2 PREREQUISITES 3
3 SYLLABUS 3
4 COURSE OUTCOMES 3
5 CO - PO/PSO MAPPING 4
6 LESSON PLAN 4
7 ACTIVITY BASED LEARNING 4
8 LECTURE NOTES 4
5.1 Basics of Turing Machine (TM) 4
5.2 Transitional Representation of TMs 6
5.3 Instantaneous description 8
5.4 Non-Deterministic TM 10
5.5 Conversion of Regular Expression to TM 12
5.6 Two stack PDA and TM 15
5.7 Variations of the TM, TM as an integer function 17
5.8 Universal TM, Linear Bounded Automata 25
5.9 TM Languages, Unrestricted grammar 27
5.10 Properties of Recursive and Recursively enumerable 28
languages
5.11 Undecidability, Reducibility, Undecidable problems 29
5.12 Post‘s Correspondence Problem(PCP), Modified PCP 30
9 PRACTICE QUIZ 32
10 ASSIGNMENTS 33
11 PART A QUESTIONS & ANSWERS (2 MARKS QUESTIONS) 33
12 PART B QUESTIONS 34
13 SUPPORTIVE ONLINE CERTIFICATION COURSES 34
14 REAL TIME APPLICATIONS 34
15 CONTENTS BEYOND THE SYLLABUS 34
16 PRESCRIBED TEXT BOOKS & REFERENCE BOOKS 34
17 MINI PROJECT SUGGESTION 34

2|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

1. Course Objectives
Formal definitions of machine models.
1. Classify machines by their power to recognize languages.
2. Understanding of formal grammars, analysis
3. Understanding of hierarchical organization of problems depending on their
complexity
4. Understanding of the logical limits to computational capacity
5. Understanding of un-decidable problems
2. Prerequisites
Students should have knowledge on
1. Discrete Mathematics
2. Basic Mathematics

3. Syllabus
UNIT V
Turing Machines and Undecidability: Basics of Turing Machine (TM), Transitional
Representation of TMs, Instantaneous description, Non Deterministic TM, Conversion
of Regular Expression to TM, Two stack PDA and TM, Variations of the TM, TM as an
integer function, Universal TM, Linear Bounded Automata, TM Languages,
Unrestricted grammar, Properties of Recursive and Recursively enumerable
languages, Undecidability, Reducibility, Undecidable problems about TMs,
Post‘s Correspondence Problem(PCP), Modified PCP.
4. Course outcomes
1. At the end of the course, students will be able to
2. Construct finite state diagrams while solving problems of computer science
3. Find solutions to the problems using Turing machines
4. Design of new grammar and language

3|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
5. Co-PO / PSO Mapping
Machine
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 P1 PO11 PO12 PSO1 PSO2
Tools
CO1 2 3 2 3 2 3
CO2
CO3 3 3 2
CO4 3 2 2 3 3 2 3

6. Lesson Plan
Lecture
Weeks Topics to be covered References
No.
1 Basics of Turing Machine (TM) T1, R1
2 Transitional Representation of TMs T1, R1
1
3 Instantaneous description T1, R1
4 Non-Deterministic TM T1, R1
5 Conversion of Regular Expression to TM T1, R2
6 Two stack PDA and TM T1, R1
2
7 Variations of the TM, TM as an integer function T1, R1
8 Universal TM, Linear Bounded Automata T1, R1
9 TM Languages, Unrestricted grammar T1, R1
Properties of Recursive and Recursively enumerable
10 T1, R1
3 languages
11 Undecidability, Reducibility, Undecidable problems T1, R1
12 Post‘s Correspondence Problem(PCP), Modified PCP T1, R1

7. Activity Based Learning


1. Flipped Classroom on Moore and Mealy machines.
2. Group Discussion on real time programming Language rules and its application
using NFA.
8. Lecture Notes

5.1 Turing Machine

Limitations of Finite State Machine/Finite Automata:

• Can remember only current symbol


• Cannot remember previous long sequence of input

4|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
Limitations of Pushdown Automata:

• It uses stack to remember any long input sequence


• Accepts a larger class of languages than that of FA, Computation power is limited
• To overcome the above limitations, Alan Turing has proposed a model called a
Turing Machine(TM) with a two-way infinite tape. The tape is divided into cells, each
of which can hold only one symbol. The input of the machine is a string
w=w1w2w...wn initially written on the left most portion of the tape, followed by an
infinite sequence of blanks B.
• The machine is able to move a read/write head left and right over the tape as it
performs computation. It can read and write symbols on the tape as it pleases.

B B. W1. W2 Wn B B

5.1.1 BLOCK DIAGRAM OF TURING MACHINE

It is a simple mathematical model of a general purpose computer. It is capable of


performing any calculation which can be performed by any computing machine. Hence
this model is popularly known as “Turing Machine”.

FEATURES OF TM:

• It has external memory which remembers arbitrarily long sequence of input.


• It has unlimited memory capability.
• The model has a facility by which the input at left or right on the tape can be read
easily.

5|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
• The machine can produce certain output based on its input. In this machine there is
no distinction between input and output symbols.
• The TM can be thought of as a finite state automata connected to a read or write
head,
• It has one tape which is divided into a number of cells. Each cell can store only one
symbol.
• The read or write head can examine one cell at a time.
• In one move the machine examine the present symbol under the head on the tape
and present state of an automaton to determine:
• A new symbol should be written on the tape in the cell under the head
• The head moves one cell either left(L) or right(R), The next state of the automata.
• Whether to halt or not.
DEF: TURING MACHINE:

• A TM is expressed as a 7-tuple (Q, T, B,∑, δ, q0, F) where:


• Q-finite set of states
• T -tape alphabet (symbols which can be written on Tape)
• B∈ T -blank symbol (every cell is filled with B except input alphabet initially)
• ∑ -the input alphabet (symbols which are part of input alphabet)
• δ : Q × T → Q × T × {L,R} transition function which maps.
• q0 -the initial state
• F -the set of final states.
5.2 INSTANTANEOUS DESCRIPTION OF TM

• ID of TM is (l,q,r) where
• l- tape contents left to the head of TM
• r- tape contents right to the head of TM including the symbol under head and
• q- current state
• Ex:

6|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
• Where l=ab l=abb
r=abb r=bb

Current state=q current state=q1

INSTANTANEOUS DESCRIPTION OF TM:

Moves: At any given time the move of TM depends on i) Current state and ii) input
symbol i.e., (q,a). the o/p of move would be (q1, b, L) Where q1 = next state, b= symbol
to be replaced by a and L= move left one symbol.

Ex: δ( qi,a)= ( qj,b,L) i.e., in the state qi on receiving a symbol a , then change to a new
state qj , replace a by b and the move left.

Acceptance or Rejection by TM:

• Let us assume the final Configuration of TM is (u,q,w)


• Accept: If q ∈ F
• Reject: If q ∉ F and /or next moves are not defined/loops
• If either accept or reject then TM halts(Stops)
TM as Language Accepter:

• M accepts w iff the execution of M on w terminating and ends in the accepting


state
• M rejects w iff the execution of M on w terminating and ends in the non accepting
state
• M does not accept w iff M rejects or M loops on w, Ex: Write IDs for the following TM
• δ( q0,a)= (q0,X,R), δ( q0,b)= (q0,b,R), δ( q0,B)= (q1,B,L), δ( q1,b)= (q1,Y,L) , δ( q1,X)=
(q1,X,L), δ( q1,B)= (q2,B,H) and string w=abba.

B B B a b b A B B B

Current state= q0

B B B X b b A B B B

Current state= q0

B B B X b b A B B B

Current state= q0

7|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
B B B X b b A B B B

Current state= q0

B B B X b b X B B B

Current state= q0

B B B X b b X B B B

Current state= q1

B B B X b b X B B B

Current state= q1

B B B X b Y X B B B

Current state= q1

B B B X Y Y X B B B

Current state= q1

B B B X Y Y X B B B

Current state= q1

δ( q1,B)= (q2,B,H)

REPRESENTATION OF TM:

• Representation of TM: A TM can be represented by means of Transition Table and


Transition diagram.
• Representation of TM using Transition Table: The Transition table for the above TM is
as given below.

δ a b X Y B

q0 (q0,X,R) (q0,b,R) -- - (q1,B,L)

8|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

q1 -- (q1,Y,L) (q1,X,L) - (q2,B,H)

Representation of TM using Transition Diagram: The states are represented by vertices and
transitions are represented by directed edges. The edges are labeled in the form of (α ,β,
γ) or α →β, γ where α(∈T) is the current input symbol, β(∈T) is the symbol to be replaced
with α and γ={L,R}. The TM for the above example is as

Ex: Design a TM to recognize all strings consisting of even no of a’s defined over {a}

Transition Diagram

Transition Table

δ a B

q0 (q1,a,R) (q2,B,H)

q1 (q0,a,R) --

q2 -- --

9|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
Ex: Design TM to accept strings belonging to the language (0+1)*

Transition Diagram

Transition Table

Ex: Design a TM for finding 1’s Complement of a given binary number

Transition Diagram

δ 0 1 B

q0 (q0,1,R) (q0,0,R) (q1,B,H)

Ex: Design a TM for finding 2’s Complement of a given binary number

Transition Diagram

10|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

Transition Table

δ 0 1 B

q0 (q0,0,R) (q0,1,R) (q1,B,L)

q1 (q1,0,L) (q2,1,L) --

q2 (q2,1,L) (q2,0,L) (q3,B,H)

q3 -- -- --

Ex: Construct a TM for language consisting of strings having any no of b’s and even no of
a’s defined over {a,b}.

Design a TM to accept strings formed with 0 and 1 and having substring 000

11|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

Ex: Design a TM to accept strings formed on {0,1} and ending with 000

Transition Diagram

12|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
Transition Table:

Ex: Design a TM for accepting strings of the language L={wwr : w ∈ (0+1)* }

Transition Diagram

13|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

Ex: Design a TM for palindrome strings over {a,b}

Transition Diagram

14|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

Ex: Design a TM which accepts L={anbn: n>=1}

15|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

Ex: Design a TM which accepts L={anbncn : n>=1}

16|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
5.7 TM AS INTEGER FUNCTION:

A Turing machine M computes a function f if, when given input w in the domain of f, the
machine halts in its accept state with f(w) written (leftmost) on the tape. To use TM as a
computational machine, it is required to place the integer numbers as 0m.

Suppose it is required to add two numbers; that is, f(m, n) = m + n, then the numbers m
and n are to be placed on the tape as 0m10n where 1 is a separator for the numbers m
and n. Once processing is completed and the TM halts, the tape would have the
contents as 0(m+n), which is the required result of computation.

Ex: Design a TM to add two numbers a and b.

Sol: Let the numbers be 2 and 3. The addition of these numbers using simple logic is
explained. The numbers are placed as B02103B.

After processing, the tape content would be B05B. The simple logic that can be used is:
replace the occurrence of 0 by B and move to right and replace 1 to 0, so that it is in
required form as B05B.

Ex: Design TM for Multiplication of two integers

17|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

Ex: Design TM for f(m,n)=m-n, m>=n

18|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

CONVERSION OF REGULAR EXPRESSION TO TM

• Step1: Convert the RE to an equivalent Automaton without epsilon transitions


• Step2: Change both initial and final states of the Automata to an intermediate state
• Step3: insert a new initial state with a transition (B,B,R) to the Automata’s initial state
• Step4: convert the transitions with label a to (a,a,R)
• Step5: insert a new final state with a transition (B, B, R) from Automata’s final state to
the new final state.
Ex: Construct a TM for the RE (a+b)*(aa+bb) (a+b)*

5.7.1 VARIATIONS OF THE TM:

1. Multi Tape Turing Machine:

• Multi-tape Turing Machines have multiple tapes where each tape is accessed with
a separate head. Each head can move independently of the other heads. Initially
the input is on tape 1 and others are blank. At first, the first tape is occupied by the
input and the other tapes are kept blank. Next, the machine reads consecutive
symbols under its heads and the TM prints a symbol on each tape and moves its
heads.
• Depending on the present state and i/p symbol scanned by each of the head, the
TM can Change its state.
• Write a new symbol on the respective cell of the respective tape from where the
i/ps were scanned, Move the head one left/right.

19|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

Def: A Multi-tape Turing machine can be formally described as a 7-tuple (Q, T, ∑, δ, q0,B,
F) where

Q is a finite set of states

T is the tape alphabet

∑ is the input alphabet

δ: QXTk→ QXTk X{L,R} is a transition function

q0 is the initial state

B is a blank symbol

F is the set of final states

Ex: Design a Multi tape TM for checking whether a binary string is a palindrome or not

Sol: Consider a TM with two tapes. The i/p is written on the first tape.

The machine works by the following process:

Copy the i/p from the first tape to the second tape by traversing the first tape from
left to right.

20|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
Traverse from the first tape again from right to left and point the head to the first
symbol of i/p on tape 1.

Moves the two heads pointing on the two tapes in opposite directions checking
that the two symbols are identical and erasing the copy in tape2 at the same time.

Ex: Design a multi-tape TM for L=anbncn

2. Multi-head Turing Machine:

A multi-head Turing machine contains two or more heads to read the symbols on the
same tape. In one step all the heads sense the scanned symbols and move or write
independently.

Multi-head Turing machine can be simulated by single head Turing machine.

21|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

• Design a multi-head TM for checking whether a binary string is a palindrome or not.


• Sol: Consider a TM with two heads. The heads are pointing to the two ends of the
string on the tape. Both the heads traverse the string in the opposite direction. The
head1 has the priority over head2.
• If both of the heads gets the same symbols, then it traverses the next input right or
left by replacing the present symbol by B.
• If both heads gets B, then halt and declare the string as a palindrome.

TWO-WAY INFINITE TAPE TURING MACHINE

• In general in a TM, there is a left boundary. If the head crosses that boundary and
wants to go left, then the situation is called a crash condition. But the head may
traverse the right side up to infinity. In this sense, the i/p tape of the general TM can
be treated as a one-way infinite tape.

22|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
• A TM where there is infinite number of sequences of blank on both sides of the tape
is called a two-way infinite tape TM. A typical diagram of the i/p tape of a two-way
infinite TM is:

-- -- -- B B a a b b B B -- --

MULTI-DIMENSIONAL (K=2) TAPE TURING MACHINE

• It has multi-dimensional tape where head can move any direction that is left, right,
up or down.
• Multi-dimensional tape Turing machine can be simulated by one-dimensional Turing
machine.
• The i/p tape of 1-D TM is extended to infinite in both sides, but in one direction. If the
i/p tape can be extended infinitely in more than one dimension, then the TM is
called a multi-dimensional TM.
• In general case, consider k=2, which means that the i/p tape is extended to
infinitely in right and down directions. For this case, the read/write head can move
in the left, right, up and down directions.
• The transition function for a K-dimensional TM is δ:QX∑→QXTX{L,R,U,D,H} where
L=Left, R-Right, U-Up and D-Down.

NON-DETERMINISTIC TURING MACHINE

A non-deterministic Turing machine has a single, one way infinite tape. For a given state
and input symbol has at least one choice to move (finite number of choices for the next
move), each choice several choices of path that it might follow for a given input string. A
non-deterministic Turing machine is equivalent to deterministic Turing machine

Def: A non-Deterministic TM is expressed as a 7-tuple (Q, T, B,∑, δ, q0, F) where:

23|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
Q-finite set of states

T -tape alphabet (symbols which can be written on Tape)

B∈ T -blank symbol (every cell is filled with B except input alphabet initially)

∑ -the input alphabet (symbols which are part of input alphabet)

δ : Q × T → 2Q × T × {L,R} transition function which maps.

q0 -the initial state

F -the set of final states.

Ex: Design a TM for 0n1m, where m,n>0 and n may not be equal to m

Ex: Construct a TM over {a,b} which contains a substring abb.

Enumerator: It is a type of TM which is attached a printer. It has a work tape and an o/p
tape. The work tape is a write only once tape. At each step, the machine chooses a
symbol to write from the output alphabet on the output tape.

After writing a symbol on the output tape, the head placed on the output moves right
by one position. The enumerator has a special state, say qp , entering which the output
tape is erased and the tape head moves to the leftmost position and finally the string is
printed. A string w is printed as o/p by the enumerator if the o/p tape contains w at the
time the machine enters in to qp.

The transition function of enumerator is δ: QX∑XT→QX∑X{L,R}XTX{L,R}

24|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

5.8 UNIVERSAL TM:

• A universal Turing machine (UTM) is a Turing machine that simulates an arbitrary


Turing machine on arbitrary input. The universal machine essentially achieves this by
reading both the description of the machine to be simulated as well as the input to
that machine from its own tape.
• To design UTM, add the following to the TM:
• Increase the no of read-write heads(like multiple heads TM)
• Increase the no of input tapes(multiple tape TM)
• Increase the dimension of moving the read-write head (K-Dimensional TM)
• Add special purpose memory like stack.
• A UTM,MU is an automaton that, given as input the description of any TM and a
string w, can simulate the computation of M for input w. To construct such an MU
we first choose a standard way of describing TMs.
• We may, without loss of generality, assume that M=(Q,{0,1}, {0,1,B}, δ, q0,B,qf) where
qf is a single final state. The alphabet {0,1,B}∈T are represented as a1,a2, and a3.
The direction left and right are represented as D1 and D2 respectively. The
transitions of TM are encoded in special binary representation where each symbol is
separated by 1.
Ex: if there is a transition δ(qi, aj)= (qk, al,Dm) then the binary representation for the
transition is as given as 0i10j10k10l10m .

• The binary code for the Turing machine is M which has transitions t1, t2, t3,....tn is
represented as 111t111t211t311....11tn111.
• Note: The transitions need not be in any particular order.
25|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
• If a string has to be verified then the problem is represented as a tuple <M,w>
where M is the definition of TM and w is the input string.
• Ex: Let M=({q1,q2,q3}, {0,1}, {0.1.B}, δ, q1, B,{q2}) have moves defined as δ(q1, 1)=
(q3, 0,R), δ(q3, 0)= (q1, 1,R), δ(q3, 1)= (q2, 0,R), δ(q3, B)= (q3, 1,L).
• Give the problem representation for the string w=1011
• Sol: Let binary representation for states{q1,q2,q3}be {0,00,000}, alphabet {0,1,B} be
{0,00,000} and direction {R,L} be {0,00}. The transitions are represented as follows:

Transition Binary Representation

δ(q1, 1)= (q3, 0,R) 010010001010

δ(q3, 0)= (q1, 1,R) 000101010010

δ(q3, 1)= (q2, 0,R) 0001001001010

δ(q3, B)= (q3, 1,L) 00010001000100100

The problem instance <M,1011> is represented as 111 010010001010 11 000101010010


11 0001001001010 11 00010001000100100 111 1011

• For any input M and w, Tape 1 will keep an encoded definition of M, Tape 2 will
contain the tape contents of M and Tape 3, the internal state of M. Mu looks first
at the contents of Tapes 2 and 3 to determine the configuration of M. The behavior
of the M is as follows.
• 1. Check the format of Tape 1 for the validations of the TM model.
a. No two transitions should begin with Oi1Oj1 for the same i and j.

b. Check that if Oi1Oj1Ok1Ol1Om represents a transition, then 1 < j < 3, 1 < l <

3, and 1 < m < 3.

26|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
• 2. Initialize Tape 2 to contain w. Initialize Tape 3 to hold a single O representing initial
state q1. For all the tapes, the tape heads are positioned at the left end and these
symbols are marked to identify the starting position.
• 3. When Tape 3 holds OO, it is said to reach the final state, and the machine can
halt.
• 4. Let at any given time aJ be the symbol currently scanned by tape head 2 and let
Oi, the contents of Tape 3 (which indicates state). Scan Tape 1 from the left end to
the second 111 looking for a substring beginning with 11Oi1Oj1.
a. if no such string is found, then halt and reject.

b. if found, then let the suffix be Ok1Ol1Om11. Put Ok on Tape 3, print a on the tape cell
scanned by head 2 and move the head in direction Dm.

• It is clear that Mu accepts <M, w> if and only if M accepts w. It is also true that if M
runs forever on w, Mu runs forever on <M, w> and if M halts on w without
accepting, Mu also halts on w without accepting.
RECURSIVE AND RECURSIVELY ENUMERABLE LANGUAGES:

• There are three possible outcomes of executing a TM over a given input. The TM
may halt and accept the input Halt and Reject the input or Never Halt.
• Recursive Language: A language is recursive if there exists a TM that accepts every
string of the language and rejects every string (over the same alphabet) that is not
in the language.
• Note: If a language L is recursive, then its complement L1 must also be recursive.
• Recursively Enumerable Language: A language is recursively enumerable if there
exists a TM that accepts every string of the language and does not accept the
strings that are not in the language (i.e., strings may be rejected or may cause the
TM to go into an infinite loop).
• Note: Every recursive language is also recursively enumerable but the converse
need not be true.

Closure Properties of Recursive and Recursively enumerable languages

• Union: If L1 and If L2 are two recursive languages, their union L1∪L2 will also be
recursive because if TM halts for L1 and halts for L2, it will also halt for L1∪L2.

27|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
• Concatenation: If L1 and If L2 are two recursive languages, their concatenation
L1.L2 will also be recursive.
• Ex: L1= {anbncn|n>=0}
• L2= {dmemfm|m>=0}
• L3= L1.L2= { anbncn dmemfm :m>=0 and n>=0} is also recursive.
• Kleene Closure: If L1is recursive, its kleene closure L1* will also be recursive. For
Example: L1= {anbncn|n>=0} L1*= ({anbncn|n>=0} )* is also recursive
• Intersection and complement: If L1 and If L2 are two recursive languages, their
intersection L1 ∩ L2 will also be recursive. Similarly, complement of recursive
language L1 which is ∑*-L1, will also be recursive.
• The complement of a recursive language is recursive.
• The union of two recursive languages is recursive.
• The union of two recursively Enumerable languages is recursively enumerable.
• If L is a recursive language then Σ*-L is recursive
5.8 Linear Bounded Automata (LBA)

• A NDTM is called Linear Bound Automata (LBA) if


• Its input alphabet includes two special symbols[ and ] as left and right end
markers .
• It has no moves beyond these end markers. i.e., no left move from [ and no
right move from ]. It never changes the symbols [ and ].

• Def: A LBA is defined using 8-tuples as M=( Q, Σ, Γ, δ,q0,[,],F)


• Where Q, Σ, Γ, δ,q0 and ,F are same as for NDTM, [ and ] are left and right end
markers.
• Ex: Design LBA for L={anbncn: n>=1}

28|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

5.11 INTRODUCTION TO UNDECIDABILITY

• In the theory of computation, we often come across such problems that are
answered either 'yes' or 'no'. The class of problems which can be answered as 'yes'
are called solvable or decidable. Otherwise, the class of problems is said to be
unsolvable or undecidable.
• Decidable: A decision problem which can be solved by an algorithm is called
decidable. All the languages recognized by TM are decidable.
• Ex: Given two numbers x and y, does x evenly divides y?
• Decidable: A decision problem A is called decidable or effectively solvable if A is a
recursive set.
• Partially decidable: A problem is called partially decidable/semi decidable/
solvable/ provable if A is a recursively enumerable set.
• Undecidable: Partially decidable problems and any other problems that are not
decidable are called undecidable.
• Post Correspondence Problem (PCP): one method to test undecidability is using
TMs. The other method of testing undecidability of the string is with the help of Post's
Correspondence Problem (PCP). Let us define the PCP.
• "The Post's correspondence problem consists of two lists of strings that are of equal
length over the input. The two lists are A = w1, w2, w3, .... , wn and B = x1, x2, x3, ....
xn then there exists a non empty set of integers i1, i2, i3, .... , in n>=1 such that, w1,
w2, w3, .... wn = x1, x2, x3, .... xn"
• To solve the post correspondence problem we try all the combinations of i1, i2, i3,
.... , in to find the wi = xi then we say that PCP has a solution and is decidable
otherwise PCP is undecidable.
• Consider the following sequence and find whether it has a solution (decidable) or
not.

i List A List B

1 1 111

2 10111 10

3 10 0

Sol:

• If we take 3, first character in A is 1 and first character in B is 0. So we will not get


same strings.

29|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
• If we take 1 then A starts with 1 and B also starts with 1, but for the next two
characters in A, there is no matching sequence.
• So we starts with 2. i.e., i=2 Therefore

i 2

Wi 10111

Xi 10

• Length of first string >second string


• Next consider B which starts with 1. We have 1 and 2. If we consider 2 next symbol is
0 and does not match. Hence, consider 1.

i 2 1 String

Wi 10111 1 101111

Xi 10 111 10111

• Still Length of first string >second string. Again choose 1

i 2 1 1 String

Wi 10111 1 1 1011111

xi 10 111 111 10111111

• Length of first string <second string. Consider 3

i 2 1 1 3 String

Wi 10111 1 1 10 101111110

xi 10 111 111 0 101111110

• Length of first string = second string, Hence stop the procedure and declare the
sequence 2113 as a solution. Therefore it is decidable.
MPCP: MODIFIED VERSION OF PCP:

• MPCP is decidable <==> PCP is decidable.


• In MPCP, there is the additional requirement on a solution that the first pair on the
list X and Y must be the first pair in the solution.
• More formally, an instance of MPCP is two lists
• X=w1,w2,w3,....wk and Y=x1,x2,x3,.......xk
30|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
• and a solution is a list of 0 or more integers i1,i2,i3,...ip such that
w1,wi1,wi2,...wip=x1,xi1,xi2,...xip.
• The difference between the MPCP and PCP is that in the MPCP, a solution required
to start with the first string on each list.
• If we have a problem instance represented in MPCP then it can be reduced to
PCP. If there is a solution for PCP instance then there exists a solution for MPCP
instance.
• Procedure to convert MPCP to PCP or Reduction of MPCP to PCP:
• Let the list G and H be the given instance of MPCP
• Let Σ be the smallest alphabet containing all the symbols in the list G and H.
• Consider two special symbols {θ, $} not present in Σ and find two new lists X from G
and Y from H using the following rules.
• xi of list X is obtained from gi by inserting $ symbol after each character of gi.
• yi of list Y is obtained from hi by inserting $ symbol before each character of hi.
• Create new words as follows. x0=$g1, y0=h1, xk+1= θ, yk+1=$θ.

31|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
9. Practice Quiz
1. Graphical representation of a derivation is called --------------
A) production rules B) parse tree C)Derivation tree
2. CFLs are not closed under
A) concatenation B) union C) Kleen closure
3. LBA accepts _____________language.
A) CSL B) CFL C) RL
4. Grammar is said to be in CNF iff
A) NT->NT NT B) NT-> t NT C) NT-> any no. of NT
5. A Turing Machine contains_________tuples.
A) 6 B) 7 C) 5
6. If A is reducible to B and B is undecidable then_________
A) A is Decidable B) B is Decidable C) A is Un decidable
7. PDA make use of ------------
A) list B) queue C) stack
8. If PCP is decidable then MPCP is____________
A) decidable B) undecidable C) Cannot say
9. Which type of TM is attached to a printer ?
A) Enumerator B) Multi-tape TM C) Multi-head TM
10 CFG is used in ________________________
A) Translators B) assemblers C) Compilers

32|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI
10. Assignments
S. No Question BL CO
Design a Turing Machine that accepts the language L = {an bn |
n ≥1}. Give the graphical representation for the Turing Machine
1 5 5
obtained and also show the moves made by the Turing machine
for the string ‘aabb’. [June-2018]
Give the formal definition of a Turing Machine. With a diagram,
2 4 5
explain the Turing Machine model. [June-2018]
Explain in brief about any five variations of the basic TM model.
3 3 5
[Nov/Dec-2019]
Design a Turing machine to accept the following language:
4 6 5
L = {0n 1n 2n |n ≥ 1} [Nov/Dec-2018]
5 Explain in detail about universal TM. [June/July-2019] 3 5

11. Part A- Question & Answers


S. No Question& Answers BL CO
1 What is a Turing machine?
Turing machine is a simple mathematical model of a computer.
TM has unlimited and unrestricted memory and is a much more
2 5
accurate model of a general-purpose computer. The Turing
machine is a FA with a R/W Head. It has an infinite tape divided
into cells, each cell holding one symbol.
2 What are the special features of TM?
In one move, TM depending upon the symbol scanned by the
tape head and state of the finite control: Changes state. Prints 3 5
a symbol on the tape cell scanned, replacing what was written
there. Moves the R/w head left or right one cell.
3 Define Turing machine.
A Turing machine is denoted as M=(Q, Σ, Ґ ,δ ,q0, B,F) Q is a
finite set of states.
Σ is set of i/p symbols, not including B.
3 5
Ґ is the finite set of tape symbols. q0 in Q is called start state.
B in Ґ is blank symbol.
F is the set of final states.
δ is a mapping from Q X Ґ to Q X Ґ X {L,R}.
4 What are the applications of TM?
TM can be used as: Recognizers of languages. Computers of 2 5
functions on non-negative integers. Generating devices.
5 What is the basic difference between 2-way FA and TM?
Turing machine can change symbols on its tape, whereas the
FA cannot change symbols on tape. Also TM has a tape head 2 5
that moves both left and right side, whereas the FA doesn’t
have such a tape head.

33|F L A T - U N I T - V

BTECH_IT-SEM 31
SVCE TIRUPATI

12. Part B- Questions

S. No Question BL CO
Design a Turing Machine that accepts the language L = {an bn |
n ≥1}. Give the graphical representation for the Turing Machine
1 5 5
obtained and also show the moves made by the Turing machine
for the string ‘aabb’. [June-2018]
Give the formal definition of a Turing Machine. With a diagram,
2 4 5
explain the Turing Machine model. [June-2018]
Explain in brief about any five variations of the basic TM model.
3 3 5
[Nov/Dec-2019]
Design a Turing machine to accept the following language:
4 6 5
L = {0n 1n 2n |n ≥ 1} [Nov/Dec-2018]
5 Explain in detail about universal TM. [June/July-2019] 3 5

13. Supportive Online Certification Courses


1. Theory of Automata and Formal Languages By Prof. Dr. Diganta Goswami,
conducted by IIT Guwahati– 8 weeks
2. Introduction to Automata, Languages and Computation By Prof. Sourav
Mukhopadhyay, conducted by IIT Kharagpur– 12 weeks.
14. Real Time Applications
S.No Application CO
1 The Design of Lexical Analysis Phase in Compiler Design 1
15. Contents Beyond the Syllabus
1. Different types Parsing Techniques

16. Prescribed Text Books & Reference Books


Text Book
1. Introduction to Automata Theory, Formal Languages and Computation,
Shyamalendu kandar, Pearson.
2. Introduction to Automata Theory, Languages, and Computation, Third Edition,
John E Hopcroft, Rajeev Motwani, Jeffery D. Ullman, Pearson.
References:

1. Introduction to Languages and the Theory of Computation, John C Martin, TMH,


Third Edition.
2. Theory of Computation, Vivek Kulkarni, OXFORD.
3. Introduction to the Theory of Computation., Michel Sipser, 2nd Edition, Cengage
Learning.
17. Mini Project Suggestion
1. Implementation of DFA for the given problem using high level programming
language (Ex. C or Java).

34|F L A T - U N I T - V

BTECH_IT-SEM 31

You might also like