1. Gyanastra
  2. Theory of Computation
  3. Properties of Regular Languages
  4. Definition of Closure under an Operation
Free lesson, no account needed 6 min read 12 practice questions after it
Asked in past papers15 times
  • GATE CSE2024202020192014200720061998199219911989
  • UGC NET20182017201620142013

Theory of Computation · Properties of Regular Languages

Definition of Closure under an Operation

Overview

A set is closed under an operation when applying that operation to elements of the set always yields a result that is still in the set.
This idea is the basis for stating and proving closure properties of regular languages, and it also marks where regular languages differ from context-free languages.

Key concepts

  • Closed under an operation: A set SS is closed under an operation opop if, for every pair of elements x,y∈Sx, y \in S, the result x  op  yx \; op \; y is again an element of SS.
  • Closure for formal languages: The set of all regular languages is closed under an operation if, whenever two regular languages L1L_1 and L2L_2 are taken and the operation is applied to them, the resulting language is also regular (i.e., also belongs to the set of regular languages).
  • Terminology: Say "regular languages are closed under the operation", not "the operation is closed under regular languages". The set is what is closed; the operation is what the set is closed under.
  • Contrast with context-free languages: Context-free languages are NOT closed under intersection and NOT closed under complementation. Regular languages, by contrast, are closed under these, proved in the following part.
  • Proof plan: For regular languages every closure property will be proved; for context-free languages only some will be proved; for recursive, recursively enumerable and context-sensitive languages a table will be given, and referring to that table is sufficient.

How it works

  1. Take a familiar set: the set of all natural numbers N={0,1,2,3,… }\mathbb{N} = \{0, 1, 2, 3, \dots\}.
  2. Pick any two elements from the set, say two natural numbers.
  3. Apply the operation (here, addition) to those two elements.
  4. Check whether the result also belongs to the same set. Adding two natural numbers always gives a natural number, so the result is in N\mathbb{N}; therefore N\mathbb{N} is closed under addition.
  5. Transfer the idea to languages: take the set of all regular languages as the "universe" set.
  6. Take any two regular languages L1L_1 and L2L_2, apply the operation (e.g., union, intersection, complementation, concatenation), and check whether the resulting language is regular.
  7. If the result is always regular, the set of all regular languages is closed under that operation. If even one case produces a non-regular result, the set is not closed under that operation.

Formulas

  • SS is closed under opop if: ∀x,y∈S,  x  op  y∈S\forall x, y \in S,\; x \; op \; y \in S — every result of applying the operation to elements of SS stays in SS.
  • Regular languages closed under opop: if L1,L2L_1, L_2 are regular, then L1  op  L2L_1 \; op \; L_2 is regular — the result belongs to the set of regular languages.

Worked examples

Example 1 — Natural numbers under addition

  • Set: N={0,1,2,3,… }\mathbb{N} = \{0, 1, 2, 3, \dots\}
  • Take any two elements, e.g., 33 and 55.
  • Apply addition: 3+5=83 + 5 = 8.
  • 88 is a natural number, hence belongs to N\mathbb{N}.
  • Conclusion: N\mathbb{N} is closed under addition.

Example 2 — Regular languages under an operation

  • Set: the set of all regular languages.
  • Take two elements: L1L_1 regular, L2L_2 regular.
  • Apply the operation (e.g., union): L1∪L2L_1 \cup L_2.
  • If L1∪L2L_1 \cup L_2 is also regular, it belongs to the set of regular languages.
  • Conclusion: the set of regular languages is closed under that operation.

Comparison

SetOperationClosed?Reason
Natural numbers N\mathbb{N}AdditionYesSum of two natural numbers is a natural number
Regular languagesUnion (and other operations, proved later)YesResult of the operation is again a regular language
Context-free languagesIntersectionNoStated explicitly as a property to remember
Context-free languagesComplementationNoStated explicitly as a property to remember

Revision summary

  • Closed under an operation means: applying the operation to any elements of the set yields a result that is still in the set.
  • For languages: regular languages are closed under an operation if L1  op  L2L_1 \; op \; L_2 is regular whenever L1L_1 and L2L_2 are regular.
  • Correct phrasing: "regular languages are closed under the operation" — not the reverse.
  • Context-free languages are NOT closed under intersection and NOT closed under complementation.
  • One single case producing a non-regular result is enough to show the set is not closed under that operation.
  • Closure properties of regular languages are all proved; for context-free only some; for recursive, recursively enumerable and context-sensitive languages a reference table is sufficient.

Previous-year exam insights

  • The class of regular languages is closed under union, intersection, complement, concatenation, Kleene star, reversal, difference, symmetric difference and homomorphism; since complement and intersection are available, closure under NOR (L1∪L2‾\overline{L_1 \cup L_2}) and NAND also follows.
    Asked inUGC NET 2016GATE 1998
  • Closure properties do NOT give converses: if L1∪L2L_1 \cup L_2 (or L1∩L2L_1 \cap L_2) is regular, neither L1L_1 nor L2L_2 need be regular — e.g. take a non-regular LL and its complement.
    Asked inGATE 2020
  • Regular languages are not closed under infinite union (an arbitrary infinite union of regular languages can be any language, e.g. every language is a union of its singleton strings), and not closed under infinite intersection.
    Asked inGATE 2020GATE 2007
  • Every finite language is regular, hence every finite subset of any language (regular or not) is regular; but an arbitrary subset of a regular language need not be regular, and every language has a regular subset (e.g. ∅\emptyset or a singleton) and a regular superset (Σ∗\Sigma^*).
    Asked inGATE 2007GATE 2006GATE 1998GATE 1991
  • Operations that keep regularity: quotient by a regular set, Chop(L) (delete a fixed-length prefix), Even(L) (letters at even positions), and { x | ∃y, |y| = f(|x|), xy ∈ L } for f(n)=n,n2f(n) = n, n^{2} and even f(n)=2nf(n) = 2^{n};
    the reason is that the set of DFA states from which a final state is reachable in exactly m steps is ultimately periodic in m, and so are these f modulo the period.
    Asked inUGC NET 2014UGC NET 2013UGC NET 2018
  • The pumping lemma is used only to prove a language is NOT regular (a necessary condition, not sufficient); to prove regularity use closure properties, finite-language arguments, or construction of a DFA/NFA/regular expression.
    Asked inUGC NET 2017GATE 2019GATE 2014
Pages 1–2 of 2