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 is closed under an operation if, for every pair of elements , the result is again an element of .
- Closure for formal languages: The set of all regular languages is closed under an operation if, whenever two regular languages and 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
- Take a familiar set: the set of all natural numbers .
- Pick any two elements from the set, say two natural numbers.
- Apply the operation (here, addition) to those two elements.
- Check whether the result also belongs to the same set. Adding two natural numbers always gives a natural number, so the result is in ; therefore is closed under addition.
- Transfer the idea to languages: take the set of all regular languages as the "universe" set.
- Take any two regular languages and , apply the operation (e.g., union, intersection, complementation, concatenation), and check whether the resulting language is regular.
- 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
- is closed under if: — every result of applying the operation to elements of stays in .
- Regular languages closed under : if are regular, then is regular — the result belongs to the set of regular languages.
Worked examples
Example 1 — Natural numbers under addition
- Set:
- Take any two elements, e.g., and .
- Apply addition: .
- is a natural number, hence belongs to .
- Conclusion: is closed under addition.
Example 2 — Regular languages under an operation
- Set: the set of all regular languages.
- Take two elements: regular, regular.
- Apply the operation (e.g., union): .
- If is also regular, it belongs to the set of regular languages.
- Conclusion: the set of regular languages is closed under that operation.
Comparison
| Set | Operation | Closed? | Reason |
|---|---|---|---|
| Natural numbers | Addition | Yes | Sum of two natural numbers is a natural number |
| Regular languages | Union (and other operations, proved later) | Yes | Result of the operation is again a regular language |
| Context-free languages | Intersection | No | Stated explicitly as a property to remember |
| Context-free languages | Complementation | No | Stated 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 is regular whenever and 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 () and NAND also follows.
Asked inUGC NET 2016GATE 1998 - Closure properties do NOT give converses: if (or ) is regular, neither nor need be regular — e.g. take a non-regular 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. or a singleton) and a regular superset ().
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 and even ;
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