Binary recursion on Nat #
This file defines binary recursion on Nat.
Main results #
Nat.binaryRec: A recursion principle forbitrepresentations of natural numbers.Nat.binaryRec': The same asbinaryRec, but the induction step can assume that ifn=0, the bit being appended istrue.Nat.binaryRecFromOne: The same asbinaryRec, but special casing both 0 and 1 as base cases.
@[specialize #[]]
def Nat.binaryRec {motive : Nat → Sort u} (zero : motive 0) (bit : (b : Bool) → (n : Nat) → motive n → motive (bit b n)) (n : Nat) :
motive n
A recursion principle for bit representations of natural numbers.
For a predicate motive : Nat → Sort u, if instances can be
constructed for natural numbers of the form bit b n,
they can be constructed for all natural numbers.