[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ ¬r ∈ (toΓSpecFun X x).asIdeal ↔ IsUnit (↑(ΓToStalk X x) r)
[PROOFSTEP]
erw [LocalRing.mem_maximalIdeal, Classical.not_not]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ toΓSpecFun X ⁻¹' (basicOpen r).carrier = (RingedSpace.basicOpen (toRingedSpace X) r).carrier
[PROOFSTEP]
ext
[GOAL]
case h
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x✝ : ↑(toTopCat X)
⊢ x✝ ∈ toΓSpecFun X ⁻¹' (basicOpen r).carrier ↔ x✝ ∈ (RingedSpace.basicOpen (toRingedSpace X) r).carrier
[PROOFSTEP]
erw [X.toRingedSpace.mem_top_basicOpen]
[GOAL]
case h
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x✝ : ↑(toTopCat X)
⊢ x✝ ∈ toΓSpecFun X ⁻¹' (basicOpen r).carrier ↔
    IsUnit (↑(germ (toRingedSpace X).toPresheafedSpace.presheaf { val := x✝, property := (_ : x✝ ∈ ⊤) }) r)
[PROOFSTEP]
apply not_mem_prime_iff_unit_in_stalk
[GOAL]
X : LocallyRingedSpace
⊢ Continuous (toΓSpecFun X)
[PROOFSTEP]
apply isTopologicalBasis_basic_opens.continuous
[GOAL]
case hf
X : LocallyRingedSpace
⊢ ∀ (s : Set (PrimeSpectrum ↑(Γ.obj (op X)))), (s ∈ Set.range fun r => ↑(basicOpen r)) → IsOpen (toΓSpecFun X ⁻¹' s)
[PROOFSTEP]
rintro _ ⟨r, rfl⟩
[GOAL]
case hf.intro
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ IsOpen (toΓSpecFun X ⁻¹' (fun r => ↑(basicOpen r)) r)
[PROOFSTEP]
erw [X.toΓSpec_preim_basicOpen_eq r]
[GOAL]
case hf.intro
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ IsOpen (RingedSpace.basicOpen (toRingedSpace X) r).carrier
[PROOFSTEP]
exact (X.toRingedSpace.basicOpen r).2
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ IsUnit (↑(toToΓSpecMapBasicOpen X r) r)
[PROOFSTEP]
convert
  (X.presheaf.map <| (eqToHom <| X.toΓSpecMapBasicOpen_eq r).op).isUnit_map
    (X.toRingedSpace.isUnit_res_basicOpen r)
      -- Porting note : `rw [comp_apply]` to `erw [comp_apply]`
[GOAL]
case h.e'_3
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ ↑(toToΓSpecMapBasicOpen X r) r =
    ↑(X.presheaf.map (eqToHom (_ : toΓSpecMapBasicOpen X r = RingedSpace.basicOpen (toRingedSpace X) r)).op)
      (↑((toRingedSpace X).toPresheafedSpace.presheaf.map
            (homOfLE (_ : RingedSpace.basicOpen (toRingedSpace X) r ≤ ⊤)).op)
        r)
[PROOFSTEP]
erw [← comp_apply, ← Functor.map_comp]
[GOAL]
case h.e'_3
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ ↑(toToΓSpecMapBasicOpen X r) r =
    ↑((toRingedSpace X).toPresheafedSpace.presheaf.map
          ((homOfLE (_ : RingedSpace.basicOpen (toRingedSpace X) r ≤ ⊤)).op ≫
            (eqToHom (_ : toΓSpecMapBasicOpen X r = RingedSpace.basicOpen (toRingedSpace X) r)).op))
      r
[PROOFSTEP]
congr
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
f : (structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X r))
⊢ toOpen (↑(Γ.obj (op X))) (basicOpen r) ≫ f = toToΓSpecMapBasicOpen X r ↔ f = toΓSpecCApp X r
[PROOFSTEP]
have loc_inst := IsLocalization.to_basicOpen (Γ.obj (op X)) r
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
f : (structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X r))
loc_inst : IsLocalization.Away r ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))
⊢ toOpen (↑(Γ.obj (op X))) (basicOpen r) ≫ f = toToΓSpecMapBasicOpen X r ↔ f = toΓSpecCApp X r
[PROOFSTEP]
rw [← @IsLocalization.Away.AwayMap.lift_comp _ _ _ _ _ _ _ r loc_inst _ (X.isUnit_res_toΓSpecMapBasicOpen r)]
  --pick_goal 5; exact is_localization.to_basic_open _ r
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
f : (structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X r))
loc_inst : IsLocalization.Away r ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))
⊢ toOpen (↑(Γ.obj (op X))) (basicOpen r) ≫ f =
      RingHom.comp (IsLocalization.Away.lift r (_ : IsUnit (↑(toToΓSpecMapBasicOpen X r) r)))
        (algebraMap ↑(Γ.obj (op X)) ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))) ↔
    f = toΓSpecCApp X r
[PROOFSTEP]
constructor
[GOAL]
case mp
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
f : (structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X r))
loc_inst : IsLocalization.Away r ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))
⊢ toOpen (↑(Γ.obj (op X))) (basicOpen r) ≫ f =
      RingHom.comp (IsLocalization.Away.lift r (_ : IsUnit (↑(toToΓSpecMapBasicOpen X r) r)))
        (algebraMap ↑(Γ.obj (op X)) ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))) →
    f = toΓSpecCApp X r
[PROOFSTEP]
intro h
[GOAL]
case mp
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
f : (structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X r))
loc_inst : IsLocalization.Away r ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))
h :
  toOpen (↑(Γ.obj (op X))) (basicOpen r) ≫ f =
    RingHom.comp (IsLocalization.Away.lift r (_ : IsUnit (↑(toToΓSpecMapBasicOpen X r) r)))
      (algebraMap ↑(Γ.obj (op X)) ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r))))
⊢ f = toΓSpecCApp X r
[PROOFSTEP]
refine' @IsLocalization.ringHom_ext _ _ _ _ _ _ _ _ loc_inst _ _ _
[GOAL]
case mp
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
f : (structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X r))
loc_inst : IsLocalization.Away r ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))
h :
  toOpen (↑(Γ.obj (op X))) (basicOpen r) ≫ f =
    RingHom.comp (IsLocalization.Away.lift r (_ : IsUnit (↑(toToΓSpecMapBasicOpen X r) r)))
      (algebraMap ↑(Γ.obj (op X)) ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r))))
⊢ RingHom.comp f (algebraMap ↑(Γ.obj (op X)) ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))) =
    RingHom.comp (toΓSpecCApp X r)
      (algebraMap ↑(Γ.obj (op X)) ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r))))
[PROOFSTEP]
exact h
[GOAL]
case mpr
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
f : (structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X r))
loc_inst : IsLocalization.Away r ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r)))
⊢ f = toΓSpecCApp X r →
    toOpen (↑(Γ.obj (op X))) (basicOpen r) ≫ f =
      RingHom.comp (IsLocalization.Away.lift r (_ : IsUnit (↑(toToΓSpecMapBasicOpen X r) r)))
        (algebraMap ↑(Γ.obj (op X)) ↑((structureSheaf ↑(Γ.obj (op X))).val.obj (op (basicOpen r))))
