Alphabeta Math
How statement and proof provenance work

The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.

  • Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
  • AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
  • AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.

These labels describe origin, not correctness: citations and verification chips remain separate evidence.

11 results · all verified · 5 also independently AI-judged
Every result on this page is machine-checked by a proof checker and read in full and owner-audited; the judge is an additional, independent cross-model AI review of the proofs. The 6 not AI-judged were verified by owner audit (typically over a confirmed judge false positive), not failures.

Context-Free Grammars and Normal Forms

1 · Prerequisites

2 · Summary

This page develops context-free grammars from derivations and parse trees through ambiguity, grammar simplification, Chomsky and Greibach normal forms, and the core closure constructions. The local route keeps the normal-form arguments constructive: useless, epsilon, and unit elimination are proved first, and the GNF conversion is justified by explicit substitution and left-recursion rewrite lemmas.

3 · Logical flowchart

4 · Definitions, theorems and proofs

DefinitionDefinition: Literature-sourcedProof: Not applicablejudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Context-free grammars

Definition

A context-free grammar is a quadruple G=(V,Σ,P,S) such that:

  • V is a finite set of variables.
  • Σ is a finite alphabet of terminals, disjoint from V.
  • SV is the start variable.
  • P is a finite set of productions of the form Aα, where AV and α is a finite word over the alphabet VΣ in the sense of Computation alphabets, words, the empty word, and Σ.

The word α may be empty, in which case the production is written Aε.

Remarks

  • "Context-free" means that the left-hand side of every production is a single variable, independent of the surrounding sentential context.

  • The grammar is finite because both the variable set and the production set are finite.

DefinitionDefinition: Literature-sourcedProof: Not applicablejudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

One-step derivation and finite derivation in a context-free grammar

Definition

Let G=(V,Σ,P,S) be a context-free grammar. A word over VΣ is a sentential form.

For sentential forms β,γ, write βGγ when there exist words x,y over VΣ, a variable AV, and a production Aα in P such that β=xAy,γ=xαy. This is the one-step derivation relation of G, a relation in the sense of Relation, domR, ranR, fldR, and the specialisations "relation from A to B" and "relation on A" on the set of sentential forms.

Write βGγ when γ is obtained from β by finitely many one-step derivations, possibly zero. This is the reflexive transitive closure of G, and a chain β=β0Gβ1GGβn=γ is a finite derivation from β to γ.

DefinitionDefinition: Literature-sourcedProof: Not applicablejudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

The language generated by a CFG

Definition

Let G=(V,Σ,P,S) be a context-free grammar. The language generated by G is L(G):={wΣ:SGw}.

A language L over Σ is context-free when L=L(G) for some context-free grammar G over Σ.

DefinitionDefinition: Literature-sourcedProof: Not applicablejudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Leftmost and rightmost derivations

Definition

Let G=(V,Σ,P,S) be a context-free grammar, and suppose xAyGxαy is one derivation step.

This step is leftmost when x contains no variables, so the rewritten occurrence of A is the leftmost variable in the sentential form. It is rightmost when y contains no variables, so the rewritten occurrence of A is the rightmost variable.

A finite derivation is a leftmost derivation when each of its steps is leftmost, and a rightmost derivation when each of its steps is rightmost.

DefinitionDefinition: Literature-sourcedProof: Not applicablejudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Parse trees and their yields

Definition

Let G=(V,Σ,P,S) be a context-free grammar. A parse tree for G is a finite, finitely branching rooted tree of finite sequences in the sense of Rooted trees of finite sequences, levels, branches, and finite branching, with ordered finite successor sets, together with a label on each node, satisfying the following conditions.

  • The root is labelled by the start variable S.
  • Every internal node is labelled by a variable AV.
  • If an internal node labelled A has ordered children labelled x1,,xk, then Ax1xk is a production of G.
  • A leaf is either labelled by a terminal in Σ, or is a variable leaf corresponding to a production Aε and contributes no terminal symbol to the yield.

Reading the terminal leaves from left to right gives a word in Σ, called the yield of the parse tree.

Remarks

  • The finite-sequence address set is what makes "left to right" precise: among siblings, the natural-number labels of successor nodes provide the order.

  • The tree itself is finite. This rules out infinite variable chains that do not correspond to a finite derivation.

  • An ε-production contributes no terminal letter to the yield.

