Theorem: isIntegral_localization
File: Mathlib/RingTheory/Localization/Integral.lean

tactic: intro x
state_before: R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
⊢ RingHom.IsIntegral
    (IsLocalization.map Sₘ (algebraMap R S)
      (_ : M ≤ Submonoid.comap (algebraMap R S) (Algebra.algebraMapSubmonoid S M)))

tactic: obtain ⟨⟨s, ⟨u, hu⟩⟩, hx⟩ := surj (Algebra.algebraMapSubmonoid S M) x
state_before: R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
⊢ RingHom.IsIntegralElem
    (IsLocalization.map Sₘ (algebraMap R S)
      (_ : M ≤ Submonoid.comap (algebraMap R S) (Algebra.algebraMapSubmonoid S M)))
    x

tactic: obtain ⟨v, hv⟩ := hu
state_before: case intro.mk.mk
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
hu : u ∈ Algebra.algebraMapSubmonoid S M
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := hu }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := hu }).fst
⊢ RingHom.IsIntegralElem
    (IsLocalization.map Sₘ (algebraMap R S)
      (_ : M ≤ Submonoid.comap (algebraMap R S) (Algebra.algebraMapSubmonoid S M)))
    x

tactic: obtain ⟨v', hv'⟩ := isUnit_iff_exists_inv'.1 (map_units Rₘ ⟨v, hv.1⟩)
state_before: case intro.mk.mk.intro
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
v : R
hv : v ∈ ↑M ∧ ↑(algebraMap R S) v = u
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).fst
⊢ RingHom.IsIntegralElem
    (IsLocalization.map Sₘ (algebraMap R S)
      (_ : M ≤ Submonoid.comap (algebraMap R S) (Algebra.algebraMapSubmonoid S M)))
    x

tactic: refine'
  @isIntegral_of_isIntegral_mul_unit Rₘ _ _ _ (localizationAlgebra M S) x (algebraMap S Sₘ u) v' _
    _
state_before: case intro.mk.mk.intro.intro
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
v : R
hv : v ∈ ↑M ∧ ↑(algebraMap R S) v = u
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).fst
v' : Rₘ
hv' : v' * ↑(algebraMap R Rₘ) ↑{ val := v, property := (_ : v ∈ ↑M) } = 1
⊢ RingHom.IsIntegralElem
    (IsLocalization.map Sₘ (algebraMap R S)
      (_ : M ≤ Submonoid.comap (algebraMap R S) (Algebra.algebraMapSubmonoid S M)))
    x

tactic: replace hv' := congr_arg (@algebraMap Rₘ Sₘ _ _ (localizationAlgebra M S)) hv'
state_before: case intro.mk.mk.intro.intro.refine'_1
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
v : R
hv : v ∈ ↑M ∧ ↑(algebraMap R S) v = u
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).fst
v' : Rₘ
hv' : v' * ↑(algebraMap R Rₘ) ↑{ val := v, property := (_ : v ∈ ↑M) } = 1
⊢ ↑(algebraMap Rₘ Sₘ) v' * ↑(algebraMap S Sₘ) u = 1

tactic: rw [RingHom.map_mul, RingHom.map_one, ← RingHom.comp_apply _ (algebraMap R Rₘ)] at hv'
state_before: case intro.mk.mk.intro.intro.refine'_1
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
v : R
hv : v ∈ ↑M ∧ ↑(algebraMap R S) v = u
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).fst
v' : Rₘ
hv' : ↑(algebraMap Rₘ Sₘ) (v' * ↑(algebraMap R Rₘ) ↑{ val := v, property := (_ : v ∈ ↑M) }) = ↑(algebraMap Rₘ Sₘ) 1
⊢ ↑(algebraMap Rₘ Sₘ) v' * ↑(algebraMap S Sₘ) u = 1

tactic: erw [IsLocalization.map_comp
  (show _ ≤ (Algebra.algebraMapSubmonoid S M).comap _ from M.le_comap_map)] at hv'
state_before: case intro.mk.mk.intro.intro.refine'_1
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
v : R
hv : v ∈ ↑M ∧ ↑(algebraMap R S) v = u
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).fst
v' : Rₘ
hv' :
  ↑(algebraMap Rₘ Sₘ) v' *
      ↑(RingHom.comp (algebraMap Rₘ Sₘ) (algebraMap R Rₘ)) ↑{ val := v, property := (_ : v ∈ ↑M) } =
    1
⊢ ↑(algebraMap Rₘ Sₘ) v' * ↑(algebraMap S Sₘ) u = 1

tactic: exact hv.2 ▸ hv'
state_before: case intro.mk.mk.intro.intro.refine'_1
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
v : R
hv : v ∈ ↑M ∧ ↑(algebraMap R S) v = u
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).fst
v' : Rₘ
hv' :
  ↑(algebraMap Rₘ Sₘ) v' * ↑(RingHom.comp (algebraMap S Sₘ) (algebraMap R S)) ↑{ val := v, property := (_ : v ∈ ↑M) } =
    1
⊢ ↑(algebraMap Rₘ Sₘ) v' * ↑(algebraMap S Sₘ) u = 1

tactic: obtain ⟨p, hp⟩ := H s
state_before: case intro.mk.mk.intro.intro.refine'_2
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
v : R
hv : v ∈ ↑M ∧ ↑(algebraMap R S) v = u
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).fst
v' : Rₘ
hv' : v' * ↑(algebraMap R Rₘ) ↑{ val := v, property := (_ : v ∈ ↑M) } = 1
⊢ IsIntegral Rₘ (x * ↑(algebraMap S Sₘ) u)

tactic: exact hx.symm ▸ is_integral_localization_at_leadingCoeff p hp.2 (hp.1.symm ▸ M.one_mem)
state_before: case intro.mk.mk.intro.intro.refine'_2.intro
R : Type u_1
inst✝⁹ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
P : Type ?u.284769
inst✝⁶ : CommRing P
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁵ : CommRing Rₘ
inst✝⁴ : CommRing Sₘ
inst✝³ : Algebra R Rₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : Algebra S Sₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
H : Algebra.IsIntegral R S
x : Sₘ
s u : S
v : R
hv : v ∈ ↑M ∧ ↑(algebraMap R S) v = u
hx :
  x * ↑(algebraMap S Sₘ) ↑(s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).snd =
    ↑(algebraMap S Sₘ) (s, { val := u, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = u) }).fst
v' : Rₘ
hv' : v' * ↑(algebraMap R Rₘ) ↑{ val := v, property := (_ : v ∈ ↑M) } = 1
p : R[X]
hp : Monic p ∧ eval₂ (algebraMap R S) s p = 0
⊢ IsIntegral Rₘ (x * ↑(algebraMap S Sₘ) u)