l3lab/ntp-mathlib huggingface dataset:
/-- Characterization of the sheaf hom on basic opens,
    direction ← (next lemma) is used at various places, but → is not used in this file. -/
theorem toΓSpecCApp_iff
    (f :
      (structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶
        X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r)) :
    toOpen _ (basicOpen r) ≫ f = X.toToΓSpecMapBasicOpen r ↔ f = X.toΓSpecCApp r := by
  -- Porting Note: Type class problem got stuck in `IsLocalization.Away.AwayMap.lift_comp`
  -- created instance manually. This replaces the `pick_goal` tactics
  have loc_inst := IsLocalization.to_basicOpen (Γ.obj (op X)) r
  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
  

Proof state:
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

Next tactic:
constructor
/-- Characterization of the sheaf hom on basic opens,
    direction ← (next lemma) is used at various places, but → is not used in this file. -/
theorem toΓSpecCApp_iff
    (f :
      (structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶
        X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r)) :
    toOpen _ (basicOpen r) ≫ f = X.toToΓSpecMapBasicOpen r ↔ f = X.toΓSpecCApp r := by
  -- Porting Note: Type class problem got stuck in `IsLocalization.Away.AwayMap.lift_comp`
  -- created instance manually. This replaces the `pick_goal` tactics
  have loc_inst := IsLocalization.to_basicOpen (Γ.obj (op X)) r
  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
  constructor
  · 

Proof state:
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

Next tactic:
intro h
/-- Characterization of the sheaf hom on basic opens,
    direction ← (next lemma) is used at various places, but → is not used in this file. -/
theorem toΓSpecCApp_iff
    (f :
      (structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶
        X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r)) :
    toOpen _ (basicOpen r) ≫ f = X.toToΓSpecMapBasicOpen r ↔ f = X.toΓSpecCApp r := by
  -- Porting Note: Type class problem got stuck in `IsLocalization.Away.AwayMap.lift_comp`
  -- created instance manually. This replaces the `pick_goal` tactics
  have loc_inst := IsLocalization.to_basicOpen (Γ.obj (op X)) r
  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
  constructor
  · intro h
    --Porting Note: Type class problem got stuck, same as above
    

Proof state:
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

Next tactic:
refine' @IsLocalization.ringHom_ext _ _ _ _ _ _ _ _ loc_inst _ _ _
/-- Characterization of the sheaf hom on basic opens,
    direction ← (next lemma) is used at various places, but → is not used in this file. -/
theorem toΓSpecCApp_iff
    (f :
      (structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶
        X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r)) :
    toOpen _ (basicOpen r) ≫ f = X.toToΓSpecMapBasicOpen r ↔ f = X.toΓSpecCApp r := by
  -- Porting Note: Type class problem got stuck in `IsLocalization.Away.AwayMap.lift_comp`
  -- created instance manually. This replaces the `pick_goal` tactics
  have loc_inst := IsLocalization.to_basicOpen (Γ.obj (op X)) r
  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
  constructor
  · intro h
    --Porting Note: Type class problem got stuck, same as above
    refine' @IsLocalization.ringHom_ext _ _ _ _ _ _ _ _ loc_inst _ _ _
    

Proof state:
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))))

Next tactic:
exact h
/-- Characterization of the sheaf hom on basic opens,
    direction ← (next lemma) is used at various places, but → is not used in this file. -/
theorem toΓSpecCApp_iff
    (f :
      (structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶
        X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r)) :
    toOpen _ (basicOpen r) ≫ f = X.toToΓSpecMapBasicOpen r ↔ f = X.toΓSpecCApp r := by
  -- Porting Note: Type class problem got stuck in `IsLocalization.Away.AwayMap.lift_comp`
  -- created instance manually. This replaces the `pick_goal` tactics
  have loc_inst := IsLocalization.to_basicOpen (Γ.obj (op X)) r
  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
  constructor
  · intro h
    --Porting Note: Type class problem got stuck, same as above
    refine' @IsLocalization.ringHom_ext _ _ _ _ _ _ _ _ loc_inst _ _ _
    exact h
    --pick_goal 5; exact is_localization.to_basic_open _ r; exact h
  

