SlideShare a Scribd company logo
1 of 3
Download to read offline
MTH 401: Theory of Computation April 22, 2014
Department of Mathematics and Statistics Time: 180 minutes
Indian Institute of Technology - Kanpur Maximum Score: 40
End-semester Examination
1. Indicate whether following statements are true or false. Justify your answer (to justify
a claim that a statement is true, an (informal) proof is required; to justify a claim
that a statement is false, a single counterexample is sufficient.) Note that no credit
will be given to a correct guess without any explanation or followed by an
incorrect justification.
(a) The language {0, 1}∗
is countable. [1]
True. Clearly,
{0, 1}∗
=
∞
n=0
{w ∈ {0, 1}∗
: |w| = n},
is a countable union of finite sets, and therefore, countable.
(b) The regular expression 0∗
(100 + 010 + 001)0∗
generates the language {w | w ∈
{0, 1}∗
and w contains at least two 0s and at most one 1}. [1]
False. Clearly, a string generated by the given regular expression always contains
exactly one 1.
(c) If a language is accepted by a non-deterministic finite state machine, then it is
clearly context-free. [1]
True. A language that is accepted by a non-deterministic FSM is regular, and
all regular languages are context-free.
(d) If L1L2 is regular then L1 and L2 are both regular. [1]
False. L1 = L(0∗
) and L2 = {0p
| p is a prome}. Clearly, L1L2 = L(0∗
){ , 0, 00}
is regular whereas L2 is not regular.
(e) If L∗
= ∅, then L = ∅. [1]
False. An equivalent statement is: if L = ∅, then L∗
= ∅. Clearly false, as ∈ L∗
even when L = ∅.
(f) If a and b are letters in an alphabet, then (a∗
b∗
)∗
= (a + b)∗
. [1]
True. w ∈ L((a∗
b∗
)∗
) ⇐⇒ there are integers m1, . . . , mk ≥ 0, and n1, . . . , nk ≥
0 for some k ≥ 0 such that w = an1
bm1
. . . ank bmk ⇐⇒ w ∈ L((a + b)∗
).
(g) The language given by {w ∈ {0, 1}∗
| n0(w) = n1(w)}, where na(w) denotes the
number of occurrences of the symbol a in w, is a context free language. [1]
True. {w ∈ {0, 1}∗
| n0(w) = 2n1(w)} = L(G) where G = ({0, 1}, {S}, S, {S →
0S0S1 | 0S1S0 | 1S0S0}).
2
(h) Let L be a language over the alphabet {0, 1}. If L∗
is regular, then L is also
regular. [1]
False. Let L = {0, 1} ∪ {0n
1n
| n ≥ 0}. Then L∗
= {0, 1}∗
is clearly regular
where as L is not regular.
(i) The set of Turing machines over a given alphabet that do not accept any even
length palindrome is decidable. [1]
False. By Rice’s Theorem.
(j) If L1 is Recursive and L2 is PSPACE-complete then there is a reduction from
L1 to L2. [1]
False. For example, any recursive language in EXP that is not in PSPACE can
not be reduced to a PSAPCE-complete language.
2. Let P be the set of all pushdown machines and e : P → {0, 1}∗
be a given function.
Let L = {w ∈ Σ∗
| w ∈ L(w)}, where L(w) = L(P) if w = e(P). Note that L(w) = ∅
if w ∈ e(P). Show that L is not a context free language. [10]
Solution: Suppose L is context free. Then, there is a pushdown machine P0 such that
L = L(P0). Let w0 = e(P0). If w0 ∈ L = L(P0) = L(w0), then, by definition of L,
w0 ∈ L. A contradiction. Similarly, if w0 ∈ L = L(P0) = L(w0), then, by definition of
L, w0 ∈ L. Again a contradiction. Thus, L is not context free.
3. Let Σ = {a}. Suppose L0 = {(x1, y1), (x2, y2), . . . , (xn, yn) | xi, yi ∈ Σ∗
} be a language
over the alphabet Σ0 = Σ ∪ {(} ∪ {)} ∪ {, } and
LPCP = {(x1, y1), . . . , (xn, yn) ∈ L0 |
there exists (i1, . . . , im) with 0 ≤ il ≤ n such that xi1 · · · xim = yi1 · · · yim }.
Show that LPCP is recursive. [10]
Solution: In order to show that LPCP is recursive, we need to provide a membership
algorithm. Note that every p = (x1, y1), (x2, y2), . . . , (xn, yn) ∈ L0 is of the form
p = (al1
, am1
), (al2
, am2
), . . . , (aln
, amn
) for some l1, l2, . . . , ln and m1, m2, . . . , mn.
Thus, given any p = (al1
, am1
), (al2
, am2
), . . . , (aln
, amn
) ∈ L0, the following algorithm
decides its membership to LPCP :
Step 1: For each i = 1 to n, compute di = li − mi.
Step 2: If for all i0 ∈ {1, 2, . . . , n}, di > 0, then p ∈ LPCP .
Step 3: Else if for all i0 ∈ {1, 2, . . . , n}, di < 0, then p ∈ LPCP .
Step 4: Else if the is an i0 ∈ {1, 2, . . . , n} such that di0 = 0, then p ∈ LPCP as xi0 = yi0 .
3
Step 5: Else there is an i1 ∈ {1, 2, . . . , n} such that di1 > 0 and i2 ∈ {1, 2, . . . , n} such
that di2 < 0. Then, p ∈ LPCP as xi1 . . . xi1
(−di2
) times
xi2 . . . xi2
(di1
) times
= a−di2
li1
+di1
li2 = a−di2
(di1
+mi1
)+di1
(di2
+mi2
)
=
a−di2
mi1
+di1
mi2 = yi1 . . . yi1
(−di2
) times
yi2 . . . yi2
(di1
) times
.
4. Recall that, given two languages L1 and L2, their right quotient, denoted by L1/L2,
is defined as {w ∈ Σ∗
: ∃x ∈ L2 such that wx ∈ L1}. Suppose Σ = {0, 1, 2, 3}. Let
L1 = L(G1) and L2 = L(G2) where
G1 = (Σ, {S}, S, {S → 12
30 | 03
31 | 01232 | 12
S0 | 03
S1 | 012S2})
and
G2 = (Σ, {S}, S, {S → 030 | 131 | 232 | 0S0 | 1S1 | 2S2}).
Show that L1/L2 is not a context free language. [10]
Hint: Observe what elements can belong to the set L1/L2 to argue why it can not be
context free.
Solution: Let L = L1/L2. Each string z in L is obtained from words z1 in L1 and z2
in L2 satisfying z1 = zz2. Since each string in L1 or L2 contains the symbol 3 exactly
once, the terminal substrings starting from 3 in z1 and in z2 are the same. If the string
30 (or 31) is a substring of z1, then 12
30 (or 03
31) occurs in z1 and 030 (or 131) occurs
in z2. Either case contradicts the equation z1 = zz2. Thus the only letter which can
occur immediately to the right of 3 in z1 is 2. Therefore z1 must contain 01232 as a
substring and z2 must contain 232 as a substring. Hence the shortest strings which can
occur as z1, z2 are 01232 and 232. Thus 01 is in L. In z1 we see that 232 is preceded
by 1. Then any longer word for z2 must contain 12321, and the corresponding z1
must contain 03
012321. Therefore 04
is in L. This line of reasoning can be continued
inductively to provide a means of enumerating all the elements of L. We find that L
consists of the sequence
01, 04
, 12
03
, 14
02
, 16
0, 18
, 03
17
, 06
16
, . . . , 024
, . . .
where to pass from one string xi in the sequence to the next xi+1, we use the following
rule:
• If xi = yi0, then xi+1 = 12
yi.
• If xi = yi1, then xi+1 = 03
yi.
In particular, 0n
∈ L if and only if n = 4(6)k
for k ≥ 0.
Now, if L is a CFL, then there exists a pumping lemma constant N. Choose a k0
large enough such that n0 = 4(6)k0
> N. Clearly z = 0n0
∈ L with |z| > N. Now,
irrespective of how we split z into five pieces, u, v, w, x, y with x = uvwxy, |uwy| ≤ N,
|vx| = l > 0, uvi
wxi
y = 0n0+(i−1)l
∈ L for some i ≥ 0, a contradiction. Thus, L is not
a CFL.