TheoremStatement: Literature-sourcedProof: AI-generatedprecheck passjudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Derivations and parse trees correspond

Statement

Let G=(V,Σ,P,S) be a context-free grammar and let wΣ.

  1. The word w is derived from S in G if and only if there exists a parse tree for G with yield w.
  2. Every parse tree for G determines a unique leftmost derivation of its yield and a unique rightmost derivation of its yield.

Facts & Assumptions

Given: A context-free grammar G=(V,Σ,P,S) and a word wΣ.

[L1]

Leftmost and rightmost derivations are the derivations that rewrite the leftmost or rightmost remaining variable at each step, by Leftmost and rightmost derivations.

[L2]

A parse tree is finite; each internal node labelled A records exactly one production Ax1xk whose ordered children carry the labels x1,,xk; variable leaves may represent ε-productions; and the yield is the left-to-right list of terminal leaves, by Parse trees and their yields.

Proof

technique · direct
1.1

Suppose first that SGw. Start with one root labelled S and process the derivation step by step. When a step rewrites a current leaf labelled A by a nonempty right-hand side x1xk, make that leaf an internal node with ordered children labelled x1,,xk. When a step uses Aε, leave that leaf in place as the variable leaf corresponding to the ε-production. Because the derivation is finite, this constructs a finite parse tree whose nodes record exactly the productions used in the derivation.

givenL2induction
1.2

Conversely, suppose a parse tree for G has yield w. Start from the sentential form S and repeatedly rewrite the leftmost variable leaf represented in the fixed tree: if that leaf is an internal node of the tree with ordered children x1,,xk, apply the production Ax1xk; if it is a variable leaf corresponding to Aε, apply that ε-production. By [L2], every step is licensed by G, and by construction every step is leftmost in the sense of [L1]. Because the tree is finite, this process terminates after one step for each variable-labelled node, and the final terminal frontier is exactly the yield w.

givenL1L2construct
2.1

At the end of the construction in step 1.1, the leaves read left to right are exactly the symbols of the terminal word w, because each derivation step replaces one leaf occurrence of A by the same ordered right-hand side that the tree stores. So a derivation of w yields a parse tree whose yield is w.

step 1.1L2
2.2

The choice in step 1.2 is forced: at each stage there is a unique leftmost variable leaf of the fixed parse tree, so the leftmost derivation read from the tree is unique. The same argument, reading rightmost variable leaves instead, gives a unique rightmost derivation.

step 1.2L1
3.1

Steps 1.1 and 2.1 prove the forward implication of clause 1, and step 1.2 proves the reverse implication. Step 2.2 proves clause 2.

step 1.1step 2.1step 1.2step 2.2
DefinitionDefinition: Literature-sourcedProof: Not applicableaudited 2026-08-30Open item page →

Ambiguous grammars, unambiguous grammars, and inherently ambiguous languages

Definition

Let G be a context-free grammar.

The grammar G is ambiguous when there exists a word wL(G) having two distinct leftmost derivations in G. By Derivations and parse trees correspond, this is equivalent to requiring two distinct finite parse trees for G with yield w.

The grammar G is unambiguous when it is not ambiguous.

A context-free language L is inherently ambiguous when every context-free grammar G with L(G)=L is ambiguous.

Remarks

  • Ambiguity is a property of a grammar, while inherent ambiguity is a property of a language.

  • A language may admit both ambiguous and unambiguous grammars; in that case the ambiguous grammar is not evidence that the language is inherently ambiguous.

DefinitionDefinition: Literature-sourcedProof: Not applicablejudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Nullable, generating, and reachable variables

Definition

Let G=(V,Σ,P,S) be a context-free grammar.

  • A variable AV is nullable when AGε.
  • A variable AV is generating when AGw for some terminal word wΣ.
  • A variable AV is reachable when there exist sentential forms x,y over VΣ with SGxAy.

A variable is useful when it is both generating and reachable.

TheoremStatement: Literature-sourcedProof: AI-generatedprecheck passaudited 2026-08-30Open item page →

Eliminating useless symbols preserves the generated language

Statement