Proof state:
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))))

Next tactic:
apply congr_arg
/-- The sheaf hom on all basic opens, commuting with restrictions. -/
@[simps app]
def toΓSpecCBasicOpens :
    (inducedFunctor basicOpen).op ⋙ (structureSheaf (Γ.obj (op X))).1 ⟶
      (inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward _ X.toΓSpecBase).obj X.𝒪).1 where
  app r := X.toΓSpecCApp r.unop
  naturality r s f := by
    

Proof state:
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 CommRingCat (toΓSpecBase X)).obj (𝒪 X)).val).map f

Next tactic:
apply (StructureSheaf.to_basicOpen_epi (Γ.obj (op X)) r.unop).1
/-- The sheaf hom on all basic opens, commuting with restrictions. -/
@[simps app]
def toΓSpecCBasicOpens :
    (inducedFunctor basicOpen).op ⋙ (structureSheaf (Γ.obj (op X))).1 ⟶
      (inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward _ X.toΓSpecBase).obj X.𝒪).1 where
  app r := X.toΓSpecCApp r.unop
  naturality r s f := by
    apply (StructureSheaf.to_basicOpen_epi (Γ.obj (op X)) r.unop).1
    

Proof state:
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 CommRingCat (toΓSpecBase X)).obj (𝒪 X)).val).map f

Next tactic:
simp only [← Category.assoc]
/-- The sheaf hom on all basic opens, commuting with restrictions. -/
@[simps app]
def toΓSpecCBasicOpens :
    (inducedFunctor basicOpen).op ⋙ (structureSheaf (Γ.obj (op X))).1 ⟶
      (inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward _ X.toΓSpecBase).obj X.𝒪).1 where
  app r := X.toΓSpecCApp r.unop
  naturality r s f := by
    apply (StructureSheaf.to_basicOpen_epi (Γ.obj (op X)) r.unop).1
    simp only [← Category.assoc]
    

Proof state:
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 CommRingCat (toΓSpecBase X)).obj (𝒪 X)).val).map f

Next tactic:
erw [X.toΓSpecCApp_spec r.unop]
/-- The sheaf hom on all basic opens, commuting with restrictions. -/
@[simps app]
def toΓSpecCBasicOpens :
    (inducedFunctor basicOpen).op ⋙ (structureSheaf (Γ.obj (op X))).1 ⟶
      (inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward _ X.toΓSpecBase).obj X.𝒪).1 where
  app r := X.toΓSpecCApp r.unop
  naturality r s f := by
    apply (StructureSheaf.to_basicOpen_epi (Γ.obj (op X)) r.unop).1
    simp only [← Category.assoc]
    erw [X.toΓSpecCApp_spec r.unop]
    

Proof state:
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 CommRingCat (toΓSpecBase X)).obj (𝒪 X)).val).map f

Next tactic:
convert X.toΓSpecCApp_spec s.unop
/-- The sheaf hom on all basic opens, commuting with restrictions. -/
@[simps app]
def toΓSpecCBasicOpens :
    (inducedFunctor basicOpen).op ⋙ (structureSheaf (Γ.obj (op X))).1 ⟶
      (inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward _ X.toΓSpecBase).obj X.𝒪).1 where
  app r := X.toΓSpecCApp r.unop
  naturality r s f := by
    apply (StructureSheaf.to_basicOpen_epi (Γ.obj (op X)) r.unop).1
    simp only [← Category.assoc]
    erw [X.toΓSpecCApp_spec r.unop]
    convert X.toΓSpecCApp_spec s.unop
    