[PROOFSTEP]
apply congr_arg
[GOAL]
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
r s : (InducedCategory (Opens (PrimeSpectrum ↑(Γ.obj (op X)))) basicOpen)ᵒᵖ
f : r ⟶ s
⊢ ((inducedFunctor basicOpen).op ⋙ (structureSheaf ↑(Γ.obj (op X))).val).map f ≫ (fun r => toΓSpecCApp X r.unop) s =
    (fun r => toΓSpecCApp X r.unop) r ≫
      ((inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)).val).map f
[PROOFSTEP]
apply (StructureSheaf.to_basicOpen_epi (Γ.obj (op X)) r.unop).1
[GOAL]
case a
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
r s : (InducedCategory (Opens (PrimeSpectrum ↑(Γ.obj (op X)))) basicOpen)ᵒᵖ
f : r ⟶ s
⊢ toOpen (↑(Γ.obj (op X))) (basicOpen r.unop) ≫
      ((inducedFunctor basicOpen).op ⋙ (structureSheaf ↑(Γ.obj (op X))).val).map f ≫ (fun r => toΓSpecCApp X r.unop) s =
    toOpen (↑(Γ.obj (op X))) (basicOpen r.unop) ≫
      (fun r => toΓSpecCApp X r.unop) r ≫
        ((inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)).val).map f
[PROOFSTEP]
simp only [← Category.assoc]
[GOAL]
case a
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
r s : (InducedCategory (Opens (PrimeSpectrum ↑(Γ.obj (op X)))) basicOpen)ᵒᵖ
f : r ⟶ s
⊢ (toOpen (↑(Γ.obj (op X))) (basicOpen r.unop) ≫
        ((inducedFunctor basicOpen).op ⋙ (structureSheaf ↑(Γ.obj (op X))).val).map f) ≫
      toΓSpecCApp X s.unop =
    (toOpen (↑(Γ.obj (op X))) (basicOpen r.unop) ≫ toΓSpecCApp X r.unop) ≫
      ((inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)).val).map f
[PROOFSTEP]
erw [X.toΓSpecCApp_spec r.unop]
[GOAL]
case a
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
r s : (InducedCategory (Opens (PrimeSpectrum ↑(Γ.obj (op X)))) basicOpen)ᵒᵖ
f : r ⟶ s
⊢ (toOpen (↑(Γ.obj (op X))) (basicOpen r.unop) ≫
        ((inducedFunctor basicOpen).op ⋙ (structureSheaf ↑(Γ.obj (op X))).val).map f) ≫
      toΓSpecCApp X s.unop =
    toToΓSpecMapBasicOpen X r.unop ≫
      ((inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)).val).map f
[PROOFSTEP]
convert X.toΓSpecCApp_spec s.unop
[GOAL]
case h.e'_3.h
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
r s : (InducedCategory (Opens (PrimeSpectrum ↑(Γ.obj (op X)))) basicOpen)ᵒᵖ
f : r ⟶ s
e_1✝ :
  (CommRingCat.of ↑(Γ.obj (op X)) ⟶
      ((inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)).val).obj s) =
    (CommRingCat.of ↑(Γ.obj (op X)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X s.unop)))
⊢ toToΓSpecMapBasicOpen X r.unop ≫
      ((inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)).val).map f =
    toToΓSpecMapBasicOpen X s.unop
[PROOFSTEP]
symm
[GOAL]
case h.e'_3.h
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
r s : (InducedCategory (Opens (PrimeSpectrum ↑(Γ.obj (op X)))) basicOpen)ᵒᵖ
f : r ⟶ s
e_1✝ :
  (CommRingCat.of ↑(Γ.obj (op X)) ⟶
      ((inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)).val).obj s) =
    (CommRingCat.of ↑(Γ.obj (op X)) ⟶ X.presheaf.obj (op (toΓSpecMapBasicOpen X s.unop)))
⊢ toToΓSpecMapBasicOpen X s.unop =
    toToΓSpecMapBasicOpen X r.unop ≫
      ((inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)).val).map f
[PROOFSTEP]
apply X.presheaf.map_comp
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ NatTrans.app (toΓSpecSheafedSpace X).c (op (basicOpen r)) = toΓSpecCApp X r
[PROOFSTEP]
have :=
  TopCat.Sheaf.extend_hom_app (Spec.toSheafedSpace.obj (op (Γ.obj (op X)))).presheaf
    ((TopCat.Sheaf.pushforward X.toΓSpecBase).obj X.𝒪) isBasis_basic_opens X.toΓSpecCBasicOpens r
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
this :
  NatTrans.app
      (↑(TopCat.Sheaf.restrictHomEquivHom (Spec.toSheafedSpace.obj (op (Γ.obj (op X)))).presheaf
            ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)) (_ : Opens.IsBasis (Set.range basicOpen)))
        (toΓSpecCBasicOpens X))
      (op (basicOpen r)) =
    NatTrans.app (toΓSpecCBasicOpens X) (op r)
⊢ NatTrans.app (toΓSpecSheafedSpace X).c (op (basicOpen r)) = toΓSpecCApp X r
[PROOFSTEP]
dsimp at this
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
this :
  NatTrans.app
      (↑(TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)) (_ : Opens.IsBasis (Set.range basicOpen)))
        (toΓSpecCBasicOpens X))
      (op (basicOpen r)) =
    toΓSpecCApp X r
⊢ NatTrans.app (toΓSpecSheafedSpace X).c (op (basicOpen r)) = toΓSpecCApp X r
[PROOFSTEP]
rw [← this]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
this :
  NatTrans.app
      (↑(TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)) (_ : Opens.IsBasis (Set.range basicOpen)))
        (toΓSpecCBasicOpens X))
      (op (basicOpen r)) =
    toΓSpecCApp X r
⊢ NatTrans.app (toΓSpecSheafedSpace X).c (op (basicOpen r)) =
    NatTrans.app
      (↑(TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)) (_ : Opens.IsBasis (Set.range basicOpen)))
        (toΓSpecCBasicOpens X))
      (op (basicOpen r))
[PROOFSTEP]
dsimp
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
this :
  NatTrans.app
      (↑(TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)) (_ : Opens.IsBasis (Set.range basicOpen)))
        (toΓSpecCBasicOpens X))
      (op (basicOpen r)) =
    toΓSpecCApp X r
⊢ NatTrans.app
      (↑(TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)) (_ : Opens.IsBasis (Set.range basicOpen)))
        (toΓSpecCBasicOpens X))
      (op (basicOpen r)) =
    NatTrans.app
      (↑(TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward (toΓSpecBase X)).obj (𝒪 X)) (_ : Opens.IsBasis (Set.range basicOpen)))
        (toΓSpecCBasicOpens X))
      (op (basicOpen r))
[PROOFSTEP]
congr
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ toStalk (↑(op (Γ.obj (op X))).unop) (↑(toΓSpecSheafedSpace X).base x) ≫
      PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x =
    ΓToStalk X x