More Related Content

What's hot

Algoritmos Greedy
Algoritmos GreedyAlgoritmos Greedy
Algoritmos Greedyluzenith_g
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common SubsequenceKrishma Parekh
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtrackingmandlapure
 
Ecfft zk studyclub 9.9
Ecfft zk studyclub 9.9Ecfft zk studyclub 9.9
Ecfft zk studyclub 9.9Alex Pruden
 
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVEChapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVEnszakir
 
Dynamic1
Dynamic1Dynamic1
Dynamic1MyAlome
 
DISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEMDISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEMMANISH KUMAR
 
Prerequisite for metric space
Prerequisite for metric spacePrerequisite for metric space
Prerequisite for metric spaceROHAN GAIKWAD
 
Definition ofvectorspace
Definition ofvectorspaceDefinition ofvectorspace
Definition ofvectorspaceTanuj Parikh
 
Arithmetic Progression
Arithmetic ProgressionArithmetic Progression
Arithmetic ProgressionDeepali Tanwar
 
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...Francesco Tudisco
 
Bc0052 theory of computer science
Bc0052   theory of computer scienceBc0052   theory of computer science
Bc0052 theory of computer sciencesmumbahelp
 
Arithmetic progression
Arithmetic progressionArithmetic progression
Arithmetic progressionMayank Devnani
 

