algebraic_geometry.open_immersion.SchemeMathlib.AlgebraicGeometry.OpenImmersion

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)

(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
@@ -493,7 +493,7 @@ theorem AlgebraicGeometry.isIso_iff_isOpenImmersionCat {X Y : Scheme} (f : X ⟶
 theorem AlgebraicGeometry.isIso_iff_stalk_iso {X Y : Scheme} (f : X ⟶ Y) :
     IsIso f ↔ IsIso f.1.base ∧ ∀ x, IsIso (PresheafedSpace.stalkMap f.1 x) :=
   by
-  rw [is_iso_iff_is_open_immersion, is_open_immersion.iff_stalk_iso, and_comm', ← and_assoc']
+  rw [is_iso_iff_is_open_immersion, is_open_immersion.iff_stalk_iso, and_comm, ← and_assoc]
   refine' and_congr ⟨_, _⟩ Iff.rfl
   · rintro ⟨h₁, h₂⟩
     convert_to
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2021 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import AlgebraicGeometry.OpenImmersion.Basic
+import Geometry.RingedSpace.OpenImmersion
 import AlgebraicGeometry.Scheme
 import CategoryTheory.Limits.Shapes.CommSq
 
Diff
@@ -297,7 +297,7 @@ theorem affineBasisCover_is_basis (X : Scheme) :
   · rintro a U haU hU
     rcases X.affine_cover.covers a with ⟨x, e⟩
     let U' := (X.affine_cover.map (X.affine_cover.f a)).1.base ⁻¹' U
-    have hxU' : x ∈ U' := by rw [← e] at haU ; exact haU
+    have hxU' : x ∈ U' := by rw [← e] at haU; exact haU
     rcases prime_spectrum.is_basis_basic_opens.exists_subset_of_mem_open hxU'
         ((X.affine_cover.map (X.affine_cover.f a)).1.base.continuous_toFun.isOpen_preimage _
           hU) with
@@ -323,7 +323,7 @@ def OpenCover.finiteSubcover {X : Scheme} (𝒰 : OpenCover X) [H : CompactSpace
     by
     intro x
     have h' : x ∈ (⊤ : Set X.carrier) := trivial
-    rw [← Classical.choose_spec this, Set.mem_iUnion] at h' 
+    rw [← Classical.choose_spec this, Set.mem_iUnion] at h'
     rcases h' with ⟨y, _, ⟨hy, rfl⟩, hy'⟩
     exact ⟨⟨y, hy⟩, hy'⟩
   exact
@@ -581,7 +581,7 @@ instance hasPullback_of_right : HasPullback g f :=
 instance pullback_snd_of_left : IsOpenImmersionCat (pullback.snd : pullback f g ⟶ _) :=
   by
   have := preserves_pullback.iso_hom_snd forget f g
-  dsimp only [Scheme.forget_to_LocallyRingedSpace, induced_functor_map] at this 
+  dsimp only [Scheme.forget_to_LocallyRingedSpace, induced_functor_map] at this
   rw [← this]
   change LocallyRingedSpace.is_open_immersion _
   infer_instance
@@ -756,7 +756,7 @@ theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
   by
   have e := Scheme.preimage_basic_open f (f.inv_app U r)
   rw [Scheme.hom.inv_app, PresheafedSpace.is_open_immersion.inv_app_app_apply,
-    Scheme.basic_open_res, inf_eq_right.mpr _] at e 
+    Scheme.basic_open_res, inf_eq_right.mpr _] at e
   rw [← e]
   ext1
   refine' set.image_preimage_eq_inter_range.trans _
@@ -848,14 +848,14 @@ theorem Scheme.restrictFunctor_map_app {U V : Opens X.carrier} (i : U ⟶ V) (W
   have e₁ :=
     Scheme.congr_app (X.restrict_functor_map_of_restrict i)
       (op <| V.open_embedding.is_open_map.functor.obj W)
-  rw [Scheme.comp_val_c_app] at e₁ 
+  rw [Scheme.comp_val_c_app] at e₁
   have e₂ := (X.restrict_functor.map i).1.val.c.naturality (eq_to_hom W.map_functor_eq).op
-  rw [← is_iso.eq_inv_comp] at e₂ 
+  rw [← is_iso.eq_inv_comp] at e₂
   dsimp at e₁ e₂ ⊢
   rw [e₂, W.adjunction_counit_map_functor, ← is_iso.eq_inv_comp, is_iso.inv_comp_eq, ←
-    is_iso.eq_comp_inv] at e₁ 
+    is_iso.eq_comp_inv] at e₁
   simp_rw [eq_to_hom_map (opens.map _), eq_to_hom_map (IsOpenMap.functor _), ← functor.map_inv, ←
-    functor.map_comp] at e₁ 
+    functor.map_comp] at e₁
   rw [e₁]
   congr 1
 #align algebraic_geometry.Scheme.restrict_functor_map_app AlgebraicGeometry.Scheme.restrictFunctor_map_app
@@ -1128,13 +1128,13 @@ theorem morphismRestrict_c_app {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier
   by
   have :=
     Scheme.congr_app (morphism_restrict_ι f U) (op (U.open_embedding.is_open_map.functor.obj V))
-  rw [Scheme.comp_val_c_app, Scheme.comp_val_c_app_assoc] at this 
+  rw [Scheme.comp_val_c_app, Scheme.comp_val_c_app_assoc] at this
   have e : (opens.map U.inclusion).obj (U.open_embedding.is_open_map.functor.obj V) = V := by ext1;
     exact Set.preimage_image_eq _ Subtype.coe_injective
   have : _ ≫ X.presheaf.map _ = _ :=
     (((f ∣_ U).1.c.naturality (eq_to_hom e).op).symm.trans _).trans this
   swap; · change Y.presheaf.map _ ≫ _ = Y.presheaf.map _ ≫ _; congr
-  rw [← is_iso.eq_comp_inv, ← functor.map_inv, category.assoc] at this 
+  rw [← is_iso.eq_comp_inv, ← functor.map_inv, category.assoc] at this
   rw [this]
   congr 1
   erw [← X.presheaf.map_comp, ← X.presheaf.map_comp]
@@ -1227,7 +1227,7 @@ def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.
   by
   refine' morphism_restrict_restrict _ _ _ ≪≫ morphism_restrict_eq _ _
   have e := Scheme.preimage_basic_open (Y.of_restrict U.open_embedding) r
-  erw [Scheme.of_restrict_val_c_app, opens.adjunction_counit_app_self, eq_to_hom_op] at e 
+  erw [Scheme.of_restrict_val_c_app, opens.adjunction_counit_app_self, eq_to_hom_op] at e
   rw [← (Y.restrict U.open_embedding).basicOpen_res_eq _ (eq_to_hom U.inclusion_map_eq_top).op, ←
     comp_apply]
   erw [← Y.presheaf.map_comp]
Diff
@@ -291,7 +291,7 @@ theorem affineBasisCover_is_basis (X : Scheme) :
       {x : Set X.carrier |
         ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} :=
   by
-  apply TopologicalSpace.isTopologicalBasis_of_open_of_nhds
+  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
   · rintro _ ⟨a, rfl⟩
     exact is_open_immersion.open_range (X.affine_basis_cover.map a)
   · rintro a U haU hU
Diff
@@ -760,7 +760,7 @@ theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f]
   rw [← e]
   ext1
   refine' set.image_preimage_eq_inter_range.trans _
-  erw [Set.inter_eq_left_iff_subset]
+  erw [Set.inter_eq_left]
   refine' Set.Subset.trans (Scheme.basic_open_le _ _) (Set.image_subset_range _ _)
   refine' le_trans (Scheme.basic_open_le _ _) (le_of_eq _)
   ext1
@@ -1234,7 +1234,7 @@ def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.
   rw [eq_to_hom_op, eq_to_hom_op, eq_to_hom_map, eq_to_hom_trans]
   erw [← e]
   ext1; dsimp [opens.map, opens.inclusion]
-  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left_iff_subset, Subtype.range_coe]
+  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, Subtype.range_coe]
   exact Y.basic_open_le r
 #align algebraic_geometry.morphism_restrict_restrict_basic_open AlgebraicGeometry.morphismRestrictRestrictBasicOpen
 -/
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2021 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathbin.AlgebraicGeometry.OpenImmersion.Basic
-import Mathbin.AlgebraicGeometry.Scheme
-import Mathbin.CategoryTheory.Limits.Shapes.CommSq
+import AlgebraicGeometry.OpenImmersion.Basic
+import AlgebraicGeometry.Scheme
+import CategoryTheory.Limits.Shapes.CommSq
 
 #align_import algebraic_geometry.open_immersion.Scheme from "leanprover-community/mathlib"@"5d0c76894ada7940957143163d7b921345474cbc"
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2021 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.open_immersion.Scheme
-! leanprover-community/mathlib commit 5d0c76894ada7940957143163d7b921345474cbc
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.AlgebraicGeometry.OpenImmersion.Basic
 import Mathbin.AlgebraicGeometry.Scheme
 import Mathbin.CategoryTheory.Limits.Shapes.CommSq
 
+#align_import algebraic_geometry.open_immersion.Scheme from "leanprover-community/mathlib"@"5d0c76894ada7940957143163d7b921345474cbc"
+
 /-!
 # Open immersions of 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.open_immersion.Scheme
-! leanprover-community/mathlib commit 533f62f4dd62a5aad24a04326e6e787c8f7e98b1
+! leanprover-community/mathlib commit 5d0c76894ada7940957143163d7b921345474cbc
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.CategoryTheory.Limits.Shapes.CommSq
 /-!
 # Open immersions of schemes
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 -/
 
 
Diff
@@ -33,12 +33,15 @@ variable {C : Type u} [Category.{v} C]
 /-- A morphism of Schemes is an open immersion if it is an open immersion as a morphism
 of LocallyRingedSpaces
 -/
-abbrev IsOpenImmersion {X Y : Scheme} (f : X ⟶ Y) : Prop :=
+abbrev IsOpenImmersionCat {X Y : Scheme} (f : X ⟶ Y) : Prop :=
   LocallyRingedSpace.IsOpenImmersion f
-#align algebraic_geometry.is_open_immersion AlgebraicGeometry.IsOpenImmersion
+#align algebraic_geometry.is_open_immersion AlgebraicGeometry.IsOpenImmersionCat
 
 namespace LocallyRingedSpace.IsOpenImmersion
 
+/- warning: algebraic_geometry.LocallyRingedSpace.is_open_immersion.Scheme clashes with algebraic_geometry.LocallyRingedSpace.IsOpenImmersion.Scheme -> AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.scheme
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.LocallyRingedSpace.is_open_immersion.Scheme AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.schemeₓ'. -/
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.scheme /-
 /-- To show that a locally ringed space is a scheme, it suffices to show that it has a jointly
 surjective family of open immersions from affine schemes. -/
 protected def scheme (X : LocallyRingedSpace)
@@ -59,18 +62,20 @@ protected def scheme (X : LocallyRingedSpace)
     · exact Subtype.range_coe_subtype
     · infer_instance
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.Scheme AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.scheme
+-/
 
 end LocallyRingedSpace.IsOpenImmersion
 
-theorem IsOpenImmersion.open_range {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] :
+theorem IsOpenImmersionCat.open_range {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f] :
     IsOpen (Set.range f.1.base) :=
   H.base_open.open_range
-#align algebraic_geometry.is_open_immersion.open_range AlgebraicGeometry.IsOpenImmersion.open_range
+#align algebraic_geometry.is_open_immersion.open_range AlgebraicGeometry.IsOpenImmersionCat.open_range
 
 section OpenCover
 
 namespace Scheme
 
+#print AlgebraicGeometry.Scheme.OpenCover /-
 -- TODO: provide API to and from a presieve.
 /-- An open cover of `X` consists of a family of open immersions into `X`,
 and for each `x : X` an open immersion (indexed by `f x`) that covers `x`.
@@ -87,8 +92,9 @@ structure OpenCover (X : Scheme.{u}) where
   map : ∀ j : J, obj j ⟶ X
   f : X.carrier → J
   Covers : ∀ x, x ∈ Set.range (map (f x)).1.base
-  IsOpen : ∀ x, IsOpenImmersion (map x) := by infer_instance
+  IsOpen : ∀ x, IsOpenImmersionCat (map x) := by infer_instance
 #align algebraic_geometry.Scheme.open_cover AlgebraicGeometry.Scheme.OpenCover
+-/
 
 attribute [instance] open_cover.is_open
 
@@ -96,6 +102,7 @@ variable {X Y Z : Scheme.{u}} (𝒰 : OpenCover X) (f : X ⟶ Z) (g : Y ⟶ Z)
 
 variable [∀ x, HasPullback (𝒰.map x ≫ f) g]
 
+#print AlgebraicGeometry.Scheme.affineCover /-
 /-- The affine cover of a scheme. -/
 def affineCover (X : Scheme) : OpenCover X
     where
@@ -119,10 +126,12 @@ def affineCover (X : Scheme) : OpenCover X
     change epi ((SheafedSpace.forget _).map (LocallyRingedSpace.forget_to_SheafedSpace.map _))
     infer_instance
 #align algebraic_geometry.Scheme.affine_cover AlgebraicGeometry.Scheme.affineCover
+-/
 
 instance : Inhabited X.OpenCover :=
   ⟨X.affineCover⟩
 
+#print AlgebraicGeometry.Scheme.OpenCover.bind /-
 /-- Given an open cover `{ Uᵢ }` of `X`, and for each `Uᵢ` an open cover, we may combine these
 open covers to form an open cover of `X`.  -/
 @[simps J obj map]
@@ -141,7 +150,9 @@ def OpenCover.bind (f : ∀ x : 𝒰.J, OpenCover (𝒰.obj x)) : OpenCover X
     erw [comp_apply]
     rw [hz, hy]
 #align algebraic_geometry.Scheme.open_cover.bind AlgebraicGeometry.Scheme.OpenCover.bind
+-/
 
+#print AlgebraicGeometry.Scheme.openCoverOfIsIso /-
 /-- An isomorphism `X ⟶ Y` is an open cover of `Y`. -/
 @[simps J obj map]
 def openCoverOfIsIso {X Y : Scheme.{u}} (f : X ⟶ Y) [IsIso f] : OpenCover Y
@@ -154,7 +165,9 @@ def openCoverOfIsIso {X Y : Scheme.{u}} (f : X ⟶ Y) [IsIso f] : OpenCover Y
     rw [set.range_iff_surjective.mpr]; · trivial; rw [← TopCat.epi_iff_surjective]
     infer_instance
 #align algebraic_geometry.Scheme.open_cover_of_is_iso AlgebraicGeometry.Scheme.openCoverOfIsIso
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.copy /-
 /-- We construct an open cover from another, by providing the needed fields and showing that the
 provided fields are isomorphic with the original open cover. -/
 @[simps J obj map]
@@ -173,7 +186,9 @@ def OpenCover.copy {X : Scheme} (𝒰 : OpenCover X) (J : Type _) (obj : J → S
       · rw [← TopCat.epi_iff_surjective]; infer_instance
     IsOpen := fun i => by rw [e₂]; infer_instance }
 #align algebraic_geometry.Scheme.open_cover.copy AlgebraicGeometry.Scheme.OpenCover.copy
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.pushforwardIso /-
 /-- The pushforward of an open cover along an isomorphism. -/
 @[simps J obj map]
 def OpenCover.pushforwardIso {X Y : Scheme} (𝒰 : OpenCover X) (f : X ⟶ Y) [IsIso f] : OpenCover Y :=
