Finite Automata
# DFA
$$
\begin{align*} & \text{Finite Automaton} = (Q, \Sigma, \delta, q_0, F) \\ & \text{where:} \\ & Q \text{ is a finite set of states} \\ & \Sigma \text{ is a finite set of symbols called the alphabet} \\ & \delta: Q \times \Sigma \rightarrow Q \text{ is the transition function} \
& q_0 \in Q \text{ is the start state} \\ & F \subseteq Q \text{ is the set of accept states} \end{align*}
$$
# Dense
# Sparse
# NFA
- multiple paths possible (0, 1 or many at each step)
- Ξ΅-transition is a βfreeβ move without reading input
- Accept input if some path leads to accept state
- Useful Mathematically
# Conversion
# Regexp to NFA
# NFA to DFA
- subset construction
- Epsilon Closure
# Minimize DFA
- Divide the states into two sets. One contain all final states and other contain non-final states.
- For every states in the two sets, if for every alphabet, the transition is not distinguishable, it can be joined.
Partition β { DA , { D β DA } }
Worklist β { DA , { D β DA } }
while (Worklist β β
) do
select a set s from Worklist and remove it
for each character c in alphabet do
Image β { x | Ξ΄(x, c) β s }
for each set q in Partition that has a state in Image do
q1 β q β© Image
q2 β q β q1
if q2 β β
then // split q around s and c
remove q from Partition
Partition β Partition βͺ q1 βͺ q2
if q is in Worklist then // and update the Worklist, remove q from Worklist
Worklist β Worklist βͺ q1 βͺ q2
else if |q1| β€ |q2| then
Worklist β Worklist βͺ q1
else
Worklist β Worklist βͺ q2
if s = q then // need another s
break