Regular Language Properties, the Pumping Lemma & Minimization

closure properties of regular languages

Imagine a toolbox of LEGO bricks where every brick you can build is guaranteed to fit back into the same box. The regular languages behave like that box: take regular languages and combine them in certain standard ways, and the result is STILL regular — it never escapes the family. We say the regular languages are CLOSED under those operations. This is the workshop secret behind building complicated recognizers out of simple ones.

Concretely, if L and M are regular languages, then so are: their union L ∪ M (strings in either one), their concatenation LM (a string of L followed by a string of M), the Kleene star L* (zero or more strings from L glued together), their intersection L ∩ M (strings in both), the complement of L (every string over the alphabet NOT in L), the difference L minus M, the reversal of L (every string spelled backwards), and the image of L under a homomorphism (a symbol-by-symbol renaming). Each of these is proved by an explicit CONSTRUCTION: a recipe that takes the automata or regular expressions for L and M and builds one for the result. For example, the product construction handles union and intersection, and swapping the accepting and non-accepting states handles complement.

Closure matters for two opposite reasons. Positively, it lets you DESIGN by composition: recognize 'valid identifiers' and 'reserved keywords' separately, then take a difference to recognize 'identifiers that are not keywords' — and you know a single finite automaton still exists. Negatively, closure is a PROOF WEAPON: if combining a mystery language with known-regular pieces (via intersection, complement, homomorphism, reversal) would force a non-regular language to become regular, the mystery language could not have been regular in the first place.

Let A = strings over {a, b} with an even number of a's, and B = strings ending in b. Both are regular. Then A ∩ B (even a's AND ending in b) is regular, the complement of A (odd number of a's) is regular, and A minus B (even a's, not ending in b) is regular — each built mechanically from the DFAs for A and B.

Closure means these combinations are guaranteed to stay inside the regular family.

Closure is closure under FINITELY many applications: each single operation keeps you regular, so any finite combination does too. Beware that the context-free languages are NOT closed under intersection or complement — closure properties differ from family to family.

Also called
closure of the regular languages正規語言對運算的封閉性