File: Mathlib/RingTheory/Multiplicity.lean

full_name: multiplicity
code: /-- `multiplicity a b` returns the largest natural number `n` such that
  `a ^ n ∣ b`, as a `PartENat` or natural with infinity. If `∀ n, a ^ n ∣ b`,
  then it returns `⊤`-/
def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat 
goal: PartENat

full_name: multiplicity.Finite
code: /-- `multiplicity.Finite a b` indicates that the multiplicity of `a` in `b` is finite. -/
abbrev Finite (a b : α) : Prop 
goal: Prop

full_name: multiplicity.finite_iff_dom
code: theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} :
    Finite a b ↔ (multiplicity a b).Dom 
goal: multiplicity.Finite a b ↔ (multiplicity a b).Dom

full_name: multiplicity.finite_def
code: theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b 
goal: multiplicity.Finite a b ↔ ∃ n, ¬a ^ (n + 1) ∣ b

full_name: multiplicity.not_dvd_one_of_finite_one_right
code: theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 
goal: multiplicity.Finite a 1 → ¬a ∣ 1

full_name: multiplicity.Int.natCast_multiplicity
code: @[norm_cast]
theorem Int.natCast_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b 
goal: multiplicity ↑a ↑b = multiplicity a b

full_name: multiplicity.not_finite_iff_forall
code: theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b 
goal: ¬multiplicity.Finite a b ↔ ∀ (n : ℕ), a ^ n ∣ b

full_name: multiplicity.not_unit_of_finite
code: theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a 
goal: ¬IsUnit a

full_name: multiplicity.finite_of_finite_mul_right
code: theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b 
goal: multiplicity.Finite a (b * c) → multiplicity.Finite a b

full_name: multiplicity.pow_dvd_of_le_multiplicity
code: theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} :
    (k : PartENat) ≤ multiplicity a b → a ^ k ∣ b 
goal: ↑k ≤ multiplicity a b → a ^ k ∣ b

full_name: multiplicity.pow_multiplicity_dvd
code: theorem pow_multiplicity_dvd {a b : α} (h : Finite a b) : a ^ get (multiplicity a b) h ∣ b 
goal: a ^ (multiplicity a b).get h ∣ b

full_name: multiplicity.is_greatest
code: theorem is_greatest {a b : α} {m : ℕ} (hm : multiplicity a b < m) : ¬a ^ m ∣ b 
goal: ¬a ^ m ∣ b

full_name: multiplicity.is_greatest'
code: theorem is_greatest' {a b : α} {m : ℕ} (h : Finite a b) (hm : get (multiplicity a b) h < m) :
    ¬a ^ m ∣ b 
goal: ¬a ^ m ∣ b

full_name: multiplicity.pos_of_dvd
code: theorem pos_of_dvd {a b : α} (hfin : Finite a b) (hdiv : a ∣ b) :
    0 < (multiplicity a b).get hfin 
goal: 0 < (multiplicity a b).get hfin

full_name: multiplicity.unique
code: theorem unique {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) :
    (k : PartENat) = multiplicity a b 
goal: ↑k = multiplicity a b

full_name: multiplicity.unique'
code: theorem unique' {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) :
    k = get (multiplicity a b) ⟨k, hsucc⟩ 
goal: k = (multiplicity a b).get ⋯

full_name: multiplicity.le_multiplicity_of_pow_dvd
code: theorem le_multiplicity_of_pow_dvd {a b : α} {k : ℕ} (hk : a ^ k ∣ b) :
    (k : PartENat) ≤ multiplicity a b 
goal: ↑k ≤ multiplicity a b

full_name: multiplicity.pow_dvd_iff_le_multiplicity
code: theorem pow_dvd_iff_le_multiplicity {a b : α} {k : ℕ} :
    a ^ k ∣ b ↔ (k : PartENat) ≤ multiplicity a b 
goal: a ^ k ∣ b ↔ ↑k ≤ multiplicity a b

full_name: multiplicity.multiplicity_lt_iff_not_dvd
code: theorem multiplicity_lt_iff_not_dvd {a b : α} {k : ℕ} :
    multiplicity a b < (k : PartENat) ↔ ¬a ^ k ∣ b 
goal: multiplicity a b < ↑k ↔ ¬a ^ k ∣ b

full_name: multiplicity.eq_coe_iff
code: theorem eq_coe_iff {a b : α} {n : ℕ} :
    multiplicity a b = (n : PartENat) ↔ a ^ n ∣ b ∧ ¬a ^ (n + 1) ∣ b 
goal: multiplicity a b = ↑n ↔ a ^ n ∣ b ∧ ¬a ^ (n + 1) ∣ b

full_name: multiplicity.eq_top_iff
code: theorem eq_top_iff {a b : α} : multiplicity a b = ⊤ ↔ ∀ n : ℕ, a ^ n ∣ b 
goal: multiplicity a b = ⊤ ↔ ∀ (n : ℕ), a ^ n ∣ b

