Closure Properties of Context-Free Languages

Consider a compiler trying to check that a program has balanced parentheses and correctly matched `begin`/`end` blocks. Each of these individual requirements is a classic context-free language. But does combining them with "and" stay context-free? This question — what happens when you combine context-free languages using set operations — is the subject of closure properties. The answer is far more delicate than for regular languages. Closure properties tell us which operations preserve context-freeness. They let us build new languages from old ones. We get a guaranteed-correct-by-construction grammar or pushdown automaton. They also tell us, crucially, which operations break context-freeness. This is often the fastest way to prove a language is not context-free. It lets us avoid resorting to the Pumping Lemma for Context-Free Languages. Real parsers, static analyzers, and type checkers rely on some key facts. Union and concatenation of context-free constructs stay context-free. But intersecting two context-free constraints can silently escape the class. The big picture is a study in contrasts with Regular Languages. Regular languages form a robust class. They are closed under nearly every Boolean and algebraic operation. Union, intersection, complement, concatenation, star, reversal — all safe. Context-free languages (CFLs) are closed under the algebraic operations. These mirror how grammars are built (union, concatenation, Kleene star). But CFLs fail badly under the Boolean operations (intersection, complement). This asymmetry is not a minor technicality. It is a structural fact about how Context-Free Grammars generate strings. It also reflects the limited memory of a Pushdown Automaton. This is compared to a machine with two independent stacks. This article gives constructive proofs for the closure results. These are actual grammar and automaton constructions you could code up. It also gives explicit counterexample languages for the two crucial non-closure results. It ends by showing how a clever combination trick survives: intersecting a CFL with a regular language. This is an exception that resolves the tension. It becomes a full closure property in its own right.

Key takeaways
  • CFLs are closed under union, concatenation, and Kleene star — proved by directly combining grammars.
  • CFLs are not closed under intersection: two CFLs can intersect to a non-context-free language.
  • CFLs are not closed under complement, which follows from the intersection failure via De Morgan's law.
  • CFLs are closed under intersection with a regular language, using a synchronized product construction.
  • The failures trace back to a PDA's single stack: two stacks (needed to check two things at once) buy full Turing power.
  • Closure results are the standard tool for building new CFLs safely, and for disproving context-freeness quickly.
The core insight

Context-free languages behave like a ring under the grammar-building operations (union, concatenation, star) but collapse under set-theoretic Boolean operations (intersection, complement), because a pushdown automaton has only one stack to track only one nested structure at a time.

The idea

A class of languages is closed under an operation if applying that operation to members of the class always produces another member of the class. For regular languages, closure under union, intersection, complement, concatenation, and star all hold, and each is provable by a direct automaton or regular-expression construction. The question this article answers is which of these survive when the class is broadened to context-free languages, generated by Context-Free Grammars (CFGs) and recognized by pushdown automata (PDAs). The three positive closure results — union, concatenation, star — are proved the same way you would combine regular expressions: syntactically glue grammars together. If L1L_1 is generated by a CFG with start symbol S1S_1 and L2L_2 by a CFG with start symbol S2S_2 (with disjoint variable sets, which we can always arrange by renaming), a new start symbol with rules like S→S1∣S2S \to S_1 \mid S_2 (for union) or S→S1S2S \to S_1 S_2 (for concatenation) or S→S1S∣εS \to S_1 S \mid \varepsilon (for star) generates the combined language. These constructions are almost too easy — which is itself informative: it shows union, concatenation, and star are operations native to the recursive, tree-structured way CFGs generate strings. The negative results are the heart of the article. Intersection and complement fail because checking membership in L1∩L2L_1 \cap L_2 can require tracking two independent unbounded counts simultaneously — one for each language's internal bookkeeping — and a single stack cannot hold two independent counters that both grow and shrink arbitrarily. The canonical witness is

L1={anbncm:n,m≥0},L2={ambncn:n,m≥0},L_1 = \{a^n b^n c^m : n, m \geq 0\}, \qquad L_2 = \{a^m b^n c^n : n, m \geq 0\},

both context-free (each needs to match only one pair of counts with a single stack), but

L1∩L2={anbncn:n≥0},L_1 \cap L_2 = \{a^n b^n c^n : n \geq 0\},