[PROOFSTEP]
rw [PresheafedSpace.stalkMap]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ toStalk (↑(op (Γ.obj (op X))).unop) (↑(toΓSpecSheafedSpace X).base x) ≫
      (stalkFunctor CommRingCat (↑(toΓSpecSheafedSpace X).base x)).map (toΓSpecSheafedSpace X).c ≫
        stalkPushforward CommRingCat (toΓSpecSheafedSpace X).base X.presheaf x =
    ΓToStalk X x
[PROOFSTEP]
erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X))) ⟨X.toΓSpecFun x, by rw [basicOpen_one]; trivial⟩]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ toΓSpecFun X x ∈ basicOpen 1
[PROOFSTEP]
rw [basicOpen_one]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ toΓSpecFun X x ∈ ⊤
[PROOFSTEP]
trivial
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ (toOpen (↑(Γ.obj (op X))) (basicOpen 1) ≫
        germ (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X))))
          { val := toΓSpecFun X x, property := (_ : toΓSpecFun X x ∈ basicOpen 1) }) ≫
      (stalkFunctor CommRingCat (↑(toΓSpecSheafedSpace X).base x)).map (toΓSpecSheafedSpace X).c ≫
        stalkPushforward CommRingCat (toΓSpecSheafedSpace X).base X.presheaf x =
    ΓToStalk X x
[PROOFSTEP]
rw [← Category.assoc, Category.assoc (toOpen _ _)]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ (toOpen (↑(Γ.obj (op X))) (basicOpen 1) ≫
        germ (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X))))
            { val := toΓSpecFun X x, property := (_ : toΓSpecFun X x ∈ basicOpen 1) } ≫
          (stalkFunctor CommRingCat (↑(toΓSpecSheafedSpace X).base x)).map (toΓSpecSheafedSpace X).c) ≫
      stalkPushforward CommRingCat (toΓSpecSheafedSpace X).base X.presheaf x =
    ΓToStalk X x
[PROOFSTEP]
erw [stalkFunctor_map_germ]
  -- Porting note : was `rw [←assoc, toΓSpecSheafedSpace_app_spec]`, but Lean did not like it.
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ (toOpen (↑(Γ.obj (op X))) (basicOpen 1) ≫
        NatTrans.app (toΓSpecSheafedSpace X).c (op (basicOpen 1)) ≫
          germ ((toΓSpecSheafedSpace X).base _* X.presheaf)
            { val := toΓSpecFun X x, property := (_ : toΓSpecFun X x ∈ basicOpen 1) }) ≫
      stalkPushforward CommRingCat (toΓSpecSheafedSpace X).base X.presheaf x =
    ΓToStalk X x
[PROOFSTEP]
rw [toΓSpecSheafedSpace_app_spec_assoc]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ (toToΓSpecMapBasicOpen X 1 ≫
        germ ((toΓSpecSheafedSpace X).base _* X.presheaf)
          { val := toΓSpecFun X x, property := (_ : toΓSpecFun X x ∈ basicOpen 1) }) ≫
      stalkPushforward CommRingCat (toΓSpecSheafedSpace X).base X.presheaf x =
    ΓToStalk X x
[PROOFSTEP]
unfold ΓToStalk
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ (toToΓSpecMapBasicOpen X 1 ≫
        germ ((toΓSpecSheafedSpace X).base _* X.presheaf)
          { val := toΓSpecFun X x, property := (_ : toΓSpecFun X x ∈ basicOpen 1) }) ≫
      stalkPushforward CommRingCat (toΓSpecSheafedSpace X).base X.presheaf x =
    germ X.presheaf { val := x, property := trivial }
[PROOFSTEP]
rw [← stalkPushforward_germ _ X.toΓSpecBase X.presheaf ⊤]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ (toToΓSpecMapBasicOpen X 1 ≫
        germ ((toΓSpecSheafedSpace X).base _* X.presheaf)
          { val := toΓSpecFun X x, property := (_ : toΓSpecFun X x ∈ basicOpen 1) }) ≫
      stalkPushforward CommRingCat (toΓSpecSheafedSpace X).base X.presheaf x =
    germ (toΓSpecBase X _* X.presheaf)
        { val := ↑(toΓSpecBase X) ↑{ val := x, property := trivial },
          property := (_ : ↑{ val := x, property := trivial } ∈ (Opens.map (toΓSpecBase X)).obj ⊤) } ≫
      stalkPushforward CommRingCat (toΓSpecBase X) X.presheaf ↑{ val := x, property := trivial }
[PROOFSTEP]
congr 1
[GOAL]
case e_a
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ toToΓSpecMapBasicOpen X 1 ≫
      germ ((toΓSpecSheafedSpace X).base _* X.presheaf)
        { val := toΓSpecFun X x, property := (_ : toΓSpecFun X x ∈ basicOpen 1) } =
    germ (toΓSpecBase X _* X.presheaf)
      { val := ↑(toΓSpecBase X) ↑{ val := x, property := trivial },
        property := (_ : ↑{ val := x, property := trivial } ∈ (Opens.map (toΓSpecBase X)).obj ⊤) }
[PROOFSTEP]
change (X.toΓSpecBase _* X.presheaf).map le_top.hom.op ≫ _ = _
[GOAL]
case e_a
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ (toΓSpecBase X _* X.presheaf).map
        (LE.le.hom
            (_ :
              { carrier := {x | ¬1 ∈ x.asIdeal}, is_open' := (_ : ∃ y, zeroLocus y = {x | ¬1 ∈ x.asIdeal}ᶜ) } ≤ ⊤)).op ≫
      germ ((toΓSpecSheafedSpace X).base _* X.presheaf)
        { val := toΓSpecFun X x, property := (_ : toΓSpecFun X x ∈ basicOpen 1) } =
    germ (toΓSpecBase X _* X.presheaf)
      { val := ↑(toΓSpecBase X) ↑{ val := x, property := trivial },
        property := (_ : ↑{ val := x, property := trivial } ∈ (Opens.map (toΓSpecBase X)).obj ⊤) }
[PROOFSTEP]
apply germ_res
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ ∀ (x : ↑↑X.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x)
[PROOFSTEP]
intro x
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x)
[PROOFSTEP]
let p : PrimeSpectrum (Γ.obj (op X)) := X.toΓSpecFun x
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x)
[PROOFSTEP]
constructor
  -- show stalk map is local hom ↓
[GOAL]
case map_nonunit
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
⊢ ∀
    (a :
      ↑(PresheafedSpace.stalk (Spec.locallyRingedSpaceObj (Γ.obj (op X))).toSheafedSpace.toPresheafedSpace
          (↑(toΓSpecSheafedSpace X).base x))),
    IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) a) → IsUnit a
[PROOFSTEP]
let S := (structureSheaf _).presheaf.stalk p
[GOAL]
case map_nonunit
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
⊢ ∀
    (a :
      ↑(PresheafedSpace.stalk (Spec.locallyRingedSpaceObj (Γ.obj (op X))).toSheafedSpace.toPresheafedSpace
          (↑(toΓSpecSheafedSpace X).base x))),
    IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) a) → IsUnit a
