File: .lake/packages/lean4/src/lean/Init/Data/Nat/Div.lean

full_name: Nat.«instDvd_.lake»
code: /--
Divisibility of natural numbers. `a ∣ b` (typed as `\|`) says that
there is some `c` such that `b = a * c`.
-/
instance : Dvd Nat 
goal: Dvd Nat

full_name: Nat.div_rec_lemma
code: theorem div_rec_lemma {x y : Nat} : 0 < y ∧ y ≤ x → x - y < x 
goal: 0 < y ∧ y ≤ x → x - y < x

full_name: Nat.div
code: @[extern "lean_nat_div"]
protected def div (x y : @& Nat) : Nat 
goal: Nat

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

full_name: Nat.div_eq
code: theorem div_eq (x y : Nat) : x / y = if 0 < y ∧ y ≤ x then (x - y) / y + 1 else 0 
goal: x / y = ite (0 < y ∧ y ≤ x) ((x - y) / y + 1) 0

full_name: Nat.div.inductionOn
code: def div.inductionOn.{u}
      {motive : Nat → Nat → Sort u}
      (x y : Nat)
      (ind  : ∀ x y, 0 < y ∧ y ≤ x → motive (x - y) y → motive x y)
      (base : ∀ x y, ¬(0 < y ∧ y ≤ x) → motive x y)
      : motive x y 
goal: motive x y

full_name: Nat.div_le_self
code: theorem div_le_self (n k : Nat) : n / k ≤ n 
goal: n / k ≤ n

full_name: Nat.div_lt_self
code: theorem div_lt_self {n k : Nat} (hLtN : 0 < n) (hLtK : 1 < k) : n / k < n 
goal: n / k < n

full_name: Nat.modCore
code: @[extern "lean_nat_mod"]
protected def modCore (x y : @& Nat) : Nat 
goal: Nat

full_name: Nat.mod
code: @[extern "lean_nat_mod"]
protected def mod : @& Nat → @& Nat → Nat
  /-
  Nat.modCore is defined by well-founded recursion and thus irreducible. Nevertheless it is
  desireable if trivial `Nat.mod` calculations, namely
  * `Nat.mod 0 m` for all `m`
  * `Nat.mod n (m+n)` for concrete literals `n`
  reduce definitionally.
  This property is desirable for `Fin n` literals, as it means `(ofNat 0 : Fin n).val = 0` by
  definition.
   -/
  
goal: Nat → Nat → Nat

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

full_name: Nat.modCore_eq_mod
code: protected theorem modCore_eq_mod (n m : Nat) : Nat.modCore n m = n % m 
goal: n.modCore m = n % m

full_name: Nat.mod_eq
code: theorem mod_eq (x y : Nat) : x % y = if 0 < y ∧ y ≤ x then (x - y) % y else x 
goal: x % y = ite (0 < y ∧ y ≤ x) ((x - y) % y) x

full_name: Nat.mod.inductionOn
code: def mod.inductionOn.{u}
      {motive : Nat → Nat → Sort u}
      (x y  : Nat)
      (ind  : ∀ x y, 0 < y ∧ y ≤ x → motive (x - y) y → motive x y)
      (base : ∀ x y, ¬(0 < y ∧ y ≤ x) → motive x y)
      : motive x y 
goal: motive x y

full_name: Nat.mod_zero
code: @[simp] theorem mod_zero (a : Nat) : a % 0 = a 
goal: a % 0 = a

full_name: Nat.mod_eq_of_lt
code: theorem mod_eq_of_lt {a b : Nat} (h : a < b) : a % b = a 
goal: a % b = a

full_name: Nat.mod_eq_sub_mod
code: theorem mod_eq_sub_mod {a b : Nat} (h : a ≥ b) : a % b = (a - b) % b 
goal: a % b = (a - b) % b

