Theorem: exist_unique_eq_mul_prod
File: Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean

tactic: let ζ := x * (∏ i, (fundSystem K i) ^ ((basisModTorsion K).repr (Additive.ofMul ↑x) i))⁻¹
state_before: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
⊢ ∃! ζe, x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i
state_after: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ ∃! ζe, x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i

tactic: have h_tors : ζ ∈ torsion K := by
  rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
    ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
  simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
  rw [add_eq_zero_iff_eq_neg, neg_neg]
  exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
state_before: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ ∃! ζe, x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i
state_after: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
⊢ ∃! ζe, x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i

tactic: refine ⟨⟨⟨ζ, h_tors⟩, ((basisModTorsion K).repr (Additive.ofMul ↑x) : Fin (rank K) → ℤ)⟩, ?_, ?_⟩
state_before: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
⊢ ∃! ζe, x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i
state_after: case refine_1
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
⊢ (fun ζe => x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i)
    (⟨ζ, h_tors⟩, ⇑((basisModTorsion K).repr (Additive.ofMul ↑x)))

case refine_2
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
⊢ ∀ (y : ↥(torsion K) × (Fin (rank K) → ℤ)),
    (fun ζe => x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i) y →
      y = (⟨ζ, h_tors⟩, ⇑((basisModTorsion K).repr (Additive.ofMul ↑x)))

tactic: rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
  ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
state_before: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ ζ ∈ torsion K
state_after: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ Additive.ofMul ↑x +
      -∑ i : Fin (rank K), Additive.ofMul ↑(fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i) =
    0

tactic: simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
state_before: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ Additive.ofMul ↑x +
      -∑ i : Fin (rank K), Additive.ofMul ↑(fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i) =
    0
state_after: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ Additive.ofMul ↑x +
      -∑ x_1 : Fin (rank K),
          ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1 •
            Additive.ofMul (Additive.toMul ((basisModTorsion K) x_1)) =
    0

tactic: rw [add_eq_zero_iff_eq_neg, neg_neg]
state_before: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ Additive.ofMul ↑x +
      -∑ x_1 : Fin (rank K),
          ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1 •
            Additive.ofMul (Additive.toMul ((basisModTorsion K) x_1)) =
    0
state_after: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ Additive.ofMul ↑x =
    ∑ x_1 : Fin (rank K),
      ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1 • Additive.ofMul (Additive.toMul ((basisModTorsion K) x_1))

tactic: exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
state_before: K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
⊢ Additive.ofMul ↑x =
    ∑ x_1 : Fin (rank K),
      ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1 • Additive.ofMul (Additive.toMul ((basisModTorsion K) x_1))
state_after: no goals

tactic: simp only [ζ, _root_.inv_mul_cancel_right]
state_before: case refine_1
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
⊢ (fun ζe => x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i)
    (⟨ζ, h_tors⟩, ⇑((basisModTorsion K).repr (Additive.ofMul ↑x)))
state_after: no goals

tactic: rintro ⟨⟨ζ', h_tors'⟩, η⟩ hf
state_before: case refine_2
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
⊢ ∀ (y : ↥(torsion K) × (Fin (rank K) → ℤ)),
    (fun ζe => x = ↑ζe.1 * ∏ i : Fin (rank K), fundSystem K i ^ ζe.2 i) y →
      y = (⟨ζ, h_tors⟩, ⇑((basisModTorsion K).repr (Additive.ofMul ↑x)))
state_after: case refine_2.mk.mk
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : Fin (rank K) → ℤ
ζ' : (𝓞 K)ˣ
h_tors' : ζ' ∈ torsion K
hf : x = ↑(⟨ζ', h_tors'⟩, η).1 * ∏ i : Fin (rank K), fundSystem K i ^ (⟨ζ', h_tors'⟩, η).2 i
⊢ (⟨ζ', h_tors'⟩, η) = (⟨ζ, h_tors⟩, ⇑((basisModTorsion K).repr (Additive.ofMul ↑x)))

tactic: simp only [ζ, ← fun_eq_repr K h_tors' hf, Prod.mk.injEq, Subtype.mk.injEq, and_true]
state_before: case refine_2.mk.mk
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : Fin (rank K) → ℤ
ζ' : (𝓞 K)ˣ
h_tors' : ζ' ∈ torsion K
hf : x = ↑(⟨ζ', h_tors'⟩, η).1 * ∏ i : Fin (rank K), fundSystem K i ^ (⟨ζ', h_tors'⟩, η).2 i
⊢ (⟨ζ', h_tors'⟩, η) = (⟨ζ, h_tors⟩, ⇑((basisModTorsion K).repr (Additive.ofMul ↑x)))
state_after: case refine_2.mk.mk
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : Fin (rank K) → ℤ
ζ' : (𝓞 K)ˣ
h_tors' : ζ' ∈ torsion K
hf : x = ↑(⟨ζ', h_tors'⟩, η).1 * ∏ i : Fin (rank K), fundSystem K i ^ (⟨ζ', h_tors'⟩, η).2 i
⊢ ζ' = x * (∏ x : Fin (rank K), fundSystem K x ^ η x)⁻¹

tactic: nth_rewrite 1 [hf]
state_before: case refine_2.mk.mk
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : Fin (rank K) → ℤ
ζ' : (𝓞 K)ˣ
h_tors' : ζ' ∈ torsion K
hf : x = ↑(⟨ζ', h_tors'⟩, η).1 * ∏ i : Fin (rank K), fundSystem K i ^ (⟨ζ', h_tors'⟩, η).2 i
⊢ ζ' = x * (∏ x : Fin (rank K), fundSystem K x ^ η x)⁻¹
state_after: case refine_2.mk.mk
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : Fin (rank K) → ℤ
ζ' : (𝓞 K)ˣ
h_tors' : ζ' ∈ torsion K
hf : x = ↑(⟨ζ', h_tors'⟩, η).1 * ∏ i : Fin (rank K), fundSystem K i ^ (⟨ζ', h_tors'⟩, η).2 i
⊢ ζ' =
    (↑(⟨ζ', h_tors'⟩, η).1 * ∏ i : Fin (rank K), fundSystem K i ^ (⟨ζ', h_tors'⟩, η).2 i) *
      (∏ x : Fin (rank K), fundSystem K x ^ η x)⁻¹

tactic: rw [_root_.mul_inv_cancel_right]
state_before: case refine_2.mk.mk
K : Type u_1
inst✝² : Field K
inst✝¹ inst✝ : NumberField K
x : (𝓞 K)ˣ
ζ : (𝓞 K)ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : Fin (rank K) → ℤ
ζ' : (𝓞 K)ˣ
h_tors' : ζ' ∈ torsion K
hf : x = ↑(⟨ζ', h_tors'⟩, η).1 * ∏ i : Fin (rank K), fundSystem K i ^ (⟨ζ', h_tors'⟩, η).2 i
⊢ ζ' =
    (↑(⟨ζ', h_tors'⟩, η).1 * ∏ i : Fin (rank K), fundSystem K i ^ (⟨ζ', h_tors'⟩, η).2 i) *
      (∏ x : Fin (rank K), fundSystem K x ^ η x)⁻¹
state_after: no goals