Theorem: AlgebraicGeometry.IsAffineOpen.isLocalization_stalk'
File: Mathlib/AlgebraicGeometry/AffineScheme.lean

Proof steps:
state_before: X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization.AtPrime (↑(X.presheaf.stalk (hU.fromSpec.val.base y))) y.asIdeal
state_after: X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization y.asIdeal.primeCompl ↑((Spec Γ(X, U)).presheaf.stalk y)
tactic: apply
    (@IsLocalization.isLocalization_iff_of_ringEquiv (R := Γ(X, U))
      (S := X.presheaf.stalk (hU.fromSpec.1.base y)) _ y.asIdeal.primeCompl _
      (TopCat.Presheaf.algebra_section_stalk X.presheaf ⟨hU.fromSpec.1.base y, hy⟩) _ _
      (asIso <| hU.fromSpec.stalkMap y).commRingCatIsoToRingEquiv).mpr
state_before: X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization y.asIdeal.primeCompl ↑((Spec Γ(X, U)).presheaf.stalk y)
state_after: case a
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization y.asIdeal.primeCompl ↑((Spec Γ(X, U)).presheaf.stalk y) ↔
    IsLocalization.AtPrime (↑((structureSheaf ↑Γ(X, U)).presheaf.stalk y)) y.asIdeal
tactic: convert StructureSheaf.IsLocalization.to_stalk Γ(X, U) y using 1
state_before: case a
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization y.asIdeal.primeCompl ↑((Spec Γ(X, U)).presheaf.stalk y) ↔
    IsLocalization.AtPrime (↑((structureSheaf ↑Γ(X, U)).presheaf.stalk y)) y.asIdeal
state_after: case a
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization y.asIdeal.primeCompl ↑((Spec Γ(X, U)).presheaf.stalk y) ↔
    IsLocalization y.asIdeal.primeCompl ↑((structureSheaf ↑Γ(X, U)).presheaf.stalk y)
tactic: delta IsLocalization.AtPrime StructureSheaf.stalkAlgebra
state_before: case a
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization y.asIdeal.primeCompl ↑((Spec Γ(X, U)).presheaf.stalk y) ↔
    IsLocalization y.asIdeal.primeCompl ↑((structureSheaf ↑Γ(X, U)).presheaf.stalk y)
state_after: case a
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization y.asIdeal.primeCompl ↑((Spec Γ(X, U)).presheaf.stalk y) =
    IsLocalization y.asIdeal.primeCompl ↑((structureSheaf ↑Γ(X, U)).presheaf.stalk y)
tactic: rw [iff_iff_eq]
state_before: case a
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ IsLocalization y.asIdeal.primeCompl ↑((Spec Γ(X, U)).presheaf.stalk y) =
    IsLocalization y.asIdeal.primeCompl ↑((structureSheaf ↑Γ(X, U)).presheaf.stalk y)
state_after: case a.h.e_6.h.e_i
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ (asIso (Scheme.Hom.stalkMap hU.fromSpec y)).commRingCatIsoToRingEquiv.toRingHom.comp
      (algebraMap ↑Γ(X, U) ↑(X.presheaf.stalk (hU.fromSpec.val.base y))) =
    StructureSheaf.toStalk (↑Γ(X, U)) y
tactic: congr 2
state_before: case a.h.e_6.h.e_i
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ (asIso (Scheme.Hom.stalkMap hU.fromSpec y)).commRingCatIsoToRingEquiv.toRingHom.comp
      (algebraMap ↑Γ(X, U) ↑(X.presheaf.stalk (hU.fromSpec.val.base y))) =
    StructureSheaf.toStalk (↑Γ(X, U)) y
state_after: case a.h.e_6.h.e_i
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ (asIso (Scheme.Hom.stalkMap hU.fromSpec y)).commRingCatIsoToRingEquiv.toRingHom.comp
      (X.presheaf.germ ⟨hU.fromSpec.val.base y, hy⟩) =
    StructureSheaf.toStalk (↑Γ(X, U)) y
tactic: rw [RingHom.algebraMap_toAlgebra]
state_before: case a.h.e_6.h.e_i
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ (asIso (Scheme.Hom.stalkMap hU.fromSpec y)).commRingCatIsoToRingEquiv.toRingHom.comp
      (X.presheaf.germ ⟨hU.fromSpec.val.base y, hy⟩) =
    StructureSheaf.toStalk (↑Γ(X, U)) y
state_after: case a.h.e_6.h.e_i
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ hU.fromSpec.val.c.app (op U) ≫ (Spec Γ(X, U)).presheaf.germ ⟨y, hy⟩ = StructureSheaf.toStalk (↑Γ(X, U)) y
tactic: refine (PresheafedSpace.stalkMap_germ hU.fromSpec.1 _ ⟨_, hy⟩).trans ?_
state_before: case a.h.e_6.h.e_i
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ hU.fromSpec.val.c.app (op U) ≫ (Spec Γ(X, U)).presheaf.germ ⟨y, hy⟩ = StructureSheaf.toStalk (↑Γ(X, U)) y
state_after: case a.h.e_6.h.e_i
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ (Scheme.ΓSpecIso Γ(X, U)).inv ≫ (Spec Γ(X, U)).presheaf.germ ((fun x => ⟨↑x, ⋯⟩) ⟨y, hy⟩) =
    StructureSheaf.toStalk (↑Γ(X, U)) y
tactic: rw [← Scheme.Hom.app, IsAffineOpen.fromSpec_app_self, Category.assoc, TopCat.Presheaf.germ_res]
state_before: case a.h.e_6.h.e_i
X Y : Scheme
U : X.Opens
hU : IsAffineOpen U
f : ↑Γ(X, U)
y : PrimeSpectrum ↑Γ(X, U)
hy : hU.fromSpec.val.base y ∈ U
⊢ (Scheme.ΓSpecIso Γ(X, U)).inv ≫ (Spec Γ(X, U)).presheaf.germ ((fun x => ⟨↑x, ⋯⟩) ⟨y, hy⟩) =
    StructureSheaf.toStalk (↑Γ(X, U)) y
state_after: no goals
tactic: rfl