Theorem: FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top
File: Mathlib/RingTheory/DedekindDomain/PID.lean

tactic: have hinv := I.mul_inv
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
h : Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v}) = ⊤
⊢ Submodule.IsPrincipal ↑↑I

tactic: set J := Submodule.comap (Algebra.linearMap R A) ((I : Submodule R A) * Submodule.span R {v})
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
h : Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v}) = ⊤
hinv : ↑I * ↑I⁻¹ = 1
⊢ Submodule.IsPrincipal ↑↑I

tactic: have hJ : IsLocalization.coeSubmodule A J = ↑I * Submodule.span R {v} := by
  rw [Subtype.ext_iff] at hinv
  simp only [coe_mul, val_eq_coe, coe_one] at hinv
  apply Submodule.map_comap_eq_self
  rw [← Submodule.one_eq_range, ← hinv]
  exact Submodule.mul_le_mul_right ((Submodule.span_singleton_le_iff_mem _ _).2 hv)
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
⊢ Submodule.IsPrincipal ↑↑I

tactic: have : (1 : A) ∈ ↑I * Submodule.span R {v} := by
  rw [← hJ, h, IsLocalization.coeSubmodule_top, Submodule.mem_one]
  exact ⟨1, (algebraMap R _).map_one⟩
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
⊢ Submodule.IsPrincipal ↑↑I

tactic: obtain ⟨w, hw, hvw⟩ := Submodule.mem_mul_span_singleton.1 this
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
this : 1 ∈ ↑↑I * Submodule.span R {v}
⊢ Submodule.IsPrincipal ↑↑I

tactic: refine' ⟨⟨w, _⟩⟩
state_before: case intro.intro
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
this : 1 ∈ ↑↑I * Submodule.span R {v}
w : A
hw : w ∈ ↑↑I
hvw : w * v = 1
⊢ Submodule.IsPrincipal ↑↑I

tactic: rw [← FractionalIdeal.coe_spanSingleton S, ← inv_inv I, eq_comm]
state_before: case intro.intro
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
this : 1 ∈ ↑↑I * Submodule.span R {v}
w : A
hw : w ∈ ↑↑I
hvw : w * v = 1
⊢ ↑↑I = Submodule.span R {w}

tactic: refine' congr_arg (↑) (Units.eq_inv_of_mul_eq_one_left (le_antisymm _ _))
state_before: case intro.intro
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
this : 1 ∈ ↑↑I * Submodule.span R {v}
w : A
hw : w ∈ ↑↑I
hvw : w * v = 1
⊢ ↑(spanSingleton S w) = ↑↑I⁻¹⁻¹

tactic: rw [Subtype.ext_iff] at hinv
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
⊢ IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}

tactic: simp only [coe_mul, val_eq_coe, coe_one] at hinv
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑(↑I * ↑I⁻¹) = ↑1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
⊢ IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}

tactic: apply Submodule.map_comap_eq_self
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hinv : ↑↑I * ↑↑I⁻¹ = 1
⊢ IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}

tactic: rw [← Submodule.one_eq_range, ← hinv]
state_before: case h
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hinv : ↑↑I * ↑↑I⁻¹ = 1
⊢ ↑↑I * Submodule.span R {v} ≤ LinearMap.range (Algebra.linearMap R A)

tactic: exact Submodule.mul_le_mul_right ((Submodule.span_singleton_le_iff_mem _ _).2 hv)
state_before: case h
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hinv : ↑↑I * ↑↑I⁻¹ = 1
⊢ ↑↑I * Submodule.span R {v} ≤ ↑↑I * ↑↑I⁻¹

tactic: rw [← hJ, h, IsLocalization.coeSubmodule_top, Submodule.mem_one]
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
⊢ 1 ∈ ↑↑I * Submodule.span R {v}

tactic: exact ⟨1, (algebraMap R _).map_one⟩
state_before: R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
⊢ ∃ y, ↑(algebraMap R A) y = 1

tactic: conv_rhs => rw [← hinv, mul_comm]
state_before: case intro.intro.refine'_1
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
this : 1 ∈ ↑↑I * Submodule.span R {v}
w : A
hw : w ∈ ↑↑I
hvw : w * v = 1
⊢ ↑I⁻¹ * spanSingleton S w ≤ 1

tactic: apply FractionalIdeal.mul_le_mul_left (FractionalIdeal.spanSingleton_le_iff_mem.mpr hw)
state_before: case intro.intro.refine'_1
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
this : 1 ∈ ↑↑I * Submodule.span R {v}
w : A
hw : w ∈ ↑↑I
hvw : w * v = 1
⊢ ↑I⁻¹ * spanSingleton S w ≤ ↑I⁻¹ * ↑I

tactic: rw [FractionalIdeal.one_le, ← hvw, mul_comm]
state_before: case intro.intro.refine'_2
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
this : 1 ∈ ↑↑I * Submodule.span R {v}
w : A
hw : w ∈ ↑↑I
hvw : w * v = 1
⊢ 1 ≤ ↑I⁻¹ * spanSingleton S w

tactic: exact FractionalIdeal.mul_mem_mul hv (FractionalIdeal.mem_spanSingleton_self _ _)
state_before: case intro.intro.refine'_2
R✝ : Type ?u.9292
inst✝⁴ : CommRing R✝
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
S : Submonoid R
inst✝ : IsLocalization S A
I : (FractionalIdeal S A)ˣ
v : A
hv : v ∈ ↑I⁻¹
hinv : ↑I * ↑I⁻¹ = 1
J : Submodule R R := Submodule.comap (Algebra.linearMap R A) (↑↑I * Submodule.span R {v})
h : J = ⊤
hJ : IsLocalization.coeSubmodule A J = ↑↑I * Submodule.span R {v}
this : 1 ∈ ↑↑I * Submodule.span R {v}
w : A
hw : w ∈ ↑↑I
hvw : w * v = 1
⊢ v * w ∈ ↑I⁻¹ * spanSingleton S w