For every context-free grammar G there exists a context-free grammar G such that L(G)=L(G) and either:

  1. L(G)= and G is the evident empty-language grammar, or
  2. every variable of G is both generating and reachable.

Facts & Assumptions

Given: A context-free grammar G=(V,Σ,P,S).

[L1]

Variables may be nullable, generating, reachable, or useful exactly as in Nullable, generating, and reachable variables.

[L2]

The generated language is L(G)={wΣ:SGw}, by The language generated by a CFG.

Proof

technique · direct
1.1

Let TV be the generating variables of G, and let P1 consist of the productions whose left-hand side lies in T and whose right-hand side contains no variable outside T. If ST, then no terminal word is derivable from S, so [L2] gives L(G)= and we may take G to be any fixed grammar generating the empty language. If ST, set G1:=(T,Σ,P1,S).

L1L2givenconstruct
1.2

In the case ST, let RT be the variables reachable from S in G1, let P2 consist of the productions in P1 whose left-hand side lies in R and whose right-hand side contains no variable outside R, and set G2:=(R,Σ,P2,S). Every derivation beginning at S stays inside R by definition of reachability.

L1givenconstruct
2.1

Assume now that ST. Any derivation of a terminal word can use only generating variables, because every variable appearing in that derivation must eventually derive a terminal subword. Conversely, every rule kept in G1 was already a rule of G. Hence L(G1)=L(G).

L1L2step 1.1
3.1

Therefore deleting the unreachable variables changes no derivation from S to a terminal word, while every variable remaining in G2 is both generating and reachable. So L(G2)=L(G1)=L(G).

step 2.1step 1.2
4.1

Taking G=G2 in the case ST and the empty-language grammar in the case ST proves the theorem.

step 1.1step 3.1
TheoremStatement: Literature-sourcedProof: AI-generatedprecheck passjudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Epsilon-productions can be eliminated except possibly at the start symbol

Statement

For every context-free grammar G there exists a context-free grammar Gε such that:

  1. Gε has no ε-productions and L(Gε)=L(G){ε}.
  2. If εL(G), then there exists a context-free grammar G with L(G)=L(G) whose only ε-production is a start-symbol rule S0ε, where S0 does not occur on any right-hand side.

Facts & Assumptions

Given: A context-free grammar G=(V,Σ,P,S).

[L1]

A variable is nullable exactly when it derives ε, by Nullable, generating, and reachable variables.

[L2]

The generated language is defined by derivability from the start symbol, by The language generated by a CFG.

Proof

technique · direct
1.1

Let N be the nullable variables of G. Form a grammar Gε by deleting every production Aε and, for each remaining production Ax1xk, adding every nonempty right-hand side obtained by deleting any chosen subset of nullable occurrences among the xi.

L1construct
1.2

If εL(G), clause 1 already proves the theorem. Assume instead that εL(G). Introduce a fresh start variable S0 and add the two productions S0S and S0ε, leaving all productions of Gε unchanged.

givenconstruct
2.1

Any derivation of a nonempty terminal word in G can be shortened to one in Gε by collapsing each maximal family of nullable subderivations into a single use of one of the added productions. Conversely, every added production in Gε can be expanded back in G by re-inserting derivations of the deleted nullable variables to ε. Therefore [L2] gives L(Gε)=L(G){ε}.

L1L2step 1.1
3.1

The rule S0ε restores the missing empty word, while step 2.1 already preserved every nonempty terminal word. Because S0 is fresh, it appears on no right-hand side, so this is the only ε-production of the new grammar G. Hence L(G)=L(G).

step 2.1step 1.2
TheoremStatement: Literature-sourcedProof: AI-generatedprecheck passaudited 2026-08-30Open item page →

Unit productions can be eliminated

Statement

A unit production is a production AB whose left- and right-hand sides are both single variables.

For every context-free grammar G there exists a context-free grammar H such that L(H)=L(G) and H has no unit productions.

Facts & Assumptions

Given: A context-free grammar G.

[L1]

By Epsilon-productions can be eliminated except possibly at the start symbol, we may first replace G by an equivalent grammar whose only possible ε-production is a special start-symbol rule.

[L2]

The generated language is defined by derivability from the start symbol, by The language generated by a CFG.

