nat.primrec

The primitive recursive functions .

primcodable

A primcodable type is an encodable type for which the encode/decode functions are primitive recursive.

primrec

primrec f means f is primitive recursive (after encoding its input and output as natural numbers).

primrec₂

primrec₂ f means f is a binary primitive recursive function. This is technically unnecessary since we can always curry all the arguments together, but there are enough natural two-arg functions that it is convenient to express this directly.

primrec_pred

primrec_pred p means p : α Prop is a (decidable) primitive recursive predicate, which is to say that to_bool ∘ p : α bool is primitive recursive.

primrec_rel

primrec_rel p means p : α β Prop is a (decidable) primitive recursive relation, which is to say that to_bool ∘ p : α β bool is primitive recursive.

nat.primrec'

An alternative inductive definition of primrec which does not use the pairing function on ℕ, and so has to work with n-ary functions on ℕ instead of unary functions. We prove that this is equivalent to the regular notion in to_prim and of_prim.