[PROOFSTEP]
rintro (t : S) ht
[GOAL]
case map_nonunit
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
⊢ IsUnit t
[PROOFSTEP]
obtain ⟨⟨r, s⟩, he⟩ := IsLocalization.surj p.asIdeal.primeCompl t
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
he : t * ↑(algebraMap ↑(Γ.obj (op X)) ↑S) ↑(r, s).snd = ↑(algebraMap ↑(Γ.obj (op X)) ↑S) (r, s).fst
⊢ IsUnit t
[PROOFSTEP]
dsimp at he
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
he :
  t * ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s =
    ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ IsUnit t
[PROOFSTEP]
set t' := _
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
he :
  t * ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s =
    ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
t' : ?m.142259 := ?m.142260
⊢ IsUnit t
[PROOFSTEP]
change t * t' = _ at he
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ IsUnit t
[PROOFSTEP]
apply isUnit_of_mul_isUnit_left (y := t')
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ IsUnit (t * t')
[PROOFSTEP]
rw [he]
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ IsUnit (↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r)
[PROOFSTEP]
refine' IsLocalization.map_units S (⟨r, _⟩ : p.asIdeal.primeCompl)
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ r ∈ Ideal.primeCompl p.asIdeal
[PROOFSTEP]
apply (not_mem_prime_iff_unit_in_stalk _ _ _).mpr
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ IsUnit (↑(ΓToStalk X x) r)
[PROOFSTEP]
rw [← toStalk_stalkMap_toΓSpec]
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ IsUnit
    (↑(toStalk (↑(op (Γ.obj (op X))).unop) (↑(toΓSpecSheafedSpace X).base x) ≫
          PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x)
      r)
[PROOFSTEP]
erw [comp_apply, ← he]
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) (t * t'))
[PROOFSTEP]
rw [RingHom.map_mul]
  -- Porting note : `IsLocalization.map_units` and the goal needs to be simplified before Lean
      -- realize it is useful
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
⊢ IsUnit
    (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t * ↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t')
[PROOFSTEP]
have := IsLocalization.map_units (R := Γ.obj (op X)) S s
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
this : IsUnit (↑(algebraMap ↑(Γ.obj (op X)) ↑S) ↑s)
⊢ IsUnit
    (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t * ↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t')
[PROOFSTEP]
dsimp at this ⊢
[GOAL]
case map_nonunit.intro.mk
X : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X))
x : ↑↑X.toPresheafedSpace
p : PrimeSpectrum ↑(Γ.obj (op X)) := toΓSpecFun X x
S : CommRingCat := TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(Γ.obj (op X)))) p
t : ↑S
ht : IsUnit (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t)
r : ↑(Γ.obj (op X))
s : { x // x ∈ Ideal.primeCompl p.asIdeal }
t' : ↑S := ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s
he : t * t' = ↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) r
this : IsUnit (↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s)
⊢ IsUnit
    (↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) t *
      ↑(PresheafedSpace.stalkMap (toΓSpecSheafedSpace X) x) (↑(toStalk (↑(X.presheaf.obj (op ⊤))) (toΓSpecFun X x)) ↑s))
[PROOFSTEP]
refine ht.mul <| this.map _
[GOAL]
X✝ : LocallyRingedSpace
r : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
w : (toΓSpec X).val.base ≫ (Spec.locallyRingedSpaceMap f).val.base = β.val.base
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
⊢ toΓSpec X ≫ Spec.locallyRingedSpaceMap f = β
[PROOFSTEP]
ext1
  -- Porting note : need more hand holding here
[GOAL]
case h
X✝ : LocallyRingedSpace
r : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
w : (toΓSpec X).val.base ≫ (Spec.locallyRingedSpaceMap f).val.base = β.val.base
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
⊢ (toΓSpec X ≫ Spec.locallyRingedSpaceMap f).val = β.val
[PROOFSTEP]
change (X.toΓSpec.1 ≫ _).base = _ at w
[GOAL]
case h
X✝ : LocallyRingedSpace
r : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
w : ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base = β.val.base
⊢ (toΓSpec X ≫ Spec.locallyRingedSpaceMap f).val = β.val
[PROOFSTEP]
apply Spec.basicOpen_hom_ext w
[GOAL]
case h
X✝ : LocallyRingedSpace
r : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
w : ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base = β.val.base
⊢ ∀ (r : ↑R),
    let U := basicOpen r;
    (toOpen (↑R) U ≫ NatTrans.app ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).c (op U)) ≫
        X.presheaf.map
          (eqToHom
            (_ :
              (Opens.map ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base).op.obj (op U) =
                (Opens.map β.val.base).op.obj (op U))) =
      toOpen (↑R) U ≫ NatTrans.app β.val.c (op U)
[PROOFSTEP]
intro r U
[GOAL]
case h
X✝ : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
w : ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base = β.val.base
r : ↑R
U : Opens (PrimeSpectrum ↑R) := basicOpen r
⊢ (toOpen (↑R) U ≫ NatTrans.app ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).c (op U)) ≫
      X.presheaf.map
        (eqToHom
          (_ :
            (Opens.map ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base).op.obj (op U) =
              (Opens.map β.val.base).op.obj (op U))) =
    toOpen (↑R) U ≫ NatTrans.app β.val.c (op U)
[PROOFSTEP]
erw [LocallyRingedSpace.comp_val_c_app]
[GOAL]
case h
X✝ : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
w : ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base = β.val.base
r : ↑R
U : Opens (PrimeSpectrum ↑R) := basicOpen r
⊢ (toOpen (↑R) U ≫
        NatTrans.app (Spec.locallyRingedSpaceMap f).val.c (op U) ≫
          NatTrans.app (toΓSpec X).val.c (op ((Opens.map (Spec.locallyRingedSpaceMap f).val.base).obj (op U).unop))) ≫
      X.presheaf.map
        (eqToHom
          (_ :
            (Opens.map ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base).op.obj (op U) =
              (Opens.map β.val.base).op.obj (op U))) =
    toOpen (↑R) U ≫ NatTrans.app β.val.c (op U)
[PROOFSTEP]
erw [toOpen_comp_comap_assoc]
[GOAL]
case h
X✝ : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
w : ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base = β.val.base
r : ↑R
U : Opens (PrimeSpectrum ↑R) := basicOpen r
⊢ (CommRingCat.ofHom f ≫
        toOpen (↑(Γ.obj (op X))) (↑(Opens.comap (PrimeSpectrum.comap f)) U) ≫
          NatTrans.app (toΓSpec X).val.c (op ((Opens.map (Spec.locallyRingedSpaceMap f).val.base).obj (op U).unop))) ≫
      X.presheaf.map
        (eqToHom
          (_ :
            (Opens.map ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base).op.obj (op U) =
              (Opens.map β.val.base).op.obj (op U))) =
    toOpen (↑R) U ≫ NatTrans.app β.val.c (op U)