@@ -181,10 +196,12 @@ def OpenCover.pushforwardIso {X Y : Scheme} (𝒰 : OpenCover X) (f : X ⟶ Y) [
     ((Equiv.punitProd _).symm.trans (Equiv.sigmaEquivProd PUnit 𝒰.J).symm) (fun _ => Iso.refl _)
     fun _ => (Category.id_comp _).symm
 #align algebraic_geometry.Scheme.open_cover.pushforward_iso AlgebraicGeometry.Scheme.OpenCover.pushforwardIso
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.add /-
 /-- Adding an open immersion into an open cover gives another open cover. -/
 @[simps]
-def OpenCover.add {X : Scheme} (𝒰 : X.OpenCover) {Y : Scheme} (f : Y ⟶ X) [IsOpenImmersion f] :
+def OpenCover.add {X : Scheme} (𝒰 : X.OpenCover) {Y : Scheme} (f : Y ⟶ X) [IsOpenImmersionCat f] :
     X.OpenCover where
   J := Option 𝒰.J
   obj i := Option.rec Y 𝒰.obj i
@@ -193,18 +210,21 @@ def OpenCover.add {X : Scheme} (𝒰 : X.OpenCover) {Y : Scheme} (f : Y ⟶ X) [
   Covers := 𝒰.Covers
   IsOpen := by rintro (_ | _) <;> dsimp <;> infer_instance
 #align algebraic_geometry.Scheme.open_cover.add AlgebraicGeometry.Scheme.OpenCover.add
+-/
 
 -- Related result : `open_cover.pullback_cover`, where we pullback an open cover on `X` along a
 -- morphism `W ⟶ X`. This is provided at the end of the file since it needs some more results
 -- about open immersion (which in turn needs the open cover API).
 attribute [local reducible] CommRingCat.of CommRingCat.ofHom
 
+#print AlgebraicGeometry.Scheme.val_base_isIso /-
 instance val_base_isIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] : IsIso f.1.base :=
   Scheme.forgetToTop.map_isIso f
 #align algebraic_geometry.Scheme.val_base_is_iso AlgebraicGeometry.Scheme.val_base_isIso
+-/
 
-instance basic_open_isOpenImmersion {R : CommRingCat} (f : R) :
-    AlgebraicGeometry.IsOpenImmersion
+instance basic_open_isOpenImmersionCat {R : CommRingCat} (f : R) :
+    AlgebraicGeometry.IsOpenImmersionCat
       (Scheme.Spec.map (CommRingCat.ofHom (algebraMap R (Localization.Away f))).op) :=
   by
   apply (config := { instances := false }) SheafedSpace.is_open_immersion.of_stalk_iso
@@ -213,8 +233,9 @@ instance basic_open_isOpenImmersion {R : CommRingCat} (f : R) :
   exact (PrimeSpectrum.localization_away_openEmbedding (Localization.Away f) f : _)
   intro x
   exact Spec_map_localization_is_iso R (Submonoid.powers f) x
-#align algebraic_geometry.Scheme.basic_open_is_open_immersion AlgebraicGeometry.Scheme.basic_open_isOpenImmersion
+#align algebraic_geometry.Scheme.basic_open_is_open_immersion AlgebraicGeometry.Scheme.basic_open_isOpenImmersionCat
 
+#print AlgebraicGeometry.Scheme.affineBasisCoverOfAffine /-
 /-- The basic open sets form an affine open cover of `Spec R`. -/
 def affineBasisCoverOfAffine (R : CommRingCat) : OpenCover (Spec.obj (Opposite.op R))
     where
@@ -226,25 +247,33 @@ def affineBasisCoverOfAffine (R : CommRingCat) : OpenCover (Spec.obj (Opposite.o
     rw [set.range_iff_surjective.mpr ((TopCat.epi_iff_surjective _).mp _)]
     · exact trivial
     · infer_instance
-  IsOpen x := AlgebraicGeometry.Scheme.basic_open_isOpenImmersion x
+  IsOpen x := AlgebraicGeometry.Scheme.basic_open_isOpenImmersionCat x
 #align algebraic_geometry.Scheme.affine_basis_cover_of_affine AlgebraicGeometry.Scheme.affineBasisCoverOfAffine
+-/
 
+#print AlgebraicGeometry.Scheme.affineBasisCover /-
 /-- We may bind the basic open sets of an open affine cover to form a affine cover that is also
 a basis. -/
 def affineBasisCover (X : Scheme) : OpenCover X :=
   X.affineCover.bind fun x => affineBasisCoverOfAffine _
 #align algebraic_geometry.Scheme.affine_basis_cover AlgebraicGeometry.Scheme.affineBasisCover
+-/
 
+#print AlgebraicGeometry.Scheme.affineBasisCoverRing /-
 /-- The coordinate ring of a component in the `affine_basis_cover`. -/
 def affineBasisCoverRing (X : Scheme) (i : X.affineBasisCover.J) : CommRingCat :=
   CommRingCat.of <| @Localization.Away (X.local_affine i.1).choose_spec.some _ i.2
 #align algebraic_geometry.Scheme.affine_basis_cover_ring AlgebraicGeometry.Scheme.affineBasisCoverRing
+-/
 
+#print AlgebraicGeometry.Scheme.affineBasisCover_obj /-
 theorem affineBasisCover_obj (X : Scheme) (i : X.affineBasisCover.J) :
     X.affineBasisCover.obj i = Spec.obj (op <| X.affineBasisCoverRing i) :=
   rfl
 #align algebraic_geometry.Scheme.affine_basis_cover_obj AlgebraicGeometry.Scheme.affineBasisCover_obj
+-/
 
+#print AlgebraicGeometry.Scheme.affineBasisCover_map_range /-
 theorem affineBasisCover_map_range (X : Scheme) (x : X.carrier)
     (r : (X.local_affine x).choose_spec.some) :
     Set.range (X.affineBasisCover.map ⟨x, r⟩).1.base =
@@ -254,7 +283,9 @@ theorem affineBasisCover_map_range (X : Scheme) (x : X.carrier)
   congr
   exact (PrimeSpectrum.localization_away_comap_range (Localization.Away r) r : _)
 #align algebraic_geometry.Scheme.affine_basis_cover_map_range AlgebraicGeometry.Scheme.affineBasisCover_map_range
+-/
 
+#print AlgebraicGeometry.Scheme.affineBasisCover_is_basis /-
 theorem affineBasisCover_is_basis (X : Scheme) :
     TopologicalSpace.IsTopologicalBasis
       {x : Set X.carrier |
@@ -275,7 +306,9 @@ theorem affineBasisCover_is_basis (X : Scheme) :
     · exact ⟨x, hxV, e⟩
     · rw [Set.image_subset_iff]; exact hVU
 #align algebraic_geometry.Scheme.affine_basis_cover_is_basis AlgebraicGeometry.Scheme.affineBasisCover_is_basis
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.finiteSubcover /-
 /-- Every open cover of a quasi-compact scheme can be refined into a finite subcover.
 -/
 @[simps obj map]
@@ -300,6 +333,7 @@ def OpenCover.finiteSubcover {X : Scheme} (𝒰 : OpenCover X) [H : CompactSpace
       f := fun x => (h x).some
       Covers := fun x => (h x).choose_spec }
 #align algebraic_geometry.Scheme.open_cover.finite_subcover AlgebraicGeometry.Scheme.OpenCover.finiteSubcover
+-/
 
 instance [H : CompactSpace X.carrier] : Fintype 𝒰.finiteSubcover.J := by
   delta open_cover.finite_subcover; infer_instance
@@ -316,6 +350,9 @@ variable {X : PresheafedSpace.{u} CommRingCat.{u}} (Y : Scheme.{u})
 
 variable (f : X ⟶ Y.toPresheafedSpace) [H : PresheafedSpace.IsOpenImmersion f]
 
+/- warning: algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme clashes with algebraic_geometry.PresheafedSpace.IsOpenImmersion.to_Scheme -> AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeₓ'. -/
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme /-
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a scheme, then so is `X`. -/
 def toScheme : Scheme :=
   by
@@ -330,44 +367,70 @@ def toScheme : Scheme :=
   · rw [LocallyRingedSpace.is_open_immersion.lift_range]; exact hx
   · delta LocallyRingedSpace.is_open_immersion.lift; infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme
+-/
 
+/- warning: algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_to_LocallyRingedSpace clashes with algebraic_geometry.PresheafedSpace.IsOpenImmersion.to_Scheme_to_LocallyRingedSpace -> AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme_toLocallyRingedSpace
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_to_LocallyRingedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme_toLocallyRingedSpaceₓ'. -/
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme_toLocallyRingedSpace /-
 @[simp]
 theorem toScheme_toLocallyRingedSpace :
     (toScheme Y f).toLocallyRingedSpace = toLocallyRingedSpace Y.1 f :=
   rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_to_LocallyRingedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme_toLocallyRingedSpace
+-/
 
+/- warning: algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom clashes with algebraic_geometry.PresheafedSpace.IsOpenImmersion.to_Scheme_hom -> AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHomₓ'. -/
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom /-
 /-- If `X ⟶ Y` is an open immersion of PresheafedSpaces, and `Y` is a Scheme, we can
 upgrade it into a morphism of Schemes.
 -/
 def toSchemeHom : toScheme Y f ⟶ Y :=
   toLocallyRingedSpaceHom _ f
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom
+-/
 
+/- warning: algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_val clashes with algebraic_geometry.PresheafedSpace.IsOpenImmersion.to_Scheme_hom_val -> AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_val
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_val AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_valₓ'. -/
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_val /-
 @[simp]
 theorem toSchemeHom_val : (toSchemeHom Y f).val = f :=
   rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_val AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_val
+-/
 
-instance toSchemeHom_isOpenImmersion : IsOpenImmersion (toSchemeHom Y f) :=
+/- warning: algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_is_open_immersion clashes with algebraic_geometry.PresheafedSpace.IsOpenImmersion.to_Scheme_hom_IsOpenImmersion -> AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_isOpenImmersionₓ
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_isOpenImmersionₓₓ'. -/
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_isOpenImmersionₓ /-
+instance toSchemeHom_isOpenImmersion : IsOpenImmersionCat (toSchemeHom Y f) :=
   H
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_isOpenImmersionₓ
+-/
 
+/- warning: algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_eq_of_LocallyRingedSpace_eq clashes with algebraic_geometry.PresheafedSpace.IsOpenImmersion.Scheme_eq_of_LocallyRingedSpace_eq -> AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_eq_of_locallyRingedSpace_eq
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_eq_of_LocallyRingedSpace_eq AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_eq_of_locallyRingedSpace_eqₓ'. -/
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_eq_of_locallyRingedSpace_eq /-
 theorem scheme_eq_of_locallyRingedSpace_eq {X Y : Scheme}
     (H : X.toLocallyRingedSpace = Y.toLocallyRingedSpace) : X = Y := by cases X; cases Y; congr;
   exact H
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_eq_of_LocallyRingedSpace_eq AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_eq_of_locallyRingedSpace_eq
+-/
 
-theorem scheme_toScheme {X Y : Scheme} (f : X ⟶ Y) [IsOpenImmersion f] : toScheme Y f.1 = X :=
+/- warning: algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_to_Scheme clashes with algebraic_geometry.PresheafedSpace.IsOpenImmersion.Scheme_to_Scheme -> AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_toScheme
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_to_Scheme AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_toSchemeₓ'. -/
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_toScheme /-
+theorem scheme_toScheme {X Y : Scheme} (f : X ⟶ Y) [IsOpenImmersionCat f] : toScheme Y f.1 = X :=
   by
   apply Scheme_eq_of_LocallyRingedSpace_eq
   exact LocallyRingedSpace_to_LocallyRingedSpace f
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_to_Scheme AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_toScheme
+-/
 
 end ToScheme
 
 end PresheafedSpace.IsOpenImmersion
 
+#print AlgebraicGeometry.Scheme.restrict /-
 /-- The restriction of a Scheme along an open embedding. -/
 @[simps]
 def Scheme.restrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X.carrier} (h : OpenEmbedding f) :
@@ -375,52 +438,58 @@ def Scheme.restrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X.carrier} (h
   { PresheafedSpace.IsOpenImmersion.toScheme X (X.toPresheafedSpace.of_restrict h) with
     toPresheafedSpace := X.toPresheafedSpace.restrict h }
 #align algebraic_geometry.Scheme.restrict AlgebraicGeometry.Scheme.restrict
+-/
 
+/- warning: algebraic_geometry.Scheme.of_restrict clashes with algebraic_geometry.Scheme.ofRestrict -> AlgebraicGeometry.Scheme.ofRestrict
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.Scheme.of_restrict AlgebraicGeometry.Scheme.ofRestrictₓ'. -/
+#print AlgebraicGeometry.Scheme.ofRestrict /-
 /-- The canonical map from the restriction to the supspace. -/
 @[simps]
 def Scheme.ofRestrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X.carrier}
     (h : OpenEmbedding f) : X.restrict h ⟶ X :=
   X.toLocallyRingedSpace.of_restrict h
 #align algebraic_geometry.Scheme.of_restrict AlgebraicGeometry.Scheme.ofRestrict
+-/
 
-instance IsOpenImmersion.ofRestrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X.carrier}
-    (h : OpenEmbedding f) : IsOpenImmersion (X.of_restrict h) :=
+instance IsOpenImmersionCat.ofRestrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X.carrier}
+    (h : OpenEmbedding f) : IsOpenImmersionCat (X.of_restrict h) :=
   show PresheafedSpace.IsOpenImmersion (X.toPresheafedSpace.of_restrict h) by infer_instance
-#align algebraic_geometry.is_open_immersion.of_restrict AlgebraicGeometry.IsOpenImmersion.ofRestrict
+#align algebraic_geometry.is_open_immersion.of_restrict AlgebraicGeometry.IsOpenImmersionCat.ofRestrict
 
 namespace IsOpenImmersion
 
 variable {X Y Z : Scheme.{u}} (f : X ⟶ Z) (g : Y ⟶ Z)
 
-variable [H : IsOpenImmersion f]
+variable [H : IsOpenImmersionCat f]
 
-instance (priority := 100) of_isIso [IsIso g] : IsOpenImmersion g :=
+instance (priority := 100) of_isIso [IsIso g] : IsOpenImmersionCat g :=
   @LocallyRingedSpace.IsOpenImmersion.of_isIso _
     (show IsIso ((inducedFunctor _).map g) by infer_instance)
-#align algebraic_geometry.is_open_immersion.of_is_iso AlgebraicGeometry.IsOpenImmersion.of_isIso
+#align algebraic_geometry.is_open_immersion.of_is_iso AlgebraicGeometry.IsOpenImmersionCat.of_isIso
 
-theorem to_iso {X Y : Scheme} (f : X ⟶ Y) [h : IsOpenImmersion f] [Epi f.1.base] : IsIso f :=
+theorem to_iso {X Y : Scheme} (f : X ⟶ Y) [h : IsOpenImmersionCat f] [Epi f.1.base] : IsIso f :=
   @isIso_of_reflects_iso _ _ f
     (Scheme.forgetToLocallyRingedSpace ⋙
       LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace)
     (@PresheafedSpace.IsOpenImmersion.to_iso _ f.1 h _) _
-#align algebraic_geometry.is_open_immersion.to_iso AlgebraicGeometry.IsOpenImmersion.to_iso
+#align algebraic_geometry.is_open_immersion.to_iso AlgebraicGeometry.IsOpenImmersionCat.to_iso
 
 theorem of_stalk_iso {X Y : Scheme} (f : X ⟶ Y) (hf : OpenEmbedding f.1.base)
-    [∀ x, IsIso (PresheafedSpace.stalkMap f.1 x)] : IsOpenImmersion f :=
+    [∀ x, IsIso (PresheafedSpace.stalkMap f.1 x)] : IsOpenImmersionCat f :=
   SheafedSpace.IsOpenImmersion.of_stalk_iso f.1 hf
-#align algebraic_geometry.is_open_immersion.of_stalk_iso AlgebraicGeometry.IsOpenImmersion.of_stalk_iso
+#align algebraic_geometry.is_open_immersion.of_stalk_iso AlgebraicGeometry.IsOpenImmersionCat.of_stalk_iso
 
 theorem iff_stalk_iso {X Y : Scheme} (f : X ⟶ Y) :
-    IsOpenImmersion f ↔ OpenEmbedding f.1.base ∧ ∀ x, IsIso (PresheafedSpace.stalkMap f.1 x) :=
-  ⟨fun H => ⟨H.1, inferInstance⟩, fun ⟨h₁, h₂⟩ => @IsOpenImmersion.of_stalk_iso f h₁ h₂⟩
-#align algebraic_geometry.is_open_immersion.iff_stalk_iso AlgebraicGeometry.IsOpenImmersion.iff_stalk_iso
+    IsOpenImmersionCat f ↔ OpenEmbedding f.1.base ∧ ∀ x, IsIso (PresheafedSpace.stalkMap f.1 x) :=
+  ⟨fun H => ⟨H.1, inferInstance⟩, fun ⟨h₁, h₂⟩ => @IsOpenImmersionCat.of_stalk_iso f h₁ h₂⟩
+#align algebraic_geometry.is_open_immersion.iff_stalk_iso AlgebraicGeometry.IsOpenImmersionCat.iff_stalk_iso
 
-theorem AlgebraicGeometry.isIso_iff_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) :
-    IsIso f ↔ IsOpenImmersion f ∧ Epi f.1.base :=
-  ⟨fun H => ⟨inferInstance, inferInstance⟩, fun ⟨h₁, h₂⟩ => @IsOpenImmersion.to_iso f h₁ h₂⟩
-#align algebraic_geometry.is_iso_iff_is_open_immersion AlgebraicGeometry.isIso_iff_isOpenImmersion
+theorem AlgebraicGeometry.isIso_iff_isOpenImmersionCat {X Y : Scheme} (f : X ⟶ Y) :
+    IsIso f ↔ IsOpenImmersionCat f ∧ Epi f.1.base :=
+  ⟨fun H => ⟨inferInstance, inferInstance⟩, fun ⟨h₁, h₂⟩ => @IsOpenImmersionCat.to_iso f h₁ h₂⟩
+#align algebraic_geometry.is_iso_iff_is_open_immersion AlgebraicGeometry.isIso_iff_isOpenImmersionCat
 
+#print AlgebraicGeometry.isIso_iff_stalk_iso /-
 theorem AlgebraicGeometry.isIso_iff_stalk_iso {X Y : Scheme} (f : X ⟶ Y) :
     IsIso f ↔ IsIso f.1.base ∧ ∀ x, IsIso (PresheafedSpace.stalkMap f.1 x) :=
   by
@@ -437,21 +506,22 @@ theorem AlgebraicGeometry.isIso_iff_stalk_iso {X Y : Scheme} (f : X ⟶ Y) :
     · infer_instance
   · intro H; exact ⟨inferInstance, (TopCat.homeoOfIso (as_iso f.1.base)).OpenEmbedding⟩
 #align algebraic_geometry.is_iso_iff_stalk_iso AlgebraicGeometry.isIso_iff_stalk_iso
+-/
 
 /-- A open immersion induces an isomorphism from the domain onto the image -/
 def isoRestrict : X ≅ (Z.restrict H.base_open : _) :=
   ⟨H.isoRestrict.Hom, H.isoRestrict.inv, H.isoRestrict.hom_inv_id, H.isoRestrict.inv_hom_id⟩
-#align algebraic_geometry.is_open_immersion.iso_restrict AlgebraicGeometry.IsOpenImmersion.isoRestrict
+#align algebraic_geometry.is_open_immersion.iso_restrict AlgebraicGeometry.IsOpenImmersionCat.isoRestrict
 
 local notation "forget" => Scheme.forgetToLocallyRingedSpace
 
 instance mono : Mono f :=
   (inducedFunctor _).mono_of_mono_map (show @Mono LocallyRingedSpace _ _ _ f by infer_instance)
-#align algebraic_geometry.is_open_immersion.mono AlgebraicGeometry.IsOpenImmersion.mono
+#align algebraic_geometry.is_open_immersion.mono AlgebraicGeometry.IsOpenImmersionCat.mono
 
-instance forget_map_isOpenImmersion : LocallyRingedSpace.IsOpenImmersion (forget.map f) :=
+instance forget_map_isOpenImmersionCat : LocallyRingedSpace.IsOpenImmersion (forget.map f) :=
   ⟨H.base_open, H.c_iso⟩
-#align algebraic_geometry.is_open_immersion.forget_map_is_open_immersion AlgebraicGeometry.IsOpenImmersion.forget_map_isOpenImmersion
+#align algebraic_geometry.is_open_immersion.forget_map_is_open_immersion AlgebraicGeometry.IsOpenImmersionCat.forget_map_isOpenImmersionCat
 
 instance hasLimit_cospan_forget_of_left :
     HasLimit (cospan f g ⋙ Scheme.forgetToLocallyRingedSpace) :=
@@ -459,77 +529,77 @@ instance hasLimit_cospan_forget_of_left :
   apply has_limit_of_iso (diagramIsoCospan.{u} _).symm
   change has_limit (cospan (forget.map f) (forget.map g))
   infer_instance
-#align algebraic_geometry.is_open_immersion.has_limit_cospan_forget_of_left AlgebraicGeometry.IsOpenImmersion.hasLimit_cospan_forget_of_left
+#align algebraic_geometry.is_open_immersion.has_limit_cospan_forget_of_left AlgebraicGeometry.IsOpenImmersionCat.hasLimit_cospan_forget_of_left
 
 open CategoryTheory.Limits.WalkingCospan
 
 instance hasLimit_cospan_forget_of_left' :
     HasLimit (cospan ((cospan f g ⋙ forget).map Hom.inl) ((cospan f g ⋙ forget).map Hom.inr)) :=
   show HasLimit (cospan (forget.map f) (forget.map g)) from inferInstance
-#align algebraic_geometry.is_open_immersion.has_limit_cospan_forget_of_left' AlgebraicGeometry.IsOpenImmersion.hasLimit_cospan_forget_of_left'
+#align algebraic_geometry.is_open_immersion.has_limit_cospan_forget_of_left' AlgebraicGeometry.IsOpenImmersionCat.hasLimit_cospan_forget_of_left'
 
 instance hasLimit_cospan_forget_of_right : HasLimit (cospan g f ⋙ forget) :=
   by
   apply has_limit_of_iso (diagramIsoCospan.{u} _).symm
   change has_limit (cospan (forget.map g) (forget.map f))
   infer_instance
-#align algebraic_geometry.is_open_immersion.has_limit_cospan_forget_of_right AlgebraicGeometry.IsOpenImmersion.hasLimit_cospan_forget_of_right
+#align algebraic_geometry.is_open_immersion.has_limit_cospan_forget_of_right AlgebraicGeometry.IsOpenImmersionCat.hasLimit_cospan_forget_of_right
 
 instance hasLimit_cospan_forget_of_right' :
     HasLimit (cospan ((cospan g f ⋙ forget).map Hom.inl) ((cospan g f ⋙ forget).map Hom.inr)) :=
   show HasLimit (cospan (forget.map g) (forget.map f)) from inferInstance
-#align algebraic_geometry.is_open_immersion.has_limit_cospan_forget_of_right' AlgebraicGeometry.IsOpenImmersion.hasLimit_cospan_forget_of_right'
+#align algebraic_geometry.is_open_immersion.has_limit_cospan_forget_of_right' AlgebraicGeometry.IsOpenImmersionCat.hasLimit_cospan_forget_of_right'
 
 instance forgetCreatesPullbackOfLeft : CreatesLimit (cospan f g) forget :=
   createsLimitOfFullyFaithfulOfIso
     (PresheafedSpace.IsOpenImmersion.toScheme Y (@pullback.snd LocallyRingedSpace _ _ _ _ f g _).1)
     (eqToIso (by simp) ≪≫ HasLimit.isoOfNatIso (diagramIsoCospan _).symm)
-#align algebraic_geometry.is_open_immersion.forget_creates_pullback_of_left AlgebraicGeometry.IsOpenImmersion.forgetCreatesPullbackOfLeft
+#align algebraic_geometry.is_open_immersion.forget_creates_pullback_of_left AlgebraicGeometry.IsOpenImmersionCat.forgetCreatesPullbackOfLeft
 
 instance forgetCreatesPullbackOfRight : CreatesLimit (cospan g f) forget :=
   createsLimitOfFullyFaithfulOfIso
     (PresheafedSpace.IsOpenImmersion.toScheme Y (@pullback.fst LocallyRingedSpace _ _ _ _ g f _).1)
     (eqToIso (by simp) ≪≫ HasLimit.isoOfNatIso (diagramIsoCospan _).symm)
-#align algebraic_geometry.is_open_immersion.forget_creates_pullback_of_right AlgebraicGeometry.IsOpenImmersion.forgetCreatesPullbackOfRight
+#align algebraic_geometry.is_open_immersion.forget_creates_pullback_of_right AlgebraicGeometry.IsOpenImmersionCat.forgetCreatesPullbackOfRight
 
 instance forgetPreservesOfLeft : PreservesLimit (cospan f g) forget :=
   CategoryTheory.preservesLimitOfCreatesLimitAndHasLimit _ _
-#align algebraic_geometry.is_open_immersion.forget_preserves_of_left AlgebraicGeometry.IsOpenImmersion.forgetPreservesOfLeft
+#align algebraic_geometry.is_open_immersion.forget_preserves_of_left AlgebraicGeometry.IsOpenImmersionCat.forgetPreservesOfLeft
 
 instance forgetPreservesOfRight : PreservesLimit (cospan g f) forget :=
   preservesPullbackSymmetry _ _ _
-#align algebraic_geometry.is_open_immersion.forget_preserves_of_right AlgebraicGeometry.IsOpenImmersion.forgetPreservesOfRight
+#align algebraic_geometry.is_open_immersion.forget_preserves_of_right AlgebraicGeometry.IsOpenImmersionCat.forgetPreservesOfRight
 
 instance hasPullback_of_left : HasPullback f g :=
   hasLimit_of_created (cospan f g) forget
-#align algebraic_geometry.is_open_immersion.has_pullback_of_left AlgebraicGeometry.IsOpenImmersion.hasPullback_of_left
+#align algebraic_geometry.is_open_immersion.has_pullback_of_left AlgebraicGeometry.IsOpenImmersionCat.hasPullback_of_left
 
 instance hasPullback_of_right : HasPullback g f :=
   hasLimit_of_created (cospan g f) forget
-#align algebraic_geometry.is_open_immersion.has_pullback_of_right AlgebraicGeometry.IsOpenImmersion.hasPullback_of_right
+#align algebraic_geometry.is_open_immersion.has_pullback_of_right AlgebraicGeometry.IsOpenImmersionCat.hasPullback_of_right
 
-instance pullback_snd_of_left : IsOpenImmersion (pullback.snd : pullback f g ⟶ _) :=
+instance pullback_snd_of_left : IsOpenImmersionCat (pullback.snd : pullback f g ⟶ _) :=
   by
   have := preserves_pullback.iso_hom_snd forget f g
   dsimp only [Scheme.forget_to_LocallyRingedSpace, induced_functor_map] at this 
   rw [← this]
   change LocallyRingedSpace.is_open_immersion _
   infer_instance
-#align algebraic_geometry.is_open_immersion.pullback_snd_of_left AlgebraicGeometry.IsOpenImmersion.pullback_snd_of_left
+#align algebraic_geometry.is_open_immersion.pullback_snd_of_left AlgebraicGeometry.IsOpenImmersionCat.pullback_snd_of_left
 
-instance pullback_fst_of_right : IsOpenImmersion (pullback.fst : pullback g f ⟶ _) :=
+instance pullback_fst_of_right : IsOpenImmersionCat (pullback.fst : pullback g f ⟶ _) :=
   by
   rw [← pullback_symmetry_hom_comp_snd]
   infer_instance
-#align algebraic_geometry.is_open_immersion.pullback_fst_of_right AlgebraicGeometry.IsOpenImmersion.pullback_fst_of_right
+#align algebraic_geometry.is_open_immersion.pullback_fst_of_right AlgebraicGeometry.IsOpenImmersionCat.pullback_fst_of_right
 
-instance pullback_to_base [IsOpenImmersion g] :
-    IsOpenImmersion (limit.π (cospan f g) WalkingCospan.one) :=
+instance pullback_to_base [IsOpenImmersionCat g] :
+    IsOpenImmersionCat (limit.π (cospan f g) WalkingCospan.one) :=
   by
   rw [← limit.w (cospan f g) walking_cospan.hom.inl]
   change is_open_immersion (_ ≫ f)
   infer_instance
