d | 0 | 1 | e | |
-> | A | 0 | {B} | 0 |
B | {D} | 0 | {C} | |
* | C | 0 | {E} | 0 |
D | 0 | {B} | 0 | |
E | {C} | 0 | 0 |
Answer: NFA:
d | 0 | 1 | |
-> | A | 0 | {B, C} |
B | {D} | {E} | |
* | C | 0 | {E} |
D | 0 | {B, C} | |
E | {C} | 0 |
Answer:
*/RL = {C0, C1,
C2, C3 }, where
C0 = e,
C1 = a(a+b)*b,
C2 = a(a+b)*a,
C3 = b(a+b)*.
The index of RL is 4.
Answer:
S -> AB A -> aAb | ab B -> cBd | cdThe derivation tree:
S / \ A B /\ / \ a b c d
S -> aBC B -> bB | b C -> D D -> ab
Answer: After the removal of unit productions:
S -> aBC B -> bB | b C -> ab D -> abAfter the removal of useless symbols:
S -> aBC B -> bB | b C -> abAfter replacing terminal with new variables:
S -> CaBC B -> CbB | b C -> CaCb Ca -> a Cb -> bEquivalent grammar in CNF:
S -> CaD D -> BC B -> CbB | b C -> CaCb Ca -> a Cb -> b
Answer:
a) Ga: S -> AB, A -> aAb | ab, B -> cB | c
b) Gb: S -> AB, A -> aA | a, B -> bBc | bc
Answer:
d | 0 | 1 | B |
q0 | (q0,0,R) | (q1,1,R) | (q2,B,R) |
q1 | - | (q1,1,R) | (q2,B,R) |
q2 | - | - | - |
Answer:
L= { <M,w> | M accepts
w}.
There is an algorithm to determine if a DFA M accepts
the string w. The algorithm halts in |w| steps, with Yes
or No answer. Therefore, the language L is recursive, and the
problem is decidable.