To make all this precise (and eventually prove that it works) we
may need to refresh your knowledge of finite automata a bit.
First, recall the structure of a deterministic finite state machine.
A finite set of states, .
An input alphabet, .
A transition function : x -> .
A subset F of called the set of final
states.
An element 0 of called the initial state.
While you are at it, recall (or at least note) that we can explain
the behavior of a deterministic finite state machine by defining
a function that extends to strings over the input
alphabet. In particular, we can define
: x * -> recursively as
( , ) =
( , x ) = ( ( , ), x )
and then state that the language accepted by the machine is