Theorem: multiplicity_factor_dvd_iso_eq_multiplicity_of_mem_normalizedFactors
File: Mathlib/RingTheory/ChainOfDivisors.lean

tactic: apply Eq.symm
state_before: M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
⊢ multiplicity (↑(↑d { val := p, property := (_ : p ∣ m) })) n = multiplicity p m

tactic: suffices multiplicity (Associates.mk p) (Associates.mk m) = multiplicity (Associates.mk
  ↑(d ⟨associatesEquivOfUniqueUnits (associatesEquivOfUniqueUnits.symm p), by
    simp [dvd_of_mem_normalizedFactors hp]⟩)) (Associates.mk n) by
  simpa only [multiplicity_mk_eq_multiplicity, associatesEquivOfUniqueUnits_symm_apply,
    associatesEquivOfUniqueUnits_apply, out_mk, normalize_eq] using this
state_before: case h
M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
⊢ multiplicity p m = multiplicity (↑(↑d { val := p, property := (_ : p ∣ m) })) n

tactic: have : Associates.mk (d ⟨associatesEquivOfUniqueUnits (associatesEquivOfUniqueUnits.symm p), by
  simp only [dvd_of_mem_normalizedFactors hp, associatesEquivOfUniqueUnits_symm_apply,
    associatesEquivOfUniqueUnits_apply, out_mk, normalize_eq]⟩ : N) =
  ↑(mkFactorOrderIsoOfFactorDvdEquiv hd ⟨associatesEquivOfUniqueUnits.symm p, by
    rw [associatesEquivOfUniqueUnits_symm_apply]
    exact mk_le_mk_of_dvd (dvd_of_mem_normalizedFactors hp)⟩) :=
  by rw [mkFactorOrderIsoOfFactorDvdEquiv_apply_coe]
state_before: case h
M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
⊢ multiplicity (Associates.mk p) (Associates.mk m) =
    multiplicity
      (Associates.mk
        ↑(↑d
            { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
              property := (_ : p * 1 ∣ m) }))
      (Associates.mk n)

tactic: rw [this]
state_before: case h
M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
this :
  Associates.mk
      ↑(↑d
          { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
            property := (_ : ↑normalize p ∣ m) }) =
    ↑(↑(mkFactorOrderIsoOfFactorDvdEquiv hd)
        { val := ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p,
          property := (_ : ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)) })
⊢ multiplicity (Associates.mk p) (Associates.mk m) =
    multiplicity
      (Associates.mk
        ↑(↑d
            { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
              property := (_ : p * 1 ∣ m) }))
      (Associates.mk n)

tactic: letI := Classical.decEq (Associates M)
state_before: case h
M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
this :
  Associates.mk
      ↑(↑d
          { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
            property := (_ : ↑normalize p ∣ m) }) =
    ↑(↑(mkFactorOrderIsoOfFactorDvdEquiv hd)
        { val := ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p,
          property := (_ : ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)) })
⊢ multiplicity (Associates.mk p) (Associates.mk m) =
    multiplicity
      (↑(↑(mkFactorOrderIsoOfFactorDvdEquiv hd)
          { val := ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p,
            property := (_ : ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)) }))
      (Associates.mk n)

tactic: refine'
  multiplicity_prime_eq_multiplicity_image_by_factor_orderIso (mk_ne_zero.mpr hn) _
    (mkFactorOrderIsoOfFactorDvdEquiv hd)
state_before: case h
M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
this✝ :
  Associates.mk
      ↑(↑d
          { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
            property := (_ : ↑normalize p ∣ m) }) =
    ↑(↑(mkFactorOrderIsoOfFactorDvdEquiv hd)
        { val := ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p,
          property := (_ : ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)) })
this : DecidableEq (Associates M) := Classical.decEq (Associates M)
⊢ multiplicity (Associates.mk p) (Associates.mk m) =
    multiplicity
      (↑(↑(mkFactorOrderIsoOfFactorDvdEquiv hd)
          { val := ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p,
            property := (_ : ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)) }))
      (Associates.mk n)

