Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Tutorial I
1) Design FSM for testing divisibility by 5 for decimal numbers.
2) Design FSM to check whether given unary number is divisible by 3 or
a
b
c
p
{p}
{q}
{r}
Q
{p}
{q}
{r}
*r
{q}
{r}
{p}
a. Compute the -closure of each state.
b. Give all the strings of length three or less accepted by the
automaton.
c. Convert the automaton to DFA.
5) Repeat above exercise for the following NFA.
a
b
c
p
{q , r}
{q}
{r}
Q
{p}
{r}
{p,q}
*r
6) Convert to DFA the following NFA
a.
p
q
r
*s
b.
0
{p,q}
{r}
{s}
{s}
1
{p}
{r}
{s}
p
q
r
*s
*t
0
{p,q}
{r,s}
{p,r}
-
1
{p}
{t}
{t}
-
5) Minimize the following DFA, where q0 is the start state and q3 & q5 are
final states.
q0
q1
q2
*q3
q4
*q5
A
q1
q0
q1
q5
q3
q5
b
q3
q3
q4
q5
q3
q5
0
q0
q1
q1
output
n
y
n
1
q1
q2
q2
output
n
n
y
p
p
q
0
q
p
r
0
r
p
r
1
8) Design Moore and Mealy machine that will read sequence made up
of letters a,e,i,o,u and will give same output as that of character
except when i followed by e will change to u.
lemma.
a)
L={0i1j| i>j}
b)
L={0m1n| gcd(m,n)=1}
c)
L={02n| n>=1}
d)
L={02n+1| n>=0}
e)
L={axbmcn | n, x>=3}
f)
L={ an | n>=0}
g)
L={ww | w {a,b}*}
h)
L = {x | x is palindrome, x {0,1}*}
i)
j)
L={ ap | p is prime}
S -> aB | ab
A->aAB | a
B -> ABb | b
2) Describe the language generated by the following grammar.
S -> aaSb
S -> A
A -> CAdd
A -> Cd
3) Eliminate e-productions from G, where G is consisting of following
productions.
S -> Aa | B
A-> a | bc | B
B -> A | bb
5) Consider CFG, G = (VN , , P, S) where VN ={ S,A,B }
= {0,1} and
P={
S -> A11B | 11A | B | 11
A -> 0
B -> BB }
Remove useless symbols from it.
6) Construct CFG without null production from the one which is given
below
S -> a | Ab | aBa
A -> b | ^
B -> b | A
n>=1}
4) Design Turing machine that recognize the language L= { x |
na(x)=nb(x) }
={a,b}
5) Construct PDA for the following Language.
L = { Om1nOm+n |m,n >= 1}
6) Define PDA and construct PDA for the grammar
E ->E+E | E-E | (E) | id