File: Mathlib/Data/Num/Basic.lean

full_name: PosNum.bit0
code: /-- The type of positive binary numbers.

     13 = 1101(base 2) = bit1 (bit0 (bit1 one)) -/
inductive PosNum : Type
  | one : PosNum
  | bit1 : PosNum → PosNum
  | bit0 : PosNum → PosNum
  deriving DecidableEq
goal: PosNum → PosNum

full_name: PosNum.one
code: /-- The type of positive binary numbers.

     13 = 1101(base 2) = bit1 (bit0 (bit1 one)) -/
inductive PosNum : Type
  | one : PosNum
  | bit1 : PosNum → PosNum
  | bit0 : PosNum → PosNum
  deriving DecidableEq
goal: PosNum

full_name: PosNum
code: /-- The type of positive binary numbers.

     13 = 1101(base 2) = bit1 (bit0 (bit1 one)) -/
inductive PosNum : Type
  | one : PosNum
  | bit1 : PosNum → PosNum
  | bit0 : PosNum → PosNum
  deriving DecidableEq
goal: Type

full_name: PosNum.bit1
code: /-- The type of positive binary numbers.

     13 = 1101(base 2) = bit1 (bit0 (bit1 one)) -/
inductive PosNum : Type
  | one : PosNum
  | bit1 : PosNum → PosNum
  | bit0 : PosNum → PosNum
  deriving DecidableEq
goal: PosNum → PosNum

full_name: instOnePosNum
code: instance : One PosNum 
goal: One PosNum

full_name: instInhabitedPosNum
code: instance : Inhabited PosNum 
goal: Inhabited PosNum

full_name: Num
code: /-- The type of nonnegative binary numbers, using `PosNum`.

     13 = 1101(base 2) = pos (bit1 (bit0 (bit1 one))) -/
inductive Num : Type
  | zero : Num
  | pos : PosNum → Num
  deriving DecidableEq
goal: Type

full_name: Num.zero
code: /-- The type of nonnegative binary numbers, using `PosNum`.

     13 = 1101(base 2) = pos (bit1 (bit0 (bit1 one))) -/
inductive Num : Type
  | zero : Num
  | pos : PosNum → Num
  deriving DecidableEq
goal: Num

full_name: Num.pos
code: /-- The type of nonnegative binary numbers, using `PosNum`.

     13 = 1101(base 2) = pos (bit1 (bit0 (bit1 one))) -/
inductive Num : Type
  | zero : Num
  | pos : PosNum → Num
  deriving DecidableEq
goal: PosNum → Num

full_name: instZeroNum
code: instance : Zero Num 
goal: Zero Num

full_name: instOneNum
code: instance : One Num 
goal: One Num

full_name: instInhabitedNum
code: instance : Inhabited Num 
goal: Inhabited Num

full_name: ZNum
code: /-- Representation of integers using trichotomy around zero.

     13 = 1101(base 2) = pos (bit1 (bit0 (bit1 one)))
     -13 = -1101(base 2) = neg (bit1 (bit0 (bit1 one))) -/
inductive ZNum : Type
  | zero : ZNum
  | pos : PosNum → ZNum
  | neg : PosNum → ZNum
  deriving DecidableEq
goal: Type

full_name: ZNum.neg
code: /-- Representation of integers using trichotomy around zero.

     13 = 1101(base 2) = pos (bit1 (bit0 (bit1 one)))
     -13 = -1101(base 2) = neg (bit1 (bit0 (bit1 one))) -/
inductive ZNum : Type
  | zero : ZNum
  | pos : PosNum → ZNum
  | neg : PosNum → ZNum
  deriving DecidableEq
goal: PosNum → ZNum

full_name: ZNum.pos
code: /-- Representation of integers using trichotomy around zero.

     13 = 1101(base 2) = pos (bit1 (bit0 (bit1 one)))
     -13 = -1101(base 2) = neg (bit1 (bit0 (bit1 one))) -/
inductive ZNum : Type
  | zero : ZNum
  | pos : PosNum → ZNum
  | neg : PosNum → ZNum
  deriving DecidableEq
goal: PosNum → ZNum