full_name: multiplicity.isUnit_left
code: @[simp]
theorem isUnit_left {a : α} (b : α) (ha : IsUnit a) : multiplicity a b = ⊤ 
goal: multiplicity a b = ⊤

full_name: multiplicity.one_left
code: theorem one_left (b : α) : multiplicity 1 b = ⊤ 
goal: multiplicity 1 b = ⊤

full_name: multiplicity.get_one_right
code: @[simp]
theorem get_one_right {a : α} (ha : Finite a 1) : get (multiplicity a 1) ha = 0 
goal: (multiplicity a 1).get ha = 0

full_name: multiplicity.unit_left
code: theorem unit_left (a : α) (u : αˣ) : multiplicity (u : α) a = ⊤ 
goal: multiplicity (↑u) a = ⊤

full_name: multiplicity.multiplicity_eq_zero
code: theorem multiplicity_eq_zero {a b : α} : multiplicity a b = 0 ↔ ¬a ∣ b 
goal: multiplicity a b = 0 ↔ ¬a ∣ b

full_name: multiplicity.multiplicity_ne_zero
code: theorem multiplicity_ne_zero {a b : α} : multiplicity a b ≠ 0 ↔ a ∣ b 
goal: multiplicity a b ≠ 0 ↔ a ∣ b

full_name: multiplicity.eq_top_iff_not_finite
code: theorem eq_top_iff_not_finite {a b : α} : multiplicity a b = ⊤ ↔ ¬Finite a b 
goal: multiplicity a b = ⊤ ↔ ¬multiplicity.Finite a b

full_name: multiplicity.ne_top_iff_finite
code: theorem ne_top_iff_finite {a b : α} : multiplicity a b ≠ ⊤ ↔ Finite a b 
goal: multiplicity a b ≠ ⊤ ↔ multiplicity.Finite a b

full_name: multiplicity.lt_top_iff_finite
code: theorem lt_top_iff_finite {a b : α} : multiplicity a b < ⊤ ↔ Finite a b 
goal: multiplicity a b < ⊤ ↔ multiplicity.Finite a b

full_name: multiplicity.exists_eq_pow_mul_and_not_dvd
code: theorem exists_eq_pow_mul_and_not_dvd {a b : α} (hfin : Finite a b) :
    ∃ c : α, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c 
goal: ∃ c, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c

full_name: multiplicity.multiplicity_le_multiplicity_iff
code: theorem multiplicity_le_multiplicity_iff {a b : α} {c d : β} :
    multiplicity a b ≤ multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b → c ^ n ∣ d 
goal: multiplicity a b ≤ multiplicity c d ↔ ∀ (n : ℕ), a ^ n ∣ b → c ^ n ∣ d

full_name: multiplicity.multiplicity_eq_multiplicity_iff
code: theorem multiplicity_eq_multiplicity_iff {a b : α} {c d : β} :
    multiplicity a b = multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b ↔ c ^ n ∣ d 
goal: multiplicity a b = multiplicity c d ↔ ∀ (n : ℕ), a ^ n ∣ b ↔ c ^ n ∣ d

full_name: multiplicity.le_multiplicity_map
code: theorem le_multiplicity_map {F : Type*} [FunLike F α β] [MonoidHomClass F α β]
    (f : F) {a b : α} : multiplicity a b ≤ multiplicity (f a) (f b) 
goal: multiplicity a b ≤ multiplicity (f a) (f b)

full_name: multiplicity.multiplicity_map_eq
code: theorem multiplicity_map_eq {F : Type*} [EquivLike F α β] [MulEquivClass F α β]
    (f : F) {a b : α} : multiplicity (f a) (f b) = multiplicity a b 
goal: multiplicity (f a) (f b) = multiplicity a b

full_name: multiplicity.multiplicity_le_multiplicity_of_dvd_right
code: theorem multiplicity_le_multiplicity_of_dvd_right {a b c : α} (h : b ∣ c) :
    multiplicity a b ≤ multiplicity a c 
goal: multiplicity a b ≤ multiplicity a c

full_name: multiplicity.eq_of_associated_right
code: theorem eq_of_associated_right {a b c : α} (h : Associated b c) :
    multiplicity a b = multiplicity a c 
goal: multiplicity a b = multiplicity a c

full_name: multiplicity.dvd_of_multiplicity_pos
code: theorem dvd_of_multiplicity_pos {a b : α} (h : (0 : PartENat) < multiplicity a b) : a ∣ b 
goal: a ∣ b

full_name: multiplicity.dvd_iff_multiplicity_pos
code: theorem dvd_iff_multiplicity_pos {a b : α} : (0 : PartENat) < multiplicity a b ↔ a ∣ b 
goal: 0 < multiplicity a b ↔ a ∣ b

