Theorem T2. The union of two regular languages is a regular language.
Proof. Let L1 and L2 be any regular languages, on alphabets Σ1 and Σ2 respectively. By exercise 5 of exercise set #1, L1 and L2 are both regular languages on the alphabet Σ1 Σ2 ; hence, by D6, there must be a finite automaton on Σ1 Σ2 that accepts exactly the members of L1 -say, one with states Q1 ={ q10 ,, q1n }, initial state q10 , final states F1 , and transition functon δ1 -and a finite automaton Σ1 Σ2 that accepts exactly the members of L2 -say, one with states Q2 ={ q20 ,, q2m }, initial state q20 , final states F2 , and transition function δ2 . We assume, without loss of generality, that Q1 Q2 =. (If the two automata somehow share states, the common states can be replaced with distinct but functionally equivalent states so as to ensure that this condition is met; proving that this is always possible involves a simple double induction, on the number of states to be replaced and on the length of input strings.)
Construct a new nondeterministic finite automaton on the alphabet Σ1 Σ2 with states
Q = Q1 Q2 { q }

(where q is the new initial state), final states
F ={ F1 F2 { q }, if q10 F1 or q20 F2 ; F1 F2 otherwise,

and transition function δ defined by
δ (q,a)={ { δ1 (q,a)}, ifq Q1 ; { δ2 (q,a)}, ifq Q2 ; { δ1 ( q10 ,a), δ2 ( q20 ,a)}, ifq= q .

We shall show that this nondeterministic finite automaton accepts L1 L2 . First of all, there is an easy special case: The nondeterministic finite automaton accepts the null string, ε, iff it is a member of L1 L2 . For ε is accepted iff the initial state q F , which by the definition of F is true iff the initial state of one of the finite automata is a member of the set of final states for that automaton, which in turn is true iff ε is accepted by that automaton and hence in either L1 or L2 .
For longer strings, we need an inductive argument, this time with a base step dealing with strings of length 1; treating such strings in a separate case seems to be the easiest way of dealing with the exceptional transition from the initial state of the nondeterministic finite automaton. The inductive proposition must be formulated with some care, so that it will be general enough: We show that for any non-null string x( Σ1 Σ2 )* , the result set δ ^ ( q ,x) on x in the nondeterministic finite automaton will have as its sole members the result states δ1 ^ ( q10 ,x) and δ2 ^ ( q20 ,x) of the two finite automata on x.
Base step. If |x| is 1, the proposition follows directly from the third clause of the definition of δ , by D4(b) and D8(b).
Induction step. Suppose |x|=k+1, for some k1. Then x=wa, where w is a string of length k on Σ1 Σ2 and a Σ1 Σ2 . Now,
δ ^ ( q ,wa) = q δ ^ ( q ,w) δ (q,a) (by D8(b)) = δ ( δ1 ^ ( q10 ,w),a) δ ( δ2 ^ ( q20 ,w),a) (by the hypothesis of induction) ={ δ1 ( δ1 ^ ( q10 ,w),a), δ2 ( δ2 ^ ( q20 ,w),a)} (by the definition of δ ) ={ δ1 ^ ( q10 ,wa), δ2 ^ ( q20 ,wa)} (by D4(b))

since δ1 ^ ( q10 ,w) Q1 and δ2 ^ ( q20 ,w) Q2 . This completes the induction.
Now, first let x be any member of L1 (other than ε). The result state of the finite automaton for L1 on x is a final state of that finite automaton, by D5, and hence also a final state of the nondeterministic finite automaton, by the definition of F . Since this result state is in the result set of the nondeterministic finite automaton on x, the nondeterministic finite automaton accepts x, by D9. Similarly, if x L2 , xε, then the nondeterministic finite automaton accepts x.
Conversely, let x by any member of ( Σ1 Σ2 )* -ε that is accepted by the nondeterministic finite automaton. By D9, the result set of the nondeterministic finite automaton on x has as a member some final state qf of the nondeterministic finite automaton. This qf cannot be q , since it is reached by a non-empty sequence of transitions, and there are no transitions into q . It must therefore be a member of F1 or of F2 . Suppose it is a member of F1 . Since F1 Q1 , qf Q1 . Hence, by the inductive argument, qf = δ1 ^ ( q10 ,x), since δ2 ^ ( q20 ,x) Q1 . Therefore, the finite automaton for L1 accepts x, which is to say that x L1 . Similarly, if qf F2 , then x L2 .
Thus the nondeterministic finite automaton accepts x iff either x L1 or x L2 , that is, iff x L1 L2 . This has now been shown to hold both for x=ε and for xε. Hence, by D10, the nondeterministic finite automaton accepts L1 L2 . Hence, by theorem T1, L1 L2 is regular.



File translated from TEX by TTM, version 3.61.
On 9 Jul 2004, 10:20.