Theory of Computation · Week 1 · Lesson 0003 of 7

Regular operations on languages

Language operations choose strings, join strings, or repeat blocks.

Time 25–35 minBook §1.1–1.2Exam win Test membership and reason about which sets must be regular
The win

Calculate union, concatenation and star, then apply closure under the right hypotheses.

1Warm-up

2Choose, join and repeat

The union A ∪ B is the set of strings in A or B or both. It combines two sets of allowed inputs. “If either language contains 01, their union contains 01.”

The concatenation xy of strings x and y writes x immediately before y. The concatenation AB of languages is {xy | x ∈ A and y ∈ B}. This describes a string built in two consecutive pieces. “01 belongs to {0}{1}.” Order matters because the pieces occupy different positions.

The Kleene star A* consists of all concatenations of zero or more strings from A. The number of choices is finite for each resulting string. Pieces can repeat, and choosing zero pieces yields ε. “If A = {01}, then 0101 belongs to A*.” Define A⁰ = {ε} and Ak as k concatenated copies of A for k ≥ 1. Then A* = ⋃k≥0 Ak. The notation A+ uses k ≥ 1 instead. In particular, ∅* = {ε}.

Trace the same input languages through choice, concatenation and repetition.

With A = {01, 011} and B = {ε, 1}, the union lists four distinct strings ε, 1, 01, 011. To calculate AB, append ε and 1 to each member of A. The outputs are 01, 011, 011 and 0111. Since a set counts each string once, AB = {01, 011, 0111}.

The string 011011 has a cut after the third symbol. Both resulting pieces are 011, a member of A.
One valid cut into pieces from A establishes that 011011 belongs to A*.
The mistake everyone makes

In A*, each individual piece must belong to A. The entire string may fail the rule for A, and the pieces may be different lengths.

Take L as the even-length binary strings with an odd number of zeros. The string 010111 belongs to L* because 01 | 0111 splits it into two even-length pieces, each with exactly one zero. The full string has two zeros.

For 0000, the only possible positive even-length split is 00 | 00, besides the single piece 0000. Every candidate piece has an even number of zeros, so 0000 is outside L*. The string 111101 belongs to L* as a single length-six block with one zero. An odd-length word cannot be made from even-length blocks.

Sipser, Introduction to the Theory of Computation, §1.1–1.2.

3Closure and finite exceptions

A class is closed under an operation when applying that operation to members of the class yields another member. Regular languages are closed under union, concatenation, star, intersection and complement. Intersection A ∩ B keeps strings in both. In a product DFA it accepts pairs with both coordinates accepting. Complement over a fixed Σ keeps the strings in Σ* outside the language. Swapping the accepting and rejecting states of a complete DFA gives the complement. Difference A − B keeps A’s strings outside B, so it is intersection with the complement of B.

A finite language has finitely many strings. Every finite language is regular. Use a state for each distinct prefix of its words, start at ε, accept the states that are full words, and send missing transitions to a rejecting sink. If the language is empty, use one rejecting state. For {0, 01}, take states ε, 0, 01 and a sink, and accept states 0 and 01.

For any language L and finite F, L ∩ F is finite because it is contained in F. If L is nonregular, L − F is nonregular: if it were regular, the union (L − F) ∪ (L ∩ F) would make L regular. Likewise, if L ∪ F were regular, removing F and restoring the finite L ∩ F would make L regular.

If every proper subset of L is regular, then L is regular. The empty case is finite. Otherwise choose w ∈ L. The proper subset L − {w} is regular, and union with the regular singleton {w} recovers L. Having regular finite subsets imposes no restriction, because every finite language is regular. A regular language Σ* contains every language over Σ, including nonregular ones when such languages exist over Σ.

4Recap

5Check yourself

6Cheat card

Regular operations on languages
Union
Either language.
Concatenation
Find one cut, allowing empty pieces when available.
Star
Find a factorization into zero or more allowed pieces.
Finite sets
Every finite language is regular. Removing or adding finitely many strings preserves regularity status.
Memory hook
Union chooses a word. Concatenation joins two words. Star lets you choose the number of words.
Ask your teacher for another worked example or for feedback on your own trace.