Theorem: Ideal.exists_ideal_over_prime_of_is_integral'
File: Mathlib/RingTheory/Ideal/Over.lean

tactic: have hP0 : (0 : S) ∉ Algebra.algebraMapSubmonoid S P.primeCompl := by
  rintro ⟨x, ⟨hx, x0⟩⟩
  exact absurd (hP x0) hx
state_before: R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
⊢ ∃ Q, IsPrime Q ∧ comap (algebraMap R S) Q = P

tactic: let Rₚ := Localization P.primeCompl
state_before: R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
⊢ ∃ Q, IsPrime Q ∧ comap (algebraMap R S) Q = P

tactic: let Sₚ := Localization (Algebra.algebraMapSubmonoid S P.primeCompl)
state_before: R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
Rₚ : Type u_1 := Localization (primeCompl P)
⊢ ∃ Q, IsPrime Q ∧ comap (algebraMap R S) Q = P

tactic: letI : IsDomain (Localization (Algebra.algebraMapSubmonoid S P.primeCompl)) :=
  IsLocalization.isDomain_localization (le_nonZeroDivisors_of_noZeroDivisors hP0)
state_before: R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
Rₚ : Type u_1 := Localization (primeCompl P)
Sₚ : Type u_2 := Localization (Algebra.algebraMapSubmonoid S (primeCompl P))
⊢ ∃ Q, IsPrime Q ∧ comap (algebraMap R S) Q = P

tactic: obtain ⟨Qₚ : Ideal Sₚ, Qₚ_maximal⟩ := exists_maximal Sₚ
state_before: R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
Rₚ : Type u_1 := Localization (primeCompl P)
Sₚ : Type u_2 := Localization (Algebra.algebraMapSubmonoid S (primeCompl P))
this : IsDomain (Localization (Algebra.algebraMapSubmonoid S (primeCompl P))) :=
  IsLocalization.isDomain_localization (le_nonZeroDivisors_of_noZeroDivisors hP0)
⊢ ∃ Q, IsPrime Q ∧ comap (algebraMap R S) Q = P

tactic: haveI Qₚ_max : IsMaximal (comap _ Qₚ) :=
  @isMaximal_comap_of_isIntegral_of_isMaximal Rₚ _ Sₚ _ (localizationAlgebra P.primeCompl S)
    (isIntegral_localization H) _ Qₚ_maximal
state_before: case intro
R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
Rₚ : Type u_1 := Localization (primeCompl P)
Sₚ : Type u_2 := Localization (Algebra.algebraMapSubmonoid S (primeCompl P))
this : IsDomain (Localization (Algebra.algebraMapSubmonoid S (primeCompl P))) :=
  IsLocalization.isDomain_localization (le_nonZeroDivisors_of_noZeroDivisors hP0)
Qₚ : Ideal Sₚ
Qₚ_maximal : IsMaximal Qₚ
⊢ ∃ Q, IsPrime Q ∧ comap (algebraMap R S) Q = P

tactic: refine' ⟨comap (algebraMap S Sₚ) Qₚ, ⟨comap_isPrime _ Qₚ, _⟩⟩
state_before: case intro
R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
Rₚ : Type u_1 := Localization (primeCompl P)
Sₚ : Type u_2 := Localization (Algebra.algebraMapSubmonoid S (primeCompl P))
this : IsDomain (Localization (Algebra.algebraMapSubmonoid S (primeCompl P))) :=
  IsLocalization.isDomain_localization (le_nonZeroDivisors_of_noZeroDivisors hP0)
Qₚ : Ideal Sₚ
Qₚ_maximal : IsMaximal Qₚ
Qₚ_max : IsMaximal (comap (algebraMap Rₚ Sₚ) Qₚ)
⊢ ∃ Q, IsPrime Q ∧ comap (algebraMap R S) Q = P

