Set-level recursion on the natural numbers #
ZFNat.rec and ZFNat.rec_unique state the universal property of the naturals at the type
level: the motive is a Lean family and the recursor is a Lean definition. This file states the
same property inside the model: Nat is a ZFSet, arrows are elements of funs, the
successor is the set-level function succFun, and composition is ZFSet.composition.
The main result is funs_nat_recursion: for x ∈ X and a step function s ∈ X.funs X there
is a unique h ∈ Nat.funs X with h ∅ = x and h ∘ᶻ succFun = s ∘ᶻ h. In categorical terms,
(Nat, ∅, succFun) is a natural numbers object in the category of ZFSets and funs.
The successor as a set-level function #
The successor function Nat → Nat, as an element of Nat.funs Nat.
Equations
- ZFSet.succFun = ZFSet.Nat.lambda ZFSet.Nat fun (a : ZFSet.{?u.1}) => insert a a
Instances For
The iterate of a step function #
The n-th iterate of s applied to x, at the type level. This is ZFNat.rec with the
constant motive {y // y ∈ X}; recFun is its transport into the model.
Equations
- ZFSet.recVal x s hx hs n = ZFSet.ZFNat.rec n ⟨x, hx⟩ fun (x : ZFSet.ZFNat) (ih : ↥X) => @ᶻs ⋯ ⟨↑ih, ⋯⟩
Instances For
The recursor as a set #
The set-level recursor: the element of Nat.funs X sending n to sⁿ x.
Equations
- ZFSet.recFun x s hx hs = ZFSet.Nat.lambda X fun (a : ZFSet.{?u.1}) => if hn : a ∈ ZFSet.Nat then ↑(ZFSet.recVal x s hx hs ⟨a, hn⟩) else ∅
Instances For
recFun as a partial function, so that fapply can be applied to it without re-running the
zpfun search on the (large) body of recFun.
The universal property #
recFun sends ∅ — the set-level zero — to x.
recFun satisfies the recursion equation h ∘ᶻ succFun = s ∘ᶻ h.
Uniqueness: any h : Nat → X with h ∅ = x and h ∘ᶻ succFun = s ∘ᶻ h is recFun x s.
The proof is ZFNat.rec_unique — the typed uniqueness lemma — applied to the family
fun k ↦ h k, so the set-level statement is discharged by the type-level one.
Set-level recursion theorem for the naturals. For x ∈ X and a step function
s ∈ X.funs X there is a unique h ∈ Nat.funs X with h ∅ = x and
h ∘ᶻ succFun = s ∘ᶻ h; the witness is recFun x s.
Equivalently: (Nat, ∅, succFun) is a natural numbers object for ZFSets and funs.