A finitestate automaton is defined as a set of Prolog clauses. Some very limited familiarity with Prolog is assumed. A finitestate automaton is defined using the following relations:
It is worthwhile to note that we do not require that the transition relation is total. In other words, there can be states that have no outgoing transitions for certain symbols. In such cases we assume that these transitions do exist, but lead to some nonfinal state from which you cannot leave. This state is sometimes called the sink. In example 1 state 1 is such a sink. Thus, we may abbreviate example 1 as
In the representation we are using, we do not require that the alphabet and the set of states is defined explicitly. If the previous example is further abbreviated as:

(3) 