Binary representation of integers using inductive types #
Note: Unlike in Coq, where this representation is preferred because of
the reliance on kernel reduction, in Lean this representation is discouraged
in favor of the "Peano" natural numbers Nat, and the purpose of this
collection of theorems is to show the equivalence of the different approaches.
Instances For
Instances For
Instances For
Addition of two PosNums.
Instances For
The number of bits of a PosNum, as a Nat.
Instances For
Multiplication of two PosNums.
Instances For
@[implicit_reducible, instance 100]
Ordering of PosNums.
Instances For
castPosNum casts a PosNum into any type which has 1 and +.
Instances For
@[implicit_reducible, instance 900]
@[implicit_reducible, instance 900]
bitm1 x appends a 1 to the end of x, mapping x to 2 * x - 1.
Instances For
Subtraction of PosNums, where if a < b, then a - b = 1.
Instances For
Auxiliary definition for PosNum.divMod.
Instances For
divMod x y = (y / x, y % x).
Instances For
Auxiliary definition for Num.gcd.
Instances For
@[implicit_reducible, instance 900]