Basic Examples (3)
Basic Examples
(3)
A simple NFA that rejects the given input:
In[46]:=
Out[46]=
The intial state of the NFA is After the next input 1, the new state is After the next input 1, the new state is After the next input 1, the new state is After the next input 0, the new state is After the next input 0, the new state is After the next input 0, the new state is This is the last state and the string is not accepted.
q
0
q
1
q
2
q
0
q
2
q
1
q
0
———
If the last state is in the list of accept states, the input is accepted:
In[47]:=
Out[47]=
The intial state of the NFA is After the next input 1, the new state is After the next input 1, the new state is After the next input 1, the new state is After the next input 0, the new state is After the next input 0, the new state is After the next input 0, the new state is This is the last state and the string is accepted.
q
0
q
1
q
2
q
0
q
2
q
1
q
0
———
If one of the letters in the input is not in the alphabet, the simulation will throw an error:
In[51]:=
Out[51]=
Error: One or more of the input characters are not in the alphabet
Scope (1)
Scope
(1)