- union
Let M1 = (K1, ∑, Δ1, s1, F1),
M2 = (K2, ∑, Δ2, s2, F2)
We construct a non-deterministic automaton
M = (K, ∑, Δ, s, F), where
K = K1 È K2 È {s}
F = F1 È F2
Δ = Δ1
È Δ2 È
{(s, e, s1), (s, e, s2)}
We introduce a new start state s, and M “guesses” whether the input is for M1 or M2.
Formally,
if w є ∑* then
(s,w) ├ *M (q, e) for some q є F iff
either (s1, w) ├ *M1 (q, e) for some q є F1
or (s2, w) ├ *M2 (q, e) for some q є F2
Hence M accepts w iff M1 accepts w or M2 accepts w, thus L(M) = L(M1)
Ç L(M2)
- concatenation
We will construct an automaton M that accepts L(M) = L(M1) ° L(M2)
Let M1 = (K1, ∑, Δ1, s1, F1),
M2 = (K2, ∑, Δ2, s2, F2)
We construct a non-deterministic automaton
M = (K, ∑, Δ, s, F), where
K = K1 È K2
s = s1
F = F2
Δ = Δ1
È Δ2 È
{(q, e, s2)| q є F1}
Here the idea is the connect all final states of M1 with empty links to the start state of M2.
Formally,
if w є ∑* then
(s,w) ├ *M (q, e) for some q є F iff
w = uv, and
(s1, u) ├ *M1 (q, e) for some q є F1,
i.e. u є L(M1)
(s2, v) ├ *M2 (q, e) for some q є F2,
i.e. v є L(M2)
Hence M accepts w iff M1 accepts part of w and then M2 accepts the remaining part.
Thus L(M) = L(M1) ° L(M2)
- Kleene star
Let M1 = (K1, ∑, Δ1, s1, F1)
We construct a non-deterministic automaton M that accepts L(M) = L(M)* in the following way:
M = (K, ∑, Δ, s, F), where
K = K1 È {s}
F = F1 È {s}
Δ = Δ1
È {(s, e, s1) }È { (q, e, s1) | q є F1}
The idea here is to have a new start state connected to s1 with an empty link,
so that M accepts the empty string, and to have e-transitions from all
final states of M1 to s1, so that once a string has been read,
the computation can resume from the initial state.
- complementation
Let M = (K, ∑, δ, s, F), accepting L(M). The complement of L(M) is
∑* - L(M). It is accepted by a deterministic FSA constructed in the following way:
M' = (K, ∑, δ, s, K - F)
M' is identical to M except that the final and non-final states are interchanged.
Thus a string that is accepted by M will not be accepted by M’ and vice versa.
- intersection
Here we apply the equality:
L1 Ç L2 = ∑* - ((∑* - L1) È (∑* - L2))
The closedness under intersection follows from the closedness under union and complementation.
How to construct M (we consider deterministic complete automata):
Let M1 = (K1, ∑, δ1, s1, F1),
M2 = (K2, ∑, δ2, s2, F2)
We construct a deterministic automaton M = (K, ∑, δ, s, F), where
K = K1 x K2
s = (s1,s2)
F = {(q, p) | q є
F1, p є F2}
δ = { (q1, p1), a, (q2,p2)) |
(q1,a, q2) є δ1,(p1,a,p2) є
δ2 }
Let M1 and M2 are accepting L(M1) and L(M2) respectively.
The new automaton M has to accept strings { w | w L(M1) Ç L(M2)},
i.e. both M1 and M2 on w have to stop in final states.