TAFL
TAFL
Session: 2023-24
Semester: IV
Course Code: BCS-402
Course Name: TAFL
UNIT-I
Giv DFA accepting the following language over ∑= {0,1} 2021 CO1
i) Number of 1’s is multiple of 3.
1 ii) Number of 1’s is not multiple of 3. 10
iii) Containing either substring ‘000’ or ‘111’
iv) All the strings that end with 11 and contain 101 as substring.
Design a DFA which accepts the set of strings over alphabet Σ = { 1, 2, 3, 2022 10 CO1
2 4 } such that string when interpreted as decimal numbers, sum of their
digits are divisible by 5.
Determine an NFA accepting all strings over {0,1} which end with 1 but 2021 10 CO1
3 does not contain the substring 00. Also calculate equivalent DFA.
Design the DFA that accepts an even number of a’s and even number 10 CO1
4 of b’s.
Minimize the automata given below 2022 10 CO1
Compute the epsilon- closure for the given NFA. Convert it into DFA 2021 10 CO1
UNIT-II
Write the regular expression for the following languages: (2010-11) 2021 10 CO2
i) The set of all strings of 0’s and 1’s which ends with 1 and
does not contain substring 00.
ii) The set of all strings of 0’s and 1’s with an equal number
of 0’s and 1’s such that no prefix has two more 0’s than
1’s nor two more 1’s than 0’s.
iii) The set of all strings of 0’s and 1’s in which every 0 is
followed by 11
1 iv) The set of all strings of 0’s and 1’s in which the number
of 0’s is even
v) Set of strings of 0’s and 1’s whose 5’th symbol from the
left end is 1
vi) The set of string {a, b, c} containing at least one a and at
least one b
vii) L = { anbm : n>=4 and m <=3 }
viii) L = { w: |w| mod 3 = 0}, w Є (a,b)*
i) Obtain the NFA without epsilon transition corresponding to the 2021 10 CO2
following regular expression:
2
( 0* + 1*)*11(1*0*)* ,
00( 0* + 1*)*11
ii) Construct Є-NFA for regular expression (a + b)*ab*
Let r1 and r2 be two regular expressions defined as follows: 2021 10 CO2
r1 = (00*1)*1
3 and r2 = 1 + 0(0 + 10)*11
Prove that r1 = r2
Find all the regular expressions Rij(2) for the following DFA 2021 10 CO2
(2012-13)
State/Input a b
(Transition)
4 q0 q1 q0
q1 q1 q2
*q2 q2 q1
b)
7 i.) Use the pumping lemma to show that following language is 2022 10 CO2
not regular:
L = {ap | p is prime number} is not regular.
ii).Define Pumping Lemma for Regular Languages. Prove that the
language L = {0n 1n | n>=1} is not regular.
Explain closure and decision properties of regular languages with 10 CO2
8 suitable examples.
UNIT-III
Simplify the following grammar by eliminating useless symbols and 2021 10 CO3
useless production:
S a| aA | B | C |
1 A aB | Є, B Aa, C cCD, D dd
Also find the Chomsky Normal form of the simplified
grammar
Construct the following CFG G with start symbol S, which generate the 2022 10 CO3
set of arithmetic expressions:
SS+S|S*S|S^S|a
Given that the precedence of operator in decreasing order is ^,
4 *, +. The operator +, * are left associative while ^ is right
associative:
a)Show that given grammar is ambiguous
b)Write the equivalent unambiguous CFG G’ which generate the same
language.
5 Explain in detail about closure and decision properties of context free 10 CO3
languages
Give the complete hierarchy of grammar with their recognizers as well 2021 10 CO3
6
as the form of production rules( Chomsky Classification).
Write the context free grammar for the language L defined as follows 2021 10 CO3
7
L = { aibjck | i = j or j = k; i, j, k are positive integers }
A context free grammar G is given by the following productions: E→E+E| 2023 10 CO3
E-E|E∗E|E^E|N N→0|1|2|3|4|5|6|7|8|9 Determine whether the
8
grammar G is ambiguous or not.If ambiguous then construct an
unambiguous grammar equivalent to G.
UNIT IV
i) Construct a PDA that accepts the language L over {a, b, c} defined as 10 CO4
follows:
L = { am bn cp | p=m+n; m, n, p >0 }
ii) Construct a PDA for the context free grammar ( {S, A, B}, {a, b}, P, S)
where productions P are as follows:
1 S aABB| aAA
A aBB | a
B bBB | A
UNIT-V
i) Draw the model diagram for Turing Machine and Church-Turing 10 CO5
thesis.
ii) Discuss various variations of Turing machine
1) Multi track TM
1 2) Multi tape TM
3) Multi-dimensional TM
4) Non deterministic TM
iii) Write Short notes on Universal Turing Machine
iv) Write short notes on the halting problem of Turing machine
i) Differentiate between recursive language and recursively 2021 10 CO5
enumerable language.
2 ii) What do you mean by unsolvable problem? Explain
iii Prove that if a language L and complement of L both are
recursively enumerable then L is recursive
i) Define Post Correspondence Problem (PCP) and Modified Post 2021 10 CO5
Correspondence Problem (MPCP). Prove that if PCP is
describable then MPCP would be decidable
3
ii) State and prove that Post Correspondence Problem (PCP) is
undecidable
i)Construct a TM that accepts the set of all palindromes over the input 2022 10 CO5
alphabets {a, b}
ii) Design a TM recognizing the following language.
4
L = { am b anbapbam+n+p| m, n,p >= 1 }
Let T1 and T2 be two Turing Machine; compute the functions f1 and f2 2022 10 CO5
from N to N (where N is a natural number), respectively,
6
construct a Turing machine that computes the function
i) min(f1, f2).
ii) max(f1, f2).
Design a TM that computes the integer function f defined as follows 10 CO5
7 f(n) = 3n where n is integer and n>=0
Design a 2-track TM that takes as input on track-1 an and leaves on track- 10 CO5
8
2 the binary representation on n.
9. Differentiate Post’s Correspondence Problem (PCP) and 2022 CO5
Modified PCP with its applications. Find a PCP solutions of the
lists (if possible):
X=(10,011,101) and Y=(101 ,11, 011).