What's hot (20)

Algoritmos Greedy
Algoritmos GreedyAlgoritmos Greedy
Algoritmos Greedy
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtracking
 
Ecfft zk studyclub 9.9
Ecfft zk studyclub 9.9Ecfft zk studyclub 9.9
Ecfft zk studyclub 9.9
 
Vector spaces
Vector spacesVector spaces
Vector spaces
 
Muchtadi
MuchtadiMuchtadi
Muchtadi
 
Vector space
Vector spaceVector space
Vector space
 
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVEChapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
 
Dynamic1
Dynamic1Dynamic1
Dynamic1
 
DISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEMDISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEM
 
Prerequisite for metric space
Prerequisite for metric spacePrerequisite for metric space
Prerequisite for metric space
 
Definition ofvectorspace
Definition ofvectorspaceDefinition ofvectorspace
Definition ofvectorspace
 
Inner product spaces
Inner product spacesInner product spaces
Inner product spaces
 
Arithmetic Progression
Arithmetic ProgressionArithmetic Progression
Arithmetic Progression
 
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
 
Vector space
Vector spaceVector space
Vector space
 
Backtracking
BacktrackingBacktracking
Backtracking
 
f'=f
f'=ff'=f
f'=f
 
Bc0052 theory of computer science
Bc0052   theory of computer scienceBc0052   theory of computer science
Bc0052 theory of computer science
 
Arithmetic progression
Arithmetic progressionArithmetic progression
Arithmetic progression
 

Similar to End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur

Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 
Dynamical systems solved ex
Dynamical systems solved exDynamical systems solved ex
Dynamical systems solved exMaths Tutoring
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdfshruti533256
 
RegularExpressions.pdf
RegularExpressions.pdfRegularExpressions.pdf
RegularExpressions.pdfImranBhatti58
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...parmeet834
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Dr. Maamoun Ahmed
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------MIGUELANGEL2672
 
Prin digcommselectedsoln
Prin digcommselectedsolnPrin digcommselectedsoln
Prin digcommselectedsolnAhmed Alshomi
 
Class1
 Class1 Class1
Class1issbp
 
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...Aladdinew
 

Similar to End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur (20)

unit 2 part b.docx
unit 2 part b.docxunit 2 part b.docx
unit 2 part b.docx
 
PART B.docx
PART B.docxPART B.docx
PART B.docx
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
Dynamical systems solved ex
Dynamical systems solved exDynamical systems solved ex
Dynamical systems solved ex
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
 