which is famously not context-free (provable by the pumping lemma, foreshadowed but not needed here). Since CFLs are closed under union but L1‾∪L2‾=L1∩L2‾\overline{L_1} \cup \overline{L_2} = \overline{L_1 \cap L_2} by De Morgan's law, non-closure under intersection forces non-closure under complement as well — if complement were closed, intersection would be too, via L1∩L2=L1‾∪L2‾‾L_1 \cap L_2 = \overline{\overline{L_1} \cup \overline{L_2}}. The one rescue is closure under intersection with a regular language: if LL is context-free and RR is regular, then L∩RL \cap R is always context-free. This works because a DFA for RR can be run in lockstep alongside a PDA for LL without any extra stack demands — the DFA's finite memory piggybacks on the PDA's state, costing nothing extra in stack discipline.

How it works

Union: L1∪L2L_1 \cup L_2

Given CFGs G1=(V1,Σ,R1,S1)G_1 = (V_1, \Sigma, R_1, S_1) and G2=(V2,Σ,R2,S2)G_2 = (V_2, \Sigma, R_2, S_2) with V1∩V2=∅V_1 \cap V_2 = \varnothing, construct

G=(V1∪V2∪{S},Σ,R1∪R2∪{S→S1∣S2},S).G = (V_1 \cup V_2 \cup \{S\}, \Sigma, R_1 \cup R_2 \cup \{S \to S_1 \mid S_2\}, S).

Any derivation from SS immediately commits to expanding via S1S_1 or S2S_2, after which it behaves exactly as a derivation in G1G_1 or G2G_2 respectively. Hence L(G)=L(G1)∪L(G2)L(G) = L(G_1) \cup L(G_2).

Concatenation: L1L2L_1 L_2

With the same disjointness assumption, construct

G=(V1∪V2∪{S},Σ,R1∪R2∪{S→S1S2},S).G = (V_1 \cup V_2 \cup \{S\}, \Sigma, R_1 \cup R_2 \cup \{S \to S_1 S_2\}, S).

Every derivation produces a string w1w2w_1 w_2 where S1⇒∗w1S_1 \Rightarrow^* w_1 and S2⇒∗w2S_2 \Rightarrow^* w_2, so L(G)=L(G1)⋅L(G2)L(G) = L(G_1) \cdot L(G_2).

Kleene star: L1∗L_1^*

Construct

G=(V1∪{S},Σ,R1∪{S→S1S∣ε},S).G = (V_1 \cup \{S\}, \Sigma, R_1 \cup \{S \to S_1 S \mid \varepsilon\}, S).

This generates ε\varepsilon, or S1S_1 followed by another (possibly empty) sequence, giving exactly L(G1)∗={ε}∪L1∪L1L1∪⋯L(G_1)^* = \{\varepsilon\} \cup L_1 \cup L_1 L_1 \cup \cdots.

Intersection with a regular language: the product PDA

This is the one non-trivial positive construction and is worth doing carefully, since it is the tool that rescues intersection in the one case where it's salvageable, and it is exactly the technique used to intersect a CFL with a filter (e.g. "strings of even length," or "strings not containing `xyz`"). Let P=(QP,Σ,Γ,δP,q0P,FP)P = (Q_P, \Sigma, \Gamma, \delta_P, q_{0P}, F_P) be a PDA for LL (accepting by final state), and let D=(QD,Σ,δD,q0D,FD)D = (Q_D, \Sigma, \delta_D, q_{0D}, F_D) be a DFA for RR. Build the product PDA

P′=(QP×QD, Σ, Γ, δ′, (q0P,q0D), FP×FD),P' = (Q_P \times Q_D,\ \Sigma,\ \Gamma,\ \delta',\ (q_{0P}, q_{0D}),\ F_P \times F_D),

where δ′((p,q),a,X)\delta'((p,q), a, X) simulates PP's move on aa (or ε\varepsilon) and, whenever PP consumes an input symbol a≠εa \neq \varepsilon, simultaneously advances qq to δD(q,a)\delta_D(q,a); on ε\varepsilon-moves of PP, the DFA state qq stays fixed (a DFA has nothing to do on ε\varepsilon). ``` function BUILD-PRODUCT-PDA(P, D):

# P = (Q_P, Sigma, Gamma, delta_P, q0_P, F_P) -- PDA for L

# D = (Q_D, Sigma, delta_D, q0_D, F_D) -- DFA for R Q' <- Q_P x Q_D start <- (q0_P, q0_D) accept <- F_P x F_D delta' <- empty transition table for each transition (p, a, X) -> (p', Y) in delta_P: for each q in Q_D: if a == EPSILON:

# DFA does not move on epsilon add transition ((p, q), EPSILON, X) -> ((p', q), Y) to delta' else: q' <- delta_D(q, a) add transition ((p, q), a, X) -> ((p', q'), Y) to delta' return PDA(Q', Sigma, Gamma, delta', start, accept) ``` The construction never touches the stack alphabet Γ\Gamma or adds any new stack symbols — the DFA's contribution is pure finite-state bookkeeping folded into P′P''s control states. That is exactly why this trick works but general intersection of two CFLs does not: two PDAs both need their own stack, and one machine cannot run two independent stacks and still be a PDA.