full_name: multiplicity.finite_nat_iff
code: theorem finite_nat_iff {a b : ℕ} : Finite a b ↔ a ≠ 1 ∧ 0 < b 
goal: multiplicity.Finite a b ↔ a ≠ 1 ∧ 0 < b

full_name: multiplicity.finite_of_finite_mul_left
code: theorem finite_of_finite_mul_left {a b c : α} : Finite a (b * c) → Finite a c 
goal: multiplicity.Finite a (b * c) → multiplicity.Finite a c

full_name: multiplicity.isUnit_right
code: theorem isUnit_right {a b : α} (ha : ¬IsUnit a) (hb : IsUnit b) : multiplicity a b = 0 
goal: multiplicity a b = 0

full_name: multiplicity.one_right
code: theorem one_right {a : α} (ha : ¬IsUnit a) : multiplicity a 1 = 0 
goal: multiplicity a 1 = 0

full_name: multiplicity.unit_right
code: theorem unit_right {a : α} (ha : ¬IsUnit a) (u : αˣ) : multiplicity a u = 0 
goal: multiplicity a ↑u = 0

full_name: multiplicity.multiplicity_le_multiplicity_of_dvd_left
code: theorem multiplicity_le_multiplicity_of_dvd_left {a b c : α} (hdvd : a ∣ b) :
    multiplicity b c ≤ multiplicity a c 
goal: multiplicity b c ≤ multiplicity a c

full_name: multiplicity.eq_of_associated_left
code: theorem eq_of_associated_left {a b c : α} (h : Associated a b) :
    multiplicity b c = multiplicity a c 
goal: multiplicity b c = multiplicity a c

full_name: multiplicity.ne_zero_of_finite
code: theorem ne_zero_of_finite {a b : α} (h : Finite a b) : b ≠ 0 
goal: b ≠ 0

full_name: multiplicity.zero
code: @[simp]
protected theorem zero (a : α) : multiplicity a 0 = ⊤ 
goal: multiplicity a 0 = ⊤

full_name: multiplicity.multiplicity_zero_eq_zero_of_ne_zero
code: @[simp]
theorem multiplicity_zero_eq_zero_of_ne_zero (a : α) (ha : a ≠ 0) : multiplicity 0 a = 0 
goal: multiplicity 0 a = 0

full_name: multiplicity.multiplicity_mk_eq_multiplicity
code: theorem multiplicity_mk_eq_multiplicity
    [DecidableRel ((· ∣ ·) : Associates α → Associates α → Prop)] {a b : α} :
    multiplicity (Associates.mk a) (Associates.mk b) = multiplicity a b 
goal: multiplicity (Associates.mk a) (Associates.mk b) = multiplicity a b

full_name: multiplicity.min_le_multiplicity_add
code: theorem min_le_multiplicity_add {p a b : α} :
    min (multiplicity p a) (multiplicity p b) ≤ multiplicity p (a + b) 
goal: min (multiplicity p a) (multiplicity p b) ≤ multiplicity p (a + b)

full_name: multiplicity.neg
code: @[simp]
protected theorem neg (a b : α) : multiplicity a (-b) = multiplicity a b 
goal: multiplicity a (-b) = multiplicity a b

full_name: multiplicity.Int.natAbs
code: theorem Int.natAbs (a : ℕ) (b : ℤ) : multiplicity a b.natAbs = multiplicity (a : ℤ) b 
goal: multiplicity a b.natAbs = multiplicity (↑a) b

full_name: multiplicity.multiplicity_add_of_gt
code: theorem multiplicity_add_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) :
    multiplicity p (a + b) = multiplicity p b 
goal: multiplicity p (a + b) = multiplicity p b

full_name: multiplicity.multiplicity_sub_of_gt
code: theorem multiplicity_sub_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) :
    multiplicity p (a - b) = multiplicity p b 
goal: multiplicity p (a - b) = multiplicity p b

full_name: multiplicity.multiplicity_add_eq_min
code: theorem multiplicity_add_eq_min {p a b : α} (h : multiplicity p a ≠ multiplicity p b) :
    multiplicity p (a + b) = min (multiplicity p a) (multiplicity p b) 
goal: multiplicity p (a + b) = min (multiplicity p a) (multiplicity p b)

full_name: multiplicity.finite_mul_aux
code: theorem finite_mul_aux {p : α} (hp : Prime p) {a b : α} :
    ∀ {n m : ℕ}, ¬p ^ (n + 1) ∣ a → ¬p ^ (m + 1) ∣ b → ¬p ^ (n + m + 1) ∣ a * b
  
goal: ¬p ^ (n + 1) ∣ a → ¬p ^ (m + 1) ∣ b → ¬p ^ (n + m + 1) ∣ a * b