tactic: obtain ⟨q, hq, hq'⟩ :=
  exists_mem_normalizedFactors_of_dvd (mk_ne_zero.mpr hm)
    ((prime_mk p).mpr (prime_of_normalized_factor p hp)).irreducible
    (mk_le_mk_of_dvd (dvd_of_mem_normalizedFactors hp))
state_before: case h
M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
this✝ :
  Associates.mk
      ↑(↑d
          { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
            property := (_ : ↑normalize p ∣ m) }) =
    ↑(↑(mkFactorOrderIsoOfFactorDvdEquiv hd)
        { val := ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p,
          property := (_ : ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)) })
this : DecidableEq (Associates M) := Classical.decEq (Associates M)
⊢ Associates.mk p ∈ normalizedFactors (Associates.mk m)

tactic: rwa [associated_iff_eq.mp hq']
state_before: case h.intro.intro
M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
this✝ :
  Associates.mk
      ↑(↑d
          { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
            property := (_ : ↑normalize p ∣ m) }) =
    ↑(↑(mkFactorOrderIsoOfFactorDvdEquiv hd)
        { val := ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p,
          property := (_ : ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)) })
this : DecidableEq (Associates M) := Classical.decEq (Associates M)
q : Associates M
hq : q ∈ normalizedFactors (Associates.mk m)
hq' : Associated (Associates.mk p) q
⊢ Associates.mk p ∈ normalizedFactors (Associates.mk m)

tactic: simp [dvd_of_mem_normalizedFactors hp]
state_before: M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
⊢ ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p) ∣ m

tactic: simpa only [multiplicity_mk_eq_multiplicity, associatesEquivOfUniqueUnits_symm_apply,
  associatesEquivOfUniqueUnits_apply, out_mk, normalize_eq] using this
state_before: M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
this :
  multiplicity (Associates.mk p) (Associates.mk m) =
    multiplicity
      (Associates.mk
        ↑(↑d
            { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
              property := (_ : p * 1 ∣ m) }))
      (Associates.mk n)
⊢ multiplicity p m = multiplicity (↑(↑d { val := p, property := (_ : p ∣ m) })) n

tactic: simp only [dvd_of_mem_normalizedFactors hp, associatesEquivOfUniqueUnits_symm_apply,
  associatesEquivOfUniqueUnits_apply, out_mk, normalize_eq]
state_before: M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
⊢ ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p) ∣ m

tactic: rw [associatesEquivOfUniqueUnits_symm_apply]
state_before: M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
⊢ ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)

tactic: exact mk_le_mk_of_dvd (dvd_of_mem_normalizedFactors hp)
state_before: M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
⊢ Associates.mk p ∈ Set.Iic (Associates.mk m)

tactic: rw [mkFactorOrderIsoOfFactorDvdEquiv_apply_coe]
state_before: M : Type u_1
inst✝⁸ : CancelCommMonoidWithZero M
N : Type u_2
inst✝⁷ : CancelCommMonoidWithZero N
inst✝⁶ : Unique Mˣ
inst✝⁵ : Unique Nˣ
inst✝⁴ : UniqueFactorizationMonoid M
inst✝³ : UniqueFactorizationMonoid N
inst✝² : DecidableEq M
inst✝¹ : DecidableRel fun x x_1 => x ∣ x_1
inst✝ : DecidableRel fun x x_1 => x ∣ x_1
m p : M
n : N
hm : m ≠ 0
hn : n ≠ 0
hp : p ∈ normalizedFactors m
d : { l // l ∣ m } ≃ { l // l ∣ n }
hd : ∀ (l l' : { l // l ∣ m }), ↑(↑d l) ∣ ↑(↑d l') ↔ ↑l ∣ ↑l'
⊢ Associates.mk
      ↑(↑d
          { val := ↑associatesEquivOfUniqueUnits (↑(MulEquiv.symm associatesEquivOfUniqueUnits) p),
            property := (_ : ↑normalize p ∣ m) }) =
    ↑(↑(mkFactorOrderIsoOfFactorDvdEquiv hd)
        { val := ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p,
          property := (_ : ↑(MulEquiv.symm associatesEquivOfUniqueUnits) p ∈ Set.Iic (Associates.mk m)) })