TOC

Created by
BBorhan
Last edited time
Tag
Moore MachineMealy Machine
Output depends only upon the present state.Output depends on the present state as well as present input.
Output is placed on states. Output is placed on transitions.  
Easy to design. It is difficult to design. 
If input changes, output does not changeIf input changes, output also changes.
More states are required. Less number of states are required.  

Using Arden’s theorem:

Removable ambiguity inherent ambiguity
It can be removedIt’s not
This refers to ambiguity which is present in a grammar and we can remove it by writing another grammar that is unambiguous produces the same languageThis is the situation when every grammar that generates a given language, say L is ambiguous we say the language is inherently ambiguous
. E --> E + E | E * E | idL  =  {a^m b^m c^n  | m,n >= 0}  U  {a^m b^n c^n | m,n >= 0}

  1. Since S is in right side we have to add S' -> S :
    S>SS>bAaBA>bAAaSaB>ABBbSb S' -> S \\ S-> bA | aB \\ A-> bAA | aS | a \\B-> ABB | bS | b
  1. Removing Null Pointer : There's no null pointer
  1. Remove Unit Production:
    After removing S' -> S :
S>bAaBS>bAaB,A>bAAaSa,B>aBBbSbS' -> bA | aB \\ S -> bA | aB,\\ A-> bAA | aS | a,\\ B-> aBB | bS | b
  1. Removing Useless symbol
  1. Replacing the productions that has more than two variables in RHS
S>bAaBS>bAaBA>bAAaSaB>AXbSbX>BBS' -> bA | aB \\ S -> bA | aB \\ A -> bAA | aS | a \\ B -> AX | bS | b \\ X -> BB\\
  1. Change in Production where terminal is left of variable where P → qA
S>YAZBS>YAZBA>ZMZSSB>AXYSbX>BBY>bZ>aM>AAS' -> YA | ZB \\ S-> YA | ZB \\ A -> ZM | ZS | S \\ B -> AX | YS | b \\ X -> BB \\ Y -> b \\ Z -> a \\ M -> AA \\

Closure has the highest precedence, followed by concatenation, followed by union.

Rijk=Rijk1+Rik(Rkkk1)Rkjk1R{_i}{_j}^k = R{_i}{_j}^{k-1} + R{_i}{_k} (R{_k}{_k}^{k-1})^* R{_k}{_j}^{k-1}

The transitions on state are self-loop

A grammar where every production is either of the form A → BC or A → c (where A, B, C are arbitrary variables and c an arbitrary symbol).

A CFG is in CNF if all production rules satisfy following conditions

(i) (i) 

Useful symbols ={a,b,A,B,S,D}= \{a, b, A, B, S, D\}

C C  is Useless.

Grammar :

SaAabBbϵAaBbDABabS \rarr aAa | bBb |\epsilon \\ A \rarr a \\ B \rarr b \\ D \rarr A | B |ab

(ii)(ii)

Eliminating SϵS \rarr \epsilon :

SaAabBbAaBbDABabS \rarr aAa | bBb \\ A \rarr a \\ B \rarr b \\ D \rarr A | B |ab

(iii)(iii)

Eliminating DAD \rarr A & DBD \rarr B (Unit Production):

SaAabBbAaBbDababS \rarr aAa | bBb \\ A \rarr a \\ B \rarr b \\ D \rarr a | b |ab

(i)(i) Leftmost Derivation

S → aASaAS

aSbASaSbAS (Rule 1)

aabASaabAS (Rule 2)

aabbaSaabbaS (Rule 1)

aabbaaaabbaa (Rule 2)

(ii)(ii) Rightmost Derivation

SaASS \rarr aAS

aAaaAa (Rule 1)

aSbAaaSbAa (Rule 2)

aSbbaaaSbbaa (Rule 2)

aabbaaaabbaa (Rule 1)

(iii)(iii) Parse tree

(i)(i)

Leftmost derivation

EEEE \rarr E * E

IIEII*E

aIEaI*E

aI(E)aI*(E)

aI(E+E)aI * (E+E)

aI(II+E)aI * (II+E)

aI(IbI+E)aI*(IbI+E)

aI(abI+E)aI*(abI + E)

aI(abI+I0)aI*(abI +I0)

aI(abI+II0)aI*(abI +II0)

aI(abI+bI0)aI*(abI +bI0)

aI(abI+bIa0)aI*(abI +bIa0)

Rightmost derivation

EEEE \rarr E*E

E(E)E*(E)

E(E+E)E * (E+E)

E(E+I)E*(E+I)

E(E+II)E*(E+II)

E(E+bI)E*(E+bI)

E(I+bI)E*(I+bI)

E(I0+bI)E*(I0+bI)

E(a0+bI)E*(a0+bI)

I(a0+bI)I*(a0+bI)

I0(a0+bI)I0*(a0+bI)

II0(a0+bI)II0*(a0+bI)

IIa0(a0+bI)IIa0*(a0+bI)

bIa0(a0+bI)bIa0*(a0+bI)

Type of Complexity Classes

DFANFA
DFA stands for Deterministic Finite Automata.NFA stands for Nondeterministic Finite Automata.
For each symbolic representation of the alphabet, there is only one state transition in DFA.No need to specify how does the NFA react according to some symbol.
DFA cannot use Empty String transition.NFA can use Empty String transition.
DFA can be understood as one machine.NFA can be understood as multiple little machines computing at the same time.
In DFA, the next possible state is distinctly set.In NFA, each pair of state and input symbol can have many possible next states.
DFA is more difficult to construct.NFA is easier to construct.
DFA requires more space.Less
All DFA are NFA.Not all NFA are DFA.
δ: QxΣ -> Qδ: Qx(Σ U ε) -> 2^Q
Epsilon move is not allowed in DFAEpsilon move is allowed in NFA