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.
Primitive Recursive and Partial Computable Functions
1 · Prerequisites
- Construction of the Natural Numbers
- Countability and Uncountability
- Finite Counting, Factorials and Binomial Coefficients
- Formal Languages, Encodings, and Decision Problems
- Linear Recurrences and Rational Generating Functions
- Relations, Functions, and Quotients
- Robust Machine Models and Universal Computation
- The ZFC Axioms and the Basic Set Constructions
- Turing Machines, Configurations, and Computation
2 · Summary
This page develops the classical ladder from primitive recursion to partial recursion and then to machine computability. The route is explicit about the intermediate coding work: finite sequences are coded by natural numbers, single Turing steps are arithmetized, Kleene's -predicate and output function are defined from those codings, and the normal-form theorem turns machine computation into minimization over coded histories.
The page closes with the two standard comparison seams. Ackermann's function shows that total computability is strictly broader than primitive recursion, while the lambda-calculus comparison identifies partial recursive functions with lambda-definable ones without collapsing terms, computations, machine codes, and extensional functions into the same object.
3 · Logical flowchart
4 · Definitions, theorems and proofs
The zero, successor, and projection functions on the natural numbers
Definition
For each integer , the initial arithmetic functions on are:
- the zero function
- the successor function
- for each , the th projection
Here is the natural-number system from The natural numbers (von Neumann), and each displayed rule determines a total function in the sense of A function is a relation with and implying ; , the value , domain and codomain.
Remarks
-
These are the basic generators from which primitive recursive functions are built.
-
The arity is part of the data: the family contains one projection for each positive arity and each coordinate in that arity.
Composition and primitive recursion as closure schemes on arithmetic functions
Definition
Let and let be total arithmetic functions. Their composition is the function from to .
Let and be total arithmetic functions. A function is obtained from and by primitive recursion when and for every and every .
By The recursion theorem, once and are fixed there exists a unique total function satisfying these two clauses.
Remarks
-
Composition does not change totality.
-
Primitive recursion is recursion on one distinguished natural-number argument, with the previous function value available in the recursive clause.
Primitive recursive functions
Definition
A total function is primitive recursive when it belongs to the smallest collection of total arithmetic functions that:
- contains every initial arithmetic function from The zero, successor, and projection functions on the natural numbers, and
- is closed under the two schemes from Composition and primitive recursion as closure schemes on arithmetic functions.
Equivalently, a primitive recursive function is one obtainable from the zero, successor, and projection functions by finitely many applications of composition and primitive recursion.
Remarks
-
Primitive recursive functions are always total on .
-
The definition is extensional: different constructions may yield the same primitive recursive function.
Basic arithmetic operations and bounded quantification are primitive recursive
Statement
The following total functions are primitive recursive:
- addition and multiplication on ,
- predecessor , ,
- truncated subtraction ,
- the characteristic functions of , equality, and order,
- for every primitive recursive , the bounded sum and bounded product
- and therefore bounded existential and universal quantifiers of primitive-recursive predicates.
Facts & Assumptions
Given: The closure clauses in Primitive recursive functions.
Primitive recursive functions are exactly the total functions obtained from the initial arithmetic functions by finitely many compositions and primitive recursions, by Primitive recursive functions.
Proof
Addition is obtained by primitive recursion from the clauses and . Multiplication is then obtained by primitive recursion from and addition via and . By [L1], both functions are primitive recursive.
The predecessor function is primitive recursive from and . Then truncated subtraction is primitive recursive by and . From this, the zero-test is primitive recursive via and , the sign function is primitive recursive, equality is given by , and order is given by . So the listed basic arithmetic and characteristic functions are primitive recursive by [L1].
If is primitive recursive, then bounded sums and products are obtained by primitive recursion through , , , and . Hence and are primitive recursive by [L1].
If is a primitive-recursive characteristic function, then and . Thus bounded existential and bounded universal quantification preserve primitive recursiveness.
The displayed constructions establish every operation and quantifier listed in the statement.
A natural-number coding of finite sequences
Definition
Write for the canonical binary numeral of , with . For a binary word , let
For a finite sequence of natural numbers define its sequence word The leading keeps the whole word a canonical positive binary numeral even when .
The natural-number code of is the unique natural number whose binary numeral is . In particular, the empty sequence has code , because .
By Finite tuples admit effective prefix-free binary encodings, the tuple of binary numerals inside is effectively and uniquely decodable, so this construction gives an injective coding of finite sequences of natural numbers by natural numbers.
Remarks
-
Later items write for the decoded length of the sequence coded by , and for its th decoded entry when .
-
The coding is chosen so that the length header and every coordinate block can be recovered by bounded scans through the binary numeral of the code.
The sequence-length and coordinate-reading functions are primitive recursive
Statement
For the coding from A natural-number coding of finite sequences, the following total functions are primitive recursive:
- the decoded length function defined by and otherwise, and
- the coordinate-reading function defined by and otherwise.
Facts & Assumptions
Given: The sequence coding from A natural-number coding of finite sequences.
Primitive recursive functions are closed under the basic arithmetic, characteristic, and bounded-quantification constructions from Basic arithmetic operations and bounded quantification are primitive recursive.
A coded finite sequence has binary numeral , with each block , by A natural-number coding of finite sequences.
Proof
By bounded search on quotients and remainders, one can primitive-recursively recover the binary length of a positive integer and each individual bit of its canonical binary numeral. Using [L2], a bounded scan first reads the sentinel and unary header, obtaining a candidate . It then parses exactly self-delimiting blocks, checks that each payload is a canonical binary numeral, and verifies that the final block ends at the end of the numeral. Only if all these checks succeed does it return ; otherwise it returns . All scan bounds are at most the binary length of , so this full validity test and the total function are primitive recursive by [L1].
Once is known, the start and end of the th block are found by another bounded scan through the same binary numeral: each block begins with a run of 's whose length is the bit-length of , followed by one delimiter , followed by exactly that many payload bits. The integer represented by that payload is then recovered by a bounded primitive-recursive evaluation of binary place values.
If the bounded scan shows that or that the numeral of is not of the required form, define the output to be . Otherwise return the value decoded in step 2.1. Because every search range is bounded by the bit-length of , the total function is primitive recursive by [L1].
Steps 1.1 and 3.1 prove that both the length function and the total coordinate-reading function are primitive recursive.
Unbounded minimization and partial recursive functions
Definition
A partial function is a function whose domain is some subset of and whose values lie in . Thus the hooked arrow records the ambient input set, while the actual domain may be smaller.
Let be a partial function. Its unbounded minimization is the partial function defined at exactly when there exists such that and is defined and nonzero for every ; in that case is the least such .
Composition of partial functions is strict: if and , then is defined exactly when every is defined and is defined at the resulting tuple. Primitive recursion for partial functions uses the same two recursive clauses as in the total case, with a value undefined as soon as a required earlier value or an application of a defining function is undefined.
A partial function is partial recursive when it belongs to the smallest class of partial functions on finite powers of that:
- contains every initial arithmetic function, viewed as a total partial function,
- is closed under strict composition,
- is closed under partial primitive recursion, and
- is closed under unbounded minimization.
Remarks
-
Minimization is the first closure operation here that can destroy totality.
-
A partial recursive function is therefore allowed to be undefined on some inputs even though the primitive recursive functions are always total.
The Ackermann function is total computable but not primitive recursive
Statement
Let be the Ackermann-Peter function defined by Then is a total computable function, but is not primitive recursive.
Facts & Assumptions
Given: The function defined in the statement.
Primitive recursive functions are the total functions obtained from the initial functions by finitely many compositions and primitive recursions, by Primitive recursive functions.
A machine computes a partial function when it halts with the required output on every input in the domain and diverges off the domain, by Partial functions computed by a machine under fixed encodings.
For each fixed , the unary function is strictly increasing in , and is obtained by iterating a growing number of times. Consequently, for fixed and , some sufficiently high row with eventually dominates the shifted row , and passing to a sufficiently higher row absorbs any fixed finite composition or an -fold iteration of lower rows.
Proof
A deterministic machine can evaluate by keeping a finite stack of pending calls. Start with the one stack entry . If the top entry is , replace it by the value ; if it is , replace it by ; and if it is , replace it by the two pending calls and then , where the second frame waits for the value returned by the first and then substitutes it into . Every individual rewrite is effective on a coded stack, so by [L2] this gives a machine procedure for evaluating .
For each primitive recursive -ary function , structural induction on its construction from [L1] gives constants such that for all inputs. The initial functions satisfy such a bound. For composition, apply the induction bounds to all inner functions, take their maximum, and then apply the bound for the outer function; monotonicity and the absorption property in [F1] replace the resulting finite composition by one higher fixed row. For primitive recursion, the recursion variable bounds the number of successive applications of the step function; [F1] again absorbs those boundedly many lower-row iterations into a higher fixed row.
The defining recursion decreases the left argument whenever the right argument is reset, and otherwise decreases the right argument before the left argument is used again. Induction on and then on therefore shows that every call chain eventually reaches the base clause . Hence the machine from step 1.1 halts on every input , so is total computable.
If itself were primitive recursive, step 1.2 would give fixed with for all . Setting and then taking sufficiently large gives by [F1], contradicting that bound. Therefore is not primitive recursive.
Steps 2.1 and 2.2 prove that Ackermann's function is total computable but not primitive recursive.
The one-step update on coded Turing configurations is primitive recursive
Statement
For a configuration , let be the larger of and the rightmost nonblank tape position, taking the latter to be when the tape is blank. Define its configuration code by
There is a primitive recursive total function such that, whenever is a valid machine code and is the chosen code of a configuration of :
- if is nonhalting and , then
- if is halting, then .
On malformed inputs, returns a fixed default code.
Facts & Assumptions
Given: The machine code and configuration code .
A coded machine is given by a finite tuple recording its state count, input-alphabet size, tape-alphabet size, and lexicographically ordered transition triples, and the code is effectively decodable, by A fixed effective binary encoding of deterministic one-tape Turing machines and The chosen machine coding is injective and has a total decoder.
A configuration of a one-tape machine is determined by its current state, head position, and finite tape data, and one step changes only the scanned symbol, the state, and the head position according to Configurations of a deterministic one-tape Turing machine and The one-step configuration relation.
For the chosen natural-number coding of finite sequences, the decoded length and any decoded coordinate are primitive recursive, by The sequence-length and coordinate-reading functions are primitive recursive.
Basic arithmetic, characteristic functions, and bounded searches are primitive recursive, by Basic arithmetic operations and bounded quantification are primitive recursive.
Proof
By the configuration-code definition in the statement and [L3], primitive recursive functions recover from the decoded length of the tuple, its first two entries , the currently scanned symbol , and any later tape symbol that may need to be copied into the output code.
Using the explicit tuple format from [L1], together with the primitive-recursive arithmetic and bounded searches from [L4], one can scan the canonical binary numeral of : count the initial unary arity header, locate each self-delimiting block, verify the tuple-length and alphabet constraints, and recover the first three numerals and every transition-table coordinate, returning the default branch on malformed inputs. A bounded search through the recovered transition list therefore finds the unique transition triple attached to the pair when is nonhalting. Using [L2] and the decoded tape coordinates from step 1.1, form the updated tape, state, and head position . Then use a bounded backward search through positions at most to find the rightmost nonblank updated cell, taking if none exists, and set to the maximum of that position and . The output tuple is exactly , so erasing the former rightmost nonblank cell trims the trailing blank while a head move onto a blank cell still records the head position.
If the decoded state is already accepting or rejecting, step 2.1 is skipped and the output is the original code . If the input code is malformed, return one fixed default code. These are again primitive-recursive case distinctions because the relevant checks are bounded and finite.
Re-encoding the canonically trimmed updated sequence from step 2.1 uses only primitive-recursive arithmetic on its boundedly many coordinates, so the total function is primitive recursive and has the stated behavior.
Kleene's T-predicate and output function
Definition
Fix the machine coding from A fixed effective binary encoding of deterministic one-tape Turing machines and the sequence coding from A natural-number coding of finite sequences.
For natural numbers , define Kleene's -predicate to hold exactly when codes a finite sequence of configurations such that:
- decodes to a machine ,
- is the initial configuration of on input ,
- is obtained from by the coded one-step update for every , and
- is halting.
Define the output function as follows. If decodes to a nonempty sequence whose final entry is a well-formed configuration code and the tape in that configuration contains a canonical binary numeral followed by blanks, let be the natural number represented by that numeral. On every other input, set . Thus only extracts data from the final coded configuration; it does not first test an unbounded existential claim about whether some machine and input have that history. The output-word convention is the one fixed in Finite computation histories, halting computations, and divergence.
Define the numeric zero-test for by
The primitive-recursive readers of The sequence-length and coordinate-reading functions are primitive recursive parse the history and every configuration coordinate. A bounded universal check over the decoded list verifies the initial configuration, each update using The one-step update on coded Turing configurations is primitive recursive, and the final halting state. Equality tests, composition, bounded search, and bounded universal quantification preserve primitive recursiveness by Basic arithmetic operations and bounded quantification are primitive recursive. The same readers locate the final configuration and perform a bounded scan of its finitely encoded tape segment, checking and evaluating the canonical binary numeral. Consequently the combined history-validity zero-test and the final-output reader are primitive recursive, and is a primitive-recursive relation through its zero-test.
Remarks
-
says that is a complete halting computation history, not just one legal step.
-
The least satisfying is the first successful coded history in the usual numeric order, not necessarily the shortest history.
Kleene normal form for partial recursive functions
Statement
For every partial recursive function , there exists a natural number such that for every input :
- if is defined, then
- and if is undefined, then there is no with .
Here , its numeric zero-test , and are the primitive recursive objects from Kleene's T-predicate and output function.
Facts & Assumptions
Given: A partial recursive function .
Partial recursive functions are generated from the initial arithmetic functions by composition, primitive recursion, and unbounded minimization, by Unbounded minimization and partial recursive functions.
The relation says that codes a complete halting computation history for the machine coded by on input ; its numeric zero-test satisfies exactly when ; and reads the halting output from that history, by Kleene's T-predicate and output function.
Proof
By [L1], the function is presented by a finite derivation from the initial functions using composition, primitive recursion, and minimization. Build a machine for that derivation by structural induction. The zero, successor, and projection functions have immediate machines. For composition, run the machines for the inner functions in sequence and feed their outputs to the outer machine; divergence of any required subcomputation propagates. For primitive recursion, store the parameters and previous value and iterate the step machine from to the recursion argument. For minimization, evaluate the search function at in order and halt at the first zero; if an earlier required value is undefined, the machine diverges as prescribed by partial minimization. Since the derivation is finite, this yields one machine code computing .
For this fixed code , the predicate from [L2] recognizes exactly the coded halting histories of that machine. Therefore, if , there is at least one code with , and every such successful history has halting output , so . If the minimization search never finds a zero or some earlier subcomputation diverges, then the machine has no halting history on , so there is no with .
In the defined case, the least successful history code exists, and step 2.1 gives . In the undefined case, step 2.1 gives the second clause of the statement.
A partial function is partial recursive if and only if it is Turing computable
Statement
Let be a partial function, with inputs and outputs encoded by their canonical binary numerals. Then is partial recursive if and only if is Turing computable under those encodings.
Facts & Assumptions
Given: A partial function .
A machine computes a partial function when it halts with the required encoded output on the domain and diverges off the domain, by Partial functions computed by a machine under fixed encodings.
Partial recursive functions are closed under composition and unbounded minimization and contain the primitive recursive functions, by Unbounded minimization and partial recursive functions.
Every partial recursive function has a normal-form expression for some code , by Kleene normal form for partial recursive functions.
The predicate , its primitive-recursive numeric zero-test , and the function encode halting computation histories and their outputs arithmetically, by Kleene's T-predicate and output function.
Proof
Assume first that is partial recursive. By [L3], choose with whenever is defined. Every primitive-recursive function is Turing computable: the initial functions have immediate machines, machine composition realizes composition, and a finite loop realizes primitive recursion. Hence machines compute the primitive-recursive functions and from [L5]. A machine can therefore search successively through , evaluate , and at the first zero compute and halt with its binary numeral. If there is no successful , the search continues forever. By [L1], this machine computes .
Conversely, assume that is Turing computable. Then by [L1] there is a machine code whose halting computations on input produce exactly the values of . By [L5], the characteristic function of the relation is primitive recursive, so the total search function that returns exactly when holds and otherwise is primitive recursive. By [L2], the partial search is therefore partial recursive, and composing with the primitive recursive output map shows that is partial recursive as well. Its domain and values agree with because exists exactly when the machine coded by has a halting history on , and then [L5] says that is exactly the machine's output. Hence is partial recursive.
Steps 1.1 and 1.2 prove both implications, so is partial recursive if and only if it is Turing computable.
Lambda terms, beta reduction, and the partial functions they represent
Definition
The lambda terms are the finite expressions built from variables by the rules Because they are finite strings over a fixed finite syntax, they admit effective coding.
A beta reduction is one application of the rewrite rule where denotes capture-avoiding substitution: before substituting, bound variables of are alpha-renamed when necessary so that no free variable of becomes bound. Terms that differ only by such a consistent renaming of bound variables are identified up to alpha-equivalence. The relation denotes the reflexive transitive closure of beta reduction modulo alpha-equivalence.
For each , let be the Church numeral for . A lambda term represents a partial function when:
- for every in the domain of ,
- and for every input tuple outside the domain, the term never reaches a Church numeral by beta reduction.
Such a function is called lambda-definable.
Remarks
-
The represented object is a partial function on natural numbers, not the term itself.
-
The chosen convention is extensional: different lambda terms may represent the same partial function.
A partial function is lambda-definable if and only if it is partial recursive
Statement
For a partial function , the following are equivalent:
- is lambda-definable.
- is partial recursive.
Facts & Assumptions
Given: A partial function .
Lambda-definability means representation by a lambda term on Church numerals via beta reduction, by Lambda terms, beta reduction, and the partial functions they represent.
Partial recursive functions are generated from the initial functions by composition, primitive recursion, and minimization, by Unbounded minimization and partial recursive functions.
A partial function on natural numbers is partial recursive exactly when it is Turing computable, by A partial function is partial recursive if and only if it is Turing computable.
Finite tuples of natural numbers have an effective natural-number coding with primitive-recursive length and coordinate readers, by A natural-number coding of finite sequences and The sequence-length and coordinate-reading functions are primitive recursive.
The fixed-arity tuple coder is primitive recursive: binary length and bit extraction are bounded arithmetic operations, appending a block is , and is obtained by primitive recursion from multiplication (Basic arithmetic operations and bounded quantification are primitive recursive).
Proof
Assume is partial recursive. By [L2], it is built from the initial arithmetic functions by composition, primitive recursion, and minimization. The initial functions are represented by the standard lambda terms for zero, successor, and projections; composition is represented by term substitution; primitive recursion is represented by the usual iterator on Church numerals; and minimization is represented by a fixpoint term that performs the unbounded search until a zero-test succeeds. Hence some lambda term represents in the sense of [L1].
Conversely, assume is lambda-definable. By [L1], there is a lambda term such that reaches a Church numeral exactly on the tuples where is defined, and the numeral reached is its value. Given the sequence code of , a Turing machine uses [L4] to recover the coordinates, forms that application, and performs a breadth-first search through all finite beta-reduction sequences, halting when a branch reaches a Church numeral. This computes the unary coded version of , so [L3] makes that coded function partial recursive. Composing with the primitive-recursive tuple coder from [L5] and coordinate readers from [L4] makes the original -ary partial recursive.
Steps 1.1 and 1.2 prove both directions, so lambda-definability and partial recursiveness are equivalent for .
FALSE: every total computable function is primitive recursive
Statement
False claim: every total computable function on a finite power of is primitive recursive.
Facts & Assumptions
Given: The false claim above.
Every total computable function on a finite power of is primitive recursive.
The Ackermann function is total computable but not primitive recursive, by The Ackermann function is total computable but not primitive recursive.
Refutation
By [L1], the Ackermann function is a total computable function on , so it is directly an instance of the universal claim [A1].
The same fact [L1] states that is not primitive recursive. This contradicts [A1].
FALSE: applying mu-minimization to a computable search predicate always yields a total function
Statement
False claim: if is computable, then the minimization is always total.
Facts & Assumptions
Given: The false claim above.
If is computable, then is total.
Unbounded minimization is defined only when some searched value makes the total function equal to , by Unbounded minimization and partial recursive functions.
Refutation
Take the total computable function for all . For this , there is no with for any input .
By [L1], the minimization is therefore undefined for every . In particular it is not total, contradicting [A1].
5 · Examples, counterexamples and false statements
None yet.
Sources
- Jeremy Avigad and Richard Zach, Recursive Functions
- Klaus Sutner, Primitive Recursion
- Klaus Sutner, Coding Functions
- Klaus Sutner, Other Models
- Richard Zach, Computability Theory
- Jeremy Avigad and Richard Zach, Lambda Definability
- A. M. Turing, On Computable Numbers, with an Application to the Entscheidungsproblem