[PROOFSTEP]
rw [Category.assoc]
[GOAL]
case h
X✝ : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
w : ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base = β.val.base
r : ↑R
U : Opens (PrimeSpectrum ↑R) := basicOpen r
⊢ CommRingCat.ofHom f ≫
      (toOpen (↑(Γ.obj (op X))) (↑(Opens.comap (PrimeSpectrum.comap f)) U) ≫
          NatTrans.app (toΓSpec X).val.c (op ((Opens.map (Spec.locallyRingedSpaceMap f).val.base).obj (op U).unop))) ≫
        X.presheaf.map
          (eqToHom
            (_ :
              (Opens.map ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base).op.obj (op U) =
                (Opens.map β.val.base).op.obj (op U))) =
    toOpen (↑R) U ≫ NatTrans.app β.val.c (op U)
[PROOFSTEP]
erw [toΓSpecSheafedSpace_app_spec, ← X.presheaf.map_comp]
[GOAL]
case h
X✝ : LocallyRingedSpace
r✝ : ↑(Γ.obj (op X✝))
X : LocallyRingedSpace
R : CommRingCat
f : R ⟶ Γ.obj (op X)
β : X ⟶ Spec.locallyRingedSpaceObj R
h :
  ∀ (r : ↑R),
    f ≫ X.presheaf.map (homOfLE (_ : (Opens.map β.val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑R) (basicOpen r) ≫ NatTrans.app β.val.c (op (basicOpen r))
w : ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base = β.val.base
r : ↑R
U : Opens (PrimeSpectrum ↑R) := basicOpen r
⊢ CommRingCat.ofHom f ≫
      X.presheaf.map
        ((Opens.leTop (toΓSpecMapBasicOpen X (↑f r))).op ≫
          eqToHom
            (_ :
              (Opens.map ((toΓSpec X).val ≫ (Spec.locallyRingedSpaceMap f).val).base).op.obj (op U) =
                (Opens.map β.val.base).op.obj (op U))) =
    toOpen (↑R) U ≫ NatTrans.app β.val.c (op U)
[PROOFSTEP]
convert h r using 1
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ toSpecΓ (Γ.obj (op X)) ≫ NatTrans.app (toΓSpec X).val.c (op ⊤) = 𝟙 (Γ.obj (op X))
[PROOFSTEP]
unfold toSpecΓ
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ toOpen ↑(Γ.obj (op X)) ⊤ ≫ NatTrans.app (toΓSpec X).val.c (op ⊤) = 𝟙 (Γ.obj (op X))
[PROOFSTEP]
rw [← toOpen_res _ (basicOpen (1 : Γ.obj (op X))) ⊤ (eqToHom basicOpen_one.symm)]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ (toOpen (↑(Γ.obj (op X))) (basicOpen 1) ≫
        (structureSheaf ↑(Γ.obj (op X))).val.map (eqToHom (_ : ⊤ = basicOpen 1)).op) ≫
      NatTrans.app (toΓSpec X).val.c (op ⊤) =
    𝟙 (Γ.obj (op X))
[PROOFSTEP]
erw [Category.assoc]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ toOpen (↑(Γ.obj (op X))) (basicOpen 1) ≫
      (structureSheaf ↑(Γ.obj (op X))).val.map (eqToHom (_ : ⊤ = basicOpen 1)).op ≫
        NatTrans.app (toΓSpec X).val.c (op ⊤) =
    𝟙 (Γ.obj (op X))
[PROOFSTEP]
rw [NatTrans.naturality, ← Category.assoc]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ (toOpen (↑(Γ.obj (op X))) (basicOpen 1) ≫ NatTrans.app (toΓSpec X).val.c (op (basicOpen 1))) ≫
      ((toΓSpec X).val.base _* X.presheaf).map (eqToHom (_ : ⊤ = basicOpen 1)).op =
    𝟙 (Γ.obj (op X))
[PROOFSTEP]
erw [X.toΓSpecSheafedSpace_app_spec 1, ← Functor.map_comp]
[GOAL]
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ X.presheaf.map
      ((Opens.leTop (toΓSpecMapBasicOpen X 1)).op ≫
        (Opens.map (toΓSpec X).val.base).op.map (eqToHom (_ : ⊤ = basicOpen 1)).op) =
    𝟙 (Γ.obj (op X))
[PROOFSTEP]
convert eqToHom_map X.presheaf _
[GOAL]
case convert_3
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ op ⊤ = (Opens.map (toΓSpec X).val.base).op.obj (op ⊤)
[PROOFSTEP]
rfl
[GOAL]
X Y : LocallyRingedSpace
f : X ⟶ Y
⊢ (𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y = toΓSpec X ≫ (Γ.rightOp ⋙ Spec.toLocallyRingedSpace).map f
[PROOFSTEP]
symm
[GOAL]
X Y : LocallyRingedSpace
f : X ⟶ Y
⊢ toΓSpec X ≫ (Γ.rightOp ⋙ Spec.toLocallyRingedSpace).map f = (𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y
[PROOFSTEP]
apply LocallyRingedSpace.comp_ring_hom_ext
[GOAL]
case w
X Y : LocallyRingedSpace
f : X ⟶ Y
⊢ (toΓSpec ((𝟭 LocallyRingedSpace).obj X)).val.base ≫ (Spec.locallyRingedSpaceMap (Γ.rightOp.map f).unop).val.base =
    ((𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y).val.base
[PROOFSTEP]
ext1 x
[GOAL]
case w.w
X Y : LocallyRingedSpace
f : X ⟶ Y
x : (forget TopCat).obj ↑((𝟭 LocallyRingedSpace).obj X).toPresheafedSpace
⊢ ↑((toΓSpec ((𝟭 LocallyRingedSpace).obj X)).val.base ≫ (Spec.locallyRingedSpaceMap (Γ.rightOp.map f).unop).val.base)
      x =
    ↑((𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y).val.base x
[PROOFSTEP]
dsimp [Spec.topMap, LocallyRingedSpace.toΓSpecFun]
  --Porting Note: Had to add the next four lines
[GOAL]
case w.w
X Y : LocallyRingedSpace
f : X ⟶ Y
x : (forget TopCat).obj ↑((𝟭 LocallyRingedSpace).obj X).toPresheafedSpace
⊢ ↑(toΓSpecBase X ≫ PrimeSpectrum.comap (NatTrans.app f.val.c (op ⊤))) x = ↑(f.val.base ≫ toΓSpecBase Y) x
[PROOFSTEP]
rw [comp_apply, comp_apply]
[GOAL]
case w.w
X Y : LocallyRingedSpace
f : X ⟶ Y
x : (forget TopCat).obj ↑((𝟭 LocallyRingedSpace).obj X).toPresheafedSpace
⊢ ↑(PrimeSpectrum.comap (NatTrans.app f.val.c (op ⊤))) (↑(toΓSpecBase X) x) = ↑(toΓSpecBase Y) (↑f.val.base x)
[PROOFSTEP]
dsimp [toΓSpecBase]
[GOAL]
case w.w
X Y : LocallyRingedSpace
f : X ⟶ Y
x : (forget TopCat).obj ↑((𝟭 LocallyRingedSpace).obj X).toPresheafedSpace
⊢ ↑(PrimeSpectrum.comap (NatTrans.app f.val.c (op ⊤))) (↑(ContinuousMap.mk (toΓSpecFun X)) x) =
    ↑(ContinuousMap.mk (toΓSpecFun Y)) (↑f.val.base x)
[PROOFSTEP]
rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
[GOAL]
case w.w
X Y : LocallyRingedSpace
f : X ⟶ Y
x : (forget TopCat).obj ↑((𝟭 LocallyRingedSpace).obj X).toPresheafedSpace
⊢ ↑(PrimeSpectrum.comap (NatTrans.app f.val.c (op ⊤))) (toΓSpecFun X x) = toΓSpecFun Y (↑f.val.base x)
[PROOFSTEP]
dsimp [toΓSpecFun]
[GOAL]
case w.w
X Y : LocallyRingedSpace
f : X ⟶ Y
x : (forget TopCat).obj ↑((𝟭 LocallyRingedSpace).obj X).toPresheafedSpace
⊢ ↑(PrimeSpectrum.comap (NatTrans.app f.val.c (op ⊤)))
      (↑(PrimeSpectrum.comap (ΓToStalk X x)) (LocalRing.closedPoint ↑(TopCat.Presheaf.stalk X.presheaf x))) =
    ↑(PrimeSpectrum.comap (ΓToStalk Y (↑f.val.base x)))
      (LocalRing.closedPoint ↑(TopCat.Presheaf.stalk Y.presheaf (↑f.val.base x)))
[PROOFSTEP]
rw [← LocalRing.comap_closedPoint (PresheafedSpace.stalkMap f.val x), ← PrimeSpectrum.comap_comp_apply, ←
  PrimeSpectrum.comap_comp_apply]
[GOAL]
case w.w
X Y : LocallyRingedSpace
f : X ⟶ Y
x : (forget TopCat).obj ↑((𝟭 LocallyRingedSpace).obj X).toPresheafedSpace
⊢ ↑(PrimeSpectrum.comap (RingHom.comp (ΓToStalk X x) (NatTrans.app f.val.c (op ⊤))))
      (LocalRing.closedPoint ↑(TopCat.Presheaf.stalk X.presheaf x)) =
    ↑(PrimeSpectrum.comap (RingHom.comp (PresheafedSpace.stalkMap f.val x) (ΓToStalk Y (↑f.val.base x))))
      (LocalRing.closedPoint ↑(PresheafedSpace.stalk X.toPresheafedSpace x))
[PROOFSTEP]
congr 2
[GOAL]
case w.w.e_a.e_f
X Y : LocallyRingedSpace
f : X ⟶ Y
x : (forget TopCat).obj ↑((𝟭 LocallyRingedSpace).obj X).toPresheafedSpace
⊢ RingHom.comp (ΓToStalk X x) (NatTrans.app f.val.c (op ⊤)) =
    RingHom.comp (PresheafedSpace.stalkMap f.val x) (ΓToStalk Y (↑f.val.base x))
[PROOFSTEP]
exact (PresheafedSpace.stalkMap_germ f.1 ⊤ ⟨x, trivial⟩).symm
[GOAL]
case h
X Y : LocallyRingedSpace
f : X ⟶ Y
⊢ ∀ (r : ↑(Γ.rightOp.obj Y).unop),
    (Γ.rightOp.map f).unop ≫
        ((𝟭 LocallyRingedSpace).obj X).presheaf.map
          (homOfLE (_ : (Opens.map ((𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y).val.base).obj (basicOpen r) ≤ ⊤)).op =
      toOpen (↑(Γ.rightOp.obj Y).unop) (basicOpen r) ≫
        NatTrans.app ((𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y).val.c (op (basicOpen r))
[PROOFSTEP]
intro r
[GOAL]
case h
X Y : LocallyRingedSpace
f : X ⟶ Y
r : ↑(Γ.rightOp.obj Y).unop
⊢ (Γ.rightOp.map f).unop ≫
      ((𝟭 LocallyRingedSpace).obj X).presheaf.map
        (homOfLE (_ : (Opens.map ((𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y).val.base).obj (basicOpen r) ≤ ⊤)).op =
    toOpen (↑(Γ.rightOp.obj Y).unop) (basicOpen r) ≫
      NatTrans.app ((𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y).val.c (op (basicOpen r))
[PROOFSTEP]
rw [LocallyRingedSpace.comp_val_c_app, ← Category.assoc]
[GOAL]
case h
X Y : LocallyRingedSpace
f : X ⟶ Y
r : ↑(Γ.rightOp.obj Y).unop
⊢ (Γ.rightOp.map f).unop ≫
      ((𝟭 LocallyRingedSpace).obj X).presheaf.map
        (homOfLE (_ : (Opens.map ((𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y).val.base).obj (basicOpen r) ≤ ⊤)).op =
    (toOpen (↑(Γ.rightOp.obj Y).unop) (basicOpen r) ≫ NatTrans.app (toΓSpec Y).val.c (op (basicOpen r))) ≫
      NatTrans.app ((𝟭 LocallyRingedSpace).map f).val.c
        (op ((Opens.map (toΓSpec Y).val.base).obj (op (basicOpen r)).unop))
[PROOFSTEP]
erw [Y.toΓSpecSheafedSpace_app_spec, f.1.c.naturality]
[GOAL]
case h
X Y : LocallyRingedSpace
f : X ⟶ Y
r : ↑(Γ.rightOp.obj Y).unop
⊢ (Γ.rightOp.map f).unop ≫
      ((𝟭 LocallyRingedSpace).obj X).presheaf.map
        (homOfLE (_ : (Opens.map ((𝟭 LocallyRingedSpace).map f ≫ toΓSpec Y).val.base).obj (basicOpen r) ≤ ⊤)).op =
    NatTrans.app f.val.c (op ⊤) ≫ (f.val.base _* X.presheaf).map (Opens.leTop (toΓSpecMapBasicOpen Y r)).op
[PROOFSTEP]
rfl
[GOAL]
R : CommRingCat
⊢ NatTrans.app identityToΓSpec (Spec.toLocallyRingedSpace.obj (op R)) ≫
      Spec.toLocallyRingedSpace.map (NatTrans.app SpecΓIdentity.inv R).op =
    𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))
[PROOFSTEP]
apply LocallyRingedSpace.comp_ring_hom_ext
[GOAL]
case w
R : CommRingCat
⊢ (toΓSpec ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base ≫
      (Spec.locallyRingedSpaceMap (NatTrans.app SpecΓIdentity.inv R).op.unop).val.base =
    (𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base
[PROOFSTEP]
ext (p : PrimeSpectrum R)
[GOAL]
case w.w
R : CommRingCat
p : PrimeSpectrum ↑R
⊢ ↑((toΓSpec ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base ≫
          (Spec.locallyRingedSpaceMap (NatTrans.app SpecΓIdentity.inv R).op.unop).val.base)
      p =
    ↑(𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base p
[PROOFSTEP]
change _ = p
[GOAL]
case w.w
R : CommRingCat
p : PrimeSpectrum ↑R
⊢ ↑((toΓSpec ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base ≫
          (Spec.locallyRingedSpaceMap (NatTrans.app SpecΓIdentity.inv R).op.unop).val.base)
      p =
    p
[PROOFSTEP]
ext x
[GOAL]
case w.w.asIdeal.h
R : CommRingCat
p : PrimeSpectrum ↑R
x : ↑(op ((𝟭 CommRingCat).obj R)).unop
⊢ x ∈
      (↑((toΓSpec ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base ≫
              (Spec.locallyRingedSpaceMap (NatTrans.app SpecΓIdentity.inv R).op.unop).val.base)
          p).asIdeal ↔
    x ∈ p.asIdeal
[PROOFSTEP]
erw [← IsLocalization.AtPrime.to_map_mem_maximal_iff ((structureSheaf R).presheaf.stalk p) p.asIdeal x]
[GOAL]
case w.w.asIdeal.h
R : CommRingCat
p : PrimeSpectrum ↑R
x : ↑(op ((𝟭 CommRingCat).obj R)).unop
⊢ x ∈
      (↑((toΓSpec ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base ≫
              (Spec.locallyRingedSpaceMap (NatTrans.app SpecΓIdentity.inv R).op.unop).val.base)
          p).asIdeal ↔
    ↑(algebraMap ↑R ↑(TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑R)) p)) x ∈
      LocalRing.maximalIdeal ↑(TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑R)) p)
[PROOFSTEP]
rfl
[GOAL]
case h
R : CommRingCat
⊢ ∀ (r : ↑(op ((𝟭 CommRingCat).obj R)).unop),
    (NatTrans.app SpecΓIdentity.inv R).op.unop ≫
        ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R))).presheaf.map
          (homOfLE
              (_ :
                (Opens.map (𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base).obj
                    (basicOpen r) ≤
                  ⊤)).op =
      toOpen (↑(op ((𝟭 CommRingCat).obj R)).unop) (basicOpen r) ≫
        NatTrans.app (𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.c (op (basicOpen r))
[PROOFSTEP]
intro r
[GOAL]
case h
R : CommRingCat
r : ↑(op ((𝟭 CommRingCat).obj R)).unop
⊢ (NatTrans.app SpecΓIdentity.inv R).op.unop ≫
      ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R))).presheaf.map
        (homOfLE
            (_ :
              (Opens.map (𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.base).obj
                  (basicOpen r) ≤
                ⊤)).op =
    toOpen (↑(op ((𝟭 CommRingCat).obj R)).unop) (basicOpen r) ≫
      NatTrans.app (𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.toLocallyRingedSpace.obj (op R)))).val.c (op (basicOpen r))
[PROOFSTEP]
apply toOpen_res
[GOAL]
⊢ whiskerRight identityToΓSpec Γ.rightOp ≫
      (Functor.associator Γ.rightOp Spec.toLocallyRingedSpace Γ.rightOp).hom ≫
        whiskerLeft Γ.rightOp (NatIso.op SpecΓIdentity).inv =
    NatTrans.id (𝟭 LocallyRingedSpace ⋙ Γ.rightOp)
[PROOFSTEP]
ext X
[GOAL]
case w.h
X : LocallyRingedSpace
⊢ NatTrans.app
      (whiskerRight identityToΓSpec Γ.rightOp ≫
        (Functor.associator Γ.rightOp Spec.toLocallyRingedSpace Γ.rightOp).hom ≫
          whiskerLeft Γ.rightOp (NatIso.op SpecΓIdentity).inv)
      X =
    NatTrans.app (NatTrans.id (𝟭 LocallyRingedSpace ⋙ Γ.rightOp)) X
[PROOFSTEP]
erw [Category.id_comp]
[GOAL]
case w.h
X : LocallyRingedSpace
⊢ NatTrans.app (whiskerRight identityToΓSpec Γ.rightOp ≫ whiskerLeft Γ.rightOp (NatIso.op SpecΓIdentity).inv) X =
    NatTrans.app (NatTrans.id (𝟭 LocallyRingedSpace ⋙ Γ.rightOp)) X
[PROOFSTEP]
exact congr_arg Quiver.Hom.op (left_triangle X)
[GOAL]
⊢ whiskerLeft Spec.toLocallyRingedSpace identityToΓSpec ≫
      (Functor.associator Spec.toLocallyRingedSpace Γ.rightOp Spec.toLocallyRingedSpace).inv ≫
        whiskerRight (NatIso.op SpecΓIdentity).inv Spec.toLocallyRingedSpace =
    NatTrans.id (Spec.toLocallyRingedSpace ⋙ 𝟭 LocallyRingedSpace)
[PROOFSTEP]
ext R : 2
  -- Porting note : a little bit hand holding
[GOAL]
case w.h
R : CommRingCatᵒᵖ
⊢ NatTrans.app
      (whiskerLeft Spec.toLocallyRingedSpace identityToΓSpec ≫
        (Functor.associator Spec.toLocallyRingedSpace Γ.rightOp Spec.toLocallyRingedSpace).inv ≫
          whiskerRight (NatIso.op SpecΓIdentity).inv Spec.toLocallyRingedSpace)
      R =
    NatTrans.app (NatTrans.id (Spec.toLocallyRingedSpace ⋙ 𝟭 LocallyRingedSpace)) R
[PROOFSTEP]
change identityToΓSpec.app _ ≫ 𝟙 _ ≫ Spec.toLocallyRingedSpace.map _ = 𝟙 _
[GOAL]
case w.h
R : CommRingCatᵒᵖ
⊢ NatTrans.app identityToΓSpec (Spec.locallyRingedSpaceObj R.unop) ≫
      𝟙 ((Γ.rightOp ⋙ Spec.toLocallyRingedSpace).obj (Spec.locallyRingedSpaceObj R.unop)) ≫
        Spec.toLocallyRingedSpace.map (NatTrans.app (NatIso.op SpecΓIdentity).inv R) =
    𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.locallyRingedSpaceObj R.unop))
[PROOFSTEP]
simp_rw [Category.id_comp, show (NatIso.op SpecΓIdentity).inv.app R = (SpecΓIdentity.inv.app R.unop).op from rfl]
[GOAL]
case w.h
R : CommRingCatᵒᵖ
⊢ NatTrans.app identityToΓSpec (Spec.locallyRingedSpaceObj R.unop) ≫
      Spec.toLocallyRingedSpace.map (NatTrans.app SpecΓIdentity.inv R.unop).op =
    𝟙 ((𝟭 LocallyRingedSpace).obj (Spec.locallyRingedSpaceObj R.unop))
[PROOFSTEP]
exact right_triangle R.unop
[GOAL]
X : Scheme
R : CommRingCatᵒᵖ
f : op (Scheme.Γ.obj (op X)) ⟶ R
⊢ ↑(Adjunction.homEquiv adjunction X R) f =
    ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace R) f
[PROOFSTEP]
dsimp [adjunction, Adjunction.restrictFullyFaithful]
[GOAL]
X : Scheme
R : CommRingCatᵒᵖ
f : op (Scheme.Γ.obj (op X)) ⟶ R
⊢ ↑(equivOfFullyFaithful Scheme.forgetToLocallyRingedSpace).symm
      (𝟙 X.toLocallyRingedSpace ≫
        ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace R)
            (𝟙 (op (X.presheaf.obj (op ⊤))) ≫ ↑(equivOfFullyFaithful (𝟭 CommRingCatᵒᵖ)) f ≫ 𝟙 R) ≫
          𝟙 (Spec.locallyRingedSpaceObj R.unop)) =
    ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace R) f
[PROOFSTEP]
simp only [Category.comp_id, Category.id_comp]
[GOAL]
X : Scheme
R : CommRingCatᵒᵖ
f : op (Scheme.Γ.obj (op X)) ⟶ R
⊢ ↑(equivOfFullyFaithful Scheme.forgetToLocallyRingedSpace).symm
      (↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace R)
        (↑(equivOfFullyFaithful (𝟭 CommRingCatᵒᵖ)) f)) =
    ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace R) f
