Formal grammar Created 2026-09-24 Updated 2026-11-05
A formal grammar specifies how to generate a formal language by repeated applications of production rules. Write , where is a finite set of nonterminal symbols, is a disjoint finite alphabet of terminal symbols, is the start symbol, and is a finite set of production rules . In an unrestricted formal grammar, the word must contain at least one nonterminal symbol; may be any word over .
A grammar derivation replaces an occurrence of inside a word by . The generated formal language isIntermediate words may still contain nonterminal symbols; these are sentential forms. For example, the production rules and give and generate exactly . Restricting each left side to one nonterminal symbol gives a context-free grammar.[ref]
Introduction to the Theory of Computation by Jean Gallier (2017). Sections6.1–6.2, printed pp.127–129, context-free grammar and derivation definitions
Kleene's recursion theorem Created 2026-10-14 Updated 2026-11-05
Fix an effective numbering of the partial computable functions with a universal partial computable function and the parameter compilation supplied by the S-m-n theorem. For every total computable function , there is a program index such thatHere means equality as partial functions, including the inputs on which computation diverges. The conclusion concerns a program's behavior, not equality of program indices: has no numerical fixed point, but still has this semantic fixed point.[ref]
Introduction to the Theory of Computation by Jean Gallier (2017). Section10.5, Theorem10.22, printed pp.276–277
For a proof, the S-m-n theorem gives a total computable function compiling into a program that, on input , first computes and then runs the program with that resulting index on . Thuswhere both sides diverge if the inner computation does. Choose an index for the total computable function . Setting givesThe theorem makes rigorous a program's ability to use a description of itself. For example, let compile a program that ignores its input and prints . Its semantic fixed point is a program that prints its own index. This does not require a program to read its source file.