Why general intersection has no such construction

If both L1L_1 and L2L_2 require a stack (not just a DFA) to recognize, the naive idea — run P1P_1 and P2P_2 "in parallel," tracking (p1,p2)(p_1, p_2) as the state and somehow combining the two stacks — fails because a PDA has one stack, and there is no way to interleave two unrelated, unboundedly growing/shrinking stacks into one stack while preserving decidable access to both tops on demand. Concretely, tracking anbncma^nb^nc^m needs a stack to certify nn (push on aa's, pop on bb's) while tracking ambncna^mb^nc^n needs a stack to certify a different pairing of counts. Intersecting forces certifying both n=nn = n (from the first) and n=nn = n (a different equality, from the second) at once on the same string, which amounts to certifying three simultaneous equalities among counts of aa's, bb's, cc's — precisely the two-counter test that a one-stack machine cannot pass (this is what the pumping lemma later proves rigorously).

Figure
Product construction: PDA × DFA states run in lockstep, one stack, one finite control
PDA P for L p p′ a, X→Y single stack Γ DFA D for R q q′ a Product PDA P′ for L ∩ R (p,q) (p′,q′) a, X→Y (same stack)

Complexity & correctness

Union. Time: O(∣G1∣+∣G2∣)O(|G_1| + |G_2|) to build GG, since we simply take the union of two rule sets and add one rule. Space: same bound. Correctness: a leftmost derivation from SS in GG has exactly two forms, S⇒S1⇒∗wS \Rightarrow S_1 \Rightarrow^* w or S⇒S2⇒∗wS \Rightarrow S_2 \Rightarrow^* w, and since V1,V2V_1, V_2 are disjoint, no derivation can "mix" rules from both grammars, so L(G)=L(G1)∪L(G2)L(G) = L(G_1) \cup L(G_2) exactly, with no spurious strings introduced and none lost.

Concatenation. Time and space O(∣G1∣+∣G2∣)O(|G_1| + |G_2|). Correctness: every derivation from SS begins S⇒S1S2S \Rightarrow S_1 S_2 and, by disjointness of variables, the S1S_1 portion and S2S_2 portion of the derivation tree never interact — one derives independently to some w1∈L1w_1 \in L_1, the other to w2∈L2w_2 \in L_2, and the yield is their concatenation w1w2w_1w_2. Conversely every w1w2w_1w_2 with w1∈L1,w2∈L2w_1 \in L_1, w_2 \in L_2 arises this way, giving exact equality L(G)=L1L2L(G) = L_1L_2.

Star. Time and space O(∣G1∣)O(|G_1|) plus one new rule. Correctness: induction on the number of times S→S1SS \to S_1 S is applied before the base case S→εS \to \varepsilon terminates the recursion shows L(G)=⋃k≥0L1k=L1∗L(G) = \bigcup_{k \geq 0} L_1^k = L_1^*; the grammar is literally the inductive definition of Kleene star written as production rules.