[PROOFSTEP]
rfl
  --Porting Note: Added
[GOAL]
X : Scheme
R : CommRingCatᵒᵖ
f : X ⟶ Scheme.Spec.obj R
⊢ ↑(Adjunction.homEquiv adjunction X R).symm f =
    ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace R).symm f
[PROOFSTEP]
rw [adjunction_homEquiv]
[GOAL]
X : Scheme
R : CommRingCatᵒᵖ
f : X ⟶ Scheme.Spec.obj R
⊢ ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace R).symm f =
    ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace R).symm f
[PROOFSTEP]
rfl
[GOAL]
R : CommRingCatᵒᵖ
⊢ NatTrans.app adjunction.counit R = NatTrans.app locallyRingedSpaceAdjunction.counit R
[PROOFSTEP]
rw [← Adjunction.homEquiv_symm_id, ← Adjunction.homEquiv_symm_id, adjunction_homEquiv_symm_apply]
[GOAL]
R : CommRingCatᵒᵖ
⊢ ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction (Scheme.Spec.obj R).toLocallyRingedSpace R).symm
      (𝟙 (Scheme.Spec.obj R)) =
    ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction (Spec.toLocallyRingedSpace.obj R) R).symm
      (𝟙 (Spec.toLocallyRingedSpace.obj R))