full_name: Nat.mod_lt
code: theorem mod_lt (x : Nat) {y : Nat} : y > 0 → x % y < y 
goal: y > 0 → x % y < y

full_name: Nat.mod_le
code: theorem mod_le (x y : Nat) : x % y ≤ x 
goal: x % y ≤ x

full_name: Nat.zero_mod
code: @[simp] theorem zero_mod (b : Nat) : 0 % b = 0 
goal: 0 % b = 0

full_name: Nat.mod_self
code: @[simp] theorem mod_self (n : Nat) : n % n = 0 
goal: n % n = 0

full_name: Nat.mod_one
code: theorem mod_one (x : Nat) : x % 1 = 0 
goal: x % 1 = 0

full_name: Nat.div_add_mod
code: theorem div_add_mod (m n : Nat) : n * (m / n) + m % n = m 
goal: n * (m / n) + m % n = m

full_name: Nat.div_eq_sub_div
code: theorem div_eq_sub_div (h₁ : 0 < b) (h₂ : b ≤ a) : a / b = (a - b) / b + 1 
goal: a / b = (a - b) / b + 1

full_name: Nat.mod_add_div
code: theorem mod_add_div (m k : Nat) : m % k + k * (m / k) = m 
goal: m % k + k * (m / k) = m

full_name: Nat.div_one
code: @[simp] protected theorem div_one (n : Nat) : n / 1 = n 
goal: n / 1 = n

full_name: Nat.div_zero
code: @[simp] protected theorem div_zero (n : Nat) : n / 0 = 0 
goal: n / 0 = 0

full_name: Nat.zero_div
code: @[simp] protected theorem zero_div (b : Nat) : 0 / b = 0 
goal: 0 / b = 0

full_name: Nat.le_div_iff_mul_le
code: theorem le_div_iff_mul_le (k0 : 0 < k) : x ≤ y / k ↔ x * k ≤ y 
goal: x ≤ y / k ↔ x * k ≤ y

full_name: Nat.div_div_eq_div_mul
code: protected theorem div_div_eq_div_mul (m n k : Nat) : m / n / k = m / (n * k) 
goal: m / n / k = m / (n * k)

full_name: Nat.div_mul_le_self
code: theorem div_mul_le_self : ∀ (m n : Nat), m / n * n ≤ m
  
goal: m / n * n ≤ m

full_name: Nat.div_lt_iff_lt_mul
code: theorem div_lt_iff_lt_mul (Hk : 0 < k) : x / k < y ↔ x < y * k 
goal: x / k < y ↔ x < y * k

full_name: Nat.add_div_right
code: @[simp] theorem add_div_right (x : Nat) {z : Nat} (H : 0 < z) : (x + z) / z = (x / z) + 1 
goal: (x + z) / z = x / z + 1

full_name: Nat.add_div_left
code: @[simp] theorem add_div_left (x : Nat) {z : Nat} (H : 0 < z) : (z + x) / z = (x / z) + 1 
goal: (z + x) / z = x / z + 1

full_name: Nat.add_mul_div_left
code: theorem add_mul_div_left (x z : Nat) {y : Nat} (H : 0 < y) : (x + y * z) / y = x / y + z 
goal: (x + y * z) / y = x / y + z

full_name: Nat.add_mul_div_right
code: theorem add_mul_div_right (x y : Nat) {z : Nat} (H : 0 < z) : (x + y * z) / z = x / z + y 
goal: (x + y * z) / z = x / z + y

full_name: Nat.add_mod_right
code: @[simp] theorem add_mod_right (x z : Nat) : (x + z) % z = x % z 
goal: (x + z) % z = x % z

full_name: Nat.add_mod_left
code: @[simp] theorem add_mod_left (x z : Nat) : (x + z) % x = z % x 
goal: (x + z) % x = z % x

full_name: Nat.add_mul_mod_self_left
code: @[simp] theorem add_mul_mod_self_left (x y z : Nat) : (x + y * z) % y = x % y 
goal: (x + y * z) % y = x % y

