Languages, Regular Languages and Closure

Regular Languages and Closure

If R and S are regular languages, then so is R ∪ S. Write regular expressions for each, and join them using the | operator. Similarly, R concatenate S, i.e. any string in R followed by any string in S, is regular. Write down the first regular expression, then the second.

Given an fsm, swap success and failure, so that final states become non-final, and vice versa. The result is the complement of the original language, and it is regular. I don't believe there is a good way to find the complement of a language that is described by a regular expression, except to convert it to an fsm, change the states, and revert back to a regular expression.

Use demorgan's laws to show closure under intersection. Or, run two machines in parallel and declare success iff both machines wind up in a final state.

If regular expressions are substituted for symbols in another regular expression, the result is still a regular expression, and the language is regular. This is true even if the replacement strings have some of the same letters as the original alphabet -- even if X is replaced with AXB*(X|C). If exactly one word replaces each symbol, e.g. X → ABC, the substitution is a homomorphism. Sometimes this process can be reversed. If some of the letters, say A B and C, combine to form a finite set of substrings within the words of a regular language, each of these substrings can be replaced with a new symbol, giving the inverse homomorphism. In the above example, we would write ABC → X. This is also a regular language. Thinking in terms of machines, let the new symbol X take our fsm to the state that ABC would have produced. The result is an fsm that accepts the abbreviated words.

Finally, regular languages are closed under quotient. The word w is in l1/l2 if some x in l2 and some y in l1 satisfies wx = y. This is not trivial to prove. Let m1 be an fsm that accepts l1 and let m2 accept l2. Let t be any state in m1. Build a new machine mt that runs m1 and m2 in parallel, beginning in state t for m1 and the start state for m2. See if this machine accepts any words at all. Keep feeding it letters, and see which states are accessible, until it has reached every state that is attainable from t, start. If this includes a final state, i.e. m1 and m2 reach final states together, then mark t as successful. Do this for every state in m1. Build m3, just like m1, with the same states and transitions, but the states that have been marked "successful" become the final states of m3. These may or may not include the final states of m1. In any case, a word w, fed to m3, winds up in a final state iff there is a word x that is accepted by m2, while wx is accepted by m1. The machine m3 proves the quotient language is regular.