tactic: convert Localization.AtPrime.comap_maximalIdeal (I := P)
state_before: case intro
R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
Rₚ : Type u_1 := Localization (primeCompl P)
Sₚ : Type u_2 := Localization (Algebra.algebraMapSubmonoid S (primeCompl P))
this : IsDomain (Localization (Algebra.algebraMapSubmonoid S (primeCompl P))) :=
  IsLocalization.isDomain_localization (le_nonZeroDivisors_of_noZeroDivisors hP0)
Qₚ : Ideal Sₚ
Qₚ_maximal : IsMaximal Qₚ
Qₚ_max : IsMaximal (comap (algebraMap Rₚ Sₚ) Qₚ)
⊢ comap (algebraMap R S) (comap (algebraMap S Sₚ) Qₚ) = P

tactic: rw [comap_comap, ← LocalRing.eq_maximalIdeal Qₚ_max,
  ←@IsLocalization.map_comp (P := S) (Q := Sₚ) (g := algebraMap R S)
  (M := P.primeCompl) (T := Algebra.algebraMapSubmonoid S P.primeCompl) (S := Rₚ) _
  _ _ _ _ _ (fun p hp => Algebra.mem_algebraMapSubmonoid_of_mem ⟨p, hp⟩) _ _]
state_before: case h.e'_2
R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
Rₚ : Type u_1 := Localization (primeCompl P)
Sₚ : Type u_2 := Localization (Algebra.algebraMapSubmonoid S (primeCompl P))
this : IsDomain (Localization (Algebra.algebraMapSubmonoid S (primeCompl P))) :=
  IsLocalization.isDomain_localization (le_nonZeroDivisors_of_noZeroDivisors hP0)
Qₚ : Ideal Sₚ
Qₚ_maximal : IsMaximal Qₚ
Qₚ_max : IsMaximal (comap (algebraMap Rₚ Sₚ) Qₚ)
⊢ comap (algebraMap R S) (comap (algebraMap S Sₚ) Qₚ) =
    comap (algebraMap R (Localization.AtPrime P)) (LocalRing.maximalIdeal (Localization (primeCompl P)))

tactic: rfl
state_before: case h.e'_2
R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
hP0 : ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)
Rₚ : Type u_1 := Localization (primeCompl P)
Sₚ : Type u_2 := Localization (Algebra.algebraMapSubmonoid S (primeCompl P))
this : IsDomain (Localization (Algebra.algebraMapSubmonoid S (primeCompl P))) :=
  IsLocalization.isDomain_localization (le_nonZeroDivisors_of_noZeroDivisors hP0)
Qₚ : Ideal Sₚ
Qₚ_maximal : IsMaximal Qₚ
Qₚ_max : IsMaximal (comap (algebraMap Rₚ Sₚ) Qₚ)
⊢ comap
      (RingHom.comp
        (IsLocalization.map Sₚ (algebraMap R S)
          (_ :
            ∀ (p : R) (hp : p ∈ primeCompl P),
              ↑(algebraMap R S) ↑{ val := p, property := hp } ∈ Algebra.algebraMapSubmonoid S (primeCompl P)))
        (algebraMap R Rₚ))
      Qₚ =
    comap (algebraMap R (Localization.AtPrime P)) (comap (algebraMap Rₚ Sₚ) Qₚ)

tactic: rintro ⟨x, ⟨hx, x0⟩⟩
state_before: R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
⊢ ¬0 ∈ Algebra.algebraMapSubmonoid S (primeCompl P)

tactic: exact absurd (hP x0) hx
state_before: case intro.intro
R : Type u_1
inst✝⁴ : CommRing R
S : Type u_2
inst✝³ : CommRing S
f : R →+* S
I J : Ideal S
inst✝² : Algebra R S
inst✝¹ : IsDomain S
H : Algebra.IsIntegral R S
P : Ideal R
inst✝ : IsPrime P
hP : RingHom.ker (algebraMap R S) ≤ P
x : R
hx : x ∈ ↑(primeCompl P)
x0 : ↑(algebraMap R S) x = 0
⊢ False