Theorem: FractionalIdeal.exists_eq_spanSingleton_mul
File: Mathlib/RingTheory/FractionalIdeal.lean

tactic: obtain ⟨a_inv, nonzero, ha⟩ := I.isFractional
state_before: R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
⊢ ∃ a aI, a ≠ 0 ∧ I = spanSingleton R₁⁰ (↑(algebraMap R₁ K) a)⁻¹ * ↑aI

tactic: have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
state_before: case intro.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
⊢ ∃ a aI, a ≠ 0 ∧ I = spanSingleton R₁⁰ (↑(algebraMap R₁ K) a)⁻¹ * ↑aI

tactic: have map_a_nonzero : algebraMap R₁ K a_inv ≠ 0 :=
  mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
state_before: case intro.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
⊢ ∃ a aI, a ≠ 0 ∧ I = spanSingleton R₁⁰ (↑(algebraMap R₁ K) a)⁻¹ * ↑aI

tactic: refine'
  ⟨a_inv,
    Submodule.comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (algebraMap R₁ K a_inv) * I),
    nonzero, ext fun x => Iff.trans ⟨_, _⟩ mem_singleton_mul.symm⟩
state_before: case intro.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
⊢ ∃ a aI, a ≠ 0 ∧ I = spanSingleton R₁⁰ (↑(algebraMap R₁ K) a)⁻¹ * ↑aI

tactic: intro hx
state_before: case intro.intro.refine'_1
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x : K
⊢ x ∈ I →
    ∃ y',
      y' ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I)) ∧
        x = (↑(algebraMap R₁ K) a_inv)⁻¹ * y'

tactic: obtain ⟨x', hx'⟩ := ha x hx
state_before: case intro.intro.refine'_1
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x : K
hx : x ∈ I
⊢ ∃ y',
    y' ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I)) ∧
      x = (↑(algebraMap R₁ K) a_inv)⁻¹ * y'

tactic: rw [Algebra.smul_def] at hx'
state_before: case intro.intro.refine'_1.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x : K
hx : x ∈ I
x' : R₁
hx' : ↑(algebraMap R₁ K) x' = a_inv • x
⊢ ∃ y',
    y' ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I)) ∧
      x = (↑(algebraMap R₁ K) a_inv)⁻¹ * y'

tactic: refine' ⟨algebraMap R₁ K x', (mem_coeIdeal _).mpr ⟨x', mem_singleton_mul.mpr _, rfl⟩, _⟩
state_before: case intro.intro.refine'_1.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x : K
hx : x ∈ I
x' : R₁
hx' : ↑(algebraMap R₁ K) x' = ↑(algebraMap R₁ K) a_inv * x
⊢ ∃ y',
    y' ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I)) ∧
      x = (↑(algebraMap R₁ K) a_inv)⁻¹ * y'

tactic: exact ⟨x, hx, hx'⟩
state_before: case intro.intro.refine'_1.intro.refine'_1
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x : K
hx : x ∈ I
x' : R₁
hx' : ↑(algebraMap R₁ K) x' = ↑(algebraMap R₁ K) a_inv * x
⊢ ∃ y', y' ∈ I ∧ ↑(Algebra.linearMap R₁ K) x' = ↑(algebraMap R₁ K) a_inv * y'

tactic: rw [hx', ← mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
state_before: case intro.intro.refine'_1.intro.refine'_2
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x : K
hx : x ∈ I
x' : R₁
hx' : ↑(algebraMap R₁ K) x' = ↑(algebraMap R₁ K) a_inv * x
⊢ x = (↑(algebraMap R₁ K) a_inv)⁻¹ * ↑(algebraMap R₁ K) x'

tactic: rintro ⟨y, hy, rfl⟩
state_before: case intro.intro.refine'_2
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x : K
⊢ (∃ y',
      y' ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I)) ∧
        x = (↑(algebraMap R₁ K) a_inv)⁻¹ * y') →
    x ∈ I

tactic: obtain ⟨x', hx', rfl⟩ := (mem_coeIdeal _).mp hy
state_before: case intro.intro.refine'_2.intro.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
y : K
hy : y ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I))
⊢ (↑(algebraMap R₁ K) a_inv)⁻¹ * y ∈ I

tactic: obtain ⟨y', hy', hx'⟩ := mem_singleton_mul.mp hx'
state_before: case intro.intro.refine'_2.intro.intro.intro.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x' : R₁
hx' : x' ∈ comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I)
hy : ↑(algebraMap R₁ K) x' ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I))
⊢ (↑(algebraMap R₁ K) a_inv)⁻¹ * ↑(algebraMap R₁ K) x' ∈ I

tactic: rw [Algebra.linearMap_apply] at hx'
state_before: case intro.intro.refine'_2.intro.intro.intro.intro.intro.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x' : R₁
hx'✝ : x' ∈ comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I)
hy : ↑(algebraMap R₁ K) x' ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I))
y' : K
hy' : y' ∈ I
hx' : ↑(Algebra.linearMap R₁ K) x' = ↑(algebraMap R₁ K) a_inv * y'
⊢ (↑(algebraMap R₁ K) a_inv)⁻¹ * ↑(algebraMap R₁ K) x' ∈ I

tactic: rwa [hx', ← mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
state_before: case intro.intro.refine'_2.intro.intro.intro.intro.intro.intro
R : Type ?u.1535657
inst✝⁷ : CommRing R
S : Submonoid R
P : Type ?u.1535864
inst✝⁶ : CommRing P
inst✝⁵ : Algebra R P
loc : IsLocalization S P
R₁ : Type u_1
inst✝⁴ : CommRing R₁
K : Type u_2
inst✝³ : Field K
inst✝² : Algebra R₁ K
inst✝¹ : IsFractionRing R₁ K
inst✝ : IsDomain R₁
I : FractionalIdeal R₁⁰ K
a_inv : R₁
nonzero✝ : a_inv ∈ R₁⁰
ha : ∀ (b : K), b ∈ ↑I → IsInteger R₁ (a_inv • b)
nonzero : a_inv ≠ 0
map_a_nonzero : ↑(algebraMap R₁ K) a_inv ≠ 0
x' : R₁
hx'✝ : x' ∈ comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I)
hy : ↑(algebraMap R₁ K) x' ∈ ↑(comap (Algebra.linearMap R₁ K) ↑(spanSingleton R₁⁰ (↑(algebraMap R₁ K) a_inv) * I))
y' : K
hy' : y' ∈ I
hx' : ↑(algebraMap R₁ K) x' = ↑(algebraMap R₁ K) a_inv * y'
⊢ (↑(algebraMap R₁ K) a_inv)⁻¹ * ↑(algebraMap R₁ K) x' ∈ I