Proof state:
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 CommRingCat (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 CommRingCat (toΓSpecBase X)).obj (𝒪 X)).val).map f =
    toToΓSpecMapBasicOpen X s.unop

Next tactic:
symm
/-- The sheaf hom on all basic opens, commuting with restrictions. -/
@[simps app]
def toΓSpecCBasicOpens :
    (inducedFunctor basicOpen).op ⋙ (structureSheaf (Γ.obj (op X))).1 ⟶
      (inducedFunctor basicOpen).op ⋙ ((TopCat.Sheaf.pushforward _ X.toΓSpecBase).obj X.𝒪).1 where
  app r := X.toΓSpecCApp r.unop
  naturality r s f := by
    apply (StructureSheaf.to_basicOpen_epi (Γ.obj (op X)) r.unop).1
    simp only [← Category.assoc]
    erw [X.toΓSpecCApp_spec r.unop]
    convert X.toΓSpecCApp_spec s.unop
    symm
    

Proof state:
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 CommRingCat (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 CommRingCat (toΓSpecBase X)).obj (𝒪 X)).val).map f

Next tactic:
apply X.presheaf.map_comp
theorem toΓSpecSheafedSpace_app_eq :
    X.toΓSpecSheafedSpace.c.app (op (basicOpen r)) = X.toΓSpecCApp r := by
  

Proof state:
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
⊢ (toΓSpecSheafedSpace X).c.app (op (basicOpen r)) = toΓSpecCApp X r

Next tactic:
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
theorem toΓSpecSheafedSpace_app_eq :
    X.toΓSpecSheafedSpace.c.app (op (basicOpen r)) = X.toΓSpecCApp r := by
  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
  

Proof state:
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
this :
  ((TopCat.Sheaf.restrictHomEquivHom (Spec.toSheafedSpace.obj (op (Γ.obj (op X)))).presheaf
            ((TopCat.Sheaf.pushforward CommRingCat (toΓSpecBase X)).obj (𝒪 X))
            (_ : Opens.IsBasis (Set.range basicOpen)))
          (toΓSpecCBasicOpens X)).app
      (op (basicOpen r)) =
    (toΓSpecCBasicOpens X).app (op r)
⊢ (toΓSpecSheafedSpace X).c.app (op (basicOpen r)) = toΓSpecCApp X r

Next tactic:
dsimp at this
theorem toΓSpecSheafedSpace_app_eq :
    X.toΓSpecSheafedSpace.c.app (op (basicOpen r)) = X.toΓSpecCApp r := by
  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
  dsimp at this
  

Proof state:
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
this :
  ((TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward CommRingCat (toΓSpecBase X)).obj (𝒪 X))
            (_ : Opens.IsBasis (Set.range basicOpen)))
          (toΓSpecCBasicOpens X)).app
      (op (basicOpen r)) =
    toΓSpecCApp X r
⊢ (toΓSpecSheafedSpace X).c.app (op (basicOpen r)) = toΓSpecCApp X r

Next tactic:
rw [← this]
theorem toΓSpecSheafedSpace_app_eq :
    X.toΓSpecSheafedSpace.c.app (op (basicOpen r)) = X.toΓSpecCApp r := by
  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
  dsimp at this
  rw [← this]
  

Proof state:
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
this :
  ((TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward CommRingCat (toΓSpecBase X)).obj (𝒪 X))
            (_ : Opens.IsBasis (Set.range basicOpen)))
          (toΓSpecCBasicOpens X)).app
      (op (basicOpen r)) =
    toΓSpecCApp X r
⊢ (toΓSpecSheafedSpace X).c.app (op (basicOpen r)) =
    ((TopCat.Sheaf.restrictHomEquivHom (structureSheaf ↑(X.presheaf.obj (op ⊤))).val
            ((TopCat.Sheaf.pushforward CommRingCat (toΓSpecBase X)).obj (𝒪 X))
            (_ : Opens.IsBasis (Set.range basicOpen)))
          (toΓSpecCBasicOpens X)).app
      (op (basicOpen r))