Intersection with a regular language. The product PDA has ∣QP∣⋅∣QD∣|Q_P| \cdot |Q_D| states and the same stack alphabet as PP, so construction time and space are O(∣QP∣⋅∣QD∣⋅∣δP∣)O(|Q_P| \cdot |Q_D| \cdot |\delta_P|) in the worst case (each PDA transition is replicated once per DFA state, except ε\varepsilon-transitions which don't multiply the DFA state). Correctness: by construction, P′P' has an accepting computation on ww if and only if PP has an accepting computation on ww and the DFA-component trace on ww ends in FDF_D — i.e. iff w∈L(P)w \in L(P) and w∈L(D)w \in L(D), so L(P′)=L∩RL(P') = L \cap R exactly. The key invariant is that the DFA component of the state after reading input prefix xx always equals δD∗(q0D,x)\delta_D^*(q_{0D}, x), provable by a straightforward induction on the length of the computation, since every input-consuming move of P′P' updates the DFA component exactly as DD would, and ε\varepsilon-moves leave it untouched (matching that DD makes no move on ε\varepsilon).

Why general intersection genuinely fails (not just "no known construction"). This is a non-closure theorem, not an open question: it is proved by the explicit counterexample below combined with the (separately provable, via the pumping lemma) fact that {anbncn:n≥0}\{a^nb^nc^n : n \geq 0\} is not context-free. Since L1={anbncm}L_1 = \{a^nb^nc^m\} and L2={ambncn}L_2 = \{a^mb^nc^n\} are each context-free (exhibited by explicit grammars below) and their intersection is not, the class itself cannot be closed under intersection — no future cleverness can fix this, because it is a theorem about what the class contains, not a limitation of a particular technique.

Complement. Non-closure follows purely from logic, given non-closure under intersection and closure under union: if CFLs were closed under complement, then for any CFLs L1,L2L_1, L_2, De Morgan gives

L1∩L2=L1‾∪L2‾‾,L_1 \cap L_2 = \overline{\overline{L_1} \cup \overline{L_2}},

and the right-hand side would be a CFL (complement of CFL, union of CFLs, complement of CFL again) — contradicting the intersection counterexample. So complement cannot be closed either. This is a proof by contradiction riding entirely on set identities plus the operations already established; no separate combinatorial counterexample is even required, though one exists (e.g. {ww:w∈Σ∗}‾\overline{\{ww : w \in \Sigma^*\}} is not context-free either, by a similar argument).

Tradeoff to flag honestly. The regular-intersection construction is a genuinely useful engineering tool — it's how you intersect "syntax tree shape" (context-free) with "matches this lexical pattern" (regular) cheaply — but it is not a loophole for intersecting two arbitrary CFLs; the moment RR is itself only known to be context-free rather than regular, the construction collapses because the DFA half no longer has bounded memory to fold into PP's states.

Worked example

We verify concretely that L1={anbncm:n,m≥0}L_1 = \{a^nb^nc^m : n,m \geq 0\} and L2={ambncn:n,m≥0}L_2 = \{a^mb^nc^n : n, m \geq 0\} are each context-free, and that their intersection forces the triple-equality language.

Grammar for L1L_1:

S1→AC,A→aAb∣ε,C→cC∣εS_1 \to A C, \qquad A \to aAb \mid \varepsilon, \qquad C \to cC \mid \varepsilon

Here AA generates anbna^nb^n for any n≥0n \geq 0 and CC generates cmc^m for any m≥0m \geq 0, independently — a single stack easily certifies the one nested match (AA's recursion) while CC needs no stack discipline at all (it's regular). L(S1)=L1L(S_1) = L_1.

Grammar for L2L_2:

S2→AB,A→aA∣ε,B→bBc∣εS_2 \to A B, \qquad A \to aA \mid \varepsilon, \qquad B \to bBc \mid \varepsilon

Symmetric reasoning: AA generates ama^m freely, BB generates bncnb^nc^n with one stack-matched recursion. L(S2)=L2L(S_2) = L_2. Both are unambiguously context-free — one nested dependency each, exactly what a PDA's single stack is built to check. Now trace membership for a few strings to see the intersection collapse onto triple-matching:

stringin L1L_1? (nn from anbna^nb^n, any cmc^m)in L2L_2? (any ama^m, nn from bncnb^nc^n)in L1∩L2L_1 \cap L_2?
ε\varepsilonyes (n=0,m=0n=0,m=0)yesyes
aabbccaabbccyes (n=2n=2, m=2m=2)yes (m=2m=2, n=2n=2)yes
aabbcaabbcyes (n=2,m=1n=2, m=1)no (bb-count 2≠c2 \ne c-count 11)no
abbccabbccno (aa-count 1≠b1 \ne b-count 22)yes (m=1m=1, n=2n=2)no
aaabbbcccaaabbbcccyes (n=3,m=3n=3,m=3)yes (m=3,n=3m=3,n=3)yes
aabbbccaabbbccno (aa-count≠b\ne b-count)no (bb-count ≠c\ne c-count)no

The pattern is exactly anbncna^nb^nc^n: membership in both L1L_1 and L2L_2 forces (#aa = #bb) from the L1L_1 side and (#bb = #cc) from the L2L_2 side, which together force all three counts equal. That combined condition is precisely {anbncn:n≥0}\{a^nb^nc^n : n \geq 0\}, which no single PDA stack can certify (informally: certifying #aa=#bb consumes the stack watching aa's against bb's, leaving nothing to simultaneously certify #bb=#cc; this intuition is made rigorous later by the pumping lemma). To make the regular-intersection rescue equally concrete: let L={anbn:n≥0}L = \{a^nb^n : n \geq 0\} (context-free) and R=R = "strings of even length" (regular, recognized by a 2-state DFA tracking parity). The product construction above builds a PDA whose control states are (PDA state, parity bit); it accepts exactly the even-length strings of the form anbna^nb^n, i.e. {anbn:n even}={a2kb2k:k≥0}\{a^nb^n : n \text{ even}\} = \{a^{2k}b^{2k} : k \geq 0\} — still visibly context-free, and produced automatically with zero new stack machinery.

Common pitfalls & traps

pitfallwhy it happensfix
Assuming CFLs closed under intersection "because regular languages are"Overgeneralizing from the regular case without checking the stack-resource argumentAlways check: does the combined language need to track two independent unbounded quantities at once? If so, suspect non-closure
Forgetting to rename variables before combining grammarsV1V_1 and V2V_2 may share a nonterminal name like SS or AASystematically rename (V1′=V1×{1}V_1' = V_1 \times \{1\}, etc.) before taking the union of rule sets
Concatenation construction S→S1S2S \to S_1S_2 used to "prove" closure under intersection by analogyConfusing sequential composition with simultaneous constraint-checkingRecognize concatenation composes disjoint substrings; intersection imposes overlapping constraints on the same string — structurally different
Believing complement non-closure needs its own separate counterexample every timeNot noticing De Morgan already derives it for free from intersectionCite the De Morgan argument; only reach for a direct counterexample when intersection-closure isn't already established
Misapplying the CFL ∩ regular trick to two arbitrary CFLsOverlooking that the rescue crucially needs one side to have bounded (finite-state) memoryCheck explicitly which of the two languages is regular before invoking the product construction

Pioneers & history

The theory of context-free grammars and their closure properties emerged from the confluence of formal linguistics and early compiler theory, crystallizing the algebraic structure that governs which language operations preserve "parseability."

Origins · 1 minNoam Chomsky and how this was discovered
NC
Noam Chomsky
1928– · Linguistics and formal language theory, MIT

Chomsky's hierarchy of grammars (1956) formally defined context-free grammars as a class strictly between regular and context-sensitive grammars, providing the very object whose closure properties this article studies.

JB
John Backus
1924–2007 · IBM, co-designer of FORTRAN and BNF

Backus (independently converging with Chomsky's ideas) devised Backus-Naur Form to specify ALGOL's syntax, giving programming-language designers the practical notation in which context-free grammars — and hence their closure operations — are written to this day.

History
1956
— Chomsky introduces the hierarchy of grammars including context-free grammars.
1959
— Backus-Naur Form used to specify ALGOL 60's syntax, popularizing CFGs in computing.
1961
— Bar-Hillel, Perles, and Shamir prove foundational non-closure results, including non-closure under intersection and complement, and formalize the pumping lemma for context-free languages.
1965–1970
s — Pushdown automata equivalence to CFGs is formalized, giving automaton-level proofs of the algebraic closure properties.
1979
— Hopcroft and Ullman's textbook treatment establishes the now-standard pedagogical presentation of CFL closure properties.

Where this matters

Compiler front ends rely on union and concatenation closure implicitly every time a grammar rule is written as an alternation (`stmt → if_stmt | while_stmt | ...`) or a sequence (`if_stmt → IF expr THEN stmt`) — these are exactly the union and concatenation constructions, guaranteeing the combined language of legal programs is still context-free and hence parseable by a Pushdown Automaton-based parser (LL/LR parsers, in practice). The regular-intersection closure is the theoretical backbone of lexer-parser separation: a lexer's regular-language token patterns get intersected against a parser's context-free grammar of token sequences, and closure guarantees the composite (source text directly to accept/reject) remains context-free, justifying the standard two-phase compiler architecture. Static analysis tools that check "does this XML/JSON document match this schema AND satisfy this regex-like filter" exploit CFL ∩ regular closure directly. Conversely, the non-closure results are a working programmer's early-warning signal: if you notice you're trying to intersect two grammar-like constraints and the combination seems to require matching three or more independent counts (a classic tell), that's a hint you may have wandered outside context-free territory into languages requiring more power — precisely the situation formally nailed down by the Pumping Lemma for Context-Free Languages, and one reason type systems and schema languages sometimes deliberately restrict themselves to guarantee decidable or efficient checking.

Ask the tutor: Can you show, using the pumping lemma, exactly why {anbncn:n≥0}\{a^nb^nc^n : n \geq 0\} fails to be context-free?

Are context-free languages closed under complement if the alphabet has only one symbol?

For a unary alphabet {a}\{a\}, every context-free language is actually regular (a classical fact about unary CFLs), and regular languages are closed under complement. So in that degenerate special case, complementing a unary CFL does stay context-free — but this doesn't contradict the general non-closure theorem, which requires alphabets with at least two symbols to build witnesses like anbncna^nb^nc^n. The moment the alphabet has two or more symbols, the general non-closure result applies, and complement can escape the class.

Is there an easier way to see why intersection fails, without the a^n b^n c^n example?

Not really an easier way, but an equally standard alternative: intersect {aibjck:i=j}\{a^ib^jc^k : i=j\} with {aibjck:j=k}\{a^ib^jc^k : j=k\}, which is the same example phrased with explicit index variables, or use {anbnw:w∈{a,b}∗}\{a^nb^nw : w \in \{a,b\}^*\} intersected with {wcn:w∈{a,b}∗,n=∣w∣c}\{wc^n : w \in \{a,b\}^*, n = |w|_c\}-style variants. All standard counterexamples reduce to the same core phenomenon: forcing two independent equalities to hold simultaneously, which requires more memory discipline than one stack provides.

Does non-closure under intersection mean two specific CFLs never intersect to a CFL?

No — closure failure is about the general case, not every instance. Many pairs of CFLs intersect to another CFL; for instance intersecting {anbn}\{a^nb^n\} with {anbn}\{a^nb^n\} trivially gives back a CFL, and intersecting any CFL with Σ∗\Sigma^* gives back the same CFL. Non-closure only asserts that some pair of CFLs has a non-context-free intersection, which is enough to break the general closure property, but it doesn't stop individual intersections from happening to stay context-free.

Why does the CFG-combination trick fail for intersection the way it succeeds for union?

Union's grammar trick works because S→S1∣S2S \to S_1 \mid S_2 lets a derivation choose to follow one grammar exclusively — no need to reconcile the two derivations. Intersection would need a single derivation to simultaneously satisfy both grammars' constraints on the same string, and there is no analogous simple production rule that enforces "generate a string that both G1G_1 and G2G_2 would separately accept." No grammar-level trick analogous to S→S1∣S2S \to S_1 \mid S_2 exists for intersection, which is a symptom, not a coincidence, of the deeper stack-resource limitation.

How does this connect to the pumping lemma for context-free languages?

The pumping lemma is the tool used to rigorously prove that specific languages, like {anbncn}\{a^nb^nc^n\}, are not context-free — a fact this article uses but does not prove from scratch. Closure properties are often used together with the pumping lemma: you construct a suspicious language via intersection of two known CFLs, get a candidate that "smells" non-context-free, and then invoke the pumping lemma to nail down the proof rigorously. The two topics are complementary halves of the same toolkit for classifying languages.

Are CFLs closed under reversal, or under Kleene plus?

Yes to both, and both follow by simple grammar tricks similar to the ones shown here. For reversal, reverse the right-hand side of every production (if A→αA \to \alpha, replace with A→αRA \to \alpha^R); an easy induction shows this reverses every derived string. For Kleene plus, use S→S1S∣S1S \to S_1 S \mid S_1 (omitting the ε\varepsilon base case of the star construction), which generates one or more concatenated copies of L1L_1, i.e. exactly L1+=L1L1∗L_1^+ = L_1 L_1^*.

Does non-closure under intersection also break closure under set difference?

Yes — set difference L1∖L2=L1∩L2‾L_1 \setminus L_2 = L_1 \cap \overline{L_2} combines two operations CFLs are not generally closed under, so it fails in general too. A standard example: since CFLs are closed under intersection with regular languages and Σ∗\Sigma^* is regular and closed under complement (trivially, since Σ∗‾=∅\overline{\Sigma^*} = \varnothing is regular), L1∖RL_1 \setminus R for regular RR is safe, but L1∖L2L_1 \setminus L_2 for a general context-free L2L_2 is not guaranteed to be context-free.

Before this

Where this leads