[GOAL]
X Y : Scheme
f : X ⟶ Y
inst✝ : IsIso f
h : IsAffine Y
⊢ IsAffine X
[PROOFSTEP]
rw [← mem_Spec_essImage] at h ⊢
[GOAL]
X Y : Scheme
f : X ⟶ Y
inst✝ : IsIso f
h : Y ∈ Functor.essImage Scheme.Spec
⊢ X ∈ Functor.essImage Scheme.Spec
[PROOFSTEP]
exact Functor.essImage.ofIso (asIso f).symm h
[GOAL]
⊢ HasLimits AffineScheme
[PROOFSTEP]
haveI := Adjunction.has_colimits_of_equivalence Γ.{u}
[GOAL]
this : HasColimitsOfSize.{u, u, u, u + 1} AffineSchemeᵒᵖ
⊢ HasLimits AffineScheme
[PROOFSTEP]
haveI : HasLimits AffineScheme.{u}ᵒᵖᵒᵖ := Limits.hasLimits_op_of_hasColimits
[GOAL]
this✝ : HasColimitsOfSize.{u, u, u, u + 1} AffineSchemeᵒᵖ
this : HasLimits AffineSchemeᵒᵖᵒᵖ
⊢ HasLimits AffineScheme
[PROOFSTEP]
exact Adjunction.has_limits_of_equivalence (opOpEquivalence AffineScheme.{u}).inverse
[GOAL]
⊢ PreservesLimits forgetToScheme
[PROOFSTEP]
apply (config := { allowSynthFailures := true })
  @preservesLimitsOfNatIso _ _ _ _ _ _ (isoWhiskerRight equivCommRingCat.unitIso forgetToScheme).symm
[GOAL]
⊢ PreservesLimitsOfSize.{?u.56375, ?u.56375, ?u.56375, ?u.56375, ?u.56375 + 1, ?u.56375 + 1}
    ((equivCommRingCat.functor ⋙ equivCommRingCat.inverse) ⋙ forgetToScheme)
[PROOFSTEP]
change PreservesLimits (equivCommRingCat.functor ⋙ Scheme.Spec)
[GOAL]
⊢ PreservesLimits (equivCommRingCat.functor ⋙ Scheme.Spec)
[PROOFSTEP]
infer_instance
[GOAL]
X Y : Scheme
inst✝ : IsAffine X
f : X ⟶ Y
H : IsOpenImmersion f
⊢ IsAffineOpen (Scheme.Hom.opensRange f)
[PROOFSTEP]
refine' isAffineOfIso (IsOpenImmersion.isoOfRangeEq f (Y.ofRestrict _) _).inv
[GOAL]
X Y : Scheme
inst✝ : IsAffine X
f : X ⟶ Y
H : IsOpenImmersion f
⊢ Set.range ↑f.val.base =
    Set.range ↑(Scheme.ofRestrict Y (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.Hom.opensRange f)))).val.base
[PROOFSTEP]
exact Subtype.range_val.symm
[GOAL]
X : Scheme
inst✝ : IsAffine X
⊢ IsAffineOpen ⊤
[PROOFSTEP]
convert rangeIsAffineOpenOfOpenImmersion (𝟙 X)
[GOAL]
case h.e'_2
X : Scheme
inst✝ : IsAffine X
⊢ ⊤ = Scheme.Hom.opensRange (𝟙 X)
[PROOFSTEP]
ext1
[GOAL]
case h.e'_2.h
X : Scheme
inst✝ : IsAffine X
⊢ ↑⊤ = ↑(Scheme.Hom.opensRange (𝟙 X))
[PROOFSTEP]
exact Set.range_id.symm
[GOAL]
X : Scheme
⊢ Opens.IsBasis (Scheme.affineOpens X)
[PROOFSTEP]
rw [Opens.isBasis_iff_nbhd]
[GOAL]
X : Scheme
⊢ ∀ {U : Opens ↑↑X.toPresheafedSpace} {x : ↑↑X.toPresheafedSpace},
    x ∈ U → ∃ U', U' ∈ Scheme.affineOpens X ∧ x ∈ U' ∧ U' ≤ U
