1. Gyanastra
  2. Theory of Computation
  3. Properties of Regular Languages
  4. Closure of Regular Languages under Union
Free lesson, no account needed 6 min read 9 practice questions after it
Asked in past papers6 times
  • GATE CSE20201995199019891987
  • UGC NET2013

Theory of Computation · Properties of Regular Languages

Closure of Regular Languages under Union

Overview

A class of languages is closed under an operation when applying that operation to languages in the class always yields a language still in the class.
Regular languages are closed under union, concatenation and Kleene star, and each fact is proved with the regular expression argument.

Key concepts

  • Closed under an operation: a class of languages is closed under an operation if applying that operation to languages in the class always produces a language that is again in the class.
  • Regular expression argument: every regular language has a regular expression, and the regular-expression definition of regular languages is itself closed under union (plus), concatenation and star.
    This single technique proves all three closure properties.
  • Closure under union: if L1L_1 is regular and L2L_2 is regular, then L1∪L2L_1 \cup L_2 is regular.
  • Closure under concatenation: if L1L_1 is regular and L2L_2 is regular, then L1⋅L2L_1 \cdot L_2 is regular.
  • Closure under Kleene star: if L1L_1 is regular, then L1∗L_1^* (Kleene star / Kleene closure) is regular.
  • For closure properties of the other language classes (context-free, recursive, recursively enumerable, context-sensitive), a summary table is sufficient for reference.

How it works

Union (L1∪L2L_1 \cup L_2)

  1. L1L_1 regular implies there exists a regular expression R1R_1 with L(R1)=L1L(R_1) = L_1.
  2. L2L_2 regular implies there exists a regular expression R2R_2 with L(R2)=L2L(R_2) = L_2.
  3. The union of the two languages is obtained by putting a plus in the middle: R1+R2R_1 + R_2.
  4. R1+R2R_1 + R_2 is again a regular expression, since union (plus) is one of the three regular-expression operations.
  5. Therefore L1∪L2=L(R1+R2)L_1 \cup L_2 = L(R_1 + R_2) is regular.

Concatenation (L1⋅L2L_1 \cdot L_2)

  1. L1L_1 regular implies a regular expression R1R_1 for L1L_1.
  2. L2L_2 regular implies a regular expression R2R_2 for L2L_2.
  3. Apply concatenation to the expressions: R1R2R_1R_2.
  4. R1R2R_1R_2 is again a regular expression, since concatenation is a regular-expression operation.
  5. Since the resulting expression is a regular expression, the language it denotes, L1⋅L2L_1 \cdot L_2, must be regular.

Kleene star (L1∗L_1^*)

  1. L1L_1 regular implies there exists a regular expression R1R_1 for L1L_1.
  2. The Kleene closure of the language is the Kleene closure of the regular expression: R1∗R_1^*.
  3. R1∗R_1^* is again a regular expression, since star is a regular-expression operation.
  4. Therefore the resulting language L1∗L_1^* is regular.

Formulas

  • L1∪L2=L(R1+R2)L_1 \cup L_2 = L(R_1 + R_2) — R1R_1 is a regular expression for L1L_1, R2R_2 is a regular expression for L2L_2, and ++ denotes union of regular expressions.
  • L1⋅L2=L(R1R2)L_1 \cdot L_2 = L(R_1R_2) — juxtaposition denotes concatenation of regular expressions.
  • L1∗=L(R1∗)L_1^* = L(R_1^*) — ∗* denotes Kleene star of a regular expression.

Worked examples

The method, applied to each operation:

  • Union: given regular L1L_1 with expression R1R_1 and regular L2L_2 with expression R2R_2, form R1+R2R_1 + R_2; it is a regular expression, so L1∪L2L_1 \cup L_2 is regular.
  • Concatenation: given regular L1L_1 with expression R1R_1 and regular L2L_2 with expression R2R_2, form R1R2R_1R_2; it is a regular expression, so L1⋅L2L_1 \cdot L_2 is regular.
  • Kleene star: given regular L1L_1 with expression R1R_1, form R1∗R_1^*; it is a regular expression, so L1∗L_1^* is regular.

Comparison

OperationStatementProof idea
UnionL1L_1 regular and L2L_2 regular ⇒\Rightarrow L1∪L2L_1 \cup L_2 regularTake regular expressions R1R_1, R2R_2; R1+R2R_1 + R_2 is a regular expression
ConcatenationL1L_1 regular and L2L_2 regular ⇒\Rightarrow L1⋅L2L_1 \cdot L_2 regularTake regular expressions R1R_1, R2R_2; R1R2R_1R_2 is a regular expression
Kleene starL1L_1 regular ⇒\Rightarrow L1∗L_1^* regularTake regular expression R1R_1; R1∗R_1^* is a regular expression

Revision summary

  • Closure means the result of the operation stays inside the class: regular in, regular out.
  • The proof pattern is always: convert the language(s) to regular expression(s), apply the corresponding regular-expression operation (plus, concatenation, star), and note the result is still a regular expression, hence the language is regular.
  • Union of regular expressions is written with ++, not with ∪\cup.
  • Concatenation of regular expressions is written by juxtaposition: R1R2R_1R_2.
  • Kleene star of a language corresponds to Kleene star of its regular expression: R1∗R_1^*.
  • For context-free, recursive, recursively enumerable and context-sensitive languages, a summary table of closure properties is sufficient for reference.

Previous-year exam insights

  • Regular languages are closed under all the standard operations: union, intersection, complement, difference, concatenation, Kleene star, reversal, homomorphism and inverse homomorphism.
    In particular, if L1 and L2 are regular then L1 ∩ L2 and Σ* − L1 are regular.
    Asked inGATE 1990GATE 1989
  • Closure under union (or any binary operation) is a finite, binary property: it says nothing about infinite unions.
    The class of regular languages is NOT closed under infinite union, and a union of two languages can be regular even when one or both of them are not regular (e.g. a non-regular language united with its complement gives Σ*).
    Asked inGATE 2020
  • If L is regular then its reversal LRL^{R} is regular (reverse the regular expression, or reverse all transitions of the NFA and swap initial and final states), and the concatenation of two regular languages is regular; hence languages built from regular pieces by union, concatenation, star, reversal and complement stay regular.
    Asked inUGC NET 2013
  • A language of the form {wwRww^{R} | w ∈ Σ*} is not regular (pump it, or note it needs unbounded memory), whereas {wwRww^{R}} over a one-letter alphabet or with w of bounded length can be regular; do not assume reversal-based patterns are regular.
    Asked inUGC NET 2013
  • Closure facts for other classes: context-free languages are closed under union, concatenation, Kleene star and homomorphism but NOT under intersection or complement; recursive languages are closed under all boolean operations; recursively enumerable languages are closed under union and intersection but not complement; context-sensitive languages are closed under union, intersection and complement.
    Asked inGATE 1989
  • To prove a class is NOT closed under an operation, give a counterexample: e.g. for intersection of two CFLs, take {ana^{n} bnb^{n} cmc^{m}} ∩ {ama^{m} bnb^{n} cnc^{n}} = {ana^{n} bnb^{n} cnc^{n}};
    for complement of CFLs, use that closure under complement plus union would give closure under intersection by De Morgan, which fails.
    Asked inGATE 1989
Pages 1–2 of 2