Input: NDFAs $M_1 = (Q_1,\Sigma_1,\Delta_1,s_1,W_1)$ and $M_2 = (Q_2,\Sigma_2,\Delta_2,s_2,W_2)$, where $Q_1 \cap Q_2 = \emptyset$Here are a couple of questions to answer about this mystery algorithm:
Output: NDFA M such that _______________________ ←it's a mystery!
$M = (Q_1 \cup Q_2 \cup \{s\}, \Sigma_1 \cup \Sigma_2, \Delta_1 \cup \Delta_2 \cup \{(s,\lambda,s_1),(s,\lambda,s_2)\}, s, W_1 \cup W_2)$,
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})
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".
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, λ (the empty string) satisfies our definition of L1. So λ concatenated with bb gives bb, and λ concatenated with cc gives cc.
Input: NDFAs 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 λ-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: NDFA M such that L(M) = L(M1)L(M2)
Algorithm: ConcatenateMy 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'll have to prove it, which I do below. If you accept my claim, then we have the following thoerem:
Input: NDFAs M1 = (Q1,Σ1,Δ1,s1,W1) and M2 = (Q2,Σ2,Δ2,s2,W2), where Q1 ∩ Q2 = ∅
Output: NDFA M such that L(M) = L(M1)L(M2)
M = (Q1 ∪ Q2, Σ1 ∪ Σ2, Δ, s1,W2), where Δ = Δ1 ∪ Δ2 ∪ {(q,λ,s2) | q ∈ W1}
1) λ ∈ 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: NDFA M = (Q, Σ, Δ, s, W)
Output: NDFA M' such that L(M') = L(M)* \[ M' = (Q \cup \{$\}, \Sigma, \Delta \cup \{(\$,\lambda,s)\} \cup \{(q,\lambda,\$) | q \in W\}, \$, \{\$\}), \] where $ ∉ Q, i.e. $ is a new state