Proof

technique · direct
1.1

Replace G by an equivalent grammar G1 as in [L1]. For variables A,B, write AB when AG1B using only unit productions. Now form H by deleting all unit productions and, whenever AB and Bα is a nonunit production of G1, adding the copied production Aα.

L1construct
2.1

Any derivation of a terminal word in G1 can be compressed to a derivation in H by replacing each maximal block of unit productions followed by one nonunit production Bα with the copied rule Aα placed into H. Therefore every word of L(G1) lies in L(H).

step 1.1L2
2.2

Conversely, every copied production Aα of H came from some unit chain AB in G1 and a nonunit production Bα of G1. Expanding one use of Aα back into that unit chain followed by Bα turns any derivation in H into a derivation in G1. So every word of L(H) lies in L(G1).

step 1.1L2
3.1

Steps 2.1 and 2.2 give L(H)=L(G1)=L(G), and H has no unit productions by construction.

L1step 2.1step 2.2
DefinitionDefinition: Literature-sourcedProof: Not applicablejudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Chomsky normal form

Definition

A context-free grammar G=(V,Σ,P,S) is in Chomsky normal form when every production of G is of one of the following types:

  1. ABC, where A,B,CV;
  2. Aa, where AV and aΣ;
  3. optionally, Sε, provided that S does not occur on any right-hand side.

Remarks

  • The start-symbol ε-rule is an exception, not part of the generic binary-or-terminal pattern.

  • In CNF, every nonempty derivation step either expands one variable into two variables or replaces one variable by one terminal.

TheoremStatement: Literature-sourcedProof: AI-generatedprecheck passaudited 2026-08-30Open item page →

Every context-free language has an equivalent grammar in Chomsky normal form

Statement

Every context-free grammar has an equivalent context-free grammar in Chomsky normal form.

Facts & Assumptions

Given: A context-free grammar G.

[L1]

Useless symbols can be eliminated without changing the language, by Eliminating useless symbols preserves the generated language.

[L2]

Epsilon-productions can be eliminated except for the special start-symbol exception, by Epsilon-productions can be eliminated except possibly at the start symbol.

[L3]

Unit productions can be eliminated without changing the language, by Unit productions can be eliminated.

[L4]

Chomsky normal form allows only productions of the shapes listed in Chomsky normal form.

Proof

technique · direct
1.1

Apply [L1], [L2], and [L3] in order to obtain an equivalent grammar G1 in which every remaining production is nonunit and every ε-production is removed except possibly a start-symbol rule.

L1L2L3construct
2.1

For each terminal a that appears in a right-hand side of length at least 2, introduce a fresh variable Ta with production Taa, and replace that occurrence of a by Ta. This changes no generated word, because each use of Ta can immediately be expanded to the terminal a. After this step, every right-hand side is either a single terminal or a word of variables only.

constructstep 1.1
3.1

For each production AB1B2Bk with k3, introduce fresh variables C1,,Ck2 and replace the production by AB1C1,CiBi+1Ci+1  (1ik3),Ck2Bk1Bk. The middle family is empty when k=3, so that case is the two-rule chain AB1C1 and C1B2B3. One use of the original long rule is equivalent to this forced chain of binary rules, and conversely the binary chain produces exactly the same string of variables.

constructstep 2.1
4.1

After steps 2.1 and 3.1, every production is either ABC, Aa, or the exceptional start-symbol rule Sε. Therefore [L4] says the resulting grammar is in Chomsky normal form, and the preceding steps preserved the language.

L4step 2.1step 3.1
DefinitionDefinition: Literature-sourcedProof: Not applicablejudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Greibach normal form

Definition

A context-free grammar G=(V,Σ,P,S) is in Greibach normal form when every production is of the form Aaα, where AV, aΣ, and α is a possibly empty word of variables, together with the optional exception Sε when S does not occur on any right-hand side.

Remarks

  • In GNF, every nonempty derivation step emits one terminal immediately.

  • The optional start-symbol ε-rule plays the same role here as in Chomsky normal form.

LemmaStatement: Literature-sourcedProof: AI-generatedprecheck passjudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Substituting a variable's productions into a leading variable occurrence preserves the language

Statement