full_name: ZNum.zero
code: /-- Representation of integers using trichotomy around zero.

     13 = 1101(base 2) = pos (bit1 (bit0 (bit1 one)))
     -13 = -1101(base 2) = neg (bit1 (bit0 (bit1 one))) -/
inductive ZNum : Type
  | zero : ZNum
  | pos : PosNum → ZNum
  | neg : PosNum → ZNum
  deriving DecidableEq
goal: ZNum

full_name: instZeroZNum
code: instance : Zero ZNum 
goal: Zero ZNum

full_name: instOneZNum
code: instance : One ZNum 
goal: One ZNum

full_name: instInhabitedZNum
code: instance : Inhabited ZNum 
goal: Inhabited ZNum

full_name: PosNum.bit
code: /-- `bit b n` appends the bit `b` to the end of `n`, where `bit tt x = x1` and `bit ff x = x0`. -/
def bit (b : Bool) : PosNum → PosNum 
goal: PosNum → PosNum

full_name: PosNum.succ
code: /-- The successor of a `PosNum`. -/
def succ : PosNum → PosNum
  
goal: PosNum → PosNum

full_name: PosNum.isOne
code: /-- Returns a boolean for whether the `PosNum` is `one`. -/
def isOne : PosNum → Bool
  
goal: PosNum → Bool

full_name: PosNum.add
code: /-- Addition of two `PosNum`s. -/
protected def add : PosNum → PosNum → PosNum
  
goal: PosNum → PosNum → PosNum

full_name: PosNum.instAdd
code: instance : Add PosNum 
goal: Add PosNum

full_name: PosNum.pred'
code: /-- The predecessor of a `PosNum` as a `Num`. -/
def pred' : PosNum → Num
  
goal: PosNum → Num

full_name: PosNum.pred
code: /-- The predecessor of a `PosNum` as a `PosNum`. This means that `pred 1 = 1`. -/
def pred (a : PosNum) : PosNum 
goal: PosNum

full_name: PosNum.size
code: /-- The number of bits of a `PosNum`, as a `PosNum`. -/
def size : PosNum → PosNum
  
goal: PosNum → PosNum

full_name: PosNum.natSize
code: /-- The number of bits of a `PosNum`, as a `Nat`. -/
def natSize : PosNum → Nat
  
goal: PosNum → ℕ

full_name: PosNum.mul
code: /-- Multiplication of two `PosNum`s. -/
protected def mul (a : PosNum) : PosNum → PosNum
  
goal: PosNum → PosNum

full_name: PosNum.instMul
code: instance : Mul PosNum 
goal: Mul PosNum

full_name: PosNum.ofNatSucc
code: /-- `ofNatSucc n` is the `PosNum` corresponding to `n + 1`. -/
def ofNatSucc : ℕ → PosNum
  
goal: ℕ → PosNum

full_name: PosNum.ofNat
code: /-- `ofNat n` is the `PosNum` corresponding to `n`, except for `ofNat 0 = 1`. -/
def ofNat (n : ℕ) : PosNum 
goal: PosNum

full_name: PosNum.instOfNatHAddNatOfNat
code: instance {n : ℕ} : OfNat PosNum (n + 1) 
goal: OfNat PosNum (n + 1)

full_name: PosNum.cmp
code: /-- Ordering of `PosNum`s. -/
def cmp : PosNum → PosNum → Ordering
  
goal: PosNum → PosNum → Ordering

full_name: PosNum.instLT
code: instance : LT PosNum 
goal: LT PosNum

full_name: PosNum.instLE
code: instance : LE PosNum 
goal: LE PosNum

full_name: PosNum.decidableLT
code: instance decidableLT : @DecidableRel PosNum (· < ·)
  
goal: DecidableRel fun x x_1 => x < x_1

full_name: PosNum.decidableLE
code: instance decidableLE : @DecidableRel PosNum (· ≤ ·)
  
goal: DecidableRel fun x x_1 => x ≤ x_1

full_name: castPosNum
code: /-- `castPosNum` casts a `PosNum` into any type which has `1` and `+`. -/
@[deprecated (since := "2022-11-18"), coe]
def castPosNum : PosNum → α
  
goal: PosNum → α

