File: .lake/packages/lean4/src/lean/Init/Data/Int/Basic.lean

full_name: Int.negSucc
code: /--
The type of integers. It is defined as an inductive type based on the
natural number type `Nat` featuring two constructors: "a natural
number is an integer", and "the negation of a successor of a natural
number is an integer". The former represents integers between `0`
(inclusive) and `∞`, and the latter integers between `-∞` and `-1`
(inclusive).

This type is special-cased by the compiler. The runtime has a special
representation for `Int` which stores "small" signed numbers directly,
and larger numbers use an arbitrary precision "bignum" library
(usually [GMP](https://gmplib.org/)). A "small number" is an integer
that can be encoded with 63 bits (31 bits on 32-bits architectures).
-/
inductive Int : Type where
  /-- A natural number is an integer (`0` to `∞`). -/
  | ofNat   : Nat → Int
  /-- The negation of the successor of a natural number is an integer
    (`-1` to `-∞`). -/
  | negSucc : Nat → Int
goal: Nat → Int

full_name: Int
code: /--
The type of integers. It is defined as an inductive type based on the
natural number type `Nat` featuring two constructors: "a natural
number is an integer", and "the negation of a successor of a natural
number is an integer". The former represents integers between `0`
(inclusive) and `∞`, and the latter integers between `-∞` and `-1`
(inclusive).

This type is special-cased by the compiler. The runtime has a special
representation for `Int` which stores "small" signed numbers directly,
and larger numbers use an arbitrary precision "bignum" library
(usually [GMP](https://gmplib.org/)). A "small number" is an integer
that can be encoded with 63 bits (31 bits on 32-bits architectures).
-/
inductive Int : Type where
  /-- A natural number is an integer (`0` to `∞`). -/
  | ofNat   : Nat → Int
  /-- The negation of the successor of a natural number is an integer
    (`-1` to `-∞`). -/
  | negSucc : Nat → Int
goal: Type

full_name: Int.ofNat
code: /--
The type of integers. It is defined as an inductive type based on the
natural number type `Nat` featuring two constructors: "a natural
number is an integer", and "the negation of a successor of a natural
number is an integer". The former represents integers between `0`
(inclusive) and `∞`, and the latter integers between `-∞` and `-1`
(inclusive).

This type is special-cased by the compiler. The runtime has a special
representation for `Int` which stores "small" signed numbers directly,
and larger numbers use an arbitrary precision "bignum" library
(usually [GMP](https://gmplib.org/)). A "small number" is an integer
that can be encoded with 63 bits (31 bits on 32-bits architectures).
-/
inductive Int : Type where
  /-- A natural number is an integer (`0` to `∞`). -/
  | ofNat   : Nat → Int
  /-- The negation of the successor of a natural number is an integer
    (`-1` to `-∞`). -/
  | negSucc : Nat → Int
goal: Nat → Int

full_name: instNatCastInt
code: instance : NatCast Int 
goal: NatCast Int

full_name: instOfNat
code: instance instOfNat : OfNat Int n 
goal: OfNat Int n

full_name: Int.«_aux_.lake_packages_lean4_src_lean_Init_Data_Int_Basic___unexpand_Int_negSucc_1»
code: /--
`-[n+1]` is suggestive notation for `negSucc n`, which is the second constructor of
`Int` for making strictly negative numbers by mapping `n : Nat` to `-(n + 1)`.
-/
scoped notation "-[" n "+1]" => negSucc n
goal: Lean.PrettyPrinter.Unexpander

full_name: Int.«_aux_.lake_packages_lean4_src_lean_Init_Data_Int_Basic___macroRules_Int_term-[_+1]_1»
code: /--
`-[n+1]` is suggestive notation for `negSucc n`, which is the second constructor of
`Int` for making strictly negative numbers by mapping `n : Nat` to `-(n + 1)`.
-/
scoped notation "-[" n "+1]" => negSucc n
goal: Lean.Macro

full_name: Int.instInhabited
code: instance : Inhabited Int 
goal: Inhabited Int

full_name: Int.default_eq_zero
code: @[simp] theorem default_eq_zero : default = (0 : Int) 
goal: default = 0

full_name: Int.zero_ne_one
code: protected theorem zero_ne_one : (0 : Int) ≠ 1 
goal: 0 ≠ 1

full_name: Int.ofNat_eq_coe
code: @[simp] theorem ofNat_eq_coe : Int.ofNat n = Nat.cast n 
goal: Int.ofNat n = ↑n

full_name: Int.ofNat_zero
code: @[simp] theorem ofNat_zero : ((0 : Nat) : Int) = 0 
goal: ↑0 = 0

full_name: Int.ofNat_one
code: @[simp] theorem ofNat_one  : ((1 : Nat) : Int) = 1 
goal: ↑1 = 1

full_name: Int.ofNat_two
code: theorem ofNat_two : ((2 : Nat) : Int) = 2 
goal: ↑2 = 2

full_name: Int.negOfNat
code: /-- Negation of a natural number. -/
def negOfNat : Nat → Int
  
goal: Nat → Int

full_name: Int.neg
code: /-- Negation of an integer.

  Implemented by efficient native code. -/
@[extern "lean_int_neg"]
protected def neg (n : @& Int) : Int 
goal: Int

full_name: Int.instNegInt
code: @[default_instance mid]
instance instNegInt : Neg Int 
goal: Neg Int

full_name: Int.subNatNat
code: /-- Subtraction of two natural numbers. -/
def subNatNat (m n : Nat) : Int 
goal: Int

full_name: Int.add
code: /-- Addition of two integers.

  ```
  #eval (7 : Int) + (6 : Int) -- 13
  #eval (6 : Int) + (-6 : Int) -- 0
  ```

  Implemented by efficient native code. -/
@[extern "lean_int_add"]
protected def add (m n : @& Int) : Int 
goal: Int

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

full_name: Int.mul
code: /-- Multiplication of two integers.

  ```
  #eval (63 : Int) * (6 : Int) -- 378
  #eval (6 : Int) * (-6 : Int) -- -36
  #eval (7 : Int) * (0 : Int) -- 0
  ```

  Implemented by efficient native code. -/
@[extern "lean_int_mul"]
protected def mul (m n : @& Int) : Int 
goal: Int

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

full_name: Int.sub
code: /-- Subtraction of two integers.

  ```
  #eval (63 : Int) - (6 : Int) -- 57
  #eval (7 : Int) - (0 : Int) -- 7
  #eval (0 : Int) - (7 : Int) -- -7
  ```

  Implemented by efficient native code. -/
@[extern "lean_int_sub"]
protected def sub (m n : @& Int) : Int 
goal: Int

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

full_name: Int.NonNeg
code: /-- A proof that an `Int` is non-negative. -/
inductive NonNeg : Int → Prop where
  /-- Sole constructor, proving that `ofNat n` is positive. -/
  | mk (n : Nat) : NonNeg (ofNat n)
goal: Int → Prop

full_name: Int.NonNeg.mk
code: /-- A proof that an `Int` is non-negative. -/
inductive NonNeg : Int → Prop where
  /-- Sole constructor, proving that `ofNat n` is positive. -/
  | mk (n : Nat) : NonNeg (ofNat n)
goal: (Int.ofNat n).NonNeg

full_name: Int.le
code: /-- Definition of `a ≤ b`, encoded as `b - a ≥ 0`. -/
protected def le (a b : Int) : Prop 
goal: Prop

full_name: Int.instLEInt
code: instance instLEInt : LE Int 
goal: LE Int

full_name: Int.lt
code: /-- Definition of `a < b`, encoded as `a + 1 ≤ b`. -/
protected def lt (a b : Int) : Prop 
goal: Prop

full_name: Int.instLTInt
code: instance instLTInt : LT Int 
goal: LT Int

full_name: Int.decEq
code: /-- Decides equality between two `Int`s.

  ```
  #eval (7 : Int) = (3 : Int) + (4 : Int) -- true
  #eval (6 : Int) = (3 : Int) * (2 : Int) -- true
  #eval ¬ (6 : Int) = (3 : Int) -- true
  ```

  Implemented by efficient native code. -/
@[extern "lean_int_dec_eq"]
protected def decEq (a b : @& Int) : Decidable (a = b) 
goal: Decidable (a = b)

full_name: Int.instDecidableEq
code: instance : DecidableEq Int 
goal: DecidableEq Int

full_name: _private.«.lake».packages.lean4.src.lean.Init.Data.Int.Basic.0.Int.decNonneg
code: /-- Decides whether an integer is negative.

  ```
  #eval (7 : Int).decNonneg.decide -- true
  #eval (0 : Int).decNonneg.decide -- true
  #eval ¬ (-7 : Int).decNonneg.decide -- true
  ```

  Implemented by efficient native code. -/
@[extern "lean_int_dec_nonneg"]
private def decNonneg (m : @& Int) : Decidable (NonNeg m) 
goal: Decidable m.NonNeg

full_name: Int.decLe
code: /-- Decides whether `a ≤ b`.

  ```
  #eval ¬ ( (7 : Int) ≤ (0 : Int) ) -- true
  #eval (0 : Int) ≤ (0 : Int) -- true
  #eval (7 : Int) ≤ (10 : Int) -- true
  ```

  Implemented by efficient native code. -/
@[extern "lean_int_dec_le"]
instance decLe (a b : @& Int) : Decidable (a ≤ b) 
goal: Decidable (a ≤ b)

full_name: Int.decLt
code: /-- Decides whether `a < b`.

  ```
  #eval `¬ ( (7 : Int) < 0 )` -- true
  #eval `¬ ( (0 : Int) < 0 )` -- true
  #eval `(7 : Int) < 10` -- true
  ```

  Implemented by efficient native code. -/
@[extern "lean_int_dec_lt"]
instance decLt (a b : @& Int) : Decidable (a < b) 
goal: Decidable (a < b)

full_name: Int.natAbs
code: /-- Absolute value (`Nat`) of an integer.

  ```
  #eval (7 : Int).natAbs -- 7
  #eval (0 : Int).natAbs -- 0
  #eval (-11 : Int).natAbs -- 11
  ```

  Implemented by efficient native code. -/
@[extern "lean_nat_abs"]
def natAbs (m : @& Int) : Nat 
goal: Nat

full_name: Int.sign
code: /--
Returns the "sign" of the integer as another integer: `1` for positive numbers,
`-1` for negative numbers, and `0` for `0`.
-/
def sign : Int → Int
  
goal: Int → Int

full_name: Int.toNat
code: /-- Turns an integer into a natural number, negative numbers become
  `0`.

  ```
  #eval (7 : Int).toNat -- 7
  #eval (0 : Int).toNat -- 0
  #eval (-7 : Int).toNat -- 0
  ```
-/
def toNat : Int → Nat
  
goal: Int → Nat

full_name: Int.toNat'
code: /--
* If `n : Nat`, then `int.toNat' n = some n`
* If `n : Int` is negative, then `int.toNat' n = none`.
-/
def toNat' : Int → Option Nat
  
goal: Int → Option Nat

full_name: Int.instDvd
code: /--
Divisibility of integers. `a ∣ b` (typed as `\|`) says that
there is some `c` such that `b = a * c`.
-/
instance : Dvd Int 
goal: Dvd Int

full_name: Int.pow
code: /-- Power of an integer to some natural number.

  ```
  #eval (2 : Int) ^ 4 -- 16
  #eval (10 : Int) ^ 0 -- 1
  #eval (0 : Int) ^ 10 -- 0
  #eval (-7 : Int) ^ 3 -- -343
  ```
-/
protected def pow (m : Int) : Nat → Int
  
goal: Nat → Int

full_name: Int.instHPowNat
code: instance : HPow Int Nat Int 
goal: HPow Int Nat Int

full_name: Int.instLawfulBEq
code: instance : LawfulBEq Int 
goal: LawfulBEq Int

full_name: Int.instMin
code: instance : Min Int 
goal: Min Int

full_name: Int.instMax
code: instance : Max Int 
goal: Max Int

full_name: IntCast
code: /--
The canonical homomorphism `Int → R`.
In most use cases `R` will have a ring structure and this will be a ring homomorphism.
-/
class IntCast (R : Type u) where
  /-- The canonical map `Int → R`. -/
  protected intCast : Int → R
goal: Type u

full_name: IntCast.intCast
code: /--
The canonical homomorphism `Int → R`.
In most use cases `R` will have a ring structure and this will be a ring homomorphism.
-/
class IntCast (R : Type u) where
  /-- The canonical map `Int → R`. -/
  protected intCast : Int → R
goal: Int → R

full_name: instIntCastInt
code: instance : IntCast Int 
goal: IntCast Int

full_name: Int.cast
code: /--
Apply the canonical homomorphism from `Int` to a type `R` from an `IntCast R` instance.

In Mathlib there will be such a homomorphism whenever `R` is an additive group with a `1`.
-/
@[coe, reducible, match_pattern] protected def Int.cast {R : Type u} [IntCast R] : Int → R 
goal: Int → R

full_name: instCoeTailIntOfIntCast
code: instance [IntCast R] : CoeTail Int R 
goal: CoeTail Int R

full_name: instCoeHTCTIntOfIntCast
code: instance [IntCast R] : CoeHTCT Int R 
goal: CoeHTCT Int R