[PROOFSTEP]
rfl
[GOAL]
X : Scheme
⊢ NatTrans.app adjunction.unit X = NatTrans.app locallyRingedSpaceAdjunction.unit X.toLocallyRingedSpace
[PROOFSTEP]
rw [← Adjunction.homEquiv_id, ← Adjunction.homEquiv_id, adjunction_homEquiv_apply]
[GOAL]
X : Scheme
⊢ ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace (Scheme.Γ.rightOp.obj X))
      (𝟙 (Scheme.Γ.rightOp.obj X)) =
    ↑(Adjunction.homEquiv locallyRingedSpaceAdjunction X.toLocallyRingedSpace (Γ.rightOp.obj X.toLocallyRingedSpace))
      (𝟙 (Γ.rightOp.obj X.toLocallyRingedSpace))
[PROOFSTEP]
rfl
[GOAL]
⊢ IsIso locallyRingedSpaceAdjunction.counit
[PROOFSTEP]
dsimp only [locallyRingedSpaceAdjunction, Adjunction.mkOfUnitCounit_counit]
  -- Porting Note: `dsimp` was unnecessary and had to make this explicit
[GOAL]
⊢ IsIso (NatIso.op SpecΓIdentity).inv
[PROOFSTEP]
convert IsIso.of_iso_inv (NatIso.op SpecΓIdentity) using 1
[GOAL]
⊢ IsIso adjunction.counit
[PROOFSTEP]
apply (config := { allowSynthFailures := true }) NatIso.isIso_of_isIso_app
[GOAL]
case inst
⊢ ∀ (X : CommRingCatᵒᵖ), IsIso (NatTrans.app adjunction.counit X)
[PROOFSTEP]
intro R
[GOAL]
case inst
R : CommRingCatᵒᵖ
⊢ IsIso (NatTrans.app adjunction.counit R)
[PROOFSTEP]
rw [adjunction_counit_app]
[GOAL]
case inst
R : CommRingCatᵒᵖ
⊢ IsIso (NatTrans.app locallyRingedSpaceAdjunction.counit R)
[PROOFSTEP]
infer_instance
[GOAL]
X : Scheme
⊢ NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op ⊤))
[PROOFSTEP]
have := congr_app ΓSpec.adjunction.left_triangle X
[GOAL]
X : Scheme
this :
  NatTrans.app (whiskerRight adjunction.unit Scheme.Γ.rightOp ≫ whiskerLeft Scheme.Γ.rightOp adjunction.counit) X =
    NatTrans.app (𝟙 (𝟭 Scheme ⋙ Scheme.Γ.rightOp)) X