full_name: castNum
code: /-- `castNum` casts a `Num` into any type which has `0`, `1` and `+`. -/
@[deprecated (since := "2022-11-18"), coe]
def castNum [Zero α] : Num → α
  
goal: Num → α

full_name: posNumCoe
code: @[deprecated (since := "2023-03-31")] instance (priority := 900) posNumCoe : CoeHTCT PosNum α 
goal: CoeHTCT PosNum α

full_name: numNatCoe
code: @[deprecated (since := "2023-03-31")]
instance (priority := 900) numNatCoe [Zero α] : CoeHTCT Num α 
goal: CoeHTCT Num α

full_name: instReprPosNum
code: instance : Repr PosNum 
goal: Repr PosNum

full_name: instReprNum
code: instance : Repr Num 
goal: Repr Num

full_name: Num.succ'
code: /-- The successor of a `Num` as a `PosNum`. -/
def succ' : Num → PosNum
  
goal: Num → PosNum

full_name: Num.succ
code: /-- The successor of a `Num` as a `Num`. -/
def succ (n : Num) : Num 
goal: Num

full_name: Num.add
code: /-- Addition of two `Num`s. -/
protected def add : Num → Num → Num
  
goal: Num → Num → Num

full_name: Num.instAdd
code: instance : Add Num 
goal: Add Num

full_name: Num.bit0
code: /-- `bit0 n` appends a `0` to the end of `n`, where `bit0 n = n0`. -/
protected def bit0 : Num → Num
  
goal: Num → Num

full_name: Num.bit1
code: /-- `bit1 n` appends a `1` to the end of `n`, where `bit1 n = n1`. -/
protected def bit1 : Num → Num
  
goal: Num → Num

full_name: Num.bit
code: /-- `bit b n` appends the bit `b` to the end of `n`, where `bit tt x = x1` and `bit ff x = x0`. -/
def bit (b : Bool) : Num → Num 
goal: Num → Num

full_name: Num.size
code: /-- The number of bits required to represent a `Num`, as a `Num`. `size 0` is defined to be `0`. -/
def size : Num → Num
  
goal: Num → Num

full_name: Num.natSize
code: /-- The number of bits required to represent a `Num`, as a `Nat`. `size 0` is defined to be `0`. -/
def natSize : Num → Nat
  
goal: Num → ℕ

full_name: Num.mul
code: /-- Multiplication of two `Num`s. -/
protected def mul : Num → Num → Num
  
goal: Num → Num → Num

full_name: Num.instMul
code: instance : Mul Num 
goal: Mul Num

full_name: Num.cmp
code: /-- Ordering of `Num`s. -/
def cmp : Num → Num → Ordering
  
goal: Num → Num → Ordering

full_name: Num.instLT
code: instance : LT Num 
goal: LT Num

full_name: Num.instLE
code: instance : LE Num 
goal: LE Num

full_name: Num.decidableLT
code: instance decidableLT : @DecidableRel Num (· < ·)
  
goal: DecidableRel fun x x_1 => x < x_1

full_name: Num.decidableLE
code: instance decidableLE : @DecidableRel Num (· ≤ ·)
  
goal: DecidableRel fun x x_1 => x ≤ x_1

full_name: Num.toZNum
code: /-- Converts a `Num` to a `ZNum`. -/
def toZNum : Num → ZNum
  
goal: Num → ZNum

full_name: Num.toZNumNeg
code: /-- Converts `x : Num` to `-x : ZNum`. -/
def toZNumNeg : Num → ZNum
  
goal: Num → ZNum

full_name: Num.ofNat'
code: /-- Converts a `Nat` to a `Num`. -/
def ofNat' : ℕ → Num 
goal: ℕ → Num

full_name: ZNum.zNeg
code: /-- The negation of a `ZNum`. -/
def zNeg : ZNum → ZNum
  
goal: ZNum → ZNum

full_name: ZNum.instNeg
code: instance : Neg ZNum 
goal: Neg ZNum

full_name: ZNum.abs
code: /-- The absolute value of a `ZNum` as a `Num`. -/
def abs : ZNum → Num
  
goal: ZNum → Num