Let G be a context-free grammar containing the production AuBv. Suppose the productions of B in G are exactly Bw1,,Bwm, where u,v,w1,,wm are words over variables and terminals. Let H be the grammar obtained by deleting the production AuBv and replacing it by the family Auw1v,,Auwmv, while keeping every other production of G.

Then L(H)=L(G).

Facts & Assumptions

Given: Grammars G and H related by the displayed substitution step, with the displayed list Bw1,,Bwm equal to the full family of B-productions in G.

[L1]

A finite derivation is a chain of one-step derivations, by One-step derivation and finite derivation in a context-free grammar.

[L2]

The language L(G) consists of the terminal words derivable from the start symbol, by The language generated by a CFG.

Proof

technique · direct
1.1

Let xAyGxuBvy be one use of the deleted production in a derivation of a terminal word, and follow the distinguished occurrence of B created by this step. It is eventually rewritten by some Bwi, since the displayed rules are all the productions of B. Every intervening step rewrites a different variable occurrence. Such a step commutes with the rewrite of the distinguished B: applying the two context-free productions in either order gives the same sentential form. We may therefore move Bwi leftward past all intervening steps and replace the resulting adjacent fragment xAyGxuBvyGxuwivy by the single H-step xAyHxuwivy. Restoring the commuted surrounding-context steps gives the same final terminal word.

givenL1
1.2

Conversely, every use in H of a substituted production Auwiv can be expanded in G to the two steps xAyGxuBvyGxuwivy. Replacing each substituted step in a derivation of a terminal word in H by this two-step fragment yields a derivation in G with the same yield. Hence [L2] gives L(H)L(G).

givenL1L2
2.1

If a terminal derivation in G never uses the deleted production AuBv, then it is also a derivation in H. Otherwise apply step 1.1 to one use of AuBv. This decreases by one the number of uses of the deleted production in the finite derivation without changing its terminal yield. Repeating finitely many times produces an H-derivation of the same word, so [L2] gives L(G)L(H).

L2step 1.1
3.1

The two inclusions from steps 2.1 and 1.2 prove L(H)=L(G).

step 2.1step 1.2
LemmaStatement: Literature-sourcedProof: AI-generatedprecheck passaudited 2026-08-30Open item page →

Eliminating immediate left recursion preserves the language

Statement

Suppose the productions of a variable A in a context-free grammar are exactly AAu1,,AAur,Av1,,Avs, where none of the words vj begins with A. Introduce a fresh variable R and replace those productions by Av1,,Avs,Av1R,,AvsR, Ru1,,Rur,Ru1R,,RurR, leaving every other production unchanged.

Then the resulting grammar generates the same language as the original grammar.

Facts & Assumptions

Given: The original grammar and the rewritten grammar related by the displayed immediate-left-recursion elimination step.

[L1]

Leftmost derivations always rewrite the leftmost remaining variable, by Leftmost and rightmost derivations.

[L2]

The language of a grammar is determined by the terminal words derivable from its start symbol, by The language generated by a CFG.

Proof

technique · direct
1.1

Consider a leftmost derivation segment in the original grammar beginning with A. Because every left-recursive rule has the form AAui, any maximal initial block of left-recursive steps must look like AAui1Aui2ui1Auikui1vjuikui1. So the contribution of this segment is always one non-left-recursive word vj followed by a finite concatenation of the ui.

L1given
2.1

The new variable R generates exactly the nonempty finite concatenations of the ui: use Rui for a one-term concatenation and RuiR to prepend further ui's. Therefore the segment in step 1.1 is reproduced in the rewritten grammar either by Avj when k=0 or by AvjR followed by a derivation of the same tail from R when k1.

constructstep 1.1
3.1

Conversely, any derivation segment in the rewritten grammar beginning with A either uses Avj directly or uses AvjR followed by a derivation of a finite concatenation of the ui from R. Reversing the regrouping in step 1.1 turns that segment back into a block of left-recursive uses of AAui ending with Avj in the original grammar.

step 2.1
4.1

Since all other productions are unchanged, steps 2.1 and 3.1 convert derivations of terminal words back and forth without changing the yield. Hence [L2] gives equality of the generated languages.

