SlideShare uma empresa Scribd logo
1 de 3
Baixar para ler 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.

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 
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
 

Semelhante a 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
 
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
 
Assignment 2 solution acs
Assignment 2 solution acsAssignment 2 solution acs
Assignment 2 solution acs
 

Mais de 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
 

Mais de 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
 

Último

Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.elesangwon
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Forming section troubleshooting checklist for improving wire life (1).ppt
Forming section troubleshooting checklist for improving wire life (1).pptForming section troubleshooting checklist for improving wire life (1).ppt
Forming section troubleshooting checklist for improving wire life (1).pptNoman khan
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
Curve setting (Basic Mine Surveying)_MI10412MI.pptx
Curve setting (Basic Mine Surveying)_MI10412MI.pptxCurve setting (Basic Mine Surveying)_MI10412MI.pptx
Curve setting (Basic Mine Surveying)_MI10412MI.pptxRomil Mishra
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsResearcher Researcher
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organizationchnrketan
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 

Último (20)

Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Forming section troubleshooting checklist for improving wire life (1).ppt
Forming section troubleshooting checklist for improving wire life (1).pptForming section troubleshooting checklist for improving wire life (1).ppt
Forming section troubleshooting checklist for improving wire life (1).ppt
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
Curve setting (Basic Mine Surveying)_MI10412MI.pptx
Curve setting (Basic Mine Surveying)_MI10412MI.pptxCurve setting (Basic Mine Surveying)_MI10412MI.pptx
Curve setting (Basic Mine Surveying)_MI10412MI.pptx
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending Actuators
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organization
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 

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.