Linear algebra
Linear algebraLinear algebra
Linear algebra
 
RegularExpressions.pdf
RegularExpressions.pdfRegularExpressions.pdf
RegularExpressions.pdf
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 
Linear Algebra Assignment Help
Linear Algebra Assignment Help Linear Algebra Assignment Help
Linear Algebra Assignment Help
 
Lecture5
Lecture5Lecture5
Lecture5
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
 
Number theory
Number theoryNumber theory
Number theory
 
Prin digcommselectedsoln
Prin digcommselectedsolnPrin digcommselectedsoln
Prin digcommselectedsoln
 
Class1
 Class1 Class1
Class1
 
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
 
Theory of computation
Theory of computationTheory of computation
Theory of computation
 
Imc2016 day1-solutions
Imc2016 day1-solutionsImc2016 day1-solutions
Imc2016 day1-solutions
 

More from Vivekananda Samiti

End semester examination | MTH 653A, IITK Integral Equation
End semester examination | MTH 653A, IITK Integral Equation End semester examination | MTH 653A, IITK Integral Equation
End semester examination | MTH 653A, IITK Integral Equation Vivekananda Samiti
 
Mth 653 a end sem paper | Integral Equation
Mth 653 a end sem paper | Integral Equation Mth 653 a end sem paper | Integral Equation
Mth 653 a end sem paper | Integral Equation Vivekananda Samiti
 
Regression project report | Regression analysis | MTH 426 IITK
Regression project report | Regression analysis | MTH 426 IITK Regression project report | Regression analysis | MTH 426 IITK
Regression project report | Regression analysis | MTH 426 IITK Vivekananda Samiti
 
Project co prediction Regression analysis | MTH 426 IITK
Project co prediction Regression analysis | MTH 426 IITK Project co prediction Regression analysis | MTH 426 IITK
Project co prediction Regression analysis | MTH 426 IITK Vivekananda Samiti
 
Indian eduaction system group 13 | MTH 423A IITK
Indian eduaction system group 13 | MTH 423A IITKIndian eduaction system group 13 | MTH 423A IITK
Indian eduaction system group 13 | MTH 423A IITKVivekananda Samiti
 
Final presentation | MTH426A IITK
Final presentation | MTH426A IITKFinal presentation | MTH426A IITK
Final presentation | MTH426A IITKVivekananda Samiti
 
Mth 416A, Regression Analysis - 2016 midsem, endsem and quizes
Mth 416A, Regression Analysis - 2016   midsem, endsem and quizesMth 416A, Regression Analysis - 2016   midsem, endsem and quizes
Mth 416A, Regression Analysis - 2016 midsem, endsem and quizesVivekananda Samiti
 
Mth 416A end sem paper 2017, IITK
Mth 416A end sem paper 2017, IITK Mth 416A end sem paper 2017, IITK
Mth 416A end sem paper 2017, IITK Vivekananda Samiti
 
Mth 401 IITK theory of computation 2016
Mth 401 IITK theory of computation 2016Mth 401 IITK theory of computation 2016
Mth 401 IITK theory of computation 2016Vivekananda Samiti
 
Mth 412 IITK end sem paper 2016
Mth 412 IITK end sem paper 2016Mth 412 IITK end sem paper 2016
Mth 412 IITK end sem paper 2016Vivekananda Samiti
 
Phy 301 a end sem paper | Energy, IIT Kanpur
Phy 301 a end sem paper | Energy, IIT KanpurPhy 301 a end sem paper | Energy, IIT Kanpur
Phy 301 a end sem paper | Energy, IIT KanpurVivekananda Samiti
 
Fluidendsem | Mth 523 Fluid Dynamics | B V Rathish Kumar | IIT Kanpur
Fluidendsem | Mth 523 Fluid Dynamics | B V Rathish Kumar | IIT KanpurFluidendsem | Mth 523 Fluid Dynamics | B V Rathish Kumar | IIT Kanpur
Fluidendsem | Mth 523 Fluid Dynamics | B V Rathish Kumar | IIT KanpurVivekananda Samiti
 
