Alphabeta Math
TheoremStatement: Literature-sourcedProof: AI-generatedprecheck passaudited 2026-09-12
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.

CFG emptiness and finiteness are decidable

Statement

Given a context-free grammar G, one can decide whether L(G) is empty and whether L(G) is finite.

Facts & Assumptions

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

[L1]

By The language generated by a CFG, the language of G is the set of words derivable from the start symbol S.

[L2]

By Eliminating useless symbols preserves the generated language, useless symbols can be removed without changing the generated language.

[L3]

By Epsilon-productions can be eliminated except possibly at the start symbol, epsilon-productions can be removed except for the standard start-symbol exception.

[L4]

By Unit productions can be eliminated, unit productions can be removed without changing the generated language.

Proof

technique · direct
1.1

To decide emptiness, compute the least set of generating variables: start with variables that have a production to a terminal word, and repeatedly add a variable A once some production Aα has every variable occurring in α already marked generating. Because V is finite, this fixed-point computation halts. By [L1], the language is empty exactly when the start variable S never becomes generating.

L1givenconstruct
1.2

For finiteness, first replace G by an equivalent grammar G using [L2], [L3], and [L4], so that every remaining variable is useful, there are no unit productions, and there are no epsilon-productions except possibly the start-symbol exception. Build the directed dependency graph on the variables of G with an edge AB whenever some production for A contains B on its right-hand side.

L2L3L4construct
2.1

If some reachable variable A lies on a directed cycle of this graph, then usefulness gives a terminal derivation from each variable on the cycle, while the removal of unit and nonstart epsilon-productions forces at least one terminal symbol to be added when the cycle is traversed once. Hence there is a derivation AGxAy with xy1. Repeating that cycle any number of times and then finishing to terminals yields words of arbitrarily large length in L(G)=L(G), so the language is infinite.

L1step 1.2
2.2

Conversely, if the reachable part of the dependency graph is acyclic, then no root-to-leaf path in a parse tree can repeat a reachable variable. So parse trees have uniformly bounded depth. Because G has only finitely many productions and bounded branching, only finitely many parse trees can occur, and therefore only finitely many terminal yields occur. Thus L(G) is finite.

step 1.2
3.1

Step 1.1 decides emptiness, and steps 2.1-2.2 decide finiteness by a finite graph-cycle test.

step 1.1step 2.1step 2.2

Depends on

Used by

Dependency tree · two levels

6 results within two dependency steps of this one, each drawn at its shortest distance from it. An arrow runs from a result to what uses it, so the chart reads left to right and ends at this result, which carries a heavier outline. Every node is a link to that result. Click elsewhere on the chart to enlarge it.

Sources