Theorem: AlgebraicGeometry.IsClosedImmersion.spec_of_surjective
File: Mathlib/AlgebraicGeometry/Morphisms/ClosedImmersion.lean

tactic: erw [← localRingHom_comp_stalkIso, CommRingCat.coe_comp, CommRingCat.coe_comp]
state_before: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective ⇑(PresheafedSpace.stalkMap (Spec.map f).val x)
state_after: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective
    ((⇑(StructureSheaf.stalkIso (↑S) x).inv ∘
        ⇑(Localization.localRingHom ((PrimeSpectrum.comap f) x).asIdeal x.asIdeal f ⋯)) ∘
      ⇑(StructureSheaf.stalkIso (↑R) ((PrimeSpectrum.comap f) x)).hom)

tactic: apply Function.Surjective.comp (Function.Surjective.comp _ _) _
state_before: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective
    ((⇑(StructureSheaf.stalkIso (↑S) x).inv ∘
        ⇑(Localization.localRingHom ((PrimeSpectrum.comap f) x).asIdeal x.asIdeal f ⋯)) ∘
      ⇑(StructureSheaf.stalkIso (↑R) ((PrimeSpectrum.comap f) x)).hom)
state_after: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective ⇑(StructureSheaf.stalkIso (↑S) x).inv

R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective ⇑(Localization.localRingHom ((PrimeSpectrum.comap f) x).asIdeal x.asIdeal f ⋯)

R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective ⇑(StructureSheaf.stalkIso (↑R) ((PrimeSpectrum.comap f) x)).hom

tactic: exact (ConcreteCategory.bijective_of_isIso (StructureSheaf.stalkIso S x).inv).2
state_before: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective ⇑(StructureSheaf.stalkIso (↑S) x).inv
state_after: no goals

tactic: exact surjective_localRingHom_of_surjective f h x.asIdeal
state_before: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective ⇑(Localization.localRingHom ((PrimeSpectrum.comap f) x).asIdeal x.asIdeal f ⋯)
state_after: no goals

tactic: let g := (StructureSheaf.stalkIso ((CommRingCat.of R))
  ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x)).hom
state_before: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
⊢ Function.Surjective ⇑(StructureSheaf.stalkIso (↑R) ((PrimeSpectrum.comap f) x)).hom
state_after: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
g : (Spec.structureSheaf ↑(CommRingCat.of ↑R)).presheaf.stalk ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x) ⟶
  CommRingCat.of (Localization.AtPrime ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x).asIdeal) :=
  (StructureSheaf.stalkIso (↑(CommRingCat.of ↑R)) ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x)).hom
⊢ Function.Surjective ⇑(StructureSheaf.stalkIso (↑R) ((PrimeSpectrum.comap f) x)).hom

tactic: exact (ConcreteCategory.bijective_of_isIso g).2
state_before: R S : CommRingCat
f : R ⟶ S
h : Function.Surjective ⇑f
x : ↑↑(Spec S).toPresheafedSpace
g : (Spec.structureSheaf ↑(CommRingCat.of ↑R)).presheaf.stalk ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x) ⟶
  CommRingCat.of (Localization.AtPrime ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x).asIdeal) :=
  (StructureSheaf.stalkIso (↑(CommRingCat.of ↑R)) ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x)).hom
⊢ Function.Surjective ⇑(StructureSheaf.stalkIso (↑R) ((PrimeSpectrum.comap f) x)).hom
state_after: no goals