-- Mathlib/RingTheory/Localization/Submodule.lean
theorem coeSubmodule_isPrincipal {I : Ideal R} (h : M ≤ nonZeroDivisors R) :
    (coeSubmodule S I).IsPrincipal ↔ I.IsPrincipal

Proof state:
case mpr.mk.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : R
hx : I = Submodule.span R {x}
⊢ (coeSubmodule S I).IsPrincipal

Tactic:
refine ⟨⟨algebraMap R S x, ?_⟩⟩

Result:
case mpr.mk.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : R
hx : I = Submodule.span R {x}
⊢ coeSubmodule S I = Submodule.span R {(algebraMap R S) x}

Proof state:
case mp.mk.intro.intro.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : R
left✝ : x ∈ I
hx : coeSubmodule S I = Submodule.span R {(algebraMap R S) x}
x_mem : (algebraMap R S) x ∈ coeSubmodule S I
⊢ coeSubmodule S I = coeSubmodule S (Submodule.span R {x})

Tactic:
rw [Ideal.submodule_span_eq, hx, coeSubmodule_span_singleton]

Result:
no goals

Proof state:
case mp.mk.intro.intro.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : R
left✝ : x ∈ I
hx : coeSubmodule S I = Submodule.span R {(algebraMap R S) x}
x_mem : (algebraMap R S) x ∈ coeSubmodule S I
⊢ Submodule.IsPrincipal I

Tactic:
refine ⟨⟨x, coeSubmodule_injective S h ?_⟩⟩

Result:
case mp.mk.intro.intro.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : R
left✝ : x ∈ I
hx : coeSubmodule S I = Submodule.span R {(algebraMap R S) x}
x_mem : (algebraMap R S) x ∈ coeSubmodule S I
⊢ coeSubmodule S I = coeSubmodule S (Submodule.span R {x})

Proof state:
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
⊢ (coeSubmodule S I).IsPrincipal ↔ Submodule.IsPrincipal I

Tactic:
constructor <;> rintro ⟨⟨x, hx⟩⟩

Result:
case mp.mk.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : S
hx : coeSubmodule S I = Submodule.span R {x}
⊢ Submodule.IsPrincipal I

case mpr.mk.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : R
hx : I = Submodule.span R {x}
⊢ (coeSubmodule S I).IsPrincipal

Proof state:
case mpr.mk.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : R
hx : I = Submodule.span R {x}
⊢ coeSubmodule S I = Submodule.span R {(algebraMap R S) x}

Tactic:
rw [hx, Ideal.submodule_span_eq, coeSubmodule_span_singleton]

Result:
no goals

Proof state:
case mp.mk.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : S
hx : coeSubmodule S I = Submodule.span R {x}
x_mem : x ∈ coeSubmodule S I
⊢ Submodule.IsPrincipal I

Tactic:
obtain ⟨x, _, rfl⟩ := (mem_coeSubmodule _ _).mp x_mem

Result:
case mp.mk.intro.intro.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : R
left✝ : x ∈ I
hx : coeSubmodule S I = Submodule.span R {(algebraMap R S) x}
x_mem : (algebraMap R S) x ∈ coeSubmodule S I
⊢ Submodule.IsPrincipal I

Proof state:
case mp.mk.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : S
hx : coeSubmodule S I = Submodule.span R {x}
⊢ Submodule.IsPrincipal I

Tactic:
have x_mem : x ∈ coeSubmodule S I := hx.symm ▸ Submodule.mem_span_singleton_self x

Result:
case mp.mk.intro
R : Type u_3
inst✝³ : CommRing R
M : Submonoid R
S : Type u_4
inst✝² : CommRing S
inst✝¹ : Algebra R S
inst✝ : IsLocalization M S
I : Ideal R
h : M ≤ nonZeroDivisors R
x : S
hx : coeSubmodule S I = Submodule.span R {x}
x_mem : x ∈ coeSubmodule S I
⊢ Submodule.IsPrincipal I