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

Proof steps:
state_before: R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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}) = ⊤
⊢ (↑↑I).IsPrincipal
state_after: R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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
⊢ (↑↑I).IsPrincipal
tactic: have hinv := I.mul_inv
state_before: R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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
⊢ (↑↑I).IsPrincipal
state_after: R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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 = ⊤
⊢ (↑↑I).IsPrincipal
tactic: set J := Submodule.comap (Algebra.linearMap R A) ((I : Submodule R A) * Submodule.span R {v})
state_before: R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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 = ⊤
⊢ (↑↑I).IsPrincipal
state_after: R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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}
⊢ (↑↑I).IsPrincipal
tactic: have hJ : IsLocalization.coeSubmodule A J = ↑I * Submodule.span R {v} := by
    -- Porting note: had to insert `val_eq_coe` into this rewrite.
    -- Arguably this is because `Subtype.ext_iff` is breaking the `FractionalIdeal` API.
    rw [Subtype.ext_iff, val_eq_coe, 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_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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}
⊢ (↑↑I).IsPrincipal
state_after: R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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}
⊢ (↑↑I).IsPrincipal
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_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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}
⊢ (↑↑I).IsPrincipal
state_after: case intro.intro
R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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).IsPrincipal
tactic: obtain ⟨w, hw, hvw⟩ := Submodule.mem_mul_span_singleton.1 this
state_before: case intro.intro
R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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).IsPrincipal
state_after: case intro.intro
R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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 ⟨⟨w, ?_⟩⟩
state_before: case intro.intro
R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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}
state_after: case intro.intro
R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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 [← FractionalIdeal.coe_spanSingleton S, ← inv_inv I, eq_comm]
state_before: case intro.intro
R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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⁻¹⁻¹
state_after: case intro.intro.refine_1
R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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

case intro.intro.refine_2
R✝ : Type u_1
inst✝⁴ : CommRing R✝
R : Type u_2
A : Type u_3
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: refine congr_arg coeToSubmodule (Units.eq_inv_of_mul_eq_one_left (le_antisymm ?_ ?_))