full_name: Nat.add_mul_mod_self_right
code: @[simp] theorem add_mul_mod_self_right (x y z : Nat) : (x + y * z) % z = x % z 
goal: (x + y * z) % z = x % z

full_name: Nat.mul_mod_right
code: @[simp] theorem mul_mod_right (m n : Nat) : (m * n) % m = 0 
goal: m * n % m = 0

full_name: Nat.mul_mod_left
code: @[simp] theorem mul_mod_left (m n : Nat) : (m * n) % n = 0 
goal: m * n % n = 0

full_name: Nat.div_eq_of_lt_le
code: protected theorem div_eq_of_lt_le (lo : k * n ≤ m) (hi : m < (k + 1) * n) : m / n = k 
goal: m / n = k

full_name: Nat.sub_mul_div
code: theorem sub_mul_div (x n p : Nat) (h₁ : n*p ≤ x) : (x - n*p) / n = x / n - p 
goal: (x - n * p) / n = x / n - p

full_name: Nat.mul_sub_div
code: theorem mul_sub_div (x n p : Nat) (h₁ : x < n*p) : (n * p - (x + 1)) / n = p - ((x / n) + 1) 
goal: (n * p - (x + 1)) / n = p - (x / n + 1)

full_name: Nat.mul_mod_mul_left
code: theorem mul_mod_mul_left (z x y : Nat) : (z * x) % (z * y) = z * (x % y) 
goal: z * x % (z * y) = z * (x % y)

full_name: Nat.div_eq_of_lt
code: theorem div_eq_of_lt (h₀ : a < b) : a / b = 0 
goal: a / b = 0

full_name: Nat.mul_div_cancel
code: protected theorem mul_div_cancel (m : Nat) {n : Nat} (H : 0 < n) : m * n / n = m 
goal: m * n / n = m

full_name: Nat.mul_div_cancel_left
code: protected theorem mul_div_cancel_left (m : Nat) {n : Nat} (H : 0 < n) : n * m / n = m 
goal: n * m / n = m

full_name: Nat.div_le_of_le_mul
code: protected theorem div_le_of_le_mul {m n : Nat} : ∀ {k}, m ≤ k * n → m / k ≤ n
  
goal: m ≤ k * n → m / k ≤ n

full_name: Nat.mul_div_right
code: @[simp] theorem mul_div_right (n : Nat) {m : Nat} (H : 0 < m) : m * n / m = n 
goal: m * n / m = n

full_name: Nat.mul_div_left
code: @[simp] theorem mul_div_left (m : Nat) {n : Nat} (H : 0 < n) : m * n / n = m 
goal: m * n / n = m

full_name: Nat.div_self
code: protected theorem div_self (H : 0 < n) : n / n = 1 
goal: n / n = 1

full_name: Nat.div_eq_of_eq_mul_left
code: protected theorem div_eq_of_eq_mul_left (H1 : 0 < n) (H2 : m = k * n) : m / n = k 
goal: m / n = k

full_name: Nat.div_eq_of_eq_mul_right
code: protected theorem div_eq_of_eq_mul_right (H1 : 0 < n) (H2 : m = n * k) : m / n = k 
goal: m / n = k

full_name: Nat.mul_div_mul_left
code: protected theorem mul_div_mul_left {m : Nat} (n k : Nat) (H : 0 < m) :
    m * n / (m * k) = n / k 
goal: m * n / (m * k) = n / k

full_name: Nat.mul_div_mul_right
code: protected theorem mul_div_mul_right {m : Nat} (n k : Nat) (H : 0 < m) :
    n * m / (k * m) = n / k 
goal: n * m / (k * m) = n / k

full_name: Nat.mul_div_le
code: theorem mul_div_le (m n : Nat) : n * (m / n) ≤ m 
goal: n * (m / n) ≤ m