algebraic_geometry.AffineSchemeMathlib.AlgebraicGeometry.AffineScheme

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -126,7 +126,8 @@ namespace AffineScheme
 /-- The `Spec` functor into the category of affine schemes. -/
 def Spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
   Scheme.Spec.toEssImage
-deriving Full, Faithful, EssSurj
+deriving CategoryTheory.Functor.Full, CategoryTheory.Functor.Faithful,
+  CategoryTheory.Functor.EssSurj
 #align algebraic_geometry.AffineScheme.Spec AlgebraicGeometry.AffineScheme.Spec
 -/
 
@@ -135,7 +136,7 @@ deriving Full, Faithful, EssSurj
 @[simps]
 def forgetToScheme : AffineScheme ⥤ Scheme :=
   Scheme.Spec.essImageInclusion
-deriving Full, Faithful
+deriving CategoryTheory.Functor.Full, CategoryTheory.Functor.Faithful
 #align algebraic_geometry.AffineScheme.forget_to_Scheme AlgebraicGeometry.AffineScheme.forgetToScheme
 -/
 
@@ -154,7 +155,7 @@ def equivCommRingCat : AffineScheme ≌ CommRingCatᵒᵖ :=
 -/
 
 #print AlgebraicGeometry.AffineScheme.ΓIsEquiv /-
-instance ΓIsEquiv : IsEquivalence Γ.{u} :=
+instance ΓIsEquiv : CategoryTheory.Functor.IsEquivalence Γ.{u} :=
   haveI : is_equivalence Γ.{u}.rightOp.op := is_equivalence.of_equivalence equiv_CommRing.op
   (functor.is_equivalence_trans Γ.{u}.rightOp.op (op_op_equivalence _).Functor : _)
 #align algebraic_geometry.AffineScheme.Γ_is_equiv AlgebraicGeometry.AffineScheme.ΓIsEquiv
@@ -172,7 +173,7 @@ instance : HasLimits AffineScheme.{u} :=
 
 noncomputable instance : PreservesLimits Γ.{u}.rightOp :=
   @Adjunction.isEquivalencePreservesLimits _ _ Γ.rightOp
-    (IsEquivalence.ofEquivalence equivCommRingCat)
+    (CategoryTheory.Functor.IsEquivalence.ofEquivalence equivCommRingCat)
 
 noncomputable instance : PreservesLimits forgetToScheme :=
   by
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
 import AlgebraicGeometry.GammaSpecAdjunction
-import AlgebraicGeometry.OpenImmersion.Scheme
+import AlgebraicGeometry.OpenImmersion
 import CategoryTheory.Limits.Opposites
 import RingTheory.Localization.InvSubmonoid
 
Diff
@@ -359,11 +359,11 @@ theorem IsAffineOpen.SpecΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.c
   by
   haveI : is_affine _ := hU
   have e₁ := Spec_Γ_identity.hom.naturality (X.presheaf.map (eq_to_hom U.open_embedding_obj_top).op)
-  rw [← is_iso.comp_inv_eq] at e₁ 
+  rw [← is_iso.comp_inv_eq] at e₁
   have e₂ := Γ_Spec.adjunction_unit_app_app_top (X.restrict U.open_embedding)
-  erw [← e₂] at e₁ 
+  erw [← e₂] at e₁
   simp only [functor.id_map, Quiver.Hom.unop_op, functor.comp_map, ← functor.map_inv, ← op_inv,
-    LocallyRingedSpace.Γ_map, category.assoc, functor.right_op_map, inv_eq_to_hom] at e₁ 
+    LocallyRingedSpace.Γ_map, category.assoc, functor.right_op_map, inv_eq_to_hom] at e₁
   delta is_affine_open.from_Spec Scheme.iso_Spec
   rw [Scheme.comp_val_c_app, Scheme.comp_val_c_app, ← e₁]
   simp_rw [category.assoc]
@@ -797,10 +797,10 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X.carri
       hU.from_Spec.1.base ⁻¹' U.1
   · refine' ⟨fun h => by rw [h], _⟩
     intro h
-    apply_fun Set.image hU.from_Spec.1.base at h 
+    apply_fun Set.image hU.from_Spec.1.base at h
     rw [Set.image_preimage_eq_inter_range, Set.image_preimage_eq_inter_range, hU.from_Spec_range] at
-      h 
-    simp only [Set.inter_self, opens.carrier_eq_coe, Set.inter_eq_right] at h 
+      h
+    simp only [Set.inter_self, opens.carrier_eq_coe, Set.inter_eq_right] at h
     ext1
     refine' Set.Subset.antisymm _ h
     simp only [Set.iUnion_subset_iff, SetCoe.forall, opens.coe_supr]