L2step 2.1step 3.1
TheoremStatement: Literature-sourcedProof: AI-generatedprecheck passaudited 2026-08-30Open item page →

Every context-free language has an equivalent grammar in Greibach normal form

Statement

Every context-free grammar has an equivalent context-free grammar in Greibach normal form.

Facts & Assumptions

Given: A context-free grammar G.

[L1]

By Every context-free language has an equivalent grammar in Chomsky normal form, we may first replace G by an equivalent grammar in Chomsky normal form.

[L2]

If a production AuBv is replaced by the family Auw1v,,Auwmv formed from all productions of B, then the generated language is preserved, by Substituting a variable's productions into a leading variable occurrence preserves the language.

[L3]

Eliminating immediate left recursion preserves the generated language, by Eliminating immediate left recursion preserves the language.

[L4]

Greibach normal form means that every nonexceptional production has the form Aaα with leading terminal a, by Greibach normal form.

Proof

technique · direct
1.1

Replace G by an equivalent CNF grammar G1 as in [L1], and order its original variables as A1,,An. In a forward pass through this list, fix Ai and repeatedly use [L2] to remove every production of the form AiAjα with j<i. When that is done, use [L3] to eliminate the remaining immediate left-recursive productions AiAiβ, introducing an auxiliary variable Bi if needed. After stage i, every production of Ai begins either with a terminal or with an original variable Ak satisfying k>i, and every new production of Bi begins either with a terminal or with an original variable.

L1L2L3construct
2.1

In particular, after the forward pass the productions of An already begin with terminals, because there is no index k>n. Now argue downward on i=n1,n2,,1. Assume the productions of Ai+1,,An already begin with terminals. Every production of Ai begins either with a terminal or with some Ak having k>i by step 1.1, so repeated use of [L2] substitutes the full terminal-leading production family of each such Ak into the leading occurrence. Thus every production of Ai can also be made terminal-leading without changing the language.

L2step 1.1induction
3.1

The same downward substitutions clean every auxiliary variable introduced during the left-recursion eliminations. By step 1.1, each production of such a Bi already begins either with a terminal or with an original variable Ak. Once the productions of each Ak are terminal-leading by step 2.1, repeated use of [L2] removes that leading variable from the productions of Bi as well. Therefore, after finitely many substitutions, every production in the whole grammar begins with a terminal, except possibly the start-symbol rule Sε.

L2step 1.1step 2.1
4.1

Because the construction started from CNF, the symbols after the first terminal in any rewritten production are variables, and the optional start-symbol rule Sε is preserved only in the exceptional case allowed by [L4]. Hence the final grammar is in Greibach normal form, and [L2] and [L3] preserved equivalence throughout.

L4step 1.1step 2.1step 3.1
TheoremStatement: Literature-sourcedProof: AI-generatedprecheck passjudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

Context-free languages are closed under union, concatenation, Kleene star, and homomorphism

Statement

If L1,L2 are context-free languages over an alphabet Σ, and if h:ΣΔ is an alphabet map, then the following languages are context-free:

  1. L1L2,
  2. L1L2,
  3. L1,
  4. h^(L1)={h^(w):wL1}.

Facts & Assumptions

Given: Context-free languages L1 and L2, together with grammars G1=(V1,Σ,P1,S1) and G2=(V2,Σ,P2,S2) generating them, and an alphabet map h:ΣΔ.

[L1]

A language is context-free exactly when it is generated by some context-free grammar, by The language generated by a CFG.

[L2]

The induced word map h^ is obtained by replacing each letter a of a word by the word h(a) and concatenating the results, by Alphabet maps into Δ and their induced maps on words.

Proof

technique · direct
1.1

Rename variables of G1 and G2 apart, and add a fresh start variable S. The grammar with productions of G1 and G2 together with SS1 and SS2 generates exactly L1L2. Similarly, adding only the bridge rule SS1S2 yields a grammar for the concatenation L1L2.

givenL1construct
1.2

For Kleene star, keep G1 and add a fresh start variable S with productions Sε and SS1S. Repeating the second rule any finite number of times and then using Sε generates exactly a concatenation of finitely many words from L1, so the new grammar generates L1.

constructL1
1.3