Next tactic:
dsimp
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  

Proof state:
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

Next tactic:
rw [PresheafedSpace.stalkMap]
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  rw [PresheafedSpace.stalkMap]
  

Proof state:
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

Next tactic:
erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X)))
      ⟨X.toΓSpecFun x, by rw [basicOpen_one]; trivial⟩]
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  rw [PresheafedSpace.stalkMap]
  erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X)))
      ⟨X.toΓSpecFun x, by 

Proof state:
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ toΓSpecFun X x ∈ basicOpen 1

Next tactic:
rw [basicOpen_one]
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  rw [PresheafedSpace.stalkMap]
  erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X)))
      ⟨X.toΓSpecFun x, by rw [basicOpen_one]; 

Proof state:
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ toΓSpecFun X x ∈ ⊤

Next tactic:
trivial
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  rw [PresheafedSpace.stalkMap]
  erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X)))
      ⟨X.toΓSpecFun x, by rw [basicOpen_one]; trivial⟩]
  

Proof state:
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

Next tactic:
rw [← Category.assoc, Category.assoc (toOpen _ _)]
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  rw [PresheafedSpace.stalkMap]
  erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X)))
      ⟨X.toΓSpecFun x, by rw [basicOpen_one]; trivial⟩]
  rw [← Category.assoc, Category.assoc (toOpen _ _)]
  

Proof state:
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

Next tactic:
erw [stalkFunctor_map_germ]
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  rw [PresheafedSpace.stalkMap]
  erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X)))
      ⟨X.toΓSpecFun x, by rw [basicOpen_one]; trivial⟩]
  rw [← Category.assoc, Category.assoc (toOpen _ _)]
  erw [stalkFunctor_map_germ]
  -- Porting note : was `rw [← assoc, toΓSpecSheafedSpace_app_spec]`, but Lean did not like it.
  

Proof state:
X : LocallyRingedSpace
r : ↑(Γ.obj (op X))
x : ↑(toTopCat X)
⊢ (toOpen (↑(Γ.obj (op X))) (basicOpen 1) ≫
        (toΓSpecSheafedSpace X).c.app (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

Next tactic:
rw [toΓSpecSheafedSpace_app_spec_assoc]
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  rw [PresheafedSpace.stalkMap]
  erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X)))
      ⟨X.toΓSpecFun x, by rw [basicOpen_one]; trivial⟩]
  rw [← Category.assoc, Category.assoc (toOpen _ _)]
  erw [stalkFunctor_map_germ]
  -- Porting note : was `rw [← assoc, toΓSpecSheafedSpace_app_spec]`, but Lean did not like it.
  rw [toΓSpecSheafedSpace_app_spec_assoc]
  

Proof state:
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

Next tactic:
unfold ΓToStalk
/-- The map on stalks induced by the unit commutes with maps from `Γ(X)` to
    stalks (in `Spec Γ(X)` and in `X`). -/
theorem toStalk_stalkMap_toΓSpec (x : X) :
    toStalk _ _ ≫ PresheafedSpace.stalkMap X.toΓSpecSheafedSpace x = X.ΓToStalk x := by
  rw [PresheafedSpace.stalkMap]
  erw [← toOpen_germ _ (basicOpen (1 : Γ.obj (op X)))
      ⟨X.toΓSpecFun x, by rw [basicOpen_one]; trivial⟩]
  rw [← Category.assoc, Category.assoc (toOpen _ _)]
  erw [stalkFunctor_map_germ]
  -- Porting note : was `rw [← assoc, toΓSpecSheafedSpace_app_spec]`, but Lean did not like it.
  rw [toΓSpecSheafedSpace_app_spec_assoc]
  unfold ΓToStalk
  

Proof state:
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 }

Next tactic:
rw [← stalkPushforward_germ _ X.toΓSpecBase X.presheaf ⊤]