Visva-Bharati · Department of Mathematics
MMO-41
Theory of Computation-II
M.Sc. Mathematics · Semester IV2016
- 1(i) Let $G=\langle\{S,A\},\{0,1,2\},P,S\rangle$ where P consists of\par $\{S\to0SA2\mid012,\ 2A\to A2,\ 1A\to11\}$.\par Show that $L(G)=\{0^n1^n2^n\mid n\ge1\}$. [3]
- 1(ii) Find a grammar G generating $L(G)=\{a^nb^nc^i\mid n\ge1;i\ge0\}$. [3]
- 1(iii) Define a recursively enumerable set. Show that a context-sensitive language is recursive. [4]
- 2(i) Define regular expression. Construct a deterministic finite automaton whose behaviour is the valuation of the regular expression $\mathbf{ab(a\mid b)^*ba}$.
- 2(ii) Construct a regular grammar G generating the regular set represented by the regular expression $\mathbf{a^*b(a\mid b)^*}$. [2]
- 2(iii) Show that $L=\{a^p\mid p\text{ is prime}\}$ is not a regular set. [2]
- 3(i) Define a context-free grammar. When can a context-free grammar be ambiguous? Show that for the grammar G with production rules\par \hspace*{4em}$S\to aAa;$\par \hspace*{4em}$A\to Sb\mid bCC\mid DaA;$\par \hspace*{4em}$C\to abb\mid DD;$\par \hspace*{4em}$D\to aDA;$\par \hspace*{4em}$E\to aC,$\par there exists a reduced grammar which is equivalent to G.
- 3(ii) Define a Push-down automaton. Define an instantaneous description of a Push-down automaton. Explain the move operation between instantaneous descriptions.
- 4 What is top-down parsing? Using FIRST() and FOLLOW() functions construct a top-down parser for $L(G)$, the language of arithmetic expressions involving $+$ and $*$ generated by the production rules\par \hspace*{4em}$E\to E+T\mid T$\par \hspace*{4em}$T\to T*F\mid F$\par \hspace*{4em}$F\to(E)\mid id.$\par Hence obtain a top-down parsing for $w=id+id*id$. \par\hfill P.T.O. \begin{center}[ 2 ]\end{center}
- 5 Define a Turing machine, an instantaneous description of a Turing machine. Consider a Turing machine described by the transition table:\par \begin{center}\begin{tabular}{l|c|c|c|c|c} & 0 & 1 & x & y & b\\\hline $q_1$ & $xRq_2$ & & & & $bRq_5$\\ $q_2$ & $0Rq_2$ & $yLq_3$ & & $yRq_2$ & \\ $q_3$ & $0Lq_4$ & & $xRq_5$ & $yLq_3$ & \\ $q_4$ & $0Lq_4$ & & $xRq_1$ & & \\ $q_5$ & & & & $yRq_5$ & $bRq_6$\\ $(q_6)$ & & & & & \end{tabular}\end{center} Describe the processing of the string `0011' using instantaneous descriptions. When a string $w\in\Sigma^*$ is said to the accepted by a Turing machine? Design a Turing machine to recognize the language $\{1^n2^n3^n\mid n\ge1\}$.
- 6 Define primitive recursive function over $N=\{0,1,2,\ldots\}$. Show that the function $f(x,y)=x.y$ is primitive recursive. When is a function said to be partial recursive? When can a function be Turing computable? Design a Turing machine for computing the successor function $S(x)$. Use it to show that $S(1)=2$.