full_name: multiplicity.finite_mul
code: theorem finite_mul {p a b : α} (hp : Prime p) : Finite p a → Finite p b → Finite p (a * b) 
goal: multiplicity.Finite p a → multiplicity.Finite p b → multiplicity.Finite p (a * b)

full_name: multiplicity.finite_mul_iff
code: theorem finite_mul_iff {p a b : α} (hp : Prime p) : Finite p (a * b) ↔ Finite p a ∧ Finite p b 
goal: multiplicity.Finite p (a * b) ↔ multiplicity.Finite p a ∧ multiplicity.Finite p b

full_name: multiplicity.finite_pow
code: theorem finite_pow {p a : α} (hp : Prime p) : ∀ {k : ℕ} (_ : Finite p a), Finite p (a ^ k)
  
goal: multiplicity.Finite p a → multiplicity.Finite p (a ^ k)

full_name: multiplicity.multiplicity_self
code: @[simp]
theorem multiplicity_self {a : α} (ha : ¬IsUnit a) (ha0 : a ≠ 0) : multiplicity a a = 1 
goal: multiplicity a a = 1

full_name: multiplicity.get_multiplicity_self
code: @[simp]
theorem get_multiplicity_self {a : α} (ha : Finite a a) : get (multiplicity a a) ha = 1 
goal: (multiplicity a a).get ha = 1

full_name: multiplicity.mul'
code: protected theorem mul' {p a b : α} (hp : Prime p) (h : (multiplicity p (a * b)).Dom) :
    get (multiplicity p (a * b)) h =
      get (multiplicity p a) ((finite_mul_iff hp).1 h).1 +
        get (multiplicity p b) ((finite_mul_iff hp).1 h).2 
goal: (multiplicity p (a * b)).get h = (multiplicity p a).get ⋯ + (multiplicity p b).get ⋯

full_name: multiplicity.mul
code: protected theorem mul {p a b : α} (hp : Prime p) :
    multiplicity p (a * b) = multiplicity p a + multiplicity p b 
goal: multiplicity p (a * b) = multiplicity p a + multiplicity p b

full_name: multiplicity.Finset.prod
code: theorem Finset.prod {β : Type*} {p : α} (hp : Prime p) (s : Finset β) (f : β → α) :
    multiplicity p (∏ x ∈ s, f x) = ∑ x ∈ s, multiplicity p (f x) 
goal: multiplicity p (∏ x ∈ s, f x) = ∑ x ∈ s, multiplicity p (f x)

full_name: multiplicity.pow'
code: protected theorem pow' {p a : α} (hp : Prime p) (ha : Finite p a) :
    ∀ {k : ℕ}, get (multiplicity p (a ^ k)) (finite_pow hp ha) = k * get (multiplicity p a) ha 
goal: (multiplicity p (a ^ k)).get ⋯ = k * (multiplicity p a).get ha

full_name: multiplicity.pow
code: theorem pow {p a : α} (hp : Prime p) : ∀ {k : ℕ}, multiplicity p (a ^ k) = k • multiplicity p a
  
goal: multiplicity p (a ^ k) = k • multiplicity p a

full_name: multiplicity.multiplicity_pow_self
code: theorem multiplicity_pow_self {p : α} (h0 : p ≠ 0) (hu : ¬IsUnit p) (n : ℕ) :
    multiplicity p (p ^ n) = n 
goal: multiplicity p (p ^ n) = ↑n

full_name: multiplicity.multiplicity_pow_self_of_prime
code: theorem multiplicity_pow_self_of_prime {p : α} (hp : Prime p) (n : ℕ) :
    multiplicity p (p ^ n) = n 
goal: multiplicity p (p ^ n) = ↑n

full_name: multiplicity_eq_zero_of_coprime
code: theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1)
    (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 
goal: multiplicity p a = 0

full_name: multiplicity.finite_int_iff_natAbs_finite
code: theorem finite_int_iff_natAbs_finite {a b : ℤ} : Finite a b ↔ Finite a.natAbs b.natAbs 
goal: multiplicity.Finite a b ↔ multiplicity.Finite a.natAbs b.natAbs

full_name: multiplicity.finite_int_iff
code: theorem finite_int_iff {a b : ℤ} : Finite a b ↔ a.natAbs ≠ 1 ∧ b ≠ 0 
goal: multiplicity.Finite a b ↔ a.natAbs ≠ 1 ∧ b ≠ 0

full_name: multiplicity.decidableNat
code: instance decidableNat : DecidableRel fun a b : ℕ => (multiplicity a b).Dom 
goal: DecidableRel fun a b => (multiplicity a b).Dom

full_name: multiplicity.decidableInt
code: instance decidableInt : DecidableRel fun a b : ℤ => (multiplicity a b).Dom 
goal: DecidableRel fun a b => (multiplicity a b).Dom