-#align algebraic_geometry.is_open_immersion.pullback_to_base AlgebraicGeometry.IsOpenImmersion.pullback_to_base
+#align algebraic_geometry.is_open_immersion.pullback_to_base AlgebraicGeometry.IsOpenImmersionCat.pullback_to_base
 
 instance forgetToTopPreservesOfLeft : PreservesLimit (cospan f g) Scheme.forgetToTop :=
   by
@@ -538,11 +608,11 @@ instance forgetToTopPreservesOfLeft : PreservesLimit (cospan f g) Scheme.forgetT
   apply preserves_limit_of_iso_diagram _ (diagramIsoCospan.{u} _).symm
   dsimp [LocallyRingedSpace.forget_to_Top]
   infer_instance
-#align algebraic_geometry.is_open_immersion.forget_to_Top_preserves_of_left AlgebraicGeometry.IsOpenImmersion.forgetToTopPreservesOfLeft
+#align algebraic_geometry.is_open_immersion.forget_to_Top_preserves_of_left AlgebraicGeometry.IsOpenImmersionCat.forgetToTopPreservesOfLeft
 
 instance forgetToTopPreservesOfRight : PreservesLimit (cospan g f) Scheme.forgetToTop :=
   preservesPullbackSymmetry _ _ _
-#align algebraic_geometry.is_open_immersion.forget_to_Top_preserves_of_right AlgebraicGeometry.IsOpenImmersion.forgetToTopPreservesOfRight
+#align algebraic_geometry.is_open_immersion.forget_to_Top_preserves_of_right AlgebraicGeometry.IsOpenImmersionCat.forgetToTopPreservesOfRight
 
 theorem range_pullback_snd_of_left :
     Set.range (pullback.snd : pullback f g ⟶ Y).1.base =
@@ -557,7 +627,7 @@ theorem range_pullback_snd_of_left :
   rfl
   rw [← TopCat.epi_iff_surjective]
   infer_instance
-#align algebraic_geometry.is_open_immersion.range_pullback_snd_of_left AlgebraicGeometry.IsOpenImmersion.range_pullback_snd_of_left
+#align algebraic_geometry.is_open_immersion.range_pullback_snd_of_left AlgebraicGeometry.IsOpenImmersionCat.range_pullback_snd_of_left
 
 theorem range_pullback_fst_of_right :
     Set.range (pullback.fst : pullback g f ⟶ Y).1.base =
@@ -572,7 +642,7 @@ theorem range_pullback_fst_of_right :
   rfl
   rw [← TopCat.epi_iff_surjective]
   infer_instance
-#align algebraic_geometry.is_open_immersion.range_pullback_fst_of_right AlgebraicGeometry.IsOpenImmersion.range_pullback_fst_of_right
+#align algebraic_geometry.is_open_immersion.range_pullback_fst_of_right AlgebraicGeometry.IsOpenImmersionCat.range_pullback_fst_of_right
 
 theorem range_pullback_to_base_of_left :
     Set.range (pullback.fst ≫ f : pullback f g ⟶ Z).1.base =
@@ -581,7 +651,7 @@ theorem range_pullback_to_base_of_left :
   rw [pullback.condition, Scheme.comp_val_base, coe_comp, Set.range_comp,
     range_pullback_snd_of_left, opens.map_obj, opens.coe_mk, Set.image_preimage_eq_inter_range,
     Set.inter_comm]
-#align algebraic_geometry.is_open_immersion.range_pullback_to_base_of_left AlgebraicGeometry.IsOpenImmersion.range_pullback_to_base_of_left
+#align algebraic_geometry.is_open_immersion.range_pullback_to_base_of_left AlgebraicGeometry.IsOpenImmersionCat.range_pullback_to_base_of_left
 
 theorem range_pullback_to_base_of_right :
     Set.range (pullback.fst ≫ g : pullback g f ⟶ Z).1.base =
@@ -589,7 +659,7 @@ theorem range_pullback_to_base_of_right :
   by
   rw [Scheme.comp_val_base, coe_comp, Set.range_comp, range_pullback_fst_of_right, opens.map_obj,
     opens.coe_mk, Set.image_preimage_eq_inter_range, Set.inter_comm]
-#align algebraic_geometry.is_open_immersion.range_pullback_to_base_of_right AlgebraicGeometry.IsOpenImmersion.range_pullback_to_base_of_right
+#align algebraic_geometry.is_open_immersion.range_pullback_to_base_of_right AlgebraicGeometry.IsOpenImmersionCat.range_pullback_to_base_of_right
 
 /-- The universal property of open immersions:
 For an open immersion `f : X ⟶ Z`, given any morphism of schemes `g : Y ⟶ Z` whose topological
@@ -598,42 +668,46 @@ commutes with these maps.
 -/
 def lift (H' : Set.range g.1.base ⊆ Set.range f.1.base) : Y ⟶ X :=
   LocallyRingedSpace.IsOpenImmersion.lift f g H'
-#align algebraic_geometry.is_open_immersion.lift AlgebraicGeometry.IsOpenImmersion.lift
+#align algebraic_geometry.is_open_immersion.lift AlgebraicGeometry.IsOpenImmersionCat.lift
 
 @[simp, reassoc]
 theorem lift_fac (H' : Set.range g.1.base ⊆ Set.range f.1.base) : lift f g H' ≫ f = g :=
   LocallyRingedSpace.IsOpenImmersion.lift_fac f g H'
-#align algebraic_geometry.is_open_immersion.lift_fac AlgebraicGeometry.IsOpenImmersion.lift_fac
+#align algebraic_geometry.is_open_immersion.lift_fac AlgebraicGeometry.IsOpenImmersionCat.lift_fac
 
 theorem lift_uniq (H' : Set.range g.1.base ⊆ Set.range f.1.base) (l : Y ⟶ X) (hl : l ≫ f = g) :
     l = lift f g H' :=
   LocallyRingedSpace.IsOpenImmersion.lift_uniq f g H' l hl
-#align algebraic_geometry.is_open_immersion.lift_uniq AlgebraicGeometry.IsOpenImmersion.lift_uniq
+#align algebraic_geometry.is_open_immersion.lift_uniq AlgebraicGeometry.IsOpenImmersionCat.lift_uniq
 
 /-- Two open immersions with equal range are isomorphic. -/
 @[simps]
-def isoOfRangeEq [IsOpenImmersion g] (e : Set.range f.1.base = Set.range g.1.base) : X ≅ Y
+def isoOfRangeEq [IsOpenImmersionCat g] (e : Set.range f.1.base = Set.range g.1.base) : X ≅ Y
     where
   Hom := lift g f (le_of_eq e)
   inv := lift f g (le_of_eq e.symm)
   hom_inv_id' := by rw [← cancel_mono f]; simp
   inv_hom_id' := by rw [← cancel_mono g]; simp
-#align algebraic_geometry.is_open_immersion.iso_of_range_eq AlgebraicGeometry.IsOpenImmersion.isoOfRangeEq
+#align algebraic_geometry.is_open_immersion.iso_of_range_eq AlgebraicGeometry.IsOpenImmersionCat.isoOfRangeEq
 
+#print AlgebraicGeometry.Scheme.Hom.opensFunctor /-
 /-- The functor `opens X ⥤ opens Y` associated with an open immersion `f : X ⟶ Y`. -/
 abbrev AlgebraicGeometry.Scheme.Hom.opensFunctor {X Y : Scheme} (f : X ⟶ Y)
-    [H : IsOpenImmersion f] : Opens X.carrier ⥤ Opens Y.carrier :=
+    [H : IsOpenImmersionCat f] : Opens X.carrier ⥤ Opens Y.carrier :=
   H.openFunctor
 #align algebraic_geometry.Scheme.hom.opens_functor AlgebraicGeometry.Scheme.Hom.opensFunctor
+-/
 
+#print AlgebraicGeometry.Scheme.Hom.invApp /-
 /-- The isomorphism `Γ(X, U) ⟶ Γ(Y, f(U))` induced by an open immersion `f : X ⟶ Y`. -/
-def AlgebraicGeometry.Scheme.Hom.invApp {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] (U) :
+def AlgebraicGeometry.Scheme.Hom.invApp {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f] (U) :
     X.Presheaf.obj (op U) ⟶ Y.Presheaf.obj (op (f.opensFunctor.obj U)) :=
   H.invApp U
 #align algebraic_geometry.Scheme.hom.inv_app AlgebraicGeometry.Scheme.Hom.invApp
+-/
 
 theorem app_eq_inv_app_app_of_comp_eq_aux {X Y U : Scheme} (f : Y ⟶ U) (g : U ⟶ X) (fg : Y ⟶ X)
-    (H : fg = f ≫ g) [h : IsOpenImmersion g] (V : Opens U.carrier) :
+    (H : fg = f ≫ g) [h : IsOpenImmersionCat g] (V : Opens U.carrier) :
     (Opens.map f.1.base).obj V = (Opens.map fg.1.base).obj (g.opensFunctor.obj V) :=
   by
   subst H
@@ -641,16 +715,16 @@ theorem app_eq_inv_app_app_of_comp_eq_aux {X Y U : Scheme} (f : Y ⟶ U) (g : U
   congr 1
   ext1
   exact (Set.preimage_image_eq _ h.base_open.inj).symm
-#align algebraic_geometry.is_open_immersion.app_eq_inv_app_app_of_comp_eq_aux AlgebraicGeometry.IsOpenImmersion.app_eq_inv_app_app_of_comp_eq_aux
+#align algebraic_geometry.is_open_immersion.app_eq_inv_app_app_of_comp_eq_aux AlgebraicGeometry.IsOpenImmersionCat.app_eq_inv_app_app_of_comp_eq_aux
 
 /-- The `fg` argument is to avoid nasty stuff about dependent types. -/
 theorem app_eq_invApp_app_of_comp_eq {X Y U : Scheme} (f : Y ⟶ U) (g : U ⟶ X) (fg : Y ⟶ X)
-    (H : fg = f ≫ g) [h : IsOpenImmersion g] (V : Opens U.carrier) :
+    (H : fg = f ≫ g) [h : IsOpenImmersionCat g] (V : Opens U.carrier) :
     f.1.c.app (op V) =
       g.invApp _ ≫
         fg.1.c.app _ ≫
           Y.Presheaf.map
-            (eqToHom <| IsOpenImmersion.app_eq_inv_app_app_of_comp_eq_aux f g fg H V).op :=
+            (eqToHom <| IsOpenImmersionCat.app_eq_inv_app_app_of_comp_eq_aux f g fg H V).op :=
   by
   subst H
   rw [Scheme.comp_val_c_app, category.assoc, Scheme.hom.inv_app,
@@ -658,25 +732,26 @@ theorem app_eq_invApp_app_of_comp_eq {X Y U : Scheme} (f : Y ⟶ U) (g : U ⟶ X
     TopCat.Presheaf.pushforwardObj_map, ← functor.map_comp]
   convert (category.comp_id _).symm
   convert Y.presheaf.map_id _
-#align algebraic_geometry.is_open_immersion.app_eq_inv_app_app_of_comp_eq AlgebraicGeometry.IsOpenImmersion.app_eq_invApp_app_of_comp_eq
+#align algebraic_geometry.is_open_immersion.app_eq_inv_app_app_of_comp_eq AlgebraicGeometry.IsOpenImmersionCat.app_eq_invApp_app_of_comp_eq
 
-theorem lift_app {X Y U : Scheme} (f : U ⟶ Y) (g : X ⟶ Y) [h : IsOpenImmersion f] (H)
+theorem lift_app {X Y U : Scheme} (f : U ⟶ Y) (g : X ⟶ Y) [h : IsOpenImmersionCat f] (H)
     (V : Opens U.carrier) :
-    (IsOpenImmersion.lift f g H).1.c.app (op V) =
+    (IsOpenImmersionCat.lift f g H).1.c.app (op V) =
       f.invApp _ ≫
         g.1.c.app _ ≫
           X.Presheaf.map
             (eqToHom <|
-                IsOpenImmersion.app_eq_inv_app_app_of_comp_eq_aux _ _ _
-                  (IsOpenImmersion.lift_fac f g H).symm V).op :=
-  IsOpenImmersion.app_eq_invApp_app_of_comp_eq _ _ _ _ _
-#align algebraic_geometry.is_open_immersion.lift_app AlgebraicGeometry.IsOpenImmersion.lift_app
+                IsOpenImmersionCat.app_eq_inv_app_app_of_comp_eq_aux _ _ _
+                  (IsOpenImmersionCat.lift_fac f g H).symm V).op :=
+  IsOpenImmersionCat.app_eq_invApp_app_of_comp_eq _ _ _ _ _
+#align algebraic_geometry.is_open_immersion.lift_app AlgebraicGeometry.IsOpenImmersionCat.lift_app
 
 end IsOpenImmersion
 
 namespace Scheme
 
-theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] {U : Opens X.carrier}
+#print AlgebraicGeometry.Scheme.image_basicOpen /-
+theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f] {U : Opens X.carrier}
     (r : X.Presheaf.obj (op U)) : f.opensFunctor.obj (X.basicOpen r) = Y.basicOpen (f.invApp U r) :=
   by
   have e := Scheme.preimage_basic_open f (f.inv_app U r)
@@ -691,12 +766,15 @@ theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] {U
   ext1
   exact (Set.preimage_image_eq _ H.base_open.inj).symm
 #align algebraic_geometry.Scheme.image_basic_open AlgebraicGeometry.Scheme.image_basicOpen
+-/
 
+#print AlgebraicGeometry.Scheme.Hom.opensRange /-
 /-- The image of an open immersion as an open set. -/
 @[simps]
-def Hom.opensRange {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] : Opens Y.carrier :=
+def Hom.opensRange {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersionCat f] : Opens Y.carrier :=
   ⟨_, H.base_open.open_range⟩
 #align algebraic_geometry.Scheme.hom.opens_range AlgebraicGeometry.Scheme.Hom.opensRange
+-/
 
 end Scheme
 
@@ -704,6 +782,7 @@ section
 
 variable (X : Scheme)
 
+#print AlgebraicGeometry.Scheme.restrictFunctor /-
 /-- The functor taking open subsets of `X` to open subschemes of `X`. -/
 @[simps obj_left obj_hom mapLeft]
 def Scheme.restrictFunctor : Opens X.carrier ⥤ Over X
@@ -711,9 +790,9 @@ def Scheme.restrictFunctor : Opens X.carrier ⥤ Over X
   obj U := Over.mk (X.of_restrict U.OpenEmbedding)
   map U V i :=
     Over.homMk
-      (IsOpenImmersion.lift (X.of_restrict _) (X.of_restrict _)
+      (IsOpenImmersionCat.lift (X.of_restrict _) (X.of_restrict _)
         (by change Set.range coe ⊆ Set.range coe; simp_rw [Subtype.range_coe]; exact i.le))
-      (IsOpenImmersion.lift_fac _ _ _)
+      (IsOpenImmersionCat.lift_fac _ _ _)
   map_id' U := by
     ext1
     dsimp only [over.hom_mk_left, over.id_left]
@@ -725,13 +804,19 @@ def Scheme.restrictFunctor : Opens X.carrier ⥤ Over X
     rw [← cancel_mono (X.of_restrict W.open_embedding), category.assoc]
     iterate 3 rw [is_open_immersion.lift_fac]
 #align algebraic_geometry.Scheme.restrict_functor AlgebraicGeometry.Scheme.restrictFunctor
+-/
 
+/- warning: algebraic_geometry.Scheme.restrict_functor_map_of_restrict clashes with algebraic_geometry.Scheme.restrict_functor_map_ofRestrict -> AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrict
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.Scheme.restrict_functor_map_of_restrict AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrictₓ'. -/
+#print AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrict /-
 @[reassoc]
 theorem Scheme.restrictFunctor_map_ofRestrict {U V : Opens X.carrier} (i : U ⟶ V) :
     (X.restrictFunctor.map i).1 ≫ X.of_restrict _ = X.of_restrict _ :=
-  IsOpenImmersion.lift_fac _ _ _
+  IsOpenImmersionCat.lift_fac _ _ _
 #align algebraic_geometry.Scheme.restrict_functor_map_of_restrict AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrict
+-/
 
+#print AlgebraicGeometry.Scheme.restrictFunctor_map_base /-
 theorem Scheme.restrictFunctor_map_base {U V : Opens X.carrier} (i : U ⟶ V) :
     (X.restrictFunctor.map i).1.1.base = (Opens.toTopCat _).map i :=
   by
@@ -741,7 +826,9 @@ theorem Scheme.restrictFunctor_map_base {U V : Opens X.carrier} (i : U ⟶ V) :
         (X.restrict_functor_map_of_restrict i) :
       _)
 #align algebraic_geometry.Scheme.restrict_functor_map_base AlgebraicGeometry.Scheme.restrictFunctor_map_base
+-/
 
+#print AlgebraicGeometry.Scheme.restrictFunctor_map_app_aux /-
 theorem Scheme.restrictFunctor_map_app_aux {U V : Opens X.carrier} (i : U ⟶ V) (W : Opens V) :
     U.OpenEmbedding.IsOpenMap.Functor.obj ((Opens.map (X.restrictFunctor.map i).1.val.base).obj W) ≤
       V.OpenEmbedding.IsOpenMap.Functor.obj W :=
@@ -751,7 +838,9 @@ theorem Scheme.restrictFunctor_map_app_aux {U V : Opens X.carrier} (i : U ⟶ V)
   rintro _ h
   exact ⟨_, h, rfl⟩
 #align algebraic_geometry.Scheme.restrict_functor_map_app_aux AlgebraicGeometry.Scheme.restrictFunctor_map_app_aux
+-/
 
+#print AlgebraicGeometry.Scheme.restrictFunctor_map_app /-
 theorem Scheme.restrictFunctor_map_app {U V : Opens X.carrier} (i : U ⟶ V) (W : Opens V) :
     (X.restrictFunctor.map i).1.1.c.app (op W) =
       X.Presheaf.map (homOfLE <| X.restrictFunctor_map_app_aux i W).op :=
@@ -770,7 +859,9 @@ theorem Scheme.restrictFunctor_map_app {U V : Opens X.carrier} (i : U ⟶ V) (W
   rw [e₁]
   congr 1
 #align algebraic_geometry.Scheme.restrict_functor_map_app AlgebraicGeometry.Scheme.restrictFunctor_map_app
+-/
 
+#print AlgebraicGeometry.Scheme.restrictFunctorΓ /-
 /-- The functor that restricts to open subschemes and then takes global section is
 isomorphic to the structure sheaf. -/
 @[simps]
@@ -783,9 +874,11 @@ def Scheme.restrictFunctorΓ : X.restrictFunctor.op ⋙ (Over.forget X).op ⋙ S
       rw [X.restrict_functor_map_app, ← functor.map_comp, ← functor.map_comp]
       congr 1)
 #align algebraic_geometry.Scheme.restrict_functor_Γ AlgebraicGeometry.Scheme.restrictFunctorΓ
+-/
 
 end
 
+#print AlgebraicGeometry.Scheme.restrictMapIso /-
 /-- The restriction of an isomorphism onto an open set. -/
 noncomputable abbrev Scheme.restrictMapIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f]
     (U : Opens Y.carrier) :
@@ -800,7 +893,9 @@ noncomputable abbrev Scheme.restrictMapIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f
   rw [← TopCat.epi_iff_surjective]
   infer_instance
 #align algebraic_geometry.Scheme.restrict_map_iso AlgebraicGeometry.Scheme.restrictMapIso
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.pullbackCover /-
 /-- Given an open cover on `X`, we may pull them back along a morphism `W ⟶ X` to obtain
 an open cover of `W`. -/
 @[simps]
@@ -821,7 +916,9 @@ def Scheme.OpenCover.pullbackCover {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme
     exact ⟨y, h.symm⟩
     · rw [← TopCat.epi_iff_surjective]; infer_instance
 #align algebraic_geometry.Scheme.open_cover.pullback_cover AlgebraicGeometry.Scheme.OpenCover.pullbackCover
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.iUnion_range /-
 theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
     (⋃ i, Set.range (𝒰.map i).1.base) = Set.univ :=
   by
@@ -830,12 +927,16 @@ theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
   rw [Set.mem_iUnion]
   exact ⟨𝒰.f x, 𝒰.covers x⟩
 #align algebraic_geometry.Scheme.open_cover.Union_range AlgebraicGeometry.Scheme.OpenCover.iUnion_range
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.iSup_opensRange /-
 theorem Scheme.OpenCover.iSup_opensRange {X : Scheme} (𝒰 : X.OpenCover) :
     (⨆ i, (𝒰.map i).opensRange) = ⊤ :=
   Opens.ext <| by rw [opens.coe_supr]; exact 𝒰.Union_range
 #align algebraic_geometry.Scheme.open_cover.supr_opens_range AlgebraicGeometry.Scheme.OpenCover.iSup_opensRange
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.compactSpace /-
 theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite 𝒰.J]
     [H : ∀ i, CompactSpace (𝒰.obj i).carrier] : CompactSpace X.carrier :=
   by
@@ -852,7 +953,9 @@ theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite
                   (X.of_restrict (opens.open_embedding ⟨_, (𝒰.is_open i).base_open.open_range⟩))
                   subtype.range_coe.symm).Hom.1.base))
 #align algebraic_geometry.Scheme.open_cover.compact_space AlgebraicGeometry.Scheme.OpenCover.compactSpace
+-/
 
+#print AlgebraicGeometry.Scheme.OpenCover.inter /-
 /-- Given open covers `{ Uᵢ }` and `{ Uⱼ }`, we may form the open cover `{ Uᵢ ∩ Uⱼ }`. -/
 def Scheme.OpenCover.inter {X : Scheme.{u}} (𝒰₁ : Scheme.OpenCover.{v₁} X)
     (𝒰₂ : Scheme.OpenCover.{v₂} X) : X.OpenCover