[PROOFSTEP]
rintro U x (hU : x ∈ (U : Set X))
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑X.toPresheafedSpace
hU : x ∈ ↑U
⊢ ∃ U', U' ∈ Scheme.affineOpens X ∧ x ∈ U' ∧ U' ≤ U
[PROOFSTEP]
obtain ⟨S, hS, hxS, hSU⟩ := X.affineBasisCover_is_basis.exists_subset_of_mem_open hU U.isOpen
[GOAL]
case intro.intro.intro
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑X.toPresheafedSpace
hU : x ∈ ↑U
S : Set ↑↑X.toPresheafedSpace
hS : S ∈ {x | ∃ a, x = Set.range ↑(Scheme.OpenCover.map (Scheme.affineBasisCover X) a).val.base}
hxS : x ∈ S
hSU : S ⊆ ↑U
⊢ ∃ U', U' ∈ Scheme.affineOpens X ∧ x ∈ U' ∧ U' ≤ U
[PROOFSTEP]
refine' ⟨⟨S, X.affineBasisCover_is_basis.isOpen hS⟩, _, hxS, hSU⟩
[GOAL]
case intro.intro.intro
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑X.toPresheafedSpace
hU : x ∈ ↑U
S : Set ↑↑X.toPresheafedSpace
hS : S ∈ {x | ∃ a, x = Set.range ↑(Scheme.OpenCover.map (Scheme.affineBasisCover X) a).val.base}
hxS : x ∈ S
hSU : S ⊆ ↑U
⊢ { carrier := S, is_open' := (_ : IsOpen S) } ∈ Scheme.affineOpens X
[PROOFSTEP]
rcases hS with ⟨i, rfl⟩
[GOAL]
case intro.intro.intro.intro
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑X.toPresheafedSpace
hU : x ∈ ↑U
i : (Scheme.affineBasisCover X).J
hxS : x ∈ Set.range ↑(Scheme.OpenCover.map (Scheme.affineBasisCover X) i).val.base
hSU : Set.range ↑(Scheme.OpenCover.map (Scheme.affineBasisCover X) i).val.base ⊆ ↑U
⊢ { carrier := Set.range ↑(Scheme.OpenCover.map (Scheme.affineBasisCover X) i).val.base,
      is_open' := (_ : IsOpen (Set.range ↑(Scheme.OpenCover.map (Scheme.affineBasisCover X) i).val.base)) } ∈
    Scheme.affineOpens X
[PROOFSTEP]
exact rangeIsAffineOpenOfOpenImmersion _
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Scheme.Spec.obj (op (X.presheaf.obj (op U))) ⟶ X
[PROOFSTEP]
haveI : IsAffine (X.restrict U.openEmbedding) := hU
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ Scheme.Spec.obj (op (X.presheaf.obj (op U))) ⟶ X
[PROOFSTEP]
have : U.openEmbedding.isOpenMap.functor.obj ⊤ = U := by ext1; exact Set.image_univ.trans Subtype.range_coe
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U
[PROOFSTEP]
ext1
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ ↑((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤) = ↑U
[PROOFSTEP]
exact Set.image_univ.trans Subtype.range_coe
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
this : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U
⊢ Scheme.Spec.obj (op (X.presheaf.obj (op U))) ⟶ X
[PROOFSTEP]
exact
  Scheme.Spec.map (X.presheaf.map (eqToHom this.symm).op).op ≫ (X.restrict U.openEmbedding).isoSpec.inv ≫ X.ofRestrict _
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsOpenImmersion (fromSpec hU)
[PROOFSTEP]
delta IsAffineOpen.fromSpec
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsOpenImmersion
    (let_fun this := (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U);
    Scheme.Spec.map
        (X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
      (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv ≫
        Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
[PROOFSTEP]
dsimp
  -- Porting note : this was automatic
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsOpenImmersion
    (Scheme.Spec.map
        (X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
      (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv ≫
        Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
[PROOFSTEP]
repeat apply (config := { allowSynthFailures := true }) PresheafedSpace.IsOpenImmersion.comp
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsOpenImmersion
    (Scheme.Spec.map
        (X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
      (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv ≫
        Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
[PROOFSTEP]
apply (config := { allowSynthFailures := true }) PresheafedSpace.IsOpenImmersion.comp
[GOAL]
case hg
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ PresheafedSpace.IsOpenImmersion
    ((Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv ≫
        Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val
[PROOFSTEP]
apply (config := { allowSynthFailures := true }) PresheafedSpace.IsOpenImmersion.comp
[GOAL]

[PROOFSTEP]
apply (config := { allowSynthFailures := true }) PresheafedSpace.IsOpenImmersion.comp
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Set.range ↑(fromSpec hU).val.base = ↑U
[PROOFSTEP]
delta IsAffineOpen.fromSpec
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Set.range
      ↑(let_fun this := (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U);
            Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
              (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv ≫
                Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base =
    ↑U
[PROOFSTEP]
dsimp
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Set.range
      ↑((Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom
                        (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base ≫
          (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv.val.base ≫
            Opens.inclusion U) =
    ↑U
[PROOFSTEP]
erw [← Category.assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Set.range
      ↑(((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom
                          (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base ≫
            (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv.val.base) ≫
          Opens.inclusion U) =
    ↑U
[PROOFSTEP]
rw [coe_comp, Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Set.range ↑(Opens.inclusion U) = ↑U
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Function.Surjective
    ↑((Scheme.Spec.map
              (X.presheaf.map
                  (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base ≫
        (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv.val.base)
[PROOFSTEP]
exact Subtype.range_coe
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Function.Surjective
    ↑((Scheme.Spec.map
              (X.presheaf.map
                  (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base ≫
        (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv.val.base)
[PROOFSTEP]
rw [← TopCat.epi_iff_surjective]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ Epi
    ((Scheme.Spec.map
            (X.presheaf.map
                (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base ≫
      (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv.val.base)
[PROOFSTEP]
infer_instance
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ (IsOpenMap.functor (_ : IsOpenMap ↑(fromSpec hU).val.base)).obj ⊤ = U
[PROOFSTEP]
ext1
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ ↑((IsOpenMap.functor (_ : IsOpenMap ↑(fromSpec hU).val.base)).obj ⊤) = ↑U
[PROOFSTEP]
exact Set.image_univ.trans hU.fromSpec_range
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsCompact ↑U
[PROOFSTEP]
convert
  @IsCompact.image _ _ _ _ Set.univ hU.fromSpec.1.base PrimeSpectrum.compactSpace.1
    ((fromSpec hU).val.base.2)
      -- Porting note : `continuity` can't do this
[GOAL]
case h.e'_3.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
e_1✝ : ↑↑X.toPresheafedSpace = (forget TopCat).obj ↑X.toPresheafedSpace
⊢ ↑U = ↑(fromSpec hU).val.base '' Set.univ
[PROOFSTEP]
convert hU.fromSpec_range.symm
[GOAL]
case h.e'_3.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
e_1✝¹ : ↑↑X.toPresheafedSpace = (forget TopCat).obj ↑X.toPresheafedSpace
e_1✝ : Set ↑↑X.toPresheafedSpace = Set ((forget TopCat).obj ↑X.toPresheafedSpace)
⊢ ↑(fromSpec hU).val.base '' Set.univ = Set.range ↑(fromSpec hU).val.base
[PROOFSTEP]
exact Set.image_univ
[GOAL]
X Y : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : X ⟶ Y
H : IsOpenImmersion f
⊢ IsAffineOpen ((Scheme.Hom.opensFunctor f).obj U)
[PROOFSTEP]
haveI : IsAffine _ := hU
[GOAL]
X Y : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : X ⟶ Y
H : IsOpenImmersion f
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ IsAffineOpen ((Scheme.Hom.opensFunctor f).obj U)
[PROOFSTEP]
have : IsOpenImmersion (X.ofRestrict U.openEmbedding ≫ f) :=
  PresheafedSpace.IsOpenImmersion.comp (hf := IsOpenImmersion.ofRestrict _ _) (hg := H)
[GOAL]
X Y : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : X ⟶ Y
H : IsOpenImmersion f
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
⊢ IsAffineOpen ((Scheme.Hom.opensFunctor f).obj U)
[PROOFSTEP]
convert rangeIsAffineOpenOfOpenImmersion (X.ofRestrict U.openEmbedding ≫ f)
[GOAL]
case h.e'_2
X Y : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : X ⟶ Y
H : IsOpenImmersion f
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
⊢ (Scheme.Hom.opensFunctor f).obj U =
    Scheme.Hom.opensRange (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
[PROOFSTEP]
ext1
[GOAL]
case h.e'_2.h
X Y : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : X ⟶ Y
H : IsOpenImmersion f
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
⊢ ↑((Scheme.Hom.opensFunctor f).obj U) =
    ↑(Scheme.Hom.opensRange (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f))
[PROOFSTEP]
exact Set.image_eq_range _ _
[GOAL]
X Y : Scheme
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X.toPresheafedSpace
⊢ IsAffineOpen ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U) ↔ IsAffineOpen U
[PROOFSTEP]
have : IsOpenImmersion (X.ofRestrict U.openEmbedding ≫ f) :=
  PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := H)
[GOAL]
X Y : Scheme
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X.toPresheafedSpace
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
⊢ IsAffineOpen ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U) ↔ IsAffineOpen U
[PROOFSTEP]
refine'
  ⟨fun hU =>
    @isAffineOfIso _ _ (IsOpenImmersion.isoOfRangeEq (X.ofRestrict U.openEmbedding ≫ f) (Y.ofRestrict _) _).hom ?_ hU,
    fun hU => hU.imageIsOpenImmersion f⟩
[GOAL]
case refine'_1
X Y : Scheme
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X.toPresheafedSpace
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
hU : IsAffineOpen ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)
⊢ Set.range ↑(Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).val.base =
    Set.range
      ↑(Scheme.ofRestrict Y
              (_ : OpenEmbedding ↑(Opens.inclusion ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)))).val.base
[PROOFSTEP]
rw [Scheme.comp_val_base, coe_comp, Set.range_comp]
[GOAL]
case refine'_1
X Y : Scheme
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X.toPresheafedSpace
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
hU : IsAffineOpen ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)
⊢ ↑f.val.base '' Set.range ↑(Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base =
    Set.range
      ↑(Scheme.ofRestrict Y
              (_ : OpenEmbedding ↑(Opens.inclusion ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)))).val.base
[PROOFSTEP]
dsimp [Opens.inclusion]
[GOAL]
case refine'_1
X Y : Scheme
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X.toPresheafedSpace
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
hU : IsAffineOpen ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)
⊢ ↑f.val.base '' Set.range ↑(ContinuousMap.mk Subtype.val) = Set.range ↑(ContinuousMap.mk Subtype.val)
[PROOFSTEP]
rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_coe, Subtype.range_coe]
[GOAL]
case refine'_1
X Y : Scheme
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X.toPresheafedSpace
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
hU : IsAffineOpen ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)
⊢ ↑f.val.base '' ↑U = ↑((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)
[PROOFSTEP]
rfl
[GOAL]
case refine'_2
X Y : Scheme
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X.toPresheafedSpace
this : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
hU : IsAffineOpen ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)
⊢ IsIso
    (IsOpenImmersion.isoOfRangeEq (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f)
        (Scheme.ofRestrict Y
          (_ : OpenEmbedding ↑(Opens.inclusion ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U))))
        (_ :
          Set.range ↑(Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)) ≫ f).val.base =
            Set.range
              ↑(Scheme.ofRestrict Y
                      (_ :
                        OpenEmbedding
                          ↑(Opens.inclusion ((PresheafedSpace.IsOpenImmersion.openFunctor H).obj U)))).val.base)).hom
[PROOFSTEP]
infer_instance
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ (Opens.map (fromSpec hU).val.base).obj U = ⊤
[PROOFSTEP]
ext1
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ ↑((Opens.map (fromSpec hU).val.base).obj U) = ↑⊤
[PROOFSTEP]
change hU.fromSpec.1.base ⁻¹' (U : Set X) = Set.univ
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ ↑(fromSpec hU).val.base ⁻¹' ↑U = Set.univ
[PROOFSTEP]
rw [← hU.fromSpec_range, ← Set.image_univ]
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ ↑(fromSpec hU).val.base ⁻¹' (↑(fromSpec hU).val.base '' Set.univ) = Set.univ
[PROOFSTEP]
exact Set.preimage_image_eq _ PresheafedSpace.IsOpenImmersion.base_open.inj
[GOAL]
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
h : U = V
W : (Opens ↑↑(Spec.obj (op (X.presheaf.obj (op V)))).toPresheafedSpace)ᵒᵖ
⊢ (Spec.obj (op (X.presheaf.obj (op V)))).presheaf.obj W =
    ((Spec.map (X.presheaf.map (eqToHom h).op).op).val.base _* (Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj W
[PROOFSTEP]
cases h
[GOAL]
case refl
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
W : (Opens ↑↑(Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace)ᵒᵖ
⊢ (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj W =
    ((Spec.map (X.presheaf.map (eqToHom (_ : U = U)).op).op).val.base _*
          (Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      W
[PROOFSTEP]
induction W using Opposite.rec'
[GOAL]
case refl.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
X✝ : Opens ↑↑(Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace
⊢ (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op X✝) =
    ((Spec.map (X.presheaf.map (eqToHom (_ : U = U)).op).op).val.base _*
          (Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op X✝)
[PROOFSTEP]
dsimp
[GOAL]
case refl.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
X✝ : Opens ↑↑(Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace
⊢ (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op X✝) =
    (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj
      (op ((Opens.map (Spec.map (X.presheaf.map (𝟙 (op U))).op).val.base).obj X✝))
[PROOFSTEP]
simp
[GOAL]
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
h : U = V
W : (Opens ↑↑(Spec.obj (op (X.presheaf.obj (op V)))).toPresheafedSpace)ᵒᵖ
⊢ NatTrans.app (Spec.map (X.presheaf.map (eqToHom h).op).op).val.c W =
    eqToHom
      (_ :
        (Spec.obj (op (X.presheaf.obj (op V)))).presheaf.obj W =
          ((Spec.map (X.presheaf.map (eqToHom h).op).op).val.base _*
                (Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
            W)
[PROOFSTEP]
have : Scheme.Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 _ := by rw [X.presheaf.map_id, op_id, Scheme.Spec.map_id]
[GOAL]
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
h : U = V
W : (Opens ↑↑(Spec.obj (op (X.presheaf.obj (op V)))).toPresheafedSpace)ᵒᵖ
⊢ Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 (Spec.obj (op (X.presheaf.obj (op U))))
[PROOFSTEP]
rw [X.presheaf.map_id, op_id, Scheme.Spec.map_id]
[GOAL]
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
h : U = V
W : (Opens ↑↑(Spec.obj (op (X.presheaf.obj (op V)))).toPresheafedSpace)ᵒᵖ
this : Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 (Spec.obj (op (X.presheaf.obj (op U))))
⊢ NatTrans.app (Spec.map (X.presheaf.map (eqToHom h).op).op).val.c W =
    eqToHom
      (_ :
        (Spec.obj (op (X.presheaf.obj (op V)))).presheaf.obj W =
          ((Spec.map (X.presheaf.map (eqToHom h).op).op).val.base _*
                (Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
            W)
[PROOFSTEP]
cases h
[GOAL]
case refl
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
this : Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 (Spec.obj (op (X.presheaf.obj (op U))))
W : (Opens ↑↑(Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace)ᵒᵖ
⊢ NatTrans.app (Spec.map (X.presheaf.map (eqToHom (_ : U = U)).op).op).val.c W =
    eqToHom
      (_ :
        (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj W =
          ((Spec.map (X.presheaf.map (eqToHom (_ : U = U)).op).op).val.base _*
                (Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
            W)
[PROOFSTEP]
refine' (Scheme.congr_app this _).trans _
[GOAL]
case refl
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
this : Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 (Spec.obj (op (X.presheaf.obj (op U))))
W : (Opens ↑↑(Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace)ᵒᵖ
⊢ NatTrans.app (𝟙 (Spec.obj (op (X.presheaf.obj (op U))))).val.c W ≫
      (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
        (eqToHom
          (_ :
            (Opens.map (𝟙 (Spec.obj (op (X.presheaf.obj (op U))))).val.base).op.obj W =
              (Opens.map (Spec.map (X.presheaf.map (𝟙 (op U))).op).val.base).op.obj W)) =
    eqToHom
      (_ :
        (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj W =
          ((Spec.map (X.presheaf.map (eqToHom (_ : U = U)).op).op).val.base _*
                (Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
            W)
[PROOFSTEP]
erw [Category.id_comp]
[GOAL]
case refl
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
this : Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 (Spec.obj (op (X.presheaf.obj (op U))))
W : (Opens ↑↑(Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace)ᵒᵖ
⊢ (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom
        (_ :
          (Opens.map (𝟙 (Spec.obj (op (X.presheaf.obj (op U))))).val.base).op.obj W =
            (Opens.map (Spec.map (X.presheaf.map (𝟙 (op U))).op).val.base).op.obj W)) =
    eqToHom
      (_ :
        (Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj W =
          ((Spec.map (X.presheaf.map (eqToHom (_ : U = U)).op).op).val.base _*
                (Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
            W)
[PROOFSTEP]
simp [eqToHom_map]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫ NatTrans.app (fromSpec hU).val.c (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
haveI : IsAffine _ := hU
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫ NatTrans.app (fromSpec hU).val.c (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
have e₁ := SpecΓIdentity.hom.naturality (X.presheaf.map (eqToHom U.openEmbedding_obj_top).op)
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₁ :
  (Spec.toLocallyRingedSpace.rightOp ⋙ LocallyRingedSpace.Γ).map
        (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op) ≫
      NatTrans.app SpecΓIdentity.hom
        (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫
      (𝟭 CommRingCat).map
        (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op)
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫ NatTrans.app (fromSpec hU).val.c (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
rw [← IsIso.comp_inv_eq] at e₁ 
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₁ :
  ((Spec.toLocallyRingedSpace.rightOp ⋙ LocallyRingedSpace.Γ).map
          (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op) ≫
        NatTrans.app SpecΓIdentity.hom
          (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)))) ≫
      inv
        ((𝟭 CommRingCat).map
          (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op)) =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫ NatTrans.app (fromSpec hU).val.c (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
have e₂ := ΓSpec.adjunction_unit_app_app_top (X.restrict U.openEmbedding)
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₁ :
  ((Spec.toLocallyRingedSpace.rightOp ⋙ LocallyRingedSpace.Γ).map
          (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op) ≫
        NatTrans.app SpecΓIdentity.hom
          (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)))) ≫
      inv
        ((𝟭 CommRingCat).map
          (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op)) =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫ NatTrans.app (fromSpec hU).val.c (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
erw [← e₂] at e₁ 
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₁ :
  ((Spec.toLocallyRingedSpace.rightOp ⋙ LocallyRingedSpace.Γ).map
          (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op) ≫
        NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤)) ≫
      inv
        ((𝟭 CommRingCat).map
          (X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op)) =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫ NatTrans.app (fromSpec hU).val.c (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
simp only [Functor.id_map, Quiver.Hom.unop_op, Functor.comp_map, ← Functor.map_inv, ← op_inv, LocallyRingedSpace.Γ_map,
  Category.assoc, Functor.rightOp_map, inv_eqToHom] at e₁ 
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫ NatTrans.app (fromSpec hU).val.c (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
delta IsAffineOpen.fromSpec Scheme.isoSpec
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫
      NatTrans.app
        (let_fun this := (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U);
            Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
              (asIso
                    (NatTrans.app ΓSpec.adjunction.unit
                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c
        (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
rw [Scheme.comp_val_c_app, Scheme.comp_val_c_app, ← e₁]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
⊢ (NatTrans.app
          (Spec.toLocallyRingedSpace.map
                (X.presheaf.map
                    (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
          (op ⊤) ≫
        NatTrans.app
            (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
            (op ⊤) ≫
          X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) ≫
      (NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
          NatTrans.app
            (asIso
                    (NatTrans.app ΓSpec.adjunction.unit
                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
            ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U))) ≫
        NatTrans.app
          (Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
          ((Opens.map
                  ((asIso
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                        Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
            (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
simp_rw [Category.assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op ≫
          NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
            NatTrans.app
                (asIso
                        (NatTrans.app ΓSpec.adjunction.unit
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
                ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U)) ≫
              NatTrans.app
                (Scheme.Spec.map
                      (X.presheaf.map
                          (eqToHom
                              (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
                ((Opens.map
                        ((asIso
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                              Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                  (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
erw [← X.presheaf.map_comp_assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map
            ((eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op ≫
              (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op) ≫
          NatTrans.app
              (asIso
                      (NatTrans.app ΓSpec.adjunction.unit
                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
              ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U)) ≫
            NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              ((Opens.map
                      ((asIso
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
rw [← op_comp]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map
            (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop ≫
                eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op ≫
          NatTrans.app
              (asIso
                      (NatTrans.app ΓSpec.adjunction.unit
                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
              ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U)) ≫
            NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              ((Opens.map
                      ((asIso
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
have e₃ :
  U.openEmbedding.isOpenMap.adjunction.counit.app U ≫ eqToHom U.openEmbedding_obj_top.symm =
    U.openEmbedding.isOpenMap.functor.map (eqToHom U.inclusion_map_eq_top) :=
  Subsingleton.elim _
    _
      -- Porting note : `e₄` needs two more explicit inputs
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₃ :
  NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit U ≫
      eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤) =
    (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
      (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤))
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map
            (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop ≫
                eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op ≫
          NatTrans.app
              (asIso
                      (NatTrans.app ΓSpec.adjunction.unit
                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
              ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U)) ≫
            NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              ((Opens.map
                      ((asIso
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
have e₄ := (asIso (ΓSpec.adjunction.unit.app (X.restrict U.openEmbedding))).inv.1.c.naturality_assoc
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₃ :
  NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit U ≫
      eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤) =
    (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
      (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤))
e₄ :
  ∀
    ⦃X_1 Y :
      (Opens ↑↑((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).toPresheafedSpace)ᵒᵖ⦄
    (f : X_1 ⟶ Y) {Z : CommRingCat}
    (h :
      ((asIso
                      (NatTrans.app ΓSpec.adjunction.unit
                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.base _*
              ((Scheme.Γ.rightOp ⋙ Scheme.Spec).obj
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf).obj
          Y ⟶
        Z),
    ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.map f ≫
        NatTrans.app
            (asIso
                    (NatTrans.app ΓSpec.adjunction.unit
                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
            Y ≫
          h =
      NatTrans.app
          (asIso
                  (NatTrans.app ΓSpec.adjunction.unit
                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
          X_1 ≫
        ((asIso
                        (NatTrans.app ΓSpec.adjunction.unit
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.base _*
                ((Scheme.Γ.rightOp ⋙ Scheme.Spec).obj
                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf).map
            f ≫
          h
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map
            (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop ≫
                eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op ≫
          NatTrans.app
              (asIso
                      (NatTrans.app ΓSpec.adjunction.unit
                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
              ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U)) ≫
            NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              ((Opens.map
                      ((asIso
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
dsimp at e₄ 
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₃ :
  NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit U ≫
      eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤) =
    (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
      (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤))
e₄ :
  ∀ ⦃X_1 Y : (Opens ↑((Opens.toTopCat ↑X.toPresheafedSpace).obj U))ᵒᵖ⦄ (f : X_1 ⟶ Y) {Z : CommRingCat}
    (h :
      (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
          (op
            ((Opens.map
                  (inv
                        (NatTrans.app ΓSpec.adjunction.unit
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
              Y.unop)) ⟶
        Z),
    X.presheaf.map ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map f.unop).op ≫
        NatTrans.app
            (inv
                  (NatTrans.app ΓSpec.adjunction.unit
                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
            Y ≫
          h =
      NatTrans.app
          (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
          X_1 ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            ((Opens.map
                    (inv
                          (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).map
                f.unop).op ≫
          h
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map
            (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop ≫
                eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op ≫
          NatTrans.app
              (asIso
                      (NatTrans.app ΓSpec.adjunction.unit
                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
              ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U)) ≫
            NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              ((Opens.map
                      ((asIso
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
replace e₄ := @e₄ (op ⊤) (op <| (Opens.map U.inclusion).obj U) (eqToHom U.inclusion_map_eq_top).op
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₃ :
  NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit U ≫
      eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤) =
    (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
      (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤))
e₄ :
  ∀ {Z : CommRingCat}
    (h :
      (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
          (op
            ((Opens.map
                  (inv
                        (NatTrans.app ΓSpec.adjunction.unit
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
              (op ((Opens.map (Opens.inclusion U)).obj U)).unop)) ⟶
        Z),
    X.presheaf.map
          ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
              (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
        NatTrans.app
            (inv
                  (NatTrans.app ΓSpec.adjunction.unit
                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
            (op ((Opens.map (Opens.inclusion U)).obj U)) ≫
          h =
      NatTrans.app
          (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
          (op ⊤) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            ((Opens.map
                    (inv
                          (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).map
                (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
          h
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map
            (NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop ≫
                eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op ≫
          NatTrans.app
              (asIso
                      (NatTrans.app ΓSpec.adjunction.unit
                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
              ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U)) ≫
            NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              ((Opens.map
                      ((asIso
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
erw [e₃, e₄, ← Scheme.comp_val_c_app_assoc, IsIso.inv_hom_id]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₃ :
  NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit U ≫
      eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤) =
    (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
      (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤))
e₄ :
  ∀ {Z : CommRingCat}
    (h :
      (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
          (op
            ((Opens.map
                  (inv
                        (NatTrans.app ΓSpec.adjunction.unit
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
              (op ((Opens.map (Opens.inclusion U)).obj U)).unop)) ⟶
        Z),
    X.presheaf.map
          ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
              (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
        NatTrans.app
            (inv
                  (NatTrans.app ΓSpec.adjunction.unit
                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
            (op ((Opens.map (Opens.inclusion U)).obj U)) ≫
          h =
      NatTrans.app
          (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
          (op ⊤) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            ((Opens.map
                    (inv
                          (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).map
                (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
          h
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (𝟙
                (Scheme.Spec.obj
                  (op (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)))))).val.c
          (op ⊤) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            ((Opens.map
                    (inv
                          (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).map
                (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
          NatTrans.app
            (Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
            ((Opens.map
                    ((asIso
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                          Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
              (op U)) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
      (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
simp only [eqToHom_map, eqToHom_op, Scheme.Spec_map_presheaf_map_eqToHom, eqToHom_unop, unop_op]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₃ :
  NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit U ≫
      eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤) =
    (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
      (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤))
e₄ :
  ∀ {Z : CommRingCat}
    (h :
      (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
          (op
            ((Opens.map
                  (inv
                        (NatTrans.app ΓSpec.adjunction.unit
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
              (op ((Opens.map (Opens.inclusion U)).obj U)).unop)) ⟶
        Z),
    X.presheaf.map
          ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
              (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
        NatTrans.app
            (inv
                  (NatTrans.app ΓSpec.adjunction.unit
                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
            (op ((Opens.map (Opens.inclusion U)).obj U)) ≫
          h =
      NatTrans.app
          (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
          (op ⊤) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            ((Opens.map
                    (inv
                          (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).map
                (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
          h
⊢ NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (𝟙
                (Scheme.Spec.obj
                  (op (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)))))).val.c
          (op ⊤) ≫
        eqToHom
            (_ :
              (Scheme.Spec.obj
                        (op
                          (X.presheaf.obj
                            (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
                  (op
                    ((Opens.map
                          (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                      ⊤)) =
                (Scheme.Spec.obj
                        (op
                          (X.presheaf.obj
                            (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
                  (op
                    ((Opens.map
                          (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                      ((Opens.map (Opens.inclusion U)).obj U)))) ≫
          eqToHom
            (_ :
              (Scheme.Spec.obj
                        (op
                          (X.presheaf.obj
                            (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
                  ((Opens.map
                          ((asIso
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                                Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                    (op U)) =
                ((Scheme.Spec.map
                            (X.presheaf.map
                                (eqToHom
                                    (_ :
                                      U =
                                        (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj
                                          ⊤)).op).op).val.base _*
                      (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
                  ((Opens.map
                          ((asIso
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                                Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                    (op U))) =
    eqToHom
      (_ :
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op ⊤) =
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj
            (op
              ((Opens.map
                    (Scheme.Spec.map
                            (X.presheaf.map
                                (eqToHom
                                    (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                          (asIso
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                U)))
[PROOFSTEP]
erw [Scheme.Spec_map_presheaf_map_eqToHom, Category.id_comp]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e₂ :
  NatTrans.app (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
      (op ⊤) =
    NatTrans.app SpecΓIdentity.hom
      ((Scheme.restrict X
                    (_ :
                      OpenEmbedding
                        ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
        (op ⊤))
e₁ :
  NatTrans.app
        (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op).val.c
        (op ⊤) ≫
      NatTrans.app
          (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.c
          (op ⊤) ≫
        X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op =
    NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U))
e₃ :
  NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit U ≫
      eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤) =
    (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
      (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤))
e₄ :
  ∀ {Z : CommRingCat}
    (h :
      (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
          (op
            ((Opens.map
                  (inv
                        (NatTrans.app ΓSpec.adjunction.unit
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
              (op ((Opens.map (Opens.inclusion U)).obj U)).unop)) ⟶
        Z),
    X.presheaf.map
          ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).map
              (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
        NatTrans.app
            (inv
                  (NatTrans.app ΓSpec.adjunction.unit
                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
            (op ((Opens.map (Opens.inclusion U)).obj U)) ≫
          h =
      NatTrans.app
          (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
          (op ⊤) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            ((Opens.map
                    (inv
                          (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).map
                (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op.unop).op ≫
          h
⊢ eqToHom
        (_ :
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op ⊤) =
            ((Scheme.Spec.map
                        (X.presheaf.map
                            (eqToHom
                                (_ :
                                  (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ =
                                    U)).op).op).val.base _*
                  (Scheme.Spec.obj
                      (op
                        (X.presheaf.obj
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf).obj
              (op ⊤)) ≫
      eqToHom
          (_ :
            (Scheme.Spec.obj
                      (op
                        (X.presheaf.obj
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
                (op
                  ((Opens.map
                        (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                    ⊤)) =
              (Scheme.Spec.obj
                      (op
                        (X.presheaf.obj
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
                (op
                  ((Opens.map
                        (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                    ((Opens.map (Opens.inclusion U)).obj U)))) ≫
        eqToHom
          (_ :
            (Scheme.Spec.obj
                      (op
                        (X.presheaf.obj
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
                ((Opens.map
                        ((asIso
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                              Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                  (op U)) =
              ((Scheme.Spec.map
                          (X.presheaf.map
                              (eqToHom
                                  (_ :
                                    U =
                                      (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj
                                        ⊤)).op).op).val.base _*
                    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
                ((Opens.map
                        ((asIso
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                              Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
                  (op U))) =
    eqToHom
      (_ :
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op ⊤) =
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj
            (op
              ((Opens.map
                    (Scheme.Spec.map
                            (X.presheaf.map
                                (eqToHom
                                    (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                          (asIso
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                U)))
[PROOFSTEP]
simp only [eqToHom_trans]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ NatTrans.app (fromSpec hU).val.c (op U) =
    NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
      (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
        (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
rw [← hU.SpecΓIdentity_hom_app_fromSpec, Iso.inv_hom_id_app_assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ IsAffineOpen (Scheme.basicOpen X f)
[PROOFSTEP]
have o1 :
  IsOpenImmersion <|
    Scheme.Spec.map (CommRingCat.ofHom (algebraMap ((X.presheaf.obj <| op U)) (Localization.Away f))).op ≫ hU.fromSpec
[GOAL]
case o1
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
[PROOFSTEP]
exact PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := inferInstance)
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
⊢ IsAffineOpen (Scheme.basicOpen X f)
[PROOFSTEP]
convert
  rangeIsAffineOpenOfOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (X.presheaf.obj (op U)) (Localization.Away f))).op ≫ hU.fromSpec)
[GOAL]
case h.e'_2
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
⊢ Scheme.basicOpen X f =
    Scheme.Hom.opensRange
      (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫
        fromSpec hU)
[PROOFSTEP]
ext1
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
⊢ ↑(Scheme.basicOpen X f) =
    ↑(Scheme.Hom.opensRange
        (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫
          fromSpec hU))
[PROOFSTEP]
have : hU.fromSpec.val.base '' (hU.fromSpec.val.base ⁻¹' (X.basicOpen f : Set X)) = (X.basicOpen f : Set X) :=
  by
  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left_iff_subset, hU.fromSpec_range]
  exact Scheme.basicOpen_le _ _
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
⊢ ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
[PROOFSTEP]
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left_iff_subset, hU.fromSpec_range]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
⊢ ↑(Scheme.basicOpen X f) ⊆ ↑U
[PROOFSTEP]
exact Scheme.basicOpen_le _ _
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑(Scheme.basicOpen X f) =
    ↑(Scheme.Hom.opensRange
        (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫
          fromSpec hU))
[PROOFSTEP]
rw [Scheme.Hom.opensRange_coe, Scheme.comp_val_base, ← this, coe_comp, Set.range_comp]
  -- Porting note : `congr 1` did not work
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) =
    ↑(fromSpec hU).val.base ''
      Set.range
        ↑(Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op).val.base
[PROOFSTEP]
apply congr_arg (_ '' ·)
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f) =
    Set.range
      ↑(Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op).val.base
[PROOFSTEP]
refine' (Opens.coe_inj.mpr <| Scheme.preimage_basicOpen hU.fromSpec f).trans _
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑(Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f)) =
    Set.range
      ↑(Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op).val.base
[PROOFSTEP]
refine' Eq.trans _ (PrimeSpectrum.localization_away_comap_range (Localization.Away f) f).symm
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑(Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f)) =
    ↑(PrimeSpectrum.basicOpen f)
[PROOFSTEP]
congr 1
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑(Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f)) =
    ↑(PrimeSpectrum.basicOpen f)
[PROOFSTEP]
have : (Opens.map hU.fromSpec.val.base).obj U = ⊤ := by
  ext1
  change hU.fromSpec.1.base ⁻¹' (U : Set X) = Set.univ
  rw [← hU.fromSpec_range, ← Set.image_univ]
  exact Set.preimage_image_eq _ PresheafedSpace.IsOpenImmersion.base_open.inj
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ (Opens.map (fromSpec hU).val.base).obj U = ⊤
[PROOFSTEP]
ext1
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑((Opens.map (fromSpec hU).val.base).obj U) = ↑⊤
[PROOFSTEP]
change hU.fromSpec.1.base ⁻¹' (U : Set X) = Set.univ
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑(fromSpec hU).val.base ⁻¹' ↑U = Set.univ
[PROOFSTEP]
rw [← hU.fromSpec_range, ← Set.image_univ]
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
⊢ ↑(fromSpec hU).val.base ⁻¹' (↑(fromSpec hU).val.base '' Set.univ) = Set.univ
[PROOFSTEP]
exact Set.preimage_image_eq _ PresheafedSpace.IsOpenImmersion.base_open.inj
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this✝ : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
this : (Opens.map (fromSpec hU).val.base).obj U = ⊤
⊢ ↑(Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f)) =
    ↑(PrimeSpectrum.basicOpen f)
[PROOFSTEP]
refine' Eq.trans _ (Opens.coe_inj.mpr <| basicOpen_eq_of_affine f)
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this✝ : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
this : (Opens.map (fromSpec hU).val.base).obj U = ⊤
⊢ ↑(Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f)) =
    ↑(Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
        (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).inv f))
[PROOFSTEP]
have lm : ∀ s, (Opens.map hU.fromSpec.val.base).obj U ⊓ s = s := fun s => this.symm ▸ top_inf_eq
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this✝ : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
this : (Opens.map (fromSpec hU).val.base).obj U = ⊤
lm :
  ∀ (s : Opens ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace),
    (Opens.map (fromSpec hU).val.base).obj U ⊓ s = s
⊢ ↑(Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f)) =
    ↑(Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
        (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).inv f))
[PROOFSTEP]
refine' Opens.coe_inj.mpr <| Eq.trans _ (lm _)
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this✝ : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
this : (Opens.map (fromSpec hU).val.base).obj U = ⊤
lm :
  ∀ (s : Opens ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace),
    (Opens.map (fromSpec hU).val.base).obj U ⊓ s = s
⊢ Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f) =
    (Opens.map (fromSpec hU).val.base).obj U ⊓
      Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
        (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).inv f)
[PROOFSTEP]
refine'
  Eq.trans _
    ((Scheme.Spec.obj <| op <| X.presheaf.obj <| op U).basicOpen_res _ (eqToHom this).op)
      -- Porting note : changed `rw` to `erw`
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this✝ : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
this : (Opens.map (fromSpec hU).val.base).obj U = ⊤
lm :
  ∀ (s : Opens ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace),
    (Opens.map (fromSpec hU).val.base).obj U ⊓ s = s
⊢ Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f) =
    Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
      (↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map (eqToHom this).op)
        (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).inv f))
[PROOFSTEP]
erw [← comp_apply]
[GOAL]
case h.e'_2.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this✝ : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
this : (Opens.map (fromSpec hU).val.base).obj U = ⊤
lm :
  ∀ (s : Opens ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace),
    (Opens.map (fromSpec hU).val.base).obj U ⊓ s = s
⊢ Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f) =
    Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
      (↑((SpecΓIdentity.app (X.presheaf.obj (op U))).inv ≫
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map (eqToHom this).op)
        f)
[PROOFSTEP]
congr 2
[GOAL]
case h.e'_2.h.e_f.e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this✝ : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
this : (Opens.map (fromSpec hU).val.base).obj U = ⊤
lm :
  ∀ (s : Opens ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace),
    (Opens.map (fromSpec hU).val.base).obj U ⊓ s = s
⊢ NatTrans.app (fromSpec hU).val.c (op U) =
    (SpecΓIdentity.app (X.presheaf.obj (op U))).inv ≫
      (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map (eqToHom this).op
[PROOFSTEP]
rw [Iso.eq_inv_comp]
[GOAL]
case h.e'_2.h.e_f.e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
o1 :
  IsOpenImmersion
    (Scheme.Spec.map (CommRingCat.ofHom (algebraMap (↑(X.presheaf.obj (op U))) (Localization.Away f))).op ≫ fromSpec hU)
this✝ : ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X f)) = ↑(Scheme.basicOpen X f)
this : (Opens.map (fromSpec hU).val.base).obj U = ⊤
lm :
  ∀ (s : Opens ↑↑(Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace),
    (Opens.map (fromSpec hU).val.base).obj U ⊓ s = s
⊢ (SpecΓIdentity.app (X.presheaf.obj (op U))).hom ≫ NatTrans.app (fromSpec hU).val.c (op U) =
    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map (eqToHom this).op
[PROOFSTEP]
erw [hU.SpecΓIdentity_hom_app_fromSpec]
[GOAL]
X : Scheme
r : ↑(X.presheaf.obj (op ⊤))
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsAffineOpen
    ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))).val.base).obj U)
[PROOFSTEP]
apply (isAffineOpen_iff_of_isOpenImmersion (X.ofRestrict (X.basicOpen r).openEmbedding) _).mp
[GOAL]
X : Scheme
r : ↑(X.presheaf.obj (op ⊤))
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsAffineOpen
    ((PresheafedSpace.IsOpenImmersion.openFunctor
          (_ : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))))).obj
      ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))).val.base).obj U))
[PROOFSTEP]
delta PresheafedSpace.IsOpenImmersion.openFunctor
[GOAL]
X : Scheme
r : ↑(X.presheaf.obj (op ⊤))
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsAffineOpen
    ((IsOpenMap.functor
          (_ :
            IsOpenMap
              ↑(Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))).val.base)).obj
      ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))).val.base).obj U))
[PROOFSTEP]
dsimp
[GOAL]
X : Scheme
r : ↑(X.presheaf.obj (op ⊤))
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsAffineOpen
    ((IsOpenMap.functor
          (_ :
            IsOpenMap
              ↑(Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion (Scheme.basicOpen X r)))).val.base)).obj
      ((Opens.map (Opens.inclusion (Scheme.basicOpen X r))).obj U))
[PROOFSTEP]
erw [Opens.functor_obj_map_obj, Opens.openEmbedding_obj_top, inf_comm, ← Scheme.basicOpen_res _ _ (homOfLE le_top).op]
[GOAL]
X : Scheme
r : ↑(X.presheaf.obj (op ⊤))
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
⊢ IsAffineOpen (Scheme.basicOpen X (↑(X.presheaf.map (homOfLE (_ : U ≤ ⊤)).op) r))
[PROOFSTEP]
exact hU.basicOpenIsAffine _
[GOAL]
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ (Opens.map (isoSpec X).hom.val.base).obj (PrimeSpectrum.basicOpen f) = basicOpen X f
[PROOFSTEP]
rw [← basicOpen_eq_of_affine]
[GOAL]
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ (Opens.map (isoSpec X).hom.val.base).obj
      (basicOpen (Spec.obj (op (Γ.obj (op X)))) (↑(SpecΓIdentity.app (Γ.obj (op X))).inv f)) =
    basicOpen X f
[PROOFSTEP]
trans
  (Opens.map X.isoSpec.hom.1.base).obj
    ((Scheme.Spec.obj (op (Scheme.Γ.obj (op X)))).basicOpen
      ((inv (X.isoSpec.hom.1.c.app (op ((Opens.map (inv X.isoSpec.hom).val.base).obj ⊤))))
        ((X.presheaf.map (eqToHom <| by congr)) f)))
[GOAL]
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ op ⊤ = (Opens.map (isoSpec X).hom.val.base).op.obj (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))
[PROOFSTEP]
congr
[GOAL]
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ (Opens.map (isoSpec X).hom.val.base).obj
      (basicOpen (Spec.obj (op (Γ.obj (op X)))) (↑(SpecΓIdentity.app (Γ.obj (op X))).inv f)) =
    (Opens.map (isoSpec X).hom.val.base).obj
      (basicOpen (Spec.obj (op (Γ.obj (op X))))
        (↑(inv (NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))))
          (↑(X.presheaf.map
                (eqToHom
                  (_ :
                    op ⊤ =
                      op
                        ((Opens.map (isoSpec X).hom.val.base).obj
                          (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤)).unop))))
            f)))
[PROOFSTEP]
congr
[GOAL]
case e_a.e_f.h.e_5.h
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ (SpecΓIdentity.app (Γ.obj (op X))).inv =
    inv (NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤)))
[PROOFSTEP]
rw [← IsIso.inv_eq_inv, IsIso.inv_inv, IsIso.Iso.inv_inv, NatIso.app_hom]
  -- Porting note : added this `change` to prevent timeout
[GOAL]
case e_a.e_f.h.e_5.h
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ NatTrans.app SpecΓIdentity.hom (Γ.obj (op X)) =
    NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))
[PROOFSTEP]
change SpecΓIdentity.hom.app (X.presheaf.obj <| op ⊤) = _
[GOAL]
case e_a.e_f.h.e_5.h
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op ⊤)) =
    NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))
[PROOFSTEP]
rw [← ΓSpec.adjunction_unit_app_app_top X]
[GOAL]
case e_a.e_f.h.e_5.h
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ NatTrans.app (NatTrans.app ΓSpec.adjunction.unit X).val.c (op ⊤) =
    NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))
[PROOFSTEP]
rfl
[GOAL]
case e_a.e_f.h.e_6.h
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ f =
    ↑(X.presheaf.map
          (eqToHom
            (_ :
              op ⊤ =
                op
                  ((Opens.map (isoSpec X).hom.val.base).obj
                    (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤)).unop))))
      f
[PROOFSTEP]
rw [eqToHom_map]
[GOAL]
case e_a.e_f.h.e_6.h
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ f =
    ↑(eqToHom
          (_ :
            X.presheaf.obj (op ⊤) =
              X.presheaf.obj
                ((Opens.map (isoSpec X).hom.val.base).op.obj (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤)))))
      f
[PROOFSTEP]
rfl
[GOAL]
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ (Opens.map (isoSpec X).hom.val.base).obj
      (basicOpen (Spec.obj (op (Γ.obj (op X))))
        (↑(inv (NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))))
          (↑(X.presheaf.map
                (eqToHom
                  (_ :
                    op ⊤ =
                      op
                        ((Opens.map (isoSpec X).hom.val.base).obj
                          (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤)).unop))))
            f))) =
    basicOpen X f
[PROOFSTEP]
dsimp
[GOAL]
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ (Opens.map (isoSpec X).hom.val.base).obj
      (basicOpen (Spec.obj (op (X.presheaf.obj (op ⊤))))
        (↑(inv (NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))))
          (↑(X.presheaf.map (𝟙 (op ⊤))) f))) =
    basicOpen X f
[PROOFSTEP]
congr
[GOAL]
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ (Opens.map (isoSpec X).hom.val.base).obj
      (basicOpen (Spec.obj (op (X.presheaf.obj (op ⊤))))
        (↑(inv (NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))))
          (↑(X.presheaf.map (𝟙 (op ⊤))) f))) =
    basicOpen X f
[PROOFSTEP]
refine'
  (Scheme.preimage_basicOpen _ _).trans
    _
      -- Porting note : changed `rw` to `erw`
[GOAL]
X : Scheme
inst✝ : IsAffine X
f : ↑(Γ.obj (op X))
⊢ basicOpen X
      (↑(NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤)))
        (↑(inv (NatTrans.app (isoSpec X).hom.val.c (op ((Opens.map (inv (isoSpec X).hom).val.base).obj ⊤))))
          (↑(X.presheaf.map (𝟙 (op ⊤))) f))) =
    basicOpen X f
[PROOFSTEP]
erw [IsIso.inv_hom_id_apply, Scheme.basicOpen_res_eq]
[GOAL]
X : Scheme
inst✝ : IsAffine X
⊢ Opens.IsBasis (Set.range (Scheme.basicOpen X))
[PROOFSTEP]
delta Opens.IsBasis
[GOAL]
X : Scheme
inst✝ : IsAffine X
⊢ IsTopologicalBasis (SetLike.coe '' Set.range (Scheme.basicOpen X))
[PROOFSTEP]
convert
  PrimeSpectrum.isBasis_basic_opens.inducing (TopCat.homeoOfIso (Scheme.forgetToTop.mapIso X.isoSpec)).inducing using 1
[GOAL]
case h.e'_3
X : Scheme
inst✝ : IsAffine X
⊢ SetLike.coe '' Set.range (Scheme.basicOpen X) =
    Set.preimage ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ''
      (SetLike.coe '' Set.range PrimeSpectrum.basicOpen)
[PROOFSTEP]
ext
[GOAL]
case h.e'_3.h
X : Scheme
inst✝ : IsAffine X
x✝ : Set ↑↑X.toPresheafedSpace
⊢ x✝ ∈ SetLike.coe '' Set.range (Scheme.basicOpen X) ↔
    x✝ ∈
      Set.preimage ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ''
        (SetLike.coe '' Set.range PrimeSpectrum.basicOpen)
[PROOFSTEP]
simp only [Set.mem_image, exists_exists_eq_and]
[GOAL]
case h.e'_3.h
X : Scheme
inst✝ : IsAffine X
x✝ : Set ↑↑X.toPresheafedSpace
⊢ (∃ x, x ∈ Set.range (Scheme.basicOpen X) ∧ ↑x = x✝) ↔
    ∃ x,
      (∃ x_1, x_1 ∈ Set.range PrimeSpectrum.basicOpen ∧ ↑x_1 = x) ∧
        ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ⁻¹' x = x✝
[PROOFSTEP]
constructor
[GOAL]
case h.e'_3.h.mp
X : Scheme
inst✝ : IsAffine X
x✝ : Set ↑↑X.toPresheafedSpace
⊢ (∃ x, x ∈ Set.range (Scheme.basicOpen X) ∧ ↑x = x✝) →
    ∃ x,
      (∃ x_1, x_1 ∈ Set.range PrimeSpectrum.basicOpen ∧ ↑x_1 = x) ∧
        ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ⁻¹' x = x✝
[PROOFSTEP]
rintro ⟨_, ⟨x, rfl⟩, rfl⟩
[GOAL]
case h.e'_3.h.mp.intro.intro.intro
X : Scheme
inst✝ : IsAffine X
x : ↑(X.presheaf.obj (op ⊤))
⊢ ∃ x_1,
    (∃ x, x ∈ Set.range PrimeSpectrum.basicOpen ∧ ↑x = x_1) ∧
      ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ⁻¹' x_1 = ↑(Scheme.basicOpen X x)
[PROOFSTEP]
refine' ⟨_, ⟨_, ⟨x, rfl⟩, rfl⟩, _⟩
[GOAL]
case h.e'_3.h.mp.intro.intro.intro
X : Scheme
inst✝ : IsAffine X
x : ↑(X.presheaf.obj (op ⊤))
⊢ ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ⁻¹' ↑(PrimeSpectrum.basicOpen x) =
    ↑(Scheme.basicOpen X x)
[PROOFSTEP]
exact congr_arg Opens.carrier (X.map_PrimeSpectrum_basicOpen_of_affine x)
[GOAL]
case h.e'_3.h.mpr
X : Scheme
inst✝ : IsAffine X
x✝ : Set ↑↑X.toPresheafedSpace
⊢ (∃ x,
      (∃ x_1, x_1 ∈ Set.range PrimeSpectrum.basicOpen ∧ ↑x_1 = x) ∧
        ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ⁻¹' x = x✝) →
    ∃ x, x ∈ Set.range (Scheme.basicOpen X) ∧ ↑x = x✝
[PROOFSTEP]
rintro ⟨_, ⟨_, ⟨x, rfl⟩, rfl⟩, rfl⟩
[GOAL]
case h.e'_3.h.mpr.intro.intro.intro.intro.intro
X : Scheme
inst✝ : IsAffine X
x : ↑(op (Scheme.Γ.obj (op X))).unop
⊢ ∃ x_1,
    x_1 ∈ Set.range (Scheme.basicOpen X) ∧
      ↑x_1 = ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ⁻¹' ↑(PrimeSpectrum.basicOpen x)
[PROOFSTEP]
refine' ⟨_, ⟨x, rfl⟩, _⟩
[GOAL]
case h.e'_3.h.mpr.intro.intro.intro.intro.intro
X : Scheme
inst✝ : IsAffine X
x : ↑(op (Scheme.Γ.obj (op X))).unop
⊢ ↑(Scheme.basicOpen X x) =
    ↑(TopCat.homeoOfIso (Scheme.forgetToTop.mapIso (Scheme.isoSpec X))) ⁻¹' ↑(PrimeSpectrum.basicOpen x)
[PROOFSTEP]
exact congr_arg Opens.carrier (X.map_PrimeSpectrum_basicOpen_of_affine x).symm
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
⊢ ∃ f, Scheme.basicOpen X f ≤ V ∧ ↑x ∈ Scheme.basicOpen X f
[PROOFSTEP]
haveI : IsAffine _ := hU
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ ∃ f, Scheme.basicOpen X f ≤ V ∧ ↑x ∈ Scheme.basicOpen X f
[PROOFSTEP]
obtain ⟨_, ⟨_, ⟨r, rfl⟩, rfl⟩, h₁, h₂⟩ :=
  (isBasis_basicOpen (X.restrict U.openEmbedding)).exists_subset_of_mem_open (x.2 : ⟨x, h⟩ ∈ _)
    ((Opens.map U.inclusion).obj V).isOpen
[GOAL]
case intro.intro.intro.intro.intro.intro
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
⊢ ∃ f, Scheme.basicOpen X f ≤ V ∧ ↑x ∈ Scheme.basicOpen X f
[PROOFSTEP]
have :
  U.openEmbedding.isOpenMap.functor.obj ((X.restrict U.openEmbedding).basicOpen r) =
    X.basicOpen (X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op r) :=
  by
  refine' (Scheme.image_basicOpen (X.ofRestrict U.openEmbedding) r).trans _
  erw [← Scheme.basicOpen_res_eq _ _ (eqToHom U.openEmbedding_obj_top).op]
  rw [← comp_apply, ← CategoryTheory.Functor.map_comp, ← op_comp, eqToHom_trans, eqToHom_refl, op_id,
    CategoryTheory.Functor.map_id, Scheme.Hom.invApp]
  erw [PresheafedSpace.IsOpenImmersion.ofRestrict_invApp]
  congr
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
⊢ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj
      (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) =
    Scheme.basicOpen X
      (↑(X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) r)
[PROOFSTEP]
refine' (Scheme.image_basicOpen (X.ofRestrict U.openEmbedding) r).trans _
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
⊢ Scheme.basicOpen X (↑(Scheme.Hom.invApp (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) ⊤) r) =
    Scheme.basicOpen X
      (↑(X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) r)
[PROOFSTEP]
erw [← Scheme.basicOpen_res_eq _ _ (eqToHom U.openEmbedding_obj_top).op]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
⊢ Scheme.basicOpen X (↑(Scheme.Hom.invApp (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) ⊤) r) =
    Scheme.basicOpen X
      (↑(X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op)
        (↑(X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) r))
[PROOFSTEP]
rw [← comp_apply, ← CategoryTheory.Functor.map_comp, ← op_comp, eqToHom_trans, eqToHom_refl, op_id,
  CategoryTheory.Functor.map_id, Scheme.Hom.invApp]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
⊢ Scheme.basicOpen X
      (↑(PresheafedSpace.IsOpenImmersion.invApp
            (_ : IsOpenImmersion (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ⊤)
        r) =
    Scheme.basicOpen X (↑(𝟙 (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)))) r)
[PROOFSTEP]
erw [PresheafedSpace.IsOpenImmersion.ofRestrict_invApp]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
⊢ Scheme.basicOpen X
      (↑(𝟙
            ((PresheafedSpace.restrict X.toPresheafedSpace (_ : OpenEmbedding ↑(Opens.inclusion U))).presheaf.obj
              (op ⊤)))
        r) =
    Scheme.basicOpen X (↑(𝟙 (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)))) r)
[PROOFSTEP]
congr
[GOAL]
case intro.intro.intro.intro.intro.intro
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
this :
  (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj
      (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) =
    Scheme.basicOpen X
      (↑(X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) r)
⊢ ∃ f, Scheme.basicOpen X f ≤ V ∧ ↑x ∈ Scheme.basicOpen X f
[PROOFSTEP]
use X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op r
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
this :
  (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj
      (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) =
    Scheme.basicOpen X
      (↑(X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) r)
⊢ Scheme.basicOpen X
        (↑(X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) r) ≤
      V ∧
    ↑x ∈
      Scheme.basicOpen X
        (↑(X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) r)
[PROOFSTEP]
rw [← this]
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
V : Opens ↑↑X.toPresheafedSpace
x : { x // x ∈ V }
h : ↑x ∈ U
this✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
r :
  ↑((Scheme.restrict X
                  (_ :
                    OpenEmbedding
                      ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
      (op ⊤))
h₁ : { val := ↑x, property := h } ∈ ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
h₂ :
  ↑(Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ⊆
    ↑((Opens.map (Opens.inclusion U)).obj V)
this :
  (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj
      (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) =
    Scheme.basicOpen X
      (↑(X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op) r)
⊢ (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj
        (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r) ≤
      V ∧
    ↑x ∈
      (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj
        (Scheme.basicOpen (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) r)
[PROOFSTEP]
exact ⟨Set.image_subset_iff.mpr h₂, ⟨_, h⟩, h₁, rfl⟩
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ (Opens.map (fromSpec hU).val.base).obj (Scheme.basicOpen X f) =
    RingedSpace.basicOpen
      (LocallyRingedSpace.forgetToSheafedSpace.op.obj
          (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
      (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f)
[PROOFSTEP]
erw [LocallyRingedSpace.preimage_basicOpen]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ RingedSpace.basicOpen
      (LocallyRingedSpace.toRingedSpace (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toLocallyRingedSpace)
      (↑(NatTrans.app (fromSpec hU).val.c (op U)) f) =
    RingedSpace.basicOpen
      (LocallyRingedSpace.forgetToSheafedSpace.op.obj
          (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
      (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f)
[PROOFSTEP]
refine'
  Eq.trans _
    (RingedSpace.basicOpen_res_eq (Scheme.Spec.obj <| op <| X.presheaf.obj (op U)).toLocallyRingedSpace.toRingedSpace
      (eqToHom hU.fromSpec_base_preimage).op _)
      -- Porting note : `congr` does not work
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ RingedSpace.basicOpen
      (LocallyRingedSpace.toRingedSpace (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toLocallyRingedSpace)
      (↑(NatTrans.app (fromSpec hU).val.c (op U)) f) =
    RingedSpace.basicOpen
      (LocallyRingedSpace.toRingedSpace (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toLocallyRingedSpace)
      (↑((LocallyRingedSpace.toRingedSpace
                    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toLocallyRingedSpace).toPresheafedSpace.presheaf.map
            (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op)
        (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f))
[PROOFSTEP]
refine
  congr_arg (RingedSpace.basicOpen _ ·)
    ?_
      -- Porting note : change `rw` to `erw`
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑(NatTrans.app (fromSpec hU).val.c (op U)) f =
    ↑((LocallyRingedSpace.toRingedSpace
                  (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toLocallyRingedSpace).toPresheafedSpace.presheaf.map
          (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op)
      (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f)
[PROOFSTEP]
erw [← comp_apply]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑(NatTrans.app (fromSpec hU).val.c (op U)) f =
    ↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
          (LocallyRingedSpace.toRingedSpace
                    (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toLocallyRingedSpace).toPresheafedSpace.presheaf.map
            (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op)
      f
[PROOFSTEP]
congr
[GOAL]
case e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ NatTrans.app (fromSpec hU).val.c (op U) =
    NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
      (LocallyRingedSpace.toRingedSpace
                (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toLocallyRingedSpace).toPresheafedSpace.presheaf.map
        (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op
[PROOFSTEP]
erw [← hU.SpecΓIdentity_hom_app_fromSpec]
[GOAL]
case e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ NatTrans.app (fromSpec hU).val.c (op U) =
    NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
      NatTrans.app SpecΓIdentity.hom (X.presheaf.obj (op U)) ≫ NatTrans.app (fromSpec hU).val.c (op U)
[PROOFSTEP]
rw [Iso.inv_hom_id_app_assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ IsIso (basicOpenSectionsToAffine hU f)
[PROOFSTEP]
delta basicOpenSectionsToAffine
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ IsIso
    (NatTrans.app (IsAffineOpen.fromSpec hU).val.c (op (Scheme.basicOpen X f)) ≫
      (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
        (eqToHom
            (_ :
              RingedSpace.basicOpen
                  (LocallyRingedSpace.forgetToSheafedSpace.op.obj
                      (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
                  (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f) =
                (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj (Scheme.basicOpen X f))).op)
[PROOFSTEP]
apply (config := { allowSynthFailures := true }) IsIso.comp_isIso
[GOAL]
case inst
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ IsIso (NatTrans.app (IsAffineOpen.fromSpec hU).val.c (op (Scheme.basicOpen X f)))
[PROOFSTEP]
apply PresheafedSpace.IsOpenImmersion.isIso_of_subset
[GOAL]
case inst.hU
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑(Scheme.basicOpen X f) ⊆ Set.range ↑(IsAffineOpen.fromSpec hU).val.base
[PROOFSTEP]
rw [hU.fromSpec_range]
[GOAL]
case inst.hU
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑(Scheme.basicOpen X f) ⊆ ↑U
[PROOFSTEP]
exact RingedSpace.basicOpen_le _ _
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
[PROOFSTEP]
apply
  (IsLocalization.isLocalization_iff_of_ringEquiv (Submonoid.powers f)
      (asIso <|
          basicOpenSectionsToAffine hU f ≫
            (Scheme.Spec.obj _).presheaf.map
              (eqToHom (basicOpen_eq_of_affine _).symm).op).commRingCatIsoToRingEquiv).mpr
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ IsLocalization (Submonoid.powers f)
    ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f)))
[PROOFSTEP]
convert StructureSheaf.IsLocalization.to_basicOpen _ f using 1
  -- Porting note : more hand holding is required here, the next 4 lines were not necessary
[GOAL]
case h.e'_3.h.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ RingHom.toAlgebra
      (RingHom.comp
        (RingEquiv.toRingHom
          (Iso.commRingCatIsoToRingEquiv
            (asIso
              (basicOpenSectionsToAffine hU f ≫
                (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
                  (eqToHom
                      (_ :
                        PrimeSpectrum.basicOpen f =
                          Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                            (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).inv f))).op))))
        (algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))) =
    StructureSheaf.openAlgebra (↑(X.presheaf.obj (op U))) (op (PrimeSpectrum.basicOpen f))
[PROOFSTEP]
delta StructureSheaf.openAlgebra
[GOAL]
case h.e'_3.h.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ RingHom.toAlgebra
      (RingHom.comp
        (RingEquiv.toRingHom
          (Iso.commRingCatIsoToRingEquiv
            (asIso
              (basicOpenSectionsToAffine hU f ≫
                (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
                  (eqToHom
                      (_ :
                        PrimeSpectrum.basicOpen f =
                          Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                            (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).inv f))).op))))
        (algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))) =
    RingHom.toAlgebra (StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (op (PrimeSpectrum.basicOpen f)).unop)
[PROOFSTEP]
congr 1
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ RingHom.comp
      (RingEquiv.toRingHom
        (Iso.commRingCatIsoToRingEquiv
          (asIso
            (basicOpenSectionsToAffine hU f ≫
              (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
                (eqToHom
                    (_ :
                      PrimeSpectrum.basicOpen f =
                        Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                          (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).inv f))).op))))
      (algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))) =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (op (PrimeSpectrum.basicOpen f)).unop
[PROOFSTEP]
rw [CommRingCat.ringHom_comp_eq_comp, Iso.commRingIsoToRingEquiv_toRingHom, asIso_hom]
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ CommRingCat.ofHom (algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))) ≫
      CommRingCat.ofHom
        (basicOpenSectionsToAffine hU f ≫
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
            (eqToHom
                (_ :
                  PrimeSpectrum.basicOpen f =
                    Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                      (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).inv f))).op) =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (op (PrimeSpectrum.basicOpen f)).unop
[PROOFSTEP]
dsimp [CommRingCat.ofHom]
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))) ≫
      basicOpenSectionsToAffine hU f ≫
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
          (eqToHom
              (_ :
                PrimeSpectrum.basicOpen f =
                  Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                    (↑(toSpecΓ (X.presheaf.obj (op U))) f))).op =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (PrimeSpectrum.basicOpen f)
[PROOFSTEP]
change X.presheaf.map _ ≫ basicOpenSectionsToAffine hU f ≫ _ = _
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ X.presheaf.map (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace f ≤ U)).op ≫
      basicOpenSectionsToAffine hU f ≫
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
          (eqToHom
              (_ :
                PrimeSpectrum.basicOpen f =
                  Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                    (↑(toSpecΓ (X.presheaf.obj (op U))) f))).op =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (PrimeSpectrum.basicOpen f)
[PROOFSTEP]
delta basicOpenSectionsToAffine
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ X.presheaf.map (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace f ≤ U)).op ≫
      (NatTrans.app (IsAffineOpen.fromSpec hU).val.c (op (Scheme.basicOpen X f)) ≫
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
            (eqToHom
                (_ :
                  RingedSpace.basicOpen
                      (LocallyRingedSpace.forgetToSheafedSpace.op.obj
                          (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
                      (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f) =
                    (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj (Scheme.basicOpen X f))).op) ≫
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
          (eqToHom
              (_ :
                PrimeSpectrum.basicOpen f =
                  Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                    (↑(toSpecΓ (X.presheaf.obj (op U))) f))).op =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (PrimeSpectrum.basicOpen f)
[PROOFSTEP]
simp only [Scheme.comp_val_c_app, Category.assoc]
  -- Porting note : `erw naturality_assoc` for some reason does not work, so changed to a version
    -- where `naturality` is used, the good thing is that `erw` is changed back to `rw`
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ X.presheaf.map (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace f ≤ U)).op ≫
      NatTrans.app (IsAffineOpen.fromSpec hU).val.c (op (Scheme.basicOpen X f)) ≫
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
            (eqToHom
                (_ :
                  RingedSpace.basicOpen
                      (LocallyRingedSpace.forgetToSheafedSpace.op.obj
                          (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
                      (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f) =
                    (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj (Scheme.basicOpen X f))).op ≫
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
            (eqToHom
                (_ :
                  PrimeSpectrum.basicOpen f =
                    Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                      (↑(toSpecΓ (X.presheaf.obj (op U))) f))).op =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (PrimeSpectrum.basicOpen f)
[PROOFSTEP]
simp only [← Category.assoc]
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ ((X.presheaf.map (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace f ≤ U)).op ≫
          NatTrans.app (IsAffineOpen.fromSpec hU).val.c (op (Scheme.basicOpen X f))) ≫
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
          (eqToHom
              (_ :
                RingedSpace.basicOpen
                    (LocallyRingedSpace.forgetToSheafedSpace.op.obj
                        (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
                    (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f) =
                  (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj (Scheme.basicOpen X f))).op) ≫
      (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
        (eqToHom
            (_ :
              PrimeSpectrum.basicOpen f =
                Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                  (↑(toSpecΓ (X.presheaf.obj (op U))) f))).op =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (PrimeSpectrum.basicOpen f)
[PROOFSTEP]
rw [hU.fromSpec.val.c.naturality, hU.fromSpec_app_eq]
  -- simp only [Category.assoc]
    -- rw [hU.fromSpec_app_eq]
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ (((NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
              (eqToHom (_ : (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj U = ⊤)).op) ≫
          ((IsAffineOpen.fromSpec hU).val.base _* (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
            (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace f ≤ U)).op) ≫
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
          (eqToHom
              (_ :
                RingedSpace.basicOpen
                    (LocallyRingedSpace.forgetToSheafedSpace.op.obj
                        (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
                    (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f) =
                  (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj (Scheme.basicOpen X f))).op) ≫
      (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
        (eqToHom
            (_ :
              PrimeSpectrum.basicOpen f =
                Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                  (↑(toSpecΓ (X.presheaf.obj (op U))) f))).op =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (PrimeSpectrum.basicOpen f)
[PROOFSTEP]
dsimp
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ (((toSpecΓ (X.presheaf.obj (op U)) ≫
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
              (eqToHom (_ : (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj U = ⊤)).op) ≫
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
            ((Opens.map (IsAffineOpen.fromSpec hU).val.base).map
                (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace f ≤ U))).op) ≫
        (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
          (eqToHom
              (_ :
                RingedSpace.basicOpen
                    (LocallyRingedSpace.forgetToSheafedSpace.op.obj
                        (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
                    (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f) =
                  (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj (Scheme.basicOpen X f))).op) ≫
      (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
        (eqToHom
            (_ :
              PrimeSpectrum.basicOpen f =
                Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                  (↑(toSpecΓ (X.presheaf.obj (op U))) f))).op =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (PrimeSpectrum.basicOpen f)
[PROOFSTEP]
simp only [Category.assoc, ← Functor.map_comp, ← op_comp]
[GOAL]
case h.e'_3.h.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
e_1✝ :
  ↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op (PrimeSpectrum.basicOpen f))) =
    ↑((structureSheaf ↑(X.presheaf.obj (op U))).val.obj (op (PrimeSpectrum.basicOpen f)))
he✝ : CommRing.toCommSemiring = CommRing.toCommSemiring
⊢ toSpecΓ (X.presheaf.obj (op U)) ≫
      (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
        (eqToHom
              (_ :
                PrimeSpectrum.basicOpen f =
                  Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U))))
                    (↑(toSpecΓ (X.presheaf.obj (op U))) f)) ≫
            eqToHom
                (_ :
                  RingedSpace.basicOpen
                      (LocallyRingedSpace.forgetToSheafedSpace.op.obj
                          (Spec.toLocallyRingedSpace.rightOp.obj (X.presheaf.obj (op U)))).unop
                      (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U))) f) =
                    (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj (Scheme.basicOpen X f)) ≫
              (Opens.map (IsAffineOpen.fromSpec hU).val.base).map
                  (homOfLE (_ : RingedSpace.basicOpen X.toSheafedSpace f ≤ U)) ≫
                eqToHom (_ : (Opens.map (IsAffineOpen.fromSpec hU).val.base).obj U = ⊤)).op =
    StructureSheaf.toOpen (↑(X.presheaf.obj (op U))) (PrimeSpectrum.basicOpen f)
[PROOFSTEP]
apply StructureSheaf.toOpen_res
[GOAL]
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : V ⟶ U
hU : IsAffineOpen U
r : ↑(X.presheaf.obj (op U))
e : V = Scheme.basicOpen X r
⊢ IsLocalization.Away r ↑(X.presheaf.obj (op V))
[PROOFSTEP]
subst e
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
r : ↑(X.presheaf.obj (op U))
i : Scheme.basicOpen X r ⟶ U
⊢ IsLocalization.Away r ↑(X.presheaf.obj (op (Scheme.basicOpen X r)))
[PROOFSTEP]
convert isLocalization_basicOpen hU r using 3
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
g : ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
⊢ ∃ f', Scheme.basicOpen X f' = Scheme.basicOpen X g
[PROOFSTEP]
haveI := isLocalization_basicOpen hU f
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
g : ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
this : IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
⊢ ∃ f', Scheme.basicOpen X f' = Scheme.basicOpen X g
[PROOFSTEP]
obtain ⟨x, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.surj'' (Submonoid.powers f) g
[GOAL]
case intro.intro.mk.intro
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
this : IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
x : ↑(X.presheaf.obj (op U))
n : ℕ
⊢ ∃ f',
    Scheme.basicOpen X f' =
      Scheme.basicOpen X
        (x •
          ↑(↑(IsLocalization.toInvSubmonoid (Submonoid.powers f) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))
              { val := (fun x x_1 => x ^ x_1) f n,
                property := (_ : ∃ y, (fun x x_1 => x ^ x_1) f y = (fun x x_1 => x ^ x_1) f n) }))
[PROOFSTEP]
use f * x
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
this : IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
x : ↑(X.presheaf.obj (op U))
n : ℕ
⊢ Scheme.basicOpen X (f * x) =
    Scheme.basicOpen X
      (x •
        ↑(↑(IsLocalization.toInvSubmonoid (Submonoid.powers f) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))
            { val := (fun x x_1 => x ^ x_1) f n,
              property := (_ : ∃ y, (fun x x_1 => x ^ x_1) f y = (fun x x_1 => x ^ x_1) f n) }))
[PROOFSTEP]
rw [Algebra.smul_def, Scheme.basicOpen_mul, Scheme.basicOpen_mul]
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
this : IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
x : ↑(X.presheaf.obj (op U))
n : ℕ
⊢ Scheme.basicOpen X f ⊓ Scheme.basicOpen X x =
    Scheme.basicOpen X (↑(algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))) x) ⊓
      Scheme.basicOpen X
        ↑(↑(IsLocalization.toInvSubmonoid (Submonoid.powers f) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))
            { val := (fun x x_1 => x ^ x_1) f n,
              property := (_ : ∃ y, (fun x x_1 => x ^ x_1) f y = (fun x x_1 => x ^ x_1) f n) })
[PROOFSTEP]
erw [Scheme.basicOpen_res]
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
this : IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
x : ↑(X.presheaf.obj (op U))
n : ℕ
⊢ Scheme.basicOpen X f ⊓ Scheme.basicOpen X x =
    Scheme.basicOpen X f ⊓ Scheme.basicOpen X x ⊓
      Scheme.basicOpen X
        ↑(↑(IsLocalization.toInvSubmonoid (Submonoid.powers f) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))
            { val := (fun x x_1 => x ^ x_1) f n,
              property := (_ : ∃ y, (fun x x_1 => x ^ x_1) f y = (fun x x_1 => x ^ x_1) f n) })
[PROOFSTEP]
refine' (inf_eq_left.mpr _).symm
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
this : IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
x : ↑(X.presheaf.obj (op U))
n : ℕ
⊢ Scheme.basicOpen X f ⊓ Scheme.basicOpen X x ≤
    Scheme.basicOpen X
      ↑(↑(IsLocalization.toInvSubmonoid (Submonoid.powers f) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))
          { val := (fun x x_1 => x ^ x_1) f n,
            property := (_ : ∃ y, (fun x x_1 => x ^ x_1) f y = (fun x x_1 => x ^ x_1) f n) })
[PROOFSTEP]
convert inf_le_left (α := Opens X) using 1
[GOAL]
case h.e'_4
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
this : IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
x : ↑(X.presheaf.obj (op U))
n : ℕ
⊢ Scheme.basicOpen X
      ↑(↑(IsLocalization.toInvSubmonoid (Submonoid.powers f) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))
          { val := (fun x x_1 => x ^ x_1) f n,
            property := (_ : ∃ y, (fun x x_1 => x ^ x_1) f y = (fun x x_1 => x ^ x_1) f n) }) =
    Scheme.basicOpen X f
[PROOFSTEP]
apply Scheme.basicOpen_of_isUnit
[GOAL]
case h.e'_4.hf
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
this : IsLocalization.Away f ↑(X.presheaf.obj (op (Scheme.basicOpen X f)))
x : ↑(X.presheaf.obj (op U))
n : ℕ
⊢ IsUnit
    ↑(↑(IsLocalization.toInvSubmonoid (Submonoid.powers f) ↑(X.presheaf.obj (op (Scheme.basicOpen X f))))
        { val := (fun x x_1 => x ^ x_1) f n,
          property := (_ : ∃ y, (fun x x_1 => x ^ x_1) f y = (fun x x_1 => x ^ x_1) f n) })
[PROOFSTEP]
apply
  Submonoid.leftInv_le_isUnit _
    (IsLocalization.toInvSubmonoid (Submonoid.powers f) (X.presheaf.obj (op <| X.basicOpen f)) _).prop
[GOAL]
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hV : IsAffineOpen V
x : ↑↑X.toPresheafedSpace
hx : x ∈ U ⊓ V
⊢ ∃ f g, Scheme.basicOpen X f = Scheme.basicOpen X g ∧ x ∈ Scheme.basicOpen X f
[PROOFSTEP]
obtain ⟨f, hf₁, hf₂⟩ := hU.exists_basicOpen_le ⟨x, hx.2⟩ hx.1
[GOAL]
case intro.intro
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hV : IsAffineOpen V
x : ↑↑X.toPresheafedSpace
hx : x ∈ U ⊓ V
f : ↑(X.presheaf.obj (op U))
hf₁ : Scheme.basicOpen X f ≤ V
hf₂ : ↑{ val := x, property := (_ : x ∈ ↑V) } ∈ Scheme.basicOpen X f
⊢ ∃ f g, Scheme.basicOpen X f = Scheme.basicOpen X g ∧ x ∈ Scheme.basicOpen X f
[PROOFSTEP]
obtain ⟨g, hg₁, hg₂⟩ := hV.exists_basicOpen_le ⟨x, hf₂⟩ hx.2
[GOAL]
case intro.intro.intro.intro
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hV : IsAffineOpen V
x : ↑↑X.toPresheafedSpace
hx : x ∈ U ⊓ V
f : ↑(X.presheaf.obj (op U))
hf₁ : Scheme.basicOpen X f ≤ V
hf₂ : ↑{ val := x, property := (_ : x ∈ ↑V) } ∈ Scheme.basicOpen X f
g : ↑(X.presheaf.obj (op V))
hg₁ : Scheme.basicOpen X g ≤ Scheme.basicOpen X f
hg₂ : ↑{ val := x, property := hf₂ } ∈ Scheme.basicOpen X g
⊢ ∃ f g, Scheme.basicOpen X f = Scheme.basicOpen X g ∧ x ∈ Scheme.basicOpen X f
[PROOFSTEP]
obtain ⟨f', hf'⟩ := basicOpen_basicOpen_is_basicOpen hU f (X.presheaf.map (homOfLE hf₁ : _ ⟶ V).op g)
[GOAL]
case intro.intro.intro.intro.intro
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hV : IsAffineOpen V
x : ↑↑X.toPresheafedSpace
hx : x ∈ U ⊓ V
f : ↑(X.presheaf.obj (op U))
hf₁ : Scheme.basicOpen X f ≤ V
hf₂ : ↑{ val := x, property := (_ : x ∈ ↑V) } ∈ Scheme.basicOpen X f
g : ↑(X.presheaf.obj (op V))
hg₁ : Scheme.basicOpen X g ≤ Scheme.basicOpen X f
hg₂ : ↑{ val := x, property := hf₂ } ∈ Scheme.basicOpen X g
f' : ↑(X.presheaf.obj (op U))
hf' : Scheme.basicOpen X f' = Scheme.basicOpen X (↑(X.presheaf.map (homOfLE hf₁).op) g)
⊢ ∃ f g, Scheme.basicOpen X f = Scheme.basicOpen X g ∧ x ∈ Scheme.basicOpen X f
[PROOFSTEP]
replace hf' := (hf'.trans (RingedSpace.basicOpen_res _ _ _)).trans (inf_eq_right.mpr hg₁)
[GOAL]
case intro.intro.intro.intro.intro
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
hV : IsAffineOpen V
x : ↑↑X.toPresheafedSpace
hx : x ∈ U ⊓ V
f : ↑(X.presheaf.obj (op U))
hf₁ : Scheme.basicOpen X f ≤ V
hf₂ : ↑{ val := x, property := (_ : x ∈ ↑V) } ∈ Scheme.basicOpen X f
g : ↑(X.presheaf.obj (op V))
hg₁ : Scheme.basicOpen X g ≤ Scheme.basicOpen X f
hg₂ : ↑{ val := x, property := hf₂ } ∈ Scheme.basicOpen X g
f' : ↑(X.presheaf.obj (op U))
hf' : Scheme.basicOpen X f' = RingedSpace.basicOpen (LocallyRingedSpace.toRingedSpace X.toLocallyRingedSpace) g
⊢ ∃ f g, Scheme.basicOpen X f = Scheme.basicOpen X g ∧ x ∈ Scheme.basicOpen X f
[PROOFSTEP]
exact ⟨f', g, hf', hf'.symm ▸ hg₂⟩
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : { x // x ∈ U }
⊢ ↑(fromSpec hU).val.base (primeIdealOf hU x) = ↑x
[PROOFSTEP]
dsimp only [IsAffineOpen.fromSpec, Subtype.coe_mk]
  -- Porting note : in the porting note of `Scheme.comp_val_base`, it says that `elementwise` is
    -- unnecessary, indeed, the linter did not like it, so I just use `elementwise_of%` instead of
    -- adding the corresponding lemma in `Scheme.lean` file
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : { x // x ∈ U }
⊢ ↑(Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
              (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv ≫
                Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base
      (primeIdealOf hU x) =
    ↑x
[PROOFSTEP]
erw [← elementwise_of% Scheme.comp_val_base, ← elementwise_of% Scheme.comp_val_base]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : { x // x ∈ U }
⊢ ↑((Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).hom ≫
              Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U)).op).op ≫
                Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                  (Scheme.isoSpec (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).inv ≫
                    Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base
      x =
    ↑x
[PROOFSTEP]
simp only [← Functor.map_comp_assoc, ← Functor.map_comp, ← op_comp, eqToHom_trans, op_id, eqToHom_refl,
  CategoryTheory.Functor.map_id, Category.id_comp, Iso.hom_inv_id_assoc]
  -- Porting note : `simpa` did not like this rfl
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : { x // x ∈ U }
⊢ ↑(Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base x = ↑x
[PROOFSTEP]
rfl
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
    ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj (op ((Opens.map (Opens.inclusion U)).obj U))).unop
[PROOFSTEP]
rw [Opens.inclusion_map_eq_top]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
    ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj (op ⊤)).unop
[PROOFSTEP]
rfl
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ ((Opens.map
              (inv
                    (NatTrans.app ΓSpec.adjunction.unit
                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
    (op ⊤).unop
[PROOFSTEP]
rw [Opens.inclusion_map_eq_top]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ ((Opens.map
              (inv
                    (NatTrans.app ΓSpec.adjunction.unit
                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
        (op ⊤)).unop =
    (op ⊤).unop
[PROOFSTEP]
rfl
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ NatTrans.app
      (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
      (op ((Opens.map (Opens.inclusion U)).obj U)) =
    X.presheaf.map
        (op
          (eqToHom
            (_ :
              (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
          (op
            (eqToHom
              (_ :
                ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                  (op ⊤).unop)))
[PROOFSTEP]
have e :
  (Opens.map (inv (ΓSpec.adjunction.unit.app (X.restrict U.openEmbedding))).1.base).obj
      ((Opens.map U.inclusion).obj U) =
    ⊤ :=
  by rw [Opens.inclusion_map_eq_top]; rfl
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ (Opens.map
          (inv
                (NatTrans.app ΓSpec.adjunction.unit
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
      ((Opens.map (Opens.inclusion U)).obj U) =
    ⊤
[PROOFSTEP]
rw [Opens.inclusion_map_eq_top]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ (Opens.map
          (inv
                (NatTrans.app ΓSpec.adjunction.unit
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
      ⊤ =
    ⊤
[PROOFSTEP]
rfl
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e :
  (Opens.map
          (inv
                (NatTrans.app ΓSpec.adjunction.unit
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
      ((Opens.map (Opens.inclusion U)).obj U) =
    ⊤
⊢ NatTrans.app
      (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
      (op ((Opens.map (Opens.inclusion U)).obj U)) =
    X.presheaf.map
        (op
          (eqToHom
            (_ :
              (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
          (op
            (eqToHom
              (_ :
                ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                  (op ⊤).unop)))
[PROOFSTEP]
rw [Scheme.inv_val_c_app, IsIso.comp_inv_eq, Scheme.app_eq _ e, ΓSpec.adjunction_unit_app_app_top]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e :
  (Opens.map
          (inv
                (NatTrans.app ΓSpec.adjunction.unit
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
      ((Opens.map (Opens.inclusion U)).obj U) =
    ⊤
⊢ ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.map
      (eqToHom
          (_ :
            (Opens.map
                    (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) ≫
                          inv
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                ((Opens.map (Opens.inclusion U)).obj U) =
              (Opens.map (Opens.inclusion U)).obj U)).op =
    (X.presheaf.map
          (op
            (eqToHom
              (_ :
                (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                  ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
        toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
          (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            (op
              (eqToHom
                (_ :
                  ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                    (op ⊤).unop)))) ≫
      ((Scheme.Γ.rightOp ⋙ Scheme.Spec).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.map
          (eqToHom
              (_ :
                ⊤ =
                  (Opens.map
                        (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                    ((Opens.map (Opens.inclusion U)).obj U))).op ≫
        NatTrans.app SpecΓIdentity.hom
            ((Scheme.restrict X
                          (_ :
                            OpenEmbedding
                              ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
              (op ⊤)) ≫
          ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.map
            (eqToHom
                (_ :
                  (Opens.map
                          (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).obj
                      ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                        ((Opens.map (Opens.inclusion U)).obj U)) =
                    (Opens.map
                          (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).obj
                      ⊤)).op
[PROOFSTEP]
simp only [Category.assoc, eqToHom_op, eqToHom_map]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e :
  (Opens.map
          (inv
                (NatTrans.app ΓSpec.adjunction.unit
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
      ((Opens.map (Opens.inclusion U)).obj U) =
    ⊤
⊢ eqToHom
      (_ :
        ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
            (op ((Opens.map (Opens.inclusion U)).obj U)) =
          ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
            (op
              ((Opens.map
                    (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) ≫
                          inv
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                ((Opens.map (Opens.inclusion U)).obj U)))) =
    X.presheaf.map
        (op
          (eqToHom
            (_ :
              (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            (op
              (eqToHom
                (_ :
                  ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                    (op ⊤).unop))) ≫
          eqToHom
              (_ :
                ((Scheme.Γ.rightOp ⋙ Scheme.Spec).obj
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                    (op
                      ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                        ((Opens.map (Opens.inclusion U)).obj U))) =
                  ((Scheme.Γ.rightOp ⋙ Scheme.Spec).obj
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                    (op ⊤)) ≫
            NatTrans.app SpecΓIdentity.hom
                ((Scheme.restrict X
                              (_ :
                                OpenEmbedding
                                  ↑(Opens.inclusion
                                      U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
                  (op ⊤)) ≫
              eqToHom
                (_ :
                  ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                      ((Opens.map
                              (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).op.obj
                        (op ⊤)) =
                    ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                      (op
                        ((Opens.map
                              (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).obj
                          ((Opens.map
                                (inv
                                      (NatTrans.app ΓSpec.adjunction.unit
                                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                            ((Opens.map (Opens.inclusion U)).obj U)))))
[PROOFSTEP]
erw [Scheme.presheaf_map_eqToHom_op, Scheme.presheaf_map_eqToHom_op]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e :
  (Opens.map
          (inv
                (NatTrans.app ΓSpec.adjunction.unit
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
      ((Opens.map (Opens.inclusion U)).obj U) =
    ⊤
⊢ eqToHom
      (_ :
        ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
            (op ((Opens.map (Opens.inclusion U)).obj U)) =
          ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
            (op
              ((Opens.map
                    (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) ≫
                          inv
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                ((Opens.map (Opens.inclusion U)).obj U)))) =
    eqToHom
        (_ :
          X.presheaf.obj
              (op
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop) =
            X.presheaf.obj (op (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop)) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        eqToHom
            (_ :
              (Scheme.Spec.obj
                        (op
                          (X.presheaf.obj
                            (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
                  (op (op ⊤).unop) =
                (Scheme.Spec.obj
                        (op
                          (X.presheaf.obj
                            (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.obj
                  (op
                    ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop)) ≫
          eqToHom
              (_ :
                ((Scheme.Γ.rightOp ⋙ Scheme.Spec).obj
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                    (op
                      ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                        ((Opens.map (Opens.inclusion U)).obj U))) =
                  ((Scheme.Γ.rightOp ⋙ Scheme.Spec).obj
                          (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                    (op ⊤)) ≫
            NatTrans.app SpecΓIdentity.hom
                ((Scheme.restrict X
                              (_ :
                                OpenEmbedding
                                  ↑(Opens.inclusion
                                      U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
                  (op ⊤)) ≫
              eqToHom
                (_ :
                  ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                      ((Opens.map
                              (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).op.obj
                        (op ⊤)) =
                    ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                      (op
                        ((Opens.map
                              (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).obj
                          ((Opens.map
                                (inv
                                      (NatTrans.app ΓSpec.adjunction.unit
                                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                            ((Opens.map (Opens.inclusion U)).obj U)))))
[PROOFSTEP]
simp only [eqToHom_trans_assoc, eqToHom_refl, Category.id_comp]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e :
  (Opens.map
          (inv
                (NatTrans.app ΓSpec.adjunction.unit
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
      ((Opens.map (Opens.inclusion U)).obj U) =
    ⊤
⊢ eqToHom
      (_ :
        ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
            (op ((Opens.map (Opens.inclusion U)).obj U)) =
          ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
            (op
              ((Opens.map
                    (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) ≫
                          inv
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                ((Opens.map (Opens.inclusion U)).obj U)))) =
    eqToHom
        (_ :
          X.presheaf.obj
              (op
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop) =
            X.presheaf.obj (op (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop)) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        NatTrans.app SpecΓIdentity.hom
            ((Scheme.restrict X
                          (_ :
                            OpenEmbedding
                              ↑(Opens.inclusion U))).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.obj
              (op ⊤)) ≫
          eqToHom
            (_ :
              ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                  ((Opens.map
                          (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).op.obj
                    (op ⊤)) =
                ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
                  (op
                    ((Opens.map
                          (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).obj
                      ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                        ((Opens.map (Opens.inclusion U)).obj U)))))
[PROOFSTEP]
erw [SpecΓIdentity.inv_hom_id_app_assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
inst✝ : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e :
  (Opens.map
          (inv
                (NatTrans.app ΓSpec.adjunction.unit
                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
      ((Opens.map (Opens.inclusion U)).obj U) =
    ⊤
⊢ eqToHom
      (_ :
        ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
            (op ((Opens.map (Opens.inclusion U)).obj U)) =
          ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
            (op
              ((Opens.map
                    (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))) ≫
                          inv
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                ((Opens.map (Opens.inclusion U)).obj U)))) =
    eqToHom
        (_ :
          X.presheaf.obj
              (op
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop) =
            X.presheaf.obj (op (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop)) ≫
      eqToHom
        (_ :
          ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
              ((Opens.map
                      (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).op.obj
                (op ⊤)) =
            ((𝟭 Scheme).obj (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).presheaf.obj
              (op
                ((Opens.map
                      (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))).val.base).obj
                  ((Opens.map
                        (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).obj
                    ((Opens.map (Opens.inclusion U)).obj U)))))
[PROOFSTEP]
rw [eqToHom_trans]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ NatTrans.app (fromSpec hU).val.c (op U) ≫
      TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toStalk (↑(X.presheaf.obj (op U))) y
[PROOFSTEP]
haveI : IsAffine _ := hU
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ NatTrans.app (fromSpec hU).val.c (op U) ≫
      TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toStalk (↑(X.presheaf.obj (op U))) y
[PROOFSTEP]
delta IsAffineOpen.fromSpec Scheme.isoSpec StructureSheaf.toStalk
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ NatTrans.app
        (let_fun this := (_ : (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤ = U);
            Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
              (asIso
                    (NatTrans.app ΓSpec.adjunction.unit
                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c
        (op U) ≫
      TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toOpen ↑(X.presheaf.obj (op U)) ⊤ ≫
      TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        { val := y, property := True.intro }
[PROOFSTEP]
simp only [Scheme.comp_val_c_app, Category.assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
      NatTrans.app
          (asIso
                  (NatTrans.app ΓSpec.adjunction.unit
                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv.val.c
          ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj (op U)) ≫
        NatTrans.app
            (Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
            ((Opens.map
                    ((asIso
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).inv ≫
                          Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).op.obj
              (op U)) ≫
          TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toOpen ↑(X.presheaf.obj (op U)) ⊤ ≫
      TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        { val := y, property := True.intro }
[PROOFSTEP]
dsimp only [Functor.op, asIso_inv, unop_op]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
      NatTrans.app
          (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.c
          (op ((Opens.map (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj U)) ≫
        NatTrans.app
            (Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
            (op
              ((Opens.map
                    (inv
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                          Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                U)) ≫
          TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toOpen ↑(X.presheaf.obj (op U)) ⊤ ≫
      TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        { val := y, property := True.intro }
[PROOFSTEP]
erw [IsAffineOpen.isLocalization_stalk_aux]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
      (X.presheaf.map
            (op
              (eqToHom
                (_ :
                  (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                    ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
          toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
            (Scheme.Spec.obj
                    (op
                      (X.presheaf.obj
                        (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
              (op
                (eqToHom
                  (_ :
                    ((Opens.map
                                (inv
                                      (NatTrans.app ΓSpec.adjunction.unit
                                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                          (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                      (op ⊤).unop)))) ≫
        NatTrans.app
            (Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
            (op
              ((Opens.map
                    (inv
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                          Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                U)) ≫
          TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toOpen ↑(X.presheaf.obj (op U)) ⊤ ≫
      TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        { val := y, property := True.intro }
[PROOFSTEP]
simp only [Category.assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
      X.presheaf.map
          (op
            (eqToHom
              (_ :
                (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                  ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
        toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
          (Scheme.Spec.obj
                    (op
                      (X.presheaf.obj
                        (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
              (op
                (eqToHom
                  (_ :
                    ((Opens.map
                                (inv
                                      (NatTrans.app ΓSpec.adjunction.unit
                                        (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                          (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                      (op ⊤).unop))) ≫
            NatTrans.app
                (Scheme.Spec.map
                      (X.presheaf.map
                          (eqToHom
                              (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
                (op
                  ((Opens.map
                        (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                              Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                    U)) ≫
              TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf
                { val := y, property := hy } =
    StructureSheaf.toOpen ↑(X.presheaf.obj (op U)) ⊤ ≫
      TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        { val := y, property := True.intro }
[PROOFSTEP]
conv_lhs => rw [← Category.assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
| NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
    X.presheaf.map
        (op
          (eqToHom
            (_ :
              (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            (op
              (eqToHom
                (_ :
                  ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                    (op ⊤).unop))) ≫
          NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              (op
                ((Opens.map
                      (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                  U)) ≫
            TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy }
[PROOFSTEP]
rw [← Category.assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
| NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
    X.presheaf.map
        (op
          (eqToHom
            (_ :
              (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            (op
              (eqToHom
                (_ :
                  ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                    (op ⊤).unop))) ≫
          NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              (op
                ((Opens.map
                      (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                  U)) ≫
            TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy }
[PROOFSTEP]
rw [← Category.assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
| NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
    X.presheaf.map
        (op
          (eqToHom
            (_ :
              (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            (op
              (eqToHom
                (_ :
                  ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                    (op ⊤).unop))) ≫
          NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              (op
                ((Opens.map
                      (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                  U)) ≫
            TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy }
[PROOFSTEP]
rw [← Category.assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ (NatTrans.app (Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.c (op U) ≫
        X.presheaf.map
          (op
            (eqToHom
              (_ :
                (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                  ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))) ≫
      toSpecΓ (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))) ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            (op
              (eqToHom
                (_ :
                  ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                    (op ⊤).unop))) ≫
          NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              (op
                ((Opens.map
                      (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                  U)) ≫
            TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toOpen ↑(X.presheaf.obj (op U)) ⊤ ≫
      TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        { val := y, property := True.intro }
[PROOFSTEP]
erw [← X.presheaf.map_comp, Spec_Γ_naturality_assoc]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ toSpecΓ (X.presheaf.obj (op U)) ≫
      LocallyRingedSpace.Γ.map
          (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                    op
                      (eqToHom
                        (_ :
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                            ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                                (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))).op).op ≫
        (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            (op
              (eqToHom
                (_ :
                  ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                    (op ⊤).unop))) ≫
          NatTrans.app
              (Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
              (op
                ((Opens.map
                      (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                            Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                  U)) ≫
            TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toOpen ↑(X.presheaf.obj (op U)) ⊤ ≫
      TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        { val := y, property := True.intro }
[PROOFSTEP]
congr 1
[GOAL]
case e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ LocallyRingedSpace.Γ.map
        (Spec.toLocallyRingedSpace.map
            (X.presheaf.map
                ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                  op
                    (eqToHom
                      (_ :
                        (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                          ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                              (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))).op).op ≫
      (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
          (op
            (eqToHom
              (_ :
                ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                  (op ⊤).unop))) ≫
        NatTrans.app
            (Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
            (op
              ((Opens.map
                    (inv
                            (NatTrans.app ΓSpec.adjunction.unit
                              (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                          Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
                U)) ≫
          TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
      { val := y, property := True.intro }
[PROOFSTEP]
simp only [← Category.assoc]
[GOAL]
case e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
⊢ ((LocallyRingedSpace.Γ.map
            (Spec.toLocallyRingedSpace.map
                (X.presheaf.map
                    ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                      op
                        (eqToHom
                          (_ :
                            (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                              ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                                  (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))).op).op ≫
          (Scheme.Spec.obj
                  (op
                    (X.presheaf.obj
                      (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
            (op
              (eqToHom
                (_ :
                  ((Opens.map
                              (inv
                                    (NatTrans.app ΓSpec.adjunction.unit
                                      (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                        (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                    (op ⊤).unop)))) ≫
        NatTrans.app
          (Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
          (op
            ((Opens.map
                  (inv
                          (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                        Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
              U))) ≫
      TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    TopCat.Presheaf.germ (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
      { val := y, property := True.intro }
[PROOFSTEP]
convert
  (Spec.structureSheaf (X.presheaf.obj <| op U)).presheaf.germ_res (U := (Opens.map hU.fromSpec.val.base).obj U)
    (homOfLE le_top) ⟨y, hy⟩ using
  2
[GOAL]
case h.e'_2.h.h.e'_6.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ (LocallyRingedSpace.Γ.map
          (Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                    op
                      (eqToHom
                        (_ :
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                            ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                                (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))).op).op ≫
        (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
          (op
            (eqToHom
              (_ :
                ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                  (op ⊤).unop)))) ≫
      NatTrans.app
        (Scheme.Spec.map
              (X.presheaf.map
                  (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
        (op
          ((Opens.map
                (inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                      Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
            U)) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
rw [Category.assoc]
[GOAL]
case h.e'_2.h.h.e'_6.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ LocallyRingedSpace.Γ.map
        (Spec.toLocallyRingedSpace.map
            (X.presheaf.map
                ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                  op
                    (eqToHom
                      (_ :
                        (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                          ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                              (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))).op).op ≫
      (Scheme.Spec.obj
                (op
                  (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤))))).presheaf.map
          (op
            (eqToHom
              (_ :
                ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                  (op ⊤).unop))) ≫
        NatTrans.app
          (Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
          (op
            ((Opens.map
                  (inv
                          (NatTrans.app ΓSpec.adjunction.unit
                            (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                        Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base).obj
              U)) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
erw [NatTrans.naturality]
[GOAL]
case h.e'_2.h.h.e'_6.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ LocallyRingedSpace.Γ.map
        (Spec.toLocallyRingedSpace.map
            (X.presheaf.map
                ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                  op
                    (eqToHom
                      (_ :
                        (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                          ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                              (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))).op).op ≫
      NatTrans.app
          (Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.c
          (op ⊤) ≫
        ((Scheme.Spec.map
                    (X.presheaf.map
                        (eqToHom
                            (_ :
                              U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base _*
              (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
          (op
            (eqToHom
              (_ :
                ((Opens.map
                            (inv
                                  (NatTrans.app ΓSpec.adjunction.unit
                                    (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                      (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                  (op ⊤).unop))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
rw [← LocallyRingedSpace.Γ_map_op, ← LocallyRingedSpace.Γ.map_comp_assoc, ← op_comp]
[GOAL]
case h.e'_2.h.h.e'_6.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ LocallyRingedSpace.Γ.map
        (Scheme.Spec.map
              (X.presheaf.map
                  (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
            Spec.toLocallyRingedSpace.map
              (X.presheaf.map
                  ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                    op
                      (eqToHom
                        (_ :
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                            ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                                (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))).op).op ≫
      ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom
                          (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base _*
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
        (op
          (eqToHom
            (_ :
              ((Opens.map
                          (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                (op ⊤).unop))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
erw [← Scheme.Spec.map_comp]
[GOAL]
case h.e'_2.h.h.e'_6.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ LocallyRingedSpace.Γ.map
        (Scheme.Spec.map
            ((X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
              (X.presheaf.map
                  ((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                    op
                      (eqToHom
                        (_ :
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                            ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                                (op ((Opens.map (Opens.inclusion U)).obj U))).unop)))).op)).op ≫
      ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom
                          (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base _*
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
        (op
          (eqToHom
            (_ :
              ((Opens.map
                          (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                (op ⊤).unop))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
rw [← op_comp, ← X.presheaf.map_comp]
[GOAL]
case h.e'_2.h.h.e'_6.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ LocallyRingedSpace.Γ.map
        (Scheme.Spec.map
            (X.presheaf.map
                (((NatTrans.app (IsOpenMap.adjunction (_ : IsOpenMap ↑(Opens.inclusion U))).counit (op U).unop).op ≫
                    op
                      (eqToHom
                        (_ :
                          (op ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).unop =
                            ((IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).op.obj
                                (op ((Opens.map (Opens.inclusion U)).obj U))).unop))) ≫
                  (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op)).op).op ≫
      ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom
                          (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base _*
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
        (op
          (eqToHom
            (_ :
              ((Opens.map
                          (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                (op ⊤).unop))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
convert_to LocallyRingedSpace.Γ.map (Quiver.Hom.op <| Scheme.Spec.map (X.presheaf.map (𝟙 (op U))).op) ≫ _ = _
[GOAL]
case h.e'_2.h.h.e'_6.h.convert_4
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ LocallyRingedSpace.Γ.map (Scheme.Spec.map (X.presheaf.map (𝟙 (op U))).op).op ≫
      ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom
                          (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base _*
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
        (op
          (eqToHom
            (_ :
              ((Opens.map
                          (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                (op ⊤).unop))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
simp only [CategoryTheory.Functor.map_id, op_id]
[GOAL]
case h.e'_2.h.h.e'_6.h.convert_4
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ LocallyRingedSpace.Γ.map (𝟙 (Scheme.Spec.obj (op (X.presheaf.obj (op U))))).op ≫
      ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom
                          (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base _*
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
        (op
          (eqToHom
            (_ :
              ((Opens.map
                          (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                (op ⊤).unop))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
erw [CategoryTheory.Functor.map_id]
[GOAL]
case h.e'_2.h.h.e'_6.h.convert_4
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ 𝟙 (LocallyRingedSpace.Γ.obj (op (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toLocallyRingedSpace)) ≫
      ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom
                          (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base _*
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
        (op
          (eqToHom
            (_ :
              ((Opens.map
                          (inv
                                (NatTrans.app ΓSpec.adjunction.unit
                                  (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
                (op ⊤).unop))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
rw [Category.id_comp]
[GOAL]
case h.e'_2.h.h.e'_6.h.convert_4
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
this : IsAffine (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))
e_1✝ :
  (LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) ⟶
      TopCat.Presheaf.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf y) =
    ((TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤) ⟶
      TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U))))
        ↑{ val := y, property := hy })
e_3✝ :
  LocallyRingedSpace.Γ.obj (op (Spec.toLocallyRingedSpace.obj (op (X.presheaf.obj (op U))))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj (op ⊤)
e_4✝ :
  ((Scheme.Spec.map
                  (X.presheaf.map
                      (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op ≫
                inv (NatTrans.app ΓSpec.adjunction.unit (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U)))) ≫
                  Scheme.ofRestrict X (_ : OpenEmbedding ↑(Opens.inclusion U))).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).obj
      (op U) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).obj
      (op ((Opens.map (fromSpec hU).val.base).obj U))
⊢ ((Scheme.Spec.map
                (X.presheaf.map
                    (eqToHom
                        (_ : U = (IsOpenMap.functor (_ : IsOpenMap ↑(Opens.inclusion U))).obj ⊤)).op).op).val.base _*
          (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf).map
      (op
        (eqToHom
          (_ :
            ((Opens.map
                        (inv
                              (NatTrans.app ΓSpec.adjunction.unit
                                (Scheme.restrict X (_ : OpenEmbedding ↑(Opens.inclusion U))))).val.base).op.obj
                  (op ((Opens.map (Opens.inclusion U)).obj U))).unop =
              (op ⊤).unop))) =
    (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))).map
      (homOfLE (_ : (Opens.map (fromSpec hU).val.base).obj U ≤ ⊤)).op
[PROOFSTEP]
rfl
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ IsLocalization.AtPrime (↑(TopCat.Presheaf.stalk X.presheaf (↑(fromSpec hU).val.base y))) y.asIdeal
[PROOFSTEP]
apply
  (@IsLocalization.isLocalization_iff_of_ringEquiv (R := X.presheaf.obj <| op 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 <| PresheafedSpace.stalkMap hU.fromSpec.1 y).commRingCatIsoToRingEquiv).mpr
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ IsLocalization (Ideal.primeCompl y.asIdeal)
    ↑(PresheafedSpace.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace y)
[PROOFSTEP]
convert StructureSheaf.IsLocalization.to_stalk (X.presheaf.obj <| op U) y using 1
[GOAL]
case a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ IsLocalization (Ideal.primeCompl y.asIdeal)
      ↑(PresheafedSpace.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace y) ↔
    IsLocalization.AtPrime
      (↑(TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))) y)) y.asIdeal
[PROOFSTEP]
delta IsLocalization.AtPrime StructureSheaf.stalkAlgebra
[GOAL]
case a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ IsLocalization (Ideal.primeCompl y.asIdeal)
      ↑(PresheafedSpace.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace y) ↔
    IsLocalization (Ideal.primeCompl y.asIdeal)
      ↑(TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))) y)
[PROOFSTEP]
rw [iff_iff_eq]
[GOAL]
case a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ IsLocalization (Ideal.primeCompl y.asIdeal)
      ↑(PresheafedSpace.stalk (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).toPresheafedSpace y) =
    IsLocalization (Ideal.primeCompl y.asIdeal)
      ↑(TopCat.Presheaf.stalk (TopCat.Sheaf.presheaf (structureSheaf ↑(X.presheaf.obj (op U)))) y)
[PROOFSTEP]
congr 2
[GOAL]
case a.h.e_6.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ RingHom.comp
      (RingEquiv.toRingHom (Iso.commRingCatIsoToRingEquiv (asIso (PresheafedSpace.stalkMap (fromSpec hU).val y))))
      (algebraMap ↑(X.presheaf.obj (op U)) ↑(TopCat.Presheaf.stalk X.presheaf (↑(fromSpec hU).val.base y))) =
    StructureSheaf.toStalk (↑(X.presheaf.obj (op U))) y
[PROOFSTEP]
rw [RingHom.algebraMap_toAlgebra]
[GOAL]
case a.h.e_6.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ RingHom.comp
      (RingEquiv.toRingHom (Iso.commRingCatIsoToRingEquiv (asIso (PresheafedSpace.stalkMap (fromSpec hU).val y))))
      (TopCat.Presheaf.germ X.presheaf { val := ↑(fromSpec hU).val.base y, property := hy }) =
    StructureSheaf.toStalk (↑(X.presheaf.obj (op U))) y
[PROOFSTEP]
refine' (PresheafedSpace.stalkMap_germ hU.fromSpec.1 _ ⟨_, hy⟩).trans _
[GOAL]
case a.h.e_6.h.e_i
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hy : ↑(fromSpec hU).val.base y ∈ U
⊢ NatTrans.app (fromSpec hU).val.c (op U) ≫
      TopCat.Presheaf.germ (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf { val := y, property := hy } =
    StructureSheaf.toStalk (↑(X.presheaf.obj (op U))) y
[PROOFSTEP]
apply hU.isLocalization_stalk_aux' y hy
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : { x // x ∈ U }
⊢ IsLocalization.AtPrime (↑(TopCat.Presheaf.stalk X.presheaf ↑x)) (primeIdealOf hU x).asIdeal
[PROOFSTEP]
rcases x with ⟨x, hx⟩
[GOAL]
case mk
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : ↑↑X.toPresheafedSpace
hx : x ∈ U
⊢ IsLocalization.AtPrime (↑(TopCat.Presheaf.stalk X.presheaf ↑{ val := x, property := hx }))
    (primeIdealOf hU { val := x, property := hx }).asIdeal
[PROOFSTEP]
let y := hU.primeIdealOf ⟨x, hx⟩
[GOAL]
case mk
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : ↑↑X.toPresheafedSpace
hx : x ∈ U
y : PrimeSpectrum ↑(X.presheaf.obj (op U)) := primeIdealOf hU { val := x, property := hx }
⊢ IsLocalization.AtPrime (↑(TopCat.Presheaf.stalk X.presheaf ↑{ val := x, property := hx }))
    (primeIdealOf hU { val := x, property := hx }).asIdeal
[PROOFSTEP]
have : hU.fromSpec.val.base y = x :=
  hU.fromSpec_primeIdealOf
    ⟨x, hx⟩
      -- Porting note : this is painful now, need to provide explicit instance
[GOAL]
case mk
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : ↑↑X.toPresheafedSpace
hx : x ∈ U
y : PrimeSpectrum ↑(X.presheaf.obj (op U)) := primeIdealOf hU { val := x, property := hx }
this : ↑(fromSpec hU).val.base y = x
⊢ IsLocalization.AtPrime (↑(TopCat.Presheaf.stalk X.presheaf ↑{ val := x, property := hx }))
    (primeIdealOf hU { val := x, property := hx }).asIdeal
[PROOFSTEP]
change
  @IsLocalization (M := y.asIdeal.primeCompl) (S := X.presheaf.stalk x) _ _
    (TopCat.Presheaf.algebra_section_stalk X.presheaf ⟨x, hx⟩)
[GOAL]
case mk
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : ↑↑X.toPresheafedSpace
hx : x ∈ U
y : PrimeSpectrum ↑(X.presheaf.obj (op U)) := primeIdealOf hU { val := x, property := hx }
this : ↑(fromSpec hU).val.base y = x
⊢ IsLocalization (Ideal.primeCompl y.asIdeal) ↑(TopCat.Presheaf.stalk X.presheaf x)
[PROOFSTEP]
clear_value y
[GOAL]
case mk
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
x : ↑↑X.toPresheafedSpace
hx : x ∈ U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
this : ↑(fromSpec hU).val.base y = x
⊢ IsLocalization (Ideal.primeCompl y.asIdeal) ↑(TopCat.Presheaf.stalk X.presheaf x)
[PROOFSTEP]
subst this
[GOAL]
case mk
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
y : PrimeSpectrum ↑(X.presheaf.obj (op U))
hx : ↑(fromSpec hU).val.base y ∈ U
⊢ IsLocalization (Ideal.primeCompl y.asIdeal) ↑(TopCat.Presheaf.stalk X.presheaf (↑(fromSpec hU).val.base y))
[PROOFSTEP]
convert hU.isLocalization_stalk' y hx
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ Scheme.basicOpen (Scheme.Spec.obj (op (X.presheaf.obj (op U)))) (↑(NatTrans.app (fromSpec hU).val.c (op U)) f) =
    PrimeSpectrum.basicOpen f
[PROOFSTEP]
rw [← Scheme.basicOpen_res_eq _ _ (eqToHom hU.fromSpec_base_preimage.symm).op, basicOpen_eq_of_affine',
  IsAffineOpen.fromSpec_app_eq]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ PrimeSpectrum.basicOpen
      (↑(SpecΓIdentity.app (X.presheaf.obj (op U))).hom
        (↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
              (eqToHom (_ : ⊤ = (Opens.map (fromSpec hU).val.base).obj U)).op)
          (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
                (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
                  (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op)
            f))) =
    PrimeSpectrum.basicOpen f
[PROOFSTEP]
congr
  -- Porting note : change `rw` to `erw`
[GOAL]
case e_r
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑(SpecΓIdentity.app (X.presheaf.obj (op U))).hom
      (↑((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
            (eqToHom (_ : ⊤ = (Opens.map (fromSpec hU).val.base).obj U)).op)
        (↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
              (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
                (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op)
          f)) =
    f
[PROOFSTEP]
erw [← comp_apply, ← comp_apply]
[GOAL]
case e_r
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑(((NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
              (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
                (eqToHom (_ : (Opens.map (fromSpec hU).val.base).obj U = ⊤)).op) ≫
            (Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.map
              (eqToHom (_ : ⊤ = (Opens.map (fromSpec hU).val.base).obj U)).op) ≫
          (SpecΓIdentity.app (X.presheaf.obj (op U))).hom)
      f =
    f
[PROOFSTEP]
rw [Category.assoc, ← Functor.map_comp (self := (Scheme.Spec.obj <| op (X.presheaf.obj <| op U)).presheaf), eqToHom_op,
  eqToHom_op, eqToHom_trans, eqToHom_refl, CategoryTheory.Functor.map_id]
  -- Porting note : change `rw` to `erw`
[GOAL]
case e_r
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑((NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫
            𝟙 ((Scheme.Spec.obj (op (X.presheaf.obj (op U)))).presheaf.obj (op ⊤))) ≫
          (SpecΓIdentity.app (X.presheaf.obj (op U))).hom)
      f =
    f
[PROOFSTEP]
erw [Category.comp_id]
[GOAL]
case e_r
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑(NatTrans.app SpecΓIdentity.inv (X.presheaf.obj (op U)) ≫ (SpecΓIdentity.app (X.presheaf.obj (op U))).hom) f = f
[PROOFSTEP]
rw [← Iso.app_inv, Iso.inv_hom_id]
[GOAL]
case e_r
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ ↑(𝟙 ((𝟭 CommRingCat).obj (X.presheaf.obj (op U)))) f = f
[PROOFSTEP]
rfl
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
f : ↑(X.presheaf.obj (op U))
⊢ (Opens.map (fromSpec hU).val.base).obj (Scheme.basicOpen X f) = PrimeSpectrum.basicOpen f
[PROOFSTEP]
simp only [IsAffineOpen.basicOpen_fromSpec_app, Scheme.preimage_basicOpen, eq_self_iff_true]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U ↔ Ideal.span s = ⊤
[PROOFSTEP]
trans ⋃ i : s, (PrimeSpectrum.basicOpen i.1).1 = Set.univ
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U ↔ ⋃ (i : ↑s), (PrimeSpectrum.basicOpen ↑i).carrier = Set.univ
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ⋃ (i : ↑s), (PrimeSpectrum.basicOpen ↑i).carrier = Set.univ ↔ Ideal.span s = ⊤
[PROOFSTEP]
trans hU.fromSpec.1.base ⁻¹' (⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U)).1 = hU.fromSpec.1.base ⁻¹' U.1
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U ↔
    ↑(fromSpec hU).val.base ⁻¹' (⨆ (f : ↑s), Scheme.basicOpen X ↑f).carrier = ↑(fromSpec hU).val.base ⁻¹' U.carrier
[PROOFSTEP]
refine' ⟨fun h => by rw [h], _⟩
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U
⊢ ↑(fromSpec hU).val.base ⁻¹' (⨆ (f : ↑s), Scheme.basicOpen X ↑f).carrier = ↑(fromSpec hU).val.base ⁻¹' U.carrier
[PROOFSTEP]
rw [h]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ↑(fromSpec hU).val.base ⁻¹' (⨆ (f : ↑s), Scheme.basicOpen X ↑f).carrier = ↑(fromSpec hU).val.base ⁻¹' U.carrier →
    ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U
[PROOFSTEP]
intro h
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : ↑(fromSpec hU).val.base ⁻¹' (⨆ (f : ↑s), Scheme.basicOpen X ↑f).carrier = ↑(fromSpec hU).val.base ⁻¹' U.carrier
⊢ ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U
[PROOFSTEP]
apply_fun Set.image hU.fromSpec.1.base at h 
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h :
  ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' (⨆ (f : ↑s), Scheme.basicOpen X ↑f).carrier) =
    ↑(fromSpec hU).val.base '' (↑(fromSpec hU).val.base ⁻¹' U.carrier)
⊢ ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U
[PROOFSTEP]
rw [Set.image_preimage_eq_inter_range, Set.image_preimage_eq_inter_range, hU.fromSpec_range] at h 
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : (⨆ (f : ↑s), Scheme.basicOpen X ↑f).carrier ∩ ↑U = U.carrier ∩ ↑U
⊢ ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U
[PROOFSTEP]
simp only [Set.inter_self, Opens.carrier_eq_coe, Set.inter_eq_right_iff_subset] at h 
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : ↑U ⊆ ↑(⨆ (f : ↑s), Scheme.basicOpen X ↑f)
⊢ ⨆ (f : ↑s), Scheme.basicOpen X ↑f = U
[PROOFSTEP]
ext1
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : ↑U ⊆ ↑(⨆ (f : ↑s), Scheme.basicOpen X ↑f)
⊢ ↑(⨆ (f : ↑s), Scheme.basicOpen X ↑f) = ↑U
[PROOFSTEP]
refine' Set.Subset.antisymm _ h
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : ↑U ⊆ ↑(⨆ (f : ↑s), Scheme.basicOpen X ↑f)
⊢ ↑(⨆ (f : ↑s), Scheme.basicOpen X ↑f) ⊆ ↑U
[PROOFSTEP]
simp only [Set.iUnion_subset_iff, SetCoe.forall, Opens.coe_iSup]
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : ↑U ⊆ ↑(⨆ (f : ↑s), Scheme.basicOpen X ↑f)
⊢ ∀ (x : ↑(X.presheaf.obj (op U))), x ∈ s → ↑(Scheme.basicOpen X x) ⊆ ↑U
[PROOFSTEP]
intro x _
[GOAL]
case h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : ↑U ⊆ ↑(⨆ (f : ↑s), Scheme.basicOpen X ↑f)
x : ↑(X.presheaf.obj (op U))
h✝ : x ∈ s
⊢ ↑(Scheme.basicOpen X x) ⊆ ↑U
[PROOFSTEP]
exact X.basicOpen_le x
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ↑(fromSpec hU).val.base ⁻¹' (⨆ (f : ↑s), Scheme.basicOpen X ↑f).carrier = ↑(fromSpec hU).val.base ⁻¹' U.carrier ↔
    ⋃ (i : ↑s), (PrimeSpectrum.basicOpen ↑i).carrier = Set.univ
[PROOFSTEP]
simp only [Opens.iSup_def, Subtype.coe_mk, Set.preimage_iUnion]
  -- Porting note : need an extra rewrite here, after simp, it is in `↔` form
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ⋃ (i : ↑s), ↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X ↑i) = ↑(fromSpec hU).val.base ⁻¹' U.carrier ↔
    ⋃ (i : ↑s), (PrimeSpectrum.basicOpen ↑i).carrier = Set.univ
[PROOFSTEP]
rw [iff_iff_eq]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ (⋃ (i : ↑s), ↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X ↑i) = ↑(fromSpec hU).val.base ⁻¹' U.carrier) =
    (⋃ (i : ↑s), (PrimeSpectrum.basicOpen ↑i).carrier = Set.univ)
[PROOFSTEP]
congr 3
[GOAL]
case e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ⋃ (i : ↑s), ↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X ↑i) = ⋃ (i : ↑s), (PrimeSpectrum.basicOpen ↑i).carrier
[PROOFSTEP]
refine congr_arg (Set.iUnion ·) ?_
[GOAL]
case e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ (fun i => ↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X ↑i)) = fun i => (PrimeSpectrum.basicOpen ↑i).carrier
[PROOFSTEP]
ext1 x
[GOAL]
case e_a.h
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
x : ↑s
⊢ ↑(fromSpec hU).val.base ⁻¹' ↑(Scheme.basicOpen X ↑x) = (PrimeSpectrum.basicOpen ↑x).carrier
[PROOFSTEP]
exact congr_arg Opens.carrier (hU.fromSpec_map_basicOpen _)
[GOAL]
case e_a
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ↑(fromSpec hU).val.base ⁻¹' U.carrier = Set.univ
[PROOFSTEP]
exact congr_arg Opens.carrier hU.fromSpec_base_preimage
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ⋃ (i : ↑s), (PrimeSpectrum.basicOpen ↑i).carrier = Set.univ ↔ Ideal.span s = ⊤
[PROOFSTEP]
simp only [Opens.carrier_eq_coe, PrimeSpectrum.basicOpen_eq_zeroLocus_compl]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ ⋃ (i : ↑s), (PrimeSpectrum.zeroLocus {↑i})ᶜ = Set.univ ↔ Ideal.span s = ⊤
[PROOFSTEP]
rw [← Set.compl_iInter, Set.compl_univ_iff, ← PrimeSpectrum.zeroLocus_iUnion, ←
  PrimeSpectrum.zeroLocus_empty_iff_eq_top, PrimeSpectrum.zeroLocus_span]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ PrimeSpectrum.zeroLocus (⋃ (i : ↑s), {↑i}) = ∅ ↔ PrimeSpectrum.zeroLocus s = ∅
[PROOFSTEP]
simp only [Set.iUnion_singleton_eq_range, Subtype.range_val_subtype, Set.setOf_mem_eq]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ U ≤ ⨆ (f : ↑s), Scheme.basicOpen X ↑f ↔ Ideal.span s = ⊤
[PROOFSTEP]
rw [← hU.basicOpen_union_eq_self_iff, @comm _ Eq]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
⊢ U ≤ ⨆ (f : ↑s), Scheme.basicOpen X ↑f ↔ U = ⨆ (f : ↑s), Scheme.basicOpen X ↑f
[PROOFSTEP]
refine' ⟨fun h => le_antisymm h _, le_of_eq⟩
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : U ≤ ⨆ (f : ↑s), Scheme.basicOpen X ↑f
⊢ ⨆ (f : ↑s), Scheme.basicOpen X ↑f ≤ U
[PROOFSTEP]
simp only [iSup_le_iff, SetCoe.forall]
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : U ≤ ⨆ (f : ↑s), Scheme.basicOpen X ↑f
⊢ ∀ (x : ↑(X.presheaf.obj (op U))), x ∈ s → Scheme.basicOpen X x ≤ U
[PROOFSTEP]
intro x _
[GOAL]
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsAffineOpen U
s : Set ↑(X.presheaf.obj (op U))
h : U ≤ ⨆ (f : ↑s), Scheme.basicOpen X ↑f
x : ↑(X.presheaf.obj (op U))
h✝ : x ∈ s
⊢ Scheme.basicOpen X x ≤ U
[PROOFSTEP]
exact X.basicOpen_le x
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
⊢ P V
[PROOFSTEP]
classical
have : ∀ (x : V.1), ∃ f : X.presheaf.obj <| op V.1, ↑x ∈ X.basicOpen f ∧ P (X.affineBasicOpen f) :=
  by
  intro x
  have : ↑x ∈ (Set.univ : Set X) := trivial
  rw [← hS] at this 
  obtain ⟨W, hW⟩ := Set.mem_iUnion.mp this
  obtain ⟨f, g, e, hf⟩ := exists_basicOpen_le_affine_inter V.prop W.1.prop x ⟨x.prop, hW⟩
  refine' ⟨f, hf, _⟩
  convert hP₁ _ g (hS' W) using 1
  ext1
  exact e
choose f hf₁ hf₂ using this
suffices Ideal.span (Set.range f) = ⊤
  by
  obtain ⟨t, ht₁, ht₂⟩ := (Ideal.span_eq_top_iff_finite _).mp this
  apply hP₂ V t ht₂
  rintro ⟨i, hi⟩
  obtain ⟨x, rfl⟩ := ht₁ hi
  exact hf₂ x
rw [← V.prop.self_le_basicOpen_union_iff]
intro x hx
rw [iSup_range', SetLike.mem_coe, Opens.mem_iSup]
exact ⟨_, hf₁ ⟨x, hx⟩⟩
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
⊢ P V
[PROOFSTEP]
have : ∀ (x : V.1), ∃ f : X.presheaf.obj <| op V.1, ↑x ∈ X.basicOpen f ∧ P (X.affineBasicOpen f) :=
  by
  intro x
  have : ↑x ∈ (Set.univ : Set X) := trivial
  rw [← hS] at this 
  obtain ⟨W, hW⟩ := Set.mem_iUnion.mp this
  obtain ⟨f, g, e, hf⟩ := exists_basicOpen_le_affine_inter V.prop W.1.prop x ⟨x.prop, hW⟩
  refine' ⟨f, hf, _⟩
  convert hP₁ _ g (hS' W) using 1
  ext1
  exact e
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
⊢ ∀ (x : { x // x ∈ ↑V }), ∃ f, ↑x ∈ Scheme.basicOpen X f ∧ P (Scheme.affineBasicOpen X f)
[PROOFSTEP]
intro x
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
x : { x // x ∈ ↑V }
⊢ ∃ f, ↑x ∈ Scheme.basicOpen X f ∧ P (Scheme.affineBasicOpen X f)
[PROOFSTEP]
have : ↑x ∈ (Set.univ : Set X) := trivial
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
x : { x // x ∈ ↑V }
this : ↑x ∈ Set.univ
⊢ ∃ f, ↑x ∈ Scheme.basicOpen X f ∧ P (Scheme.affineBasicOpen X f)
[PROOFSTEP]
rw [← hS] at this 
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
x : { x // x ∈ ↑V }
this : ↑x ∈ ⋃ (i : ↑S), ↑↑↑i
⊢ ∃ f, ↑x ∈ Scheme.basicOpen X f ∧ P (Scheme.affineBasicOpen X f)
[PROOFSTEP]
obtain ⟨W, hW⟩ := Set.mem_iUnion.mp this
[GOAL]
case intro
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
x : { x // x ∈ ↑V }
this : ↑x ∈ ⋃ (i : ↑S), ↑↑↑i
W : ↑S
hW : ↑x ∈ ↑↑↑W
⊢ ∃ f, ↑x ∈ Scheme.basicOpen X f ∧ P (Scheme.affineBasicOpen X f)
[PROOFSTEP]
obtain ⟨f, g, e, hf⟩ := exists_basicOpen_le_affine_inter V.prop W.1.prop x ⟨x.prop, hW⟩
[GOAL]
case intro.intro.intro.intro
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
x : { x // x ∈ ↑V }
this : ↑x ∈ ⋃ (i : ↑S), ↑↑↑i
W : ↑S
hW : ↑x ∈ ↑↑↑W
f : ↑(X.presheaf.obj (op ↑V))
g : ↑(X.presheaf.obj (op ↑↑W))
e : Scheme.basicOpen X f = Scheme.basicOpen X g
hf : ↑x ∈ Scheme.basicOpen X f
⊢ ∃ f, ↑x ∈ Scheme.basicOpen X f ∧ P (Scheme.affineBasicOpen X f)
[PROOFSTEP]
refine' ⟨f, hf, _⟩
[GOAL]
case intro.intro.intro.intro
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
x : { x // x ∈ ↑V }
this : ↑x ∈ ⋃ (i : ↑S), ↑↑↑i
W : ↑S
hW : ↑x ∈ ↑↑↑W
f : ↑(X.presheaf.obj (op ↑V))
g : ↑(X.presheaf.obj (op ↑↑W))
e : Scheme.basicOpen X f = Scheme.basicOpen X g
hf : ↑x ∈ Scheme.basicOpen X f
⊢ P (Scheme.affineBasicOpen X f)
[PROOFSTEP]
convert hP₁ _ g (hS' W) using 1
[GOAL]
case h.e'_1
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
x : { x // x ∈ ↑V }
this : ↑x ∈ ⋃ (i : ↑S), ↑↑↑i
W : ↑S
hW : ↑x ∈ ↑↑↑W
f : ↑(X.presheaf.obj (op ↑V))
g : ↑(X.presheaf.obj (op ↑↑W))
e : Scheme.basicOpen X f = Scheme.basicOpen X g
hf : ↑x ∈ Scheme.basicOpen X f
⊢ Scheme.affineBasicOpen X f = Scheme.affineBasicOpen X g
[PROOFSTEP]
ext1
[GOAL]
case h.e'_1.a
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
x : { x // x ∈ ↑V }
this : ↑x ∈ ⋃ (i : ↑S), ↑↑↑i
W : ↑S
hW : ↑x ∈ ↑↑↑W
f : ↑(X.presheaf.obj (op ↑V))
g : ↑(X.presheaf.obj (op ↑↑W))
e : Scheme.basicOpen X f = Scheme.basicOpen X g
hf : ↑x ∈ Scheme.basicOpen X f
⊢ ↑(Scheme.affineBasicOpen X f) = ↑(Scheme.affineBasicOpen X g)
[PROOFSTEP]
exact e
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
this : ∀ (x : { x // x ∈ ↑V }), ∃ f, ↑x ∈ Scheme.basicOpen X f ∧ P (Scheme.affineBasicOpen X f)
⊢ P V
[PROOFSTEP]
choose f hf₁ hf₂ using this
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
⊢ P V
[PROOFSTEP]
suffices Ideal.span (Set.range f) = ⊤
  by
  obtain ⟨t, ht₁, ht₂⟩ := (Ideal.span_eq_top_iff_finite _).mp this
  apply hP₂ V t ht₂
  rintro ⟨i, hi⟩
  obtain ⟨x, rfl⟩ := ht₁ hi
  exact hf₂ x
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
this : Ideal.span (Set.range f) = ⊤
⊢ P V
[PROOFSTEP]
obtain ⟨t, ht₁, ht₂⟩ := (Ideal.span_eq_top_iff_finite _).mp this
[GOAL]
case intro.intro
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
this : Ideal.span (Set.range f) = ⊤
t : Finset ↑(X.presheaf.obj (op ↑V))
ht₁ : ↑t ⊆ Set.range f
ht₂ : Ideal.span ↑t = ⊤
⊢ P V
[PROOFSTEP]
apply hP₂ V t ht₂
[GOAL]
case intro.intro
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
this : Ideal.span (Set.range f) = ⊤
t : Finset ↑(X.presheaf.obj (op ↑V))
ht₁ : ↑t ⊆ Set.range f
ht₂ : Ideal.span ↑t = ⊤
⊢ ∀ (f : { x // x ∈ t }), P (Scheme.affineBasicOpen X ↑f)
[PROOFSTEP]
rintro ⟨i, hi⟩
[GOAL]
case intro.intro.mk
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
this : Ideal.span (Set.range f) = ⊤
t : Finset ↑(X.presheaf.obj (op ↑V))
ht₁ : ↑t ⊆ Set.range f
ht₂ : Ideal.span ↑t = ⊤
i : ↑(X.presheaf.obj (op ↑V))
hi : i ∈ t
⊢ P (Scheme.affineBasicOpen X ↑{ val := i, property := hi })
[PROOFSTEP]
obtain ⟨x, rfl⟩ := ht₁ hi
[GOAL]
case intro.intro.mk.intro
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
this : Ideal.span (Set.range f) = ⊤
t : Finset ↑(X.presheaf.obj (op ↑V))
ht₁ : ↑t ⊆ Set.range f
ht₂ : Ideal.span ↑t = ⊤
x : { x // x ∈ ↑V }
hi : f x ∈ t
⊢ P (Scheme.affineBasicOpen X ↑{ val := f x, property := hi })
[PROOFSTEP]
exact hf₂ x
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
⊢ Ideal.span (Set.range f) = ⊤
[PROOFSTEP]
rw [← V.prop.self_le_basicOpen_union_iff]
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
⊢ ↑V ≤ ⨆ (f_1 : ↑(Set.range f)), Scheme.basicOpen X ↑f_1
[PROOFSTEP]
intro x hx
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
x : ↑↑X.toPresheafedSpace
hx : x ∈ ↑↑V
⊢ x ∈ ↑(⨆ (f_1 : ↑(Set.range f)), Scheme.basicOpen X ↑f_1)
[PROOFSTEP]
rw [iSup_range', SetLike.mem_coe, Opens.mem_iSup]
[GOAL]
X : Scheme
V : ↑(Scheme.affineOpens X)
S : Set ↑(Scheme.affineOpens X)
P : ↑(Scheme.affineOpens X) → Prop
hP₁ : ∀ (U : ↑(Scheme.affineOpens X)) (f : ↑(X.presheaf.obj (op ↑U))), P U → P (Scheme.affineBasicOpen X f)
hP₂ :
  ∀ (U : ↑(Scheme.affineOpens X)) (s : Finset ↑(X.presheaf.obj (op ↑U))),
    Ideal.span ↑s = ⊤ → (∀ (f : { x // x ∈ s }), P (Scheme.affineBasicOpen X ↑f)) → P U
hS : ⋃ (i : ↑S), ↑↑↑i = Set.univ
hS' : ∀ (U : ↑S), P ↑U
f : { x // x ∈ ↑V } → ↑(X.presheaf.obj (op ↑V))
hf₁ : ∀ (x : { x // x ∈ ↑V }), ↑x ∈ Scheme.basicOpen X (f x)
hf₂ : ∀ (x : { x // x ∈ ↑V }), P (Scheme.affineBasicOpen X (f x))
x : ↑↑X.toPresheafedSpace
hx : x ∈ ↑↑V
⊢ ∃ i, x ∈ Scheme.basicOpen X (f i)
[PROOFSTEP]
exact ⟨_, hf₁ ⟨x, hx⟩⟩
