Processing math: 32%

Finite Automata

In this section we start our formal investigations into various models of computation, starting with one of the simplest forms: finite automata.

Reading

Sections 1.1

Practice problems (page 83): 1.1, 1.3, 1.4, 1.6, 1.12, 1.36, 1.37

Finite Automata

Examples and State Diagrams

The idea of a finite automaton is simple:

We usually represent finite automata via a state diagram:

In the state diagram for a finite automaton, you have:

As an example, let us think of inputs being binary numbers (only 0 and 1 as digits), and we want a finite automaton that detects if the number is divisible by 3. Recall that a number is divisible by 3 if and only if the sum of its digits are. Since we see the digits one at a time, we will keep track of the remainder on division by 3 at each stage. So:

Now as practice for you: Suppose we want a finite automaton that detects division by 7. We can still do it by keeping track of the remainder, but some changes would need to be made:

Exercise 1.37 asks you to generalize this idea.

Another practice problem: Describe an automaton that takes as input a string of a’s and b’s, and accepts only those strings where no letter appears twice in a row.

Formal Definitions

Eventually we want to have clear unambiguous definitions, so here is a more precise definition of finite automata:

A (Deterministic) Finite Automaton (DFA) is a 5-tuple (Q, \Sigma, \delta, q_0, F), where:

Question 1: What happens if F is the empty set? What if F = S?

Question 2: Use this formal definition to describe the automaton for division by 3 that we described earlier.

Question 3: Do the same for the automaton for division by 2.

We now discuss the meaning of computation in this setting. Informally we compute as follows:

More formally:

Suppose M = (Q, \Sigma, \delta, q_0, F) is a DFA.

Note that there might be many DFAs all recognizing the same language. But for a given DFA there is exactly one language it recognizes, namely the language of all strings in \Sigma that the DFA accepts.

Practice problem: Construct DFAs (including writing out the formal definition) for the following languages:

Practice problem: If we have the DFA for a language, what would the DFA for the “complement” language be?

The Union of Regular Languages

Regularity of a language (i.e. having a DFA that recognizes it) is preserved under a number of operations. In this section we will focus on the union:

Theorem

If A_1 and A_2 are two regular languages, then their union A_1 \cup A_2 is also regular.

In this section we will prove this theorem.

Question: What do you think about the intersection of regular languages?

The concatenation of regular languages, as well as the kleene star of a regular language, are regular, but this fact will be harder to prove, and it will be a consequence of further work we will do with non-deterministic automata and regular expressions.