Closure properties of deterministic context-free languages
Statement
Deterministic context-free languages (DCFL) have an unusual closure profile that sets them apart from the full context-free languages. They are closed under complement (the marquee result) and under intersection/union with a regular language — but they are not closed under most of the operations the context-free languages enjoy:
| Operation | DCFL | CFL |
|---|---|---|
| Complement | ✅ yes | ❌ no |
| Union | ❌ no | ✅ yes |
| Intersection | ❌ no | ❌ no |
| Concatenation | ❌ no | ✅ yes |
| Kleene star | ❌ no | ✅ yes |
| Homomorphism | ❌ no | ✅ yes |
| Substitution | ❌ no | ✅ yes |
| Right quotient | ❌ no | ✅ yes |
| ∩ / ∪ with regular | ✅ yes | ✅ yes |
In Lean
Positive results:
DCF_closedUnderComplement— closed under complement (see the dedicated page).DCF_closedUnderIntersectionWithRegular— closed under intersection with a regular language (and likewise union with a regular language,DCF_union_regular).
Non-closure results:
DCF_notClosedUnderConcatenation— not closed under concatenation.DCF_notClosedUnderHomomorphism/DCF_notClosedUnderEpsFreeHomomorphism— not closed under (ε-free) homomorphism.DCF_notClosedUnderUnion— not closed under union.DCF_notClosedUnderIntersection— not closed under intersection.DCF_notClosedUnderKleeneStar— not closed under Kleene star.DCF_notClosedUnderSubstitution— not closed under substitution.DCF_notClosedUnderRightQuotient— not closed under right quotient.
Proof idea
Closure under complement comes from totalizing the DPDA to a deciding
presentation and complementing its final states (see
DPDA totalization). The non-closures form a reduction
chain seeded by intersection, all anchored on the context-free pumping fact that
lang_eq_eq = {aⁿbⁿcⁿ} is not even context-free.
- Intersection is the seed (
DCF_notClosedUnderIntersection): the CFL counterexample languageslang_eq_any = {aⁿbⁿcᵐ}andlang_any_eq = {aᵐbⁿcⁿ}are exhibited as deterministic context-free, and their intersection islang_eq_eq, which is not context-free, hence not DCF. - Union (
DCF_notClosedUnderUnion) then follows from complement closure by De Morgan:L₁ ∩ L₂ = (L₁ᶜ ∪ L₂ᶜ)ᶜ, so union closure would force intersection closure. - Substitution (
DCF_notClosedUnderSubstitution) reduces directly to union: substituting the two singleton Boolean words by arbitrary DCFLs produces their union. Concatenation and homomorphism (DCF_notClosedUnderConcatenation,DCF_notClosedUnderHomomorphism) each likewise reduce a hypothetical closure to union closure — concatenation via a fresh marker plus an intersection and left quotient, homomorphism by erasing a prefix marker on a disjoint union — and Kleene star (DCF_notClosedUnderKleeneStar) uses the same union witnesses restricted to strictly positivea⁺b⁺c⁺blocks. - Right quotient (
DCF_notClosedUnderRightQuotient) is an independent reduction to the CFL right-quotient counterexample: both witness languages are DCF, but their quotient is the non-context-free language used in the CFL pumping argument.
Keywords / also known as
deterministic context-free closure properties, DCFL closed under complement, DCFL not closed under union, DPDA closure, deterministic context-free not closed under concatenation, DCFL homomorphism, type-2 deterministic languages closure, Lean formalization.
Formalized in Lean 4 with Mathlib, in Langlib.