full_name: ZNum.succ
code: /-- The successor of a `ZNum`. -/
def succ : ZNum → ZNum
  
goal: ZNum → ZNum

full_name: ZNum.pred
code: /-- The predecessor of a `ZNum`. -/
def pred : ZNum → ZNum
  
goal: ZNum → ZNum

full_name: ZNum.bit0
code: /-- `bit0 n` appends a `0` to the end of `n`, where `bit0 n = n0`. -/
protected def bit0 : ZNum → ZNum
  
goal: ZNum → ZNum

full_name: ZNum.bit1
code: /-- `bit1 x` appends a `1` to the end of `x`, mapping `x` to `2 * x + 1`. -/
protected def bit1 : ZNum → ZNum
  
goal: ZNum → ZNum

full_name: ZNum.bitm1
code: /-- `bitm1 x` appends a `1` to the end of `x`, mapping `x` to `2 * x - 1`. -/
protected def bitm1 : ZNum → ZNum
  
goal: ZNum → ZNum

full_name: ZNum.ofInt'
code: /-- Converts an `Int` to a `ZNum`. -/
def ofInt' : ℤ → ZNum
  
goal: ℤ → ZNum

full_name: PosNum.sub'
code: /-- Subtraction of two `PosNum`s, producing a `ZNum`. -/
def sub' : PosNum → PosNum → ZNum
  
goal: PosNum → PosNum → ZNum

full_name: PosNum.ofZNum'
code: /-- Converts a `ZNum` to `Option PosNum`, where it is `some` if the `ZNum` was positive and `none`
  otherwise. -/
def ofZNum' : ZNum → Option PosNum
  
goal: ZNum → Option PosNum

full_name: PosNum.ofZNum
code: /-- Converts a `ZNum` to a `PosNum`, mapping all out of range values to `1`. -/
def ofZNum : ZNum → PosNum
  
goal: ZNum → PosNum

full_name: PosNum.sub
code: /-- Subtraction of `PosNum`s, where if `a < b`, then `a - b = 1`. -/
protected def sub (a b : PosNum) : PosNum 
goal: PosNum

full_name: PosNum.instSub
code: instance : Sub PosNum 
goal: Sub PosNum

full_name: Num.ppred
code: /-- The predecessor of a `Num` as an `Option Num`, where `ppred 0 = none` -/
def ppred : Num → Option Num
  
goal: Num → Option Num

full_name: Num.pred
code: /-- The predecessor of a `Num` as a `Num`, where `pred 0 = 0`. -/
def pred : Num → Num
  
goal: Num → Num

full_name: Num.div2
code: /-- Divides a `Num` by `2` -/
def div2 : Num → Num
  
goal: Num → Num

full_name: Num.ofZNum'
code: /-- Converts a `ZNum` to an `Option Num`, where `ofZNum' p = none` if `p < 0`. -/
def ofZNum' : ZNum → Option Num
  
goal: ZNum → Option Num

full_name: Num.ofZNum
code: /-- Converts a `ZNum` to an `Option Num`, where `ofZNum p = 0` if `p < 0`. -/
def ofZNum : ZNum → Num
  
goal: ZNum → Num

full_name: Num.sub'
code: /-- Subtraction of two `Num`s, producing a `ZNum`. -/
def sub' : Num → Num → ZNum
  
goal: Num → Num → ZNum

full_name: Num.psub
code: /-- Subtraction of two `Num`s, producing an `Option Num`. -/
def psub (a b : Num) : Option Num 
goal: Option Num

full_name: Num.sub
code: /-- Subtraction of two `Num`s, where if `a < b`, `a - b = 0`. -/
protected def sub (a b : Num) : Num 
goal: Num

full_name: Num.instSub
code: instance : Sub Num 
goal: Sub Num

full_name: ZNum.add
code: /-- Addition of `ZNum`s. -/
protected def add : ZNum → ZNum → ZNum
  
goal: ZNum → ZNum → ZNum

full_name: ZNum.instAdd
code: instance : Add ZNum 
goal: Add ZNum

full_name: ZNum.mul
code: /-- Multiplication of `ZNum`s. -/
protected def mul : ZNum → ZNum → ZNum
  
goal: ZNum → ZNum → ZNum

