You are on page 1of 1

Informatique Théorique Spring 2011

Handout 1: Finite Automata

1.1 Example. Check if a binary number is divisible by 3. While processing the input, we need to
remember not the entire processed portion x of the input, but only the remainder of x when divided
by 3. This remainder can be updated one input symbol at a time:
x ≡ 0 mod 3 → x0 ≡ 0 mod 3 x ≡ 0 mod 3 → x1 ≡ 1 mod 3
x ≡ 1 mod 3 → x0 ≡ 2 mod 3 x ≡ 1 mod 3 → x1 ≡ 0 mod 3
x ≡ 2 mod 3 → x0 ≡ 1 mod 3 x ≡ 2 mod 3 → x1 ≡ 2 mod 3
We remember “x ≡ 0 mod 3” in state a, and “x ≡ 1 mod 3” in state b, and “x ≡ 2 mod 3” in state c:

0 1

 
+ +
1 0
/ A k B k C
1 0

1.2 Definition of a finite automaton. A finite automaton M consists of


Q . . . a finite set of states (the state space),
Σ . . . a finite set of input symbols (the input alphabet),
δ: Q × Σ → Q . . . a transition function,
q0 ∈ Q . . . an initial (or start) state,
F ⊆ Q . . . a set of final (or accept) states.
In mathematics, we say that M is the 5-tuple (Q, Σ, δ, q0 , F ). In examples, it is often most intuitive to
draw the state diagram of M , which is a labeled digraph as shown in Example 1.1. For this example:
Q = {a, b, c},
Σ = {0, 1},
δ(a, 0) = a, δ(a, 1) = b, δ(b, 0) = c, etc.,
q0 = a,
F = {a}.

1.3 Language of a finite automaton. A run of M is a sequence


a a an−1
s0 →0 s1 →1 ··· → sn
with s0 , . . . , sn ∈ Q and a0 , . . . , an−1 ∈ Σ such that
(1) s0 = q0 ,
(2) si+1 = δ(si , ai ) for all i ∈ [0..n − 1].
The run accepts the input word a0 . . . an−1 if
(3) sn ∈ F .
The language of M is
L(M ) = {w ∈ Σ∗ | w is accepted by some run of M }.
The language of the automaton from Example 1.1 is the set of binary numbers that are divisible by 3.
For instance, the word 011 is accepted by the following run:
0 1 1
a → a → b → a
By contrast, the word 010 is not accepted by any run; in particular, the run
0 1 0
a → a → b → c
does not end in a final state.

1.4 Regular language. A language L is called a regular language if L is the language of some finite
automaton (i.e., there exists a finite automaton M such that L(M ) = L).

1
c T.A. Henzinger, G. Théoduloz

You might also like