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 , one can decide whether is empty and whether is finite.
Facts & Assumptions
Given: A context-free grammar .
By The language generated by a CFG, the language of is the set of words derivable from the start symbol .
By Eliminating useless symbols preserves the generated language, useless symbols can be removed without changing the generated language.
By Epsilon-productions can be eliminated except possibly at the start symbol, epsilon-productions can be removed except for the standard start-symbol exception.
By Unit productions can be eliminated, unit productions can be removed without changing the generated language.
Proof
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 once some production has every variable occurring in already marked generating. Because is finite, this fixed-point computation halts. By [L1], the language is empty exactly when the start variable never becomes generating.
For finiteness, first replace by an equivalent grammar 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 with an edge whenever some production for contains on its right-hand side.
If some reachable variable 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 with . Repeating that cycle any number of times and then finishing to terminals yields words of arbitrarily large length in , so the language is infinite.
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 has only finitely many productions and bounded branching, only finitely many parse trees can occur, and therefore only finitely many terminal yields occur. Thus is finite.
Step 1.1 decides emptiness, and steps 2.1-2.2 decide finiteness by a finite graph-cycle test.
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
- Alfred V. Aho, COMS W3261 CS Theory, Lecture 11 (standard reference, not scraped)
- H. Conrad Cunningham, CSci 311, Models of Computation, Chapter 8 (standard reference, not scraped)