MIT 18.404 — Lecture 1

Introduction, Finite Automata, Regular Expressions

The class website is https://math.mit.edu/ sipser/18404/, taught by Michael Sipser. This course follows the textbook Introduction to the Theory of Computation, 3rd edition (also written by Michael Sipser).

§ Finite Automata

One simplified model of computation is the finite automaton. Here's a prototypical example.

Definition. A finite automaton M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F) is a five-tuple of the following:

We say that “MM accepts w=w1w2…wnw = w_1w_2\dots w_n” if starting at q0q_0 and following the arrows according to ww lands at an accept state.

Example. In the example above, we say that MM accepts 01101\str{01101} but rejects 00101\str{00101}.

Remark. Note that an accept state of a finite automaton need not be “stable”; it may have arrows to other states.

§ (Regular) Languages

Definition. Given a finite automaton MM, the language L(M)L(M) of MM is the set of all (finite) strings that MM accepts. Furthermore, we say that “MM recognizes AA” for some language AA if and only if A=L(M)A = L(M).

Example. In the example above, the language L(M)L(M) of MM is the set of (finite) strings with 11\str{11} as a substring.

Definition. A language AA is regular if AA is the language of some finite automaton.

Example. It turns out that…

Our goal is to be able to identify what the regular languages are.

§ Regular Operations and Regular Expressions

It helps to define the following:

Definition. For any two languages AA and BB, we can construct new languages via the regular operations:

Example. If A={01,10}A = \{\str{01}, \str{10}\} and B={22,33,44}B = \{\str{22}, \str{33}, \str{44}\}, then we have:

A∪B={01,10,22,33,44}    and    A∘B={0122,0133,0144,1022,1033,1044}.A \cup B = \{\str{01}, \str{10}, \str{22}, \str{33}, \str{44}\} ~~~ \text{ and } ~~~ A \circ B = \{\str{0122}, \str{0133}, \str{0144}, \str{1022}, \str{1033}, \str{1044}\}.

Meanwhile, we have A∗={ϵ,01,10,0101,0110,1001,1010,010101,010110,… }A^* = \{\epsilon, \str{01}, \str{10}, \str{0101}, \str{0110}, \str{1001}, \str{1010}, \str{010101}, \str{010110}, \dots\}.

Definition. We say that a regular expression is any expression formed using ϵ\epsilon, ∅\emptyset, atoms a∈Σa \in \Sigma, and regular operations.

As the name suggests, the following turns out to be true.

Theorem. (Regular Expressions are Regular) A language is regular if and only if some regular expression describes it.

For the rest of lecture, we'll work through a proof of one step of the “if” direction.

Theorem. (Union of Regular Languages) If A1A_1 and A2A_2 are regular languages, then so is A1∪A2A_1 \cup A_2.

Proof: The idea is to use the automata M1M_1 and M2M_2 that recognize A1A_1 and A2A_2 (respectively) and run them both simultaneously in a single automaton by taking their “cross product”. Here's an example of what that might look like.

Here, M1M_1 and M2M_2 are depicted as “one-dimensional” automata, drawn horizontally and vertically, respectively. Their cross product MM is the 3×33 \times 3 grid of states above and to the right of them. Evidently, the language of MM is A1∪A2A_1 \cup A_2.

Formally, writing Mk=(Qk,Σk,δk,qk,0,Fk)M_k = (Q_k, \Sigma_k, \delta_k, q_{k, 0}, F_k), the proof is to consider the finite automaton M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F) given by:

And that's it.   ■\blacksquare

Remark. Implicitly, we've assumed that the languages A1A_1 and A2A_2 use the same alphabet Σ=Σ1=Σ2\Sigma = \Sigma_1 = \Sigma_2. We will almost always assume this in general, but even without this assumption, the argument is easily repairable by taking Σ:=Σ1∪Σ2\Sigma := \Sigma_1 \cup \Sigma_2 instead.

By replacing “F:={(q1,i,q2,j)∣q1,i∈F1 or q2,j∈F2}F := \{(q_{1, i}, q_{2, j}) \mid q_{1, i} \in F_1 \text{ or } q_{2, j} \in F_2\}” with “F:=F1×F2F := F_1 \times F_2” in the proof, one can also prove the following:

Theorem. (Intersection of Regular Languages) If A1A_1 and A2A_2 are regular languages, then so is A1∩A2A_1 \cap A_2.