An Introduction to Automata
Why are automata so interesting? Automata are so simple that they fit in many places and situations.
You can use automata
- to describe real machines (vending machines, industrial automations, etc.)
- to validate protocols1
- as a language to express constraints2
- as a basic machine learning model without much generalization power
- to get insights on entangled quantum states3
- for all kind of string search/manipulation algorithm
A deterministic finite automaton (DFA) is made of
- a finite alphabet
4 - a finite set of states
- a transition function
- a starting state
- a set of accepting states
and it works in this way: you are given a word
- the automaton is initialized at state
- for each letter
, starting from , update the state to - if the last state
is an accepting state ( ) then the word is accepted otherwise it is rejected
in the end the automaton computes a function
The automaton is called deterministic because at each step it is in a definite state.
The state summarizes the relevant features (relevant for the final decision to accept or reject the word) of the input processed so far.
The language of an automaton is just the set of recognized words, the language recognized by a DFA is called regular.
The alphabet is different from application to application, for example:
- for modeling machine the letters are events like the pushing of a button, the activation of a sensor etc.
- for protocols they are actions performed by some party
- for string algorithms they are just characters
For example consider the following DFA

and consider the word "byyxy"

it is accepted because the automaton ends up in state
The traversed states encode the relevant features of the word, for example
state
On the other hand the word "abx"

is rejected because the automaton is stuck in the non-accepting state
So the automaton accepts a word if there is a path connecting the start state to the accepting state.
The same automaton can generate random words from its language by performing a random walk on its graph.
Another way to look at
Suppose you are given a word
the elements
This can be seen easily for a length 2 path:
the term inside the sum is non-zero only if there is a path
Take the word "byyxy" as an example, we can take

which is zero except for the entry
Can we make a DFA more powerful?
Imagine a machine that can be in more than one state at a time, this amounts
to changing the DFA definition of
Consider for example this NFA7

note that now, starting from
Consider the word "abab", the NFA performs these transitions
which end in an accepting state.

Note how the fact that the automaton can be in more than one state at once introduces multiple paths.
Now the question is:
Does this kind of flexibility lead to a richer structure of the accepted language? Does an NFA accept a larger language than a DFA?
Surprisingly the answer is NO?
Given an NFA it is always possible to build an equivalent DFA that accepts the same language through the subset construction.
The idea is to take
Taking the previous example we can enumerate all the distinct states needed by the NFA
NFA | DFA |
---|---|
adding the transitions the resulting DFA is

Footnotes:
for an example in operation research see GitHub - lucamarx/pywfplan: A Python library to plan a call center workforce
I hope to write more about this when I will understand it better
we denote the set of words
made by letters in
since the automaton is deterministic it can be only 0 or 1
a set of states is accepted if it contains at least one accepting state
it accepts any word that contains an "ab" or a "ba"