full_name: ZNum.instMul
code: instance : Mul ZNum 
goal: Mul ZNum

full_name: ZNum.cmp
code: /-- Ordering on `ZNum`s. -/
def cmp : ZNum → ZNum → Ordering
  
goal: ZNum → ZNum → Ordering

full_name: ZNum.instLT
code: instance : LT ZNum 
goal: LT ZNum

full_name: ZNum.instLE
code: instance : LE ZNum 
goal: LE ZNum

full_name: ZNum.decidableLT
code: instance decidableLT : @DecidableRel ZNum (· < ·)
  
goal: DecidableRel fun x x_1 => x < x_1

full_name: ZNum.decidableLE
code: instance decidableLE : @DecidableRel ZNum (· ≤ ·)
  
goal: DecidableRel fun x x_1 => x ≤ x_1

full_name: PosNum.divModAux
code: /-- Auxiliary definition for `PosNum.divMod`. -/
def divModAux (d : PosNum) (q r : Num) : Num × Num 
goal: Num × Num

full_name: PosNum.divMod
code: /-- `divMod x y = (y / x, y % x)`. -/
def divMod (d : PosNum) : PosNum → Num × Num
  
goal: PosNum → Num × Num

full_name: PosNum.div'
code: /-- Division of `PosNum`, -/
def div' (n d : PosNum) : Num 
goal: Num

full_name: PosNum.mod'
code: /-- Modulus of `PosNum`s. -/
def mod' (n d : PosNum) : Num 
goal: Num

full_name: _private.Mathlib.Data.Num.Basic.0.PosNum.sqrtAux1
code: /-- Auxiliary definition for `sqrtAux`. -/
private def sqrtAux1 (b : PosNum) (r n : Num) : Num × Num 
goal: Num × Num

full_name: _private.Mathlib.Data.Num.Basic.0.PosNum.sqrtAux
code: /-- Auxiliary definition for a `sqrt` function which is not currently implemented. -/
private def sqrtAux : PosNum → Num → Num → Num
  
goal: PosNum → Num → Num → Num

full_name: Num.div
code: /-- Division of `Num`s, where `x / 0 = 0`. -/
def div : Num → Num → Num
  
goal: Num → Num → Num

full_name: Num.mod
code: /-- Modulus of `Num`s. -/
def mod : Num → Num → Num
  
goal: Num → Num → Num

full_name: Num.instDiv
code: instance : Div Num 
goal: Div Num

full_name: Num.instMod
code: instance : Mod Num 
goal: Mod Num

full_name: Num.gcdAux
code: /-- Auxiliary definition for `Num.gcd`. -/
def gcdAux : Nat → Num → Num → Num
  
goal: ℕ → Num → Num → Num

full_name: Num.gcd
code: /-- Greatest Common Divisor (GCD) of two `Num`s. -/
def gcd (a b : Num) : Num 
goal: Num

full_name: ZNum.div
code: /-- Division of `ZNum`, where `x / 0 = 0`. -/
def div : ZNum → ZNum → ZNum
  
goal: ZNum → ZNum → ZNum

full_name: ZNum.mod
code: /-- Modulus of `ZNum`s. -/
def mod : ZNum → ZNum → ZNum
  
goal: ZNum → ZNum → ZNum

full_name: ZNum.instDiv
code: instance : Div ZNum 
goal: Div ZNum

full_name: ZNum.instMod
code: instance : Mod ZNum 
goal: Mod ZNum

full_name: ZNum.gcd
code: /-- Greatest Common Divisor (GCD) of two `ZNum`s. -/
def gcd (a b : ZNum) : Num 
goal: Num

full_name: castZNum
code: /-- `castZNum` casts a `ZNum` into any type which has `0`, `1`, `+` and `neg` -/
@[deprecated (since := "2022-11-18"), coe]
def castZNum : ZNum → α
  
goal: ZNum → α

full_name: znumCoe
code: @[deprecated (since := "2023-03-31")] instance (priority := 900) znumCoe : CoeHTCT ZNum α 
goal: CoeHTCT ZNum α

full_name: instReprZNum
code: instance : Repr ZNum 
goal: Repr ZNum