SlideShare a Scribd company logo
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 Subsequence
Krishma 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.9
Alex Pruden
 
Vector spaces
Vector spacesVector spaces
Vector spaces
Quasar Chunawala
 
Vector space
Vector spaceVector space
Vector space
Jaimin Patel
 
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
nszakir
 
Dynamic1
Dynamic1Dynamic1
Dynamic1MyAlome
 
DISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEMDISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEM
MANISH KUMAR
 
Prerequisite for metric space
Prerequisite for metric spacePrerequisite for metric space
Prerequisite for metric space
ROHAN GAIKWAD
 
Definition ofvectorspace
Definition ofvectorspaceDefinition ofvectorspace
Definition ofvectorspace
Tanuj Parikh
 
Inner product spaces
Inner product spacesInner product spaces
Inner product spaces
gidc engineering college
 
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
 
Vector space
Vector spaceVector space
Vector space
Mehedi Hasan Raju
 
Backtracking
BacktrackingBacktracking
Backtracking
Sally Salem
 
f'=f
f'=ff'=f
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 progression
Mayank 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

unit 2 part b.docx
unit 2 part b.docxunit 2 part b.docx
unit 2 part b.docx
karthikeyan Muthusamy
 
PART B.docx
PART B.docxPART B.docx
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
dawod yimer
 
Automata
AutomataAutomata
Automata
Gaditek
 
Automata
AutomataAutomata
Automata
Gaditek
 
Dynamical systems solved ex
Dynamical systems solved exDynamical systems solved ex
Dynamical systems solved ex
Maths Tutoring
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
shruti533256
 
Linear algebra
Linear algebraLinear algebra
Linear algebra
nagathangaraj
 
RegularExpressions.pdf
RegularExpressions.pdfRegularExpressions.pdf
RegularExpressions.pdf
ImranBhatti58
 
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
 
Linear Algebra Assignment Help
Linear Algebra Assignment Help Linear Algebra Assignment Help
Linear Algebra Assignment Help
Math Homework Solver
 
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
Dr. 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
 
Theory of computation
Theory of computationTheory of computation
Theory of computation
meresie tesfay
 
Imc2016 day1-solutions
Imc2016 day1-solutionsImc2016 day1-solutions
Imc2016 day1-solutions
Christos Loizos
 

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
 
Mth426 group13 final_report
Mth426 group13 final_reportMth426 group13 final_report
Mth426 group13 final_report
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 IITK
Vivekananda Samiti
 
Final presentation | MTH426A IITK
Final presentation | MTH426A IITKFinal presentation | MTH426A IITK
Final presentation | MTH426A IITK
Vivekananda 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 quizes
Vivekananda 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 2016
Vivekananda 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 2016
Vivekananda 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 Kanpur
Vivekananda Samiti
 
Phy 301 a Presentation
Phy 301 a Presentation Phy 301 a Presentation
Phy 301 a Presentation
Vivekananda Samiti
 
Phy 301 a | Project Report
Phy 301 a | Project ReportPhy 301 a | Project Report
Phy 301 a | Project Report
Vivekananda Samiti
 
Mth 523 end sem paper
Mth 523 end sem paper Mth 523 end sem paper
Mth 523 end sem paper
Vivekananda 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 Kanpur
Vivekananda 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 Kanpur
Vivekananda 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 Kanpur
Vivekananda 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 Kanpur
Vivekananda 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 Kanpur
Vivekananda 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

The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 

Recently uploaded (20)

The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 

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.