@@ -865,7 +968,9 @@ def Scheme.OpenCover.inter {X : Scheme.{u}} (𝒰₁ : Scheme.OpenCover.{v₁} X
     rw [is_open_immersion.range_pullback_to_base_of_left]
     exact ⟨𝒰₁.covers x, 𝒰₂.covers x⟩
 #align algebraic_geometry.Scheme.open_cover.inter AlgebraicGeometry.Scheme.OpenCover.inter
+-/
 
+#print AlgebraicGeometry.Scheme.openCoverOfSuprEqTop /-
 /-- If `U` is a family of open sets that covers `X`, then `X.restrict U` forms an `X.open_cover`. -/
 @[simps J obj map]
 def Scheme.openCoverOfSuprEqTop {s : Type _} (X : Scheme) (U : s → Opens X.carrier)
@@ -881,9 +986,11 @@ def Scheme.openCoverOfSuprEqTop {s : Type _} (X : Scheme) (U : s → Opens X.car
     have : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : opens X.carrier) by triv
     exact (opens.mem_supr.mp this).choose_spec
 #align algebraic_geometry.Scheme.open_cover_of_supr_eq_top AlgebraicGeometry.Scheme.openCoverOfSuprEqTop
+-/
 
 section MorphismRestrict
 
+#print AlgebraicGeometry.pullbackRestrictIsoRestrict /-
 /-- Given a morphism `f : X ⟶ Y` and an open set `U ⊆ Y`, we have `X ×[Y] U ≅ X |_{f ⁻¹ U}` -/
 def pullbackRestrictIsoRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
     pullback f (Y.of_restrict U.OpenEmbedding) ≅
@@ -895,33 +1002,43 @@ def pullbackRestrictIsoRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrie
   rw [Subtype.range_coe, Subtype.range_coe]
   rfl
 #align algebraic_geometry.pullback_restrict_iso_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict
+-/
 
+#print AlgebraicGeometry.pullbackRestrictIsoRestrict_inv_fst /-
 @[simp, reassoc]
 theorem pullbackRestrictIsoRestrict_inv_fst {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
     (pullbackRestrictIsoRestrict f U).inv ≫ pullback.fst = X.of_restrict _ := by
   delta pullback_restrict_iso_restrict; simp
 #align algebraic_geometry.pullback_restrict_iso_restrict_inv_fst AlgebraicGeometry.pullbackRestrictIsoRestrict_inv_fst
+-/
 
+#print AlgebraicGeometry.pullbackRestrictIsoRestrict_hom_restrict /-
 @[simp, reassoc]
 theorem pullbackRestrictIsoRestrict_hom_restrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
     (pullbackRestrictIsoRestrict f U).Hom ≫ X.of_restrict _ = pullback.fst := by
   delta pullback_restrict_iso_restrict; simp
 #align algebraic_geometry.pullback_restrict_iso_restrict_hom_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict_hom_restrict
+-/
 
+#print AlgebraicGeometry.morphismRestrict /-
 /-- The restriction of a morphism `X ⟶ Y` onto `X |_{f ⁻¹ U} ⟶ Y |_ U`. -/
 def morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
     X.restrict ((Opens.map f.1.base).obj U).OpenEmbedding ⟶ Y.restrict U.OpenEmbedding :=
   (pullbackRestrictIsoRestrict f U).inv ≫ pullback.snd
 #align algebraic_geometry.morphism_restrict AlgebraicGeometry.morphismRestrict
+-/
 
 infixl:80 " ∣_ " => morphismRestrict
 
+#print AlgebraicGeometry.pullbackRestrictIsoRestrict_hom_morphismRestrict /-
 @[simp, reassoc]
 theorem pullbackRestrictIsoRestrict_hom_morphismRestrict {X Y : Scheme} (f : X ⟶ Y)
     (U : Opens Y.carrier) : (pullbackRestrictIsoRestrict f U).Hom ≫ f ∣_ U = pullback.snd :=
   Iso.hom_inv_id_assoc _ _
 #align algebraic_geometry.pullback_restrict_iso_restrict_hom_morphism_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict_hom_morphismRestrict
+-/
 
+#print AlgebraicGeometry.morphismRestrict_ι /-
 @[simp, reassoc]
 theorem morphismRestrict_ι {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
     (f ∣_ U) ≫ Y.of_restrict U.OpenEmbedding = X.of_restrict _ ≫ f :=
@@ -929,7 +1046,9 @@ theorem morphismRestrict_ι {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
   delta morphism_restrict
   rw [category.assoc, pullback.condition.symm, pullback_restrict_iso_restrict_inv_fst_assoc]
 #align algebraic_geometry.morphism_restrict_ι AlgebraicGeometry.morphismRestrict_ι
+-/
 
+#print AlgebraicGeometry.isPullback_morphismRestrict /-
 theorem isPullback_morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
     IsPullback (f ∣_ U) (X.of_restrict _) (Y.of_restrict _) f :=
   by
@@ -940,7 +1059,9 @@ theorem isPullback_morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.ca
       (is_pullback.of_has_pullback f (Y.of_restrict U.open_embedding)).flip
   rw [pullback_restrict_iso_restrict_inv_fst, category.comp_id]
 #align algebraic_geometry.is_pullback_morphism_restrict AlgebraicGeometry.isPullback_morphismRestrict
+-/
 
+#print AlgebraicGeometry.morphismRestrict_comp /-
 theorem morphismRestrict_comp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) (U : Opens Z.carrier) :
     (f ≫ g) ∣_ U = ((f ∣_ (Opens.map g.val.base).obj U) ≫ g ∣_ U : _) :=
   by
@@ -956,21 +1077,27 @@ theorem morphismRestrict_comp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) (U :
   rfl
   infer_instance
 #align algebraic_geometry.morphism_restrict_comp AlgebraicGeometry.morphismRestrict_comp
+-/
 
 instance {X Y : Scheme} (f : X ⟶ Y) [IsIso f] (U : Opens Y.carrier) : IsIso (f ∣_ U) := by
   delta morphism_restrict; infer_instance
 
+#print AlgebraicGeometry.morphismRestrict_base_coe /-
 theorem morphismRestrict_base_coe {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) (x) :
     @coe U Y.carrier _ ((f ∣_ U).1.base x) = f.1.base x.1 :=
   congr_arg (fun f => PresheafedSpace.Hom.base (LocallyRingedSpace.Hom.val f) x)
     (morphismRestrict_ι f U)
 #align algebraic_geometry.morphism_restrict_base_coe AlgebraicGeometry.morphismRestrict_base_coe
+-/
 
+#print AlgebraicGeometry.morphismRestrict_val_base /-
 theorem morphismRestrict_val_base {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
     ⇑(f ∣_ U).1.base = U.1.restrictPreimage f.1.base :=
   funext fun x => Subtype.ext (morphismRestrict_base_coe f U x)
 #align algebraic_geometry.morphism_restrict_val_base AlgebraicGeometry.morphismRestrict_val_base
+-/
 
+#print AlgebraicGeometry.image_morphismRestrict_preimage /-
 theorem image_morphismRestrict_preimage {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier)
     (V : Opens U) :
     ((Opens.map f.val.base).obj U).OpenEmbedding.IsOpenMap.Functor.obj
@@ -991,7 +1118,9 @@ theorem image_morphismRestrict_preimage {X Y : Scheme} (f : X ⟶ Y) (U : Opens
     ext1
     exact morphism_restrict_base_coe f U ⟨x, hx⟩
 #align algebraic_geometry.image_morphism_restrict_preimage AlgebraicGeometry.image_morphismRestrict_preimage
+-/
 
+#print AlgebraicGeometry.morphismRestrict_c_app /-
 theorem morphismRestrict_c_app {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) (V : Opens U) :
     (f ∣_ U).1.c.app (op V) =
       f.1.c.app (op (U.OpenEmbedding.IsOpenMap.Functor.obj V)) ≫
@@ -1011,7 +1140,9 @@ theorem morphismRestrict_c_app {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier
   erw [← X.presheaf.map_comp, ← X.presheaf.map_comp]
   congr 1
 #align algebraic_geometry.morphism_restrict_c_app AlgebraicGeometry.morphismRestrict_c_app
+-/
 
+#print AlgebraicGeometry.Γ_map_morphismRestrict /-
 theorem Γ_map_morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
     Scheme.Γ.map (f ∣_ U).op =
       Y.Presheaf.map (eqToHom <| U.openEmbedding_obj_top.symm).op ≫
@@ -1022,10 +1153,13 @@ theorem Γ_map_morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrie
   erw [← X.presheaf.map_comp]
   congr
 #align algebraic_geometry.Γ_map_morphism_restrict AlgebraicGeometry.Γ_map_morphismRestrict
+-/
 
+#print AlgebraicGeometry.morphismRestrictOpensRange /-
 /-- Restricting a morphism onto the the image of an open immersion is isomorphic to the base change
 along the immersion. -/
-def morphismRestrictOpensRange {X Y U : Scheme} (f : X ⟶ Y) (g : U ⟶ Y) [hg : IsOpenImmersion g] :
+def morphismRestrictOpensRange {X Y U : Scheme} (f : X ⟶ Y) (g : U ⟶ Y)
+    [hg : IsOpenImmersionCat g] :
     Arrow.mk (f ∣_ g.opensRange) ≅ Arrow.mk (pullback.snd : pullback f g ⟶ _) :=
   by
   let V : opens Y.carrier := g.opens_range
@@ -1041,14 +1175,18 @@ def morphismRestrictOpensRange {X Y U : Scheme} (f : X ⟶ Y) (g : U ⟶ Y) [hg
     is_open_immersion.lift_fac, ← pullback.condition, morphism_restrict_ι,
     pullback_restrict_iso_restrict_hom_restrict_assoc, pullback.lift_fst_assoc, category.comp_id]
 #align algebraic_geometry.morphism_restrict_opens_range AlgebraicGeometry.morphismRestrictOpensRange
+-/
 
+#print AlgebraicGeometry.morphismRestrictEq /-
 /-- The restrictions onto two equal open sets are isomorphic. This currently has bad defeqs when
 unfolded, but it should not matter for now. Replace this definition if better defeqs are needed. -/
 def morphismRestrictEq {X Y : Scheme} (f : X ⟶ Y) {U V : Opens Y.carrier} (e : U = V) :
     Arrow.mk (f ∣_ U) ≅ Arrow.mk (f ∣_ V) :=
   eqToIso (by subst e)
 #align algebraic_geometry.morphism_restrict_eq AlgebraicGeometry.morphismRestrictEq
+-/
 
+#print AlgebraicGeometry.morphismRestrictRestrict /-
 /-- Restricting a morphism twice is isomorpic to one restriction. -/
 def morphismRestrictRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) (V : Opens U) :
     Arrow.mk (f ∣_ U ∣_ V) ≅ Arrow.mk (f ∣_ U.OpenEmbedding.IsOpenMap.Functor.obj V) :=
@@ -1076,7 +1214,9 @@ def morphismRestrictRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier)
   congr
   exact Subtype.range_coe
 #align algebraic_geometry.morphism_restrict_restrict AlgebraicGeometry.morphismRestrictRestrict
+-/
 
+#print AlgebraicGeometry.morphismRestrictRestrictBasicOpen /-
 /-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
 def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier)
     (r : Y.Presheaf.obj (op U)) :
@@ -1097,7 +1237,9 @@ def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.
   rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left_iff_subset, Subtype.range_coe]
   exact Y.basic_open_le r
 #align algebraic_geometry.morphism_restrict_restrict_basic_open AlgebraicGeometry.morphismRestrictRestrictBasicOpen
+-/
 
+#print AlgebraicGeometry.morphismRestrictStalkMap /-
 /-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
 -/
 def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) (x) :
@@ -1121,9 +1263,10 @@ def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier)
     rw [morphism_restrict_c_app, category.assoc, TopCat.Presheaf.germ_res]
     rfl
 #align algebraic_geometry.morphism_restrict_stalk_map AlgebraicGeometry.morphismRestrictStalkMap
+-/
 
-instance {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) [IsOpenImmersion f] :
-    IsOpenImmersion (f ∣_ U) := by delta morphism_restrict; infer_instance
+instance {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) [IsOpenImmersionCat f] :
+    IsOpenImmersionCat (f ∣_ U) := by delta morphism_restrict; infer_instance
 
 end MorphismRestrict
 
Diff
@@ -329,40 +329,40 @@ def toScheme : Scheme :=
   constructor
   · rw [LocallyRingedSpace.is_open_immersion.lift_range]; exact hx
   · delta LocallyRingedSpace.is_open_immersion.lift; infer_instance
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toScheme
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme
 
 @[simp]
 theorem toScheme_toLocallyRingedSpace :
     (toScheme Y f).toLocallyRingedSpace = toLocallyRingedSpace Y.1 f :=
   rfl
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_to_LocallyRingedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toScheme_toLocallyRingedSpace
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_to_LocallyRingedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toScheme_toLocallyRingedSpace
 
 /-- If `X ⟶ Y` is an open immersion of PresheafedSpaces, and `Y` is a Scheme, we can
 upgrade it into a morphism of Schemes.
 -/
 def toSchemeHom : toScheme Y f ⟶ Y :=
   toLocallyRingedSpaceHom _ f
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSchemeHom
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom
 
 @[simp]
 theorem toSchemeHom_val : (toSchemeHom Y f).val = f :=
   rfl
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_val AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSchemeHom_val
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_val AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_val
 
 instance toSchemeHom_isOpenImmersion : IsOpenImmersion (toSchemeHom Y f) :=
   H
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSchemeHom_isOpenImmersion
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.toSchemeHom_isOpenImmersionₓ
 
 theorem scheme_eq_of_locallyRingedSpace_eq {X Y : Scheme}
     (H : X.toLocallyRingedSpace = Y.toLocallyRingedSpace) : X = Y := by cases X; cases Y; congr;
   exact H
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_eq_of_LocallyRingedSpace_eq AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.scheme_eq_of_locallyRingedSpace_eq
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_eq_of_LocallyRingedSpace_eq AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_eq_of_locallyRingedSpace_eq
 
 theorem scheme_toScheme {X Y : Scheme} (f : X ⟶ Y) [IsOpenImmersion f] : toScheme Y f.1 = X :=
   by
   apply Scheme_eq_of_LocallyRingedSpace_eq
   exact LocallyRingedSpace_to_LocallyRingedSpace f
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_to_Scheme AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.scheme_toScheme
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.Scheme_to_Scheme AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ.scheme_toScheme
 
 end ToScheme
 
@@ -408,7 +408,7 @@ theorem to_iso {X Y : Scheme} (f : X ⟶ Y) [h : IsOpenImmersion f] [Epi f.1.bas
 
 theorem of_stalk_iso {X Y : Scheme} (f : X ⟶ Y) (hf : OpenEmbedding f.1.base)
     [∀ x, IsIso (PresheafedSpace.stalkMap f.1 x)] : IsOpenImmersion f :=
-  SheafedSpace.IsOpenImmersion.ofStalkIso f.1 hf
+  SheafedSpace.IsOpenImmersion.of_stalk_iso f.1 hf
 #align algebraic_geometry.is_open_immersion.of_stalk_iso AlgebraicGeometry.IsOpenImmersion.of_stalk_iso
 
 theorem iff_stalk_iso {X Y : Scheme} (f : X ⟶ Y) :
Diff
@@ -100,7 +100,7 @@ variable [∀ x, HasPullback (𝒰.map x ≫ f) g]
 def affineCover (X : Scheme) : OpenCover X
     where
   J := X.carrier
-  obj x := spec.obj <| Opposite.op (X.local_affine x).choose_spec.some
+  obj x := Spec.obj <| Opposite.op (X.local_affine x).choose_spec.some
   map x :=
     ((X.local_affine x).choose_spec.choose_spec.some.inv ≫ X.toLocallyRingedSpace.of_restrict _ : _)
   f x := x
@@ -205,7 +205,7 @@ instance val_base_isIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] : IsIso f.1.base
 
 instance basic_open_isOpenImmersion {R : CommRingCat} (f : R) :
     AlgebraicGeometry.IsOpenImmersion
-      (Scheme.spec.map (CommRingCat.ofHom (algebraMap R (Localization.Away f))).op) :=
+      (Scheme.Spec.map (CommRingCat.ofHom (algebraMap R (Localization.Away f))).op) :=
   by
   apply (config := { instances := false }) SheafedSpace.is_open_immersion.of_stalk_iso
   any_goals infer_instance
@@ -216,11 +216,11 @@ instance basic_open_isOpenImmersion {R : CommRingCat} (f : R) :
 #align algebraic_geometry.Scheme.basic_open_is_open_immersion AlgebraicGeometry.Scheme.basic_open_isOpenImmersion
 
 /-- The basic open sets form an affine open cover of `Spec R`. -/
-def affineBasisCoverOfAffine (R : CommRingCat) : OpenCover (spec.obj (Opposite.op R))
+def affineBasisCoverOfAffine (R : CommRingCat) : OpenCover (Spec.obj (Opposite.op R))
     where
   J := R
-  obj r := spec.obj (Opposite.op <| CommRingCat.of <| Localization.Away r)
-  map r := spec.map (Quiver.Hom.op (algebraMap R (Localization.Away r) : _))
+  obj r := Spec.obj (Opposite.op <| CommRingCat.of <| Localization.Away r)
+  map r := Spec.map (Quiver.Hom.op (algebraMap R (Localization.Away r) : _))
   f x := 1
   Covers r := by
     rw [set.range_iff_surjective.mpr ((TopCat.epi_iff_surjective _).mp _)]
@@ -241,7 +241,7 @@ def affineBasisCoverRing (X : Scheme) (i : X.affineBasisCover.J) : CommRingCat :
 #align algebraic_geometry.Scheme.affine_basis_cover_ring AlgebraicGeometry.Scheme.affineBasisCoverRing
 
 theorem affineBasisCover_obj (X : Scheme) (i : X.affineBasisCover.J) :
-    X.affineBasisCover.obj i = spec.obj (op <| X.affineBasisCoverRing i) :=
+    X.affineBasisCover.obj i = Spec.obj (op <| X.affineBasisCoverRing i) :=
   rfl
 #align algebraic_geometry.Scheme.affine_basis_cover_obj AlgebraicGeometry.Scheme.affineBasisCover_obj
 
@@ -408,7 +408,7 @@ theorem to_iso {X Y : Scheme} (f : X ⟶ Y) [h : IsOpenImmersion f] [Epi f.1.bas
 
 theorem of_stalk_iso {X Y : Scheme} (f : X ⟶ Y) (hf : OpenEmbedding f.1.base)
     [∀ x, IsIso (PresheafedSpace.stalkMap f.1 x)] : IsOpenImmersion f :=
-  SheafedSpace.IsOpenImmersion.of_stalk_iso f.1 hf
+  SheafedSpace.IsOpenImmersion.ofStalkIso f.1 hf
 #align algebraic_geometry.is_open_immersion.of_stalk_iso AlgebraicGeometry.IsOpenImmersion.of_stalk_iso
 
 theorem iff_stalk_iso {X Y : Scheme} (f : X ⟶ Y) :
Diff
@@ -316,8 +316,6 @@ variable {X : PresheafedSpace.{u} CommRingCat.{u}} (Y : Scheme.{u})
 
 variable (f : X ⟶ Y.toPresheafedSpace) [H : PresheafedSpace.IsOpenImmersion f]
 
-include H
-
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a scheme, then so is `X`. -/
 def toScheme : Scheme :=
   by
@@ -355,8 +353,6 @@ instance toSchemeHom_isOpenImmersion : IsOpenImmersion (toSchemeHom Y f) :=
   H
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_Scheme_hom_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSchemeHom_isOpenImmersion
 
-omit H
-
 theorem scheme_eq_of_locallyRingedSpace_eq {X Y : Scheme}
     (H : X.toLocallyRingedSpace = Y.toLocallyRingedSpace) : X = Y := by cases X; cases Y; congr;
   exact H
@@ -447,9 +443,6 @@ def isoRestrict : X ≅ (Z.restrict H.base_open : _) :=
   ⟨H.isoRestrict.Hom, H.isoRestrict.inv, H.isoRestrict.hom_inv_id, H.isoRestrict.inv_hom_id⟩
 #align algebraic_geometry.is_open_immersion.iso_restrict AlgebraicGeometry.IsOpenImmersion.isoRestrict
 
-include H
-
--- mathport name: exprforget
 local notation "forget" => Scheme.forgetToLocallyRingedSpace
 
 instance mono : Mono f :=
@@ -921,7 +914,6 @@ def morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y.carrier) :
   (pullbackRestrictIsoRestrict f U).inv ≫ pullback.snd
 #align algebraic_geometry.morphism_restrict AlgebraicGeometry.morphismRestrict
 
--- mathport name: «expr ∣_ »
 infixl:80 " ∣_ " => morphismRestrict
 
 @[simp, reassoc]

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
@@ -118,8 +118,8 @@ def affineCover (X : Scheme) : OpenCover X where
     intro x
     erw [coe_comp]
     rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ]
-    erw [Subtype.range_coe_subtype]
-    exact (X.local_affine x).choose.2
+    · erw [Subtype.range_coe_subtype]
+      exact (X.local_affine x).choose.2
     rw [← TopCat.epi_iff_surjective]
     change Epi ((SheafedSpace.forget _).map (LocallyRingedSpace.forgetToSheafedSpace.map _))
     infer_instance