⊢ NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op ⊤))
[PROOFSTEP]
dsimp at this
[GOAL]
X : Scheme
this :
  (NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤)).op ≫
      NatTrans.app adjunction.counit (op (X.presheaf.obj (op ⊤))) =
    𝟙 (op (X.presheaf.obj (op ⊤)))
⊢ NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op ⊤))
[PROOFSTEP]
rw [← IsIso.eq_comp_inv] at this
[GOAL]
X : Scheme
this :
  (NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤)).op =
    𝟙 (op (X.presheaf.obj (op ⊤))) ≫ inv (NatTrans.app adjunction.counit (op (X.presheaf.obj (op ⊤))))
⊢ NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op ⊤))
[PROOFSTEP]
simp only [adjunction_counit_app, locallyRingedSpaceAdjunction_counit, NatIso.op_inv, NatTrans.op_app, unop_op,
  Functor.id_obj, Functor.comp_obj, Functor.rightOp_obj, Spec.toLocallyRingedSpace_obj, Γ_obj,
  Spec.locallyRingedSpaceObj_toSheafedSpace, Spec.sheafedSpaceObj_carrier, Spec.sheafedSpaceObj_presheaf,
  SpecΓIdentity_inv_app, Category.id_comp] at this
[GOAL]
X : Scheme
this : (NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤)).op = inv (toSpecΓ (X.presheaf.obj (op ⊤))).op
⊢ NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op ⊤))
[PROOFSTEP]
rw [← op_inv, Quiver.Hom.op_inj.eq_iff] at this
[GOAL]
X : Scheme
this : NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = inv (toSpecΓ (X.presheaf.obj (op ⊤)))
⊢ NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op ⊤))
[PROOFSTEP]
rw [SpecΓIdentity_hom_app]
[GOAL]
X : Scheme
this : NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = inv (toSpecΓ (X.presheaf.obj (op ⊤)))
⊢ NatTrans.app (NatTrans.app adjunction.unit X).val.c (op ⊤) = inv (toSpecΓ (X.presheaf.obj (op ⊤)))
[PROOFSTEP]
convert this using 1