Quiz3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz3 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurQuiz3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz3 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
Problem set3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Problem set3 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurProblem set3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Problem set3 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
Quiz2 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz2 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurQuiz2 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz2 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
Quiz1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz1 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurQuiz1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz1 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 

More from Vivekananda Samiti (20)

End semester examination | MTH 653A, IITK Integral Equation
End semester examination | MTH 653A, IITK Integral Equation End semester examination | MTH 653A, IITK Integral Equation
End semester examination | MTH 653A, IITK Integral Equation
 
Mth 653 a end sem paper | Integral Equation
Mth 653 a end sem paper | Integral Equation Mth 653 a end sem paper | Integral Equation
Mth 653 a end sem paper | Integral Equation
 
Regression project report | Regression analysis | MTH 426 IITK
Regression project report | Regression analysis | MTH 426 IITK Regression project report | Regression analysis | MTH 426 IITK
Regression project report | Regression analysis | MTH 426 IITK
 
Project co prediction Regression analysis | MTH 426 IITK
Project co prediction Regression analysis | MTH 426 IITK Project co prediction Regression analysis | MTH 426 IITK
Project co prediction Regression analysis | MTH 426 IITK
 
Mth426 group13 final_report
Mth426 group13 final_reportMth426 group13 final_report
Mth426 group13 final_report
 
Indian eduaction system group 13 | MTH 423A IITK
Indian eduaction system group 13 | MTH 423A IITKIndian eduaction system group 13 | MTH 423A IITK
Indian eduaction system group 13 | MTH 423A IITK
 
Final presentation | MTH426A IITK
Final presentation | MTH426A IITKFinal presentation | MTH426A IITK
Final presentation | MTH426A IITK
 
Mth 416A, Regression Analysis - 2016 midsem, endsem and quizes
Mth 416A, Regression Analysis - 2016   midsem, endsem and quizesMth 416A, Regression Analysis - 2016   midsem, endsem and quizes
Mth 416A, Regression Analysis - 2016 midsem, endsem and quizes
 
Mth 416A end sem paper 2017, IITK
Mth 416A end sem paper 2017, IITK Mth 416A end sem paper 2017, IITK
Mth 416A end sem paper 2017, IITK
 
Mth 401 IITK theory of computation 2016
Mth 401 IITK theory of computation 2016Mth 401 IITK theory of computation 2016
Mth 401 IITK theory of computation 2016
 
Mth 412 IITK end sem paper 2016
Mth 412 IITK end sem paper 2016Mth 412 IITK end sem paper 2016
Mth 412 IITK end sem paper 2016
 
Phy 301 a end sem paper | Energy, IIT Kanpur
Phy 301 a end sem paper | Energy, IIT KanpurPhy 301 a end sem paper | Energy, IIT Kanpur
Phy 301 a end sem paper | Energy, IIT Kanpur
 
Phy 301 a Presentation
Phy 301 a Presentation Phy 301 a Presentation
Phy 301 a Presentation
 
Phy 301 a | Project Report
Phy 301 a | Project ReportPhy 301 a | Project Report
Phy 301 a | Project Report
 
Mth 523 end sem paper
Mth 523 end sem paper Mth 523 end sem paper
Mth 523 end sem paper
 
Fluidendsem | Mth 523 Fluid Dynamics | B V Rathish Kumar | IIT Kanpur
Fluidendsem | Mth 523 Fluid Dynamics | B V Rathish Kumar | IIT KanpurFluidendsem | Mth 523 Fluid Dynamics | B V Rathish Kumar | IIT Kanpur
Fluidendsem | Mth 523 Fluid Dynamics | B V Rathish Kumar | IIT Kanpur
 
Quiz3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz3 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurQuiz3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
Problem set3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Problem set3 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurProblem set3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Problem set3 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
Quiz2 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz2 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurQuiz2 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz2 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
Quiz1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz1 | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurQuiz1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Quiz1 | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 

Recently uploaded

NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 

Recently uploaded (20)

NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 