@@ -561,9 +561,9 @@ theorem range_pullback_snd_of_left :
   rw [Set.range_comp, Set.range_iff_surjective.mpr, ←
     @Set.preimage_univ _ _ (pullback.fst : pullback f.1.base g.1.base ⟶ _)]
   -- Porting note (#10691): was `rw`
-  erw [TopCat.pullback_snd_image_fst_preimage]
-  rw [Set.image_univ]
-  rfl
+  · erw [TopCat.pullback_snd_image_fst_preimage]
+    rw [Set.image_univ]
+    rfl
   rw [← TopCat.epi_iff_surjective]
   infer_instance
 #align algebraic_geometry.IsOpenImmersion.range_pullback_snd_of_left AlgebraicGeometry.IsOpenImmersion.range_pullback_snd_of_left
@@ -578,9 +578,9 @@ theorem range_pullback_fst_of_right :
   rw [Set.range_comp, Set.range_iff_surjective.mpr, ←
     @Set.preimage_univ _ _ (pullback.snd : pullback g.1.base f.1.base ⟶ _)]
   -- Porting note (#10691): was `rw`
-  erw [TopCat.pullback_fst_image_snd_preimage]
-  rw [Set.image_univ]
-  rfl
+  · erw [TopCat.pullback_fst_image_snd_preimage]
+    rw [Set.image_univ]
+    rfl
   rw [← TopCat.epi_iff_surjective]
   infer_instance
 #align algebraic_geometry.IsOpenImmersion.range_pullback_fst_of_right AlgebraicGeometry.IsOpenImmersion.range_pullback_fst_of_right
@@ -703,13 +703,13 @@ theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] {U
   -- Porting note (#10691): was `rw`
   erw [PresheafedSpace.IsOpenImmersion.invApp_app_apply] at e
   rw [Scheme.basicOpen_res, inf_eq_right.mpr _] at e
-  rw [← e]
-  ext1
-  -- Porting note: this `dsimp` was not necessary
-  dsimp [Opens.map]
-  refine' Set.image_preimage_eq_inter_range.trans _
-  erw [Set.inter_eq_left]
-  refine' Set.Subset.trans (Scheme.basicOpen_le _ _) (Set.image_subset_range _ _)
+  · rw [← e]
+    ext1
+    -- Porting note: this `dsimp` was not necessary
+    dsimp [Opens.map]
+    refine' Set.image_preimage_eq_inter_range.trans _
+    erw [Set.inter_eq_left]
+    refine' Set.Subset.trans (Scheme.basicOpen_le _ _) (Set.image_subset_range _ _)
   refine' le_trans (Scheme.basicOpen_le _ _) (le_of_eq _)
   ext1
   exact (Set.preimage_image_eq _ H.base_open.inj).symm
@@ -740,8 +740,8 @@ def Scheme.OpenCover.pullbackCover {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme
     erw [coe_comp]
     rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
       TopCat.pullback_fst_range]
-    obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
-    exact ⟨y, h.symm⟩
+    · obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
+      exact ⟨y, h.symm⟩
     · rw [← TopCat.epi_iff_surjective]; infer_instance
 #align algebraic_geometry.Scheme.open_cover.pullback_cover AlgebraicGeometry.Scheme.OpenCover.pullbackCover
 
@@ -763,8 +763,8 @@ def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Schem
     erw [coe_comp]
     rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
       TopCat.pullback_snd_range]
-    obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
-    exact ⟨y, h⟩
+    · obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
+      exact ⟨y, h⟩
     · rw [← TopCat.epi_iff_surjective]; infer_instance
 
 theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
feat(AlgebraicGeometry/OpenImmersion): Affine open covers, and refinements of open covers by affine ones (#11947)
Diff
@@ -826,6 +826,63 @@ def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
     exact (Opens.mem_iSup.mp this).choose_spec
 #align algebraic_geometry.Scheme.open_cover_of_supr_eq_top AlgebraicGeometry.Scheme.openCoverOfSuprEqTop
 
+namespace Scheme
+
+/--
+An affine open cover of `X` consists of a family of open immersions into `X` from
+spectra of rings.
+-/
+structure AffineOpenCover (X : Scheme.{u}) where
+  /-- index set of an affine open cover of a scheme `X` -/
+  J : Type v
+  /-- the ring associated to a component of an affine open cover -/
+  obj : J → CommRingCat.{u}
+  /-- the embedding of subschemes to `X` -/
+  map : ∀ j : J, Spec.obj (.op <| obj j) ⟶ X
+  /-- given a point of `x : X`, `f x` is the index of the subscheme which contains `x`  -/
+  f : X.carrier → J
+  /-- the subschemes covers `X` -/
+  Covers : ∀ x, x ∈ Set.range (map (f x)).1.base
+  /-- the embedding of subschemes are open immersions -/
+  IsOpen : ∀ x, IsOpenImmersion (map x) := by infer_instance
+
+namespace AffineOpenCover
+
+attribute [instance] AffineOpenCover.IsOpen
+
+/-- The open cover associated to an affine open cover. -/
+@[simps]
+def openCover {X : Scheme.{u}} (𝓤 : X.AffineOpenCover) : X.OpenCover where
+  J := 𝓤.J
+  map := 𝓤.map
+  f := 𝓤.f
+  Covers := 𝓤.Covers
+
+end AffineOpenCover
+
+/-- A choice of an affine open cover of a scheme. -/
+def affineOpenCover (X : Scheme.{u}) : X.AffineOpenCover where
+  J := X.affineCover.J
+  map := X.affineCover.map
+  f := X.affineCover.f
+  Covers := X.affineCover.Covers
+
+@[simp]
+lemma openCover_affineOpenCover (X : Scheme.{u}) : X.affineOpenCover.openCover = X.affineCover :=
+  rfl
+
+/-- Given any open cover `𝓤`, this is an affine open cover which refines it.
+The morphism in the category of open covers which proves that this is indeed a refinement, see
+`AlgebraicGeometry.Scheme.OpenCover.fromAffineRefinement`.
+-/
+def OpenCover.affineRefinement {X : Scheme.{u}} (𝓤 : X.OpenCover) : X.AffineOpenCover where
+  J := (𝓤.bind fun j => (𝓤.obj j).affineCover).J
+  map := (𝓤.bind fun j => (𝓤.obj j).affineCover).map
+  f := (𝓤.bind fun j => (𝓤.obj j).affineCover).f
+  Covers := (𝓤.bind fun j => (𝓤.obj j).affineCover).Covers
+
+end Scheme
+
 section category
 
 /--
@@ -880,4 +937,10 @@ lemma Scheme.OpenCover.comp_app {X : Scheme.{u}} {𝓤 𝓥 𝓦 : X.OpenCover}
 
 end category
 
+/-- Given any open cover `𝓤`, this is an affine open cover which refines it. -/
+def Scheme.OpenCover.fromAffineRefinement {X : Scheme.{u}} (𝓤 : X.OpenCover) :
+    𝓤.affineRefinement.openCover ⟶ 𝓤 where
+  idx j := j.fst
+  app j := (𝓤.obj j.fst).affineCover.map _
+
 end AlgebraicGeometry
feat(AlgebraicGeometry/OpenImmersion): The category structure on the type of open covers of a scheme. (#11946)

Morphisms are refinements between open covers.

Diff
@@ -826,4 +826,58 @@ def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
     exact (Opens.mem_iSup.mp this).choose_spec
 #align algebraic_geometry.Scheme.open_cover_of_supr_eq_top AlgebraicGeometry.Scheme.openCoverOfSuprEqTop
 
+section category
+
+/--
+A morphism between open covers `𝓤 ⟶ 𝓥` indicates that `𝓤` is a refinement of `𝓥`.
+Since open covers of schemes are indexed, the definition also involves a map on the
+indexing types.
+-/
+structure Scheme.OpenCover.Hom {X : Scheme.{u}} (𝓤 𝓥 : Scheme.OpenCover.{v} X) where
+  /-- The map on indexing types associated to a morphism of open covers. -/
+  idx : 𝓤.J → 𝓥.J
+  /-- The morphism between open subsets associated to a morphism of open covers. -/
+  app (j : 𝓤.J) : 𝓤.obj j ⟶ 𝓥.obj (idx j)
+  isOpen (j : 𝓤.J) : IsOpenImmersion (app j) := by infer_instance
+  w (j : 𝓤.J) : app j ≫ 𝓥.map _ = 𝓤.map _ := by aesop_cat
+
+attribute [reassoc (attr := simp)] Scheme.OpenCover.Hom.w
+attribute [instance] Scheme.OpenCover.Hom.isOpen
+
+/-- The identity morphism in the category of open covers of a scheme. -/
+def Scheme.OpenCover.Hom.id {X : Scheme.{u}} (𝓤 : Scheme.OpenCover.{v} X) : 𝓤.Hom 𝓤 where
+  idx j := j
+  app j := 𝟙 _
+
+/-- The composition of two morphisms in the category of open covers of a scheme. -/
+def Scheme.OpenCover.Hom.comp {X : Scheme.{u}} {𝓤 𝓥 𝓦 : Scheme.OpenCover.{v} X}
+    (f : 𝓤.Hom 𝓥) (g : 𝓥.Hom 𝓦) : 𝓤.Hom 𝓦 where
+  idx j := g.idx <| f.idx j
+  app j := f.app _ ≫ g.app _
+
+instance Scheme.OpenCover.category {X : Scheme.{u}} : Category (Scheme.OpenCover.{v} X) where
+  Hom 𝓤 𝓥 := 𝓤.Hom 𝓥
+  id := Scheme.OpenCover.Hom.id
+  comp f g := f.comp g
+
+@[simp]
+lemma Scheme.OpenCover.id_idx_apply {X : Scheme.{u}} (𝓤 : X.OpenCover) (j : 𝓤.J) :
+    (𝟙 𝓤 : 𝓤 ⟶ 𝓤).idx j = j := rfl
+
+@[simp]
+lemma Scheme.OpenCover.id_app {X : Scheme.{u}} (𝓤 : X.OpenCover) (j : 𝓤.J) :
+    (𝟙 𝓤 : 𝓤 ⟶ 𝓤).app j = 𝟙 _ := rfl
+
+@[simp]
+lemma Scheme.OpenCover.comp_idx_apply {X : Scheme.{u}} {𝓤 𝓥 𝓦 : X.OpenCover}
+    (f : 𝓤 ⟶ 𝓥) (g : 𝓥 ⟶ 𝓦) (j : 𝓤.J) :
+    (f ≫ g).idx j = g.idx (f.idx j) := rfl
+
+@[simp]
+lemma Scheme.OpenCover.comp_app {X : Scheme.{u}} {𝓤 𝓥 𝓦 : X.OpenCover}
+    (f : 𝓤 ⟶ 𝓥) (g : 𝓥 ⟶ 𝓦) (j : 𝓤.J) :
+    (f ≫ g).app j = f.app j ≫ g.app _ := rfl
+
+end category
+
 end AlgebraicGeometry
chore: remove superfluous uses of triv (#11679)

Std defines triv, a slight variation on trivial. It appears that Mathlib doesn't care about the distinction (any more?) and so we can consolidate on a single tactic.

https://github.com/leanprover/std4/pull/712 separately replaces triv in Std with an error explaining to use trivial.

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

Diff
@@ -818,11 +818,11 @@ def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
   obj i := X.restrict (U i).openEmbedding
   map i := X.ofRestrict (U i).openEmbedding
   f x :=
-    haveI : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by triv
+    haveI : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by trivial
     (Opens.mem_iSup.mp this).choose
   Covers x := by
     erw [Subtype.range_coe]
-    have : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by triv
+    have : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : Opens X) by trivial
     exact (Opens.mem_iSup.mp this).choose_spec
 #align algebraic_geometry.Scheme.open_cover_of_supr_eq_top AlgebraicGeometry.Scheme.openCoverOfSuprEqTop
 
chore: rename open_range to isOpen_range, closed_range to isClosed_range (#11438)

All these lemmas refer to the range of some function being open/range (i.e. isOpen or isClosed).

Diff
@@ -53,7 +53,7 @@ protected def scheme (X : LocallyRingedSpace)
   local_affine := by
     intro x
     obtain ⟨R, f, h₁, h₂⟩ := h x
-    refine' ⟨⟨⟨_, h₂.base_open.open_range⟩, h₁⟩, R, ⟨_⟩⟩
+    refine' ⟨⟨⟨_, h₂.base_open.isOpen_range⟩, h₁⟩, R, ⟨_⟩⟩
     apply LocallyRingedSpace.isoOfSheafedSpaceIso
     refine' SheafedSpace.forgetToPresheafedSpace.preimageIso _
     apply PresheafedSpace.IsOpenImmersion.isoOfRangeEq (PresheafedSpace.ofRestrict _ _) f.1
@@ -63,10 +63,12 @@ protected def scheme (X : LocallyRingedSpace)
 
 end LocallyRingedSpace.IsOpenImmersion
 
-theorem IsOpenImmersion.open_range {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] :
+theorem IsOpenImmersion.isOpen_range {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] :
     IsOpen (Set.range f.1.base) :=
-  H.base_open.open_range
-#align algebraic_geometry.IsOpenImmersion.open_range AlgebraicGeometry.IsOpenImmersion.open_range
+  H.base_open.isOpen_range
+#align algebraic_geometry.IsOpenImmersion.open_range AlgebraicGeometry.IsOpenImmersion.isOpen_range
+
+@[deprecated] alias IsOpenImmersion.open_range := IsOpenImmersion.isOpen_range -- 2024-03-17
 
 section OpenCover
 
@@ -267,7 +269,7 @@ theorem affineBasisCover_is_basis (X : Scheme) :
         ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
   apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
   · rintro _ ⟨a, rfl⟩
-    exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
+    exact IsOpenImmersion.isOpen_range (X.affineBasisCover.map a)
   · rintro a U haU hU
     rcases X.affineCover.Covers a with ⟨x, e⟩
     let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
@@ -288,7 +290,7 @@ def OpenCover.finiteSubcover {X : Scheme} (𝒰 : OpenCover X) [H : CompactSpace
     OpenCover X := by
   have :=
     @CompactSpace.elim_nhds_subcover _ _ H (fun x : X => Set.range (𝒰.map (𝒰.f x)).1.base)
-      fun x => (IsOpenImmersion.open_range (𝒰.map (𝒰.f x))).mem_nhds (𝒰.Covers x)
+      fun x => (IsOpenImmersion.isOpen_range (𝒰.map (𝒰.f x))).mem_nhds (𝒰.Covers x)
   let t := this.choose
   have h : ∀ x : X, ∃ y : t, x ∈ Set.range (𝒰.map (𝒰.f y)).1.base := by
     intro x
@@ -324,7 +326,7 @@ def toScheme : Scheme := by
   intro x
   obtain ⟨_, ⟨i, rfl⟩, hx, hi⟩ :=
     Y.affineBasisCover_is_basis.exists_subset_of_mem_open (Set.mem_range_self x)
-      H.base_open.open_range
+      H.base_open.isOpen_range
   use Y.affineBasisCoverRing i
   use LocallyRingedSpace.IsOpenImmersion.lift (toLocallyRingedSpaceHom _ f) _ hi
   constructor
@@ -551,9 +553,8 @@ instance forgetToTopPreservesOfRight : PreservesLimit (cospan g f) Scheme.forget
 
 theorem range_pullback_snd_of_left :
     Set.range (pullback.snd : pullback f g ⟶ Y).1.base =
-      ((Opens.map g.1.base).obj ⟨Set.range f.1.base, H.base_open.open_range⟩).1 := by
-  rw [←
-    show _ = (pullback.snd : pullback f g ⟶ _).1.base from
+      ((Opens.map g.1.base).obj ⟨Set.range f.1.base, H.base_open.isOpen_range⟩).1 := by
+  rw [← show _ = (pullback.snd : pullback f g ⟶ _).1.base from
       PreservesPullback.iso_hom_snd Scheme.forgetToTop f g]
   -- Porting note (#10691): was `rw`
   erw [coe_comp]
@@ -569,9 +570,8 @@ theorem range_pullback_snd_of_left :
 
 theorem range_pullback_fst_of_right :
     Set.range (pullback.fst : pullback g f ⟶ Y).1.base =
-      ((Opens.map g.1.base).obj ⟨Set.range f.1.base, H.base_open.open_range⟩).1 := by
-  rw [←
-    show _ = (pullback.fst : pullback g f ⟶ _).1.base from
+      ((Opens.map g.1.base).obj ⟨Set.range f.1.base, H.base_open.isOpen_range⟩).1 := by
+  rw [← show _ = (pullback.fst : pullback g f ⟶ _).1.base from
       PreservesPullback.iso_hom_fst Scheme.forgetToTop g f]
   -- Porting note (#10691): was `rw`
   erw [coe_comp]
@@ -718,7 +718,7 @@ theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] {U
 /-- The image of an open immersion as an open set. -/
 @[simps]
 def Hom.opensRange {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] : Opens Y :=
-  ⟨_, H.base_open.open_range⟩
+  ⟨_, H.base_open.isOpen_range⟩
 #align algebraic_geometry.Scheme.hom.opens_range AlgebraicGeometry.Scheme.Hom.opensRange
 
 end Scheme
@@ -792,7 +792,7 @@ theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite
       (TopCat.homeoOfIso
         (asIso
           (IsOpenImmersion.isoOfRangeEq (𝒰.map i)
-                  (X.ofRestrict (Opens.openEmbedding ⟨_, (𝒰.IsOpen i).base_open.open_range⟩))
+                  (X.ofRestrict (Opens.openEmbedding ⟨_, (𝒰.IsOpen i).base_open.isOpen_range⟩))
                   Subtype.range_coe.symm).hom.1.base))
 #align algebraic_geometry.Scheme.open_cover.compact_space AlgebraicGeometry.Scheme.OpenCover.compactSpace
 
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -100,7 +100,6 @@ structure OpenCover (X : Scheme.{u}) where
 attribute [instance] OpenCover.IsOpen
 
 variable {X Y Z : Scheme.{u}} (𝒰 : OpenCover X) (f : X ⟶ Z) (g : Y ⟶ Z)
-
 variable [∀ x, HasPullback (𝒰.map x ≫ f) g]
 
 /-- The affine cover of a scheme. -/
@@ -317,7 +316,6 @@ namespace PresheafedSpace.IsOpenImmersion
 section ToScheme
 
 variable {X : PresheafedSpace CommRingCat.{u}} (Y : Scheme.{u})
-
 variable (f : X ⟶ Y.toPresheafedSpace) [H : PresheafedSpace.IsOpenImmersion f]
 
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a scheme, then so is `X`. -/
@@ -398,7 +396,6 @@ instance IsOpenImmersion.ofRestrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.
 namespace IsOpenImmersion
 
 variable {X Y Z : Scheme.{u}} (f : X ⟶ Z) (g : Y ⟶ Z)
-
 variable [H : IsOpenImmersion f]
 
 instance (priority := 100) of_isIso [IsIso g] : IsOpenImmersion g :=
chore: remove tactics (#11365)

More tactics that are not used, found using the linter at #11308.

The PR consists of tactic removals, whitespace changes and replacing a porting note by an explanation.

Diff
@@ -56,7 +56,6 @@ protected def scheme (X : LocallyRingedSpace)
     refine' ⟨⟨⟨_, h₂.base_open.open_range⟩, h₁⟩, R, ⟨_⟩⟩
     apply LocallyRingedSpace.isoOfSheafedSpaceIso
     refine' SheafedSpace.forgetToPresheafedSpace.preimageIso _
-    skip
     apply PresheafedSpace.IsOpenImmersion.isoOfRangeEq (PresheafedSpace.ofRestrict _ _) f.1
     · exact Subtype.range_coe_subtype
     · exact Opens.openEmbedding _ -- Porting note (#11187): was `infer_instance`
chore: classify was infer_instance porting notes (#11188)

Classifying by adding issue number #11187 to porting notes claiming:

was infer_instance

Diff
@@ -59,7 +59,7 @@ protected def scheme (X : LocallyRingedSpace)
     skip
     apply PresheafedSpace.IsOpenImmersion.isoOfRangeEq (PresheafedSpace.ofRestrict _ _) f.1
     · exact Subtype.range_coe_subtype
-    · exact Opens.openEmbedding _ -- Porting note: was `infer_instance`
+    · exact Opens.openEmbedding _ -- Porting note (#11187): was `infer_instance`
 #align algebraic_geometry.LocallyRingedSpace.IsOpenImmersion.Scheme AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.scheme
 
 end LocallyRingedSpace.IsOpenImmersion
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
@@ -59,7 +59,7 @@ protected def scheme (X : LocallyRingedSpace)
     skip
     apply PresheafedSpace.IsOpenImmersion.isoOfRangeEq (PresheafedSpace.ofRestrict _ _) f.1
     · exact Subtype.range_coe_subtype
-    · exact Opens.openEmbedding _ -- Porting note : was `infer_instance`
+    · exact Opens.openEmbedding _ -- Porting note: was `infer_instance`
 #align algebraic_geometry.LocallyRingedSpace.IsOpenImmersion.Scheme AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.scheme
 
 end LocallyRingedSpace.IsOpenImmersion
@@ -144,7 +144,7 @@ def OpenCover.bind (f : ∀ x : 𝒰.J, OpenCover (𝒰.obj x)) : OpenCover X wh
     use z
     erw [comp_apply]
     rw [hz, hy]
-  -- Porting note : weirdly, even though no input is needed, `inferInstance` does not work
+  -- Porting note: weirdly, even though no input is needed, `inferInstance` does not work
   -- `PresheafedSpace.IsOpenImmersion.comp` is marked as `instance`
   IsOpen x := PresheafedSpace.IsOpenImmersion.comp _ _
 #align algebraic_geometry.Scheme.open_cover.bind AlgebraicGeometry.Scheme.OpenCover.bind
@@ -176,12 +176,12 @@ def OpenCover.copy {X : Scheme} (𝒰 : OpenCover X) (J : Type*) (obj : J → Sc
         Set.image_univ, e₁.rightInverse_symm]
       · exact 𝒰.Covers x
       · rw [← TopCat.epi_iff_surjective]; infer_instance
-    -- Porting note : weirdly, even though no input is needed, `inferInstance` does not work
+    -- Porting note: weirdly, even though no input is needed, `inferInstance` does not work
     -- `PresheafedSpace.IsOpenImmersion.comp` is marked as `instance`
     IsOpen := fun i => by rw [e₂]; exact PresheafedSpace.IsOpenImmersion.comp _ _ }
 #align algebraic_geometry.Scheme.open_cover.copy AlgebraicGeometry.Scheme.OpenCover.copy
 
--- Porting note : need more hint on universe level
+-- Porting note: need more hint on universe level
 /-- The pushforward of an open cover along an isomorphism. -/
 @[simps! J obj map]
 def OpenCover.pushforwardIso {X Y : Scheme.{u}} (𝒰 : OpenCover.{v} X) (f : X ⟶ Y) [IsIso f] :
@@ -230,7 +230,7 @@ def affineBasisCoverOfAffine (R : CommRingCat) : OpenCover (Spec.obj (Opposite.o
   Covers r := by
     rw [Set.range_iff_surjective.mpr ((TopCat.epi_iff_surjective _).mp _)]
     · exact trivial
-    · -- Porting note : need more hand holding here because Lean knows that
+    · -- Porting note: need more hand holding here because Lean knows that
       -- `CommRing.ofHom ...` is iso, but without `ofHom` Lean does not know what to do
       change Epi (Spec.map (CommRingCat.ofHom (algebraMap _ _)).op).1.base
       infer_instance
@@ -258,7 +258,7 @@ theorem affineBasisCover_map_range (X : Scheme) (x : X)
     Set.range (X.affineBasisCover.map ⟨x, r⟩).1.base =
       (X.affineCover.map x).1.base '' (PrimeSpectrum.basicOpen r).1 := by
   erw [coe_comp, Set.range_comp]
-  -- Porting note : `congr` fails to see the goal is comparing image of the same function
+  -- Porting note: `congr` fails to see the goal is comparing image of the same function
   refine congr_arg (_ '' ·) ?_
   exact (PrimeSpectrum.localization_away_comap_range (Localization.Away r) r : _)
 #align algebraic_geometry.Scheme.affine_basis_cover_map_range AlgebraicGeometry.Scheme.affineBasisCover_map_range
@@ -525,7 +525,7 @@ instance pullback_snd_of_left : IsOpenImmersion (pullback.snd : pullback f g ⟶
 
 instance pullback_fst_of_right : IsOpenImmersion (pullback.fst : pullback g f ⟶ _) := by
   rw [← pullbackSymmetry_hom_comp_snd]
-  -- Porting note : was just `infer_instance`, it is a bit weird that no explicit class instance is
+  -- Porting note: was just `infer_instance`, it is a bit weird that no explicit class instance is
   -- provided but still class inference fail to find this
   exact LocallyRingedSpace.IsOpenImmersion.comp (H := inferInstance) _
 #align algebraic_geometry.IsOpenImmersion.pullback_fst_of_right AlgebraicGeometry.IsOpenImmersion.pullback_fst_of_right
@@ -534,7 +534,7 @@ instance pullback_to_base [IsOpenImmersion g] :
     IsOpenImmersion (limit.π (cospan f g) WalkingCospan.one) := by
   rw [← limit.w (cospan f g) WalkingCospan.Hom.inl]
   change IsOpenImmersion (_ ≫ f)
-  -- Porting note : was just `infer_instance`, it is a bit weird that no explicit class instance is
+  -- Porting note: was just `infer_instance`, it is a bit weird that no explicit class instance is
   -- provided but still class inference fail to find this
   exact LocallyRingedSpace.IsOpenImmersion.comp (H := inferInstance) _
 #align algebraic_geometry.IsOpenImmersion.pullback_to_base AlgebraicGeometry.IsOpenImmersion.pullback_to_base
@@ -691,7 +691,7 @@ theorem lift_app {X Y U : Scheme} (f : U ⟶ Y) (g : X ⟶ Y) [IsOpenImmersion f
             (eqToHom <|
                 IsOpenImmersion.app_eq_inv_app_app_of_comp_eq_aux _ _ _
                   (IsOpenImmersion.lift_fac f g H).symm V).op :=
-  -- Porting note : `(lift_fac ...).symm` was done by unification magic in Lean3.
+  -- Porting note: `(lift_fac ...).symm` was done by unification magic in Lean3.
   IsOpenImmersion.app_eq_invApp_app_of_comp_eq _ _ _ (lift_fac _ _ H).symm _
 #align algebraic_geometry.IsOpenImmersion.lift_app AlgebraicGeometry.IsOpenImmersion.lift_app
 
@@ -709,7 +709,7 @@ theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] {U
   rw [Scheme.basicOpen_res, inf_eq_right.mpr _] at e
   rw [← e]
   ext1
-  -- Porting note : this `dsimp` was not necessary
+  -- Porting note: this `dsimp` was not necessary
   dsimp [Opens.map]
   refine' Set.image_preimage_eq_inter_range.trans _
   erw [Set.inter_eq_left]
@@ -740,7 +740,7 @@ def Scheme.OpenCover.pullbackCover {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme
     rw [←
       show _ = (pullback.fst : pullback f (𝒰.map (𝒰.f (f.1.base x))) ⟶ _).1.base from
         PreservesPullback.iso_hom_fst Scheme.forgetToTop f (𝒰.map (𝒰.f (f.1.base x)))]
-    -- Porting note : `rw` to `erw` on this single lemma
+    -- Porting note: `rw` to `erw` on this single lemma
     erw [coe_comp]
     rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
       TopCat.pullback_fst_range]
@@ -763,7 +763,7 @@ def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Schem
     rw [←
       show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
         PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
-    -- Porting note : `rw` to `erw` on this single lemma
+    -- Porting note: `rw` to `erw` on this single lemma
     erw [coe_comp]
     rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
       TopCat.pullback_snd_range]
@@ -810,7 +810,7 @@ def Scheme.OpenCover.inter {X : Scheme.{u}} (𝒰₁ : Scheme.OpenCover.{v₁} X
   Covers x := by
     rw [IsOpenImmersion.range_pullback_to_base_of_left]
     exact ⟨𝒰₁.Covers x, 𝒰₂.Covers x⟩
-  -- Porting note : was automatic
+  -- Porting note: was automatic
   IsOpen x := PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := (𝒰₁.IsOpen _))
 #align algebraic_geometry.Scheme.open_cover.inter AlgebraicGeometry.Scheme.OpenCover.inter
 
chore: classify was rw porting notes (#10692)

Classifies by adding issue number (#10691) to porting notes claiming was rw.

Diff
@@ -559,11 +559,11 @@ theorem range_pullback_snd_of_left :
   rw [←
     show _ = (pullback.snd : pullback f g ⟶ _).1.base from
       PreservesPullback.iso_hom_snd Scheme.forgetToTop f g]
-  -- Porting note : was `rw`
+  -- Porting note (#10691): was `rw`
   erw [coe_comp]
   rw [Set.range_comp, Set.range_iff_surjective.mpr, ←
     @Set.preimage_univ _ _ (pullback.fst : pullback f.1.base g.1.base ⟶ _)]
-  -- Porting note : was `rw`
+  -- Porting note (#10691): was `rw`
   erw [TopCat.pullback_snd_image_fst_preimage]
   rw [Set.image_univ]
   rfl
@@ -577,11 +577,11 @@ theorem range_pullback_fst_of_right :
   rw [←
     show _ = (pullback.fst : pullback g f ⟶ _).1.base from
       PreservesPullback.iso_hom_fst Scheme.forgetToTop g f]
-  -- Porting note : was `rw`
+  -- Porting note (#10691): was `rw`
   erw [coe_comp]
   rw [Set.range_comp, Set.range_iff_surjective.mpr, ←
     @Set.preimage_univ _ _ (pullback.snd : pullback g.1.base f.1.base ⟶ _)]
-  -- Porting note : was `rw`
+  -- Porting note (#10691): was `rw`
   erw [TopCat.pullback_fst_image_snd_preimage]
   rw [Set.image_univ]
   rfl
@@ -704,7 +704,7 @@ theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] {U
     f.opensFunctor.obj (X.basicOpen r) = Y.basicOpen (Scheme.Hom.invApp f U r) := by
   have e := Scheme.preimage_basicOpen f (Scheme.Hom.invApp f U r)
   rw [Scheme.Hom.invApp] at e
-  -- Porting note : was `rw`
+  -- Porting note (#10691): was `rw`
   erw [PresheafedSpace.IsOpenImmersion.invApp_app_apply] at e
   rw [Scheme.basicOpen_res, inf_eq_right.mpr _] at e
   rw [← e]
chore: Remove unnecessary "rw"s (#10704)

Remove unnecessary "rw"s.

Diff
@@ -594,8 +594,7 @@ theorem range_pullback_to_base_of_left :
       Set.range f.1.base ∩ Set.range g.1.base := by
   rw [pullback.condition, Scheme.comp_val_base, coe_comp, Set.range_comp,
     range_pullback_snd_of_left, Opens.carrier_eq_coe,
-    Opens.map_obj, Opens.coe_mk, Set.image_preimage_eq_inter_range,
-    Set.inter_comm]
+    Opens.map_obj, Opens.coe_mk, Set.image_preimage_eq_inter_range]
 #align algebraic_geometry.IsOpenImmersion.range_pullback_to_base_of_left AlgebraicGeometry.IsOpenImmersion.range_pullback_to_base_of_left
 
 theorem range_pullback_to_base_of_right :
chore(*): use α → β instead of ∀ _ : α, β (#9529)
Diff
@@ -87,7 +87,7 @@ structure OpenCover (X : Scheme.{u}) where
   /-- index set of an open cover of a scheme `X` -/
   J : Type v
   /-- the subschemes of an open cover -/
-  obj : ∀ _ : J, Scheme
+  obj : J → Scheme
   /-- the embedding of subschemes to `X` -/
   map : ∀ j : J, obj j ⟶ X
   /-- given a point of `x : X`, `f x` is the index of the subscheme which contains `x`  -/
chore: rename lemmas containing "of_open" to match the naming convention (#8229)

Mostly, this means replacing "of_open" by "of_isOpen". A few lemmas names were misleading and are corrected differently. Zulip discussion.

Diff
@@ -267,7 +267,7 @@ theorem affineBasisCover_is_basis (X : Scheme) :
     TopologicalSpace.IsTopologicalBasis
       {x : Set X |
         ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base} := by
-  apply TopologicalSpace.isTopologicalBasis_of_open_of_nhds
+  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
   · rintro _ ⟨a, rfl⟩
     exact IsOpenImmersion.open_range (X.affineBasisCover.map a)
   · rintro a U haU hU
feat(AlgebraicGeometry): the big Zariski site (#8549)

This PR defines the Zariski topology on the category of schemes. It may have some applications, but it should also be considered as a test case for the Grothendieck topologies API in order to check that is general enough, in particular in terms of universes: a priori, the category which shall form the small étale site of a scheme will have the same universe parameters.

Co-authored-by: Joël Riou <37772949+joelriou@users.noreply.github.com>

Diff
@@ -750,6 +750,28 @@ def Scheme.OpenCover.pullbackCover {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme
     · rw [← TopCat.epi_iff_surjective]; infer_instance
 #align algebraic_geometry.Scheme.open_cover.pullback_cover AlgebraicGeometry.Scheme.OpenCover.pullbackCover
 
+/-- Given an open cover on `X`, we may pull them back along a morphism `f : W ⟶ X` to obtain
+an open cover of `W`. This is similar to `Scheme.OpenCover.pullbackCover`, but here we
+take `pullback (𝒰.map x) f` instead of `pullback f (𝒰.map x)`. -/
+@[simps]
+def Scheme.OpenCover.pullbackCover' {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
+    W.OpenCover where
+  J := 𝒰.J
+  obj x := pullback (𝒰.map x) f
+  map x := pullback.snd
+  f x := 𝒰.f (f.1.base x)
+  Covers x := by
+    rw [←
+      show _ = (pullback.snd : pullback (𝒰.map (𝒰.f (f.1.base x))) f ⟶ _).1.base from
+        PreservesPullback.iso_hom_snd Scheme.forgetToTop (𝒰.map (𝒰.f (f.1.base x))) f]
+    -- Porting note : `rw` to `erw` on this single lemma
+    erw [coe_comp]
+    rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ,
+      TopCat.pullback_snd_range]
+    obtain ⟨y, h⟩ := 𝒰.Covers (f.1.base x)
+    exact ⟨y, h⟩
+    · rw [← TopCat.epi_iff_surjective]; infer_instance
+
 theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
     ⋃ i, Set.range (𝒰.map i).1.base = Set.univ := by
   rw [Set.eq_univ_iff_forall]
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
@@ -35,6 +35,10 @@ abbrev IsOpenImmersion {X Y : Scheme} (f : X ⟶ Y) : Prop :=
   LocallyRingedSpace.IsOpenImmersion f
 #align algebraic_geometry.IsOpenImmersion AlgebraicGeometry.IsOpenImmersion
 
+instance IsOpenImmersion.comp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z)
+  [IsOpenImmersion f] [IsOpenImmersion g] : IsOpenImmersion (f ≫ g) :=
+LocallyRingedSpace.IsOpenImmersion.comp f g
+
 namespace LocallyRingedSpace.IsOpenImmersion
 
 /-- To show that a locally ringed space is a scheme, it suffices to show that it has a jointly
@@ -369,13 +373,17 @@ end ToScheme
 end PresheafedSpace.IsOpenImmersion
 
 /-- The restriction of a Scheme along an open embedding. -/
-@[simps!]
+@[simps! (config := .lemmasOnly) carrier, simps! presheaf_map presheaf_obj]
 def Scheme.restrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X} (h : OpenEmbedding f) :
     Scheme :=
   { PresheafedSpace.IsOpenImmersion.toScheme X (X.toPresheafedSpace.ofRestrict h) with
     toPresheafedSpace := X.toPresheafedSpace.restrict h }
 #align algebraic_geometry.Scheme.restrict AlgebraicGeometry.Scheme.restrict
 
+lemma Scheme.restrict_toPresheafedSpace
+    {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X} (h : OpenEmbedding f) :
+    (X.restrict h).toPresheafedSpace = X.toPresheafedSpace.restrict h := rfl
+
 /-- The canonical map from the restriction to the subspace. -/
 @[simps!]
 def Scheme.ofRestrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X}
@@ -617,7 +625,6 @@ theorem lift_uniq (H' : Set.range g.1.base ⊆ Set.range f.1.base) (l : Y ⟶ X)
 #align algebraic_geometry.IsOpenImmersion.lift_uniq AlgebraicGeometry.IsOpenImmersion.lift_uniq
 
 /-- Two open immersions with equal range are isomorphic. -/
-@[simps]
 def isoOfRangeEq [IsOpenImmersion g] (e : Set.range f.1.base = Set.range g.1.base) : X ≅ Y where
   hom := lift g f (le_of_eq e)
   inv := lift f g (le_of_eq e.symm)
@@ -625,6 +632,18 @@ def isoOfRangeEq [IsOpenImmersion g] (e : Set.range f.1.base = Set.range g.1.bas
   inv_hom_id := by rw [← cancel_mono g]; simp
 #align algebraic_geometry.IsOpenImmersion.iso_of_range_eq AlgebraicGeometry.IsOpenImmersion.isoOfRangeEq
 
+@[simp, reassoc]
+lemma isoOfRangeEq_hom_fac {X Y Z : Scheme} (f : X ⟶ Z) (g : Y ⟶ Z)
+    [IsOpenImmersion f] [IsOpenImmersion g] (e : Set.range f.1.base = Set.range g.1.base) :
+    (isoOfRangeEq f g e).hom ≫ g = f :=
+  lift_fac _ _ (le_of_eq e)
+
+@[simp, reassoc]
+lemma isoOfRangeEq_inv_fac {X Y Z : Scheme} (f : X ⟶ Z) (g : Y ⟶ Z)
+    [IsOpenImmersion f] [IsOpenImmersion g] (e : Set.range f.1.base = Set.range g.1.base) :
+    (isoOfRangeEq f g e).inv ≫ f = g :=
+  lift_fac _ _ (le_of_eq e.symm)
+
 /-- The functor `opens X ⥤ opens Y` associated with an open immersion `f : X ⟶ Y`. -/
 abbrev _root_.AlgebraicGeometry.Scheme.Hom.opensFunctor {X Y : Scheme} (f : X ⟶ Y)
     [H : IsOpenImmersion f] : Opens X ⥤ Opens Y :=
@@ -709,129 +728,6 @@ def Hom.opensRange {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] : Opens
 
 end Scheme
 
-section
-
-variable (X : Scheme)
-
--- Porting note : `simps` can't synthesize `obj_left, obj_hom, mapLeft`
-/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
--- @[simps obj_left obj_hom mapLeft]
-def Scheme.restrictFunctor : Opens X ⥤ Over X where
-  obj U := Over.mk (X.ofRestrict U.openEmbedding)
-  map {U V} i :=
-    Over.homMk
-      (IsOpenImmersion.lift (X.ofRestrict _) (X.ofRestrict _) <| by
-          dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-          -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-          erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
-          rw [Subtype.range_val, Subtype.range_val]
-          exact i.le)
-      (IsOpenImmersion.lift_fac _ _ _)
-  map_id U := by
-    ext1
-    dsimp only [Over.homMk_left, Over.id_left]
-    rw [← cancel_mono (X.ofRestrict U.openEmbedding), Category.id_comp,
-      IsOpenImmersion.lift_fac]
-  map_comp {U V W} i j := by
-    ext1
-    dsimp only [Over.homMk_left, Over.comp_left]
-    rw [← cancel_mono (X.ofRestrict W.openEmbedding), Category.assoc]
-    iterate 3 rw [IsOpenImmersion.lift_fac]
-#align algebraic_geometry.Scheme.restrict_functor AlgebraicGeometry.Scheme.restrictFunctor
-
-@[simp] lemma Scheme.restrictFunctor_obj_left (U : Opens X) :
-  (X.restrictFunctor.obj U).left = (X.restrict U.openEmbedding) := rfl
-
-@[simp] lemma Scheme.restrictFunctor_obj_hom (U : Opens X) :
-  (X.restrictFunctor.obj U).hom = (X.ofRestrict U.openEmbedding) := rfl
-
-@[simp] lemma Scheme.restrictFunctor_map_left {U V : Opens X} (i : U ⟶ V) :
-  ((X.restrictFunctor.map i).left) =
-  IsOpenImmersion.lift (X.ofRestrict V.openEmbedding) (X.ofRestrict U.openEmbedding) (by
-    dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
-    exact i.le) := rfl
-
--- Porting note : the `by ...` used to be automatically done by unification magic
-@[reassoc]
-theorem Scheme.restrictFunctor_map_ofRestrict {U V : Opens X} (i : U ⟶ V) :
-    (X.restrictFunctor.map i).1 ≫ X.ofRestrict _ = X.ofRestrict _ :=
-  IsOpenImmersion.lift_fac _ _ (by
-    dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
-    exact i.le)
-#align algebraic_geometry.Scheme.restrict_functor_map_ofRestrict AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrict
-
-theorem Scheme.restrictFunctor_map_base {U V : Opens X} (i : U ⟶ V) :
-    (X.restrictFunctor.map i).1.1.base = (Opens.toTopCat _).map i := by
-  ext a; refine Subtype.ext ?_ -- Porting note : `ext` did not pick up `Subtype.ext`
-  exact (congr_arg (fun f : X.restrict U.openEmbedding ⟶ X => f.1.base a)
-        (X.restrictFunctor_map_ofRestrict i))
-#align algebraic_geometry.Scheme.restrict_functor_map_base AlgebraicGeometry.Scheme.restrictFunctor_map_base
-
-theorem Scheme.restrictFunctor_map_app_aux {U V : Opens X} (i : U ⟶ V) (W : Opens V) :
-    U.openEmbedding.isOpenMap.functor.obj ((Opens.map (X.restrictFunctor.map i).1.val.base).obj W) ≤
-      V.openEmbedding.isOpenMap.functor.obj W := by
-  simp only [← SetLike.coe_subset_coe, IsOpenMap.functor_obj_coe, Set.image_subset_iff,
-    Scheme.restrictFunctor_map_base, Opens.map_coe, Opens.inclusion_apply]
-  rintro _ h
-  exact ⟨_, h, rfl⟩
-#align algebraic_geometry.Scheme.restrict_functor_map_app_aux AlgebraicGeometry.Scheme.restrictFunctor_map_app_aux
-
-theorem Scheme.restrictFunctor_map_app {U V : Opens X} (i : U ⟶ V) (W : Opens V) :
-    (X.restrictFunctor.map i).1.1.c.app (op W) =
-      X.presheaf.map (homOfLE <| X.restrictFunctor_map_app_aux i W).op := by
-  have e₁ :=
-    Scheme.congr_app (X.restrictFunctor_map_ofRestrict i)
-      (op <| V.openEmbedding.isOpenMap.functor.obj W)
-  rw [Scheme.comp_val_c_app] at e₁
-  -- Porting note : `Opens.map_functor_eq` need more help
-  have e₂ := (X.restrictFunctor.map i).1.val.c.naturality (eqToHom <| W.map_functor_eq (U := V)).op
-  rw [← IsIso.eq_inv_comp] at e₂
-  dsimp at e₁ e₂ ⊢
-  rw [e₂, W.adjunction_counit_map_functor (U := V), ← IsIso.eq_inv_comp, IsIso.inv_comp_eq,
-    ← IsIso.eq_comp_inv] at e₁
-  simp_rw [eqToHom_map (Opens.map _), eqToHom_map (IsOpenMap.functor _), ← Functor.map_inv,
-    ← Functor.map_comp] at e₁
-  rw [e₁]
-  congr 1
-#align algebraic_geometry.Scheme.restrict_functor_map_app AlgebraicGeometry.Scheme.restrictFunctor_map_app
-
-/-- The functor that restricts to open subschemes and then takes global section is
-isomorphic to the structure sheaf. -/
-@[simps!]
-def Scheme.restrictFunctorΓ : X.restrictFunctor.op ⋙ (Over.forget X).op ⋙ Scheme.Γ ≅ X.presheaf :=
-  NatIso.ofComponents
-    (fun U => X.presheaf.mapIso ((eqToIso (unop U).openEmbedding_obj_top).symm.op : _))
-    (by
-      intro U V i
-      dsimp [-Scheme.restrictFunctor_map_left]
-      rw [X.restrictFunctor_map_app, ← Functor.map_comp, ← Functor.map_comp]
-      congr 1)
-#align algebraic_geometry.Scheme.restrict_functor_Γ AlgebraicGeometry.Scheme.restrictFunctorΓ
-
-end
-
-/-- The restriction of an isomorphism onto an open set. -/
-noncomputable abbrev Scheme.restrictMapIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f]
-    (U : Opens Y) :
-    X.restrict ((Opens.map f.1.base).obj U).openEmbedding ≅ Y.restrict U.openEmbedding := by
-  apply IsOpenImmersion.isoOfRangeEq (f := X.ofRestrict _ ≫ f)
-    (H := PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := inferInstance))
-    (Y.ofRestrict _) _
-  dsimp [Opens.inclusion]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  rw [coe_comp, Set.range_comp]; erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
-  dsimp
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  rw [Subtype.range_val]; erw [Subtype.range_coe]
-  refine' @Set.image_preimage_eq _ _ f.1.base U.1 _
-  rw [← TopCat.epi_iff_surjective]
-  infer_instance
-#align algebraic_geometry.Scheme.restrict_map_iso AlgebraicGeometry.Scheme.restrictMapIso
-
 /-- Given an open cover on `X`, we may pull them back along a morphism `W ⟶ X` to obtain
 an open cover of `W`. -/
 @[simps]
@@ -913,262 +809,4 @@ def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
     exact (Opens.mem_iSup.mp this).choose_spec
 #align algebraic_geometry.Scheme.open_cover_of_supr_eq_top AlgebraicGeometry.Scheme.openCoverOfSuprEqTop
 
-section MorphismRestrict
-
-/-- Given a morphism `f : X ⟶ Y` and an open set `U ⊆ Y`, we have `X ×[Y] U ≅ X |_{f ⁻¹ U}` -/
-def pullbackRestrictIsoRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
-    pullback f (Y.ofRestrict U.openEmbedding) ≅
-      X.restrict ((Opens.map f.1.base).obj U).openEmbedding := by
-  refine' IsOpenImmersion.isoOfRangeEq pullback.fst (X.ofRestrict _) _
-  rw [IsOpenImmersion.range_pullback_fst_of_right]
-  dsimp [Opens.inclusion]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val]; erw [Subtype.range_coe]
-  rfl
-#align algebraic_geometry.pullback_restrict_iso_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict
-
-@[simp, reassoc]
-theorem pullbackRestrictIsoRestrict_inv_fst {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
-    (pullbackRestrictIsoRestrict f U).inv ≫ pullback.fst = X.ofRestrict _ := by
-  delta pullbackRestrictIsoRestrict; simp
-#align algebraic_geometry.pullback_restrict_iso_restrict_inv_fst AlgebraicGeometry.pullbackRestrictIsoRestrict_inv_fst
-
-@[simp, reassoc]
-theorem pullbackRestrictIsoRestrict_hom_restrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
-    (pullbackRestrictIsoRestrict f U).hom ≫ X.ofRestrict _ = pullback.fst := by
-  delta pullbackRestrictIsoRestrict; simp
-#align algebraic_geometry.pullback_restrict_iso_restrict_hom_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict_hom_restrict
-
-/-- The restriction of a morphism `X ⟶ Y` onto `X |_{f ⁻¹ U} ⟶ Y |_ U`. -/
-def morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
-    X.restrict ((Opens.map f.1.base).obj U).openEmbedding ⟶ Y.restrict U.openEmbedding :=
-  (pullbackRestrictIsoRestrict f U).inv ≫ pullback.snd
-#align algebraic_geometry.morphism_restrict AlgebraicGeometry.morphismRestrict
-
-/-- the notation for restricting a morphism of scheme to an open subset of the target scheme -/
-infixl:80 " ∣_ " => morphismRestrict
-
-@[simp, reassoc]
-theorem pullbackRestrictIsoRestrict_hom_morphismRestrict {X Y : Scheme} (f : X ⟶ Y)
-    (U : Opens Y) : (pullbackRestrictIsoRestrict f U).hom ≫ f ∣_ U = pullback.snd :=
-  Iso.hom_inv_id_assoc _ _
-#align algebraic_geometry.pullback_restrict_iso_restrict_hom_morphism_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict_hom_morphismRestrict
-
-@[simp, reassoc]
-theorem morphismRestrict_ι {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
-    (f ∣_ U) ≫ Y.ofRestrict U.openEmbedding = X.ofRestrict _ ≫ f := by
-  delta morphismRestrict
-  rw [Category.assoc, pullback.condition.symm, pullbackRestrictIsoRestrict_inv_fst_assoc]
-#align algebraic_geometry.morphism_restrict_ι AlgebraicGeometry.morphismRestrict_ι
-
-theorem isPullback_morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
-    IsPullback (f ∣_ U) (X.ofRestrict _) (Y.ofRestrict _) f := by
-  delta morphismRestrict
-  rw [← Category.id_comp f]
-  refine'
-    (IsPullback.of_horiz_isIso ⟨_⟩).paste_horiz
-      (IsPullback.of_hasPullback f (Y.ofRestrict U.openEmbedding)).flip
-  -- Porting note : changed `rw` to `erw`
-  erw [pullbackRestrictIsoRestrict_inv_fst]; rw [Category.comp_id]
-#align algebraic_geometry.is_pullback_morphism_restrict AlgebraicGeometry.isPullback_morphismRestrict
-
-theorem morphismRestrict_comp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) (U : Opens Z) :
-    (f ≫ g) ∣_ U = ((f ∣_ (Opens.map g.val.base).obj U) ≫ g ∣_ U : _) := by
-  delta morphismRestrict
-  rw [← pullbackRightPullbackFstIso_inv_snd_snd]
-  simp_rw [← Category.assoc]
-  congr 1
-  rw [← cancel_mono pullback.fst]
-  simp_rw [Category.assoc]
-  rw [pullbackRestrictIsoRestrict_inv_fst, pullbackRightPullbackFstIso_inv_snd_fst, ←
-    pullback.condition, pullbackRestrictIsoRestrict_inv_fst_assoc,
-    pullbackRestrictIsoRestrict_inv_fst_assoc]
-#align algebraic_geometry.morphism_restrict_comp AlgebraicGeometry.morphismRestrict_comp
-
-instance {X Y : Scheme} (f : X ⟶ Y) [IsIso f] (U : Opens Y) : IsIso (f ∣_ U) := by
-  delta morphismRestrict; infer_instance
-
-theorem morphismRestrict_base_coe {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
-    @Coe.coe U Y (⟨fun x => x.1⟩) ((f ∣_ U).1.base x) = f.1.base x.1 :=
-  congr_arg (fun f => PresheafedSpace.Hom.base (LocallyRingedSpace.Hom.val f) x)
-    (morphismRestrict_ι f U)
-#align algebraic_geometry.morphism_restrict_base_coe AlgebraicGeometry.morphismRestrict_base_coe
-
-theorem morphismRestrict_val_base {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
-    ⇑(f ∣_ U).1.base = U.1.restrictPreimage f.1.base :=
-  funext fun x => Subtype.ext (morphismRestrict_base_coe f U x)
-#align algebraic_geometry.morphism_restrict_val_base AlgebraicGeometry.morphismRestrict_val_base
-
-theorem image_morphismRestrict_preimage {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
-    (V : Opens U) :
-    ((Opens.map f.val.base).obj U).openEmbedding.isOpenMap.functor.obj
-        ((Opens.map (f ∣_ U).val.base).obj V) =
-      (Opens.map f.val.base).obj (U.openEmbedding.isOpenMap.functor.obj V) := by
-  ext1
-  ext x
-  constructor
-  · rintro ⟨⟨x, hx⟩, hx' : (f ∣_ U).1.base _ ∈ V, rfl⟩
-    refine' ⟨⟨_, hx⟩, _, rfl⟩
-    -- Porting note : this rewrite was not necessary
-    rw [SetLike.mem_coe]
-    convert hx'
-    -- Porting note : `ext1` is not compiling
-    refine Subtype.ext ?_
-    exact (morphismRestrict_base_coe f U ⟨x, hx⟩).symm
-  · rintro ⟨⟨x, hx⟩, hx' : _ ∈ V.1, rfl : x = _⟩
-    refine' ⟨⟨_, hx⟩, (_ : (f ∣_ U).1.base ⟨x, hx⟩ ∈ V.1), rfl⟩
-    convert hx'
-    -- Porting note : `ext1` is compiling
-    refine Subtype.ext ?_
-    exact morphismRestrict_base_coe f U ⟨x, hx⟩
-#align algebraic_geometry.image_morphism_restrict_preimage AlgebraicGeometry.image_morphismRestrict_preimage
-
-theorem morphismRestrict_c_app {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (V : Opens U) :
-    (f ∣_ U).1.c.app (op V) =
-      f.1.c.app (op (U.openEmbedding.isOpenMap.functor.obj V)) ≫
-        X.presheaf.map (eqToHom (image_morphismRestrict_preimage f U V)).op := by
-  have :=
-    Scheme.congr_app (morphismRestrict_ι f U) (op (U.openEmbedding.isOpenMap.functor.obj V))
-  rw [Scheme.comp_val_c_app, Scheme.comp_val_c_app_assoc] at this
-  have e : (Opens.map U.inclusion).obj (U.openEmbedding.isOpenMap.functor.obj V) = V := by
-    ext1; exact Set.preimage_image_eq _ Subtype.coe_injective
-  have : _ ≫ X.presheaf.map _ = _ :=
-    (((f ∣_ U).1.c.naturality (eqToHom e).op).symm.trans ?_).trans this
-  · rw [← IsIso.eq_comp_inv, ← Functor.map_inv, Category.assoc] at this
-    rw [this]
-    congr 1
-    erw [← X.presheaf.map_comp, ← X.presheaf.map_comp]
-    congr 1
-  · change Y.presheaf.map _ ≫ _ = Y.presheaf.map _ ≫ _
-    congr 1
-#align algebraic_geometry.morphism_restrict_c_app AlgebraicGeometry.morphismRestrict_c_app
-
-theorem Γ_map_morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
-    Scheme.Γ.map (f ∣_ U).op =
-      Y.presheaf.map (eqToHom <| U.openEmbedding_obj_top.symm).op ≫
-        f.1.c.app (op U) ≫
-          X.presheaf.map (eqToHom <| ((Opens.map f.val.base).obj U).openEmbedding_obj_top).op := by
-  rw [Scheme.Γ_map_op, morphismRestrict_c_app f U ⊤, f.val.c.naturality_assoc]
-  erw [← X.presheaf.map_comp]
-  congr
-#align algebraic_geometry.Γ_map_morphism_restrict AlgebraicGeometry.Γ_map_morphismRestrict
-
-/-- Restricting a morphism onto the image of an open immersion is isomorphic to the base change
-along the immersion. -/
-def morphismRestrictOpensRange {X Y U : Scheme} (f : X ⟶ Y) (g : U ⟶ Y) [hg : IsOpenImmersion g] :
-    Arrow.mk (f ∣_ Scheme.Hom.opensRange g) ≅ Arrow.mk (pullback.snd : pullback f g ⟶ _) := by
-  let V : Opens Y := Scheme.Hom.opensRange g
-  let e :=
-    IsOpenImmersion.isoOfRangeEq g (Y.ofRestrict V.openEmbedding) Subtype.range_coe.symm
-  let t : pullback f g ⟶ pullback f (Y.ofRestrict V.openEmbedding) :=
-    pullback.map _ _ _ _ (𝟙 _) e.hom (𝟙 _) (by rw [Category.comp_id, Category.id_comp])
-      (by rw [Category.comp_id, IsOpenImmersion.isoOfRangeEq_hom, IsOpenImmersion.lift_fac])
-  symm
-  refine' Arrow.isoMk (asIso t ≪≫ pullbackRestrictIsoRestrict f V) e _
-  rw [Iso.trans_hom, asIso_hom, ← Iso.comp_inv_eq, ← cancel_mono g, Arrow.mk_hom, Arrow.mk_hom,
-    IsOpenImmersion.isoOfRangeEq_inv, Category.assoc, Category.assoc, Category.assoc,
-    IsOpenImmersion.lift_fac, ← pullback.condition, morphismRestrict_ι,
-    pullbackRestrictIsoRestrict_hom_restrict_assoc, pullback.lift_fst_assoc, Category.comp_id]
-#align algebraic_geometry.morphism_restrict_opens_range AlgebraicGeometry.morphismRestrictOpensRange
-
-/-- The restrictions onto two equal open sets are isomorphic. This currently has bad defeqs when
-unfolded, but it should not matter for now. Replace this definition if better defeqs are needed. -/
-def morphismRestrictEq {X Y : Scheme} (f : X ⟶ Y) {U V : Opens Y} (e : U = V) :
-    Arrow.mk (f ∣_ U) ≅ Arrow.mk (f ∣_ V) :=
-  eqToIso (by subst e; rfl)
-#align algebraic_geometry.morphism_restrict_eq AlgebraicGeometry.morphismRestrictEq
-
--- Porting note : this does not compile under 200000 heart beats. The proof is more or less
--- preserved with some morphisms named so that instances about them can be made manually.
-set_option maxHeartbeats 300000 in
-/-- Restricting a morphism twice is isomorphic to one restriction. -/
-def morphismRestrictRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (V : Opens U) :
-    Arrow.mk (f ∣_ U ∣_ V) ≅ Arrow.mk (f ∣_ U.openEmbedding.isOpenMap.functor.obj V) := by
-  set g := ((Y.restrict U.openEmbedding).ofRestrict (V.openEmbedding (X := TopCat.of U)) ≫
-    Y.ofRestrict U.openEmbedding)
-  have i1 : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _
-  have i2 : HasPullback f g := IsOpenImmersion.hasPullback_of_right g f
-  set h : _ ⟶ pullback f g :=
-    (pullbackRestrictIsoRestrict (f ∣_ U) V).inv ≫
-      (pullbackSymmetry _ _).hom ≫
-      pullback.map _ _ _ _ (𝟙 _)
-        ((pullbackRestrictIsoRestrict f U).inv ≫ (pullbackSymmetry _ _).hom) (𝟙 _)
-        ((Category.comp_id _).trans (Category.id_comp _).symm) (by aesop_cat) ≫
-      (pullbackRightPullbackFstIso _ _ _).hom ≫ (pullbackSymmetry _ _).hom
-  have i3 : IsIso h
-  · repeat
-      apply (config := { allowSynthFailures := true }) IsIso.comp_isIso
-  have : (f ∣_ U ∣_ V) ≫ (Iso.refl _).hom = (asIso h).hom ≫ pullback.snd (f := f) (g := g)
-  · simp only [Category.comp_id, pullbackRightPullbackFstIso_hom_fst, Iso.refl_hom,
-      Category.assoc, pullbackSymmetry_hom_comp_snd, asIso_hom, pullback.lift_fst,
-      pullbackSymmetry_hom_comp_fst]
-    rfl
-  refine'
-    Arrow.isoMk' _ _ _ _ this.symm ≪≫
-      (morphismRestrictOpensRange _ _).symm ≪≫ morphismRestrictEq _ _
-  ext1
-  dsimp
-  rw [coe_comp, Set.range_comp]
-  apply congr_arg (U.inclusion '' ·)
-  exact Subtype.range_val
-#align algebraic_geometry.morphism_restrict_restrict AlgebraicGeometry.morphismRestrictRestrict
-
-/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
-def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
-    (r : Y.presheaf.obj (op U)) :
-    Arrow.mk
-        (f ∣_ U ∣_
-          (Y.restrict _).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
-      Arrow.mk (f ∣_ Y.basicOpen r) := by
-  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
-  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
-  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
-  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
-  erw [← comp_apply]
-  erw [← Y.presheaf.map_comp]
-  rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
-  erw [← e]
-  ext1; dsimp [Opens.map, Opens.inclusion]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]; erw [ContinuousMap.coe_mk]
-  rw [Subtype.range_val]
-  exact Y.basicOpen_le r
-#align algebraic_geometry.morphism_restrict_restrict_basic_open AlgebraicGeometry.morphismRestrictRestrictBasicOpen
-
-set_option maxHeartbeats 500000 in
-/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
--/
-def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
-    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
-      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
-  fapply Arrow.isoMk'
-  · refine' Y.restrictStalkIso U.openEmbedding ((f ∣_ U).1.1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
-    apply Inseparable.of_eq
-    exact morphismRestrict_base_coe f U x
-  · exact X.restrictStalkIso (Opens.openEmbedding _) _
-  · apply TopCat.Presheaf.stalk_hom_ext
-    intro V hxV
-    simp only [TopCat.Presheaf.stalkCongr_hom, CategoryTheory.Category.assoc,
-      CategoryTheory.Iso.trans_hom]
-    erw [PresheafedSpace.restrictStalkIso_hom_eq_germ_assoc]
-    erw [PresheafedSpace.stalkMap_germ_assoc _ V ⟨_, hxV⟩]
-    rw [TopCat.Presheaf.germ_stalkSpecializes'_assoc]
-    -- Porting note : explicit variables and proofs were not necessary
-    erw [PresheafedSpace.stalkMap_germ _ (U.openEmbedding.isOpenMap.functor.obj V)
-      ⟨x.1, ⟨⟨f.1.base x.1, x.2⟩, _, rfl⟩⟩]
-    swap
-    · rw [morphismRestrict_val_base] at hxV
-      exact hxV
-    erw [PresheafedSpace.restrictStalkIso_hom_eq_germ]
-    rw [morphismRestrict_c_app, Category.assoc, TopCat.Presheaf.germ_res]
-    rfl
-#align algebraic_geometry.morphism_restrict_stalk_map AlgebraicGeometry.morphismRestrictStalkMap
-
-instance {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) [IsOpenImmersion f] :
-    IsOpenImmersion (f ∣_ U) := by
-  delta morphismRestrict
-  refine PresheafedSpace.IsOpenImmersion.comp _ _
-
-end MorphismRestrict
-
 end AlgebraicGeometry
chore: missing spaces after rcases, convert and congrm (#7725)

Replace rcases( with rcases (. Same thing for convert( and congrm(. No other change.

Diff
@@ -135,7 +135,7 @@ def OpenCover.bind (f : ∀ x : 𝒰.J, OpenCover (𝒰.obj x)) : OpenCover X wh
   Covers x := by
     let y := (𝒰.Covers x).choose
     have hy : (𝒰.map (𝒰.f x)).val.base y = x := (𝒰.Covers x).choose_spec
-    rcases(f (𝒰.f x)).Covers y with ⟨z, hz⟩
+    rcases (f (𝒰.f x)).Covers y with ⟨z, hz⟩
     change x ∈ Set.range ((f (𝒰.f x)).map ((f (𝒰.f x)).f y) ≫ 𝒰.map (𝒰.f x)).1.base
     use z
     erw [comp_apply]
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -722,7 +722,9 @@ def Scheme.restrictFunctor : Opens X ⥤ Over X where
     Over.homMk
       (IsOpenImmersion.lift (X.ofRestrict _) (X.ofRestrict _) <| by
           dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-          rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
+          -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+          erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
+          rw [Subtype.range_val, Subtype.range_val]
           exact i.le)
       (IsOpenImmersion.lift_fac _ _ _)
   map_id U := by
@@ -747,7 +749,8 @@ def Scheme.restrictFunctor : Opens X ⥤ Over X where
   ((X.restrictFunctor.map i).left) =
   IsOpenImmersion.lift (X.ofRestrict V.openEmbedding) (X.ofRestrict U.openEmbedding) (by
     dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
     exact i.le) := rfl
 
 -- Porting note : the `by ...` used to be automatically done by unification magic
@@ -756,7 +759,8 @@ theorem Scheme.restrictFunctor_map_ofRestrict {U V : Opens X} (i : U ⟶ V) :
     (X.restrictFunctor.map i).1 ≫ X.ofRestrict _ = X.ofRestrict _ :=
   IsOpenImmersion.lift_fac _ _ (by
     dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
     exact i.le)
 #align algebraic_geometry.Scheme.restrict_functor_map_ofRestrict AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrict
 
@@ -818,9 +822,11 @@ noncomputable abbrev Scheme.restrictMapIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f
     (H := PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := inferInstance))
     (Y.ofRestrict _) _
   dsimp [Opens.inclusion]
-  rw [coe_comp, Set.range_comp, ContinuousMap.coe_mk, ContinuousMap.coe_mk]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  rw [coe_comp, Set.range_comp]; erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
   dsimp
-  rw [Subtype.range_val, Subtype.range_coe]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  rw [Subtype.range_val]; erw [Subtype.range_coe]
   refine' @Set.image_preimage_eq _ _ f.1.base U.1 _
   rw [← TopCat.epi_iff_surjective]
   infer_instance
@@ -916,7 +922,8 @@ def pullbackRestrictIsoRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
   refine' IsOpenImmersion.isoOfRangeEq pullback.fst (X.ofRestrict _) _
   rw [IsOpenImmersion.range_pullback_fst_of_right]
   dsimp [Opens.inclusion]
-  rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_coe]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val]; erw [Subtype.range_coe]
   rfl
 #align algebraic_geometry.pullback_restrict_iso_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict
 
@@ -1122,8 +1129,9 @@ def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
   rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
   erw [← e]
   ext1; dsimp [Opens.map, Opens.inclusion]
-  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, ContinuousMap.coe_mk,
-    Subtype.range_val]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]; erw [ContinuousMap.coe_mk]
+  rw [Subtype.range_val]
   exact Y.basicOpen_le r
 #align algebraic_geometry.morphism_restrict_restrict_basic_open AlgebraicGeometry.morphismRestrictRestrictBasicOpen
 
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -722,9 +722,7 @@ def Scheme.restrictFunctor : Opens X ⥤ Over X where
     Over.homMk
       (IsOpenImmersion.lift (X.ofRestrict _) (X.ofRestrict _) <| by
           dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-          -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-          erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
-          rw [Subtype.range_val, Subtype.range_val]
+          rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
           exact i.le)
       (IsOpenImmersion.lift_fac _ _ _)
   map_id U := by
@@ -749,8 +747,7 @@ def Scheme.restrictFunctor : Opens X ⥤ Over X where
   ((X.restrictFunctor.map i).left) =
   IsOpenImmersion.lift (X.ofRestrict V.openEmbedding) (X.ofRestrict U.openEmbedding) (by
     dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
+    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
     exact i.le) := rfl
 
 -- Porting note : the `by ...` used to be automatically done by unification magic
@@ -759,8 +756,7 @@ theorem Scheme.restrictFunctor_map_ofRestrict {U V : Opens X} (i : U ⟶ V) :
     (X.restrictFunctor.map i).1 ≫ X.ofRestrict _ = X.ofRestrict _ :=
   IsOpenImmersion.lift_fac _ _ (by
     dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
+    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
     exact i.le)
 #align algebraic_geometry.Scheme.restrict_functor_map_ofRestrict AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrict
 
@@ -822,11 +818,9 @@ noncomputable abbrev Scheme.restrictMapIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f
     (H := PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := inferInstance))
     (Y.ofRestrict _) _
   dsimp [Opens.inclusion]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  rw [coe_comp, Set.range_comp]; erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
+  rw [coe_comp, Set.range_comp, ContinuousMap.coe_mk, ContinuousMap.coe_mk]
   dsimp
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  rw [Subtype.range_val]; erw [Subtype.range_coe]
+  rw [Subtype.range_val, Subtype.range_coe]
   refine' @Set.image_preimage_eq _ _ f.1.base U.1 _
   rw [← TopCat.epi_iff_surjective]
   infer_instance
@@ -922,8 +916,7 @@ def pullbackRestrictIsoRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
   refine' IsOpenImmersion.isoOfRangeEq pullback.fst (X.ofRestrict _) _
   rw [IsOpenImmersion.range_pullback_fst_of_right]
   dsimp [Opens.inclusion]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val]; erw [Subtype.range_coe]
+  rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_coe]
   rfl
 #align algebraic_geometry.pullback_restrict_iso_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict
 
@@ -1129,9 +1122,8 @@ def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
   rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
   erw [← e]
   ext1; dsimp [Opens.map, Opens.inclusion]
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]; erw [ContinuousMap.coe_mk]
-  rw [Subtype.range_val]
+  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, ContinuousMap.coe_mk,
+    Subtype.range_val]
   exact Y.basicOpen_le r
 #align algebraic_geometry.morphism_restrict_restrict_basic_open AlgebraicGeometry.morphismRestrictRestrictBasicOpen
 
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
@@ -722,7 +722,9 @@ def Scheme.restrictFunctor : Opens X ⥤ Over X where
     Over.homMk
       (IsOpenImmersion.lift (X.ofRestrict _) (X.ofRestrict _) <| by
           dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-          rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
+          -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+          erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
+          rw [Subtype.range_val, Subtype.range_val]
           exact i.le)
       (IsOpenImmersion.lift_fac _ _ _)
   map_id U := by
@@ -747,7 +749,8 @@ def Scheme.restrictFunctor : Opens X ⥤ Over X where
   ((X.restrictFunctor.map i).left) =
   IsOpenImmersion.lift (X.ofRestrict V.openEmbedding) (X.ofRestrict U.openEmbedding) (by
     dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
     exact i.le) := rfl
 
 -- Porting note : the `by ...` used to be automatically done by unification magic
@@ -756,7 +759,8 @@ theorem Scheme.restrictFunctor_map_ofRestrict {U V : Opens X} (i : U ⟶ V) :
     (X.restrictFunctor.map i).1 ≫ X.ofRestrict _ = X.ofRestrict _ :=
   IsOpenImmersion.lift_fac _ _ (by
     dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
-    rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_val]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
     exact i.le)
 #align algebraic_geometry.Scheme.restrict_functor_map_ofRestrict AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrict
 
@@ -818,9 +822,11 @@ noncomputable abbrev Scheme.restrictMapIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f
     (H := PresheafedSpace.IsOpenImmersion.comp (hf := inferInstance) (hg := inferInstance))
     (Y.ofRestrict _) _
   dsimp [Opens.inclusion]
-  rw [coe_comp, Set.range_comp, ContinuousMap.coe_mk, ContinuousMap.coe_mk]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  rw [coe_comp, Set.range_comp]; erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
   dsimp
-  rw [Subtype.range_val, Subtype.range_coe]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  rw [Subtype.range_val]; erw [Subtype.range_coe]
   refine' @Set.image_preimage_eq _ _ f.1.base U.1 _
   rw [← TopCat.epi_iff_surjective]
   infer_instance
@@ -916,7 +922,8 @@ def pullbackRestrictIsoRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
   refine' IsOpenImmersion.isoOfRangeEq pullback.fst (X.ofRestrict _) _
   rw [IsOpenImmersion.range_pullback_fst_of_right]
   dsimp [Opens.inclusion]
-  rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk, Subtype.range_val, Subtype.range_coe]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val]; erw [Subtype.range_coe]
   rfl
 #align algebraic_geometry.pullback_restrict_iso_restrict AlgebraicGeometry.pullbackRestrictIsoRestrict
 
@@ -1122,8 +1129,9 @@ def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
   rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
   erw [← e]
   ext1; dsimp [Opens.map, Opens.inclusion]
-  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, ContinuousMap.coe_mk,
-    Subtype.range_val]
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left]; erw [ContinuousMap.coe_mk]
+  rw [Subtype.range_val]
   exact Y.basicOpen_le r
 #align algebraic_geometry.morphism_restrict_restrict_basic_open AlgebraicGeometry.morphismRestrictRestrictBasicOpen
 
doc: fix typos (#7470)

Co-Authored-By: newell <newell.jensen@gmail.com>

Diff
@@ -376,7 +376,7 @@ def Scheme.restrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X} (h : OpenE
     toPresheafedSpace := X.toPresheafedSpace.restrict h }
 #align algebraic_geometry.Scheme.restrict AlgebraicGeometry.Scheme.restrict
 
-/-- The canonical map from the restriction to the supspace. -/
+/-- The canonical map from the restriction to the subspace. -/
 @[simps!]
 def Scheme.ofRestrict {U : TopCat} (X : Scheme) {f : U ⟶ TopCat.of X}
     (h : OpenEmbedding f) : X.restrict h ⟶ X :=
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
@@ -694,7 +694,7 @@ theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] {U
   -- Porting note : this `dsimp` was not necessary
   dsimp [Opens.map]
   refine' Set.image_preimage_eq_inter_range.trans _
-  erw [Set.inter_eq_left_iff_subset]
+  erw [Set.inter_eq_left]
   refine' Set.Subset.trans (Scheme.basicOpen_le _ _) (Set.image_subset_range _ _)
   refine' le_trans (Scheme.basicOpen_le _ _) (le_of_eq _)
   ext1
@@ -1122,7 +1122,7 @@ def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
   rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
   erw [← e]
   ext1; dsimp [Opens.map, Opens.inclusion]
-  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left_iff_subset, ContinuousMap.coe_mk,
+  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, ContinuousMap.coe_mk,
     Subtype.range_val]
   exact Y.basicOpen_le r
 #align algebraic_geometry.morphism_restrict_restrict_basic_open AlgebraicGeometry.morphismRestrictRestrictBasicOpen
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
@@ -3,7 +3,7 @@ Copyright (c) 2021 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathlib.AlgebraicGeometry.OpenImmersion.Basic
+import Mathlib.Geometry.RingedSpace.OpenImmersion
 import Mathlib.AlgebraicGeometry.Scheme
 import Mathlib.CategoryTheory.Limits.Shapes.CommSq
 
chore: tidy various files (#7035)
Diff
@@ -1144,7 +1144,7 @@ def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
       CategoryTheory.Iso.trans_hom]
     erw [PresheafedSpace.restrictStalkIso_hom_eq_germ_assoc]
     erw [PresheafedSpace.stalkMap_germ_assoc _ V ⟨_, hxV⟩]
-    rw [TopCat.Presheaf.germ_stalk_specializes'_assoc]
+    rw [TopCat.Presheaf.germ_stalkSpecializes'_assoc]
     -- Porting note : explicit variables and proofs were not necessary
     erw [PresheafedSpace.stalkMap_germ _ (U.openEmbedding.isOpenMap.functor.obj V)
       ⟨x.1, ⟨⟨f.1.base x.1, x.2⟩, _, rfl⟩⟩]
@@ -1158,8 +1158,8 @@ def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
 
 instance {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) [IsOpenImmersion f] :
     IsOpenImmersion (f ∣_ U) := by
-      delta morphismRestrict
-      refine PresheafedSpace.IsOpenImmersion.comp _ _
+  delta morphismRestrict
+  refine PresheafedSpace.IsOpenImmersion.comp _ _
 
 end MorphismRestrict
 
chore: update/remove heart beat bumps (#6860)

We clean up heart beat bumps after #6474.

Diff
@@ -1073,7 +1073,7 @@ def morphismRestrictEq {X Y : Scheme} (f : X ⟶ Y) {U V : Opens Y} (e : U = V)
 
 -- Porting note : this does not compile under 200000 heart beats. The proof is more or less
 -- preserved with some morphisms named so that instances about them can be made manually.
-set_option maxHeartbeats 350000 in
+set_option maxHeartbeats 300000 in
 /-- Restricting a morphism twice is isomorphic to one restriction. -/
 def morphismRestrictRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (V : Opens U) :
     Arrow.mk (f ∣_ U ∣_ V) ≅ Arrow.mk (f ∣_ U.openEmbedding.isOpenMap.functor.obj V) := by
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -162,7 +162,7 @@ def openCoverOfIsIso {X Y : Scheme.{u}} (f : X ⟶ Y) [IsIso f] : OpenCover Y wh
 /-- We construct an open cover from another, by providing the needed fields and showing that the
 provided fields are isomorphic with the original open cover. -/
 @[simps J obj map]
-def OpenCover.copy {X : Scheme} (𝒰 : OpenCover X) (J : Type _) (obj : J → Scheme)
+def OpenCover.copy {X : Scheme} (𝒰 : OpenCover X) (J : Type*) (obj : J → Scheme)
     (map : ∀ i, obj i ⟶ X) (e₁ : J ≃ 𝒰.J) (e₂ : ∀ i, obj i ≅ 𝒰.obj (e₁ i))
     (e₂ : ∀ i, map i = (e₂ i).hom ≫ 𝒰.map (e₁ i)) : OpenCover X :=
   { J, obj, map
@@ -893,7 +893,7 @@ def Scheme.OpenCover.inter {X : Scheme.{u}} (𝒰₁ : Scheme.OpenCover.{v₁} X
 
 /-- If `U` is a family of open sets that covers `X`, then `X.restrict U` forms an `X.open_cover`. -/
 @[simps! J obj map]
-def Scheme.openCoverOfSuprEqTop {s : Type _} (X : Scheme) (U : s → Opens X)
+def Scheme.openCoverOfSuprEqTop {s : Type*} (X : Scheme) (U : s → Opens X)
     (hU : ⨆ i, U i = ⊤) : X.OpenCover where
   J := s
   obj i := X.restrict (U i).openEmbedding
chore: fix grammar mistakes (#6121)
Diff
@@ -436,7 +436,7 @@ theorem _root_.AlgebraicGeometry.isIso_iff_stalk_iso {X Y : Scheme} (f : X ⟶ Y
   · intro H; exact ⟨inferInstance, (TopCat.homeoOfIso (asIso f.1.base)).openEmbedding⟩
 #align algebraic_geometry.is_iso_iff_stalk_iso AlgebraicGeometry.isIso_iff_stalk_iso
 
-/-- A open immersion induces an isomorphism from the domain onto the image -/
+/-- An open immersion induces an isomorphism from the domain onto the image -/
 def isoRestrict : X ≅ (Z.restrict H.base_open : _) :=
   ⟨(LocallyRingedSpace.IsOpenImmersion.isoRestrict H).hom,
     (LocallyRingedSpace.IsOpenImmersion.isoRestrict H).inv,
@@ -1046,7 +1046,7 @@ theorem Γ_map_morphismRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) :
   congr
 #align algebraic_geometry.Γ_map_morphism_restrict AlgebraicGeometry.Γ_map_morphismRestrict
 
-/-- Restricting a morphism onto the the image of an open immersion is isomorphic to the base change
+/-- Restricting a morphism onto the image of an open immersion is isomorphic to the base change
 along the immersion. -/
 def morphismRestrictOpensRange {X Y U : Scheme} (f : X ⟶ Y) (g : U ⟶ Y) [hg : IsOpenImmersion g] :
     Arrow.mk (f ∣_ Scheme.Hom.opensRange g) ≅ Arrow.mk (pullback.snd : pullback f g ⟶ _) := by
chore: use · instead of . (#6085)
Diff
@@ -255,7 +255,7 @@ theorem affineBasisCover_map_range (X : Scheme) (x : X)
       (X.affineCover.map x).1.base '' (PrimeSpectrum.basicOpen r).1 := by
   erw [coe_comp, Set.range_comp]
   -- Porting note : `congr` fails to see the goal is comparing image of the same function
-  refine congr_arg (_ '' .) ?_
+  refine congr_arg (_ '' ·) ?_
   exact (PrimeSpectrum.localization_away_comap_range (Localization.Away r) r : _)
 #align algebraic_geometry.Scheme.affine_basis_cover_map_range AlgebraicGeometry.Scheme.affineBasisCover_map_range
 
@@ -1102,7 +1102,7 @@ def morphismRestrictRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (V : Ope
   ext1
   dsimp
   rw [coe_comp, Set.range_comp]
-  apply congr_arg (U.inclusion '' .)
+  apply congr_arg (U.inclusion '' ·)
   exact Subtype.range_val
 #align algebraic_geometry.morphism_restrict_restrict AlgebraicGeometry.morphismRestrictRestrict
 
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,16 +2,13 @@
 Copyright (c) 2021 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.open_immersion.Scheme
-! leanprover-community/mathlib commit 533f62f4dd62a5aad24a04326e6e787c8f7e98b1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.AlgebraicGeometry.OpenImmersion.Basic
 import Mathlib.AlgebraicGeometry.Scheme
 import Mathlib.CategoryTheory.Limits.Shapes.CommSq
 
+#align_import algebraic_geometry.open_immersion.Scheme from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1"
+
 /-!
 # Open immersions of schemes
 
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -272,7 +272,7 @@ theorem affineBasisCover_is_basis (X : Scheme) :
   · rintro a U haU hU
     rcases X.affineCover.Covers a with ⟨x, e⟩
     let U' := (X.affineCover.map (X.affineCover.f a)).1.base ⁻¹' U
-    have hxU' : x ∈ U' := by rw [← e] at haU ; exact haU
+    have hxU' : x ∈ U' := by rw [← e] at haU; exact haU
     rcases PrimeSpectrum.isBasis_basic_opens.exists_subset_of_mem_open hxU'
         ((X.affineCover.map (X.affineCover.f a)).1.base.continuous_toFun.isOpen_preimage _
           hU) with
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
@@ -58,7 +58,7 @@ protected def scheme (X : LocallyRingedSpace)
     skip
     apply PresheafedSpace.IsOpenImmersion.isoOfRangeEq (PresheafedSpace.ofRestrict _ _) f.1
     · exact Subtype.range_coe_subtype
-    . exact Opens.openEmbedding _ -- Porting note : was `infer_instance`
+    · exact Opens.openEmbedding _ -- Porting note : was `infer_instance`
 #align algebraic_geometry.LocallyRingedSpace.IsOpenImmersion.Scheme AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.scheme
 
 end LocallyRingedSpace.IsOpenImmersion
@@ -215,8 +215,8 @@ instance basic_open_isOpenImmersion {R : CommRingCat} (f : R) :
     AlgebraicGeometry.IsOpenImmersion
       (Scheme.Spec.map (CommRingCat.ofHom (algebraMap R (Localization.Away f))).op) := by
   apply SheafedSpace.IsOpenImmersion.of_stalk_iso (H := ?_)
-  . exact (PrimeSpectrum.localization_away_openEmbedding (Localization.Away f) f : _)
-  . intro x
+  · exact (PrimeSpectrum.localization_away_openEmbedding (Localization.Away f) f : _)
+  · intro x
     exact Spec_map_localization_isIso R (Submonoid.powers f) x
 #align algebraic_geometry.Scheme.basic_open_IsOpenImmersion AlgebraicGeometry.Scheme.basic_open_isOpenImmersion
 
@@ -538,7 +538,7 @@ instance forgetToTopPreservesOfLeft : PreservesLimit (cospan f g) Scheme.forgetT
   delta Scheme.forgetToTop
   apply @Limits.compPreservesLimit (K := cospan f g) (F := forget)
     (G := LocallyRingedSpace.forgetToTop) ?_ ?_
-  . infer_instance
+  · infer_instance
   apply @preservesLimitOfIsoDiagram (F := _) _ _ _ _ _ _ (diagramIsoCospan.{u} _).symm ?_
   dsimp [LocallyRingedSpace.forgetToTop]
   infer_instance
@@ -1030,7 +1030,7 @@ theorem morphismRestrict_c_app {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (V : O
     ext1; exact Set.preimage_image_eq _ Subtype.coe_injective
   have : _ ≫ X.presheaf.map _ = _ :=
     (((f ∣_ U).1.c.naturality (eqToHom e).op).symm.trans ?_).trans this
-  . rw [← IsIso.eq_comp_inv, ← Functor.map_inv, Category.assoc] at this
+  · rw [← IsIso.eq_comp_inv, ← Functor.map_inv, Category.assoc] at this
     rw [this]
     congr 1
     erw [← X.presheaf.map_comp, ← X.presheaf.map_comp]
@@ -1092,10 +1092,10 @@ def morphismRestrictRestrict {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (V : Ope
         ((Category.comp_id _).trans (Category.id_comp _).symm) (by aesop_cat) ≫
       (pullbackRightPullbackFstIso _ _ _).hom ≫ (pullbackSymmetry _ _).hom
   have i3 : IsIso h
-  . repeat
+  · repeat
       apply (config := { allowSynthFailures := true }) IsIso.comp_isIso
   have : (f ∣_ U ∣_ V) ≫ (Iso.refl _).hom = (asIso h).hom ≫ pullback.snd (f := f) (g := g)
-  . simp only [Category.comp_id, pullbackRightPullbackFstIso_hom_fst, Iso.refl_hom,
+  · simp only [Category.comp_id, pullbackRightPullbackFstIso_hom_fst, Iso.refl_hom,
       Category.assoc, pullbackSymmetry_hom_comp_snd, asIso_hom, pullback.lift_fst,
       pullbackSymmetry_hom_comp_fst]
     rfl
@@ -1152,7 +1152,7 @@ def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
     erw [PresheafedSpace.stalkMap_germ _ (U.openEmbedding.isOpenMap.functor.obj V)
       ⟨x.1, ⟨⟨f.1.base x.1, x.2⟩, _, rfl⟩⟩]
     swap
-    . rw [morphismRestrict_val_base] at hxV
+    · rw [morphismRestrict_val_base] at hxV
       exact hxV
     erw [PresheafedSpace.restrictStalkIso_hom_eq_germ]
     rw [morphismRestrict_c_app, Category.assoc, TopCat.Presheaf.germ_res]
chore: fix grammar in docs (#5668)
Diff
@@ -236,7 +236,7 @@ def affineBasisCoverOfAffine (R : CommRingCat) : OpenCover (Spec.obj (Opposite.o
   IsOpen x := AlgebraicGeometry.Scheme.basic_open_isOpenImmersion x
 #align algebraic_geometry.Scheme.affine_basis_cover_of_affine AlgebraicGeometry.Scheme.affineBasisCoverOfAffine
 
-/-- We may bind the basic open sets of an open affine cover to form a affine cover that is also
+/-- We may bind the basic open sets of an open affine cover to form an affine cover that is also
 a basis. -/
 def affineBasisCover (X : Scheme) : OpenCover X :=
   X.affineCover.bind fun _ => affineBasisCoverOfAffine _
fix: precedences of ⨆⋃⋂⨅ (#5614)
Diff
@@ -852,7 +852,7 @@ def Scheme.OpenCover.pullbackCover {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme
 #align algebraic_geometry.Scheme.open_cover.pullback_cover AlgebraicGeometry.Scheme.OpenCover.pullbackCover
 
 theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
-    (⋃ i, Set.range (𝒰.map i).1.base) = Set.univ := by
+    ⋃ i, Set.range (𝒰.map i).1.base = Set.univ := by
   rw [Set.eq_univ_iff_forall]
   intro x
   rw [Set.mem_iUnion]
@@ -860,7 +860,7 @@ theorem Scheme.OpenCover.iUnion_range {X : Scheme} (𝒰 : X.OpenCover) :
 #align algebraic_geometry.Scheme.open_cover.Union_range AlgebraicGeometry.Scheme.OpenCover.iUnion_range
 
 theorem Scheme.OpenCover.iSup_opensRange {X : Scheme} (𝒰 : X.OpenCover) :
-    (⨆ i, Scheme.Hom.opensRange (𝒰.map i)) = ⊤ :=
+    ⨆ i, Scheme.Hom.opensRange (𝒰.map i) = ⊤ :=
   Opens.ext <| by rw [Opens.coe_iSup]; exact 𝒰.iUnion_range
 #align algebraic_geometry.Scheme.open_cover.supr_opens_range AlgebraicGeometry.Scheme.OpenCover.iSup_opensRange
 
@@ -897,7 +897,7 @@ def Scheme.OpenCover.inter {X : Scheme.{u}} (𝒰₁ : Scheme.OpenCover.{v₁} X
 /-- If `U` is a family of open sets that covers `X`, then `X.restrict U` forms an `X.open_cover`. -/
 @[simps! J obj map]
 def Scheme.openCoverOfSuprEqTop {s : Type _} (X : Scheme) (U : s → Opens X)
-    (hU : (⨆ i, U i) = ⊤) : X.OpenCover where
+    (hU : ⨆ i, U i = ⊤) : X.OpenCover where
   J := s
   obj i := X.restrict (U i).openEmbedding
   map i := X.ofRestrict (U i).openEmbedding
feat: port AlgebraicGeometry.OpenImmersion.Scheme (#5290)

Dependencies 11 + 914

915 files ported (98.8%)
379431 lines ported (98.6%)
Show graph

The unported dependencies are