Primitive recursion constructs a function from a base function and a step function . Let and be total functions with types
Write for the unchanged parameters. The function is uniquely specified by:
Base: initialise the result
The base function supplies the result at index .
Step: use the previous result
The step function receives the previous index , previous result , and unchanged parameters . Here, abbreviates .
For fixed , let . The graph shows each result feeding the next application of ; the parameters stay unchanged:
Computing requires the base case followed by applications of . Since and are total, is total. For , there are no unchanged parameters and supplies a fixed initial value.
The output of is exactly one larger than the output of at that input. Therefore, . Since equal functions must agree on every input, . This holds for every , so is not primitive-recursive.
Not all total computable functions are primitive-recursive