End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur

  • 1. MTH 401: Theory of Computation April 22, 2014 Department of Mathematics and Statistics Time: 180 minutes Indian Institute of Technology - Kanpur Maximum Score: 40 End-semester Examination 1. Indicate whether following statements are true or false. Justify your answer (to justify a claim that a statement is true, an (informal) proof is required; to justify a claim that a statement is false, a single counterexample is sufficient.) Note that no credit will be given to a correct guess without any explanation or followed by an incorrect justification. (a) The language {0, 1}∗ is countable. [1] True. Clearly, {0, 1}∗ = ∞ n=0 {w ∈ {0, 1}∗ : |w| = n}, is a countable union of finite sets, and therefore, countable. (b) The regular expression 0∗ (100 + 010 + 001)0∗ generates the language {w | w ∈ {0, 1}∗ and w contains at least two 0s and at most one 1}. [1] False. Clearly, a string generated by the given regular expression always contains exactly one 1. (c) If a language is accepted by a non-deterministic finite state machine, then it is clearly context-free. [1] True. A language that is accepted by a non-deterministic FSM is regular, and all regular languages are context-free. (d) If L1L2 is regular then L1 and L2 are both regular. [1] False. L1 = L(0∗ ) and L2 = {0p | p is a prome}. Clearly, L1L2 = L(0∗ ){ , 0, 00} is regular whereas L2 is not regular. (e) If L∗ = ∅, then L = ∅. [1] False. An equivalent statement is: if L = ∅, then L∗ = ∅. Clearly false, as ∈ L∗ even when L = ∅. (f) If a and b are letters in an alphabet, then (a∗ b∗ )∗ = (a + b)∗ . [1] True. w ∈ L((a∗ b∗ )∗ ) ⇐⇒ there are integers m1, . . . , mk ≥ 0, and n1, . . . , nk ≥ 0 for some k ≥ 0 such that w = an1 bm1 . . . ank bmk ⇐⇒ w ∈ L((a + b)∗ ). (g) The language given by {w ∈ {0, 1}∗ | n0(w) = n1(w)}, where na(w) denotes the number of occurrences of the symbol a in w, is a context free language. [1] True. {w ∈ {0, 1}∗ | n0(w) = 2n1(w)} = L(G) where G = ({0, 1}, {S}, S, {S → 0S0S1 | 0S1S0 | 1S0S0}).
  • 2. 2 (h) Let L be a language over the alphabet {0, 1}. If L∗ is regular, then L is also regular. [1] False. Let L = {0, 1} ∪ {0n 1n | n ≥ 0}. Then L∗ = {0, 1}∗ is clearly regular where as L is not regular. (i) The set of Turing machines over a given alphabet that do not accept any even length palindrome is decidable. [1] False. By Rice’s Theorem. (j) If L1 is Recursive and L2 is PSPACE-complete then there is a reduction from L1 to L2. [1] False. For example, any recursive language in EXP that is not in PSPACE can not be reduced to a PSAPCE-complete language. 2. Let P be the set of all pushdown machines and e : P → {0, 1}∗ be a given function. Let L = {w ∈ Σ∗ | w ∈ L(w)}, where L(w) = L(P) if w = e(P). Note that L(w) = ∅ if w ∈ e(P). Show that L is not a context free language. [10] Solution: Suppose L is context free. Then, there is a pushdown machine P0 such that L = L(P0). Let w0 = e(P0). If w0 ∈ L = L(P0) = L(w0), then, by definition of L, w0 ∈ L. A contradiction. Similarly, if w0 ∈ L = L(P0) = L(w0), then, by definition of L, w0 ∈ L. Again a contradiction. Thus, L is not context free. 3. Let Σ = {a}. Suppose L0 = {(x1, y1), (x2, y2), . . . , (xn, yn) | xi, yi ∈ Σ∗ } be a language over the alphabet Σ0 = Σ ∪ {(} ∪ {)} ∪ {, } and LPCP = {(x1, y1), . . . , (xn, yn) ∈ L0 | there exists (i1, . . . , im) with 0 ≤ il ≤ n such that xi1 · · · xim = yi1 · · · yim }. Show that LPCP is recursive. [10] Solution: In order to show that LPCP is recursive, we need to provide a membership algorithm. Note that every p = (x1, y1), (x2, y2), . . . , (xn, yn) ∈ L0 is of the form p = (al1 , am1 ), (al2 , am2 ), . . . , (aln , amn ) for some l1, l2, . . . , ln and m1, m2, . . . , mn. Thus, given any p = (al1 , am1 ), (al2 , am2 ), . . . , (aln , amn ) ∈ L0, the following algorithm decides its membership to LPCP : Step 1: For each i = 1 to n, compute di = li − mi. Step 2: If for all i0 ∈ {1, 2, . . . , n}, di > 0, then p ∈ LPCP . Step 3: Else if for all i0 ∈ {1, 2, . . . , n}, di < 0, then p ∈ LPCP . Step 4: Else if the is an i0 ∈ {1, 2, . . . , n} such that di0 = 0, then p ∈ LPCP as xi0 = yi0 .
  • 3. 3 Step 5: Else there is an i1 ∈ {1, 2, . . . , n} such that di1 > 0 and i2 ∈ {1, 2, . . . , n} such that di2 < 0. Then, p ∈ LPCP as xi1 . . . xi1 (−di2 ) times xi2 . . . xi2 (di1 ) times = a−di2 li1 +di1 li2 = a−di2 (di1 +mi1 )+di1 (di2 +mi2 ) = a−di2 mi1 +di1 mi2 = yi1 . . . yi1 (−di2 ) times yi2 . . . yi2 (di1 ) times . 4. Recall that, given two languages L1 and L2, their right quotient, denoted by L1/L2, is defined as {w ∈ Σ∗ : ∃x ∈ L2 such that wx ∈ L1}. Suppose Σ = {0, 1, 2, 3}. Let L1 = L(G1) and L2 = L(G2) where G1 = (Σ, {S}, S, {S → 12 30 | 03 31 | 01232 | 12 S0 | 03 S1 | 012S2}) and G2 = (Σ, {S}, S, {S → 030 | 131 | 232 | 0S0 | 1S1 | 2S2}). Show that L1/L2 is not a context free language. [10] Hint: Observe what elements can belong to the set L1/L2 to argue why it can not be context free. Solution: Let L = L1/L2. Each string z in L is obtained from words z1 in L1 and z2 in L2 satisfying z1 = zz2. Since each string in L1 or L2 contains the symbol 3 exactly once, the terminal substrings starting from 3 in z1 and in z2 are the same. If the string 30 (or 31) is a substring of z1, then 12 30 (or 03 31) occurs in z1 and 030 (or 131) occurs in z2. Either case contradicts the equation z1 = zz2. Thus the only letter which can occur immediately to the right of 3 in z1 is 2. Therefore z1 must contain 01232 as a substring and z2 must contain 232 as a substring. Hence the shortest strings which can occur as z1, z2 are 01232 and 232. Thus 01 is in L. In z1 we see that 232 is preceded by 1. Then any longer word for z2 must contain 12321, and the corresponding z1 must contain 03 012321. Therefore 04 is in L. This line of reasoning can be continued inductively to provide a means of enumerating all the elements of L. We find that L consists of the sequence 01, 04 , 12 03 , 14 02 , 16 0, 18 , 03 17 , 06 16 , . . . , 024 , . . . where to pass from one string xi in the sequence to the next xi+1, we use the following rule: • If xi = yi0, then xi+1 = 12 yi. • If xi = yi1, then xi+1 = 03 yi. In particular, 0n ∈ L if and only if n = 4(6)k for k ≥ 0. Now, if L is a CFL, then there exists a pumping lemma constant N. Choose a k0 large enough such that n0 = 4(6)k0 > N. Clearly z = 0n0 ∈ L with |z| > N. Now, irrespective of how we split z into five pieces, u, v, w, x, y with x = uvwxy, |uwy| ≤ N, |vx| = l > 0, uvi wxi y = 0n0+(i−1)l ∈ L for some i ≥ 0, a contradiction. Thus, L is not a CFL.