For homomorphism, first rename the variables of the chosen grammar for L1 so that they are disjoint from Δ. Then replace every terminal letter a occurring in a production by the word h(a), keeping that renamed variable set unchanged. The result is still a context-free grammar over Δ, and if a derivation in the source grammar yields w=a0an1, then the corresponding derivation in the rewritten grammar yields h(a0)h(an1)=h^(w) by [L2].

L2construct
2.1

Conversely, any terminal derivation in the rewritten grammar follows the same variable-expansion pattern as a terminal derivation in the renamed source grammar, because the only change was to replace each source terminal occurrence by its prescribed image word h(a). Therefore the terminal word produced at the end is exactly the image under h^ of a word of L1, so the new grammar generates exactly h^(L1).

L2step 1.3
3.1

Steps 1.1, 1.2, 1.3, and 2.1 construct grammars for all four languages, so [L1] shows that context-free languages are closed under union, concatenation, Kleene star, and homomorphism.

L1step 1.1step 1.2step 1.3step 2.1
False statementConstruction: Literature-sourcedVerification: AI-generatedprecheck passaudited 2026-08-30Open item page →

FALSE: an ambiguous CFG always generates an inherently ambiguous language

Statement

False claim: if a context-free grammar is ambiguous, then the language it generates is inherently ambiguous.

Facts & Assumptions

Given: The grammar EE+EEE(E)ab.

[A1]

The statement refuted is: every ambiguous context-free grammar generates an inherently ambiguous language.

[L1]

A context-free language is inherently ambiguous when every context-free grammar generating it is ambiguous, by Ambiguous grammars, unambiguous grammars, and inherently ambiguous languages.

Refutation

technique · direct
1.1

The displayed grammar is ambiguous: the word a+aa has one parse corresponding to a+(aa) and another corresponding to (a+a)a. So the grammar is an ambiguous CFG.

given
1.2

The standard precedence grammar EE+TT,TTFF,F(E)ab generates the same terminal strings. One inclusion follows by simultaneous induction on its E-, T-, and F-derivations, since every displayed production can be simulated by the first grammar. For the reverse inclusion, scan a generated word at parenthesis depth zero: if there is a +, split at the rightmost such +; otherwise, if there is a *, split at the rightmost such *; the remaining factor is either a, b, or a parenthesized expression. Induction on the word length gives a derivation in the precedence grammar. These rightmost top-level splits are forced by its left-recursive E- and T-rules, while the F-case is forced by the outer symbols, so the resulting parse is unique. In particular, a+aa has only the parse a+(aa). Thus the language has an unambiguous grammar.

giveninduction
2.1

By [L1], a language with an unambiguous grammar is not inherently ambiguous. So the ambiguous grammar from step 1.1 does not force its language to be inherently ambiguous, and [A1] is false.

A1L1step 1.1step 1.2
False statementConstruction: Literature-sourcedVerification: AI-generatedprecheck passjudge pass (gpt-5.6-terra)audited 2026-08-30Open item page →

FALSE: converting to Chomsky normal form preserves epsilon without a special start-symbol exception

Statement

False claim: converting a context-free grammar to Chomsky normal form preserves ε without any special exception.

Facts & Assumptions

Given: The grammar with one variable and one production, Sε.

[A1]

The statement refuted is: CNF conversion preserves ε without a special start-symbol exception.

[L1]

Chomsky normal form allows an ε-production only in the special case Sε with S absent from every right-hand side, by Chomsky normal form.

[L2]

Every context-free grammar is equivalent to one in Chomsky normal form, by Every context-free language has an equivalent grammar in Chomsky normal form.

Refutation

technique · direct
1.1

The given grammar generates exactly the language {ε}. So any equivalent CNF grammar must still generate ε.

givenL2
1.2

Without the exception described in [L1], every CNF production would have the form ABC or Aa. Such rules can produce only nonempty terminal words, because every terminal step contributes one symbol and no rule deletes all remaining symbols. Therefore a grammar with only those two rule types cannot generate ε.

L1
2.1

Step 1.2 contradicts the requirement from step 1.1, so the special start-symbol exception is genuinely necessary. The claim [A1] is false.

A1step 1.1step 1.2

5 · Examples, counterexamples and false statements

None yet.

Sources