Flat Unit 5 Notes
Flat Unit 5 Notes
Flat Unit 5 Notes
Multi-Tape/Head TM: 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.
A Multi-tape Turing machine can be formally described as a 6-tuple (Q, X, B, δ, q0, F) where −
● Q is a finite set of states
● X is the tape alphabet
● B is the blank symbol
● δ is a relation on states and symbols where
δ: Q × Xk → Q × (X × {Left_shift, Right_shift, No_shift })k
where there is k number of tapes
1
UNIT-5
2
UNIT-5
Undecidable Problems
A problem is undecidable if there is no Turing machine which will always halt in finite amount
of time to give answer as ‘yes’ or ‘no’. An undecidable problem has no algorithm to determine
the answer for a given input.
Examples
● Ambiguity of context-free languages: Given a context-free language, there is no Turing
machine which will always halt in finite amount of time and give answer whether
language is ambiguous or not.
● Equivalence of two context-free languages: Given two context-free languages, there is no
Turing machine which will always halt in finite amount of time and give answer whether
two context free languages are equal or not.
● Everything or completeness of CFG: Given a CFG and input alphabet, whether CFG will
generate all possible strings of input alphabet (∑*)is undecidable.
● Regularity of CFL, CSL, REC and REC: Given a CFL, CSL, REC or REC, determining
whether this language is regular is undecidable.
Note: Two popular undecidable problems are halting problem of TM and PCP (Post
Correspondence Problem).
Undecidable Problems about Turing machine:
which will move to final state if the string is of the form anbncn else move to non-final state. So
the TM will always halt in this case. REC languages are also called as Turing decidable
languages. The relationship between RE and REC languages can be shown in Figure 1.
5
UNIT-5
Note: As opposed to REC languages, RE languages are not closed under complement which
means complement of RE language need not be RE.
· ··
Post Correspondence Problem:
Post Correspondence Problem is a popular undecidable problem that was introduced by Emil
Leon Post in 1946. It is simpler than Halting Problem.
In this problem we have N number of Dominos (tiles). The aim is to arrange tiles in such order
that string made by Numerators is same as string made by Denominators.
In simple words, lets assume we have two lists both containing N words, aim is to find out
concatenation of these words in some sequence such that both lists yield same result.
Let’s try understanding this by taking two lists A and B
A=[aa, bb, abb] and B=[aab, ba, b]
Now for sequence 1, 2, 1, 3 first list will yield aabbaaabb and second list will yield same string
aabbaaabb.
So the solution to this PCP becomes 1, 2, 1, 3.
Post Correspondence Problems can be represented in two ways:
1. Domino’s Form :
2. Table Form :
6
UNIT-5
Explanation –
● Step-1:
We will start with tile in which numerator and denominator are starting with same
number, so we can start with either 1 or 2.
Lets go with second tile, string made by numerator- 10111, string made by
denominator is 10.
● Step-2:
We need 1s in denominator to match 1s in numerator so we will go with first tile,
string made by numerator is 10111 1, string made by denominator is 10 111.
● Step-3:
There is extra 1 in numerator to match this 1 we will add first tile in sequence, string
made by numerator is now 10111 1 1, string made by denominator is 10 111 111.
● Step-4:
Now there is extra 1 in denominator to match it we will add third tile, string made by
numerator is 10111 1 1 10, string made by denominator is 10 111 111 0.
Final Solution - 2 1 1 3
7
UNIT-5
Example-2:
Explanation –
● Step-1:
We will start from tile 1 as it is our only option, string made by numerator is 100,
string made by denominator is 1.
● Step-2:
We have extra 00 in numerator, to balance this only way is to add tile 3 to sequence,
string made by numerator is 100 1, string made by denominator is 1 00.
● Step-3:
There is extra 1 in numerator to balance we can either add tile 1 or tile 2. Lets try
adding tile 1 first, string made by numerator is 100 1 100, string made by
denominator is 1 00 1.
● Step-4:
There is extra 100 in numerator, to balance this we can add 1st tile again, string made
by numerator is 100 1 100 100, string made by denominator is 1 00 1 1 1. The 6th
digit in numerator string is 0 which is different from 6th digit in string made by
denominator which is 1.
8
UNIT-5
We can try unlimited combinations like one above but none of combination will lead us to
solution, thus this problem does not have solution.
Counter Machines:
Counter machine has the same structure as the multi-stack machine but in place of each stack is a
counter. Counters hold any non-negative integer,but we can only distinguish between zero and
nonzero counters. That's the move of the counter machine depends on its state,input symbol and
which if any of the counters are zero. In one move,the counter machine can
9
UNIT-5
a)change state
b)Add or subtract 1 from any of its counters,independently. However a counter is not allowed to
become negative,so it cant subtract from a counter that is currently 0.
Counter Machine may also be regarded as a restricted multi-stack machine. The restrictions are
as follows,
a)There are only two stack symbols,which we shall refer to as Z0(the bottom of stack marker)
and X.
b)Z0 is initially on each stack.
c)We may replace Z0 only by a string of the form X^iz0 for some
i >=0.
d)We may replace X only by X^i for some i >= 0. That's Z0 appears
only on the bottom of each stack and all other stack symbols if any are X.
10