Theorem: AlgebraicGeometry.Spec.locallyRingedSpaceMap_val
File: Mathlib/AlgebraicGeometry/Spec.lean

Proof steps:
state_before: R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha : IsUnit ((PresheafedSpace.Hom.stalkMap (sheafedSpaceMap f) p) a)
⊢ IsUnit a
state_after: R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha :
  IsUnit
    ((localizationToStalk (↑S) p)
      ((Localization.localRingHom (Ideal.comap f p.asIdeal) p.asIdeal f ⋯)
        ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a)))
⊢ IsUnit a
tactic: erw [← localRingHom_comp_stalkIso_apply] at ha
state_before: R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha :
  IsUnit
    ((localizationToStalk (↑S) p)
      ((Localization.localRingHom (Ideal.comap f p.asIdeal) p.asIdeal f ⋯)
        ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a)))
⊢ IsUnit a
state_after: R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha :
  IsUnit
    ((Localization.localRingHom (Ideal.comap f p.asIdeal) p.asIdeal f ⋯)
      ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a))
⊢ IsUnit a
tactic: replace ha := (isUnit_map_iff (stalkIso S p).inv _).mp ha
state_before: R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha :
  IsUnit
    ((Localization.localRingHom (Ideal.comap f p.asIdeal) p.asIdeal f ⋯)
      ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a))
⊢ IsUnit a
state_after: R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha : IsUnit ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a)
⊢ IsUnit a
tactic: replace ha := IsLocalRingHom.map_nonunit
        (f := (Localization.localRingHom (PrimeSpectrum.comap f p).asIdeal p.asIdeal f _)) _ ha
state_before: R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha : IsUnit ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a)
⊢ IsUnit a
state_after: case h.e'_3.h
R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha : IsUnit ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a)
e_1✝ :
  ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p)) =
    ↑((structureSheaf ↑R).presheaf.stalk ((PrimeSpectrum.comap f) p))
⊢ a = (stalkIso (↑R) ((PrimeSpectrum.comap f) p)).inv ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a)
tactic: convert RingHom.isUnit_map (stalkIso R (PrimeSpectrum.comap f p)).inv ha
state_before: case h.e'_3.h
R S : CommRingCat
f : R ⟶ S
p : ↑↑(locallyRingedSpaceObj S).toPresheafedSpace
a : ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p))
ha : IsUnit ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a)
e_1✝ :
  ↑((locallyRingedSpaceObj R).presheaf.stalk ((sheafedSpaceMap f).base p)) =
    ↑((structureSheaf ↑R).presheaf.stalk ((PrimeSpectrum.comap f) p))
⊢ a = (stalkIso (↑R) ((PrimeSpectrum.comap f) p)).inv ((stalkToFiberRingHom (↑R) ((PrimeSpectrum.comap f) p)) a)
state_after: no goals
tactic: erw [← comp_apply, show stalkToFiberRingHom R _ = (stalkIso _ _).hom from rfl,
        Iso.hom_inv_id, id_apply]