@@ -854,7 +854,7 @@ theorem of_affine_open_cover {X : Scheme} (V : X.affineOpens) (S : Set X.affineO
     by
     intro x
     have : ↑x ∈ (Set.univ : Set X.carrier) := trivial
-    rw [← hS] at this 
+    rw [← hS] at this
     obtain ⟨W, hW⟩ := set.mem_Union.mp this
     obtain ⟨f, g, e, hf⟩ := exists_basic_open_le_affine_inter V.prop W.1.Prop x ⟨x.prop, hW⟩
     refine' ⟨f, hf, _⟩
Diff
@@ -848,7 +848,31 @@ theorem of_affine_open_cover {X : Scheme} (V : X.affineOpens) (S : Set X.affineO
       ∀ (U : X.affineOpens) (s : Finset (X.Presheaf.obj <| op U))
         (hs : Ideal.span (s : Set (X.Presheaf.obj <| op U)) = ⊤),
         (∀ f : s, P (X.affineBasicOpen f.1)) → P U)
-    (hS : (⋃ i : S, i : Set X.carrier) = Set.univ) (hS' : ∀ U : S, P U) : P V := by classical
+    (hS : (⋃ i : S, i : Set X.carrier) = Set.univ) (hS' : ∀ U : S, P U) : P V := by
+  classical
+  have : ∀ x : V, ∃ f : X.presheaf.obj <| op V.1, ↑x ∈ X.basic_open f ∧ P (X.affine_basic_open f) :=
+    by
+    intro x
+    have : ↑x ∈ (Set.univ : Set X.carrier) := trivial
+    rw [← hS] at this 
+    obtain ⟨W, hW⟩ := set.mem_Union.mp this
+    obtain ⟨f, g, e, hf⟩ := exists_basic_open_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_basic_open_union_iff]
+  intro x hx
+  rw [iSup_range', opens.mem_supr]
+  exact ⟨_, hf₁ ⟨x, hx⟩⟩
 #align algebraic_geometry.of_affine_open_cover AlgebraicGeometry.of_affine_open_cover
 -/
 
Diff
@@ -848,31 +848,7 @@ theorem of_affine_open_cover {X : Scheme} (V : X.affineOpens) (S : Set X.affineO
       ∀ (U : X.affineOpens) (s : Finset (X.Presheaf.obj <| op U))
         (hs : Ideal.span (s : Set (X.Presheaf.obj <| op U)) = ⊤),
         (∀ f : s, P (X.affineBasicOpen f.1)) → P U)
-    (hS : (⋃ i : S, i : Set X.carrier) = Set.univ) (hS' : ∀ U : S, P U) : P V := by
-  classical
-  have : ∀ x : V, ∃ f : X.presheaf.obj <| op V.1, ↑x ∈ X.basic_open f ∧ P (X.affine_basic_open f) :=
-    by
-    intro x
-    have : ↑x ∈ (Set.univ : Set X.carrier) := trivial
-    rw [← hS] at this 
-    obtain ⟨W, hW⟩ := set.mem_Union.mp this
-    obtain ⟨f, g, e, hf⟩ := exists_basic_open_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_basic_open_union_iff]
-  intro x hx
-  rw [iSup_range', opens.mem_supr]
-  exact ⟨_, hf₁ ⟨x, hx⟩⟩
+    (hS : (⋃ i : S, i : Set X.carrier) = Set.univ) (hS' : ∀ U : S, P U) : P V := by classical
 #align algebraic_geometry.of_affine_open_cover AlgebraicGeometry.of_affine_open_cover
 -/
 
Diff
@@ -307,9 +307,10 @@ theorem IsAffineOpen.imageIsOpenImmersion {X Y : Scheme} {U : Opens X.carrier} (
 #align algebraic_geometry.is_affine_open.image_is_open_immersion AlgebraicGeometry.IsAffineOpen.imageIsOpenImmersion
 -/
 
-#print AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion /-
-theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
-    (U : Opens X.carrier) : IsAffineOpen (H.openFunctor.obj U) ↔ IsAffineOpen U :=
+#print AlgebraicGeometry.Scheme.Hom.isAffineOpen_iff_of_isOpenImmersion /-
+theorem AlgebraicGeometry.Scheme.Hom.isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y)
+    [H : IsOpenImmersionCat f] (U : Opens X.carrier) :
+    IsAffineOpen (H.openFunctor.obj U) ↔ IsAffineOpen U :=
   by
   refine' ⟨fun hU => @is_affine_of_iso _ _ hU, fun hU => hU.imageIsOpenImmersion f⟩
   refine' (is_open_immersion.iso_of_range_eq (X.of_restrict _ ≫ f) (Y.of_restrict _) _).Hom
@@ -318,7 +319,7 @@ theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : Is
     rw [Subtype.range_coe, Subtype.range_coe]
     rfl
   · infer_instance
-#align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
+#align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.Scheme.Hom.isAffineOpen_iff_of_isOpenImmersion
 -/
 
 #print AlgebraicGeometry.Scheme.quasi_compact_of_affine /-
@@ -382,14 +383,14 @@ theorem IsAffineOpen.SpecΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.c
 #align algebraic_geometry.is_affine_open.Spec_Γ_identity_hom_app_from_Spec AlgebraicGeometry.IsAffineOpen.SpecΓIdentity_hom_app_fromSpec
 -/
 
-#print AlgebraicGeometry.IsAffineOpen.fromSpec_app_eq /-
+#print AlgebraicGeometry.IsAffineOpen.fromSpec_app_self /-
 @[elementwise]
-theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
+theorem IsAffineOpen.fromSpec_app_self {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     hU.fromSpec.1.c.app (op U) =
       SpecΓIdentity.inv.app (X.Presheaf.obj <| op U) ≫
         (Scheme.Spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
   by rw [← hU.Spec_Γ_identity_hom_app_from_Spec, iso.inv_hom_id_app_assoc]
-#align algebraic_geometry.is_affine_open.from_Spec_app_eq AlgebraicGeometry.IsAffineOpen.fromSpec_app_eq
+#align algebraic_geometry.is_affine_open.from_Spec_app_eq AlgebraicGeometry.IsAffineOpen.fromSpec_app_self
 -/
 
 #print AlgebraicGeometry.IsAffineOpen.basicOpenIsAffine /-
@@ -521,8 +522,8 @@ instance {X : Scheme} {U : Opens X.carrier} (f : X.Presheaf.obj (op U)) :
     Algebra (X.Presheaf.obj (op U)) (X.Presheaf.obj (op <| X.basicOpen f)) :=
   (X.Presheaf.map (homOfLE <| RingedSpace.basicOpen_le _ f : _ ⟶ U).op).toAlgebra
 
-#print AlgebraicGeometry.IsAffineOpen.opens_map_fromSpec_basicOpen /-
-theorem IsAffineOpen.opens_map_fromSpec_basicOpen {X : Scheme} {U : Opens X.carrier}
+#print AlgebraicGeometry.IsAffineOpen.fromSpec_map_basicOpen' /-
+theorem IsAffineOpen.fromSpec_map_basicOpen' {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) (f : X.Presheaf.obj (op U)) :
     (Opens.map hU.fromSpec.val.base).obj (X.basicOpen f) =
       RingedSpace.basicOpen _ (SpecΓIdentity.inv.app (X.Presheaf.obj <| op U) f) :=
@@ -538,25 +539,25 @@ theorem IsAffineOpen.opens_map_fromSpec_basicOpen {X : Scheme} {U : Opens X.carr
   congr
   erw [← hU.Spec_Γ_identity_hom_app_from_Spec]
   rw [iso.inv_hom_id_app_assoc]
-#align algebraic_geometry.is_affine_open.opens_map_from_Spec_basic_open AlgebraicGeometry.IsAffineOpen.opens_map_fromSpec_basicOpen
+#align algebraic_geometry.is_affine_open.opens_map_from_Spec_basic_open AlgebraicGeometry.IsAffineOpen.fromSpec_map_basicOpen'
 -/
 
-#print AlgebraicGeometry.basicOpenSectionsToAffine /-
+#print AlgebraicGeometry.IsAffineOpen.basicOpenSectionsToAffine /-
 /-- The canonical map `Γ(𝒪ₓ, D(f)) ⟶ Γ(Spec 𝒪ₓ(U), D(Spec_Γ_identity.inv f))`
 This is an isomorphism, as witnessed by an `is_iso` instance. -/
-def basicOpenSectionsToAffine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
-    (f : X.Presheaf.obj (op U)) :
+def AlgebraicGeometry.IsAffineOpen.basicOpenSectionsToAffine {X : Scheme} {U : Opens X.carrier}
+    (hU : IsAffineOpen U) (f : X.Presheaf.obj (op U)) :
     X.Presheaf.obj (op <| X.basicOpen f) ⟶
       (Scheme.Spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.obj
         (op <| Scheme.basicOpen _ <| SpecΓIdentity.inv.app (X.Presheaf.obj (op U)) f) :=
   hU.fromSpec.1.c.app (op <| X.basicOpen f) ≫
     (Scheme.Spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.map
-      (eqToHom <| (hU.opens_map_fromSpec_basicOpen f).symm).op
-#align algebraic_geometry.basic_open_sections_to_affine AlgebraicGeometry.basicOpenSectionsToAffine
+      (eqToHom <| (hU.fromSpec_map_basicOpen' f).symm).op
+#align algebraic_geometry.basic_open_sections_to_affine AlgebraicGeometry.IsAffineOpen.basicOpenSectionsToAffine
 -/
 
 instance {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) (f : X.Presheaf.obj (op U)) :
-    IsIso (basicOpenSectionsToAffine hU f) :=
+    IsIso (AlgebraicGeometry.IsAffineOpen.basicOpenSectionsToAffine hU f) :=
   by
   delta basic_open_sections_to_affine
   apply (config := { instances := false }) is_iso.comp_is_iso
@@ -565,9 +566,10 @@ instance {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) (f : X.Preshea
     exact RingedSpace.basic_open_le _ _
   infer_instance
 
-#print AlgebraicGeometry.isLocalization_basicOpen /-
-theorem isLocalization_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
-    (f : X.Presheaf.obj (op U)) : IsLocalization.Away f (X.Presheaf.obj (op <| X.basicOpen f)) :=
+#print AlgebraicGeometry.IsAffineOpen.isLocalization_basicOpen /-
+theorem AlgebraicGeometry.IsAffineOpen.isLocalization_basicOpen {X : Scheme} {U : Opens X.carrier}
+    (hU : IsAffineOpen U) (f : X.Presheaf.obj (op U)) :
+    IsLocalization.Away f (X.Presheaf.obj (op <| X.basicOpen f)) :=
   by
   apply
     (IsLocalization.isLocalization_iff_of_ringEquiv (Submonoid.powers f)
@@ -585,19 +587,20 @@ theorem isLocalization_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAffi
   dsimp
   simp only [category.assoc, ← functor.map_comp, ← op_comp]
   apply structure_sheaf.to_open_res
-#align algebraic_geometry.is_localization_basic_open AlgebraicGeometry.isLocalization_basicOpen
+#align algebraic_geometry.is_localization_basic_open AlgebraicGeometry.IsAffineOpen.isLocalization_basicOpen
 -/
 
 instance {X : Scheme} [IsAffine X] (r : X.Presheaf.obj (op ⊤)) :
     IsLocalization.Away r (X.Presheaf.obj (op <| X.basicOpen r)) :=
-  isLocalization_basicOpen (topIsAffineOpen X) r
+  AlgebraicGeometry.IsAffineOpen.isLocalization_basicOpen (topIsAffineOpen X) r
 
-#print AlgebraicGeometry.isLocalization_of_eq_basicOpen /-
-theorem isLocalization_of_eq_basicOpen {X : Scheme} {U V : Opens X.carrier} (i : V ⟶ U)
-    (hU : IsAffineOpen U) (r : X.Presheaf.obj (op U)) (e : V = X.basicOpen r) :
+#print AlgebraicGeometry.IsAffineOpen.isLocalization_of_eq_basicOpen /-
+theorem AlgebraicGeometry.IsAffineOpen.isLocalization_of_eq_basicOpen {X : Scheme}
+    {U V : Opens X.carrier} (i : V ⟶ U) (hU : IsAffineOpen U) (r : X.Presheaf.obj (op U))
+    (e : V = X.basicOpen r) :
     @IsLocalization.Away _ r (X.Presheaf.obj (op V)) _ (X.Presheaf.map i.op).toAlgebra := by
   subst e; convert is_localization_basic_open hU r using 3
-#align algebraic_geometry.is_localization_of_eq_basic_open AlgebraicGeometry.isLocalization_of_eq_basicOpen
+#align algebraic_geometry.is_localization_of_eq_basic_open AlgebraicGeometry.IsAffineOpen.isLocalization_of_eq_basicOpen
 -/
 
 #print AlgebraicGeometry.ΓRestrictAlgebra /-
@@ -610,13 +613,15 @@ instance ΓRestrictAlgebra {X : Scheme} {Y : TopCat} {f : Y ⟶ X.carrier} (hf :
 #print AlgebraicGeometry.Γ_restrict_isLocalization /-
 instance Γ_restrict_isLocalization (X : Scheme.{u}) [IsAffine X] (r : Scheme.Γ.obj (op X)) :
     IsLocalization.Away r (Scheme.Γ.obj (op <| X.restrict (X.basicOpen r).OpenEmbedding)) :=
-  isLocalization_of_eq_basicOpen _ (topIsAffineOpen X) r (Opens.openEmbedding_obj_top _)
+  AlgebraicGeometry.IsAffineOpen.isLocalization_of_eq_basicOpen _ (topIsAffineOpen X) r
+    (Opens.openEmbedding_obj_top _)
 #align algebraic_geometry.Γ_restrict_is_localization AlgebraicGeometry.Γ_restrict_isLocalization
 -/
 
-#print AlgebraicGeometry.basicOpen_basicOpen_is_basicOpen /-
-theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
-    (f : X.Presheaf.obj (op U)) (g : X.Presheaf.obj (op <| X.basicOpen f)) :
+#print AlgebraicGeometry.IsAffineOpen.basicOpen_basicOpen_is_basicOpen /-
+theorem AlgebraicGeometry.IsAffineOpen.basicOpen_basicOpen_is_basicOpen {X : Scheme}
+    {U : Opens X.carrier} (hU : IsAffineOpen U) (f : X.Presheaf.obj (op U))
+    (g : X.Presheaf.obj (op <| X.basicOpen f)) :
     ∃ f' : X.Presheaf.obj (op U), X.basicOpen f' = X.basicOpen g :=
   by
   haveI := is_localization_basic_open hU f
@@ -631,7 +636,7 @@ theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X.carrier} (hU
     Submonoid.leftInv_le_isUnit _
       (IsLocalization.toInvSubmonoid (Submonoid.powers f) (X.presheaf.obj (op <| X.basic_open f))
           _).Prop
-#align algebraic_geometry.basic_open_basic_open_is_basic_open AlgebraicGeometry.basicOpen_basicOpen_is_basicOpen
+#align algebraic_geometry.basic_open_basic_open_is_basic_open AlgebraicGeometry.IsAffineOpen.basicOpen_basicOpen_is_basicOpen
 -/
 
 #print AlgebraicGeometry.exists_basicOpen_le_affine_inter /-
@@ -673,8 +678,7 @@ theorem IsAffineOpen.fromSpec_primeIdealOf {X : Scheme} {U : Opens X.carrier} (h
 #align algebraic_geometry.is_affine_open.from_Spec_prime_ideal_of AlgebraicGeometry.IsAffineOpen.fromSpec_primeIdealOf
 -/
 
-#print AlgebraicGeometry.IsAffineOpen.isLocalization_stalk_aux /-
-theorem IsAffineOpen.isLocalization_stalk_aux {X : Scheme} (U : Opens X.carrier)
+theorem IsAffineOpen.is_localization_stalk_aux {X : Scheme} (U : Opens X.carrier)
     [IsAffine (X.restrict U.OpenEmbedding)] :
     (inv (ΓSpec.adjunction.Unit.app (X.restrict U.OpenEmbedding))).1.c.app
         (op ((Opens.map U.inclusion).obj U)) =
@@ -698,8 +702,7 @@ theorem IsAffineOpen.isLocalization_stalk_aux {X : Scheme} (U : Opens X.carrier)
   rw [eq_to_hom_trans, eq_to_hom_refl, CategoryTheory.Functor.map_id, category.id_comp]
   erw [Spec_Γ_identity.inv_hom_id_app_assoc]
   simp only [eq_to_hom_map, eq_to_hom_trans]
-#align algebraic_geometry.is_affine_open.is_localization_stalk_aux AlgebraicGeometry.IsAffineOpen.isLocalization_stalk_aux
--/
+#align algebraic_geometry.is_affine_open.is_localization_stalk_aux AlgebraicGeometry.IsAffineOpen.is_localization_stalk_aux
 
 #print AlgebraicGeometry.IsAffineOpen.isLocalization_stalk /-
 theorem IsAffineOpen.isLocalization_stalk {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
Diff
@@ -406,7 +406,7 @@ theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X.carrier} (hU :
     hU.from_Spec.val.base '' (hU.from_Spec.val.base ⁻¹' (X.basic_open f : Set X.carrier)) =
       (X.basic_open f : Set X.carrier) :=
     by
-    rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left_iff_subset, hU.from_Spec_range]
+    rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, hU.from_Spec_range]
     exact Scheme.basic_open_le _ _
   rw [Scheme.hom.opens_range_coe, Scheme.comp_val_base, ← this, coe_comp, Set.range_comp]
   congr 1
@@ -797,7 +797,7 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X.carri
     apply_fun Set.image hU.from_Spec.1.base at h 
     rw [Set.image_preimage_eq_inter_range, Set.image_preimage_eq_inter_range, hU.from_Spec_range] at
       h 
-    simp only [Set.inter_self, opens.carrier_eq_coe, Set.inter_eq_right_iff_subset] at h 
+    simp only [Set.inter_self, opens.carrier_eq_coe, Set.inter_eq_right] at h 
     ext1
     refine' Set.Subset.antisymm _ h
     simp only [Set.iUnion_subset_iff, SetCoe.forall, opens.coe_supr]
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathbin.AlgebraicGeometry.GammaSpecAdjunction
-import Mathbin.AlgebraicGeometry.OpenImmersion.Scheme
-import Mathbin.CategoryTheory.Limits.Opposites
-import Mathbin.RingTheory.Localization.InvSubmonoid
+import AlgebraicGeometry.GammaSpecAdjunction
+import AlgebraicGeometry.OpenImmersion.Scheme
+import CategoryTheory.Limits.Opposites
+import RingTheory.Localization.InvSubmonoid
 
 #align_import algebraic_geometry.AffineScheme from "leanprover-community/mathlib"@"d0b1936853671209a866fa35b9e54949c81116e2"
 
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
-
-! This file was ported from Lean 3 source module algebraic_geometry.AffineScheme
-! leanprover-community/mathlib commit d0b1936853671209a866fa35b9e54949c81116e2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.AlgebraicGeometry.GammaSpecAdjunction
 import Mathbin.AlgebraicGeometry.OpenImmersion.Scheme
 import Mathbin.CategoryTheory.Limits.Opposites
 import Mathbin.RingTheory.Localization.InvSubmonoid
 
+#align_import algebraic_geometry.AffineScheme from "leanprover-community/mathlib"@"d0b1936853671209a866fa35b9e54949c81116e2"
+
 /-!
 # Affine schemes
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
 ! This file was ported from Lean 3 source module algebraic_geometry.AffineScheme
-! leanprover-community/mathlib commit 88474d1b5af6d37c2ab728b757771bced7f5194c
+! leanprover-community/mathlib commit d0b1936853671209a866fa35b9e54949c81116e2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -16,6 +16,9 @@ import Mathbin.RingTheory.Localization.InvSubmonoid
 /-!
 # Affine schemes
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We define the category of `AffineScheme`s as the essential image of `Spec`.
 We also define predicates about affine schemes and affine open sets.
 
Diff
@@ -46,89 +46,119 @@ namespace AlgebraicGeometry
 
 open Spec (structureSheaf)
 
+#print AlgebraicGeometry.AffineScheme /-
 /-- The category of affine schemes -/
 @[nolint has_nonempty_instance]
 def AffineScheme :=
   Scheme.Spec.EssImageSubcategory
 deriving Category
 #align algebraic_geometry.AffineScheme AlgebraicGeometry.AffineScheme
+-/
 
+#print AlgebraicGeometry.IsAffine /-
 /-- A Scheme is affine if the canonical map `X ⟶ Spec Γ(X)` is an isomorphism. -/
 class IsAffine (X : Scheme) : Prop where
   affine : IsIso (ΓSpec.adjunction.Unit.app X)
 #align algebraic_geometry.is_affine AlgebraicGeometry.IsAffine
+-/
 
 attribute [instance] is_affine.affine
 
+#print AlgebraicGeometry.Scheme.isoSpec /-
 /-- The canonical isomorphism `X ≅ Spec Γ(X)` for an affine scheme. -/
 def Scheme.isoSpec (X : Scheme) [IsAffine X] : X ≅ Scheme.Spec.obj (op <| Scheme.Γ.obj <| op X) :=
   asIso (ΓSpec.adjunction.Unit.app X)
 #align algebraic_geometry.Scheme.iso_Spec AlgebraicGeometry.Scheme.isoSpec
+-/
 
+#print AlgebraicGeometry.AffineScheme.mk /-
 /-- Construct an affine scheme from a scheme and the information that it is affine.
 Also see `AffineScheme.of` for a typclass version. -/
 @[simps]
 def AffineScheme.mk (X : Scheme) (h : IsAffine X) : AffineScheme :=
   ⟨X, @mem_essImage_of_unit_isIso _ _ _ _ h.1⟩
 #align algebraic_geometry.AffineScheme.mk AlgebraicGeometry.AffineScheme.mk
+-/
 
+#print AlgebraicGeometry.AffineScheme.of /-
 /-- Construct an affine scheme from a scheme. Also see `AffineScheme.mk` for a non-typeclass
 version. -/
 def AffineScheme.of (X : Scheme) [h : IsAffine X] : AffineScheme :=
   AffineScheme.mk X h
 #align algebraic_geometry.AffineScheme.of AlgebraicGeometry.AffineScheme.of
+-/
 
+#print AlgebraicGeometry.AffineScheme.ofHom /-
 /-- Type check a morphism of schemes as a morphism in `AffineScheme`. -/
 def AffineScheme.ofHom {X Y : Scheme} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) :
     AffineScheme.of X ⟶ AffineScheme.of Y :=
   f
 #align algebraic_geometry.AffineScheme.of_hom AlgebraicGeometry.AffineScheme.ofHom
+-/
 
-theorem mem_spec_essImage (X : Scheme) : X ∈ Scheme.Spec.essImage ↔ IsAffine X :=
+#print AlgebraicGeometry.mem_Spec_essImage /-
+theorem mem_Spec_essImage (X : Scheme) : X ∈ Scheme.Spec.essImage ↔ IsAffine X :=
   ⟨fun h => ⟨Functor.essImage.unit_isIso h⟩, fun h => @mem_essImage_of_unit_isIso _ _ _ X h.1⟩
-#align algebraic_geometry.mem_Spec_ess_image AlgebraicGeometry.mem_spec_essImage
+#align algebraic_geometry.mem_Spec_ess_image AlgebraicGeometry.mem_Spec_essImage
+-/
 
+#print AlgebraicGeometry.isAffineAffineScheme /-
 instance isAffineAffineScheme (X : AffineScheme.{u}) : IsAffine X.obj :=
   ⟨Functor.essImage.unit_isIso X.property⟩
 #align algebraic_geometry.is_affine_AffineScheme AlgebraicGeometry.isAffineAffineScheme
+-/
 
-instance specIsAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.Spec.obj R) :=
+#print AlgebraicGeometry.SpecIsAffine /-
+instance SpecIsAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.Spec.obj R) :=
   AlgebraicGeometry.isAffineAffineScheme ⟨_, Scheme.Spec.obj_mem_essImage R⟩
-#align algebraic_geometry.Spec_is_affine AlgebraicGeometry.specIsAffine
+#align algebraic_geometry.Spec_is_affine AlgebraicGeometry.SpecIsAffine
+-/
 
+#print AlgebraicGeometry.isAffineOfIso /-
 theorem isAffineOfIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X := by
   rw [← mem_Spec_ess_image] at h ⊢; exact functor.ess_image.of_iso (as_iso f).symm h
 #align algebraic_geometry.is_affine_of_iso AlgebraicGeometry.isAffineOfIso
+-/
 
 namespace AffineScheme
 
+#print AlgebraicGeometry.AffineScheme.Spec /-
 /-- The `Spec` functor into the category of affine schemes. -/
-def spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
+def Spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
   Scheme.Spec.toEssImage
 deriving Full, Faithful, EssSurj
-#align algebraic_geometry.AffineScheme.Spec AlgebraicGeometry.AffineScheme.spec
+#align algebraic_geometry.AffineScheme.Spec AlgebraicGeometry.AffineScheme.Spec
+-/
 
+#print AlgebraicGeometry.AffineScheme.forgetToScheme /-
 /-- The forgetful functor `AffineScheme ⥤ Scheme`. -/
 @[simps]
 def forgetToScheme : AffineScheme ⥤ Scheme :=
   Scheme.Spec.essImageInclusion
 deriving Full, Faithful
 #align algebraic_geometry.AffineScheme.forget_to_Scheme AlgebraicGeometry.AffineScheme.forgetToScheme
+-/
 
+#print AlgebraicGeometry.AffineScheme.Γ /-
 /-- The global section functor of an affine scheme. -/
 def Γ : AffineSchemeᵒᵖ ⥤ CommRingCat :=
   forgetToScheme.op ⋙ Scheme.Γ
 #align algebraic_geometry.AffineScheme.Γ AlgebraicGeometry.AffineScheme.Γ
+-/
 
+#print AlgebraicGeometry.AffineScheme.equivCommRingCat /-
 /-- The category of affine schemes is equivalent to the category of commutative rings. -/
-def equivCommRing : AffineScheme ≌ CommRingCatᵒᵖ :=
+def equivCommRingCat : AffineScheme ≌ CommRingCatᵒᵖ :=
   equivEssImageOfReflective.symm
-#align algebraic_geometry.AffineScheme.equiv_CommRing AlgebraicGeometry.AffineScheme.equivCommRing
+#align algebraic_geometry.AffineScheme.equiv_CommRing AlgebraicGeometry.AffineScheme.equivCommRingCat
+-/
 
+#print AlgebraicGeometry.AffineScheme.ΓIsEquiv /-
 instance ΓIsEquiv : IsEquivalence Γ.{u} :=
   haveI : is_equivalence Γ.{u}.rightOp.op := is_equivalence.of_equivalence equiv_CommRing.op
   (functor.is_equivalence_trans Γ.{u}.rightOp.op (op_op_equivalence _).Functor : _)
 #align algebraic_geometry.AffineScheme.Γ_is_equiv AlgebraicGeometry.AffineScheme.ΓIsEquiv
+-/
 
 instance : HasColimits AffineScheme.{u} :=
   haveI := Adjunction.has_limits_of_equivalence.{u} Γ.{u}
@@ -141,7 +171,8 @@ instance : HasLimits AffineScheme.{u} :=
   exact adjunction.has_limits_of_equivalence (op_op_equivalence AffineScheme.{u}).inverse
 
 noncomputable instance : PreservesLimits Γ.{u}.rightOp :=
-  @Adjunction.isEquivalencePreservesLimits _ _ Γ.rightOp (IsEquivalence.ofEquivalence equivCommRing)
+  @Adjunction.isEquivalencePreservesLimits _ _ Γ.rightOp
+    (IsEquivalence.ofEquivalence equivCommRingCat)
 
 noncomputable instance : PreservesLimits forgetToScheme :=
   by
@@ -153,16 +184,21 @@ noncomputable instance : PreservesLimits forgetToScheme :=
 
 end AffineScheme
 
+#print AlgebraicGeometry.IsAffineOpen /-
 /-- An open subset of a scheme is affine if the open subscheme is affine. -/
 def IsAffineOpen {X : Scheme} (U : Opens X.carrier) : Prop :=
   IsAffine (X.restrict U.OpenEmbedding)
 #align algebraic_geometry.is_affine_open AlgebraicGeometry.IsAffineOpen
+-/
 
+#print AlgebraicGeometry.Scheme.affineOpens /-
 /-- The set of affine opens as a subset of `opens X.carrier`. -/
 def Scheme.affineOpens (X : Scheme) : Set (Opens X.carrier) :=
   {U : Opens X.carrier | IsAffineOpen U}
 #align algebraic_geometry.Scheme.affine_opens AlgebraicGeometry.Scheme.affineOpens
+-/
 
+#print AlgebraicGeometry.rangeIsAffineOpenOfOpenImmersion /-
 theorem rangeIsAffineOpenOfOpenImmersion {X Y : Scheme} [IsAffine X] (f : X ⟶ Y)
     [H : IsOpenImmersionCat f] : IsAffineOpen f.opensRange :=
   by
@@ -170,24 +206,32 @@ theorem rangeIsAffineOpenOfOpenImmersion {X Y : Scheme} [IsAffine X] (f : X ⟶
   exact subtype.range_coe.symm
   infer_instance
 #align algebraic_geometry.range_is_affine_open_of_open_immersion AlgebraicGeometry.rangeIsAffineOpenOfOpenImmersion
+-/
 
+#print AlgebraicGeometry.topIsAffineOpen /-
 theorem topIsAffineOpen (X : Scheme) [IsAffine X] : IsAffineOpen (⊤ : Opens X.carrier) :=
   by
   convert range_is_affine_open_of_open_immersion (𝟙 X)
   ext1
   exact set.range_id.symm
 #align algebraic_geometry.top_is_affine_open AlgebraicGeometry.topIsAffineOpen
+-/
 
+#print AlgebraicGeometry.Scheme.affineCoverIsAffine /-
 instance Scheme.affineCoverIsAffine (X : Scheme) (i : X.affineCover.J) :
     IsAffine (X.affineCover.obj i) :=
-  AlgebraicGeometry.specIsAffine _
+  AlgebraicGeometry.SpecIsAffine _
 #align algebraic_geometry.Scheme.affine_cover_is_affine AlgebraicGeometry.Scheme.affineCoverIsAffine
+-/
 
+#print AlgebraicGeometry.Scheme.affineBasisCoverIsAffine /-
 instance Scheme.affineBasisCoverIsAffine (X : Scheme) (i : X.affineBasisCover.J) :
     IsAffine (X.affineBasisCover.obj i) :=
-  AlgebraicGeometry.specIsAffine _
+  AlgebraicGeometry.SpecIsAffine _
 #align algebraic_geometry.Scheme.affine_basis_cover_is_affine AlgebraicGeometry.Scheme.affineBasisCoverIsAffine
+-/
 
+#print AlgebraicGeometry.isBasis_affine_open /-
 theorem isBasis_affine_open (X : Scheme) : Opens.IsBasis X.affineOpens :=
   by
   rw [opens.is_basis_iff_nbhd]
@@ -197,7 +241,9 @@ theorem isBasis_affine_open (X : Scheme) : Opens.IsBasis X.affineOpens :=
   rcases hS with ⟨i, rfl⟩
   exact range_is_affine_open_of_open_immersion _
 #align algebraic_geometry.is_basis_affine_open AlgebraicGeometry.isBasis_affine_open
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.fromSpec /-
 /-- The open immersion `Spec 𝒪ₓ(U) ⟶ X` for an affine `U`. -/
 def IsAffineOpen.fromSpec {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     Scheme.Spec.obj (op <| X.Presheaf.obj <| op U) ⟶ X :=
@@ -209,12 +255,16 @@ def IsAffineOpen.fromSpec {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen
     Scheme.Spec.map (X.presheaf.map (eq_to_hom this.symm).op).op ≫
       (X.restrict U.open_embedding).isoSpec.inv ≫ X.of_restrict _
 #align algebraic_geometry.is_affine_open.from_Spec AlgebraicGeometry.IsAffineOpen.fromSpec
+-/
 
-instance IsAffineOpen.isOpenImmersionCat_fromSpec {X : Scheme} {U : Opens X.carrier}
+#print AlgebraicGeometry.IsAffineOpen.isOpenImmersion_fromSpec /-
+instance IsAffineOpen.isOpenImmersion_fromSpec {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) : IsOpenImmersionCat hU.fromSpec := by delta is_affine_open.from_Spec;
   infer_instance
-#align algebraic_geometry.is_affine_open.is_open_immersion_from_Spec AlgebraicGeometry.IsAffineOpen.isOpenImmersionCat_fromSpec
+#align algebraic_geometry.is_affine_open.is_open_immersion_from_Spec AlgebraicGeometry.IsAffineOpen.isOpenImmersion_fromSpec
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.fromSpec_range /-
 theorem IsAffineOpen.fromSpec_range {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     Set.range hU.fromSpec.1.base = (U : Set X.carrier) :=
   by
@@ -225,12 +275,16 @@ theorem IsAffineOpen.fromSpec_range {X : Scheme} {U : Opens X.carrier} (hU : IsA
   rw [← TopCat.epi_iff_surjective]
   infer_instance
 #align algebraic_geometry.is_affine_open.from_Spec_range AlgebraicGeometry.IsAffineOpen.fromSpec_range
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.fromSpec_image_top /-
 theorem IsAffineOpen.fromSpec_image_top {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
-    hU.isOpenImmersionCat_fromSpec.base_open.IsOpenMap.Functor.obj ⊤ = U := by ext1;
+    hU.isOpenImmersion_fromSpec.base_open.IsOpenMap.Functor.obj ⊤ = U := by ext1;
   exact set.image_univ.trans hU.from_Spec_range
 #align algebraic_geometry.is_affine_open.from_Spec_image_top AlgebraicGeometry.IsAffineOpen.fromSpec_image_top
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.isCompact /-
 theorem IsAffineOpen.isCompact {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     IsCompact (U : Set X.carrier) :=
   by
@@ -240,7 +294,9 @@ theorem IsAffineOpen.isCompact {X : Scheme} {U : Opens X.carrier} (hU : IsAffine
   convert hU.from_Spec_range.symm
   exact Set.image_univ
 #align algebraic_geometry.is_affine_open.is_compact AlgebraicGeometry.IsAffineOpen.isCompact
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.imageIsOpenImmersion /-
 theorem IsAffineOpen.imageIsOpenImmersion {X Y : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X ⟶ Y) [H : IsOpenImmersionCat f] : IsAffineOpen (f.opensFunctor.obj U) :=
   by
@@ -249,8 +305,10 @@ theorem IsAffineOpen.imageIsOpenImmersion {X Y : Scheme} {U : Opens X.carrier} (
   ext1
   exact Set.image_eq_range _ _
 #align algebraic_geometry.is_affine_open.image_is_open_immersion AlgebraicGeometry.IsAffineOpen.imageIsOpenImmersion
+-/
 
-theorem isAffineOpen_iff_of_isOpenImmersionCat {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
+#print AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion /-
+theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
     (U : Opens X.carrier) : IsAffineOpen (H.openFunctor.obj U) ↔ IsAffineOpen U :=
   by
   refine' ⟨fun hU => @is_affine_of_iso _ _ hU, fun hU => hU.imageIsOpenImmersion f⟩
@@ -260,12 +318,16 @@ theorem isAffineOpen_iff_of_isOpenImmersionCat {X Y : Scheme} (f : X ⟶ Y) [H :
     rw [Subtype.range_coe, Subtype.range_coe]
     rfl
   · infer_instance
-#align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersionCat
+#align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
+-/
 
+#print AlgebraicGeometry.Scheme.quasi_compact_of_affine /-
 instance Scheme.quasi_compact_of_affine (X : Scheme) [IsAffine X] : CompactSpace X.carrier :=
   ⟨(topIsAffineOpen X).IsCompact⟩
 #align algebraic_geometry.Scheme.quasi_compact_of_affine AlgebraicGeometry.Scheme.quasi_compact_of_affine
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.fromSpec_base_preimage /-
 theorem IsAffineOpen.fromSpec_base_preimage {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) : (Opens.map hU.fromSpec.val.base).obj U = ⊤ :=
   by
@@ -274,6 +336,7 @@ theorem IsAffineOpen.fromSpec_base_preimage {X : Scheme} {U : Opens X.carrier}
   rw [← hU.from_Spec_range, ← Set.image_univ]
   exact Set.preimage_image_eq _ PresheafedSpace.is_open_immersion.base_open.inj
 #align algebraic_geometry.is_affine_open.from_Spec_base_preimage AlgebraicGeometry.IsAffineOpen.fromSpec_base_preimage
+-/
 
 theorem Scheme.spec_map_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier} (h : U = V) (W) :
     (Scheme.Spec.map (X.Presheaf.map (eqToHom h).op).op).val.c.app W =
@@ -287,7 +350,8 @@ theorem Scheme.spec_map_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier
   simpa [eq_to_hom_map]
 #align algebraic_geometry.Scheme.Spec_map_presheaf_map_eq_to_hom AlgebraicGeometry.Scheme.spec_map_presheaf_map_eqToHom
 
-theorem IsAffineOpen.specΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.carrier}
+#print AlgebraicGeometry.IsAffineOpen.SpecΓIdentity_hom_app_fromSpec /-
+theorem IsAffineOpen.SpecΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) :
     SpecΓIdentity.Hom.app (X.Presheaf.obj <| op U) ≫ hU.fromSpec.1.c.app (op U) =
       (Scheme.Spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
@@ -315,8 +379,10 @@ theorem IsAffineOpen.specΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.c
   simp only [eq_to_hom_map, eq_to_hom_op, Scheme.Spec_map_presheaf_map_eq_to_hom]
   erw [Scheme.Spec_map_presheaf_map_eq_to_hom, category.id_comp]
   simpa only [eq_to_hom_trans]
-#align algebraic_geometry.is_affine_open.Spec_Γ_identity_hom_app_from_Spec AlgebraicGeometry.IsAffineOpen.specΓIdentity_hom_app_fromSpec
+#align algebraic_geometry.is_affine_open.Spec_Γ_identity_hom_app_from_Spec AlgebraicGeometry.IsAffineOpen.SpecΓIdentity_hom_app_fromSpec
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.fromSpec_app_eq /-
 @[elementwise]
 theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     hU.fromSpec.1.c.app (op U) =
@@ -324,7 +390,9 @@ theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X.carrier} (hU : Is
         (Scheme.Spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
   by rw [← hU.Spec_Γ_identity_hom_app_from_Spec, iso.inv_hom_id_app_assoc]
 #align algebraic_geometry.is_affine_open.from_Spec_app_eq AlgebraicGeometry.IsAffineOpen.fromSpec_app_eq
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.basicOpenIsAffine /-
 theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) : IsAffineOpen (X.basicOpen f) :=
   by
@@ -362,7 +430,9 @@ theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X.carrier} (hU :
   rw [iso.eq_inv_comp]
   erw [hU.Spec_Γ_identity_hom_app_from_Spec]
 #align algebraic_geometry.is_affine_open.basic_open_is_affine AlgebraicGeometry.IsAffineOpen.basicOpenIsAffine
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.mapRestrictBasicOpen /-
 theorem IsAffineOpen.mapRestrictBasicOpen {X : Scheme} (r : X.Presheaf.obj (op ⊤))
     {U : Opens X.carrier} (hU : IsAffineOpen U) :
     IsAffineOpen ((Opens.map (X.of_restrict (X.basicOpen r).OpenEmbedding).1.base).obj U) :=
@@ -375,8 +445,10 @@ theorem IsAffineOpen.mapRestrictBasicOpen {X : Scheme} (r : X.Presheaf.obj (op 
     Scheme.basic_open_res _ _ (hom_of_le le_top).op]
   exact hU.basic_open_is_affine _
 #align algebraic_geometry.is_affine_open.map_restrict_basic_open AlgebraicGeometry.IsAffineOpen.mapRestrictBasicOpen
+-/
 
-theorem Scheme.map_prime_spectrum_basicOpen_of_affine (X : Scheme) [IsAffine X]
+#print AlgebraicGeometry.Scheme.map_PrimeSpectrum_basicOpen_of_affine /-
+theorem Scheme.map_PrimeSpectrum_basicOpen_of_affine (X : Scheme) [IsAffine X]
     (f : Scheme.Γ.obj (op X)) :
     (Opens.map X.isoSpec.Hom.1.base).obj (PrimeSpectrum.basicOpen f) = X.basicOpen f :=
   by
@@ -394,8 +466,10 @@ theorem Scheme.map_prime_spectrum_basicOpen_of_affine (X : Scheme) [IsAffine X]
   · dsimp; congr
   · refine' (Scheme.preimage_basic_open _ _).trans _
     rw [is_iso.inv_hom_id_apply, Scheme.basic_open_res_eq]
-#align algebraic_geometry.Scheme.map_prime_spectrum_basic_open_of_affine AlgebraicGeometry.Scheme.map_prime_spectrum_basicOpen_of_affine
+#align algebraic_geometry.Scheme.map_prime_spectrum_basic_open_of_affine AlgebraicGeometry.Scheme.map_PrimeSpectrum_basicOpen_of_affine
+-/
 
+#print AlgebraicGeometry.isBasis_basicOpen /-
 theorem isBasis_basicOpen (X : Scheme) [IsAffine X] :
     Opens.IsBasis (Set.range (X.basicOpen : X.Presheaf.obj (op ⊤) → Opens X.carrier)) :=
   by
@@ -414,7 +488,9 @@ theorem isBasis_basicOpen (X : Scheme) [IsAffine X] :
     refine' ⟨_, ⟨x, rfl⟩, _⟩
     exact congr_arg opens.carrier (X.map_prime_spectrum_basic_open_of_affine x).symm
 #align algebraic_geometry.is_basis_basic_open AlgebraicGeometry.isBasis_basicOpen
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.exists_basicOpen_le /-
 theorem IsAffineOpen.exists_basicOpen_le {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     {V : Opens X.carrier} (x : V) (h : ↑x ∈ U) :
     ∃ f : X.Presheaf.obj (op U), X.basicOpen f ≤ V ∧ ↑x ∈ X.basicOpen f :=
@@ -439,11 +515,13 @@ theorem IsAffineOpen.exists_basicOpen_le {X : Scheme} {U : Opens X.carrier} (hU
   exact ⟨set.image_subset_iff.mpr h₂, Set.mem_image_of_mem _ h₁⟩
   exact x.prop
 #align algebraic_geometry.is_affine_open.exists_basic_open_le AlgebraicGeometry.IsAffineOpen.exists_basicOpen_le
+-/
 
 instance {X : Scheme} {U : Opens X.carrier} (f : X.Presheaf.obj (op U)) :
     Algebra (X.Presheaf.obj (op U)) (X.Presheaf.obj (op <| X.basicOpen f)) :=
   (X.Presheaf.map (homOfLE <| RingedSpace.basicOpen_le _ f : _ ⟶ U).op).toAlgebra
 
+#print AlgebraicGeometry.IsAffineOpen.opens_map_fromSpec_basicOpen /-
 theorem IsAffineOpen.opens_map_fromSpec_basicOpen {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) (f : X.Presheaf.obj (op U)) :
     (Opens.map hU.fromSpec.val.base).obj (X.basicOpen f) =
@@ -461,7 +539,9 @@ theorem IsAffineOpen.opens_map_fromSpec_basicOpen {X : Scheme} {U : Opens X.carr
   erw [← hU.Spec_Γ_identity_hom_app_from_Spec]
   rw [iso.inv_hom_id_app_assoc]
 #align algebraic_geometry.is_affine_open.opens_map_from_Spec_basic_open AlgebraicGeometry.IsAffineOpen.opens_map_fromSpec_basicOpen
+-/
 
+#print AlgebraicGeometry.basicOpenSectionsToAffine /-
 /-- The canonical map `Γ(𝒪ₓ, D(f)) ⟶ Γ(Spec 𝒪ₓ(U), D(Spec_Γ_identity.inv f))`
 This is an isomorphism, as witnessed by an `is_iso` instance. -/
 def basicOpenSectionsToAffine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
@@ -473,6 +553,7 @@ def basicOpenSectionsToAffine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineO
     (Scheme.Spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.map
       (eqToHom <| (hU.opens_map_fromSpec_basicOpen f).symm).op
 #align algebraic_geometry.basic_open_sections_to_affine AlgebraicGeometry.basicOpenSectionsToAffine
+-/
 
 instance {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) (f : X.Presheaf.obj (op U)) :
     IsIso (basicOpenSectionsToAffine hU f) :=
@@ -484,7 +565,8 @@ instance {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) (f : X.Preshea
     exact RingedSpace.basic_open_le _ _
   infer_instance
 
-theorem is_localization_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
+#print AlgebraicGeometry.isLocalization_basicOpen /-
+theorem isLocalization_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) : IsLocalization.Away f (X.Presheaf.obj (op <| X.basicOpen f)) :=
   by
   apply
@@ -503,28 +585,36 @@ theorem is_localization_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAff
   dsimp
   simp only [category.assoc, ← functor.map_comp, ← op_comp]
   apply structure_sheaf.to_open_res
-#align algebraic_geometry.is_localization_basic_open AlgebraicGeometry.is_localization_basicOpen
+#align algebraic_geometry.is_localization_basic_open AlgebraicGeometry.isLocalization_basicOpen
+-/
 
 instance {X : Scheme} [IsAffine X] (r : X.Presheaf.obj (op ⊤)) :
     IsLocalization.Away r (X.Presheaf.obj (op <| X.basicOpen r)) :=
-  is_localization_basicOpen (topIsAffineOpen X) r
+  isLocalization_basicOpen (topIsAffineOpen X) r
 
-theorem is_localization_of_eq_basicOpen {X : Scheme} {U V : Opens X.carrier} (i : V ⟶ U)
+#print AlgebraicGeometry.isLocalization_of_eq_basicOpen /-
+theorem isLocalization_of_eq_basicOpen {X : Scheme} {U V : Opens X.carrier} (i : V ⟶ U)
     (hU : IsAffineOpen U) (r : X.Presheaf.obj (op U)) (e : V = X.basicOpen r) :
     @IsLocalization.Away _ r (X.Presheaf.obj (op V)) _ (X.Presheaf.map i.op).toAlgebra := by
   subst e; convert is_localization_basic_open hU r using 3
-#align algebraic_geometry.is_localization_of_eq_basic_open AlgebraicGeometry.is_localization_of_eq_basicOpen
+#align algebraic_geometry.is_localization_of_eq_basic_open AlgebraicGeometry.isLocalization_of_eq_basicOpen
+-/
 
+#print AlgebraicGeometry.ΓRestrictAlgebra /-
 instance ΓRestrictAlgebra {X : Scheme} {Y : TopCat} {f : Y ⟶ X.carrier} (hf : OpenEmbedding f) :
     Algebra (Scheme.Γ.obj (op X)) (Scheme.Γ.obj (op <| X.restrict hf)) :=
   (Scheme.Γ.map (X.of_restrict hf).op).toAlgebra
 #align algebraic_geometry.Γ_restrict_algebra AlgebraicGeometry.ΓRestrictAlgebra
+-/
 
-instance Γ_restrict_is_localization (X : Scheme.{u}) [IsAffine X] (r : Scheme.Γ.obj (op X)) :
+#print AlgebraicGeometry.Γ_restrict_isLocalization /-
+instance Γ_restrict_isLocalization (X : Scheme.{u}) [IsAffine X] (r : Scheme.Γ.obj (op X)) :
     IsLocalization.Away r (Scheme.Γ.obj (op <| X.restrict (X.basicOpen r).OpenEmbedding)) :=
-  is_localization_of_eq_basicOpen _ (topIsAffineOpen X) r (Opens.openEmbedding_obj_top _)
-#align algebraic_geometry.Γ_restrict_is_localization AlgebraicGeometry.Γ_restrict_is_localization
+  isLocalization_of_eq_basicOpen _ (topIsAffineOpen X) r (Opens.openEmbedding_obj_top _)
+#align algebraic_geometry.Γ_restrict_is_localization AlgebraicGeometry.Γ_restrict_isLocalization
+-/
 
+#print AlgebraicGeometry.basicOpen_basicOpen_is_basicOpen /-
 theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) (g : X.Presheaf.obj (op <| X.basicOpen f)) :
     ∃ f' : X.Presheaf.obj (op U), X.basicOpen f' = X.basicOpen g :=
@@ -542,7 +632,9 @@ theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X.carrier} (hU
       (IsLocalization.toInvSubmonoid (Submonoid.powers f) (X.presheaf.obj (op <| X.basic_open f))
           _).Prop
 #align algebraic_geometry.basic_open_basic_open_is_basic_open AlgebraicGeometry.basicOpen_basicOpen_is_basicOpen
+-/
 
+#print AlgebraicGeometry.exists_basicOpen_le_affine_inter /-
 theorem exists_basicOpen_le_affine_inter {X : Scheme} {U V : Opens X.carrier} (hU : IsAffineOpen U)
     (hV : IsAffineOpen V) (x : X.carrier) (hx : x ∈ U ⊓ V) :
     ∃ (f : X.Presheaf.obj <| op U) (g : X.Presheaf.obj <| op V),
@@ -555,7 +647,9 @@ theorem exists_basicOpen_le_affine_inter {X : Scheme} {U V : Opens X.carrier} (h
   replace hf' := (hf'.trans (RingedSpace.basic_open_res _ _ _)).trans (inf_eq_right.mpr hg₁)
   exact ⟨f', g, hf', hf'.symm ▸ hg₂⟩
 #align algebraic_geometry.exists_basic_open_le_affine_inter AlgebraicGeometry.exists_basicOpen_le_affine_inter
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.primeIdealOf /-
 /-- The prime ideal of `𝒪ₓ(U)` corresponding to a point `x : U`. -/
 noncomputable def IsAffineOpen.primeIdealOf {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (x : U) : PrimeSpectrum (X.Presheaf.obj <| op U) :=
@@ -566,7 +660,9 @@ noncomputable def IsAffineOpen.primeIdealOf {X : Scheme} {U : Opens X.carrier} (
                     Opens.ext (Set.image_univ.trans Subtype.range_coe)).op).op).1.base
     ((@Scheme.isoSpec (X.restrict U.OpenEmbedding) hU).Hom.1.base x)
 #align algebraic_geometry.is_affine_open.prime_ideal_of AlgebraicGeometry.IsAffineOpen.primeIdealOf
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.fromSpec_primeIdealOf /-
 theorem IsAffineOpen.fromSpec_primeIdealOf {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (x : U) : hU.fromSpec.val.base (hU.primeIdealOf x) = x.1 :=
   by
@@ -575,8 +671,10 @@ theorem IsAffineOpen.fromSpec_primeIdealOf {X : Scheme} {U : Opens X.carrier} (h
   simpa only [← functor.map_comp_assoc, ← functor.map_comp, ← op_comp, eq_to_hom_trans, op_id,
     eq_to_hom_refl, CategoryTheory.Functor.map_id, category.id_comp, iso.hom_inv_id_assoc]
 #align algebraic_geometry.is_affine_open.from_Spec_prime_ideal_of AlgebraicGeometry.IsAffineOpen.fromSpec_primeIdealOf
+-/
 
-theorem IsAffineOpen.is_localization_stalk_aux {X : Scheme} (U : Opens X.carrier)
+#print AlgebraicGeometry.IsAffineOpen.isLocalization_stalk_aux /-
+theorem IsAffineOpen.isLocalization_stalk_aux {X : Scheme} (U : Opens X.carrier)
     [IsAffine (X.restrict U.OpenEmbedding)] :
     (inv (ΓSpec.adjunction.Unit.app (X.restrict U.OpenEmbedding))).1.c.app
         (op ((Opens.map U.inclusion).obj U)) =
@@ -600,9 +698,11 @@ theorem IsAffineOpen.is_localization_stalk_aux {X : Scheme} (U : Opens X.carrier
   rw [eq_to_hom_trans, eq_to_hom_refl, CategoryTheory.Functor.map_id, category.id_comp]
   erw [Spec_Γ_identity.inv_hom_id_app_assoc]
   simp only [eq_to_hom_map, eq_to_hom_trans]
-#align algebraic_geometry.is_affine_open.is_localization_stalk_aux AlgebraicGeometry.IsAffineOpen.is_localization_stalk_aux
+#align algebraic_geometry.is_affine_open.is_localization_stalk_aux AlgebraicGeometry.IsAffineOpen.isLocalization_stalk_aux
+-/
 
-theorem IsAffineOpen.is_localization_stalk {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
+#print AlgebraicGeometry.IsAffineOpen.isLocalization_stalk /-
+theorem IsAffineOpen.isLocalization_stalk {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (x : U) : IsLocalization.AtPrime (X.Presheaf.stalk x) (hU.primeIdealOf x).asIdeal :=
   by
   haveI : is_affine _ := hU
@@ -646,15 +746,19 @@ theorem IsAffineOpen.is_localization_stalk {X : Scheme} {U : Opens X.carrier} (h
   erw [CategoryTheory.Functor.map_id]
   rw [category.id_comp]
   rfl
-#align algebraic_geometry.is_affine_open.is_localization_stalk AlgebraicGeometry.IsAffineOpen.is_localization_stalk
+#align algebraic_geometry.is_affine_open.is_localization_stalk AlgebraicGeometry.IsAffineOpen.isLocalization_stalk
+-/
 
+#print AlgebraicGeometry.Scheme.affineBasicOpen /-
 /-- The basic open set of a section `f` on an an affine open as an `X.affine_opens`. -/
 @[simps]
 def Scheme.affineBasicOpen (X : Scheme) {U : X.affineOpens} (f : X.Presheaf.obj <| op U) :
     X.affineOpens :=
   ⟨X.basicOpen f, U.Prop.basicOpenIsAffine f⟩
 #align algebraic_geometry.Scheme.affine_basic_open AlgebraicGeometry.Scheme.affineBasicOpen
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.basicOpen_fromSpec_app /-
 @[simp]
 theorem IsAffineOpen.basicOpen_fromSpec_app {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) :
@@ -670,12 +774,16 @@ theorem IsAffineOpen.basicOpen_fromSpec_app {X : Scheme} {U : Opens X.carrier} (
     ← iso.app_inv, iso.inv_hom_id]
   rfl
 #align algebraic_geometry.is_affine_open.basic_open_from_Spec_app AlgebraicGeometry.IsAffineOpen.basicOpen_fromSpec_app
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.fromSpec_map_basicOpen /-
 theorem IsAffineOpen.fromSpec_map_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) :
     (Opens.map hU.fromSpec.val.base).obj (X.basicOpen f) = PrimeSpectrum.basicOpen f := by simp
 #align algebraic_geometry.is_affine_open.from_Spec_map_basic_open AlgebraicGeometry.IsAffineOpen.fromSpec_map_basicOpen
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.basicOpen_union_eq_self_iff /-
 theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) (s : Set (X.Presheaf.obj <| op U)) :
     (⨆ f : s, X.basicOpen (f : X.Presheaf.obj <| op U)) = U ↔ Ideal.span s = ⊤ :=
@@ -705,7 +813,9 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X.carri
       PrimeSpectrum.zeroLocus_empty_iff_eq_top, PrimeSpectrum.zeroLocus_span]
     simp only [Set.iUnion_singleton_eq_range, Subtype.range_val_subtype, Set.setOf_mem_eq]
 #align algebraic_geometry.is_affine_open.basic_open_union_eq_self_iff AlgebraicGeometry.IsAffineOpen.basicOpen_union_eq_self_iff
+-/
 
+#print AlgebraicGeometry.IsAffineOpen.self_le_basicOpen_union_iff /-
 theorem IsAffineOpen.self_le_basicOpen_union_iff {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) (s : Set (X.Presheaf.obj <| op U)) :
     (U ≤ ⨆ f : s, X.basicOpen (f : X.Presheaf.obj <| op U)) ↔ Ideal.span s = ⊤ :=
@@ -716,7 +826,9 @@ theorem IsAffineOpen.self_le_basicOpen_union_iff {X : Scheme} {U : Opens X.carri
   intro x hx
   exact X.basic_open_le x
 #align algebraic_geometry.is_affine_open.self_le_basic_open_union_iff AlgebraicGeometry.IsAffineOpen.self_le_basicOpen_union_iff
+-/
 
+#print AlgebraicGeometry.of_affine_open_cover /-
 /-- Let `P` be a predicate on the affine open sets of `X` satisfying
 1. If `P` holds on `U`, then `P` holds on the basic open set of every section on `U`.
 2. If `P` holds for a family of basic open sets covering `U`, then `P` holds for `U`.
@@ -759,6 +871,7 @@ theorem of_affine_open_cover {X : Scheme} (V : X.affineOpens) (S : Set X.affineO
   rw [iSup_range', opens.mem_supr]
   exact ⟨_, hf₁ ⟨x, hx⟩⟩
 #align algebraic_geometry.of_affine_open_cover AlgebraicGeometry.of_affine_open_cover
+-/
 
 end AlgebraicGeometry
 
Diff
@@ -164,7 +164,7 @@ def Scheme.affineOpens (X : Scheme) : Set (Opens X.carrier) :=
 #align algebraic_geometry.Scheme.affine_opens AlgebraicGeometry.Scheme.affineOpens
 
 theorem rangeIsAffineOpenOfOpenImmersion {X Y : Scheme} [IsAffine X] (f : X ⟶ Y)
-    [H : IsOpenImmersion f] : IsAffineOpen f.opensRange :=
+    [H : IsOpenImmersionCat f] : IsAffineOpen f.opensRange :=
   by
   refine' is_affine_of_iso (is_open_immersion.iso_of_range_eq f (Y.of_restrict _) _).inv
   exact subtype.range_coe.symm
@@ -210,10 +210,10 @@ def IsAffineOpen.fromSpec {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen
       (X.restrict U.open_embedding).isoSpec.inv ≫ X.of_restrict _
 #align algebraic_geometry.is_affine_open.from_Spec AlgebraicGeometry.IsAffineOpen.fromSpec
 
-instance IsAffineOpen.isOpenImmersion_fromSpec {X : Scheme} {U : Opens X.carrier}
-    (hU : IsAffineOpen U) : IsOpenImmersion hU.fromSpec := by delta is_affine_open.from_Spec;
+instance IsAffineOpen.isOpenImmersionCat_fromSpec {X : Scheme} {U : Opens X.carrier}
+    (hU : IsAffineOpen U) : IsOpenImmersionCat hU.fromSpec := by delta is_affine_open.from_Spec;
   infer_instance
-#align algebraic_geometry.is_affine_open.is_open_immersion_from_Spec AlgebraicGeometry.IsAffineOpen.isOpenImmersion_fromSpec
+#align algebraic_geometry.is_affine_open.is_open_immersion_from_Spec AlgebraicGeometry.IsAffineOpen.isOpenImmersionCat_fromSpec
 
 theorem IsAffineOpen.fromSpec_range {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     Set.range hU.fromSpec.1.base = (U : Set X.carrier) :=
@@ -227,7 +227,7 @@ theorem IsAffineOpen.fromSpec_range {X : Scheme} {U : Opens X.carrier} (hU : IsA
 #align algebraic_geometry.is_affine_open.from_Spec_range AlgebraicGeometry.IsAffineOpen.fromSpec_range
 
 theorem IsAffineOpen.fromSpec_image_top {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
-    hU.isOpenImmersion_fromSpec.base_open.IsOpenMap.Functor.obj ⊤ = U := by ext1;
+    hU.isOpenImmersionCat_fromSpec.base_open.IsOpenMap.Functor.obj ⊤ = U := by ext1;
   exact set.image_univ.trans hU.from_Spec_range
 #align algebraic_geometry.is_affine_open.from_Spec_image_top AlgebraicGeometry.IsAffineOpen.fromSpec_image_top
 
@@ -242,7 +242,7 @@ theorem IsAffineOpen.isCompact {X : Scheme} {U : Opens X.carrier} (hU : IsAffine
 #align algebraic_geometry.is_affine_open.is_compact AlgebraicGeometry.IsAffineOpen.isCompact
 
 theorem IsAffineOpen.imageIsOpenImmersion {X Y : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
-    (f : X ⟶ Y) [H : IsOpenImmersion f] : IsAffineOpen (f.opensFunctor.obj U) :=
+    (f : X ⟶ Y) [H : IsOpenImmersionCat f] : IsAffineOpen (f.opensFunctor.obj U) :=
   by
   haveI : is_affine _ := hU
   convert range_is_affine_open_of_open_immersion (X.of_restrict U.open_embedding ≫ f)
@@ -250,7 +250,7 @@ theorem IsAffineOpen.imageIsOpenImmersion {X Y : Scheme} {U : Opens X.carrier} (
   exact Set.image_eq_range _ _
 #align algebraic_geometry.is_affine_open.image_is_open_immersion AlgebraicGeometry.IsAffineOpen.imageIsOpenImmersion
 
-theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f]
+theorem isAffineOpen_iff_of_isOpenImmersionCat {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
     (U : Opens X.carrier) : IsAffineOpen (H.openFunctor.obj U) ↔ IsAffineOpen U :=
   by
   refine' ⟨fun hU => @is_affine_of_iso _ _ hU, fun hU => hU.imageIsOpenImmersion f⟩
@@ -260,7 +260,7 @@ theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : Is
     rw [Subtype.range_coe, Subtype.range_coe]
     rfl
   · infer_instance
-#align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
+#align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersionCat
 
 instance Scheme.quasi_compact_of_affine (X : Scheme) [IsAffine X] : CompactSpace X.carrier :=
   ⟨(topIsAffineOpen X).IsCompact⟩
Diff
@@ -49,7 +49,7 @@ open Spec (structureSheaf)
 /-- The category of affine schemes -/
 @[nolint has_nonempty_instance]
 def AffineScheme :=
-  Scheme.spec.EssImageSubcategory
+  Scheme.Spec.EssImageSubcategory
 deriving Category
 #align algebraic_geometry.AffineScheme AlgebraicGeometry.AffineScheme
 
@@ -61,7 +61,7 @@ class IsAffine (X : Scheme) : Prop where
 attribute [instance] is_affine.affine
 
 /-- The canonical isomorphism `X ≅ Spec Γ(X)` for an affine scheme. -/
-def Scheme.isoSpec (X : Scheme) [IsAffine X] : X ≅ Scheme.spec.obj (op <| Scheme.Γ.obj <| op X) :=
+def Scheme.isoSpec (X : Scheme) [IsAffine X] : X ≅ Scheme.Spec.obj (op <| Scheme.Γ.obj <| op X) :=
   asIso (ΓSpec.adjunction.Unit.app X)
 #align algebraic_geometry.Scheme.iso_Spec AlgebraicGeometry.Scheme.isoSpec
 
@@ -84,34 +84,34 @@ def AffineScheme.ofHom {X Y : Scheme} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) :
   f
 #align algebraic_geometry.AffineScheme.of_hom AlgebraicGeometry.AffineScheme.ofHom
 
-theorem mem_spec_essImage (X : Scheme) : X ∈ Scheme.spec.essImage ↔ IsAffine X :=
+theorem mem_spec_essImage (X : Scheme) : X ∈ Scheme.Spec.essImage ↔ IsAffine X :=
   ⟨fun h => ⟨Functor.essImage.unit_isIso h⟩, fun h => @mem_essImage_of_unit_isIso _ _ _ X h.1⟩
 #align algebraic_geometry.mem_Spec_ess_image AlgebraicGeometry.mem_spec_essImage
 
-instance isAffine_affineScheme (X : AffineScheme.{u}) : IsAffine X.obj :=
+instance isAffineAffineScheme (X : AffineScheme.{u}) : IsAffine X.obj :=
   ⟨Functor.essImage.unit_isIso X.property⟩
-#align algebraic_geometry.is_affine_AffineScheme AlgebraicGeometry.isAffine_affineScheme
+#align algebraic_geometry.is_affine_AffineScheme AlgebraicGeometry.isAffineAffineScheme
 
-instance spec_isAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.spec.obj R) :=
-  AlgebraicGeometry.isAffine_affineScheme ⟨_, Scheme.spec.obj_mem_essImage R⟩
-#align algebraic_geometry.Spec_is_affine AlgebraicGeometry.spec_isAffine
+instance specIsAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.Spec.obj R) :=
+  AlgebraicGeometry.isAffineAffineScheme ⟨_, Scheme.Spec.obj_mem_essImage R⟩
+#align algebraic_geometry.Spec_is_affine AlgebraicGeometry.specIsAffine
 
-theorem isAffine_of_iso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X := by
+theorem isAffineOfIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X := by
   rw [← mem_Spec_ess_image] at h ⊢; exact functor.ess_image.of_iso (as_iso f).symm h
-#align algebraic_geometry.is_affine_of_iso AlgebraicGeometry.isAffine_of_iso
+#align algebraic_geometry.is_affine_of_iso AlgebraicGeometry.isAffineOfIso
 
 namespace AffineScheme
 
 /-- The `Spec` functor into the category of affine schemes. -/
 def spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
-  Scheme.spec.toEssImage
+  Scheme.Spec.toEssImage
 deriving Full, Faithful, EssSurj
 #align algebraic_geometry.AffineScheme.Spec AlgebraicGeometry.AffineScheme.spec
 
 /-- The forgetful functor `AffineScheme ⥤ Scheme`. -/
 @[simps]
 def forgetToScheme : AffineScheme ⥤ Scheme :=
-  Scheme.spec.essImageInclusion
+  Scheme.Spec.essImageInclusion
 deriving Full, Faithful
 #align algebraic_geometry.AffineScheme.forget_to_Scheme AlgebraicGeometry.AffineScheme.forgetToScheme
 
@@ -178,15 +178,15 @@ theorem topIsAffineOpen (X : Scheme) [IsAffine X] : IsAffineOpen (⊤ : Opens X.
   exact set.range_id.symm
 #align algebraic_geometry.top_is_affine_open AlgebraicGeometry.topIsAffineOpen
 
-instance Scheme.affineCover_isAffine (X : Scheme) (i : X.affineCover.J) :
+instance Scheme.affineCoverIsAffine (X : Scheme) (i : X.affineCover.J) :
     IsAffine (X.affineCover.obj i) :=
-  AlgebraicGeometry.spec_isAffine _
-#align algebraic_geometry.Scheme.affine_cover_is_affine AlgebraicGeometry.Scheme.affineCover_isAffine
+  AlgebraicGeometry.specIsAffine _
+#align algebraic_geometry.Scheme.affine_cover_is_affine AlgebraicGeometry.Scheme.affineCoverIsAffine
 
-instance Scheme.affineBasisCover_isAffine (X : Scheme) (i : X.affineBasisCover.J) :
+instance Scheme.affineBasisCoverIsAffine (X : Scheme) (i : X.affineBasisCover.J) :
     IsAffine (X.affineBasisCover.obj i) :=
-  AlgebraicGeometry.spec_isAffine _
-#align algebraic_geometry.Scheme.affine_basis_cover_is_affine AlgebraicGeometry.Scheme.affineBasisCover_isAffine
+  AlgebraicGeometry.specIsAffine _
+#align algebraic_geometry.Scheme.affine_basis_cover_is_affine AlgebraicGeometry.Scheme.affineBasisCoverIsAffine
 
 theorem isBasis_affine_open (X : Scheme) : Opens.IsBasis X.affineOpens :=
   by
@@ -200,7 +200,7 @@ theorem isBasis_affine_open (X : Scheme) : Opens.IsBasis X.affineOpens :=
 
 /-- The open immersion `Spec 𝒪ₓ(U) ⟶ X` for an affine `U`. -/
 def IsAffineOpen.fromSpec {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
-    Scheme.spec.obj (op <| X.Presheaf.obj <| op U) ⟶ X :=
+    Scheme.Spec.obj (op <| X.Presheaf.obj <| op U) ⟶ X :=
   by
   haveI : is_affine (X.restrict U.open_embedding) := hU
   have : U.open_embedding.is_open_map.functor.obj ⊤ = U := by ext1;
@@ -276,7 +276,7 @@ theorem IsAffineOpen.fromSpec_base_preimage {X : Scheme} {U : Opens X.carrier}
 #align algebraic_geometry.is_affine_open.from_Spec_base_preimage AlgebraicGeometry.IsAffineOpen.fromSpec_base_preimage
 
 theorem Scheme.spec_map_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier} (h : U = V) (W) :
-    (Scheme.spec.map (X.Presheaf.map (eqToHom h).op).op).val.c.app W =
+    (Scheme.Spec.map (X.Presheaf.map (eqToHom h).op).op).val.c.app W =
       eqToHom (by cases h; induction W using Opposite.rec'; dsimp; simp) :=
   by
   have : Scheme.Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 _ := by
@@ -290,7 +290,7 @@ theorem Scheme.spec_map_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier
 theorem IsAffineOpen.specΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) :
     SpecΓIdentity.Hom.app (X.Presheaf.obj <| op U) ≫ hU.fromSpec.1.c.app (op U) =
-      (Scheme.spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
+      (Scheme.Spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
   by
   haveI : is_affine _ := hU
   have e₁ := Spec_Γ_identity.hom.naturality (X.presheaf.map (eq_to_hom U.open_embedding_obj_top).op)
@@ -321,7 +321,7 @@ theorem IsAffineOpen.specΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.c
 theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     hU.fromSpec.1.c.app (op U) =
       SpecΓIdentity.inv.app (X.Presheaf.obj <| op U) ≫
-        (Scheme.spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
+        (Scheme.Spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
   by rw [← hU.Spec_Γ_identity_hom_app_from_Spec, iso.inv_hom_id_app_assoc]
 #align algebraic_geometry.is_affine_open.from_Spec_app_eq AlgebraicGeometry.IsAffineOpen.fromSpec_app_eq
 
@@ -467,10 +467,10 @@ This is an isomorphism, as witnessed by an `is_iso` instance. -/
 def basicOpenSectionsToAffine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) :
     X.Presheaf.obj (op <| X.basicOpen f) ⟶
-      (Scheme.spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.obj
+      (Scheme.Spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.obj
         (op <| Scheme.basicOpen _ <| SpecΓIdentity.inv.app (X.Presheaf.obj (op U)) f) :=
   hU.fromSpec.1.c.app (op <| X.basicOpen f) ≫
-    (Scheme.spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.map
+    (Scheme.Spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.map
       (eqToHom <| (hU.opens_map_fromSpec_basicOpen f).symm).op
 #align algebraic_geometry.basic_open_sections_to_affine AlgebraicGeometry.basicOpenSectionsToAffine
 
@@ -559,7 +559,7 @@ theorem exists_basicOpen_le_affine_inter {X : Scheme} {U V : Opens X.carrier} (h
 /-- The prime ideal of `𝒪ₓ(U)` corresponding to a point `x : U`. -/
 noncomputable def IsAffineOpen.primeIdealOf {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (x : U) : PrimeSpectrum (X.Presheaf.obj <| op U) :=
-  (Scheme.spec.map
+  (Scheme.Spec.map
           (X.Presheaf.map
               (eqToHom <|
                   show U.OpenEmbedding.IsOpenMap.Functor.obj ⊤ = U from
@@ -585,7 +585,7 @@ theorem IsAffineOpen.is_localization_stalk_aux {X : Scheme} (U : Opens X.carrier
               U.OpenEmbedding.IsOpenMap.Functor.obj ⊤ ⟶
                 U.OpenEmbedding.IsOpenMap.Functor.obj ((Opens.map U.inclusion).obj U)).op ≫
         toSpecΓ (X.Presheaf.obj <| op (U.OpenEmbedding.IsOpenMap.Functor.obj ⊤)) ≫
-          (Scheme.spec.obj <| op <| X.Presheaf.obj <| _).Presheaf.map
+          (Scheme.Spec.obj <| op <| X.Presheaf.obj <| _).Presheaf.map
             (eqToHom (by rw [opens.inclusion_map_eq_top]; rfl) : unop _ ⟶ ⊤).op :=
   by
   have e :
@@ -658,7 +658,7 @@ def Scheme.affineBasicOpen (X : Scheme) {U : X.affineOpens} (f : X.Presheaf.obj
 @[simp]
 theorem IsAffineOpen.basicOpen_fromSpec_app {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) :
-    @Scheme.basicOpen (Scheme.spec.obj <| op (X.Presheaf.obj <| op U))
+    @Scheme.basicOpen (Scheme.Spec.obj <| op (X.Presheaf.obj <| op U))
         ((Opens.map hU.fromSpec.1.base).obj U) (hU.fromSpec.1.c.app (op U) f) =
       PrimeSpectrum.basicOpen f :=
   by
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
 ! This file was ported from Lean 3 source module algebraic_geometry.AffineScheme
-! leanprover-community/mathlib commit 533f62f4dd62a5aad24a04326e6e787c8f7e98b1
+! leanprover-community/mathlib commit 88474d1b5af6d37c2ab728b757771bced7f5194c
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -275,9 +275,9 @@ theorem IsAffineOpen.fromSpec_base_preimage {X : Scheme} {U : Opens X.carrier}
   exact Set.preimage_image_eq _ PresheafedSpace.is_open_immersion.base_open.inj
 #align algebraic_geometry.is_affine_open.from_Spec_base_preimage AlgebraicGeometry.IsAffineOpen.fromSpec_base_preimage
 
-theorem Scheme.specMap_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier} (h : U = V) (W) :
+theorem Scheme.spec_map_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier} (h : U = V) (W) :
     (Scheme.spec.map (X.Presheaf.map (eqToHom h).op).op).val.c.app W =
-      eqToHom (by cases h; induction W using Opposite.rec'; dsimp; simp; rfl) :=
+      eqToHom (by cases h; induction W using Opposite.rec'; dsimp; simp) :=
   by
   have : Scheme.Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 _ := by
     rw [X.presheaf.map_id, op_id, Scheme.Spec.map_id]
@@ -285,7 +285,7 @@ theorem Scheme.specMap_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier}
   refine' (Scheme.congr_app this _).trans _
   erw [category.id_comp]
   simpa [eq_to_hom_map]
-#align algebraic_geometry.Scheme.Spec_map_presheaf_map_eq_to_hom AlgebraicGeometry.Scheme.specMap_presheaf_map_eqToHom
+#align algebraic_geometry.Scheme.Spec_map_presheaf_map_eq_to_hom AlgebraicGeometry.Scheme.spec_map_presheaf_map_eqToHom
 
 theorem IsAffineOpen.specΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) :
Diff
@@ -289,7 +289,7 @@ theorem Scheme.specMap_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier}
 
 theorem IsAffineOpen.specΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) :
-    specΓIdentity.Hom.app (X.Presheaf.obj <| op U) ≫ hU.fromSpec.1.c.app (op U) =
+    SpecΓIdentity.Hom.app (X.Presheaf.obj <| op U) ≫ hU.fromSpec.1.c.app (op U) =
       (Scheme.spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
   by
   haveI : is_affine _ := hU
@@ -320,7 +320,7 @@ theorem IsAffineOpen.specΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.c
 @[elementwise]
 theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     hU.fromSpec.1.c.app (op U) =
-      specΓIdentity.inv.app (X.Presheaf.obj <| op U) ≫
+      SpecΓIdentity.inv.app (X.Presheaf.obj <| op U) ≫
         (Scheme.spec.obj _).Presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
   by rw [← hU.Spec_Γ_identity_hom_app_from_Spec, iso.inv_hom_id_app_assoc]
 #align algebraic_geometry.is_affine_open.from_Spec_app_eq AlgebraicGeometry.IsAffineOpen.fromSpec_app_eq
@@ -447,7 +447,7 @@ instance {X : Scheme} {U : Opens X.carrier} (f : X.Presheaf.obj (op U)) :
 theorem IsAffineOpen.opens_map_fromSpec_basicOpen {X : Scheme} {U : Opens X.carrier}
     (hU : IsAffineOpen U) (f : X.Presheaf.obj (op U)) :
     (Opens.map hU.fromSpec.val.base).obj (X.basicOpen f) =
-      RingedSpace.basicOpen _ (specΓIdentity.inv.app (X.Presheaf.obj <| op U) f) :=
+      RingedSpace.basicOpen _ (SpecΓIdentity.inv.app (X.Presheaf.obj <| op U) f) :=
   by
   erw [LocallyRingedSpace.preimage_basic_open]
   refine'
@@ -468,7 +468,7 @@ def basicOpenSectionsToAffine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineO
     (f : X.Presheaf.obj (op U)) :
     X.Presheaf.obj (op <| X.basicOpen f) ⟶
       (Scheme.spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.obj
-        (op <| Scheme.basicOpen _ <| specΓIdentity.inv.app (X.Presheaf.obj (op U)) f) :=
+        (op <| Scheme.basicOpen _ <| SpecΓIdentity.inv.app (X.Presheaf.obj (op U)) f) :=
   hU.fromSpec.1.c.app (op <| X.basicOpen f) ≫
     (Scheme.spec.obj <| op <| X.Presheaf.obj (op U)).Presheaf.map
       (eqToHom <| (hU.opens_map_fromSpec_basicOpen f).symm).op
Diff
@@ -4,12 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
 ! This file was ported from Lean 3 source module algebraic_geometry.AffineScheme
-! leanprover-community/mathlib commit d39590fc8728fbf6743249802486f8c91ffe07bc
+! leanprover-community/mathlib commit 533f62f4dd62a5aad24a04326e6e787c8f7e98b1
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.AlgebraicGeometry.GammaSpecAdjunction
-import Mathbin.AlgebraicGeometry.OpenImmersion
+import Mathbin.AlgebraicGeometry.OpenImmersion.Scheme
 import Mathbin.CategoryTheory.Limits.Opposites
 import Mathbin.RingTheory.Localization.InvSubmonoid
 
Diff
@@ -160,7 +160,7 @@ def IsAffineOpen {X : Scheme} (U : Opens X.carrier) : Prop :=
 
 /-- The set of affine opens as a subset of `opens X.carrier`. -/
 def Scheme.affineOpens (X : Scheme) : Set (Opens X.carrier) :=
-  { U : Opens X.carrier | IsAffineOpen U }
+  {U : Opens X.carrier | IsAffineOpen U}
 #align algebraic_geometry.Scheme.affine_opens AlgebraicGeometry.Scheme.affineOpens
 
 theorem rangeIsAffineOpenOfOpenImmersion {X Y : Scheme} [IsAffine X] (f : X ⟶ Y)
@@ -234,7 +234,8 @@ theorem IsAffineOpen.fromSpec_image_top {X : Scheme} {U : Opens X.carrier} (hU :
 theorem IsAffineOpen.isCompact {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     IsCompact (U : Set X.carrier) :=
   by
-  convert@IsCompact.image _ _ _ _ Set.univ hU.from_Spec.1.base PrimeSpectrum.compactSpace.1
+  convert
+    @IsCompact.image _ _ _ _ Set.univ hU.from_Spec.1.base PrimeSpectrum.compactSpace.1
       (by continuity)
   convert hU.from_Spec_range.symm
   exact Set.image_univ
@@ -327,7 +328,8 @@ theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X.carrier} (hU : Is
 theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) : IsAffineOpen (X.basicOpen f) :=
   by
-  convert range_is_affine_open_of_open_immersion
+  convert
+    range_is_affine_open_of_open_immersion
       (Scheme.Spec.map
           (CommRingCat.ofHom (algebraMap (X.presheaf.obj (op U)) (Localization.Away f))).op ≫
         hU.from_Spec)
@@ -398,7 +400,8 @@ theorem isBasis_basicOpen (X : Scheme) [IsAffine X] :
     Opens.IsBasis (Set.range (X.basicOpen : X.Presheaf.obj (op ⊤) → Opens X.carrier)) :=
   by
   delta opens.is_basis
-  convert prime_spectrum.is_basis_basic_opens.inducing
+  convert
+    prime_spectrum.is_basis_basic_opens.inducing
       (TopCat.homeoOfIso (Scheme.forget_to_Top.map_iso X.iso_Spec)).Inducing using
     1
   ext
@@ -629,9 +632,8 @@ theorem IsAffineOpen.is_localization_stalk {X : Scheme} {U : Opens X.carrier} (h
   simp only [← category.assoc]
   trans _ ≫ (structure_sheaf (X.presheaf.obj <| op U)).Presheaf.germ ⟨_, _⟩
   · rfl
-  convert(structure_sheaf (X.presheaf.obj <| op U)).Presheaf.germ_res (hom_of_le le_top)
-      ⟨_, _⟩ using
-    2
+  convert
+    (structure_sheaf (X.presheaf.obj <| op U)).Presheaf.germ_res (hom_of_le le_top) ⟨_, _⟩ using 2
   rw [category.assoc]
   erw [nat_trans.naturality]
   rw [← LocallyRingedSpace.Γ_map_op, ← LocallyRingedSpace.Γ.map_comp_assoc, ← op_comp]
@@ -684,7 +686,7 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X.carri
       hU.from_Spec.1.base ⁻¹' U.1
   · refine' ⟨fun h => by rw [h], _⟩
     intro h
-    apply_fun Set.image hU.from_Spec.1.base  at h 
+    apply_fun Set.image hU.from_Spec.1.base at h 
     rw [Set.image_preimage_eq_inter_range, Set.image_preimage_eq_inter_range, hU.from_Spec_range] at
       h 
     simp only [Set.inter_self, opens.carrier_eq_coe, Set.inter_eq_right_iff_subset] at h 
@@ -733,30 +735,29 @@ theorem of_affine_open_cover {X : Scheme} (V : X.affineOpens) (S : Set X.affineO
         (∀ f : s, P (X.affineBasicOpen f.1)) → P U)
     (hS : (⋃ i : S, i : Set X.carrier) = Set.univ) (hS' : ∀ U : S, P U) : P V := by
   classical
-    have :
-      ∀ x : V, ∃ f : X.presheaf.obj <| op V.1, ↑x ∈ X.basic_open f ∧ P (X.affine_basic_open f) :=
-      by
-      intro x
-      have : ↑x ∈ (Set.univ : Set X.carrier) := trivial
-      rw [← hS] at this 
-      obtain ⟨W, hW⟩ := set.mem_Union.mp this
-      obtain ⟨f, g, e, hf⟩ := exists_basic_open_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_basic_open_union_iff]
-    intro x hx
-    rw [iSup_range', opens.mem_supr]
-    exact ⟨_, hf₁ ⟨x, hx⟩⟩
+  have : ∀ x : V, ∃ f : X.presheaf.obj <| op V.1, ↑x ∈ X.basic_open f ∧ P (X.affine_basic_open f) :=
+    by
+    intro x
+    have : ↑x ∈ (Set.univ : Set X.carrier) := trivial
+    rw [← hS] at this 
+    obtain ⟨W, hW⟩ := set.mem_Union.mp this
+    obtain ⟨f, g, e, hf⟩ := exists_basic_open_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_basic_open_union_iff]
+  intro x hx
+  rw [iSup_range', opens.mem_supr]
+  exact ⟨_, hf₁ ⟨x, hx⟩⟩
 #align algebraic_geometry.of_affine_open_cover AlgebraicGeometry.of_affine_open_cover
 
 end AlgebraicGeometry
Diff
@@ -49,7 +49,8 @@ open Spec (structureSheaf)
 /-- The category of affine schemes -/
 @[nolint has_nonempty_instance]
 def AffineScheme :=
-  Scheme.spec.EssImageSubcategory deriving Category
+  Scheme.spec.EssImageSubcategory
+deriving Category
 #align algebraic_geometry.AffineScheme AlgebraicGeometry.AffineScheme
 
 /-- A Scheme is affine if the canonical map `X ⟶ Spec Γ(X)` is an isomorphism. -/
@@ -96,20 +97,22 @@ instance spec_isAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.spec.obj R) :=
 #align algebraic_geometry.Spec_is_affine AlgebraicGeometry.spec_isAffine
 
 theorem isAffine_of_iso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X := by
-  rw [← mem_Spec_ess_image] at h⊢; exact functor.ess_image.of_iso (as_iso f).symm h
+  rw [← mem_Spec_ess_image] at h ⊢; exact functor.ess_image.of_iso (as_iso f).symm h
 #align algebraic_geometry.is_affine_of_iso AlgebraicGeometry.isAffine_of_iso
 
 namespace AffineScheme
 
 /-- The `Spec` functor into the category of affine schemes. -/
 def spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
-  Scheme.spec.toEssImage deriving Full, Faithful, EssSurj
+  Scheme.spec.toEssImage
+deriving Full, Faithful, EssSurj
 #align algebraic_geometry.AffineScheme.Spec AlgebraicGeometry.AffineScheme.spec
 
 /-- The forgetful functor `AffineScheme ⥤ Scheme`. -/
 @[simps]
 def forgetToScheme : AffineScheme ⥤ Scheme :=
-  Scheme.spec.essImageInclusion deriving Full, Faithful
+  Scheme.spec.essImageInclusion
+deriving Full, Faithful
 #align algebraic_geometry.AffineScheme.forget_to_Scheme AlgebraicGeometry.AffineScheme.forgetToScheme
 
 /-- The global section functor of an affine scheme. -/
@@ -290,11 +293,11 @@ theorem IsAffineOpen.specΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X.c
   by
   haveI : is_affine _ := hU
   have e₁ := Spec_Γ_identity.hom.naturality (X.presheaf.map (eq_to_hom U.open_embedding_obj_top).op)
-  rw [← is_iso.comp_inv_eq] at e₁
+  rw [← is_iso.comp_inv_eq] at e₁ 
   have e₂ := Γ_Spec.adjunction_unit_app_app_top (X.restrict U.open_embedding)
-  erw [← e₂] at e₁
+  erw [← e₂] at e₁ 
   simp only [functor.id_map, Quiver.Hom.unop_op, functor.comp_map, ← functor.map_inv, ← op_inv,
-    LocallyRingedSpace.Γ_map, category.assoc, functor.right_op_map, inv_eq_to_hom] at e₁
+    LocallyRingedSpace.Γ_map, category.assoc, functor.right_op_map, inv_eq_to_hom] at e₁ 
   delta is_affine_open.from_Spec Scheme.iso_Spec
   rw [Scheme.comp_val_c_app, Scheme.comp_val_c_app, ← e₁]
   simp_rw [category.assoc]
@@ -539,7 +542,7 @@ theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X.carrier} (hU
 
 theorem exists_basicOpen_le_affine_inter {X : Scheme} {U V : Opens X.carrier} (hU : IsAffineOpen U)
     (hV : IsAffineOpen V) (x : X.carrier) (hx : x ∈ U ⊓ V) :
-    ∃ (f : X.Presheaf.obj <| op U)(g : X.Presheaf.obj <| op V),
+    ∃ (f : X.Presheaf.obj <| op U) (g : X.Presheaf.obj <| op V),
       X.basicOpen f = X.basicOpen g ∧ x ∈ X.basicOpen f :=
   by
   obtain ⟨f, hf₁, hf₂⟩ := hU.exists_basic_open_le ⟨x, hx.2⟩ hx.1
@@ -681,10 +684,10 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X.carri
       hU.from_Spec.1.base ⁻¹' U.1
   · refine' ⟨fun h => by rw [h], _⟩
     intro h
-    apply_fun Set.image hU.from_Spec.1.base  at h
+    apply_fun Set.image hU.from_Spec.1.base  at h 
     rw [Set.image_preimage_eq_inter_range, Set.image_preimage_eq_inter_range, hU.from_Spec_range] at
-      h
-    simp only [Set.inter_self, opens.carrier_eq_coe, Set.inter_eq_right_iff_subset] at h
+      h 
+    simp only [Set.inter_self, opens.carrier_eq_coe, Set.inter_eq_right_iff_subset] at h 
     ext1
     refine' Set.Subset.antisymm _ h
     simp only [Set.iUnion_subset_iff, SetCoe.forall, opens.coe_supr]
@@ -735,7 +738,7 @@ theorem of_affine_open_cover {X : Scheme} (V : X.affineOpens) (S : Set X.affineO
       by
       intro x
       have : ↑x ∈ (Set.univ : Set X.carrier) := trivial
-      rw [← hS] at this
+      rw [← hS] at this 
       obtain ⟨W, hW⟩ := set.mem_Union.mp this
       obtain ⟨f, g, e, hf⟩ := exists_basic_open_le_affine_inter V.prop W.1.Prop x ⟨x.prop, hW⟩
       refine' ⟨f, hf, _⟩
Diff
@@ -95,10 +95,8 @@ instance spec_isAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.spec.obj R) :=
   AlgebraicGeometry.isAffine_affineScheme ⟨_, Scheme.spec.obj_mem_essImage R⟩
 #align algebraic_geometry.Spec_is_affine AlgebraicGeometry.spec_isAffine
 
-theorem isAffine_of_iso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X :=
-  by
-  rw [← mem_Spec_ess_image] at h⊢
-  exact functor.ess_image.of_iso (as_iso f).symm h
+theorem isAffine_of_iso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X := by
+  rw [← mem_Spec_ess_image] at h⊢; exact functor.ess_image.of_iso (as_iso f).symm h
 #align algebraic_geometry.is_affine_of_iso AlgebraicGeometry.isAffine_of_iso
 
 namespace AffineScheme
@@ -202,9 +200,7 @@ def IsAffineOpen.fromSpec {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen
     Scheme.spec.obj (op <| X.Presheaf.obj <| op U) ⟶ X :=
   by
   haveI : is_affine (X.restrict U.open_embedding) := hU
-  have : U.open_embedding.is_open_map.functor.obj ⊤ = U :=
-    by
-    ext1
+  have : U.open_embedding.is_open_map.functor.obj ⊤ = U := by ext1;
     exact set.image_univ.trans Subtype.range_coe
   exact
     Scheme.Spec.map (X.presheaf.map (eq_to_hom this.symm).op).op ≫
@@ -212,9 +208,7 @@ def IsAffineOpen.fromSpec {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen
 #align algebraic_geometry.is_affine_open.from_Spec AlgebraicGeometry.IsAffineOpen.fromSpec
 
 instance IsAffineOpen.isOpenImmersion_fromSpec {X : Scheme} {U : Opens X.carrier}
-    (hU : IsAffineOpen U) : IsOpenImmersion hU.fromSpec :=
-  by
-  delta is_affine_open.from_Spec
+    (hU : IsAffineOpen U) : IsOpenImmersion hU.fromSpec := by delta is_affine_open.from_Spec;
   infer_instance
 #align algebraic_geometry.is_affine_open.is_open_immersion_from_Spec AlgebraicGeometry.IsAffineOpen.isOpenImmersion_fromSpec
 
@@ -230,9 +224,7 @@ theorem IsAffineOpen.fromSpec_range {X : Scheme} {U : Opens X.carrier} (hU : IsA
 #align algebraic_geometry.is_affine_open.from_Spec_range AlgebraicGeometry.IsAffineOpen.fromSpec_range
 
 theorem IsAffineOpen.fromSpec_image_top {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
-    hU.isOpenImmersion_fromSpec.base_open.IsOpenMap.Functor.obj ⊤ = U :=
-  by
-  ext1
+    hU.isOpenImmersion_fromSpec.base_open.IsOpenMap.Functor.obj ⊤ = U := by ext1;
   exact set.image_univ.trans hU.from_Spec_range
 #align algebraic_geometry.is_affine_open.from_Spec_image_top AlgebraicGeometry.IsAffineOpen.fromSpec_image_top
 
@@ -281,13 +273,7 @@ theorem IsAffineOpen.fromSpec_base_preimage {X : Scheme} {U : Opens X.carrier}
 
 theorem Scheme.specMap_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier} (h : U = V) (W) :
     (Scheme.spec.map (X.Presheaf.map (eqToHom h).op).op).val.c.app W =
-      eqToHom
-        (by
-          cases h
-          induction W using Opposite.rec'
-          dsimp
-          simp
-          rfl) :=
+      eqToHom (by cases h; induction W using Opposite.rec'; dsimp; simp; rfl) :=
   by
   have : Scheme.Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 _ := by
     rw [X.presheaf.map_id, op_id, Scheme.Spec.map_id]
@@ -399,10 +385,8 @@ theorem Scheme.map_prime_spectrum_basicOpen_of_affine (X : Scheme) [IsAffine X]
   · rw [← is_iso.inv_eq_inv, is_iso.inv_inv, is_iso.iso.inv_inv, nat_iso.app_hom]
     erw [← Γ_Spec.adjunction_unit_app_app_top]
     rfl
-  · rw [eq_to_hom_map]
-    rfl
-  · dsimp
-    congr
+  · rw [eq_to_hom_map]; rfl
+  · dsimp; congr
   · refine' (Scheme.preimage_basic_open _ _).trans _
     rw [is_iso.inv_hom_id_apply, Scheme.basic_open_res_eq]
 #align algebraic_geometry.Scheme.map_prime_spectrum_basic_open_of_affine AlgebraicGeometry.Scheme.map_prime_spectrum_basicOpen_of_affine
@@ -433,8 +417,7 @@ theorem IsAffineOpen.exists_basicOpen_le {X : Scheme} {U : Opens X.carrier} (hU
   obtain ⟨_, ⟨_, ⟨r, rfl⟩, rfl⟩, h₁, h₂⟩ :=
     (is_basis_basic_open (X.restrict U.open_embedding)).exists_subset_of_mem_open _
       ((opens.map U.inclusion).obj V).IsOpen
-  swap
-  exact ⟨x, h⟩
+  swap; exact ⟨x, h⟩
   have :
     U.open_embedding.is_open_map.functor.obj ((X.restrict U.open_embedding).basicOpen r) =
       X.basic_open (X.presheaf.map (eq_to_hom U.open_embedding_obj_top.symm).op r) :=
@@ -522,10 +505,8 @@ instance {X : Scheme} [IsAffine X] (r : X.Presheaf.obj (op ⊤)) :
 
 theorem is_localization_of_eq_basicOpen {X : Scheme} {U V : Opens X.carrier} (i : V ⟶ U)
     (hU : IsAffineOpen U) (r : X.Presheaf.obj (op U)) (e : V = X.basicOpen r) :
-    @IsLocalization.Away _ r (X.Presheaf.obj (op V)) _ (X.Presheaf.map i.op).toAlgebra :=
-  by
-  subst e
-  convert is_localization_basic_open hU r using 3
+    @IsLocalization.Away _ r (X.Presheaf.obj (op V)) _ (X.Presheaf.map i.op).toAlgebra := by
+  subst e; convert is_localization_basic_open hU r using 3
 #align algebraic_geometry.is_localization_of_eq_basic_open AlgebraicGeometry.is_localization_of_eq_basicOpen
 
 instance ΓRestrictAlgebra {X : Scheme} {Y : TopCat} {f : Y ⟶ X.carrier} (hf : OpenEmbedding f) :
@@ -599,19 +580,13 @@ theorem IsAffineOpen.is_localization_stalk_aux {X : Scheme} (U : Opens X.carrier
                 U.OpenEmbedding.IsOpenMap.Functor.obj ((Opens.map U.inclusion).obj U)).op ≫
         toSpecΓ (X.Presheaf.obj <| op (U.OpenEmbedding.IsOpenMap.Functor.obj ⊤)) ≫
           (Scheme.spec.obj <| op <| X.Presheaf.obj <| _).Presheaf.map
-            (eqToHom
-                  (by
-                    rw [opens.inclusion_map_eq_top]
-                    rfl) :
-                unop _ ⟶ ⊤).op :=
+            (eqToHom (by rw [opens.inclusion_map_eq_top]; rfl) : unop _ ⟶ ⊤).op :=
   by
   have e :
     (opens.map (inv (Γ_Spec.adjunction.unit.app (X.restrict U.open_embedding))).1.base).obj
         ((opens.map U.inclusion).obj U) =
       ⊤ :=
-    by
-    rw [opens.inclusion_map_eq_top]
-    rfl
+    by rw [opens.inclusion_map_eq_top]; rfl
   rw [Scheme.inv_val_c_app, is_iso.comp_inv_eq, Scheme.app_eq _ e,
     Γ_Spec.adjunction_unit_app_app_top]
   simp only [category.assoc, eq_to_hom_op]
Diff
@@ -162,20 +162,20 @@ def Scheme.affineOpens (X : Scheme) : Set (Opens X.carrier) :=
   { U : Opens X.carrier | IsAffineOpen U }
 #align algebraic_geometry.Scheme.affine_opens AlgebraicGeometry.Scheme.affineOpens
 
-theorem range_isAffineOpen_of_open_immersion {X Y : Scheme} [IsAffine X] (f : X ⟶ Y)
+theorem rangeIsAffineOpenOfOpenImmersion {X Y : Scheme} [IsAffine X] (f : X ⟶ Y)
     [H : IsOpenImmersion f] : IsAffineOpen f.opensRange :=
   by
   refine' is_affine_of_iso (is_open_immersion.iso_of_range_eq f (Y.of_restrict _) _).inv
   exact subtype.range_coe.symm
   infer_instance
-#align algebraic_geometry.range_is_affine_open_of_open_immersion AlgebraicGeometry.range_isAffineOpen_of_open_immersion
+#align algebraic_geometry.range_is_affine_open_of_open_immersion AlgebraicGeometry.rangeIsAffineOpenOfOpenImmersion
 
-theorem top_isAffineOpen (X : Scheme) [IsAffine X] : IsAffineOpen (⊤ : Opens X.carrier) :=
+theorem topIsAffineOpen (X : Scheme) [IsAffine X] : IsAffineOpen (⊤ : Opens X.carrier) :=
   by
   convert range_is_affine_open_of_open_immersion (𝟙 X)
   ext1
   exact set.range_id.symm
-#align algebraic_geometry.top_is_affine_open AlgebraicGeometry.top_isAffineOpen
+#align algebraic_geometry.top_is_affine_open AlgebraicGeometry.topIsAffineOpen
 
 instance Scheme.affineCover_isAffine (X : Scheme) (i : X.affineCover.J) :
     IsAffine (X.affineCover.obj i) :=
@@ -245,20 +245,19 @@ theorem IsAffineOpen.isCompact {X : Scheme} {U : Opens X.carrier} (hU : IsAffine
   exact Set.image_univ
 #align algebraic_geometry.is_affine_open.is_compact AlgebraicGeometry.IsAffineOpen.isCompact
 
-theorem IsAffineOpen.image_isOpenImmersion {X Y : Scheme} {U : Opens X.carrier}
-    (hU : IsAffineOpen U) (f : X ⟶ Y) [H : IsOpenImmersion f] :
-    IsAffineOpen (f.opensFunctor.obj U) :=
+theorem IsAffineOpen.imageIsOpenImmersion {X Y : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
+    (f : X ⟶ Y) [H : IsOpenImmersion f] : IsAffineOpen (f.opensFunctor.obj U) :=
   by
   haveI : is_affine _ := hU
   convert range_is_affine_open_of_open_immersion (X.of_restrict U.open_embedding ≫ f)
   ext1
   exact Set.image_eq_range _ _
-#align algebraic_geometry.is_affine_open.image_is_open_immersion AlgebraicGeometry.IsAffineOpen.image_isOpenImmersion
+#align algebraic_geometry.is_affine_open.image_is_open_immersion AlgebraicGeometry.IsAffineOpen.imageIsOpenImmersion
 
 theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f]
     (U : Opens X.carrier) : IsAffineOpen (H.openFunctor.obj U) ↔ IsAffineOpen U :=
   by
-  refine' ⟨fun hU => @is_affine_of_iso _ _ hU, fun hU => hU.image_isOpenImmersion f⟩
+  refine' ⟨fun hU => @is_affine_of_iso _ _ hU, fun hU => hU.imageIsOpenImmersion f⟩
   refine' (is_open_immersion.iso_of_range_eq (X.of_restrict _ ≫ f) (Y.of_restrict _) _).Hom
   · rw [Scheme.comp_val_base, coe_comp, Set.range_comp]
     dsimp [opens.inclusion]
@@ -268,7 +267,7 @@ theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : Is
 #align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
 
 instance Scheme.quasi_compact_of_affine (X : Scheme) [IsAffine X] : CompactSpace X.carrier :=
-  ⟨(top_isAffineOpen X).IsCompact⟩
+  ⟨(topIsAffineOpen X).IsCompact⟩
 #align algebraic_geometry.Scheme.quasi_compact_of_affine AlgebraicGeometry.Scheme.quasi_compact_of_affine
 
 theorem IsAffineOpen.fromSpec_base_preimage {X : Scheme} {U : Opens X.carrier}
@@ -336,7 +335,7 @@ theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X.carrier} (hU : Is
   by rw [← hU.Spec_Γ_identity_hom_app_from_Spec, iso.inv_hom_id_app_assoc]
 #align algebraic_geometry.is_affine_open.from_Spec_app_eq AlgebraicGeometry.IsAffineOpen.fromSpec_app_eq
 
-theorem IsAffineOpen.basicOpen_is_affine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
+theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) : IsAffineOpen (X.basicOpen f) :=
   by
   convert range_is_affine_open_of_open_immersion
@@ -371,9 +370,9 @@ theorem IsAffineOpen.basicOpen_is_affine {X : Scheme} {U : Opens X.carrier} (hU
   congr 2
   rw [iso.eq_inv_comp]
   erw [hU.Spec_Γ_identity_hom_app_from_Spec]
-#align algebraic_geometry.is_affine_open.basic_open_is_affine AlgebraicGeometry.IsAffineOpen.basicOpen_is_affine
+#align algebraic_geometry.is_affine_open.basic_open_is_affine AlgebraicGeometry.IsAffineOpen.basicOpenIsAffine
 
-theorem IsAffineOpen.map_restrict_basicOpen {X : Scheme} (r : X.Presheaf.obj (op ⊤))
+theorem IsAffineOpen.mapRestrictBasicOpen {X : Scheme} (r : X.Presheaf.obj (op ⊤))
     {U : Opens X.carrier} (hU : IsAffineOpen U) :
     IsAffineOpen ((Opens.map (X.of_restrict (X.basicOpen r).OpenEmbedding).1.base).obj U) :=
   by
@@ -384,7 +383,7 @@ theorem IsAffineOpen.map_restrict_basicOpen {X : Scheme} (r : X.Presheaf.obj (op
   erw [opens.functor_obj_map_obj, opens.open_embedding_obj_top, inf_comm, ←
     Scheme.basic_open_res _ _ (hom_of_le le_top).op]
   exact hU.basic_open_is_affine _
-#align algebraic_geometry.is_affine_open.map_restrict_basic_open AlgebraicGeometry.IsAffineOpen.map_restrict_basicOpen
+#align algebraic_geometry.is_affine_open.map_restrict_basic_open AlgebraicGeometry.IsAffineOpen.mapRestrictBasicOpen
 
 theorem Scheme.map_prime_spectrum_basicOpen_of_affine (X : Scheme) [IsAffine X]
     (f : Scheme.Γ.obj (op X)) :
@@ -519,7 +518,7 @@ theorem is_localization_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAff
 
 instance {X : Scheme} [IsAffine X] (r : X.Presheaf.obj (op ⊤)) :
     IsLocalization.Away r (X.Presheaf.obj (op <| X.basicOpen r)) :=
-  is_localization_basicOpen (top_isAffineOpen X) r
+  is_localization_basicOpen (topIsAffineOpen X) r
 
 theorem is_localization_of_eq_basicOpen {X : Scheme} {U V : Opens X.carrier} (i : V ⟶ U)
     (hU : IsAffineOpen U) (r : X.Presheaf.obj (op U)) (e : V = X.basicOpen r) :
@@ -536,7 +535,7 @@ instance ΓRestrictAlgebra {X : Scheme} {Y : TopCat} {f : Y ⟶ X.carrier} (hf :
 
 instance Γ_restrict_is_localization (X : Scheme.{u}) [IsAffine X] (r : Scheme.Γ.obj (op X)) :
     IsLocalization.Away r (Scheme.Γ.obj (op <| X.restrict (X.basicOpen r).OpenEmbedding)) :=
-  is_localization_of_eq_basicOpen _ (top_isAffineOpen X) r (Opens.openEmbedding_obj_top _)
+  is_localization_of_eq_basicOpen _ (topIsAffineOpen X) r (Opens.openEmbedding_obj_top _)
 #align algebraic_geometry.Γ_restrict_is_localization AlgebraicGeometry.Γ_restrict_is_localization
 
 theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
@@ -673,7 +672,7 @@ theorem IsAffineOpen.is_localization_stalk {X : Scheme} {U : Opens X.carrier} (h
 @[simps]
 def Scheme.affineBasicOpen (X : Scheme) {U : X.affineOpens} (f : X.Presheaf.obj <| op U) :
     X.affineOpens :=
-  ⟨X.basicOpen f, U.Prop.basicOpen_is_affine f⟩
+  ⟨X.basicOpen f, U.Prop.basicOpenIsAffine f⟩
 #align algebraic_geometry.Scheme.affine_basic_open AlgebraicGeometry.Scheme.affineBasicOpen
 
 @[simp]
Diff
@@ -713,18 +713,18 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X.carri
     simp only [Set.inter_self, opens.carrier_eq_coe, Set.inter_eq_right_iff_subset] at h
     ext1
     refine' Set.Subset.antisymm _ h
-    simp only [Set.unionᵢ_subset_iff, SetCoe.forall, opens.coe_supr]
+    simp only [Set.iUnion_subset_iff, SetCoe.forall, opens.coe_supr]
     intro x hx
     exact X.basic_open_le x
-  · simp only [opens.supr_def, Subtype.coe_mk, Set.preimage_unionᵢ, Subtype.val_eq_coe]
+  · simp only [opens.supr_def, Subtype.coe_mk, Set.preimage_iUnion, Subtype.val_eq_coe]
     congr 3
     · ext1 x
       exact congr_arg opens.carrier (hU.from_Spec_map_basic_open _)
     · exact congr_arg opens.carrier hU.from_Spec_base_preimage
   · simp only [opens.carrier_eq_coe, PrimeSpectrum.basicOpen_eq_zeroLocus_compl]
-    rw [← Set.compl_interᵢ, Set.compl_univ_iff, ← PrimeSpectrum.zeroLocus_unionᵢ, ←
+    rw [← Set.compl_iInter, Set.compl_univ_iff, ← PrimeSpectrum.zeroLocus_iUnion, ←
       PrimeSpectrum.zeroLocus_empty_iff_eq_top, PrimeSpectrum.zeroLocus_span]
-    simp only [Set.unionᵢ_singleton_eq_range, Subtype.range_val_subtype, Set.setOf_mem_eq]
+    simp only [Set.iUnion_singleton_eq_range, Subtype.range_val_subtype, Set.setOf_mem_eq]
 #align algebraic_geometry.is_affine_open.basic_open_union_eq_self_iff AlgebraicGeometry.IsAffineOpen.basicOpen_union_eq_self_iff
 
 theorem IsAffineOpen.self_le_basicOpen_union_iff {X : Scheme} {U : Opens X.carrier}
@@ -733,7 +733,7 @@ theorem IsAffineOpen.self_le_basicOpen_union_iff {X : Scheme} {U : Opens X.carri
   by
   rw [← hU.basic_open_union_eq_self_iff, @comm _ Eq]
   refine' ⟨fun h => le_antisymm h _, le_of_eq⟩
-  simp only [supᵢ_le_iff, SetCoe.forall]
+  simp only [iSup_le_iff, SetCoe.forall]
   intro x hx
   exact X.basic_open_le x
 #align algebraic_geometry.is_affine_open.self_le_basic_open_union_iff AlgebraicGeometry.IsAffineOpen.self_le_basicOpen_union_iff
@@ -778,7 +778,7 @@ theorem of_affine_open_cover {X : Scheme} (V : X.affineOpens) (S : Set X.affineO
       exact hf₂ x
     rw [← V.prop.self_le_basic_open_union_iff]
     intro x hx
-    rw [supᵢ_range', opens.mem_supr]
+    rw [iSup_range', opens.mem_supr]
     exact ⟨_, hf₁ ⟨x, hx⟩⟩
 #align algebraic_geometry.of_affine_open_cover AlgebraicGeometry.of_affine_open_cover
 
Diff
@@ -504,7 +504,7 @@ theorem is_localization_basicOpen {X : Scheme} {U : Opens X.carrier} (hU : IsAff
         (as_iso <|
             basic_open_sections_to_affine hU f ≫
               (Scheme.Spec.obj _).Presheaf.map
-                (eq_to_hom (basic_open_eq_of_affine _).symm).op).commRingIsoToRingEquiv).mpr
+                (eq_to_hom (basic_open_eq_of_affine _).symm).op).commRingCatIsoToRingEquiv).mpr
   convert structure_sheaf.is_localization.to_basic_open _ f
   change _ ≫ basic_open_sections_to_affine hU f ≫ _ = _
   delta basic_open_sections_to_affine
@@ -635,7 +635,7 @@ theorem IsAffineOpen.is_localization_stalk {X : Scheme} {U : Opens X.carrier} (h
   subst this
   apply
     (IsLocalization.isLocalization_iff_of_ringEquiv _
-        (as_iso <| PresheafedSpace.stalk_map hU.from_Spec.1 y).commRingIsoToRingEquiv).mpr
+        (as_iso <| PresheafedSpace.stalk_map hU.from_Spec.1 y).commRingCatIsoToRingEquiv).mpr
   convert structure_sheaf.is_localization.to_stalk _ _ using 1
   delta structure_sheaf.stalk_algebra
   congr 1
Diff
@@ -544,7 +544,7 @@ theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X.carrier} (hU
     ∃ f' : X.Presheaf.obj (op U), X.basicOpen f' = X.basicOpen g :=
   by
   haveI := is_localization_basic_open hU f
-  obtain ⟨x, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.surj' (Submonoid.powers f) g
+  obtain ⟨x, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.surj'' (Submonoid.powers f) g
   use f * x
   rw [Algebra.smul_def, Scheme.basic_open_mul, Scheme.basic_open_mul]
   erw [Scheme.basic_open_res]
Diff
@@ -87,19 +87,19 @@ theorem mem_spec_essImage (X : Scheme) : X ∈ Scheme.spec.essImage ↔ IsAffine
   ⟨fun h => ⟨Functor.essImage.unit_isIso h⟩, fun h => @mem_essImage_of_unit_isIso _ _ _ X h.1⟩
 #align algebraic_geometry.mem_Spec_ess_image AlgebraicGeometry.mem_spec_essImage
 
-instance isAffineAffineScheme (X : AffineScheme.{u}) : IsAffine X.obj :=
+instance isAffine_affineScheme (X : AffineScheme.{u}) : IsAffine X.obj :=
   ⟨Functor.essImage.unit_isIso X.property⟩
-#align algebraic_geometry.is_affine_AffineScheme AlgebraicGeometry.isAffineAffineScheme
+#align algebraic_geometry.is_affine_AffineScheme AlgebraicGeometry.isAffine_affineScheme
 
-instance specIsAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.spec.obj R) :=
-  AlgebraicGeometry.isAffineAffineScheme ⟨_, Scheme.spec.obj_mem_essImage R⟩
-#align algebraic_geometry.Spec_is_affine AlgebraicGeometry.specIsAffine
+instance spec_isAffine (R : CommRingCatᵒᵖ) : IsAffine (Scheme.spec.obj R) :=
+  AlgebraicGeometry.isAffine_affineScheme ⟨_, Scheme.spec.obj_mem_essImage R⟩
+#align algebraic_geometry.Spec_is_affine AlgebraicGeometry.spec_isAffine
 
-theorem isAffineOfIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X :=
+theorem isAffine_of_iso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] [h : IsAffine Y] : IsAffine X :=
   by
   rw [← mem_Spec_ess_image] at h⊢
   exact functor.ess_image.of_iso (as_iso f).symm h
-#align algebraic_geometry.is_affine_of_iso AlgebraicGeometry.isAffineOfIso
+#align algebraic_geometry.is_affine_of_iso AlgebraicGeometry.isAffine_of_iso
 
 namespace AffineScheme
 
@@ -177,15 +177,15 @@ theorem top_isAffineOpen (X : Scheme) [IsAffine X] : IsAffineOpen (⊤ : Opens X
   exact set.range_id.symm
 #align algebraic_geometry.top_is_affine_open AlgebraicGeometry.top_isAffineOpen
 
-instance Scheme.affineCoverIsAffine (X : Scheme) (i : X.affineCover.J) :
+instance Scheme.affineCover_isAffine (X : Scheme) (i : X.affineCover.J) :
     IsAffine (X.affineCover.obj i) :=
-  AlgebraicGeometry.specIsAffine _
-#align algebraic_geometry.Scheme.affine_cover_is_affine AlgebraicGeometry.Scheme.affineCoverIsAffine
+  AlgebraicGeometry.spec_isAffine _
+#align algebraic_geometry.Scheme.affine_cover_is_affine AlgebraicGeometry.Scheme.affineCover_isAffine
 
-instance Scheme.affineBasisCoverIsAffine (X : Scheme) (i : X.affineBasisCover.J) :
+instance Scheme.affineBasisCover_isAffine (X : Scheme) (i : X.affineBasisCover.J) :
     IsAffine (X.affineBasisCover.obj i) :=
-  AlgebraicGeometry.specIsAffine _
-#align algebraic_geometry.Scheme.affine_basis_cover_is_affine AlgebraicGeometry.Scheme.affineBasisCoverIsAffine
+  AlgebraicGeometry.spec_isAffine _
+#align algebraic_geometry.Scheme.affine_basis_cover_is_affine AlgebraicGeometry.Scheme.affineBasisCover_isAffine
 
 theorem isBasis_affine_open (X : Scheme) : Opens.IsBasis X.affineOpens :=
   by
Diff
@@ -285,7 +285,7 @@ theorem Scheme.specMap_presheaf_map_eqToHom {X : Scheme} {U V : Opens X.carrier}
       eqToHom
         (by
           cases h
-          induction W using Opposite.rec
+          induction W using Opposite.rec'
           dsimp
           simp
           rfl) :=
Diff
@@ -239,8 +239,7 @@ theorem IsAffineOpen.fromSpec_image_top {X : Scheme} {U : Opens X.carrier} (hU :
 theorem IsAffineOpen.isCompact {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) :
     IsCompact (U : Set X.carrier) :=
   by
-  convert
-    @IsCompact.image _ _ _ _ Set.univ hU.from_Spec.1.base PrimeSpectrum.compactSpace.1
+  convert@IsCompact.image _ _ _ _ Set.univ hU.from_Spec.1.base PrimeSpectrum.compactSpace.1
       (by continuity)
   convert hU.from_Spec_range.symm
   exact Set.image_univ
@@ -340,8 +339,7 @@ theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X.carrier} (hU : Is
 theorem IsAffineOpen.basicOpen_is_affine {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U)
     (f : X.Presheaf.obj (op U)) : IsAffineOpen (X.basicOpen f) :=
   by
-  convert
-    range_is_affine_open_of_open_immersion
+  convert range_is_affine_open_of_open_immersion
       (Scheme.Spec.map
           (CommRingCat.ofHom (algebraMap (X.presheaf.obj (op U)) (Localization.Away f))).op ≫
         hU.from_Spec)
@@ -414,8 +412,7 @@ theorem isBasis_basicOpen (X : Scheme) [IsAffine X] :
     Opens.IsBasis (Set.range (X.basicOpen : X.Presheaf.obj (op ⊤) → Opens X.carrier)) :=
   by
   delta opens.is_basis
-  convert
-    prime_spectrum.is_basis_basic_opens.inducing
+  convert prime_spectrum.is_basis_basic_opens.inducing
       (TopCat.homeoOfIso (Scheme.forget_to_Top.map_iso X.iso_Spec)).Inducing using
     1
   ext
@@ -655,8 +652,9 @@ theorem IsAffineOpen.is_localization_stalk {X : Scheme} {U : Opens X.carrier} (h
   simp only [← category.assoc]
   trans _ ≫ (structure_sheaf (X.presheaf.obj <| op U)).Presheaf.germ ⟨_, _⟩
   · rfl
-  convert
-    (structure_sheaf (X.presheaf.obj <| op U)).Presheaf.germ_res (hom_of_le le_top) ⟨_, _⟩ using 2
+  convert(structure_sheaf (X.presheaf.obj <| op U)).Presheaf.germ_res (hom_of_le le_top)
+      ⟨_, _⟩ using
+    2
   rw [category.assoc]
   erw [nat_trans.naturality]
   rw [← LocallyRingedSpace.Γ_map_op, ← LocallyRingedSpace.Γ.map_comp_assoc, ← op_comp]
Diff
@@ -130,8 +130,8 @@ instance ΓIsEquiv : IsEquivalence Γ.{u} :=
 #align algebraic_geometry.AffineScheme.Γ_is_equiv AlgebraicGeometry.AffineScheme.ΓIsEquiv
 
 instance : HasColimits AffineScheme.{u} :=
-  haveI := Adjunction.hasLimitsOfEquivalence.{u} Γ.{u}
-  Adjunction.hasColimitsOfEquivalence.{u} (op_op_equivalence AffineScheme.{u}).inverse
+  haveI := Adjunction.has_limits_of_equivalence.{u} Γ.{u}
+  Adjunction.has_colimits_of_equivalence.{u} (op_op_equivalence AffineScheme.{u}).inverse
 
 instance : HasLimits AffineScheme.{u} :=
   by

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 2 (#12361)

A PR analogous to #12338: reformatting proofs following the multiple goals linter of #12339.

Diff
@@ -267,7 +267,7 @@ theorem fromSpec_range :
     Set.range hU.fromSpec.1.base = (U : Set X) := by
   delta IsAffineOpen.fromSpec; dsimp
   rw [← Category.assoc, coe_comp, Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ]
-  exact Subtype.range_coe
+  · exact Subtype.range_coe
   rw [← TopCat.epi_iff_surjective]
   infer_instance
 #align algebraic_geometry.is_affine_open.from_Spec_range AlgebraicGeometry.IsAffineOpen.fromSpec_range
@@ -555,26 +555,26 @@ def _root_.AlgebraicGeometry.Scheme.affineBasicOpen
 theorem basicOpen_union_eq_self_iff (s : Set (X.presheaf.obj <| op U)) :
     ⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U) = U ↔ Ideal.span s = ⊤ := by
   trans ⋃ i : s, (PrimeSpectrum.basicOpen i.1).1 = Set.univ
-  trans
-    hU.fromSpec.1.base ⁻¹' (⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U)).1 =
-      hU.fromSpec.1.base ⁻¹' U.1
-  · refine' ⟨fun h => by rw [h], _⟩
-    intro h
-    apply_fun Set.image hU.fromSpec.1.base at h
-    rw [Set.image_preimage_eq_inter_range, Set.image_preimage_eq_inter_range, hU.fromSpec_range]
-      at h
-    simp only [Set.inter_self, Opens.carrier_eq_coe, Set.inter_eq_right] at h
-    ext1
-    refine' Set.Subset.antisymm _ h
-    simp only [Set.iUnion_subset_iff, SetCoe.forall, Opens.coe_iSup]
-    intro x _
-    exact X.basicOpen_le x
-  · simp only [Opens.iSup_def, Subtype.coe_mk, Set.preimage_iUnion]
-    congr! 1
-    · refine congr_arg (Set.iUnion ·) ?_
-      ext1 x
-      exact congr_arg Opens.carrier (hU.fromSpec_map_basicOpen _)
-    · exact congr_arg Opens.carrier hU.fromSpec_base_preimage
+  · trans
+      hU.fromSpec.1.base ⁻¹' (⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U)).1 =
+        hU.fromSpec.1.base ⁻¹' U.1
+    · refine' ⟨fun h => by rw [h], _⟩
+      intro h
+      apply_fun Set.image hU.fromSpec.1.base at h
+      rw [Set.image_preimage_eq_inter_range, Set.image_preimage_eq_inter_range, hU.fromSpec_range]
+        at h
+      simp only [Set.inter_self, Opens.carrier_eq_coe, Set.inter_eq_right] at h
+      ext1
+      refine' Set.Subset.antisymm _ h
+      simp only [Set.iUnion_subset_iff, SetCoe.forall, Opens.coe_iSup]
+      intro x _
+      exact X.basicOpen_le x
+    · simp only [Opens.iSup_def, Subtype.coe_mk, Set.preimage_iUnion]
+      congr! 1
+      · refine congr_arg (Set.iUnion ·) ?_
+        ext1 x
+        exact congr_arg Opens.carrier (hU.fromSpec_map_basicOpen _)
+      · exact congr_arg Opens.carrier hU.fromSpec_base_preimage
   · simp only [Opens.carrier_eq_coe, PrimeSpectrum.basicOpen_eq_zeroLocus_compl]
     rw [← Set.compl_iInter, Set.compl_univ_iff, ← PrimeSpectrum.zeroLocus_iUnion, ←
       PrimeSpectrum.zeroLocus_empty_iff_eq_top, PrimeSpectrum.zeroLocus_span]
perf: speed up some algebraic geometry with explicit universes (#12494)
Diff
@@ -245,7 +245,7 @@ theorem isBasis_basicOpen (X : Scheme) [IsAffine X] :
 
 namespace IsAffineOpen
 
-variable {X Y : Scheme} {U : Opens X} (hU : IsAffineOpen U) (f : X.presheaf.obj (op U))
+variable {X Y : Scheme.{u}} {U : Opens X} (hU : IsAffineOpen U) (f : X.presheaf.obj (op U))
 
 local notation "𝖲𝗉𝖾𝖼 𝓞ₓ(U)" => Scheme.Spec.obj (op <| X.presheaf.obj <| op U)
 
doc: fix grammar (#12272)

Change "splitted" to "split".

Diff
@@ -534,7 +534,7 @@ theorem isLocalization_stalk'
   rw [IsAffineOpen.fromSpec_app_self, Category.assoc, TopCat.Presheaf.germ_res]
   rfl
 
--- Porting note: I have splitted this into two lemmas
+-- Porting note: I have split this into two lemmas
 theorem isLocalization_stalk (x : U) :
     IsLocalization.AtPrime (X.presheaf.stalk x) (hU.primeIdealOf x).asIdeal := by
   rcases x with ⟨x, hx⟩
chore: classify porting notes referring to missing linters (#12098)

Reference the newly created issues #12094 and #12096, as well as the pre-existing #5171. Change all references to #10927 to #5171. Some of these changes were not labelled as "porting note"; change this for good measure.

Diff
@@ -45,7 +45,7 @@ namespace AlgebraicGeometry
 open Spec (structureSheaf)
 
 /-- The category of affine schemes -/
--- Porting note: removed
+-- Porting note(#5171): linter not ported yet
 -- @[nolint has_nonempty_instance]
 def AffineScheme :=
   Scheme.Spec.EssImageSubcategory
chore(CategoryTheory): move Full, Faithful, EssSurj, IsEquivalence and ReflectsIsomorphisms to the Functor namespace (#11985)

These notions on functors are now Functor.Full, Functor.Faithful, Functor.EssSurj, Functor.IsEquivalence, Functor.ReflectsIsomorphisms. Deprecated aliases are introduced for the previous names.

Diff
@@ -107,13 +107,13 @@ def Spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
 #align algebraic_geometry.AffineScheme.Spec AlgebraicGeometry.AffineScheme.Spec
 
 -- Porting note (#11081): cannot automatically derive
-instance Spec_full : Full Spec := Full.toEssImage _
+instance Spec_full : Spec.Full := Functor.Full.toEssImage _
 
 -- Porting note (#11081): cannot automatically derive
-instance Spec_faithful : Faithful Spec := Faithful.toEssImage _
+instance Spec_faithful : Spec.Faithful := Functor.Faithful.toEssImage _
 
 -- Porting note (#11081): cannot automatically derive
-instance Spec_essSurj : EssSurj Spec := EssSurj.toEssImage (F := _)
+instance Spec_essSurj : Spec.EssSurj := Functor.EssSurj.toEssImage (F := _)
 
 /-- The forgetful functor `AffineScheme ⥤ Scheme`. -/
 @[simps!]
@@ -122,12 +122,12 @@ def forgetToScheme : AffineScheme ⥤ Scheme :=
 #align algebraic_geometry.AffineScheme.forget_to_Scheme AlgebraicGeometry.AffineScheme.forgetToScheme
 
 -- Porting note (#11081): cannot automatically derive
-instance forgetToScheme_full : Full forgetToScheme :=
-show Full (Scheme.Spec.essImageInclusion) from inferInstance
+instance forgetToScheme_full : forgetToScheme.Full :=
+show (Scheme.Spec.essImageInclusion).Full from inferInstance
 
 -- Porting note (#11081): cannot automatically derive
-instance forgetToScheme_faithful : Faithful forgetToScheme :=
-show Faithful (Scheme.Spec.essImageInclusion) from inferInstance
+instance forgetToScheme_faithful : forgetToScheme.Faithful :=
+show (Scheme.Spec.essImageInclusion).Faithful from inferInstance
 
 /-- The global section functor of an affine scheme. -/
 def Γ : AffineSchemeᵒᵖ ⥤ CommRingCat :=
@@ -139,8 +139,9 @@ def equivCommRingCat : AffineScheme ≌ CommRingCatᵒᵖ :=
   equivEssImageOfReflective.symm
 #align algebraic_geometry.AffineScheme.equiv_CommRing AlgebraicGeometry.AffineScheme.equivCommRingCat
 
-instance ΓIsEquiv : IsEquivalence Γ.{u} :=
-  haveI : IsEquivalence Γ.{u}.rightOp.op := IsEquivalence.ofEquivalence equivCommRingCat.op
+instance ΓIsEquiv : Γ.{u}.IsEquivalence :=
+  haveI : Γ.{u}.rightOp.op.IsEquivalence :=
+    Functor.IsEquivalence.ofEquivalence equivCommRingCat.op
   Functor.isEquivalenceTrans Γ.{u}.rightOp.op (opOpEquivalence _).functor
 #align algebraic_geometry.AffineScheme.Γ_is_equiv AlgebraicGeometry.AffineScheme.ΓIsEquiv
 
@@ -155,7 +156,7 @@ instance hasLimits : HasLimits AffineScheme.{u} := by
 
 noncomputable instance Γ_preservesLimits : PreservesLimits Γ.{u}.rightOp :=
   @Adjunction.isEquivalencePreservesLimits _ _ _ _ Γ.rightOp
-    (IsEquivalence.ofEquivalence equivCommRingCat)
+    (Functor.IsEquivalence.ofEquivalence equivCommRingCat)
 
 noncomputable instance forgetToScheme_preservesLimits : PreservesLimits forgetToScheme := by
   apply (config := { allowSynthFailures := true })
chore: tidy various files (#11624)
Diff
@@ -569,9 +569,7 @@ theorem basicOpen_union_eq_self_iff (s : Set (X.presheaf.obj <| op U)) :
     intro x _
     exact X.basicOpen_le x
   · simp only [Opens.iSup_def, Subtype.coe_mk, Set.preimage_iUnion]
-    -- Porting note: need an extra rewrite here, after simp, it is in `↔` form
-    rw [iff_iff_eq]
-    congr 3
+    congr! 1
     · refine congr_arg (Set.iUnion ·) ?_
       ext1 x
       exact congr_arg Opens.carrier (hU.fromSpec_map_basicOpen _)
@@ -614,9 +612,7 @@ theorem of_affine_open_cover {X : Scheme} (V : X.affineOpens) (S : Set X.affineO
   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 ⟨W, hW⟩ := Set.mem_iUnion.mp (by simpa only [← hS] using Set.mem_univ (x : X))
     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
chore: remove unused tactics (#11351)

I removed some of the tactics that were not used and are hopefully uncontroversial arising from the linter at #11308.

As the commit messages should convey, the removed tactics are, essentially,

push_cast
norm_cast
congr
norm_num
dsimp
funext
intro
infer_instance
Diff
@@ -220,7 +220,7 @@ theorem Scheme.map_PrimeSpectrum_basicOpen_of_affine
     change SpecΓIdentity.hom.app (X.presheaf.obj <| op ⊤) = _
     rw [← ΓSpec.adjunction_unit_app_app_top X]
     rfl
-  · dsimp; congr
+  · dsimp
     refine' (Scheme.preimage_basicOpen _ _).trans _
     congr 1
     exact IsIso.inv_hom_id_apply _ _
chore: classify cannot automatically derive porting notes (#11082)

Classifies by adding issue number #11081 to porting notes claiming:

cannot automatically derive

Diff
@@ -106,13 +106,13 @@ def Spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
   Scheme.Spec.toEssImage
 #align algebraic_geometry.AffineScheme.Spec AlgebraicGeometry.AffineScheme.Spec
 
--- Porting note: cannot automatically derive
+-- Porting note (#11081): cannot automatically derive
 instance Spec_full : Full Spec := Full.toEssImage _
 
--- Porting note: cannot automatically derive
+-- Porting note (#11081): cannot automatically derive
 instance Spec_faithful : Faithful Spec := Faithful.toEssImage _
 
--- Porting note: cannot automatically derive
+-- Porting note (#11081): cannot automatically derive
 instance Spec_essSurj : EssSurj Spec := EssSurj.toEssImage (F := _)
 
 /-- The forgetful functor `AffineScheme ⥤ Scheme`. -/
@@ -121,11 +121,11 @@ def forgetToScheme : AffineScheme ⥤ Scheme :=
   Scheme.Spec.essImageInclusion
 #align algebraic_geometry.AffineScheme.forget_to_Scheme AlgebraicGeometry.AffineScheme.forgetToScheme
 
--- Porting note: cannot automatically derive
+-- Porting note (#11081): cannot automatically derive
 instance forgetToScheme_full : Full forgetToScheme :=
 show Full (Scheme.Spec.essImageInclusion) from inferInstance
 
--- Porting note: cannot automatically derive
+-- Porting note (#11081): cannot automatically derive
 instance forgetToScheme_faithful : Faithful forgetToScheme :=
 show Faithful (Scheme.Spec.essImageInclusion) from inferInstance
 
style: reduce spacing variation in "porting note" comments (#10886)

In this pull request, I have systematically eliminated the leading whitespace preceding the colon (:) within all unlabelled or unclassified porting notes. This adjustment facilitates a more efficient review process for the remaining notes by ensuring no entries are overlooked due to formatting inconsistencies.

Diff
@@ -45,7 +45,7 @@ namespace AlgebraicGeometry
 open Spec (structureSheaf)
 
 /-- The category of affine schemes -/
--- Porting note : removed
+-- Porting note: removed
 -- @[nolint has_nonempty_instance]
 def AffineScheme :=
   Scheme.Spec.EssImageSubcategory
@@ -106,13 +106,13 @@ def Spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
   Scheme.Spec.toEssImage
 #align algebraic_geometry.AffineScheme.Spec AlgebraicGeometry.AffineScheme.Spec
 
--- Porting note : cannot automatically derive
+-- Porting note: cannot automatically derive
 instance Spec_full : Full Spec := Full.toEssImage _
 
--- Porting note : cannot automatically derive
+-- Porting note: cannot automatically derive
 instance Spec_faithful : Faithful Spec := Faithful.toEssImage _
 
--- Porting note : cannot automatically derive
+-- Porting note: cannot automatically derive
 instance Spec_essSurj : EssSurj Spec := EssSurj.toEssImage (F := _)
 
 /-- The forgetful functor `AffineScheme ⥤ Scheme`. -/
@@ -121,11 +121,11 @@ def forgetToScheme : AffineScheme ⥤ Scheme :=
   Scheme.Spec.essImageInclusion
 #align algebraic_geometry.AffineScheme.forget_to_Scheme AlgebraicGeometry.AffineScheme.forgetToScheme
 
--- Porting note : cannot automatically derive
+-- Porting note: cannot automatically derive
 instance forgetToScheme_full : Full forgetToScheme :=
 show Full (Scheme.Spec.essImageInclusion) from inferInstance
 
--- Porting note : cannot automatically derive
+-- Porting note: cannot automatically derive
 instance forgetToScheme_faithful : Faithful forgetToScheme :=
 show Faithful (Scheme.Spec.essImageInclusion) from inferInstance
 
@@ -216,7 +216,7 @@ theorem Scheme.map_PrimeSpectrum_basicOpen_of_affine
         ((inv (X.isoSpec.hom.1.c.app (op ((Opens.map (inv X.isoSpec.hom).val.base).obj ⊤)))) f)
   · congr
     rw [← IsIso.inv_eq_inv, IsIso.inv_inv, IsIso.Iso.inv_inv, NatIso.app_hom]
-    -- Porting note : added this `change` to prevent timeout
+    -- Porting note: added this `change` to prevent timeout
     change SpecΓIdentity.hom.app (X.presheaf.obj <| op ⊤) = _
     rw [← ΓSpec.adjunction_unit_app_app_top X]
     rfl
@@ -279,7 +279,7 @@ theorem fromSpec_image_top :
 protected theorem isCompact :
     IsCompact (U : Set X) := by
   convert @IsCompact.image _ _ _ _ Set.univ hU.fromSpec.1.base PrimeSpectrum.compactSpace.1
-    ((fromSpec hU).val.base.2) -- Porting note : `continuity` can't do this
+    ((fromSpec hU).val.base.2) -- Porting note: `continuity` can't do this
   convert hU.fromSpec_range.symm
   exact Set.image_univ
 #align algebraic_geometry.is_affine_open.is_compact AlgebraicGeometry.IsAffineOpen.isCompact
@@ -361,7 +361,7 @@ theorem opensFunctor_map_basicOpen :
   rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, hU.fromSpec_range]
   exact Scheme.basicOpen_le _ _
 
--- Porting note : linter complains that LHS is not in simp-normal-form. However, the error provided
+-- Porting note: linter complains that LHS is not in simp-normal-form. However, the error provided
 -- by linter seems to tell me that left hand side should be changed in to something exactly the same
 -- as before. I am not sure if this is caused by LHS being written with all explicit argument,
 -- I am not sure if this is intentional or not.
@@ -433,7 +433,7 @@ theorem isLocalization_basicOpen :
     (IsLocalization.isLocalization_iff_of_ringEquiv (Submonoid.powers f)
       (asIso <| basicOpenSectionsToAffine hU f).commRingCatIsoToRingEquiv).mpr
   convert StructureSheaf.IsLocalization.to_basicOpen _ f using 1
-  -- Porting note : more hand holding is required here, the next 4 lines were not necessary
+  -- Porting note: more hand holding is required here, the next 4 lines were not necessary
   delta StructureSheaf.openAlgebra
   congr 1
   rw [CommRingCat.ringHom_comp_eq_comp, Iso.commRingIsoToRingEquiv_toRingHom, asIso_hom]
@@ -470,7 +470,7 @@ theorem basicOpen_basicOpen_is_basicOpen (g : X.presheaf.obj (op <| X.basicOpen
   rw [Algebra.smul_def, Scheme.basicOpen_mul, Scheme.basicOpen_mul, RingHom.algebraMap_toAlgebra]
   rw [Scheme.basicOpen_res]
   refine' (inf_eq_left.mpr _).symm
-  -- Porting note : a little help is needed here
+  -- Porting note: a little help is needed here
   convert inf_le_left (α := Opens X) using 1
   apply Scheme.basicOpen_of_isUnit
   apply
@@ -501,7 +501,7 @@ noncomputable def primeIdealOf (x : U) :
 theorem fromSpec_primeIdealOf (x : U) :
     hU.fromSpec.val.base (hU.primeIdealOf x) = x.1 := by
   dsimp only [IsAffineOpen.fromSpec, Subtype.coe_mk, IsAffineOpen.primeIdealOf]
-  -- Porting note : in the porting note of `Scheme.comp_val_base`, it says that `elementwise` is
+  -- 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
   rw [← elementwise_of% Scheme.comp_val_base]
@@ -522,7 +522,7 @@ theorem isLocalization_stalk'
       (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
-  -- Porting note : need to know what the ring is and after convert, instead of equality
+  -- Porting note: need to know what the ring is and after convert, instead of equality
   -- we get an `iff`.
   convert StructureSheaf.IsLocalization.to_stalk (X.presheaf.obj <| op U) y using 1
   delta IsLocalization.AtPrime StructureSheaf.stalkAlgebra
@@ -533,7 +533,7 @@ theorem isLocalization_stalk'
   rw [IsAffineOpen.fromSpec_app_self, Category.assoc, TopCat.Presheaf.germ_res]
   rfl
 
--- Porting note : I have splitted this into two lemmas
+-- Porting note: I have splitted this into two lemmas
 theorem isLocalization_stalk (x : U) :
     IsLocalization.AtPrime (X.presheaf.stalk x) (hU.primeIdealOf x).asIdeal := by
   rcases x with ⟨x, hx⟩
@@ -569,7 +569,7 @@ theorem basicOpen_union_eq_self_iff (s : Set (X.presheaf.obj <| op U)) :
     intro x _
     exact X.basicOpen_le x
   · simp only [Opens.iSup_def, Subtype.coe_mk, Set.preimage_iUnion]
-    -- Porting note : need an extra rewrite here, after simp, it is in `↔` form
+    -- Porting note: need an extra rewrite here, after simp, it is in `↔` form
     rw [iff_iff_eq]
     congr 3
     · refine congr_arg (Set.iUnion ·) ?_
perf(AlgebraicGeometry): Fix slow and bad proofs (#7747)

Fixed AlgebraicGeometry/AffineSchemes.lean, AlgebraicGeometry/Morphisms/QuasiSeparated.lean and AlgebraicGeometry/Morphisms/RingHomProperties.lean.

Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Andrew Yang <36414270+erdOne@users.noreply.github.com> Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -45,7 +45,7 @@ namespace AlgebraicGeometry
 open Spec (structureSheaf)
 
 /-- The category of affine schemes -/
--- Poring note : removed
+-- Porting note : removed
 -- @[nolint has_nonempty_instance]
 def AffineScheme :=
   Scheme.Spec.EssImageSubcategory
@@ -168,7 +168,7 @@ end AffineScheme
 
 /-- An open subset of a scheme is affine if the open subscheme is affine. -/
 def IsAffineOpen {X : Scheme} (U : Opens X) : Prop :=
-  IsAffine (X.restrict U.openEmbedding)
+  IsAffine (X ∣_ᵤ U)
 #align algebraic_geometry.is_affine_open AlgebraicGeometry.IsAffineOpen
 
 /-- The set of affine opens as a subset of `opens X`. -/
@@ -207,40 +207,76 @@ theorem isBasis_affine_open (X : Scheme) : Opens.IsBasis X.affineOpens := by
   exact rangeIsAffineOpenOfOpenImmersion _
 #align algebraic_geometry.is_basis_affine_open AlgebraicGeometry.isBasis_affine_open
 
+theorem Scheme.map_PrimeSpectrum_basicOpen_of_affine
+    (X : Scheme) [IsAffine X] (f : Scheme.Γ.obj (op X)) :
+    X.isoSpec.hom ⁻¹ᵁ PrimeSpectrum.basicOpen f = X.basicOpen f := by
+  rw [← basicOpen_eq_of_affine]
+  trans
+    X.isoSpec.hom ⁻¹ᵁ (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 ⊤)))) f)
+  · congr
+    rw [← IsIso.inv_eq_inv, IsIso.inv_inv, IsIso.Iso.inv_inv, NatIso.app_hom]
+    -- Porting note : added this `change` to prevent timeout
+    change SpecΓIdentity.hom.app (X.presheaf.obj <| op ⊤) = _
+    rw [← ΓSpec.adjunction_unit_app_app_top X]
+    rfl
+  · dsimp; congr
+    refine' (Scheme.preimage_basicOpen _ _).trans _
+    congr 1
+    exact IsIso.inv_hom_id_apply _ _
+#align algebraic_geometry.Scheme.map_prime_spectrum_basic_open_of_affine AlgebraicGeometry.Scheme.map_PrimeSpectrum_basicOpen_of_affine
+
+theorem isBasis_basicOpen (X : Scheme) [IsAffine X] :
+    Opens.IsBasis (Set.range (X.basicOpen : X.presheaf.obj (op ⊤) → Opens X)) := by
+  delta Opens.IsBasis
+  convert PrimeSpectrum.isBasis_basic_opens.inducing
+    (TopCat.homeoOfIso (Scheme.forgetToTop.mapIso X.isoSpec)).inducing using 1
+  ext
+  simp only [Set.mem_image, exists_exists_eq_and]
+  constructor
+  · rintro ⟨_, ⟨x, rfl⟩, rfl⟩
+    refine' ⟨_, ⟨_, ⟨x, rfl⟩, rfl⟩, _⟩
+    exact congr_arg Opens.carrier (X.map_PrimeSpectrum_basicOpen_of_affine x)
+  · rintro ⟨_, ⟨_, ⟨x, rfl⟩, rfl⟩, rfl⟩
+    refine' ⟨_, ⟨x, rfl⟩, _⟩
+    exact congr_arg Opens.carrier (X.map_PrimeSpectrum_basicOpen_of_affine x).symm
+#align algebraic_geometry.is_basis_basic_open AlgebraicGeometry.isBasis_basicOpen
+
+namespace IsAffineOpen
+
+variable {X Y : Scheme} {U : Opens X} (hU : IsAffineOpen U) (f : X.presheaf.obj (op U))
+
+local notation "𝖲𝗉𝖾𝖼 𝓞ₓ(U)" => Scheme.Spec.obj (op <| X.presheaf.obj <| op U)
+
 /-- The open immersion `Spec 𝒪ₓ(U) ⟶ X` for an affine `U`. -/
-def IsAffineOpen.fromSpec {X : Scheme} {U : Opens X} (hU : IsAffineOpen U) :
-    Scheme.Spec.obj (op <| X.presheaf.obj <| op U) ⟶ X := by
-  haveI : IsAffine (X.restrict U.openEmbedding) := hU
-  have : U.openEmbedding.isOpenMap.functor.obj ⊤ = U := by
-    ext1; exact Set.image_univ.trans Subtype.range_coe
-  exact
-    Scheme.Spec.map (X.presheaf.map (eqToHom this.symm).op).op ≫
-      (X.restrict U.openEmbedding).isoSpec.inv ≫ X.ofRestrict _
+def fromSpec :
+    𝖲𝗉𝖾𝖼 𝓞ₓ(U) ⟶ X :=
+  haveI : IsAffine (X ∣_ᵤ U) := hU
+  Scheme.Spec.map (X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op).op ≫
+    (X ∣_ᵤ U).isoSpec.inv ≫ Scheme.ιOpens U
 #align algebraic_geometry.is_affine_open.from_Spec AlgebraicGeometry.IsAffineOpen.fromSpec
 
-instance IsAffineOpen.isOpenImmersion_fromSpec {X : Scheme} {U : Opens X}
-    (hU : IsAffineOpen U) : IsOpenImmersion hU.fromSpec := by
-  delta IsAffineOpen.fromSpec; dsimp
-  -- Porting note : this was automatic
-  repeat apply (config := { allowSynthFailures := true }) PresheafedSpace.IsOpenImmersion.comp
+instance isOpenImmersion_fromSpec :
+    IsOpenImmersion hU.fromSpec := by
+  delta fromSpec
+  infer_instance
 #align algebraic_geometry.is_affine_open.is_open_immersion_from_Spec AlgebraicGeometry.IsAffineOpen.isOpenImmersion_fromSpec
 
-theorem IsAffineOpen.fromSpec_range {X : Scheme} {U : Opens X} (hU : IsAffineOpen U) :
+theorem fromSpec_range :
     Set.range hU.fromSpec.1.base = (U : Set X) := by
   delta IsAffineOpen.fromSpec; dsimp
-  erw [← Category.assoc]
-  rw [coe_comp, Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ]
+  rw [← Category.assoc, coe_comp, Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ]
   exact Subtype.range_coe
   rw [← TopCat.epi_iff_surjective]
   infer_instance
 #align algebraic_geometry.is_affine_open.from_Spec_range AlgebraicGeometry.IsAffineOpen.fromSpec_range
 
-theorem IsAffineOpen.fromSpec_image_top {X : Scheme} {U : Opens X} (hU : IsAffineOpen U) :
-    hU.isOpenImmersion_fromSpec.base_open.isOpenMap.functor.obj ⊤ = U := by
+theorem fromSpec_image_top :
+    hU.fromSpec.opensFunctor.obj ⊤ = U := by
   ext1; exact Set.image_univ.trans hU.fromSpec_range
 #align algebraic_geometry.is_affine_open.from_Spec_image_top AlgebraicGeometry.IsAffineOpen.fromSpec_image_top
 
-theorem IsAffineOpen.isCompact {X : Scheme} {U : Opens X} (hU : IsAffineOpen U) :
+protected theorem isCompact :
     IsCompact (U : Set X) := by
   convert @IsCompact.image _ _ _ _ Set.univ hU.fromSpec.1.base PrimeSpectrum.compactSpace.1
     ((fromSpec hU).val.base.2) -- Porting note : `continuity` can't do this
@@ -248,316 +284,191 @@ theorem IsAffineOpen.isCompact {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
   exact Set.image_univ
 #align algebraic_geometry.is_affine_open.is_compact AlgebraicGeometry.IsAffineOpen.isCompact
 
-theorem IsAffineOpen.imageIsOpenImmersion {X Y : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (f : X ⟶ Y) [H : IsOpenImmersion f] : IsAffineOpen (f.opensFunctor.obj U) := by
-  haveI : IsAffine _ := hU
-  have : IsOpenImmersion (X.ofRestrict U.openEmbedding ≫ f) := PresheafedSpace.IsOpenImmersion.comp
-    (hf := IsOpenImmersion.ofRestrict _ _) (hg := H)
+theorem imageIsOpenImmersion (f : X ⟶ Y) [H : IsOpenImmersion f] :
+    IsAffineOpen (f.opensFunctor.obj U) := by
+  have : IsAffine _ := hU
   convert rangeIsAffineOpenOfOpenImmersion (X.ofRestrict U.openEmbedding ≫ f)
   ext1
   exact Set.image_eq_range _ _
 #align algebraic_geometry.is_affine_open.image_is_open_immersion AlgebraicGeometry.IsAffineOpen.imageIsOpenImmersion
 
-theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f]
-    (U : Opens X) : IsAffineOpen (H.openFunctor.obj U) ↔ IsAffineOpen U := by
-  -- Porting note : add this instance explicitly
-  have : IsOpenImmersion (X.ofRestrict U.openEmbedding ≫ f) :=
-    PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := H)
+theorem _root_.AlgebraicGeometry.Scheme.Hom.isAffineOpen_iff_of_isOpenImmersion
+    (f : AlgebraicGeometry.Scheme.Hom X Y) [H : IsOpenImmersion f] {U : Opens X} :
+    IsAffineOpen (f.opensFunctor.obj U) ↔ IsAffineOpen U := by
   refine' ⟨fun hU => @isAffineOfIso _ _
     (IsOpenImmersion.isoOfRangeEq (X.ofRestrict U.openEmbedding ≫ f) (Y.ofRestrict _) _).hom ?_ hU,
     fun hU => hU.imageIsOpenImmersion f⟩
   · rw [Scheme.comp_val_base, coe_comp, Set.range_comp]
-    dsimp [Opens.inclusion]
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    rw [Subtype.range_coe]; erw [Subtype.range_coe]
+    dsimp [Opens.coe_inclusion, Scheme.restrict]
+    rw [Subtype.range_coe, Subtype.range_coe]
     rfl
   · infer_instance
-#align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
+#align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.Scheme.Hom.isAffineOpen_iff_of_isOpenImmersion
 
-instance Scheme.quasi_compact_of_affine (X : Scheme) [IsAffine X] : CompactSpace X :=
+instance _root_.AlgebraicGeometry.Scheme.quasi_compact_of_affine (X : Scheme) [IsAffine X] :
+    CompactSpace X :=
   ⟨(topIsAffineOpen X).isCompact⟩
 #align algebraic_geometry.Scheme.quasi_compact_of_affine AlgebraicGeometry.Scheme.quasi_compact_of_affine
 
-theorem IsAffineOpen.fromSpec_base_preimage {X : Scheme} {U : Opens X}
-    (hU : IsAffineOpen U) : (Opens.map hU.fromSpec.val.base).obj U = ⊤ := by
+theorem fromSpec_base_preimage :
+    hU.fromSpec ⁻¹ᵁ U = ⊤ := by
   ext1
-  change hU.fromSpec.1.base ⁻¹' (U : Set X) = Set.univ
-  rw [← hU.fromSpec_range, ← Set.image_univ]
+  rw [Opens.map_coe, Opens.coe_top, ← hU.fromSpec_range, ← Set.image_univ]
   exact Set.preimage_image_eq _ PresheafedSpace.IsOpenImmersion.base_open.inj
 #align algebraic_geometry.is_affine_open.from_Spec_base_preimage AlgebraicGeometry.IsAffineOpen.fromSpec_base_preimage
 
-theorem Scheme.Spec_map_presheaf_map_eqToHom {X : Scheme} {U V : Opens X} (h : U = V) (W) :
-    (Scheme.Spec.map (X.presheaf.map (eqToHom h).op).op).val.c.app W =
-      eqToHom (by cases h; induction W using Opposite.rec'; dsimp; simp) := by
-  have : Scheme.Spec.map (X.presheaf.map (𝟙 (op U))).op = 𝟙 _ := by
-    rw [X.presheaf.map_id, op_id, Scheme.Spec.map_id]
-  cases h
-  refine' (Scheme.congr_app this _).trans _
-  erw [Category.id_comp]
-  simp [eqToHom_map]
-#align algebraic_geometry.Scheme.Spec_map_presheaf_map_eqToHom AlgebraicGeometry.Scheme.Spec_map_presheaf_map_eqToHom
-
--- Porting note : this compiles very slowly now
-set_option maxHeartbeats 600000 in
-theorem IsAffineOpen.SpecΓIdentity_hom_app_fromSpec {X : Scheme} {U : Opens X}
-    (hU : IsAffineOpen U) :
+-- Doesn't build without the `IsAffine` instance but the linter complains
+@[nolint unusedHavesSuffices]
+theorem SpecΓIdentity_hom_app_fromSpec :
     SpecΓIdentity.hom.app (X.presheaf.obj <| op U) ≫ hU.fromSpec.1.c.app (op U) =
-      (Scheme.Spec.obj _).presheaf.map (eqToHom hU.fromSpec_base_preimage).op := by
-  haveI : IsAffine _ := hU
-  have e₁ := SpecΓIdentity.hom.naturality (X.presheaf.map (eqToHom U.openEmbedding_obj_top).op)
-  rw [← IsIso.comp_inv_eq] at e₁
-  have e₂ := ΓSpec.adjunction_unit_app_app_top (X.restrict U.openEmbedding)
-  erw [← e₂] at e₁
-  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₁
+      (𝖲𝗉𝖾𝖼 𝓞ₓ(U)).presheaf.map (eqToHom hU.fromSpec_base_preimage).op := by
+  have : IsAffine _ := hU
   delta IsAffineOpen.fromSpec Scheme.isoSpec
-  rw [Scheme.comp_val_c_app, Scheme.comp_val_c_app, ← e₁]
-  simp_rw [Category.assoc]
-  erw [← X.presheaf.map_comp_assoc]
-  rw [← op_comp]
-  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
-  have e₄ := (asIso (ΓSpec.adjunction.unit.app
-    (X.restrict U.openEmbedding))).inv.1.c.naturality_assoc
-  dsimp at e₄
-  replace e₄ := @e₄ (op ⊤) (op <| (Opens.map U.inclusion).obj U)
-    (eqToHom U.inclusion_map_eq_top).op
-  erw [e₃, e₄, ← Scheme.comp_val_c_app_assoc, IsIso.inv_hom_id]
-  simp only [eqToHom_map, eqToHom_op, Scheme.Spec_map_presheaf_map_eqToHom, eqToHom_unop, unop_op]
-  erw [Scheme.Spec_map_presheaf_map_eqToHom, Category.id_comp]
-  simp only [eqToHom_trans]
+  rw [Scheme.comp_val_c_app, Scheme.comp_val_c_app, SpecΓIdentity_hom_app_presheaf_obj,
+    Scheme.ofRestrict_val_c_app_self]
+  simp only [Category.assoc]
+  dsimp only [asIso_inv, Functor.op_obj, unop_op]
+  rw [← Functor.map_comp_assoc, ← op_comp, eqToHom_trans, Scheme.eq_restrict_presheaf_map_eqToHom,
+    NatTrans.naturality_assoc, Scheme.inv_val_c_app_top, IsIso.hom_inv_id_assoc]
+  simp only [eqToHom_map, eqToHom_op, Scheme.Spec_map_presheaf_map_eqToHom, eqToHom_trans]
 #align algebraic_geometry.is_affine_open.Spec_Γ_identity_hom_app_from_Spec AlgebraicGeometry.IsAffineOpen.SpecΓIdentity_hom_app_fromSpec
 
 @[elementwise]
-theorem IsAffineOpen.fromSpec_app_eq {X : Scheme} {U : Opens X} (hU : IsAffineOpen U) :
-    hU.fromSpec.1.c.app (op U) =
-      SpecΓIdentity.inv.app (X.presheaf.obj <| op U) ≫
-        (Scheme.Spec.obj _).presheaf.map (eqToHom hU.fromSpec_base_preimage).op :=
-  by rw [← hU.SpecΓIdentity_hom_app_fromSpec, Iso.inv_hom_id_app_assoc]
-#align algebraic_geometry.is_affine_open.from_Spec_app_eq AlgebraicGeometry.IsAffineOpen.fromSpec_app_eq
-
-theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (f : X.presheaf.obj (op U)) : IsAffineOpen (X.basicOpen f) := by
-  -- Porting note : this instance needs to be manually added, though no explicit argument is
-  -- provided.
-  have o1 : IsOpenImmersion <|
-    Scheme.Spec.map
-      (CommRingCat.ofHom (algebraMap ((X.presheaf.obj <| op U)) (Localization.Away f))).op ≫
-    hU.fromSpec
-  · exact PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := inferInstance)
-  convert
-    rangeIsAffineOpenOfOpenImmersion
-      (Scheme.Spec.map
-          (CommRingCat.ofHom (algebraMap (X.presheaf.obj (op U)) (Localization.Away f))).op ≫
-        hU.fromSpec)
+theorem fromSpec_app_self :
+    hU.fromSpec.1.c.app (op U) = SpecΓIdentity.inv.app (X.presheaf.obj <| op U) ≫
+    (𝖲𝗉𝖾𝖼 𝓞ₓ(U)).presheaf.map (eqToHom hU.fromSpec_base_preimage).op := by
+  rw [← hU.SpecΓIdentity_hom_app_fromSpec, ← NatTrans.comp_app_assoc, Iso.inv_hom_id,
+    NatTrans.id_app, Category.id_comp]
+#align algebraic_geometry.is_affine_open.from_Spec_app_eq AlgebraicGeometry.IsAffineOpen.fromSpec_app_self
+
+theorem fromSpec_map_basicOpen' :
+    hU.fromSpec ⁻¹ᵁ X.basicOpen f =
+      (𝖲𝗉𝖾𝖼 𝓞ₓ(U)).basicOpen (SpecΓIdentity.inv.app (X.presheaf.obj (op U)) f) := by
+  rw [Scheme.preimage_basicOpen, hU.fromSpec_app_self]
+  exact Scheme.basicOpen_res_eq _ _ (eqToHom hU.fromSpec_base_preimage).op
+#align algebraic_geometry.is_affine_open.opens_map_from_Spec_basic_open AlgebraicGeometry.IsAffineOpen.fromSpec_map_basicOpen'
+
+theorem fromSpec_map_basicOpen :
+    hU.fromSpec ⁻¹ᵁ X.basicOpen f = PrimeSpectrum.basicOpen f := by
+  rw [fromSpec_map_basicOpen', ← basicOpen_eq_of_affine, NatIso.app_inv]
+#align algebraic_geometry.is_affine_open.from_Spec_map_basic_open AlgebraicGeometry.IsAffineOpen.fromSpec_map_basicOpen
+
+theorem opensFunctor_map_basicOpen :
+    hU.fromSpec.opensFunctor.obj (PrimeSpectrum.basicOpen f) = X.basicOpen f := by
+  rw [← hU.fromSpec_map_basicOpen]
   ext1
-  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, hU.fromSpec_range]
-    exact Scheme.basicOpen_le _ _
-  rw [Scheme.Hom.opensRange_coe, Scheme.comp_val_base, ← this, coe_comp, Set.range_comp]
-  -- Porting note : `congr 1` did not work
-  apply congr_arg (_ '' ·)
-  refine' (Opens.coe_inj.mpr <| Scheme.preimage_basicOpen hU.fromSpec f).trans _
-  refine' Eq.trans _ (PrimeSpectrum.localization_away_comap_range (Localization.Away f) f).symm
-  congr 1
-  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
-  refine' Eq.trans _ (Opens.coe_inj.mpr <| basicOpen_eq_of_affine f)
-  have lm : ∀ s, (Opens.map hU.fromSpec.val.base).obj U ⊓ s = s := fun s => this.symm ▸ top_inf_eq
-  refine' Opens.coe_inj.mpr <| Eq.trans _ (lm _)
-  refine'
-    Eq.trans _
-      ((Scheme.Spec.obj <| op <| X.presheaf.obj <| op U).basicOpen_res _ (eqToHom this).op)
-  -- Porting note : changed `rw` to `erw`
-  erw [← comp_apply]
-  congr 2
-  rw [Iso.eq_inv_comp]
-  erw [hU.SpecΓIdentity_hom_app_fromSpec]
+  change hU.fromSpec.val.base '' (hU.fromSpec.val.base ⁻¹' (X.basicOpen f : Set X)) = _
+  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, hU.fromSpec_range]
+  exact Scheme.basicOpen_le _ _
+
+-- Porting note : linter complains that LHS is not in simp-normal-form. However, the error provided
+-- by linter seems to tell me that left hand side should be changed in to something exactly the same
+-- as before. I am not sure if this is caused by LHS being written with all explicit argument,
+-- I am not sure if this is intentional or not.
+@[simp, nolint simpNF]
+theorem basicOpen_fromSpec_app :
+    (𝖲𝗉𝖾𝖼 𝓞ₓ(U)).basicOpen (hU.fromSpec.1.c.app (op U) f) =
+      PrimeSpectrum.basicOpen f := by
+  rw [← hU.fromSpec_map_basicOpen, Scheme.preimage_basicOpen]
+#align algebraic_geometry.is_affine_open.basic_open_from_Spec_app AlgebraicGeometry.IsAffineOpen.basicOpen_fromSpec_app
+
+theorem basicOpenIsAffine :
+    IsAffineOpen (X.basicOpen f) := by
+  rw [← hU.opensFunctor_map_basicOpen, Scheme.Hom.isAffineOpen_iff_of_isOpenImmersion]
+  convert rangeIsAffineOpenOfOpenImmersion (Scheme.Spec.map
+    (CommRingCat.ofHom <| algebraMap (X.presheaf.obj (op U)) (Localization.Away f)).op)
+  exact Opens.ext (PrimeSpectrum.localization_away_comap_range (Localization.Away f) f).symm
 #align algebraic_geometry.is_affine_open.basic_open_is_affine AlgebraicGeometry.IsAffineOpen.basicOpenIsAffine
 
-theorem IsAffineOpen.mapRestrictBasicOpen {X : Scheme} (r : X.presheaf.obj (op ⊤))
-    {U : Opens X} (hU : IsAffineOpen U) :
-    IsAffineOpen ((Opens.map (X.ofRestrict (X.basicOpen r).openEmbedding).1.base).obj U) := by
-  apply
-    (isAffineOpen_iff_of_isOpenImmersion (X.ofRestrict (X.basicOpen r).openEmbedding) _).mp
-  delta PresheafedSpace.IsOpenImmersion.openFunctor
-  dsimp
-  erw [Opens.functor_obj_map_obj, Opens.openEmbedding_obj_top, inf_comm, ←
-    Scheme.basicOpen_res _ _ (homOfLE le_top).op]
+theorem mapRestrictBasicOpen (r : X.presheaf.obj (op ⊤)) :
+    IsAffineOpen (Scheme.ιOpens (X.basicOpen r) ⁻¹ᵁ U) := by
+  apply (Scheme.ιOpens (X.basicOpen r)).isAffineOpen_iff_of_isOpenImmersion.mp
+  dsimp [Scheme.Hom.opensFunctor, PresheafedSpace.IsOpenImmersion.openFunctor]
+  rw [Opens.functor_obj_map_obj, Opens.openEmbedding_obj_top, inf_comm,
+    ← Scheme.basicOpen_res _ _ (homOfLE le_top).op]
   exact hU.basicOpenIsAffine _
 #align algebraic_geometry.is_affine_open.map_restrict_basic_open AlgebraicGeometry.IsAffineOpen.mapRestrictBasicOpen
 
-theorem Scheme.map_PrimeSpectrum_basicOpen_of_affine (X : Scheme) [IsAffine X]
-    (f : Scheme.Γ.obj (op X)) :
-    (Opens.map X.isoSpec.hom.1.base).obj (PrimeSpectrum.basicOpen f) = X.basicOpen f := by
-  rw [← basicOpen_eq_of_affine]
-  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)))
-  · congr
-    · rw [← IsIso.inv_eq_inv, IsIso.inv_inv, IsIso.Iso.inv_inv, NatIso.app_hom]
-      -- Porting note : added this `change` to prevent timeout
-      change SpecΓIdentity.hom.app (X.presheaf.obj <| op ⊤) = _
-      rw [← ΓSpec.adjunction_unit_app_app_top X]
-      rfl
-    · rw [eqToHom_map]; rfl
-  · dsimp; congr
-    refine' (Scheme.preimage_basicOpen _ _).trans _
-    -- Porting note : changed `rw` to `erw`
-    erw [IsIso.inv_hom_id_apply, Scheme.basicOpen_res_eq]
-#align algebraic_geometry.Scheme.map_prime_spectrum_basic_open_of_affine AlgebraicGeometry.Scheme.map_PrimeSpectrum_basicOpen_of_affine
-
-theorem isBasis_basicOpen (X : Scheme) [IsAffine X] :
-    Opens.IsBasis (Set.range (X.basicOpen : X.presheaf.obj (op ⊤) → Opens X)) := by
-  delta Opens.IsBasis
-  convert PrimeSpectrum.isBasis_basic_opens.inducing
-    (TopCat.homeoOfIso (Scheme.forgetToTop.mapIso X.isoSpec)).inducing using 1
-  ext
-  simp only [Set.mem_image, exists_exists_eq_and]
-  constructor
-  · rintro ⟨_, ⟨x, rfl⟩, rfl⟩
-    refine' ⟨_, ⟨_, ⟨x, rfl⟩, rfl⟩, _⟩
-    exact congr_arg Opens.carrier (X.map_PrimeSpectrum_basicOpen_of_affine x)
-  · rintro ⟨_, ⟨_, ⟨x, rfl⟩, rfl⟩, rfl⟩
-    refine' ⟨_, ⟨x, rfl⟩, _⟩
-    exact congr_arg Opens.carrier (X.map_PrimeSpectrum_basicOpen_of_affine x).symm
-#align algebraic_geometry.is_basis_basic_open AlgebraicGeometry.isBasis_basicOpen
-
-theorem IsAffineOpen.exists_basicOpen_le {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    {V : Opens X} (x : V) (h : ↑x ∈ U) :
+theorem exists_basicOpen_le {V : Opens X} (x : V) (h : ↑x ∈ U) :
     ∃ f : X.presheaf.obj (op U), X.basicOpen f ≤ V ∧ ↑x ∈ X.basicOpen f := by
-  haveI : IsAffine _ := hU
+  have : IsAffine _ := hU
   obtain ⟨_, ⟨_, ⟨r, rfl⟩, rfl⟩, h₁, h₂⟩ :=
-    (isBasis_basicOpen (X.restrict U.openEmbedding)).exists_subset_of_mem_open (x.2 : ⟨x, h⟩ ∈ _)
+    (isBasis_basicOpen (X ∣_ᵤ U)).exists_subset_of_mem_open (x.2 : ⟨x, h⟩ ∈ _)
       ((Opens.map U.inclusion).obj V).isOpen
   have :
-    U.openEmbedding.isOpenMap.functor.obj ((X.restrict U.openEmbedding).basicOpen r) =
+    U.openEmbedding.isOpenMap.functor.obj ((X ∣_ᵤ U).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]
+    rw [← Scheme.basicOpen_res_eq _ _ (eqToHom U.openEmbedding_obj_top).op,
+      ← comp_apply, ← CategoryTheory.Functor.map_comp, ← op_comp, eqToHom_trans, eqToHom_refl,
+      op_id, CategoryTheory.Functor.map_id, Scheme.Hom.invApp,
+      PresheafedSpace.IsOpenImmersion.ofRestrict_invApp]
     congr
   use X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op r
   rw [← this]
   exact ⟨Set.image_subset_iff.mpr h₂, ⟨_, h⟩, h₁, rfl⟩
 #align algebraic_geometry.is_affine_open.exists_basic_open_le AlgebraicGeometry.IsAffineOpen.exists_basicOpen_le
 
-instance algebra_section_section_basicOpen {X : Scheme} {U : Opens X} (f : X.presheaf.obj (op U)) :
-    Algebra (X.presheaf.obj (op U)) (X.presheaf.obj (op <| X.basicOpen f)) :=
-  (X.presheaf.map (homOfLE <| RingedSpace.basicOpen_le _ f : _ ⟶ U).op).toAlgebra
-
-theorem IsAffineOpen.opens_map_fromSpec_basicOpen {X : Scheme} {U : Opens X}
-    (hU : IsAffineOpen U) (f : X.presheaf.obj (op U)) :
-    (Opens.map hU.fromSpec.val.base).obj (X.basicOpen f) =
-      -- Porting note : need to supply first argument in ↓ explicitly
-      RingedSpace.basicOpen (unop <| LocallyRingedSpace.forgetToSheafedSpace.op.obj <|
-        Spec.toLocallyRingedSpace.rightOp.obj <| X.presheaf.obj <| op U)
-      (SpecΓIdentity.inv.app (X.presheaf.obj <| op U) f) := by
-  erw [LocallyRingedSpace.preimage_basicOpen]
-  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
-  refine congr_arg (RingedSpace.basicOpen _ ·) ?_
-  -- Porting note : change `rw` to `erw`
-  erw [← comp_apply]
-  congr
-  erw [← hU.SpecΓIdentity_hom_app_fromSpec]
-  rw [Iso.inv_hom_id_app_assoc]
-#align algebraic_geometry.is_affine_open.opens_map_from_Spec_basic_open AlgebraicGeometry.IsAffineOpen.opens_map_fromSpec_basicOpen
-
-/-- The canonical map `Γ(𝒪ₓ, D(f)) ⟶ Γ(Spec 𝒪ₓ(U), D(Spec_Γ_identity.inv f))`
-This is an isomorphism, as witnessed by an `is_iso` instance. -/
-def basicOpenSectionsToAffine {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (f : X.presheaf.obj (op U)) :
+/-- Given an affine open U and some `f : U`,
+this is the canonical map `Γ(𝒪ₓ, D(f)) ⟶ Γ(Spec 𝒪ₓ(U), D(f))`
+This is an isomorphism, as witnessed by an `IsIso` instance. -/
+def basicOpenSectionsToAffine :
     X.presheaf.obj (op <| X.basicOpen f) ⟶
-      (Scheme.Spec.obj <| op <| X.presheaf.obj (op U)).presheaf.obj
-        (op <| Scheme.basicOpen _ <| SpecΓIdentity.inv.app (X.presheaf.obj (op U)) f) :=
+      (𝖲𝗉𝖾𝖼 𝓞ₓ(U)).presheaf.obj (op <| PrimeSpectrum.basicOpen f) :=
   hU.fromSpec.1.c.app (op <| X.basicOpen f) ≫
-    (Scheme.Spec.obj <| op <| X.presheaf.obj (op U)).presheaf.map
-      (eqToHom <| (hU.opens_map_fromSpec_basicOpen f).symm).op
-#align algebraic_geometry.basic_open_sections_to_affine AlgebraicGeometry.basicOpenSectionsToAffine
+    (𝖲𝗉𝖾𝖼 𝓞ₓ(U)).presheaf.map (eqToHom <| (hU.fromSpec_map_basicOpen f).symm).op
+#align algebraic_geometry.basic_open_sections_to_affine AlgebraicGeometry.IsAffineOpen.basicOpenSectionsToAffine
 
-instance basicOpenSectionsToAffine_isIso {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (f : X.presheaf.obj (op U)) : IsIso (basicOpenSectionsToAffine hU f) := by
+instance basicOpenSectionsToAffine_isIso :
+    IsIso (basicOpenSectionsToAffine hU f) := by
   delta basicOpenSectionsToAffine
   apply (config := { allowSynthFailures := true }) IsIso.comp_isIso
-  · apply PresheafedSpace.IsOpenImmersion.isIso_of_subset
-    rw [hU.fromSpec_range]
-    exact RingedSpace.basicOpen_le _ _
+  apply PresheafedSpace.IsOpenImmersion.isIso_of_subset
+  rw [hU.fromSpec_range]
+  exact RingedSpace.basicOpen_le _ _
 
-theorem isLocalization_basicOpen {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (f : X.presheaf.obj (op U)) : IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
+theorem isLocalization_basicOpen :
+    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
   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
+      (asIso <| basicOpenSectionsToAffine hU f).commRingCatIsoToRingEquiv).mpr
   convert StructureSheaf.IsLocalization.to_basicOpen _ f using 1
   -- Porting note : more hand holding is required here, the next 4 lines were not necessary
   delta StructureSheaf.openAlgebra
   congr 1
   rw [CommRingCat.ringHom_comp_eq_comp, Iso.commRingIsoToRingEquiv_toRingHom, asIso_hom]
-  dsimp [CommRingCat.ofHom]
-  change X.presheaf.map _ ≫ basicOpenSectionsToAffine hU f ≫ _ = _
+  dsimp [CommRingCat.ofHom, RingHom.algebraMap_toAlgebra]
+  change X.presheaf.map _ ≫ basicOpenSectionsToAffine hU f = _
   delta basicOpenSectionsToAffine
-  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`
-  simp only [←Category.assoc]
-  -- Note: changed `rw` to `simp_rw` to improve performance
-  simp_rw [hU.fromSpec.val.c.naturality, hU.fromSpec_app_eq]
-  -- simp only [Category.assoc]
-  -- rw [hU.fromSpec_app_eq]
-  dsimp
+  rw [hU.fromSpec.val.c.naturality_assoc, hU.fromSpec_app_self]
   simp only [Category.assoc, ← Functor.map_comp, ← op_comp]
   apply StructureSheaf.toOpen_res
-#align algebraic_geometry.is_localization_basic_open AlgebraicGeometry.isLocalization_basicOpen
+  exact homOfLE le_top
+#align algebraic_geometry.is_localization_basic_open AlgebraicGeometry.IsAffineOpen.isLocalization_basicOpen
 
-instance isLocalization_away_of_isAffine {X : Scheme} [IsAffine X] (r : X.presheaf.obj (op ⊤)) :
+instance _root_.AlgebraicGeometry.isLocalization_away_of_isAffine
+    [IsAffine X] (r : X.presheaf.obj (op ⊤)) :
     IsLocalization.Away r (X.presheaf.obj (op <| X.basicOpen r)) :=
   isLocalization_basicOpen (topIsAffineOpen X) r
 
-theorem isLocalization_of_eq_basicOpen {X : Scheme} {U V : Opens X} (i : V ⟶ U)
-    (hU : IsAffineOpen U) (r : X.presheaf.obj (op U)) (e : V = X.basicOpen r) :
-    @IsLocalization.Away _ _ r (X.presheaf.obj (op V)) _ (X.presheaf.map i.op).toAlgebra := by
-  subst e; convert isLocalization_basicOpen hU r using 3
-#align algebraic_geometry.is_localization_of_eq_basic_open AlgebraicGeometry.isLocalization_of_eq_basicOpen
-
-instance ΓRestrictAlgebra {X : Scheme} {Y : TopCat} {f : Y ⟶ X} (hf : OpenEmbedding f) :
-    Algebra (Scheme.Γ.obj (op X)) (Scheme.Γ.obj (op <| X.restrict hf)) :=
-  (Scheme.Γ.map (X.ofRestrict hf).op).toAlgebra
-#align algebraic_geometry.Γ_restrict_algebra AlgebraicGeometry.ΓRestrictAlgebra
+theorem isLocalization_of_eq_basicOpen {V : Opens X} (i : V ⟶ U) (e : V = X.basicOpen f) :
+    @IsLocalization.Away _ _ f (X.presheaf.obj (op V)) _ (X.presheaf.map i.op).toAlgebra := by
+  subst e; convert isLocalization_basicOpen hU f using 3
+#align algebraic_geometry.is_localization_of_eq_basic_open AlgebraicGeometry.IsAffineOpen.isLocalization_of_eq_basicOpen
 
-instance Γ_restrict_isLocalization (X : Scheme.{u}) [IsAffine X] (r : Scheme.Γ.obj (op X)) :
-    IsLocalization.Away r (Scheme.Γ.obj (op <| X.restrict (X.basicOpen r).openEmbedding)) :=
-  isLocalization_of_eq_basicOpen _ (topIsAffineOpen X) r (Opens.openEmbedding_obj_top _)
+instance _root_.AlgebraicGeometry.Γ_restrict_isLocalization
+    (X : Scheme.{u}) [IsAffine X] (r : Scheme.Γ.obj (op X)) :
+    IsLocalization.Away r (Scheme.Γ.obj (op (X ∣_ᵤ X.basicOpen r))) :=
+  (topIsAffineOpen X).isLocalization_of_eq_basicOpen r _ (Opens.openEmbedding_obj_top _)
 #align algebraic_geometry.Γ_restrict_is_localization AlgebraicGeometry.Γ_restrict_isLocalization
 
-theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (f : X.presheaf.obj (op U)) (g : X.presheaf.obj (op <| X.basicOpen f)) :
+theorem basicOpen_basicOpen_is_basicOpen (g : X.presheaf.obj (op <| X.basicOpen f)) :
     ∃ f' : X.presheaf.obj (op U), X.basicOpen f' = X.basicOpen g := by
-  haveI := isLocalization_basicOpen hU f
+  have := isLocalization_basicOpen hU f
   obtain ⟨x, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.surj'' (Submonoid.powers f) g
   use f * x
-  rw [Algebra.smul_def, Scheme.basicOpen_mul, Scheme.basicOpen_mul]
-  erw [Scheme.basicOpen_res]
+  rw [Algebra.smul_def, Scheme.basicOpen_mul, Scheme.basicOpen_mul, RingHom.algebraMap_toAlgebra]
+  rw [Scheme.basicOpen_res]
   refine' (inf_eq_left.mpr _).symm
   -- Porting note : a little help is needed here
   convert inf_le_left (α := Opens X) using 1
@@ -566,10 +477,10 @@ theorem basicOpen_basicOpen_is_basicOpen {X : Scheme} {U : Opens X} (hU : IsAffi
     Submonoid.leftInv_le_isUnit _
       (IsLocalization.toInvSubmonoid (Submonoid.powers f) (X.presheaf.obj (op <| X.basicOpen f))
         _).prop
-#align algebraic_geometry.basic_open_basic_open_is_basic_open AlgebraicGeometry.basicOpen_basicOpen_is_basicOpen
+#align algebraic_geometry.basic_open_basic_open_is_basic_open AlgebraicGeometry.IsAffineOpen.basicOpen_basicOpen_is_basicOpen
 
-theorem exists_basicOpen_le_affine_inter {X : Scheme} {U V : Opens X} (hU : IsAffineOpen U)
-    (hV : IsAffineOpen V) (x : X) (hx : x ∈ U ⊓ V) :
+theorem _root_.AlgebraicGeometry.exists_basicOpen_le_affine_inter
+    {V : Opens X} (hV : IsAffineOpen V) (x : X) (hx : x ∈ U ⊓ V) :
     ∃ (f : X.presheaf.obj <| op U) (g : X.presheaf.obj <| op V),
       X.basicOpen f = X.basicOpen g ∧ x ∈ X.basicOpen f := by
   obtain ⟨f, hf₁, hf₂⟩ := hU.exists_basicOpen_le ⟨x, hx.2⟩ hx.1
@@ -581,93 +492,31 @@ theorem exists_basicOpen_le_affine_inter {X : Scheme} {U V : Opens X} (hU : IsAf
 #align algebraic_geometry.exists_basic_open_le_affine_inter AlgebraicGeometry.exists_basicOpen_le_affine_inter
 
 /-- The prime ideal of `𝒪ₓ(U)` corresponding to a point `x : U`. -/
-noncomputable def IsAffineOpen.primeIdealOf {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (x : U) : PrimeSpectrum (X.presheaf.obj <| op U) :=
-  (Scheme.Spec.map
-          (X.presheaf.map
-              (eqToHom <|
-                  show U.openEmbedding.isOpenMap.functor.obj ⊤ = U from
-                    Opens.ext (Set.image_univ.trans Subtype.range_coe)).op).op).1.base
-    ((@Scheme.isoSpec (X.restrict U.openEmbedding) hU).hom.1.base x)
+noncomputable def primeIdealOf (x : U) :
+    PrimeSpectrum (X.presheaf.obj <| op U) :=
+  ((@Scheme.isoSpec (X ∣_ᵤ U) hU).hom ≫
+    Scheme.Spec.map (X.presheaf.map (eqToHom U.openEmbedding_obj_top).op).op).1.base x
 #align algebraic_geometry.is_affine_open.prime_ideal_of AlgebraicGeometry.IsAffineOpen.primeIdealOf
 
-theorem IsAffineOpen.fromSpec_primeIdealOf {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (x : U) : hU.fromSpec.val.base (hU.primeIdealOf x) = x.1 := by
-  dsimp only [IsAffineOpen.fromSpec, Subtype.coe_mk]
+theorem fromSpec_primeIdealOf (x : U) :
+    hU.fromSpec.val.base (hU.primeIdealOf x) = x.1 := by
+  dsimp only [IsAffineOpen.fromSpec, Subtype.coe_mk, IsAffineOpen.primeIdealOf]
   -- 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
-  erw [← elementwise_of% Scheme.comp_val_base, ← elementwise_of% Scheme.comp_val_base]
-  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
-  rfl
+  rw [← elementwise_of% Scheme.comp_val_base]
+  simp only [Scheme.Γ_obj, unop_op, Scheme.restrict_presheaf_obj, Category.assoc, ←
+    Functor.map_comp_assoc, ← op_comp, ← Functor.map_comp, eqToHom_trans, eqToHom_refl, op_id,
+    CategoryTheory.Functor.map_id, Category.id_comp, Iso.hom_inv_id_assoc,
+    Scheme.ofRestrict_val_base, Scheme.restrict_carrier, Opens.coe_inclusion]
 #align algebraic_geometry.is_affine_open.from_Spec_prime_ideal_of AlgebraicGeometry.IsAffineOpen.fromSpec_primeIdealOf
 
--- Porting note : the original proof does not compile under 0 `heartbeat`, so partially rewritten
--- but after the rewrite, I still can't get it compile under `200000`
-set_option maxHeartbeats 400000 in
-theorem IsAffineOpen.isLocalization_stalk_aux {X : Scheme} (U : Opens X)
-    [IsAffine (X.restrict U.openEmbedding)] :
-    (inv (ΓSpec.adjunction.unit.app (X.restrict U.openEmbedding))).1.c.app
-        (op ((Opens.map U.inclusion).obj U)) =
-    X.presheaf.map (op <| eqToHom <| by rw [Opens.inclusion_map_eq_top]; rfl) ≫
-      toSpecΓ (X.presheaf.obj <| op (U.openEmbedding.isOpenMap.functor.obj ⊤)) ≫
-      (Scheme.Spec.obj <| op <| X.presheaf.obj _).presheaf.map
-        (op <| eqToHom <| by rw [Opens.inclusion_map_eq_top]; rfl) := by
-  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
-  rw [Scheme.inv_val_c_app, IsIso.comp_inv_eq, Scheme.app_eq _ e,
-    ΓSpec.adjunction_unit_app_app_top]
-  simp only [Category.assoc, eqToHom_op, eqToHom_map]
-  erw [Scheme.presheaf_map_eqToHom_op, Scheme.presheaf_map_eqToHom_op]
-  simp only [eqToHom_trans_assoc, eqToHom_refl, Category.id_comp]
-  erw [SpecΓIdentity.inv_hom_id_app_assoc]
-  rw [eqToHom_trans]
-#align algebraic_geometry.is_affine_open.is_localization_stalk_aux AlgebraicGeometry.IsAffineOpen.isLocalization_stalk_aux
-
-set_option maxHeartbeats 800000 in
-theorem IsAffineOpen.isLocalization_stalk_aux' {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
+theorem isLocalization_stalk'
     (y : PrimeSpectrum (X.presheaf.obj <| op U)) (hy : hU.fromSpec.1.base y ∈ U) :
-    hU.fromSpec.val.c.app (op U) ≫ (Scheme.Spec.obj <| op (X.presheaf.obj <| op U)).presheaf.germ
-      (U := (Opens.map hU.fromSpec.val.base).obj U) ⟨y, hy⟩ =
-    StructureSheaf.toStalk (X.presheaf.obj <| op U) y := by
-  haveI : IsAffine _ := hU
-  delta IsAffineOpen.fromSpec Scheme.isoSpec StructureSheaf.toStalk
-  simp only [Scheme.comp_val_c_app, Category.assoc]
-  dsimp only [Functor.op, asIso_inv, unop_op]
-  erw [IsAffineOpen.isLocalization_stalk_aux]
-  simp only [Category.assoc]
-  conv_lhs => rw [← Category.assoc]
-  erw [← X.presheaf.map_comp, Spec_Γ_naturality_assoc]
-  congr 1
-  simp only [← Category.assoc]
-  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
-  rw [Category.assoc]
-  erw [NatTrans.naturality]
-  rw [← LocallyRingedSpace.Γ_map_op, ← LocallyRingedSpace.Γ.map_comp_assoc, ← op_comp]
-  erw [← Scheme.Spec.map_comp]
-  rw [← op_comp, ← X.presheaf.map_comp]
-  convert_to LocallyRingedSpace.Γ.map
-    (Quiver.Hom.op <| Scheme.Spec.map (X.presheaf.map (𝟙 (op U))).op) ≫ _ = _
-  simp only [CategoryTheory.Functor.map_id, op_id]
-  erw [CategoryTheory.Functor.map_id]
-  rw [Category.id_comp]
-  rfl
-
-theorem IsAffineOpen.isLocalization_stalk' {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (y : PrimeSpectrum (X.presheaf.obj <| op U)) (hy : hU.fromSpec.1.base y ∈ U) :
-  haveI : IsAffine _ := hU
-  -- haveI : Nonempty U := ⟨hU.fromSpec.1.base y⟩
-  @IsLocalization.AtPrime
-    (R := X.presheaf.obj <| op U)
-    (S := X.presheaf.stalk <| hU.fromSpec.1.base y) _ _
-    ((TopCat.Presheaf.algebra_section_stalk X.presheaf _)) y.asIdeal _ := by
+    @IsLocalization.AtPrime
+      (R := X.presheaf.obj <| op U)
+      (S := X.presheaf.stalk <| hU.fromSpec.1.base y) _ _
+      ((TopCat.Presheaf.algebra_section_stalk X.presheaf _)) y.asIdeal _ := by
   apply
     (@IsLocalization.isLocalization_iff_of_ringEquiv (R := X.presheaf.obj <| op U)
       (S := X.presheaf.stalk (hU.fromSpec.1.base y)) _ y.asIdeal.primeCompl _
@@ -681,61 +530,28 @@ theorem IsAffineOpen.isLocalization_stalk' {X : Scheme} {U : Opens X} (hU : IsAf
   congr 2
   rw [RingHom.algebraMap_toAlgebra]
   refine' (PresheafedSpace.stalkMap_germ hU.fromSpec.1 _ ⟨_, hy⟩).trans _
-  apply hU.isLocalization_stalk_aux' y hy
+  rw [IsAffineOpen.fromSpec_app_self, Category.assoc, TopCat.Presheaf.germ_res]
+  rfl
 
 -- Porting note : I have splitted this into two lemmas
-theorem IsAffineOpen.isLocalization_stalk {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (x : U) : IsLocalization.AtPrime (X.presheaf.stalk x) (hU.primeIdealOf x).asIdeal := by
+theorem isLocalization_stalk (x : U) :
+    IsLocalization.AtPrime (X.presheaf.stalk x) (hU.primeIdealOf x).asIdeal := by
   rcases x with ⟨x, hx⟩
-  let y := hU.primeIdealOf ⟨x, hx⟩
-  have : hU.fromSpec.val.base y = x := hU.fromSpec_primeIdealOf ⟨x, hx⟩
-  -- Porting note : this is painful now, need to provide explicit instance
-  change @IsLocalization (M := y.asIdeal.primeCompl) (S := X.presheaf.stalk x) _ _
-    (TopCat.Presheaf.algebra_section_stalk X.presheaf ⟨x, hx⟩)
+  set y := hU.primeIdealOf ⟨x, hx⟩ with hy
+  have : hU.fromSpec.val.base y = x := hy ▸ hU.fromSpec_primeIdealOf ⟨x, hx⟩
   clear_value y
   subst this
-  convert hU.isLocalization_stalk' y hx
+  exact hU.isLocalization_stalk' y hx
 #align algebraic_geometry.is_affine_open.is_localization_stalk AlgebraicGeometry.IsAffineOpen.isLocalization_stalk
 
 /-- The basic open set of a section `f` on an affine open as an `X.affineOpens`. -/
 @[simps]
-def Scheme.affineBasicOpen (X : Scheme) {U : X.affineOpens} (f : X.presheaf.obj <| op U) :
-    X.affineOpens :=
+def _root_.AlgebraicGeometry.Scheme.affineBasicOpen
+    (X : Scheme) {U : X.affineOpens} (f : X.presheaf.obj <| op U) : X.affineOpens :=
   ⟨X.basicOpen f, U.prop.basicOpenIsAffine f⟩
 #align algebraic_geometry.Scheme.affine_basic_open AlgebraicGeometry.Scheme.affineBasicOpen
 
--- Porting note : linter complains that LHS is not in simp-normal-form. However, the error provided
--- by linter seems to tell me that left hand side should be changed in to something exactly the same
--- as before. I am not sure if this is caused by LHS being written with all explicit argument,
--- I am not sure if this is intentional or not.
-@[simp, nolint simpNF]
-theorem IsAffineOpen.basicOpen_fromSpec_app {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (f : X.presheaf.obj (op U)) :
-    @Scheme.basicOpen (Scheme.Spec.obj <| op (X.presheaf.obj <| op U))
-        ((Opens.map hU.fromSpec.1.base).obj U) (hU.fromSpec.1.c.app (op U) f) =
-      PrimeSpectrum.basicOpen f := by
-  rw [← Scheme.basicOpen_res_eq _ _ (eqToHom hU.fromSpec_base_preimage.symm).op,
-    basicOpen_eq_of_affine', IsAffineOpen.fromSpec_app_eq]
-  congr
-  -- Porting note : change `rw` to `erw`
-  erw [← comp_apply, ← comp_apply]
-  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`
-  erw [Category.comp_id]
-  rw [← Iso.app_inv, Iso.inv_hom_id]
-  rfl
-#align algebraic_geometry.is_affine_open.basic_open_from_Spec_app AlgebraicGeometry.IsAffineOpen.basicOpen_fromSpec_app
-
-theorem IsAffineOpen.fromSpec_map_basicOpen {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
-    (f : X.presheaf.obj (op U)) :
-    (Opens.map hU.fromSpec.val.base).obj (X.basicOpen f) = PrimeSpectrum.basicOpen f := by
-  simp only [IsAffineOpen.basicOpen_fromSpec_app, Scheme.preimage_basicOpen, eq_self_iff_true]
-#align algebraic_geometry.is_affine_open.from_Spec_map_basic_open AlgebraicGeometry.IsAffineOpen.fromSpec_map_basicOpen
-
-theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X}
-    (hU : IsAffineOpen U) (s : Set (X.presheaf.obj <| op U)) :
+theorem basicOpen_union_eq_self_iff (s : Set (X.presheaf.obj <| op U)) :
     ⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U) = U ↔ Ideal.span s = ⊤ := by
   trans ⋃ i : s, (PrimeSpectrum.basicOpen i.1).1 = Set.univ
   trans
@@ -766,8 +582,7 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X}
     simp only [Set.iUnion_singleton_eq_range, Subtype.range_val_subtype, Set.setOf_mem_eq]
 #align algebraic_geometry.is_affine_open.basic_open_union_eq_self_iff AlgebraicGeometry.IsAffineOpen.basicOpen_union_eq_self_iff
 
-theorem IsAffineOpen.self_le_basicOpen_union_iff {X : Scheme} {U : Opens X}
-    (hU : IsAffineOpen U) (s : Set (X.presheaf.obj <| op U)) :
+theorem self_le_basicOpen_union_iff (s : Set (X.presheaf.obj <| op U)) :
     (U ≤ ⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U)) ↔ Ideal.span s = ⊤ := by
   rw [← hU.basicOpen_union_eq_self_iff, @comm _ Eq]
   refine' ⟨fun h => le_antisymm h _, le_of_eq⟩
@@ -776,6 +591,8 @@ theorem IsAffineOpen.self_le_basicOpen_union_iff {X : Scheme} {U : Opens X}
   exact X.basicOpen_le x
 #align algebraic_geometry.is_affine_open.self_le_basic_open_union_iff AlgebraicGeometry.IsAffineOpen.self_le_basicOpen_union_iff
 
+end IsAffineOpen
+
 /-- Let `P` be a predicate on the affine open sets of `X` satisfying
 1. If `P` holds on `U`, then `P` holds on the basic open set of every section on `U`.
 2. If `P` holds for a family of basic open sets covering `U`, then `P` holds for `U`.
feat(Mathlib/AlgebraicGeometry): Move material on restriction to new file (#7749)

Also provides new notations and fixed slow proofs

Co-authored-by: Andrew Yang <36414270+erdOne@users.noreply.github.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
 import Mathlib.AlgebraicGeometry.GammaSpecAdjunction
-import Mathlib.AlgebraicGeometry.OpenImmersion
+import Mathlib.AlgebraicGeometry.Restrict
 import Mathlib.CategoryTheory.Limits.Opposites
 import Mathlib.RingTheory.Localization.InvSubmonoid
 
chore: removing unneeded maxHeartbeats (#7761)

Due to recent changes in core we can reduce or remove many set_option maxHeartbeats statements.

I have tried to be careful to not leave anything too close to the line, so don't be surprised if some of these can still be reduced further.

This reduces us from 96 maxHeartbeats statements to 44. (There are 10 false positives in meta or testing code.)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -501,7 +501,6 @@ instance basicOpenSectionsToAffine_isIso {X : Scheme} {U : Opens X} (hU : IsAffi
     rw [hU.fromSpec_range]
     exact RingedSpace.basicOpen_le _ _
 
-set_option maxHeartbeats 300000 in
 theorem isLocalization_basicOpen {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
     (f : X.presheaf.obj (op U)) : IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
   apply
@@ -607,7 +606,7 @@ theorem IsAffineOpen.fromSpec_primeIdealOf {X : Scheme} {U : Opens X} (hU : IsAf
 
 -- Porting note : the original proof does not compile under 0 `heartbeat`, so partially rewritten
 -- but after the rewrite, I still can't get it compile under `200000`
-set_option maxHeartbeats 640000 in
+set_option maxHeartbeats 400000 in
 theorem IsAffineOpen.isLocalization_stalk_aux {X : Scheme} (U : Opens X)
     [IsAffine (X.restrict U.openEmbedding)] :
     (inv (ΓSpec.adjunction.unit.app (X.restrict U.openEmbedding))).1.c.app
@@ -630,7 +629,7 @@ theorem IsAffineOpen.isLocalization_stalk_aux {X : Scheme} (U : Opens X)
   rw [eqToHom_trans]
 #align algebraic_geometry.is_affine_open.is_localization_stalk_aux AlgebraicGeometry.IsAffineOpen.isLocalization_stalk_aux
 
-set_option maxHeartbeats 1600000 in
+set_option maxHeartbeats 800000 in
 theorem IsAffineOpen.isLocalization_stalk_aux' {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
     (y : PrimeSpectrum (X.presheaf.obj <| op U)) (hy : hU.fromSpec.1.base y ∈ U) :
     hU.fromSpec.val.c.app (op U) ≫ (Scheme.Spec.obj <| op (X.presheaf.obj <| op U)).presheaf.germ
@@ -661,7 +660,6 @@ theorem IsAffineOpen.isLocalization_stalk_aux' {X : Scheme} {U : Opens X} (hU :
   rw [Category.id_comp]
   rfl
 
-set_option maxHeartbeats 500000 in
 theorem IsAffineOpen.isLocalization_stalk' {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
     (y : PrimeSpectrum (X.presheaf.obj <| op U)) (hy : hU.fromSpec.1.base y ∈ U) :
   haveI : IsAffine _ := hU
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -268,7 +268,10 @@ theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : Is
     fun hU => hU.imageIsOpenImmersion f⟩
   · rw [Scheme.comp_val_base, coe_comp, Set.range_comp]
     dsimp [Opens.inclusion]
-    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_coe, Subtype.range_coe]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    rw [Subtype.range_coe]; erw [Subtype.range_coe]
     rfl
   · infer_instance
 #align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -268,10 +268,7 @@ theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : Is
     fun hU => hU.imageIsOpenImmersion f⟩
   · rw [Scheme.comp_val_base, coe_comp, Set.range_comp]
     dsimp [Opens.inclusion]
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    rw [Subtype.range_coe]; erw [Subtype.range_coe]
+    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_coe, Subtype.range_coe]
     rfl
   · infer_instance
 #align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
chore: bump toolchain to v4.2.0-rc2 (#7703)

This includes all the changes from #7606.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -268,7 +268,10 @@ theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : Is
     fun hU => hU.imageIsOpenImmersion f⟩
   · rw [Scheme.comp_val_base, coe_comp, Set.range_comp]
     dsimp [Opens.inclusion]
-    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_coe, Subtype.range_coe]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    rw [Subtype.range_coe]; erw [Subtype.range_coe]
     rfl
   · infer_instance
 #align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
chore: Make Set/Finset lemmas match lattice lemma names (#7378)

Rename union_eq_left_iff_subset to union_eq_left to match sup_eq_left. Similarly for the right and inter versions.

Diff
@@ -356,7 +356,7 @@ theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X} (hU : IsAffine
   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]
+    rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, hU.fromSpec_range]
     exact Scheme.basicOpen_le _ _
   rw [Scheme.Hom.opensRange_coe, Scheme.comp_val_base, ← this, coe_comp, Set.range_comp]
   -- Porting note : `congr 1` did not work
@@ -745,7 +745,7 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X}
     apply_fun Set.image hU.fromSpec.1.base at h
     rw [Set.image_preimage_eq_inter_range, Set.image_preimage_eq_inter_range, hU.fromSpec_range]
       at h
-    simp only [Set.inter_self, Opens.carrier_eq_coe, Set.inter_eq_right_iff_subset] at h
+    simp only [Set.inter_self, Opens.carrier_eq_coe, Set.inter_eq_right] at h
     ext1
     refine' Set.Subset.antisymm _ h
     simp only [Set.iUnion_subset_iff, SetCoe.forall, Opens.coe_iSup]
chore: move (locally) ringed spaces out of AlgebraicGeometry (#7330)

Create new folder Geometry.RingedSpace for (locally) ringed spaces and move about half of the contents of AlgebraicGeometry there. Files renamed:

AlgebraicGeometry.OpenImmersion.Scheme → AlgebraicGeometry.OpenImmersion
AlgebraicGeometry.RingedSpace → Geometry.RingedSpace.Basic
AlgebraicGeometry.LocallyRingedSpace → Geometry.RingedSpace.LocallyRingedSpace
AlgebraicGeometry.LocallyRingedSpace.HasColimits → Geometry.RingedSpace.LocallyRingedSpace.HasColimits
AlgebraicGeometry.OpenImmersion.Basic → Geometry.RingedSpace.OpenImmersion
AlgebraicGeometry.PresheafedSpace → Geometry.RingedSpace.PresheafedSpace
AlgebraicGeometry.PresheafedSpace.Gluing → Geometry.RingedSpace.PresheafedSpace.Gluing
AlgebraicGeometry.PresheafedSpace.HasColimits → Geometry.RingedSpace.PresheafedSpace.HasColimits
AlgebraicGeometry.SheafedSpace → Geometry.RingedSpace.SheafedSpace
AlgebraicGeometry.Stalks → Geometry.RingedSpace.Stalks

See Zulip.

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
 import Mathlib.AlgebraicGeometry.GammaSpecAdjunction
-import Mathlib.AlgebraicGeometry.OpenImmersion.Scheme
+import Mathlib.AlgebraicGeometry.OpenImmersion
 import Mathlib.CategoryTheory.Limits.Opposites
 import Mathlib.RingTheory.Localization.InvSubmonoid
 
perf (AlgebraicGeometry): tricks to mildly improve performance (#7306)

These changes mildly improve performance. They are put in place until AlgebraicGeometry is refactored.

Diff
@@ -519,7 +519,8 @@ theorem isLocalization_basicOpen {X : Scheme} {U : Opens X} (hU : IsAffineOpen U
   -- 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`
   simp only [←Category.assoc]
-  rw [hU.fromSpec.val.c.naturality, hU.fromSpec_app_eq]
+  -- Note: changed `rw` to `simp_rw` to improve performance
+  simp_rw [hU.fromSpec.val.c.naturality, hU.fromSpec_app_eq]
   -- simp only [Category.assoc]
   -- rw [hU.fromSpec_app_eq]
   dsimp
chore: update/remove heart beat bumps (#6860)

We clean up heart beat bumps after #6474.

Diff
@@ -498,7 +498,7 @@ instance basicOpenSectionsToAffine_isIso {X : Scheme} {U : Opens X} (hU : IsAffi
     rw [hU.fromSpec_range]
     exact RingedSpace.basicOpen_le _ _
 
-set_option maxHeartbeats 310000 in
+set_option maxHeartbeats 300000 in
 theorem isLocalization_basicOpen {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
     (f : X.presheaf.obj (op U)) : IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
   apply
@@ -626,7 +626,7 @@ theorem IsAffineOpen.isLocalization_stalk_aux {X : Scheme} (U : Opens X)
   rw [eqToHom_trans]
 #align algebraic_geometry.is_affine_open.is_localization_stalk_aux AlgebraicGeometry.IsAffineOpen.isLocalization_stalk_aux
 
-set_option maxHeartbeats 3200000 in
+set_option maxHeartbeats 1600000 in
 theorem IsAffineOpen.isLocalization_stalk_aux' {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
     (y : PrimeSpectrum (X.presheaf.obj <| op U)) (hy : hU.fromSpec.1.base y ∈ U) :
     hU.fromSpec.val.c.app (op U) ≫ (Scheme.Spec.obj <| op (X.presheaf.obj <| op U)).presheaf.germ
@@ -657,7 +657,7 @@ theorem IsAffineOpen.isLocalization_stalk_aux' {X : Scheme} {U : Opens X} (hU :
   rw [Category.id_comp]
   rfl
 
-set_option maxHeartbeats 800000 in
+set_option maxHeartbeats 500000 in
 theorem IsAffineOpen.isLocalization_stalk' {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
     (y : PrimeSpectrum (X.presheaf.obj <| op U)) (hy : hU.fromSpec.1.base y ∈ U) :
   haveI : IsAffine _ := hU
chore: remove unused simps (#6632)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -220,7 +220,7 @@ def IsAffineOpen.fromSpec {X : Scheme} {U : Opens X} (hU : IsAffineOpen U) :
 
 instance IsAffineOpen.isOpenImmersion_fromSpec {X : Scheme} {U : Opens X}
     (hU : IsAffineOpen U) : IsOpenImmersion hU.fromSpec := by
-  delta IsAffineOpen.fromSpec; dsimp; simp only [Scheme.comp_val]
+  delta IsAffineOpen.fromSpec; dsimp
   -- Porting note : this was automatic
   repeat apply (config := { allowSynthFailures := true }) PresheafedSpace.IsOpenImmersion.comp
 #align algebraic_geometry.is_affine_open.is_open_immersion_from_Spec AlgebraicGeometry.IsAffineOpen.isOpenImmersion_fromSpec
chore: fix grammar mistakes (#6121)
Diff
@@ -695,7 +695,7 @@ theorem IsAffineOpen.isLocalization_stalk {X : Scheme} {U : Opens X} (hU : IsAff
   convert hU.isLocalization_stalk' y hx
 #align algebraic_geometry.is_affine_open.is_localization_stalk AlgebraicGeometry.IsAffineOpen.isLocalization_stalk
 
-/-- The basic open set of a section `f` on an an affine open as an `X.affineOpens`. -/
+/-- The basic open set of a section `f` on an affine open as an `X.affineOpens`. -/
 @[simps]
 def Scheme.affineBasicOpen (X : Scheme) {U : X.affineOpens} (f : X.presheaf.obj <| op U) :
     X.affineOpens :=
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
-
-! This file was ported from Lean 3 source module algebraic_geometry.AffineScheme
-! leanprover-community/mathlib commit 88474d1b5af6d37c2ab728b757771bced7f5194c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.AlgebraicGeometry.GammaSpecAdjunction
 import Mathlib.AlgebraicGeometry.OpenImmersion.Scheme
 import Mathlib.CategoryTheory.Limits.Opposites
 import Mathlib.RingTheory.Localization.InvSubmonoid
 
+#align_import algebraic_geometry.AffineScheme from "leanprover-community/mathlib"@"88474d1b5af6d37c2ab728b757771bced7f5194c"
+
 /-!
 # Affine schemes
 
chore: fix focusing dots (#5708)

This PR is the result of running

find . -type f -name "*.lean" -exec sed -i -E 's/^( +)\. /\1· /' {} \;
find . -type f -name "*.lean" -exec sed -i -E 'N;s/^( +·)\n +(.*)$/\1 \2/;P;D' {} \;

which firstly replaces . focusing dots with · and secondly removes isolated instances of such dots, unifying them with the following line. A new rule is placed in the style linter to verify this.

Diff
@@ -273,7 +273,7 @@ theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : Is
     dsimp [Opens.inclusion]
     rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_coe, Subtype.range_coe]
     rfl
-  . infer_instance
+  · infer_instance
 #align algebraic_geometry.is_affine_open_iff_of_is_open_immersion AlgebraicGeometry.isAffineOpen_iff_of_isOpenImmersion
 
 instance Scheme.quasi_compact_of_affine (X : Scheme) [IsAffine X] : CompactSpace X :=
@@ -349,7 +349,7 @@ theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X} (hU : IsAffine
     Scheme.Spec.map
       (CommRingCat.ofHom (algebraMap ((X.presheaf.obj <| op U)) (Localization.Away f))).op ≫
     hU.fromSpec
-  . exact PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := inferInstance)
+  · exact PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := inferInstance)
   convert
     rangeIsAffineOpenOfOpenImmersion
       (Scheme.Spec.map
@@ -406,7 +406,7 @@ theorem Scheme.map_PrimeSpectrum_basicOpen_of_affine (X : Scheme) [IsAffine X]
       ((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)))
-  . congr
+  · congr
     · rw [← IsIso.inv_eq_inv, IsIso.inv_inv, IsIso.Iso.inv_inv, NatIso.app_hom]
       -- Porting note : added this `change` to prevent timeout
       change SpecΓIdentity.hom.app (X.presheaf.obj <| op ⊤) = _
chore: tidy various files (#5628)
Diff
@@ -261,7 +261,6 @@ theorem IsAffineOpen.imageIsOpenImmersion {X Y : Scheme} {U : Opens X} (hU : IsA
   exact Set.image_eq_range _ _
 #align algebraic_geometry.is_affine_open.image_is_open_immersion AlgebraicGeometry.IsAffineOpen.imageIsOpenImmersion
 
-set_option maxHeartbeats 0 in
 theorem isAffineOpen_iff_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f]
     (U : Opens X) : IsAffineOpen (H.openFunctor.obj U) ↔ IsAffineOpen U := by
   -- Porting note : add this instance explicitly
@@ -364,7 +363,7 @@ theorem IsAffineOpen.basicOpenIsAffine {X : Scheme} {U : Opens X} (hU : IsAffine
     exact Scheme.basicOpen_le _ _
   rw [Scheme.Hom.opensRange_coe, Scheme.comp_val_base, ← this, coe_comp, Set.range_comp]
   -- Porting note : `congr 1` did not work
-  apply congr_arg (_ '' .)
+  apply congr_arg (_ '' ·)
   refine' (Opens.coe_inj.mpr <| Scheme.preimage_basicOpen hU.fromSpec f).trans _
   refine' Eq.trans _ (PrimeSpectrum.localization_away_comap_range (Localization.Away f) f).symm
   congr 1
@@ -474,7 +473,7 @@ theorem IsAffineOpen.opens_map_fromSpec_basicOpen {X : Scheme} {U : Opens X}
       (Scheme.Spec.obj <| op <| X.presheaf.obj (op U)).toLocallyRingedSpace.toRingedSpace
       (eqToHom hU.fromSpec_base_preimage).op _)
   -- Porting note : `congr` does not work
-  refine congr_arg (RingedSpace.basicOpen _ .) ?_
+  refine congr_arg (RingedSpace.basicOpen _ ·) ?_
   -- Porting note : change `rw` to `erw`
   erw [← comp_apply]
   congr
@@ -699,7 +698,7 @@ theorem IsAffineOpen.isLocalization_stalk {X : Scheme} {U : Opens X} (hU : IsAff
   convert hU.isLocalization_stalk' y hx
 #align algebraic_geometry.is_affine_open.is_localization_stalk AlgebraicGeometry.IsAffineOpen.isLocalization_stalk
 
-/-- The basic open set of a section `f` on an an affine open as an `X.affine_opens`. -/
+/-- The basic open set of a section `f` on an an affine open as an `X.affineOpens`. -/
 @[simps]
 def Scheme.affineBasicOpen (X : Scheme) {U : X.affineOpens} (f : X.presheaf.obj <| op U) :
     X.affineOpens :=
@@ -758,7 +757,7 @@ theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X}
     -- Porting note : need an extra rewrite here, after simp, it is in `↔` form
     rw [iff_iff_eq]
     congr 3
-    · refine congr_arg (Set.iUnion .) ?_
+    · refine congr_arg (Set.iUnion ·) ?_
       ext1 x
       exact congr_arg Opens.carrier (hU.fromSpec_map_basicOpen _)
     · exact congr_arg Opens.carrier hU.fromSpec_base_preimage
fix: precedences of ⨆⋃⋂⨅ (#5614)
Diff
@@ -738,8 +738,8 @@ theorem IsAffineOpen.fromSpec_map_basicOpen {X : Scheme} {U : Opens X} (hU : IsA
 
 theorem IsAffineOpen.basicOpen_union_eq_self_iff {X : Scheme} {U : Opens X}
     (hU : IsAffineOpen U) (s : Set (X.presheaf.obj <| op U)) :
-    (⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U)) = U ↔ Ideal.span s = ⊤ := by
-  trans (⋃ i : s, (PrimeSpectrum.basicOpen i.1).1) = Set.univ
+    ⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U) = U ↔ Ideal.span s = ⊤ := by
+  trans ⋃ i : s, (PrimeSpectrum.basicOpen i.1).1 = Set.univ
   trans
     hU.fromSpec.1.base ⁻¹' (⨆ f : s, X.basicOpen (f : X.presheaf.obj <| op U)).1 =
       hU.fromSpec.1.base ⁻¹' U.1
chore: reorder universes in ConcreteCategory (#5605)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -630,7 +630,7 @@ theorem IsAffineOpen.isLocalization_stalk_aux {X : Scheme} (U : Opens X)
   rw [eqToHom_trans]
 #align algebraic_geometry.is_affine_open.is_localization_stalk_aux AlgebraicGeometry.IsAffineOpen.isLocalization_stalk_aux
 
-set_option maxHeartbeats 1643256 in
+set_option maxHeartbeats 3200000 in
 theorem IsAffineOpen.isLocalization_stalk_aux' {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
     (y : PrimeSpectrum (X.presheaf.obj <| op U)) (hy : hU.fromSpec.1.base y ∈ U) :
     hU.fromSpec.val.c.app (op U) ≫ (Scheme.Spec.obj <| op (X.presheaf.obj <| op U)).presheaf.germ
@@ -661,7 +661,7 @@ theorem IsAffineOpen.isLocalization_stalk_aux' {X : Scheme} {U : Opens X} (hU :
   rw [Category.id_comp]
   rfl
 
-set_option maxHeartbeats 420000 in
+set_option maxHeartbeats 800000 in
 theorem IsAffineOpen.isLocalization_stalk' {X : Scheme} {U : Opens X} (hU : IsAffineOpen U)
     (y : PrimeSpectrum (X.presheaf.obj <| op U)) (hy : hU.fromSpec.1.base y ∈ U) :
   haveI : IsAffine _ := hU
feat: port AlgebraicGeometry.AffineScheme (#5394)

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Dependencies 11 + 919

920 files ported (98.8%)
381037 lines ported (98.6%)
Show graph

The unported dependencies are