
Input: Machines M1 = (Q1,Σ1,Δ1,s1,W1)
and M2 = (Q2,Σ2,Δ2,s2,W2), where
Q1 ∩ Q2 = ∅
Output:
M = (Q1 ∪ Q2 &cup {s}, Σ1 ∪ Σ2,
Δ1 ∪ Δ2 ∪ {(s,e,s1),(s,e,s2)},
s, W1 ∪ W2), where s ∉ Q1 and s ∉ Q2
(i.e. s is a new state)
M1 = ({p0,p1}, {a,b}, {(p0,a,p1),(p1,a,p0)}, p0, {p1}) and M2 = ({q0,q1}, {a,b}, {(q0,b,q1),(q1,b,q0)}, q0, {q0})
Theorem: If L1 and L2 are languages accepted by nondeterministic finite automata, then L1 ∪ L2 is also accepted by a nondeterministic finite automaton.
To give a formal definition of the concatenation of two languages we need to recall our set constructor notation, which looks like { A | B }, where the { means "the set of all" and the | means "such that".
For languages L1, L2 ⊆ Σ*, the contatenation of L1 and L2 (denoted L1L2) is { xy ∈ Σ* | x ∈ L1 and y ∈ L2}. In other words, L1L2 is the set of all strings of the form xy such that x ∈ L1 and y ∈ L2.So, for example, if L1 = {aa, ba, c} and L2 = {cc, cb, c}, L1L2 = {aacc, aacb, aac, bacc, bacb, bac, ccc, ccb, cc}. Concatenation of infinite lanugages also makes sense with our definition. For example, if L1 is the language of strings of a's of even length and L2 = {bb, cc}, then:
L1L2 = {bb, cc, aabb, aacc, aaaabb, aaaacc, aaaaaabb, aaaaaacc, ... }Can you see how bb and cc ended up in the concatenation of L1 and L2? Well, e (the empty string) satisfies our definition of L1. So e concatenated with bb gives bb, and e concatenated with cc gives cc.
Input: Machines M1 = (Q1,Σ1,Δ1,s1,W1) and M2 = (Q2,Σ2,Δ2,s2,W2), where Q1 ∩ Q2 = ∅If you think back to specific examples from last lecture, you hopefully see the general strategy. Add e-transitions from the accepting states of M1 to the start state of M2. The start state of the new machine will be M1's start state, and the accepting states are the accepting states of M2. We can describe this formally as:
Output: Machine M such that L(M) = L(M1)L(M2)
Input: Machines M1 = (Q1,Σ1,Δ1,s1,W1) and M2 = (Q2,Σ2,Δ2,s2,W2), where Q1 ∩ Q2 = ∅My claim is that L(M) = L(M1)L(M2). Following our previous discussion, we'll assume this claim is self-evident enough from our experience with this algorithm. To be strictly, formally correct, however, we'd have to prove it. If you accept my claim, then we have the following thoerem:
Output: Machine M = (Q1 ∪ Q2, Σ1 ∪ Σ2, Δ, s1,W2), where Δ = Δ1 ∪ Δ2 ∪ {(q,e,s2) | q ∈ W1}
Theorem: If L1 and L2 are languages that are accepted by nondeterministic finite automata, then L1L2 is
1) e ∈ L*A definition like this is called a recursive definition, and it is basically a set of rules generating all the elements of L*. A few examples will, hopefully, make Kleene Star clear to you:
2) if x ∈ L* then xy ∈ L* for every y ∈ L
So, the Kleene Star of a language is the set of all strings consisting of zero or more elements of the language concatenated together.
Algorithm Kleene StarNow, I claim that L(M') = L(M)*. I really ought to prove it, of course. However, for the moment why don't you just try it on an example or two and convince yourself that it really works.
Input: Machine M = (Q, Σ, Δ, s, W)
Output: M' = (Q ∪ {$}, Σ, Δ ∪ {($,e,s)} ∪ {(q,e,$) | q ∈ W}, s, {$}), where $ ∉ Q, i.e. $ is a new state