More Deterministic Finite Automata




CS154

Chris Pollett

Feb. 9, 2011

Outline

Formal Definition

At the end of Monday, we gave the following formal definition of deterministic finite automata (DFA):

Example of the Definition

Implementing Finite Automata -- Base Class

Implementing Finite Automata -- Specific Automata

Comments on Code

Formal Definition of Accepting a String

The Extended Transition Function

Designing Automata

Trap States

Walks on Automata

Theorem

Let `M= (Q, Sigma, delta, q0, F)` be a DFA, and GM be its associated transition graph. Then for every `q_i`, `q_j` in `Q` and `w` in `Sigma^star` , `delta^star(q_i,w) = q_j` iff there is in GM a walk with label `w` (that is, the edge labels written down as a string are `w`) from `q_i` to `q_j`.

Proof. We give a proof by induction on the length `n geq 0` of `w`. Notice `delta^star(q, epsilon)=q` corresponds exactly with a walk of length `0` in GM . So the `|w|=0` case holds. Assume the statement is true up to some `n`. Let `w=va` where `|v|=n`. (The induction step case.) Suppose `delta^star(q_i,v) = q_k` . By the induction hypothesis there is a walk `W` of length `n` in GM from `q_i`,to `q_k`. If `delta^star(q_i,w) = q_j` we must have `delta^star(q_i,w) = delta (delta^star(q_i,v), a) = q_j` by the definition of `delta^star.` So we have `delta(q_k,a) = q_j`. Thus, if we add to `W` the edge `(q_k, q_j)`, the label on the resulting walk will be `va=w` as desired. This new walk has length `n+1`. It is also not hard to turn this argument around to show if one stated with a walk of length `n+1` with label `w`, that one could show `delta^star(q_i,w) = q_j`. You should do this at home.

Regular Operations