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.
@[inline]
def
Nat.bitCasesOn
{motive : Nat → Sort u}
(n : Nat)
(bit : (b : Bool) → (n : Nat) → motive (bit b n))
:
motive n
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 any given natural number.
Equations
Instances For
@[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.
Equations
Instances For
@[specialize #[]]
def
Nat.binaryRec'
{motive : Nat → Sort u}
(zero : motive 0)
(bit : (b : Bool) → (n : Nat) → (n = 0 → b = true) → motive n → motive (bit b n))
(n : Nat)
:
motive n
The same as binaryRec, but the induction step can assume that if n=0,
the bit being appended is true