algebraic_geometry.open_immersion.basicMathlib.Geometry.RingedSpace.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
@@ -935,7 +935,7 @@ section OfStalkIso
 
 variable [HasLimits C] [HasColimits C] [ConcreteCategory.{v} C]
 
-variable [ReflectsIsomorphisms (forget C)] [PreservesLimits (forget C)]
+variable [CategoryTheory.Functor.ReflectsIsomorphisms (forget C)] [PreservesLimits (forget C)]
 
 variable [PreservesFilteredColimits (forget C)]
 
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2021 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Topology.Category.Top.Limits.Pullbacks
-import AlgebraicGeometry.LocallyRingedSpace
+import Topology.Category.TopCat.Limits.Pullbacks
+import Geometry.RingedSpace.LocallyRingedSpace
 
 #align_import algebraic_geometry.open_immersion.basic from "leanprover-community/mathlib"@"f2ad3645af9effcdb587637dc28a6074edc813f9"
 
Diff
@@ -465,8 +465,8 @@ theorem pullbackConeOfLeftLift_fst :
     erw [← s.X.presheaf.map_comp]
     erw [s.snd.c.naturality_assoc]
     have := congr_app s.condition (op (hf.open_functor.obj x))
-    dsimp only [comp_c_app, unop_op] at this 
-    rw [← is_iso.comp_inv_eq] at this 
+    dsimp only [comp_c_app, unop_op] at this
+    rw [← is_iso.comp_inv_eq] at this
     reassoc! this
     erw [← this, hf.inv_app_app_assoc, s.fst.c.naturality_assoc]
     simpa [eq_to_hom_map]
@@ -898,7 +898,7 @@ instance sheafedSpace_pullback_snd_of_left :
   have : _ = limit.π (cospan f g) right := preserves_limits_iso_hom_π forget (cospan f g) right
   rw [← this]
   have := has_limit.iso_of_nat_iso_hom_π (diagramIsoCospan.{v} (cospan f g ⋙ forget)) right
-  erw [category.comp_id] at this 
+  erw [category.comp_id] at this
   rw [← this]
   dsimp
   infer_instance
@@ -913,7 +913,7 @@ instance sheafedSpace_pullback_fst_of_right :
   have : _ = limit.π (cospan g f) left := preserves_limits_iso_hom_π forget (cospan g f) left
   rw [← this]
   have := has_limit.iso_of_nat_iso_hom_π (diagramIsoCospan.{v} (cospan g f ⋙ forget)) left
-  erw [category.comp_id] at this 
+  erw [category.comp_id] at this
   rw [← this]
   dsimp
   infer_instance
@@ -955,11 +955,11 @@ theorem of_stalk_iso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.
           (show Y.sheaf ⟶ (TopCat.Sheaf.pushforward f.base).obj X.sheaf from ⟨f.c⟩)
       rintro ⟨_, y, hy, rfl⟩
       specialize H y
-      delta PresheafedSpace.stalk_map at H 
+      delta PresheafedSpace.stalk_map at H
       haveI H' :=
         TopCat.Presheaf.stalkPushforward.stalkPushforward_iso_of_openEmbedding C hf X.presheaf y
       have := @is_iso.comp_is_iso _ H (@is_iso.inv_is_iso _ H')
-      rw [category.assoc, is_iso.hom_inv_id, category.comp_id] at this 
+      rw [category.assoc, is_iso.hom_inv_id, category.comp_id] at this
       exact this }
 #align algebraic_geometry.SheafedSpace.is_open_immersion.of_stalk_iso AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_stalk_iso
 -/
@@ -977,11 +977,11 @@ theorem sigma_ι_openEmbedding : OpenEmbedding (colimit.ι F i).base :=
   rw [← show _ = (colimit.ι F i).base from ι_preserves_colimits_iso_inv (SheafedSpace.forget C) F i]
   have : _ = _ ≫ colimit.ι (discrete.functor ((F ⋙ SheafedSpace.forget C).obj ∘ discrete.mk)) i :=
     has_colimit.iso_of_nat_iso_ι_hom discrete.nat_iso_functor i
-  rw [← iso.eq_comp_inv] at this 
+  rw [← iso.eq_comp_inv] at this
   rw [this]
   have : colimit.ι _ _ ≫ _ = _ :=
     TopCat.sigmaIsoSigma_hom_ι.{v, v} ((F ⋙ SheafedSpace.forget C).obj ∘ discrete.mk) i.as
-  rw [← iso.eq_comp_inv] at this 
+  rw [← iso.eq_comp_inv] at this
   cases i
   rw [this]
   simp_rw [← category.assoc, TopCat.openEmbedding_iff_comp_isIso,
@@ -1006,16 +1006,16 @@ theorem image_preimage_is_empty (j : Discrete ι) (h : i ≠ j) (U : Opens (F.ob
       (preserves_colimit_iso (SheafedSpace.forget C) F ≪≫
           has_colimit.iso_of_nat_iso discrete.nat_iso_functor ≪≫ TopCat.sigmaIsoSigma.{v} _).Hom
       Eq
-  simp_rw [CategoryTheory.Iso.trans_hom, ← TopCat.comp_app, ← PresheafedSpace.comp_base] at eq 
-  rw [ι_preserves_colimits_iso_inv] at eq 
+  simp_rw [CategoryTheory.Iso.trans_hom, ← TopCat.comp_app, ← PresheafedSpace.comp_base] at eq
+  rw [ι_preserves_colimits_iso_inv] at eq
   change
     ((SheafedSpace.forget C).map (colimit.ι F i) ≫ _) y =
       ((SheafedSpace.forget C).map (colimit.ι F j) ≫ _) x at
-    eq 
+    eq
   cases i; cases j
   rw [ι_preserves_colimits_iso_hom_assoc, ι_preserves_colimits_iso_hom_assoc,
     has_colimit.iso_of_nat_iso_ι_hom_assoc, has_colimit.iso_of_nat_iso_ι_hom_assoc,
-    TopCat.sigmaIsoSigma_hom_ι.{v}, TopCat.sigmaIsoSigma_hom_ι.{v}] at eq 
+    TopCat.sigmaIsoSigma_hom_ι.{v}, TopCat.sigmaIsoSigma_hom_ι.{v}] at eq
   exact h (congr_arg discrete.mk (congr_arg Sigma.fst Eq))
 #align algebraic_geometry.SheafedSpace.is_open_immersion.image_preimage_is_empty AlgebraicGeometry.SheafedSpace.IsOpenImmersion.image_preimage_is_empty
 -/
@@ -1110,8 +1110,8 @@ def pullbackConeOfLeft : PullbackCone f g :=
     have :=
       PresheafedSpace.stalk_map.congr_hom _ _
         (PresheafedSpace.is_open_immersion.pullback_cone_of_left_condition f.1 g.1) x
-    rw [PresheafedSpace.stalk_map.comp, PresheafedSpace.stalk_map.comp] at this 
-    rw [← is_iso.eq_inv_comp] at this 
+    rw [PresheafedSpace.stalk_map.comp, PresheafedSpace.stalk_map.comp] at this
+    rw [← is_iso.eq_inv_comp] at this
     rw [this]
     infer_instance
   ·
@@ -1137,8 +1137,8 @@ def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) :=
           (PresheafedSpace.is_open_immersion.pullback_cone_of_left_lift_snd f.1 g.1
             (pullback_cone.mk s.fst.1 s.snd.1 (congr_arg LocallyRingedSpace.hom.val s.condition)))
           x
-      change _ = _ ≫ PresheafedSpace.stalk_map s.snd.1 x at this 
-      rw [PresheafedSpace.stalk_map.comp, ← is_iso.eq_inv_comp] at this 
+      change _ = _ ≫ PresheafedSpace.stalk_map s.snd.1 x at this
+      rw [PresheafedSpace.stalk_map.comp, ← is_iso.eq_inv_comp] at this
       rw [this]
       infer_instance
     constructor
Diff
@@ -3,8 +3,8 @@ 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.Topology.Category.Top.Limits.Pullbacks
-import Mathbin.AlgebraicGeometry.LocallyRingedSpace
+import Topology.Category.Top.Limits.Pullbacks
+import AlgebraicGeometry.LocallyRingedSpace
 
 #align_import algebraic_geometry.open_immersion.basic from "leanprover-community/mathlib"@"f2ad3645af9effcdb587637dc28a6074edc813f9"
 
Diff
@@ -379,7 +379,7 @@ def pullbackConeOfLeftFst :
                     Subtype.coe_mk, functor.op_obj, Subtype.val_eq_coe]
                   apply LE.le.antisymm
                   · rintro _ ⟨_, h₁, h₂⟩
-                    use (TopCat.pullbackIsoProdSubtype _ _).inv ⟨⟨_, _⟩, h₂⟩
+                    use(TopCat.pullbackIsoProdSubtype _ _).inv ⟨⟨_, _⟩, h₂⟩
                     simpa using h₁
                   · rintro _ ⟨x, h₁, rfl⟩
                     exact ⟨_, h₁, concrete_category.congr_hom pullback.condition x⟩))
@@ -1129,8 +1129,7 @@ instance : LocallyRingedSpace.IsOpenImmersion (pullbackConeOfLeft f g).snd :=
 def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) :=
   PullbackCone.isLimitAux' _ fun s =>
     by
-    use
-      PresheafedSpace.is_open_immersion.pullback_cone_of_left_lift f.1 g.1
+    use PresheafedSpace.is_open_immersion.pullback_cone_of_left_lift f.1 g.1
         (pullback_cone.mk s.fst.1 s.snd.1 (congr_arg LocallyRingedSpace.hom.val s.condition))
     · intro x
       have :=
Diff
@@ -2,15 +2,12 @@
 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.basic
-! leanprover-community/mathlib commit f2ad3645af9effcdb587637dc28a6074edc813f9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Topology.Category.Top.Limits.Pullbacks
 import Mathbin.AlgebraicGeometry.LocallyRingedSpace
 
+#align_import algebraic_geometry.open_immersion.basic from "leanprover-community/mathlib"@"f2ad3645af9effcdb587637dc28a6074edc813f9"
+
 /-!
 # Open immersions of structured spaces
 
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.basic
-! leanprover-community/mathlib commit 533f62f4dd62a5aad24a04326e6e787c8f7e98b1
+! leanprover-community/mathlib commit f2ad3645af9effcdb587637dc28a6074edc813f9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.AlgebraicGeometry.LocallyRingedSpace
 /-!
 # Open immersions of structured spaces
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We say that a morphism of presheafed spaces `f : X ⟶ Y` is an open immersion if
 the underlying map of spaces is an open embedding `f : X ⟶ U ⊆ Y`,
 and the sheaf map `Y(V) ⟶ f _* X(V)` is an iso for each `V ⊆ U`.
Diff
@@ -73,21 +73,25 @@ spaces, such that the sheaf map `Y(V) ⟶ f _* X(V)` is an iso for each `V ⊆ U
 class PresheafedSpace.IsOpenImmersion {X Y : PresheafedSpace.{v} C} (f : X ⟶ Y) : Prop where
   base_open : OpenEmbedding f.base
   c_iso : ∀ U : Opens X, IsIso (f.c.app (op (base_open.IsOpenMap.Functor.obj U)))
-#align algebraic_geometry.PresheafedSpace.is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion
+#align algebraic_geometry.PresheafedSpace.is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersionₓ
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion /-
 /-- A morphism of SheafedSpaces is an open immersion if it is an open immersion as a morphism
 of PresheafedSpaces
 -/
 abbrev SheafedSpace.IsOpenImmersion {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) : Prop :=
   PresheafedSpace.IsOpenImmersion f
-#align algebraic_geometry.SheafedSpace.is_open_immersion AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion
+#align algebraic_geometry.SheafedSpace.is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion /-
 /-- A morphism of LocallyRingedSpaces is an open immersion if it is an open immersion as a morphism
 of SheafedSpaces
 -/
 abbrev LocallyRingedSpace.IsOpenImmersion {X Y : LocallyRingedSpace} (f : X ⟶ Y) : Prop :=
   SheafedSpace.IsOpenImmersion f.1
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion
+-/
 
 namespace PresheafedSpace.IsOpenImmersion
 
@@ -101,11 +105,14 @@ section
 
 variable {X Y : PresheafedSpace.{v} C} {f : X ⟶ Y} (H : is_open_immersion f)
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.openFunctor /-
 /-- The functor `opens X ⥤ opens Y` associated with an open immersion `f : X ⟶ Y`. -/
 abbrev openFunctor :=
   H.base_open.IsOpenMap.Functor
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.open_functor AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.openFunctor
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict /-
 /-- An open immersion `f : X ⟶ Y` induces an isomorphism `X ≅ Y|_{f(X)}`. -/
 @[simps hom_c_app]
 noncomputable def isoRestrict : X ≅ Y.restrict H.base_open :=
@@ -128,7 +135,9 @@ noncomputable def isoRestrict : X ≅ Y.restrict H.base_open :=
         erw [f.c.naturality_assoc, ← X.presheaf.map_comp]
         congr)
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.iso_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict_hom_ofRestrict /-
 @[simp]
 theorem isoRestrict_hom_ofRestrict : H.isoRestrict.Hom ≫ Y.of_restrict _ = f :=
   by
@@ -141,16 +150,22 @@ theorem isoRestrict_hom_ofRestrict : H.isoRestrict.Hom ≫ Y.of_restrict _ = f :
     · erw [X.presheaf.map_id, category.comp_id]
   · rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.iso_restrict_hom_of_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict_hom_ofRestrict
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict_inv_ofRestrict /-
 @[simp]
 theorem isoRestrict_inv_ofRestrict : H.isoRestrict.inv ≫ f = Y.of_restrict _ := by
   rw [iso.inv_comp_eq, iso_restrict_hom_of_restrict]
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.iso_restrict_inv_of_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict_inv_ofRestrict
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.mono /-
 instance mono [H : is_open_immersion f] : Mono f := by rw [← H.iso_restrict_hom_of_restrict];
   apply mono_comp
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.mono AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.mono
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.comp /-
 /-- The composition of two open immersions is an open immersion. -/
 instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : is_open_immersion f] (g : Y ⟶ Z)
     [hg : is_open_immersion g] : is_open_immersion (f ≫ g)
@@ -177,14 +192,18 @@ instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : is_open_immersion f] (
       rw [this]
       infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.comp AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.comp
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp /-
 /-- For an open immersion `f : X ⟶ Y` and an open set `U ⊆ X`, we have the map `X(U) ⟶ Y(U)`. -/
 noncomputable def invApp (U : Opens X) :
     X.Presheaf.obj (op U) ⟶ Y.Presheaf.obj (op (H.openFunctor.obj U)) :=
   X.Presheaf.map (eqToHom (by simp [opens.map, Set.preimage_image_eq _ H.base_open.inj])) ≫
     inv (f.c.app (op (H.openFunctor.obj U)))
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.inv_app AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.inv_naturality /-
 @[simp, reassoc]
 theorem inv_naturality {U V : (Opens X)ᵒᵖ} (i : U ⟶ V) :
     X.Presheaf.map i ≫ H.invApp (unop V) =
@@ -196,9 +215,11 @@ theorem inv_naturality {U V : (Opens X)ᵒᵖ} (i : U ⟶ V) :
   erw [← X.presheaf.map_comp]
   congr
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.inv_naturality AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.inv_naturality
+-/
 
 instance (U : Opens X) : IsIso (H.invApp U) := by delta inv_app; infer_instance
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.inv_invApp /-
 theorem inv_invApp (U : Opens X) :
     inv (H.invApp U) =
       f.c.app (op (H.openFunctor.obj U)) ≫
@@ -209,14 +230,18 @@ theorem inv_invApp (U : Opens X) :
   delta inv_app
   simp [← functor.map_comp]
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.inv_inv_app AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.inv_invApp
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp_app /-
 @[simp, reassoc, elementwise]
 theorem invApp_app (U : Opens X) :
     H.invApp U ≫ f.c.app (op (H.openFunctor.obj U)) =
       X.Presheaf.map (eqToHom (by simp [opens.map, Set.preimage_image_eq _ H.base_open.inj])) :=
   by rw [inv_app, category.assoc, is_iso.inv_hom_id, category.comp_id]
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.inv_app_app AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp_app
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.app_invApp /-
 @[simp, reassoc]
 theorem app_invApp (U : Opens Y) :
     f.c.app (op U) ≫ H.invApp ((Opens.map f.base).obj U) =
@@ -225,7 +250,9 @@ theorem app_invApp (U : Opens Y) :
           op U ⟶ op (H.openFunctor.obj ((Opens.map f.base).obj U))) :=
   by erw [← category.assoc]; rw [is_iso.comp_inv_eq, f.c.naturality]; congr
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.app_inv_app AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.app_invApp
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.app_inv_app' /-
 /-- A variant of `app_inv_app` that gives an `eq_to_hom` instead of `hom_of_le`. -/
 @[reassoc]
 theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
@@ -240,19 +267,25 @@ theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
                 exact set.subset_inter_iff.mpr ⟨fun _ h => h, hU⟩)).op :=
   by erw [← category.assoc]; rw [is_iso.comp_inv_eq, f.c.naturality]; congr
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.app_inv_app' AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.app_inv_app'
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIso /-
 /-- An isomorphism is an open immersion. -/
 instance ofIso {X Y : PresheafedSpace.{v} C} (H : X ≅ Y) : is_open_immersion H.Hom
     where
   base_open := (TopCat.homeoOfIso ((forget C).mapIso H)).OpenEmbedding
   c_iso _ := inferInstance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_iso AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIso
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIsIso /-
 instance (priority := 100) ofIsIso {X Y : PresheafedSpace.{v} C} (f : X ⟶ Y) [IsIso f] :
     is_open_immersion f :=
   AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIso (asIso f)
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_is_iso AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIsIso
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict /-
 instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
     (hf : OpenEmbedding f) : is_open_immersion (Y.of_restrict hf)
     where
@@ -269,7 +302,9 @@ instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
     · rw [Y.presheaf.map_id]
       infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict_invApp /-
 @[elementwise, simp]
 theorem ofRestrict_invApp {C : Type _} [Category C] (X : PresheafedSpace C) {Y : TopCat}
     {f : Y ⟶ TopCat.of X.carrier} (h : OpenEmbedding f) (U : Opens (X.restrict h).carrier) :
@@ -280,7 +315,9 @@ theorem ofRestrict_invApp {C : Type _} [Category C] (X : PresheafedSpace C) {Y :
   change X.presheaf.map _ = X.presheaf.map _
   congr
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_restrict_inv_app AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict_invApp
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.to_iso /-
 /-- An open immersion is an iso if the underlying continuous map is epi. -/
 theorem to_iso (f : X ⟶ Y) [h : is_open_immersion f] [h' : Epi f.base] : IsIso f :=
   by
@@ -305,13 +342,16 @@ theorem to_iso (f : X ⟶ Y) [h : is_open_immersion f] [h' : Epi f.base] : IsIso
       exact (Set.image_preimage_eq _ ((TopCat.epi_iff_surjective _).mp h')).symm
     convert @is_open_immersion.c_iso _ h ((opens.map f.base).obj (unop U))
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_iso AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.to_iso
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.stalk_iso /-
 instance stalk_iso [HasColimits C] [H : is_open_immersion f] (x : X) : IsIso (stalkMap f x) :=
   by
   rw [← H.iso_restrict_hom_of_restrict]
   rw [PresheafedSpace.stalk_map.comp]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.stalk_iso AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.stalk_iso
+-/
 
 end
 
@@ -321,6 +361,7 @@ noncomputable section
 
 variable {X Y Z : PresheafedSpace.{v} C} (f : X ⟶ Z) [hf : is_open_immersion f] (g : Y ⟶ Z)
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftFst /-
 /-- (Implementation.) The projection map when constructing the pullback along an open immersion.
 -/
 def pullbackConeOfLeftFst :
@@ -351,7 +392,9 @@ def pullbackConeOfLeftFst :
         erw [← Y.presheaf.map_comp]
         congr }
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left_fst AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftFst
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullback_cone_of_left_condition /-
 theorem pullback_cone_of_left_condition : pullbackConeOfLeftFst f g ≫ f = Y.of_restrict _ ≫ g :=
   by
   ext U
@@ -364,7 +407,9 @@ theorem pullback_cone_of_left_condition : pullbackConeOfLeftFst f g ≫ f = Y.of
     congr
   · simpa using pullback.condition
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left_condition AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullback_cone_of_left_condition
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeft /-
 /-- We construct the pullback along an open immersion via restricting along the pullback of the
 maps of underlying spaces (which is also an open embedding).
 -/
@@ -372,9 +417,11 @@ def pullbackConeOfLeft : PullbackCone f g :=
   PullbackCone.mk (pullbackConeOfLeftFst f g) (Y.of_restrict _)
     (pullback_cone_of_left_condition f g)
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeft
+-/
 
 variable (s : PullbackCone f g)
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift /-
 /-- (Implementation.) Any cone over `cospan f g` indeed factors through the constructed cone.
 -/
 def pullbackConeOfLeftLift : s.pt ⟶ (pullbackConeOfLeft f g).pt
@@ -404,7 +451,9 @@ def pullbackConeOfLeftLift : s.pt ⟶ (pullbackConeOfLeft f g).pt
         erw [← s.X.presheaf.map_comp, ← s.X.presheaf.map_comp]
         congr }
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left_lift AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift_fst /-
 -- this lemma is not a `simp` lemma, because it is an implementation detail
 theorem pullbackConeOfLeftLift_fst :
     pullbackConeOfLeftLift f g s ≫ (pullbackConeOfLeft f g).fst = s.fst :=
@@ -424,7 +473,9 @@ theorem pullbackConeOfLeftLift_fst :
   · change pullback.lift _ _ _ ≫ pullback.fst = _
     simp
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left_lift_fst AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift_fst
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift_snd /-
 -- this lemma is not a `simp` lemma, because it is an implementation detail
 theorem pullbackConeOfLeftLift_snd :
     pullbackConeOfLeftLift f g s ≫ (pullbackConeOfLeft f g).snd = s.snd :=
@@ -440,13 +491,17 @@ theorem pullbackConeOfLeftLift_snd :
   · change pullback.lift _ _ _ ≫ pullback.snd = _
     simp
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left_lift_snd AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift_snd
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeSndIsOpenImmersion /-
 instance pullbackConeSndIsOpenImmersion : is_open_immersion (pullbackConeOfLeft f g).snd :=
   by
   erw [CategoryTheory.Limits.PullbackCone.mk_snd]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_snd_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeSndIsOpenImmersion
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftIsLimit /-
 /-- The constructed pullback cone is indeed the pullback. -/
 def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) :=
   by
@@ -459,15 +514,21 @@ def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) :=
   rw [← cancel_mono (pullback_cone_of_left f g).snd]
   exact h₂.trans (pullback_cone_of_left_lift_snd f g s).symm
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left_is_limit AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftIsLimit
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.hasPullback_of_left /-
 instance hasPullback_of_left : HasPullback f g :=
   ⟨⟨⟨_, pullbackConeOfLeftIsLimit f g⟩⟩⟩
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.has_pullback_of_left AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.hasPullback_of_left
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.hasPullback_of_right /-
 instance hasPullback_of_right : HasPullback g f :=
   hasPullback_symmetry f g
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.has_pullback_of_right AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.hasPullback_of_right
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackSndOfLeft /-
 /-- Open immersions are stable under base-change. -/
 instance pullbackSndOfLeft : is_open_immersion (pullback.snd : pullback f g ⟶ _) :=
   by
@@ -475,21 +536,27 @@ instance pullbackSndOfLeft : is_open_immersion (pullback.snd : pullback f g ⟶
   rw [← limit.iso_limit_cone_hom_π ⟨_, pullback_cone_of_left_is_limit f g⟩ walking_cospan.right]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_snd_of_left AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackSndOfLeft
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackFstOfRight /-
 /-- Open immersions are stable under base-change. -/
 instance pullbackFstOfRight : is_open_immersion (pullback.fst : pullback g f ⟶ _) :=
   by
   rw [← pullback_symmetry_hom_comp_snd]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_fst_of_right AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackFstOfRight
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackToBaseIsOpenImmersion /-
 instance pullbackToBaseIsOpenImmersion [is_open_immersion g] :
     is_open_immersion (limit.π (cospan f g) WalkingCospan.one) :=
   by
   rw [← limit.w (cospan f g) walking_cospan.hom.inl, cospan_map_inl]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_to_base_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackToBaseIsOpenImmersion
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.forgetPreservesLimitsOfLeft /-
 instance forgetPreservesLimitsOfLeft : PreservesLimit (cospan f g) (forget C) :=
   preservesLimitOfPreservesLimitCone (pullbackConeOfLeftIsLimit f g)
     (by
@@ -505,11 +572,15 @@ instance forgetPreservesLimitsOfLeft : PreservesLimit (cospan f g) (forget C) :=
       · exact category.comp_id _
       · exact category.comp_id _)
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.forget_preserves_limits_of_left AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.forgetPreservesLimitsOfLeft
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.forgetPreservesLimitsOfRight /-
 instance forgetPreservesLimitsOfRight : PreservesLimit (cospan g f) (forget C) :=
   preservesPullbackSymmetry (forget C) f g
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.forget_preserves_limits_of_right AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.forgetPreservesLimitsOfRight
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullback_snd_isIso_of_range_subset /-
 theorem pullback_snd_isIso_of_range_subset (H : Set.range g.base ⊆ Set.range f.base) :
     IsIso (pullback.snd : pullback f g ⟶ _) :=
   by
@@ -522,7 +593,9 @@ theorem pullback_snd_isIso_of_range_subset (H : Set.range g.base ⊆ Set.range f
     infer_instance
   apply to_iso
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_snd_is_iso_of_range_subset AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullback_snd_isIso_of_range_subset
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift /-
 /-- The universal property of open immersions:
 For an open immersion `f : X ⟶ Z`, given any morphism of schemes `g : Y ⟶ Z` whose topological
 image is contained in the image of `f`, we can lift this morphism to a unique `Y ⟶ X` that
@@ -532,16 +605,22 @@ def lift (H : Set.range g.base ⊆ Set.range f.base) : Y ⟶ X :=
   haveI := pullback_snd_is_iso_of_range_subset f g H
   inv (pullback.snd : pullback f g ⟶ _) ≫ pullback.fst
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.lift AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift_fac /-
 @[simp, reassoc]
 theorem lift_fac (H : Set.range g.base ⊆ Set.range f.base) : lift f g H ≫ f = g := by
   erw [category.assoc]; rw [is_iso.inv_comp_eq]; exact pullback.condition
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.lift_fac AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift_fac
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift_uniq /-
 theorem lift_uniq (H : Set.range g.base ⊆ Set.range f.base) (l : Y ⟶ X) (hl : l ≫ f = g) :
     l = lift f g H := by rw [← cancel_mono f, hl, lift_fac]
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.lift_uniq AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift_uniq
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoOfRangeEq /-
 /-- Two open immersions with equal range is isomorphic. -/
 @[simps]
 def isoOfRangeEq [is_open_immersion g] (e : Set.range f.base = Set.range g.base) : X ≅ Y
@@ -551,6 +630,7 @@ def isoOfRangeEq [is_open_immersion g] (e : Set.range f.base = Set.range g.base)
   hom_inv_id' := by rw [← cancel_mono f]; simp
   inv_hom_id' := by rw [← cancel_mono g]; simp
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.iso_of_range_eq AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoOfRangeEq
+-/
 
 end Pullback
 
@@ -562,6 +642,7 @@ variable {X : PresheafedSpace.{v} C} (Y : SheafedSpace C)
 
 variable (f : X ⟶ Y.toPresheafedSpace) [H : is_open_immersion f]
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace /-
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a SheafedSpace, then so is `X`. -/
 def toSheafedSpace : SheafedSpace C
     where
@@ -572,37 +653,50 @@ def toSheafedSpace : SheafedSpace C
     exact (Y.restrict H.base_open).IsSheaf
   toPresheafedSpace := X
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_toPresheafedSpace /-
 @[simp]
 theorem toSheafedSpace_toPresheafedSpace : (toSheafedSpace Y f).toPresheafedSpace = X :=
   rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_to_PresheafedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_toPresheafedSpace
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom /-
 /-- If `X ⟶ Y` is an open immersion of PresheafedSpaces, and `Y` is a SheafedSpace, we can
 upgrade it into a morphism of SheafedSpaces.
 -/
 def toSheafedSpaceHom : toSheafedSpace Y f ⟶ Y :=
   f
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_hom AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom_base /-
 @[simp]
 theorem toSheafedSpaceHom_base : (toSheafedSpaceHom Y f).base = f.base :=
   rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_hom_base AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom_base
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom_c /-
 @[simp]
 theorem toSheafedSpaceHom_c : (toSheafedSpaceHom Y f).c = f.c :=
   rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_hom_c AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom_c
+-/
 
-instance toSheafedSpaceIsOpenImmersion : SheafedSpace.IsOpenImmersion (toSheafedSpaceHom Y f) :=
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_isOpenImmersion /-
+instance toSheafedSpace_isOpenImmersion : SheafedSpace.IsOpenImmersion (toSheafedSpaceHom Y f) :=
   H
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceIsOpenImmersion
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_isOpenImmersion
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.sheafedSpace_toSheafedSpace /-
 @[simp]
 theorem sheafedSpace_toSheafedSpace {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) [is_open_immersion f] :
     toSheafedSpace Y f = X := by cases X; rfl
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.SheafedSpace_to_SheafedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.sheafedSpaceₓ_toSheafedSpace
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.SheafedSpace_to_SheafedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.sheafedSpace_toSheafedSpace
+-/
 
 end ToSheafedSpace
 
@@ -612,6 +706,7 @@ variable {X : PresheafedSpace.{u} CommRingCat.{u}} (Y : LocallyRingedSpace.{u})
 
 variable (f : X ⟶ Y.toPresheafedSpace) [H : is_open_immersion f]
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace /-
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a LocallyRingedSpace, then so is `X`. -/
 def toLocallyRingedSpace : LocallyRingedSpace
     where
@@ -620,38 +715,50 @@ def toLocallyRingedSpace : LocallyRingedSpace
     haveI : LocalRing (Y.to_SheafedSpace.to_PresheafedSpace.stalk (f.base x)) := Y.local_ring _
     (as_iso (stalk_map f x)).commRingCatIsoToRingEquiv.LocalRing
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_LocallyRingedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace_toSheafedSpace /-
 @[simp]
 theorem toLocallyRingedSpace_toSheafedSpace :
     (toLocallyRingedSpace Y f).toSheafedSpace = toSheafedSpace Y.1 f :=
   rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_LocallyRingedSpace_to_SheafedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace_toSheafedSpace
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpaceHom /-
 /-- If `X ⟶ Y` is an open immersion of PresheafedSpaces, and `Y` is a LocallyRingedSpace, we can
 upgrade it into a morphism of LocallyRingedSpace.
 -/
 def toLocallyRingedSpaceHom : toLocallyRingedSpace Y f ⟶ Y :=
   ⟨f, fun x => inferInstance⟩
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_LocallyRingedSpace_hom AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpaceHom
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpaceHom_val /-
 @[simp]
 theorem toLocallyRingedSpaceHom_val : (toLocallyRingedSpaceHom Y f).val = f :=
   rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_LocallyRingedSpace_hom_val AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpaceHom_val
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace_isOpenImmersion /-
 instance toLocallyRingedSpace_isOpenImmersion :
     LocallyRingedSpace.IsOpenImmersion (toLocallyRingedSpaceHom Y f) :=
   H
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_LocallyRingedSpace_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace_isOpenImmersion
+-/
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.locallyRingedSpace_toLocallyRingedSpace /-
 @[simp]
 theorem locallyRingedSpace_toLocallyRingedSpace {X Y : LocallyRingedSpace} (f : X ⟶ Y)
     [LocallyRingedSpace.IsOpenImmersion f] : toLocallyRingedSpace Y f.1 = X := by cases X;
   delta to_LocallyRingedSpace; simp
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.LocallyRingedSpace_to_LocallyRingedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.locallyRingedSpace_toLocallyRingedSpace
+-/
 
 end ToLocallyRingedSpace
 
+#print AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isIso_of_subset /-
 theorem isIso_of_subset {X Y : PresheafedSpace.{v} C} (f : X ⟶ Y)
     [H : PresheafedSpace.IsOpenImmersion f] (U : Opens Y.carrier)
     (hU : (U : Set Y.carrier) ⊆ Set.range f.base) : IsIso (f.c.app <| op U) :=
@@ -662,20 +769,25 @@ theorem isIso_of_subset {X Y : PresheafedSpace.{v} C} (f : X ⟶ Y)
     exact (set.inter_eq_left_iff_subset.mpr hU).symm.trans set.image_preimage_eq_inter_range.symm
   convert PresheafedSpace.is_open_immersion.c_iso ((opens.map f.base).obj U)
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.is_iso_of_subset AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isIso_of_subset
+-/
 
 end PresheafedSpace.IsOpenImmersion
 
 namespace SheafedSpace.IsOpenImmersion
 
-instance (priority := 100) ofIsIso {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) [IsIso f] :
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_isIso /-
+instance (priority := 100) of_isIso {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) [IsIso f] :
     SheafedSpace.IsOpenImmersion f :=
   @PresheafedSpace.IsOpenImmersion.ofIsIso _ f (SheafedSpace.forgetToPresheafedSpace.map_isIso _)
-#align algebraic_geometry.SheafedSpace.is_open_immersion.of_is_iso AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.ofIsIso
+#align algebraic_geometry.SheafedSpace.is_open_immersion.of_is_iso AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_isIso
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.comp /-
 instance comp {X Y Z : SheafedSpace C} (f : X ⟶ Y) (g : Y ⟶ Z) [SheafedSpace.IsOpenImmersion f]
     [SheafedSpace.IsOpenImmersion g] : SheafedSpace.IsOpenImmersion (f ≫ g) :=
   PresheafedSpace.IsOpenImmersion.comp f g
-#align algebraic_geometry.SheafedSpace.is_open_immersion.comp AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.comp
+#align algebraic_geometry.SheafedSpace.is_open_immersion.comp AlgebraicGeometry.SheafedSpace.IsOpenImmersion.comp
+-/
 
 section Pullback
 
@@ -690,50 +802,65 @@ open CategoryTheory.Limits.WalkingCospan
 instance : Mono f :=
   forget.mono_of_mono_map (show @Mono (PresheafedSpace C) _ _ _ f by infer_instance)
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetMapIsOpenImmersion /-
 instance forgetMapIsOpenImmersion : PresheafedSpace.IsOpenImmersion (forget.map f) :=
   ⟨H.base_open, H.c_iso⟩
-#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_map_is_open_immersion AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.forgetMapIsOpenImmersion
+#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_map_is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetMapIsOpenImmersion
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left /-
 instance hasLimit_cospan_forget_of_left : HasLimit (cospan f g ⋙ forget) :=
   by
   apply has_limit_of_iso (diagramIsoCospan.{v} _).symm
   change has_limit (cospan (forget.map f) (forget.map g))
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.hasLimit_cospan_forget_of_left
+#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left' /-
 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.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left' AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.hasLimit_cospan_forget_of_left'
+#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left' AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left'
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right /-
 instance hasLimit_cospan_forget_of_right : HasLimit (cospan g f ⋙ forget) :=
   by
   apply has_limit_of_iso (diagramIsoCospan.{v} _).symm
   change has_limit (cospan (forget.map g) (forget.map f))
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.hasLimit_cospan_forget_of_right
+#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.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.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right' AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.hasLimit_cospan_forget_of_right'
+#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right' AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right'
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetCreatesPullbackOfLeft /-
 instance forgetCreatesPullbackOfLeft : CreatesLimit (cospan f g) forget :=
   createsLimitOfFullyFaithfulOfIso
     (PresheafedSpace.IsOpenImmersion.toSheafedSpace Y
       (@pullback.snd (PresheafedSpace C) _ _ _ _ f g _))
     (eqToIso (show pullback _ _ = pullback _ _ by congr) ≪≫
       HasLimit.isoOfNatIso (diagramIsoCospan _).symm)
-#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_creates_pullback_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.forgetCreatesPullbackOfLeft
+#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_creates_pullback_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetCreatesPullbackOfLeft
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetCreatesPullbackOfRight /-
 instance forgetCreatesPullbackOfRight : CreatesLimit (cospan g f) forget :=
   createsLimitOfFullyFaithfulOfIso
     (PresheafedSpace.IsOpenImmersion.toSheafedSpace Y
       (@pullback.fst (PresheafedSpace C) _ _ _ _ g f _))
     (eqToIso (show pullback _ _ = pullback _ _ by congr) ≪≫
       HasLimit.isoOfNatIso (diagramIsoCospan _).symm)
-#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_creates_pullback_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.forgetCreatesPullbackOfRight
+#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_creates_pullback_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetCreatesPullbackOfRight
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft /-
 instance sheafedSpaceForgetPreservesOfLeft : PreservesLimit (cospan f g) (SheafedSpace.forget C) :=
   @Limits.compPreservesLimit _ _ _ _ forget (PresheafedSpace.forget C) _
     (by
@@ -741,22 +868,30 @@ instance sheafedSpaceForgetPreservesOfLeft : PreservesLimit (cospan f g) (Sheafe
         preserves_limit_of_iso_diagram _ (diagramIsoCospan.{v} _).symm
       dsimp
       infer_instance)
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfRight /-
 instance sheafedSpaceForgetPreservesOfRight : PreservesLimit (cospan g f) (SheafedSpace.forget C) :=
   preservesPullbackSymmetry _ _ _
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpaceForgetPreservesOfRight
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfRight
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_hasPullback_of_left /-
 instance sheafedSpace_hasPullback_of_left : HasPullback f g :=
   hasLimit_of_created (cospan f g) forget
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_has_pullback_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpaceₓ_hasPullback_of_left
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_has_pullback_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_hasPullback_of_left
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_hasPullback_of_right /-
 instance sheafedSpace_hasPullback_of_right : HasPullback g f :=
   hasLimit_of_created (cospan g f) forget
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_has_pullback_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpaceₓ_hasPullback_of_right
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_has_pullback_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_hasPullback_of_right
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_snd_of_left /-
 /-- Open immersions are stable under base-change. -/
-instance sheafedSpacePullbackSndOfLeft :
+instance sheafedSpace_pullback_snd_of_left :
     SheafedSpace.IsOpenImmersion (pullback.snd : pullback f g ⟶ _) :=
   by
   delta pullback.snd
@@ -767,9 +902,11 @@ instance sheafedSpacePullbackSndOfLeft :
   rw [← this]
   dsimp
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_snd_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpacePullbackSndOfLeft
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_snd_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_snd_of_left
+-/
 
-instance sheafedSpacePullbackFstOfRight :
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_fst_of_right /-
+instance sheafedSpace_pullback_fst_of_right :
     SheafedSpace.IsOpenImmersion (pullback.fst : pullback g f ⟶ _) :=
   by
   delta pullback.fst
@@ -780,14 +917,17 @@ instance sheafedSpacePullbackFstOfRight :
   rw [← this]
   dsimp
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_fst_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpacePullbackFstOfRight
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_fst_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_fst_of_right
+-/
 
-instance sheafedSpacePullbackToBaseIsOpenImmersion [SheafedSpace.IsOpenImmersion g] :
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_to_base_isOpenImmersion /-
+instance sheafedSpace_pullback_to_base_isOpenImmersion [SheafedSpace.IsOpenImmersion g] :
     SheafedSpace.IsOpenImmersion (limit.π (cospan f g) one : pullback f g ⟶ Z) :=
   by
   rw [← limit.w (cospan f g) hom.inl, cospan_map_inl]
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_to_base_is_open_immersion AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpacePullbackToBaseIsOpenImmersion
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_to_base_is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_to_base_isOpenImmersion
+-/
 
 end Pullback
 
@@ -799,12 +939,13 @@ variable [ReflectsIsomorphisms (forget C)] [PreservesLimits (forget C)]
 
 variable [PreservesFilteredColimits (forget C)]
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_stalk_iso /-
 /-- Suppose `X Y : SheafedSpace C`, where `C` is a concrete category,
 whose forgetful functor reflects isomorphisms, preserves limits and filtered colimits.
 Then a morphism `X ⟶ Y` that is a topological open embedding
 is an open immersion iff every stalk map is an iso.
 -/
-theorem ofStalkIso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.base)
+theorem of_stalk_iso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.base)
     [H : ∀ x : X, IsIso (PresheafedSpace.stalkMap f x)] : SheafedSpace.IsOpenImmersion f :=
   { base_open := hf
     c_iso := fun U =>
@@ -820,7 +961,8 @@ theorem ofStalkIso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.ba
       have := @is_iso.comp_is_iso _ H (@is_iso.inv_is_iso _ H')
       rw [category.assoc, is_iso.hom_inv_id, category.comp_id] at this 
       exact this }
-#align algebraic_geometry.SheafedSpace.is_open_immersion.of_stalk_iso AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.ofStalkIso
+#align algebraic_geometry.SheafedSpace.is_open_immersion.of_stalk_iso AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_stalk_iso
+-/
 
 end OfStalkIso
 
@@ -829,6 +971,7 @@ section Prod
 variable [HasLimits C] {ι : Type v} (F : Discrete ι ⥤ SheafedSpace C) [HasColimit F]
   (i : Discrete ι)
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sigma_ι_openEmbedding /-
 theorem sigma_ι_openEmbedding : OpenEmbedding (colimit.ι F i).base :=
   by
   rw [← show _ = (colimit.ι F i).base from ι_preserves_colimits_iso_inv (SheafedSpace.forget C) F i]
@@ -845,8 +988,10 @@ theorem sigma_ι_openEmbedding : OpenEmbedding (colimit.ι F i).base :=
     TopCat.openEmbedding_iff_isIso_comp]
   dsimp
   exact openEmbedding_sigmaMk
-#align algebraic_geometry.SheafedSpace.is_open_immersion.sigma_ι_open_embedding AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sigma_ι_openEmbedding
+#align algebraic_geometry.SheafedSpace.is_open_immersion.sigma_ι_open_embedding AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sigma_ι_openEmbedding
+-/
 
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.image_preimage_is_empty /-
 theorem image_preimage_is_empty (j : Discrete ι) (h : i ≠ j) (U : Opens (F.obj i)) :
     (Opens.map (colimit.ι (F ⋙ SheafedSpace.forgetToPresheafedSpace) j).base).obj
         ((Opens.map (preservesColimitIso SheafedSpace.forgetToPresheafedSpace F).inv.base).obj
@@ -872,9 +1017,11 @@ theorem image_preimage_is_empty (j : Discrete ι) (h : i ≠ j) (U : Opens (F.ob
     has_colimit.iso_of_nat_iso_ι_hom_assoc, has_colimit.iso_of_nat_iso_ι_hom_assoc,
     TopCat.sigmaIsoSigma_hom_ι.{v}, TopCat.sigmaIsoSigma_hom_ι.{v}] at eq 
   exact h (congr_arg discrete.mk (congr_arg Sigma.fst Eq))
-#align algebraic_geometry.SheafedSpace.is_open_immersion.image_preimage_is_empty AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.image_preimage_is_empty
+#align algebraic_geometry.SheafedSpace.is_open_immersion.image_preimage_is_empty AlgebraicGeometry.SheafedSpace.IsOpenImmersion.image_preimage_is_empty
+-/
 
-instance sigmaιIsOpenImmersion [HasStrictTerminalObjects C] :
+#print AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sigma_ι_isOpenImmersion /-
+instance sigma_ι_isOpenImmersion [HasStrictTerminalObjects C] :
     SheafedSpace.IsOpenImmersion (colimit.ι F i)
     where
   base_open := sigma_ι_openEmbedding F i
@@ -911,7 +1058,8 @@ instance sigmaιIsOpenImmersion [HasStrictTerminalObjects C] :
     convert (F.obj j).Sheaf.isTerminalOfEmpty
     convert image_preimage_is_empty F i j (fun h => hj (congr_arg op h.symm)) U
     exact (congr_arg PresheafedSpace.hom.base e).symm
-#align algebraic_geometry.SheafedSpace.is_open_immersion.sigma_ι_is_open_immersion AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sigmaιIsOpenImmersion
+#align algebraic_geometry.SheafedSpace.is_open_immersion.sigma_ι_is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sigma_ι_isOpenImmersion
+-/
 
 end Prod
 
@@ -925,25 +1073,32 @@ variable {X Y Z : LocallyRingedSpace.{u}} (f : X ⟶ Z) (g : Y ⟶ Z)
 
 variable [H : LocallyRingedSpace.IsOpenImmersion f]
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.of_isIso /-
 instance (priority := 100) of_isIso [IsIso g] : LocallyRingedSpace.IsOpenImmersion g :=
   @PresheafedSpace.IsOpenImmersion.ofIsIso _ g.1
     ⟨⟨(inv g).1, by
         erw [← LocallyRingedSpace.comp_val]; rw [is_iso.hom_inv_id]
         erw [← LocallyRingedSpace.comp_val]; rw [is_iso.inv_hom_id]; constructor <;> simpa⟩⟩
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.of_is_iso AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.of_isIso
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.comp /-
 instance comp (g : Z ⟶ Y) [LocallyRingedSpace.IsOpenImmersion g] :
     LocallyRingedSpace.IsOpenImmersion (f ≫ g) :=
   PresheafedSpace.IsOpenImmersion.comp f.1 g.1
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.comp AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.comp
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.mono /-
 instance mono : Mono f :=
   LocallyRingedSpace.forgetToSheafedSpace.mono_of_mono_map (show Mono f.1 by infer_instance)
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.mono AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.mono
+-/
 
 instance : SheafedSpace.IsOpenImmersion (LocallyRingedSpace.forgetToSheafedSpace.map f) :=
   H
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullbackConeOfLeft /-
 /-- An explicit pullback cone over `cospan f g` if `f` is an open immersion. -/
 def pullbackConeOfLeft : PullbackCone f g :=
   by
@@ -964,10 +1119,12 @@ def pullbackConeOfLeft : PullbackCone f g :=
       LocallyRingedSpace.hom.ext _ _
         (PresheafedSpace.is_open_immersion.pullback_cone_of_left_condition _ _)
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.pullback_cone_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullbackConeOfLeft
+-/
 
 instance : LocallyRingedSpace.IsOpenImmersion (pullbackConeOfLeft f g).snd :=
   show PresheafedSpace.IsOpenImmersion (Y.toPresheafedSpace.of_restrict _) by infer_instance
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullbackConeOfLeftIsLimit /-
 /-- The constructed `pullback_cone_of_left` is indeed limiting. -/
 def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) :=
   PullbackCone.isLimitAux' _ fun s =>
@@ -1004,15 +1161,21 @@ def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) :=
               (pullback_cone.mk s.fst.1 s.snd.1
                 (congr_arg LocallyRingedSpace.hom.val s.condition))).symm)
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.pullback_cone_of_left_is_limit AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullbackConeOfLeftIsLimit
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.hasPullback_of_left /-
 instance hasPullback_of_left : HasPullback f g :=
   ⟨⟨⟨_, pullbackConeOfLeftIsLimit f g⟩⟩⟩
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.has_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.hasPullback_of_left
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.hasPullback_of_right /-
 instance hasPullback_of_right : HasPullback g f :=
   hasPullback_symmetry f g
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.has_pullback_of_right AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.hasPullback_of_right
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_snd_of_left /-
 /-- Open immersions are stable under base-change. -/
 instance pullback_snd_of_left :
     LocallyRingedSpace.IsOpenImmersion (pullback.snd : pullback f g ⟶ _) :=
@@ -1021,7 +1184,9 @@ instance pullback_snd_of_left :
   rw [← limit.iso_limit_cone_hom_π ⟨_, pullback_cone_of_left_is_limit f g⟩ walking_cospan.right]
   infer_instance
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.pullback_snd_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_snd_of_left
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_fst_of_right /-
 /-- Open immersions are stable under base-change. -/
 instance pullback_fst_of_right :
     LocallyRingedSpace.IsOpenImmersion (pullback.fst : pullback g f ⟶ _) :=
@@ -1029,14 +1194,18 @@ instance pullback_fst_of_right :
   rw [← pullback_symmetry_hom_comp_snd]
   infer_instance
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.pullback_fst_of_right AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_fst_of_right
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_to_base_isOpenImmersion /-
 instance pullback_to_base_isOpenImmersion [LocallyRingedSpace.IsOpenImmersion g] :
     LocallyRingedSpace.IsOpenImmersion (limit.π (cospan f g) WalkingCospan.one) :=
   by
   rw [← limit.w (cospan f g) walking_cospan.hom.inl, cospan_map_inl]
   infer_instance
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.pullback_to_base_is_open_immersion AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_to_base_isOpenImmersion
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetPreservesPullbackOfLeft /-
 instance forgetPreservesPullbackOfLeft :
     PreservesLimit (cospan f g) LocallyRingedSpace.forgetToSheafedSpace :=
   preservesLimitOfPreservesLimitCone (pullbackConeOfLeftIsLimit f g)
@@ -1045,7 +1214,11 @@ instance forgetPreservesPullbackOfLeft :
       apply is_limit_of_is_limit_pullback_cone_map SheafedSpace.forget_to_PresheafedSpace
       exact PresheafedSpace.is_open_immersion.pullback_cone_of_left_is_limit f.1 g.1)
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_preserves_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetPreservesPullbackOfLeft
+-/
 
+/- warning: algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_pullback_of_left clashes with algebraic_geometry.LocallyRingedSpace.is_open_immersion.forgetToPresheafedSpace_preserves_pullback_of_left -> AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfLeft
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfLeftₓ'. -/
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfLeft /-
 instance forgetToPresheafedSpacePreservesPullbackOfLeft :
     PreservesLimit (cospan f g)
       (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) :=
@@ -1054,13 +1227,19 @@ instance forgetToPresheafedSpacePreservesPullbackOfLeft :
       apply (is_limit_map_cone_pullback_cone_equiv _ _).symm.toFun
       exact PresheafedSpace.is_open_immersion.pullback_cone_of_left_is_limit f.1 g.1)
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfLeft
+-/
 
+/- warning: algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_open_immersion clashes with algebraic_geometry.LocallyRingedSpace.is_open_immersion.forgetToPresheafedSpace_preserves_open_immersion -> AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesOpenImmersion
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_open_immersion AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesOpenImmersionₓ'. -/
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesOpenImmersion /-
 instance forgetToPresheafedSpacePreservesOpenImmersion :
     PresheafedSpace.IsOpenImmersion
       ((LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace).map f) :=
   H
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_open_immersion AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesOpenImmersion
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToTopPreservesPullbackOfLeft /-
 instance forgetToTopPreservesPullbackOfLeft :
     PreservesLimit (cospan f g) (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forget _) :=
   by
@@ -1074,40 +1253,60 @@ instance forgetToTopPreservesPullbackOfLeft :
   dsimp [SheafedSpace.forget_to_PresheafedSpace]
   infer_instance
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_Top_preserves_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToTopPreservesPullbackOfLeft
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetReflectsPullbackOfLeft /-
 instance forgetReflectsPullbackOfLeft :
     ReflectsLimit (cospan f g) LocallyRingedSpace.forgetToSheafedSpace :=
   reflectsLimitOfReflectsIsomorphisms _ _
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_reflects_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetReflectsPullbackOfLeft
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetPreservesPullbackOfRight /-
 instance forgetPreservesPullbackOfRight :
     PreservesLimit (cospan g f) LocallyRingedSpace.forgetToSheafedSpace :=
   preservesPullbackSymmetry _ _ _
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_preserves_pullback_of_right AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetPreservesPullbackOfRight
+-/
 
+/- warning: algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_pullback_of_right clashes with algebraic_geometry.LocallyRingedSpace.is_open_immersion.forgetToPresheafedSpace_preserves_pullback_of_right -> AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfRight
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_pullback_of_right AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfRightₓ'. -/
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfRight /-
 instance forgetToPresheafedSpacePreservesPullbackOfRight :
     PreservesLimit (cospan g f)
       (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) :=
   preservesPullbackSymmetry _ _ _
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_preserves_pullback_of_right AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfRight
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetReflectsPullbackOfRight /-
 instance forgetReflectsPullbackOfRight :
     ReflectsLimit (cospan g f) LocallyRingedSpace.forgetToSheafedSpace :=
   reflectsLimitOfReflectsIsomorphisms _ _
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_reflects_pullback_of_right AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetReflectsPullbackOfRight
+-/
 
+/- warning: algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_reflects_pullback_of_left clashes with algebraic_geometry.LocallyRingedSpace.is_open_immersion.forgetToPresheafedSpace_reflects_pullback_of_left -> AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfLeft
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_reflects_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfLeftₓ'. -/
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfLeft /-
 instance forgetToPresheafedSpaceReflectsPullbackOfLeft :
     ReflectsLimit (cospan f g)
       (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) :=
   reflectsLimitOfReflectsIsomorphisms _ _
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_reflects_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfLeft
+-/
 
+/- warning: algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_reflects_pullback_of_right clashes with algebraic_geometry.LocallyRingedSpace.is_open_immersion.forgetToPresheafedSpace_reflects_pullback_of_right -> AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfRight
+Case conversion may be inaccurate. Consider using '#align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_reflects_pullback_of_right AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfRightₓ'. -/
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfRight /-
 instance forgetToPresheafedSpaceReflectsPullbackOfRight :
     ReflectsLimit (cospan g f)
       (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) :=
   reflectsLimitOfReflectsIsomorphisms _ _
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_PresheafedSpace_reflects_pullback_of_right AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfRight
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_snd_isIso_of_range_subset /-
 theorem pullback_snd_isIso_of_range_subset (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
     IsIso (pullback.snd : pullback f g ⟶ _) :=
   by
@@ -1122,7 +1321,9 @@ theorem pullback_snd_isIso_of_range_subset (H' : Set.range g.1.base ⊆ Set.rang
   infer_instance
   infer_instance
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.pullback_snd_is_iso_of_range_subset AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_snd_isIso_of_range_subset
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift /-
 /-- The universal property of open immersions:
 For an open immersion `f : X ⟶ Z`, given any morphism of schemes `g : Y ⟶ Z` whose topological
 image is contained in the image of `f`, we can lift this morphism to a unique `Y ⟶ X` that
@@ -1132,16 +1333,22 @@ def lift (H' : Set.range g.1.base ⊆ Set.range f.1.base) : Y ⟶ X :=
   haveI := pullback_snd_is_iso_of_range_subset f g H'
   inv (pullback.snd : pullback f g ⟶ _) ≫ pullback.fst
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.lift AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_fac /-
 @[simp, reassoc]
 theorem lift_fac (H' : Set.range g.1.base ⊆ Set.range f.1.base) : lift f g H' ≫ f = g := by
   erw [category.assoc]; rw [is_iso.inv_comp_eq]; exact pullback.condition
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.lift_fac AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_fac
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_uniq /-
 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' := by rw [← cancel_mono f, hl, lift_fac]
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.lift_uniq AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_uniq
+-/
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_range /-
 theorem lift_range (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
     Set.range (lift f g H').1.base = f.1.base ⁻¹' Set.range g.1.base :=
   by
@@ -1161,9 +1368,11 @@ theorem lift_range (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
         (LocallyRingedSpace.forget_to_SheafedSpace ⋙ SheafedSpace.forget _).map_inv _]
     infer_instance
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.lift_range AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_range
+-/
 
 end Pullback
 
+#print AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.isoRestrict /-
 /-- An open immersion is isomorphic to the induced open subscheme on its image. -/
 def isoRestrict {X Y : LocallyRingedSpace} {f : X ⟶ Y} (H : LocallyRingedSpace.IsOpenImmersion f) :
     X ≅ Y.restrict H.base_open :=
@@ -1172,6 +1381,7 @@ def isoRestrict {X Y : LocallyRingedSpace} {f : X ⟶ Y} (H : LocallyRingedSpace
   refine' SheafedSpace.forget_to_PresheafedSpace.preimage_iso _
   exact H.iso_restrict
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.iso_restrict AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.isoRestrict
+-/
 
 end LocallyRingedSpace.IsOpenImmersion
 
Diff
@@ -80,7 +80,7 @@ of PresheafedSpaces
 -/
 abbrev SheafedSpace.IsOpenImmersion {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) : Prop :=
   PresheafedSpace.IsOpenImmersion f
-#align algebraic_geometry.SheafedSpace.is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion
+#align algebraic_geometry.SheafedSpace.is_open_immersion AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion
 
 /-- A morphism of LocallyRingedSpaces is an open immersion if it is an open immersion as a morphism
 of SheafedSpaces
@@ -595,14 +595,14 @@ theorem toSheafedSpaceHom_c : (toSheafedSpaceHom Y f).c = f.c :=
   rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_hom_c AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom_c
 
-instance toSheafedSpace_isOpenImmersion : SheafedSpace.IsOpenImmersion (toSheafedSpaceHom Y f) :=
+instance toSheafedSpaceIsOpenImmersion : SheafedSpace.IsOpenImmersion (toSheafedSpaceHom Y f) :=
   H
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_isOpenImmersion
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceIsOpenImmersion
 
 @[simp]
 theorem sheafedSpace_toSheafedSpace {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) [is_open_immersion f] :
     toSheafedSpace Y f = X := by cases X; rfl
-#align algebraic_geometry.PresheafedSpace.is_open_immersion.SheafedSpace_to_SheafedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.sheafedSpace_toSheafedSpace
+#align algebraic_geometry.PresheafedSpace.is_open_immersion.SheafedSpace_to_SheafedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.sheafedSpaceₓ_toSheafedSpace
 
 end ToSheafedSpace
 
@@ -667,15 +667,15 @@ end PresheafedSpace.IsOpenImmersion
 
 namespace SheafedSpace.IsOpenImmersion
 
-instance (priority := 100) of_isIso {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) [IsIso f] :
+instance (priority := 100) ofIsIso {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) [IsIso f] :
     SheafedSpace.IsOpenImmersion f :=
   @PresheafedSpace.IsOpenImmersion.ofIsIso _ f (SheafedSpace.forgetToPresheafedSpace.map_isIso _)
-#align algebraic_geometry.SheafedSpace.is_open_immersion.of_is_iso AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_isIso
+#align algebraic_geometry.SheafedSpace.is_open_immersion.of_is_iso AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.ofIsIso
 
 instance comp {X Y Z : SheafedSpace C} (f : X ⟶ Y) (g : Y ⟶ Z) [SheafedSpace.IsOpenImmersion f]
     [SheafedSpace.IsOpenImmersion g] : SheafedSpace.IsOpenImmersion (f ≫ g) :=
   PresheafedSpace.IsOpenImmersion.comp f g
-#align algebraic_geometry.SheafedSpace.is_open_immersion.comp AlgebraicGeometry.SheafedSpace.IsOpenImmersion.comp
+#align algebraic_geometry.SheafedSpace.is_open_immersion.comp AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.comp
 
 section Pullback
 
@@ -692,31 +692,31 @@ instance : Mono f :=
 
 instance forgetMapIsOpenImmersion : PresheafedSpace.IsOpenImmersion (forget.map f) :=
   ⟨H.base_open, H.c_iso⟩
-#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_map_is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetMapIsOpenImmersion
+#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_map_is_open_immersion AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.forgetMapIsOpenImmersion
 
 instance hasLimit_cospan_forget_of_left : HasLimit (cospan f g ⋙ forget) :=
   by
   apply has_limit_of_iso (diagramIsoCospan.{v} _).symm
   change has_limit (cospan (forget.map f) (forget.map g))
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left
+#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.hasLimit_cospan_forget_of_left
 
 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.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left' AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left'
+#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left' AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.hasLimit_cospan_forget_of_left'
 
 instance hasLimit_cospan_forget_of_right : HasLimit (cospan g f ⋙ forget) :=
   by
   apply has_limit_of_iso (diagramIsoCospan.{v} _).symm
   change has_limit (cospan (forget.map g) (forget.map f))
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right
+#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.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.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right' AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right'
+#align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right' AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.hasLimit_cospan_forget_of_right'
 
 instance forgetCreatesPullbackOfLeft : CreatesLimit (cospan f g) forget :=
   createsLimitOfFullyFaithfulOfIso
@@ -724,7 +724,7 @@ instance forgetCreatesPullbackOfLeft : CreatesLimit (cospan f g) forget :=
       (@pullback.snd (PresheafedSpace C) _ _ _ _ f g _))
     (eqToIso (show pullback _ _ = pullback _ _ by congr) ≪≫
       HasLimit.isoOfNatIso (diagramIsoCospan _).symm)
-#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_creates_pullback_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetCreatesPullbackOfLeft
+#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_creates_pullback_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.forgetCreatesPullbackOfLeft
 
 instance forgetCreatesPullbackOfRight : CreatesLimit (cospan g f) forget :=
   createsLimitOfFullyFaithfulOfIso
@@ -732,7 +732,7 @@ instance forgetCreatesPullbackOfRight : CreatesLimit (cospan g f) forget :=
       (@pullback.fst (PresheafedSpace C) _ _ _ _ g f _))
     (eqToIso (show pullback _ _ = pullback _ _ by congr) ≪≫
       HasLimit.isoOfNatIso (diagramIsoCospan _).symm)
-#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_creates_pullback_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetCreatesPullbackOfRight
+#align algebraic_geometry.SheafedSpace.is_open_immersion.forget_creates_pullback_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.forgetCreatesPullbackOfRight
 
 instance sheafedSpaceForgetPreservesOfLeft : PreservesLimit (cospan f g) (SheafedSpace.forget C) :=
   @Limits.compPreservesLimit _ _ _ _ forget (PresheafedSpace.forget C) _
@@ -741,22 +741,22 @@ instance sheafedSpaceForgetPreservesOfLeft : PreservesLimit (cospan f g) (Sheafe
         preserves_limit_of_iso_diagram _ (diagramIsoCospan.{v} _).symm
       dsimp
       infer_instance)
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft
 
 instance sheafedSpaceForgetPreservesOfRight : PreservesLimit (cospan g f) (SheafedSpace.forget C) :=
   preservesPullbackSymmetry _ _ _
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfRight
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpaceForgetPreservesOfRight
 
 instance sheafedSpace_hasPullback_of_left : HasPullback f g :=
   hasLimit_of_created (cospan f g) forget
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_has_pullback_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_hasPullback_of_left
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_has_pullback_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpaceₓ_hasPullback_of_left
 
 instance sheafedSpace_hasPullback_of_right : HasPullback g f :=
   hasLimit_of_created (cospan g f) forget
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_has_pullback_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_hasPullback_of_right
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_has_pullback_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpaceₓ_hasPullback_of_right
 
 /-- Open immersions are stable under base-change. -/
-instance sheafedSpace_pullback_snd_of_left :
+instance sheafedSpacePullbackSndOfLeft :
     SheafedSpace.IsOpenImmersion (pullback.snd : pullback f g ⟶ _) :=
   by
   delta pullback.snd
@@ -767,9 +767,9 @@ instance sheafedSpace_pullback_snd_of_left :
   rw [← this]
   dsimp
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_snd_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_snd_of_left
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_snd_of_left AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpacePullbackSndOfLeft
 
-instance sheafedSpace_pullback_fst_of_right :
+instance sheafedSpacePullbackFstOfRight :
     SheafedSpace.IsOpenImmersion (pullback.fst : pullback g f ⟶ _) :=
   by
   delta pullback.fst
@@ -780,14 +780,14 @@ instance sheafedSpace_pullback_fst_of_right :
   rw [← this]
   dsimp
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_fst_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_fst_of_right
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_fst_of_right AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpacePullbackFstOfRight
 
-instance sheafedSpace_pullback_to_base_isOpenImmersion [SheafedSpace.IsOpenImmersion g] :
+instance sheafedSpacePullbackToBaseIsOpenImmersion [SheafedSpace.IsOpenImmersion g] :
     SheafedSpace.IsOpenImmersion (limit.π (cospan f g) one : pullback f g ⟶ Z) :=
   by
   rw [← limit.w (cospan f g) hom.inl, cospan_map_inl]
   infer_instance
-#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_to_base_is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_to_base_isOpenImmersion
+#align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_pullback_to_base_is_open_immersion AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sheafedSpacePullbackToBaseIsOpenImmersion
 
 end Pullback
 
@@ -804,7 +804,7 @@ whose forgetful functor reflects isomorphisms, preserves limits and filtered col
 Then a morphism `X ⟶ Y` that is a topological open embedding
 is an open immersion iff every stalk map is an iso.
 -/
-theorem of_stalk_iso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.base)
+theorem ofStalkIso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.base)
     [H : ∀ x : X, IsIso (PresheafedSpace.stalkMap f x)] : SheafedSpace.IsOpenImmersion f :=
   { base_open := hf
     c_iso := fun U =>
@@ -820,7 +820,7 @@ theorem of_stalk_iso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.
       have := @is_iso.comp_is_iso _ H (@is_iso.inv_is_iso _ H')
       rw [category.assoc, is_iso.hom_inv_id, category.comp_id] at this 
       exact this }
-#align algebraic_geometry.SheafedSpace.is_open_immersion.of_stalk_iso AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_stalk_iso
+#align algebraic_geometry.SheafedSpace.is_open_immersion.of_stalk_iso AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.ofStalkIso
 
 end OfStalkIso
 
@@ -845,7 +845,7 @@ theorem sigma_ι_openEmbedding : OpenEmbedding (colimit.ι F i).base :=
     TopCat.openEmbedding_iff_isIso_comp]
   dsimp
   exact openEmbedding_sigmaMk
-#align algebraic_geometry.SheafedSpace.is_open_immersion.sigma_ι_open_embedding AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sigma_ι_openEmbedding
+#align algebraic_geometry.SheafedSpace.is_open_immersion.sigma_ι_open_embedding AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sigma_ι_openEmbedding
 
 theorem image_preimage_is_empty (j : Discrete ι) (h : i ≠ j) (U : Opens (F.obj i)) :
     (Opens.map (colimit.ι (F ⋙ SheafedSpace.forgetToPresheafedSpace) j).base).obj
@@ -872,9 +872,9 @@ theorem image_preimage_is_empty (j : Discrete ι) (h : i ≠ j) (U : Opens (F.ob
     has_colimit.iso_of_nat_iso_ι_hom_assoc, has_colimit.iso_of_nat_iso_ι_hom_assoc,
     TopCat.sigmaIsoSigma_hom_ι.{v}, TopCat.sigmaIsoSigma_hom_ι.{v}] at eq 
   exact h (congr_arg discrete.mk (congr_arg Sigma.fst Eq))
-#align algebraic_geometry.SheafedSpace.is_open_immersion.image_preimage_is_empty AlgebraicGeometry.SheafedSpace.IsOpenImmersion.image_preimage_is_empty
+#align algebraic_geometry.SheafedSpace.is_open_immersion.image_preimage_is_empty AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.image_preimage_is_empty
 
-instance sigma_ι_isOpenImmersion [HasStrictTerminalObjects C] :
+instance sigmaιIsOpenImmersion [HasStrictTerminalObjects C] :
     SheafedSpace.IsOpenImmersion (colimit.ι F i)
     where
   base_open := sigma_ι_openEmbedding F i
@@ -911,7 +911,7 @@ instance sigma_ι_isOpenImmersion [HasStrictTerminalObjects C] :
     convert (F.obj j).Sheaf.isTerminalOfEmpty
     convert image_preimage_is_empty F i j (fun h => hj (congr_arg op h.symm)) U
     exact (congr_arg PresheafedSpace.hom.base e).symm
-#align algebraic_geometry.SheafedSpace.is_open_immersion.sigma_ι_is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sigma_ι_isOpenImmersion
+#align algebraic_geometry.SheafedSpace.is_open_immersion.sigma_ι_is_open_immersion AlgebraicGeometry.SheafedSpaceₓ.IsOpenImmersion.sigmaιIsOpenImmersion
 
 end Prod
 
Diff
@@ -93,7 +93,6 @@ namespace PresheafedSpace.IsOpenImmersion
 
 open PresheafedSpace
 
--- mathport name: expris_open_immersion
 local notation "is_open_immersion" => PresheafedSpace.IsOpenImmersion
 
 attribute [instance] is_open_immersion.c_iso
@@ -322,8 +321,6 @@ noncomputable section
 
 variable {X Y Z : PresheafedSpace.{v} C} (f : X ⟶ Z) [hf : is_open_immersion f] (g : Y ⟶ Z)
 
-include hf
-
 /-- (Implementation.) The projection map when constructing the pullback along an open immersion.
 -/
 def pullbackConeOfLeftFst :
@@ -565,8 +562,6 @@ variable {X : PresheafedSpace.{v} C} (Y : SheafedSpace C)
 
 variable (f : X ⟶ Y.toPresheafedSpace) [H : is_open_immersion f]
 
-include H
-
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a SheafedSpace, then so is `X`. -/
 def toSheafedSpace : SheafedSpace C
     where
@@ -604,8 +599,6 @@ instance toSheafedSpace_isOpenImmersion : SheafedSpace.IsOpenImmersion (toSheafe
   H
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_isOpenImmersion
 
-omit H
-
 @[simp]
 theorem sheafedSpace_toSheafedSpace {X Y : SheafedSpace.{v} C} (f : X ⟶ Y) [is_open_immersion f] :
     toSheafedSpace Y f = X := by cases X; rfl
@@ -619,8 +612,6 @@ variable {X : PresheafedSpace.{u} CommRingCat.{u}} (Y : LocallyRingedSpace.{u})
 
 variable (f : X ⟶ Y.toPresheafedSpace) [H : is_open_immersion f]
 
-include H
-
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a LocallyRingedSpace, then so is `X`. -/
 def toLocallyRingedSpace : LocallyRingedSpace
     where
@@ -653,8 +644,6 @@ instance toLocallyRingedSpace_isOpenImmersion :
   H
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_LocallyRingedSpace_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace_isOpenImmersion
 
-omit H
-
 @[simp]
 theorem locallyRingedSpace_toLocallyRingedSpace {X Y : LocallyRingedSpace} (f : X ⟶ Y)
     [LocallyRingedSpace.IsOpenImmersion f] : toLocallyRingedSpace Y f.1 = X := by cases X;
@@ -694,9 +683,6 @@ variable {X Y Z : SheafedSpace C} (f : X ⟶ Z) (g : Y ⟶ Z)
 
 variable [H : SheafedSpace.IsOpenImmersion f]
 
-include H
-
--- mathport name: exprforget
 local notation "forget" => SheafedSpace.forgetToPresheafedSpace
 
 open CategoryTheory.Limits.WalkingCospan
@@ -946,8 +932,6 @@ instance (priority := 100) of_isIso [IsIso g] : LocallyRingedSpace.IsOpenImmersi
         erw [← LocallyRingedSpace.comp_val]; rw [is_iso.inv_hom_id]; constructor <;> simpa⟩⟩
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.of_is_iso AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.of_isIso
 
-include H
-
 instance comp (g : Z ⟶ Y) [LocallyRingedSpace.IsOpenImmersion g] :
     LocallyRingedSpace.IsOpenImmersion (f ≫ g) :=
   PresheafedSpace.IsOpenImmersion.comp f.1 g.1
Diff
@@ -286,7 +286,7 @@ theorem ofRestrict_invApp {C : Type _} [Category C] (X : PresheafedSpace C) {Y :
 theorem to_iso (f : X ⟶ Y) [h : is_open_immersion f] [h' : Epi f.base] : IsIso f :=
   by
   apply (config := { instances := false }) is_iso_of_components
-  · let this : X ≃ₜ Y :=
+  · let this.1 : X ≃ₜ Y :=
       (Homeomorph.ofEmbedding _ h.base_open.to_embedding).trans
         { toFun := Subtype.val
           invFun := fun x =>
Diff
@@ -3,25 +3,18 @@ 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
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
+! This file was ported from Lean 3 source module algebraic_geometry.open_immersion.basic
+! leanprover-community/mathlib commit 533f62f4dd62a5aad24a04326e6e787c8f7e98b1
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.AlgebraicGeometry.PresheafedSpace.HasColimits
-import Mathbin.CategoryTheory.Limits.Shapes.BinaryProducts
-import Mathbin.CategoryTheory.Limits.Preserves.Shapes.Pullbacks
-import Mathbin.Topology.Sheaves.Functors
 import Mathbin.Topology.Category.Top.Limits.Pullbacks
-import Mathbin.AlgebraicGeometry.Scheme
-import Mathbin.CategoryTheory.Limits.Shapes.StrictInitial
-import Mathbin.CategoryTheory.Limits.Shapes.CommSq
-import Mathbin.Algebra.Category.Ring.Instances
+import Mathbin.AlgebraicGeometry.LocallyRingedSpace
 
 /-!
 # Open immersions of structured spaces
 
-We say that a morphism of presheafed spaces `f : X ⟶ Y` is an open immersions if
+We say that a morphism of presheafed spaces `f : X ⟶ Y` is an open immersion if
 the underlying map of spaces is an open embedding `f : X ⟶ U ⊆ Y`,
 and the sheaf map `Y(V) ⟶ f _* X(V)` is an iso for each `V ⊆ U`.
 
@@ -96,13 +89,6 @@ abbrev LocallyRingedSpace.IsOpenImmersion {X Y : LocallyRingedSpace} (f : X ⟶
   SheafedSpace.IsOpenImmersion f.1
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion
 
-/-- 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 :=
-  LocallyRingedSpace.IsOpenImmersion f
-#align algebraic_geometry.is_open_immersion AlgebraicGeometry.IsOpenImmersion
-
 namespace PresheafedSpace.IsOpenImmersion
 
 open PresheafedSpace
@@ -1203,1101 +1189,11 @@ def isoRestrict {X Y : LocallyRingedSpace} {f : X ⟶ Y} (H : LocallyRingedSpace
   exact H.iso_restrict
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.iso_restrict AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.isoRestrict
 
-/-- 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)
-    (h :
-      ∀ x : X,
-        ∃ (R : CommRingCat) (f : Spec.toLocallyRingedSpace.obj (op R) ⟶ X),
-          (x ∈ Set.range f.1.base : _) ∧ LocallyRingedSpace.IsOpenImmersion f) :
-    Scheme where
-  toLocallyRingedSpace := X
-  local_affine := by
-    intro x
-    obtain ⟨R, f, h₁, h₂⟩ := h x
-    refine' ⟨⟨⟨_, h₂.base_open.open_range⟩, h₁⟩, R, ⟨_⟩⟩
-    apply LocallyRingedSpace.iso_of_SheafedSpace_iso
-    refine' SheafedSpace.forget_to_PresheafedSpace.preimage_iso _
-    skip
-    apply PresheafedSpace.is_open_immersion.iso_of_range_eq (PresheafedSpace.of_restrict _ _) f.1
-    · 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] :
-    IsOpen (Set.range f.1.base) :=
-  H.base_open.open_range
-#align algebraic_geometry.is_open_immersion.open_range AlgebraicGeometry.IsOpenImmersion.open_range
-
 section OpenCover
 
-namespace Scheme
-
--- 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`.
-
-This is merely a coverage in the Zariski pretopology, and it would be optimal
-if we could reuse the existing API about pretopologies, However, the definitions of sieves and
-grothendieck topologies uses `Prop`s, so that the actual open sets and immersions are hard to
-obtain. Also, since such a coverage in the pretopology usually contains a proper class of
-immersions, it is quite hard to glue them, reason about finite covers, etc.
--/
-structure OpenCover (X : Scheme.{u}) where
-  J : Type v
-  obj : ∀ j : J, Scheme
-  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
-#align algebraic_geometry.Scheme.open_cover AlgebraicGeometry.Scheme.OpenCover
-
-attribute [instance] open_cover.is_open
-
-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. -/
-def affineCover (X : Scheme) : OpenCover X
-    where
-  J := X.carrier
-  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
-  IsOpen x :=
-    by
-    apply (config := { instances := false }) PresheafedSpace.is_open_immersion.comp
-    infer_instance
-    apply PresheafedSpace.is_open_immersion.of_restrict
-  Covers := by
-    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).some.2
-    rw [← TopCat.epi_iff_surjective]
-    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⟩
-
-/-- 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]
-def OpenCover.bind (f : ∀ x : 𝒰.J, OpenCover (𝒰.obj x)) : OpenCover X
-    where
-  J := Σ i : 𝒰.J, (f i).J
-  obj x := (f x.1).obj x.2
-  map x := (f x.1).map x.2 ≫ 𝒰.map x.1
-  f x := ⟨_, (f _).f (𝒰.Covers x).some⟩
-  Covers x := by
-    let y := (𝒰.covers x).some
-    have hy : (𝒰.map (𝒰.f x)).val.base y = x := (𝒰.covers x).choose_spec
-    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]
-    rw [hz, hy]
-#align algebraic_geometry.Scheme.open_cover.bind AlgebraicGeometry.Scheme.OpenCover.bind
-
-/-- 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
-    where
-  J := PUnit.{v + 1}
-  obj _ := X
-  map _ := f
-  f _ := PUnit.unit
-  Covers x := by
-    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
-
-/-- 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)
-    (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
-    f := fun x => e₁.symm (𝒰.f x)
-    Covers := fun x =>
-      by
-      rw [e₂, Scheme.comp_val_base, coe_comp, Set.range_comp, set.range_iff_surjective.mpr,
-        Set.image_univ, e₁.right_inverse_symm]
-      · exact 𝒰.covers x
-      · 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
-
-/-- 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 :=
-  ((openCoverOfIsIso f).bind fun _ => 𝒰).copy 𝒰.J _ _
-    ((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
-
-/-- 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] :
-    X.OpenCover where
-  J := Option 𝒰.J
-  obj i := Option.rec Y 𝒰.obj i
-  map i := Option.rec f 𝒰.map i
-  f x := some (𝒰.f 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
-
-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
-      (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
-  any_goals infer_instance
-  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
-
-/-- The basic open sets form an affine open cover of `Spec 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) : _))
-  f x := 1
-  Covers r := by
-    rw [set.range_iff_surjective.mpr ((TopCat.epi_iff_surjective _).mp _)]
-    · exact trivial
-    · infer_instance
-  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
-a basis. -/
-def affineBasisCover (X : Scheme) : OpenCover X :=
-  X.affineCover.bind fun x => affineBasisCoverOfAffine _
-#align algebraic_geometry.Scheme.affine_basis_cover AlgebraicGeometry.Scheme.affineBasisCover
-
-/-- 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
-
-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
-
-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 =
-      (X.affineCover.map x).1.base '' (PrimeSpectrum.basicOpen r).1 :=
-  by
-  erw [coe_comp, Set.range_comp]
-  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
-
-theorem affineBasisCover_is_basis (X : Scheme) :
-    TopologicalSpace.IsTopologicalBasis
-      {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
-  · rintro _ ⟨a, rfl⟩
-    exact is_open_immersion.open_range (X.affine_basis_cover.map a)
-  · 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
-    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
-      ⟨_, ⟨_, ⟨s, rfl⟩, rfl⟩, hxV, hVU⟩
-    refine' ⟨_, ⟨⟨_, s⟩, rfl⟩, _, _⟩ <;> erw [affine_basis_cover_map_range]
-    · 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
-
-/-- Every open cover of a quasi-compact scheme can be refined into a finite subcover.
--/
-@[simps obj map]
-def OpenCover.finiteSubcover {X : Scheme} (𝒰 : OpenCover X) [H : CompactSpace X.carrier] :
-    OpenCover X :=
-  by
-  have :=
-    @CompactSpace.elim_nhds_subcover _ H (fun x : X.carrier => Set.range (𝒰.map (𝒰.f x)).1.base)
-      fun x => (is_open_immersion.open_range (𝒰.map (𝒰.f x))).mem_nhds (𝒰.covers x)
-  let t := this.some
-  have h : ∀ x : X.carrier, ∃ y : t, x ∈ Set.range (𝒰.map (𝒰.f y)).1.base :=
-    by
-    intro x
-    have h' : x ∈ (⊤ : Set X.carrier) := trivial
-    rw [← Classical.choose_spec this, Set.mem_iUnion] at h' 
-    rcases h' with ⟨y, _, ⟨hy, rfl⟩, hy'⟩
-    exact ⟨⟨y, hy⟩, hy'⟩
-  exact
-    { J := t
-      obj := fun x => 𝒰.obj (𝒰.f x.1)
-      map := fun x => 𝒰.map (𝒰.f x.1)
-      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
-
-end Scheme
-
 end OpenCover
 
-namespace PresheafedSpace.IsOpenImmersion
-
-section ToScheme
-
-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
-  apply LocallyRingedSpace.is_open_immersion.Scheme (to_LocallyRingedSpace _ f)
-  intro x
-  obtain ⟨_, ⟨i, rfl⟩, hx, hi⟩ :=
-    Y.affine_basis_cover_is_basis.exists_subset_of_mem_open (Set.mem_range_self x)
-      H.base_open.open_range
-  use Y.affine_basis_cover_ring i
-  use LocallyRingedSpace.is_open_immersion.lift (to_LocallyRingedSpace_hom _ f) _ hi
-  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
-
-@[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
-
-/-- 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
-
-@[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) :=
-  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
-#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
-
-end ToScheme
-
-end PresheafedSpace.IsOpenImmersion
-
-/-- 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) :
-    Scheme :=
-  { PresheafedSpace.IsOpenImmersion.toScheme X (X.toPresheafedSpace.of_restrict h) with
-    toPresheafedSpace := X.toPresheafedSpace.restrict h }
-#align algebraic_geometry.Scheme.restrict AlgebraicGeometry.Scheme.restrict
-
-/-- 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) :=
-  show PresheafedSpace.IsOpenImmersion (X.toPresheafedSpace.of_restrict h) by infer_instance
-#align algebraic_geometry.is_open_immersion.of_restrict AlgebraicGeometry.IsOpenImmersion.ofRestrict
-
-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 :=
-  @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
-
-theorem to_iso {X Y : Scheme} (f : X ⟶ Y) [h : IsOpenImmersion 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
-
-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
-#align algebraic_geometry.is_open_immersion.of_stalk_iso AlgebraicGeometry.IsOpenImmersion.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
-
-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_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']
-  refine' and_congr ⟨_, _⟩ Iff.rfl
-  · rintro ⟨h₁, h₂⟩
-    convert_to
-      is_iso
-        (TopCat.isoOfHomeo
-            (Homeomorph.homeomorphOfContinuousOpen
-              (Equiv.ofBijective _ ⟨h₂.inj, (TopCat.epi_iff_surjective _).mp h₁⟩) h₂.continuous
-              h₂.is_open_map)).Hom
-    · ext; rfl
-    · 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
-
-include H
-
--- mathport name: exprforget
-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
-
-instance forget_map_isOpenImmersion : 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
-
-instance hasLimit_cospan_forget_of_left :
-    HasLimit (cospan f g ⋙ Scheme.forgetToLocallyRingedSpace) :=
-  by
-  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
-
-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'
-
-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
-
-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'
-
-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
-
-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
-
-instance forgetPreservesOfLeft : PreservesLimit (cospan f g) forget :=
-  CategoryTheory.preservesLimitOfCreatesLimitAndHasLimit _ _
-#align algebraic_geometry.is_open_immersion.forget_preserves_of_left AlgebraicGeometry.IsOpenImmersion.forgetPreservesOfLeft
-
-instance forgetPreservesOfRight : PreservesLimit (cospan g f) forget :=
-  preservesPullbackSymmetry _ _ _
-#align algebraic_geometry.is_open_immersion.forget_preserves_of_right AlgebraicGeometry.IsOpenImmersion.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
-
-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
-
-instance pullback_snd_of_left : IsOpenImmersion (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
-
-instance pullback_fst_of_right : IsOpenImmersion (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
-
-instance pullback_to_base [IsOpenImmersion g] :
-    IsOpenImmersion (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
-
-instance forgetToTopPreservesOfLeft : PreservesLimit (cospan f g) Scheme.forgetToTop :=
-  by
-  apply (config := { instances := false }) limits.comp_preserves_limit
-  infer_instance
-  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
-
-instance forgetToTopPreservesOfRight : PreservesLimit (cospan g f) Scheme.forgetToTop :=
-  preservesPullbackSymmetry _ _ _
-#align algebraic_geometry.is_open_immersion.forget_to_Top_preserves_of_right AlgebraicGeometry.IsOpenImmersion.forgetToTopPreservesOfRight
-
-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⟩ :=
-  by
-  rw [←
-    show _ = (pullback.snd : pullback f g ⟶ _).1.base from
-      preserves_pullback.iso_hom_snd Scheme.forget_to_Top f g,
-    coe_comp, Set.range_comp, set.range_iff_surjective.mpr, ←
-    @Set.preimage_univ _ _ (pullback.fst : pullback f.1.base g.1.base ⟶ _),
-    TopCat.pullback_snd_image_fst_preimage, Set.image_univ]
-  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
-
-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⟩ :=
-  by
-  rw [←
-    show _ = (pullback.fst : pullback g f ⟶ _).1.base from
-      preserves_pullback.iso_hom_fst Scheme.forget_to_Top g f,
-    coe_comp, Set.range_comp, set.range_iff_surjective.mpr, ←
-    @Set.preimage_univ _ _ (pullback.snd : pullback g.1.base f.1.base ⟶ _),
-    TopCat.pullback_fst_image_snd_preimage, Set.image_univ]
-  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
-
-theorem range_pullback_to_base_of_left :
-    Set.range (pullback.fst ≫ f : pullback f g ⟶ Z).1.base =
-      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.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
-
-theorem range_pullback_to_base_of_right :
-    Set.range (pullback.fst ≫ g : pullback g f ⟶ Z).1.base =
-      Set.range g.1.base ∩ Set.range f.1.base :=
-  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
-
-/-- The universal property of open immersions:
-For an open immersion `f : X ⟶ Z`, given any morphism of schemes `g : Y ⟶ Z` whose topological
-image is contained in the image of `f`, we can lift this morphism to a unique `Y ⟶ X` that
-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
-
-@[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
-
-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
-
-/-- 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)
-  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
-
-/-- 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.openFunctor
-#align algebraic_geometry.Scheme.hom.opens_functor AlgebraicGeometry.Scheme.Hom.opensFunctor
-
-/-- 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) :
-    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) :
-    (Opens.map f.1.base).obj V = (Opens.map fg.1.base).obj (g.opensFunctor.obj V) :=
-  by
-  subst H
-  rw [Scheme.comp_val_base, opens.map_comp_obj]
-  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
-
-/-- 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) :
-    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 :=
-  by
-  subst H
-  rw [Scheme.comp_val_c_app, category.assoc, Scheme.hom.inv_app,
-    PresheafedSpace.is_open_immersion.inv_app_app_assoc, f.val.c.naturality_assoc,
-    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
-
-theorem lift_app {X Y U : Scheme} (f : U ⟶ Y) (g : X ⟶ Y) [h : IsOpenImmersion f] (H)
-    (V : Opens U.carrier) :
-    (IsOpenImmersion.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
-
-end IsOpenImmersion
-
-namespace Scheme
-
-theorem image_basicOpen {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion 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)
-  rw [Scheme.hom.inv_app, PresheafedSpace.is_open_immersion.inv_app_app_apply,
-    Scheme.basic_open_res, inf_eq_right.mpr _] at e 
-  rw [← e]
-  ext1
-  refine' set.image_preimage_eq_inter_range.trans _
-  erw [Set.inter_eq_left_iff_subset]
-  refine' Set.Subset.trans (Scheme.basic_open_le _ _) (Set.image_subset_range _ _)
-  refine' le_trans (Scheme.basic_open_le _ _) (le_of_eq _)
-  ext1
-  exact (Set.preimage_image_eq _ H.base_open.inj).symm
-#align algebraic_geometry.Scheme.image_basic_open AlgebraicGeometry.Scheme.image_basicOpen
-
-/-- 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 :=
-  ⟨_, H.base_open.open_range⟩
-#align algebraic_geometry.Scheme.hom.opens_range AlgebraicGeometry.Scheme.Hom.opensRange
-
-end Scheme
-
-section
-
-variable (X : Scheme)
-
-/-- 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
-    where
-  obj U := Over.mk (X.of_restrict U.OpenEmbedding)
-  map U V i :=
-    Over.homMk
-      (IsOpenImmersion.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 _ _ _)
-  map_id' U := by
-    ext1
-    dsimp only [over.hom_mk_left, over.id_left]
-    rw [← cancel_mono (X.of_restrict U.open_embedding), category.id_comp,
-      is_open_immersion.lift_fac]
-  map_comp' U V W i j := by
-    ext1
-    dsimp only [over.hom_mk_left, over.comp_left]
-    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
-
-@[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 _ _ _
-#align algebraic_geometry.Scheme.restrict_functor_map_of_restrict AlgebraicGeometry.Scheme.restrictFunctor_map_ofRestrict
-
-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
-  ext a
-  exact
-    (congr_arg (fun f : X.restrict U.open_embedding ⟶ X => f.1.base a)
-        (X.restrict_functor_map_of_restrict i) :
-      _)
-#align algebraic_geometry.Scheme.restrict_functor_map_base AlgebraicGeometry.Scheme.restrictFunctor_map_base
-
-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 :=
-  by
-  simp only [← SetLike.coe_subset_coe, IsOpenMap.functor_obj_coe, Set.image_subset_iff,
-    Scheme.restrict_functor_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.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 :=
-  by
-  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₁ 
-  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₂ 
-  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₁ 
-  simp_rw [eq_to_hom_map (opens.map _), eq_to_hom_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 [-Subtype.val_eq_coe, -Scheme.restrict_functor_map_left]
-      rw [X.restrict_functor_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.carrier) :
-    X.restrict ((Opens.map f.1.base).obj U).OpenEmbedding ≅ Y.restrict U.OpenEmbedding :=
-  by
-  refine' is_open_immersion.iso_of_range_eq (X.of_restrict _ ≫ f) (Y.of_restrict _) _
-  dsimp [opens.inclusion]
-  rw [coe_comp, Set.range_comp]
-  dsimp
-  rw [Subtype.range_coe, 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]
-def Scheme.OpenCover.pullbackCover {X : Scheme} (𝒰 : X.OpenCover) {W : Scheme} (f : W ⟶ X) :
-    W.OpenCover where
-  J := 𝒰.J
-  obj x := pullback f (𝒰.map x)
-  map x := pullback.fst
-  f x := 𝒰.f (f.1.base x)
-  Covers x :=
-    by
-    rw [←
-      show _ = (pullback.fst : pullback f (𝒰.map (𝒰.f (f.1.base x))) ⟶ _).1.base from
-        preserves_pullback.iso_hom_fst Scheme.forget_to_Top f (𝒰.map (𝒰.f (f.1.base x)))]
-    rw [coe_comp, 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⟩
-    · rw [← TopCat.epi_iff_surjective]; infer_instance
-#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
-  rw [Set.eq_univ_iff_forall]
-  intro x
-  rw [Set.mem_iUnion]
-  exact ⟨𝒰.f x, 𝒰.covers x⟩
-#align algebraic_geometry.Scheme.open_cover.Union_range AlgebraicGeometry.Scheme.OpenCover.iUnion_range
-
-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
-
-theorem Scheme.OpenCover.compactSpace {X : Scheme} (𝒰 : X.OpenCover) [Finite 𝒰.J]
-    [H : ∀ i, CompactSpace (𝒰.obj i).carrier] : CompactSpace X.carrier :=
-  by
-  cases nonempty_fintype 𝒰.J
-  rw [← isCompact_univ_iff, ← 𝒰.Union_range]
-  apply isCompact_iUnion
-  intro i
-  rw [isCompact_iff_compactSpace]
-  exact
-    @Homeomorph.compactSpace _ _ (H i)
-      (TopCat.homeoOfIso
-        (as_iso
-          (is_open_immersion.iso_of_range_eq (𝒰.map i)
-                  (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
-
-/-- 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
-    where
-  J := 𝒰₁.J × 𝒰₂.J
-  obj ij := pullback (𝒰₁.map ij.1) (𝒰₂.map ij.2)
-  map ij := pullback.fst ≫ 𝒰₁.map ij.1
-  f x := ⟨𝒰₁.f x, 𝒰₂.f x⟩
-  Covers x := by
-    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
-
-/-- 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)
-    (hU : (⨆ i, U i) = ⊤) : X.OpenCover where
-  J := s
-  obj i := X.restrict (U i).OpenEmbedding
-  map i := X.of_restrict (U i).OpenEmbedding
-  f x :=
-    haveI : x ∈ ⨆ i, U i := hU.symm ▸ show x ∈ (⊤ : opens X.carrier) by triv
-    (opens.mem_supr.mp this).some
-  Covers x := by
-    erw [Subtype.range_coe]
-    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
-
-/-- 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) ≅
-      X.restrict ((Opens.map f.1.base).obj U).OpenEmbedding :=
-  by
-  refine' is_open_immersion.iso_of_range_eq pullback.fst (X.of_restrict _) _
-  rw [is_open_immersion.range_pullback_fst_of_right]
-  dsimp [opens.inclusion]
-  rw [Subtype.range_coe, 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.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
-
-@[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
-
-/-- 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
-
--- mathport name: «expr ∣_ »
-infixl:80 " ∣_ " => 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
-
-@[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 :=
-  by
-  delta morphism_restrict
-  rw [category.assoc, pullback.condition.symm, pullback_restrict_iso_restrict_inv_fst_assoc]
-#align algebraic_geometry.morphism_restrict_ι AlgebraicGeometry.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
-  delta morphism_restrict
-  nth_rw 1 [← category.id_comp f]
-  refine'
-    (is_pullback.of_horiz_is_iso ⟨_⟩).paste_horiz
-      (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
-
-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
-  delta morphism_restrict
-  rw [← pullback_right_pullback_fst_iso_inv_snd_snd]
-  simp_rw [← category.assoc]
-  congr 1
-  rw [← cancel_mono pullback.fst]
-  simp_rw [category.assoc]
-  rw [pullback_restrict_iso_restrict_inv_fst, pullback_right_pullback_fst_iso_inv_snd_fst, ←
-    pullback.condition, pullback_restrict_iso_restrict_inv_fst_assoc,
-    pullback_restrict_iso_restrict_inv_fst_assoc]
-  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
-
-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
-
-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
-
-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
-        ((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 _ ∈ _, rfl⟩
-    refine' ⟨⟨_, hx⟩, _, rfl⟩
-    convert hx'
-    ext1
-    exact (morphism_restrict_base_coe f U ⟨x, hx⟩).symm
-  · rintro ⟨⟨x, hx⟩, hx', rfl : x = _⟩
-    refine' ⟨⟨_, hx⟩, (_ : (f ∣_ U).1.base ⟨x, hx⟩ ∈ V.1), rfl⟩
-    convert hx'
-    ext1
-    exact morphism_restrict_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.carrier) (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 (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 
-  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 [this]
-  congr 1
-  erw [← X.presheaf.map_comp, ← X.presheaf.map_comp]
-  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.carrier) :
-    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, morphism_restrict_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 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 ∣_ g.opensRange) ≅ Arrow.mk (pullback.snd : pullback f g ⟶ _) :=
-  by
-  let V : opens Y.carrier := g.opens_range
-  let e :=
-    is_open_immersion.iso_of_range_eq g (Y.of_restrict V.open_embedding) subtype.range_coe.symm
-  let t : pullback f g ⟶ pullback f (Y.of_restrict V.open_embedding) :=
-    pullback.map _ _ _ _ (𝟙 _) e.hom (𝟙 _) (by rw [category.comp_id, category.id_comp])
-      (by rw [category.comp_id, is_open_immersion.iso_of_range_eq_hom, is_open_immersion.lift_fac])
-  symm
-  refine' arrow.iso_mk (as_iso t ≪≫ pullback_restrict_iso_restrict f V) e _
-  rw [iso.trans_hom, as_iso_hom, ← iso.comp_inv_eq, ← cancel_mono g, arrow.mk_hom, arrow.mk_hom,
-    is_open_immersion.iso_of_range_eq_inv, category.assoc, category.assoc, category.assoc,
-    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
-
-/-- 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
-
-/-- 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) :=
-  by
-  have :
-    (f ∣_ U ∣_ V) ≫ (iso.refl _).Hom =
-      (as_iso <|
-            (pullback_restrict_iso_restrict (f ∣_ U) V).inv ≫
-              (pullback_symmetry _ _).Hom ≫
-                pullback.map _ _ _ _ (𝟙 _)
-                    ((pullback_restrict_iso_restrict f U).inv ≫ (pullback_symmetry _ _).Hom) (𝟙 _)
-                    ((category.comp_id _).trans (category.id_comp _).symm) (by simpa) ≫
-                  (pullback_right_pullback_fst_iso _ _ _).Hom ≫ (pullback_symmetry _ _).Hom).Hom ≫
-        pullback.snd :=
-    by
-    simpa only [category.comp_id, pullback_right_pullback_fst_iso_hom_fst, iso.refl_hom,
-      category.assoc, pullback_symmetry_hom_comp_snd, as_iso_hom, pullback.lift_fst,
-      pullback_symmetry_hom_comp_fst]
-  refine'
-    arrow.iso_mk' _ _ _ _ this.symm ≪≫
-      (morphism_restrict_opens_range _ _).symm ≪≫ morphism_restrict_eq _ _
-  ext1
-  dsimp
-  rw [coe_comp, Set.range_comp]
-  congr
-  exact Subtype.range_coe
-#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.carrier)
-    (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' 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 
-  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]
-  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]
-  exact Y.basic_open_le r
-#align algebraic_geometry.morphism_restrict_restrict_basic_open AlgebraicGeometry.morphismRestrictRestrictBasicOpen
-
-/-- 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) :
-    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
-      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) :=
-  by
-  fapply arrow.iso_mk'
-  · refine' Y.restrict_stalk_iso U.open_embedding ((f ∣_ U).1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
-    apply Inseparable.of_eq
-    exact morphism_restrict_base_coe f U x
-  · exact X.restrict_stalk_iso _ _
-  · apply TopCat.Presheaf.stalk_hom_ext
-    intro V hxV
-    simp only [TopCat.Presheaf.stalkCongr_hom, CategoryTheory.Category.assoc,
-      CategoryTheory.Iso.trans_hom]
-    erw [PresheafedSpace.restrict_stalk_iso_hom_eq_germ_assoc]
-    erw [PresheafedSpace.stalk_map_germ_assoc _ _ ⟨_, _⟩]
-    rw [TopCat.Presheaf.germ_stalk_specializes'_assoc]
-    erw [PresheafedSpace.stalk_map_germ _ _ ⟨_, _⟩]
-    erw [PresheafedSpace.restrict_stalk_iso_hom_eq_germ]
-    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
-
-end MorphismRestrict
-
 end AlgebraicGeometry
 

Changes in mathlib4

mathlib3
mathlib4
chore(CategoryTheory): move Full, Faithful, EssSurj, IsEquivalence and ReflectsIsomorphisms to the Functor namespace (#11985)

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

Diff
@@ -821,7 +821,7 @@ end Pullback
 section OfStalkIso
 
 variable [HasLimits C] [HasColimits C] [ConcreteCategory C]
-variable [ReflectsIsomorphisms (CategoryTheory.forget C)]
+variable [(CategoryTheory.forget C).ReflectsIsomorphisms]
   [PreservesLimits (CategoryTheory.forget C)]
 
 variable [PreservesFilteredColimits (CategoryTheory.forget C)]
@@ -1122,11 +1122,12 @@ theorem pullback_snd_isIso_of_range_subset (H' : Set.range g.1.base ⊆ Set.rang
     IsIso (pullback.snd : pullback f g ⟶ _) := by
   -- Porting note: was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
-  have h1 := @ReflectsIsomorphisms.reflects (F := LocallyRingedSpace.forgetToSheafedSpace) _ _ _
+  have h1 := @Functor.ReflectsIsomorphisms.reflects
+    (F := LocallyRingedSpace.forgetToSheafedSpace) _ _ _
   refine @h1 _ _ _ ?_; clear h1
   -- Porting note: was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
-  have h2 := @ReflectsIsomorphisms.reflects
+  have h2 := @Functor.ReflectsIsomorphisms.reflects
     (F := SheafedSpace.forgetToPresheafedSpace (C := CommRingCat)) _ _ _
   refine @h2 _ _ _ ?_; clear h2
   erw [← PreservesPullback.iso_hom_snd
doc: fix many more mathlib3 names in doc comments (#11987)

A mix of various changes; generated with a script and manually tweaked.

Diff
@@ -251,7 +251,7 @@ theorem app_invApp (U : Opens Y) :
   by erw [← Category.assoc]; rw [IsIso.comp_inv_eq, f.c.naturality]; congr
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.app_inv_app AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.app_invApp
 
-/-- A variant of `app_inv_app` that gives an `eq_to_hom` instead of `hom_of_le`. -/
+/-- A variant of `app_inv_app` that gives an `eqToHom` instead of `homOfLe`. -/
 @[reassoc]
 theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
     f.c.app (op U) ≫ H.invApp ((Opens.map f.base).obj U) =
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
@@ -590,7 +590,6 @@ open CategoryTheory.Limits.WalkingCospan
 section ToSheafedSpace
 
 variable {X : PresheafedSpace C} (Y : SheafedSpace C)
-
 variable (f : X ⟶ Y.toPresheafedSpace) [H : IsOpenImmersion f]
 
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a SheafedSpace, then so is `X`. -/
@@ -638,7 +637,6 @@ end ToSheafedSpace
 section ToLocallyRingedSpace
 
 variable {X : PresheafedSpace CommRingCat} (Y : LocallyRingedSpace)
-
 variable (f : X ⟶ Y.toPresheafedSpace) [H : IsOpenImmersion f]
 
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a LocallyRingedSpace, then so is `X`. -/
@@ -707,7 +705,6 @@ instance comp {X Y Z : SheafedSpace C} (f : X ⟶ Y) (g : Y ⟶ Z) [SheafedSpace
 noncomputable section Pullback
 
 variable {X Y Z : SheafedSpace C} (f : X ⟶ Z) (g : Y ⟶ Z)
-
 variable [H : SheafedSpace.IsOpenImmersion f]
 
 -- Porting note: in mathlib3, this local notation is often followed by a space to avoid confusion
@@ -824,7 +821,6 @@ end Pullback
 section OfStalkIso
 
 variable [HasLimits C] [HasColimits C] [ConcreteCategory C]
-
 variable [ReflectsIsomorphisms (CategoryTheory.forget C)]
   [PreservesLimits (CategoryTheory.forget C)]
 
@@ -952,7 +948,6 @@ namespace LocallyRingedSpace.IsOpenImmersion
 noncomputable section Pullback
 
 variable {X Y Z : LocallyRingedSpace} (f : X ⟶ Z) (g : Y ⟶ Z)
-
 variable [H : LocallyRingedSpace.IsOpenImmersion f]
 
 instance (priority := 100) of_isIso [IsIso g] : LocallyRingedSpace.IsOpenImmersion g :=
chore: classify rw to erw porting notes (#11225)

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

change rw to erw

Diff
@@ -1173,7 +1173,7 @@ theorem lift_range (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
       (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forget _) f g
   rw [LocallyRingedSpace.comp_val, SheafedSpace.comp_base, ← this, ← Category.assoc, coe_comp]
   rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ]
-  -- Porting note: change `rw` to `erw` on this lemma
+  -- Porting note (#11224): change `rw` to `erw` on this lemma
   erw [TopCat.pullback_fst_range]
   ext
   constructor
chore: classify slow / slower porting notes (#11084)

Classifies by adding issue number #11083 to porting notes claiming anything semantically equivalent to:

  • "very slow; improve performance?"
  • "quite slow; improve performance?"
  • "`tactic" was slow"
  • "removed attribute because it caused extremely slow tactic"
  • "proof was rewritten, because it was too slow"
  • "doing this make things very slow"
  • "slower implementation"
Diff
@@ -919,7 +919,7 @@ instance sigma_ι_isOpenImmersion [HasStrictTerminalObjects C] :
     suffices IsIso <| (colimit.ι (F ⋙ SheafedSpace.forgetToPresheafedSpace) i ≫
         (preservesColimitIso SheafedSpace.forgetToPresheafedSpace F).inv).c.app <|
       op (H.isOpenMap.functor.obj U) by
-      -- Porting note: just `convert` is very slow, so helps it a bit
+      -- Porting note (#11083): just `convert` is very slow, so helps it a bit
       convert this using 2 <;> congr
     rw [PresheafedSpace.comp_c_app,
       ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π]
chore: prepare Lean version bump with explicit simp (#10999)

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

Diff
@@ -428,7 +428,7 @@ def pullbackConeOfLeftLift : s.pt ⟶ (pullbackConeOfLeft f g).pt where
                 have : _ = s.snd.base := limit.lift_π s' WalkingCospan.right
                 conv_lhs =>
                   erw [← this]
-                  dsimp
+                  dsimp [s']
                   -- Porting note: need a bit more hand holding here about function composition
                   rw [coe_comp, show ∀ f g, f ∘ g = fun x => f (g x) from fun _ _ => rfl]
                   erw [← Set.preimage_preimage]
chore: classify added instance porting notes (#10884)

Classifies by adding issue number (#10754) to porting notes claiming added instance.

Diff
@@ -1147,14 +1147,14 @@ image is contained in the image of `f`, we can lift this morphism to a unique `Y
 commutes with these maps.
 -/
 def lift (H' : Set.range g.1.base ⊆ Set.range f.1.base) : Y ⟶ X :=
-  -- Porting note: added instance manually
+  -- Porting note (#10754): added instance manually
   have := pullback_snd_isIso_of_range_subset f g H'
   inv (pullback.snd : pullback f g ⟶ _) ≫ pullback.fst
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.lift AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift
 
 @[simp, reassoc]
 theorem lift_fac (H' : Set.range g.1.base ⊆ Set.range f.1.base) : lift f g H' ≫ f = g := by
-  -- Porting note: added instance manually
+  -- Porting note (#10754): added instance manually
   haveI := pullback_snd_isIso_of_range_subset f g H'
   erw [Category.assoc]; rw [IsIso.inv_comp_eq]; exact pullback.condition
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.lift_fac AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_fac
@@ -1165,7 +1165,7 @@ theorem lift_uniq (H' : Set.range g.1.base ⊆ Set.range f.1.base) (l : Y ⟶ X)
 
 theorem lift_range (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
     Set.range (lift f g H').1.base = f.1.base ⁻¹' Set.range g.1.base := by
-  -- Porting note: added instance manually
+  -- Porting note (#10754): added instance manually
   have := pullback_snd_isIso_of_range_subset f g H'
   dsimp only [lift]
   have : _ = (pullback.fst : pullback f g ⟶ _).val.base :=
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
@@ -53,7 +53,7 @@ Abbreviations are also provided for `SheafedSpace`, `LocallyRingedSpace` and `Sc
 
 -/
 
--- Porting note : due to `PresheafedSpace`, `SheafedSpace` and `LocallyRingedSpace`
+-- Porting note: due to `PresheafedSpace`, `SheafedSpace` and `LocallyRingedSpace`
 set_option linter.uppercaseLean3 false
 
 open TopologicalSpace CategoryTheory Opposite
@@ -131,7 +131,7 @@ noncomputable def isoRestrict : X ≅ Y.restrict H.base_open :=
 
 @[simp]
 theorem isoRestrict_hom_ofRestrict : H.isoRestrict.hom ≫ Y.ofRestrict _ = f := by
-  -- Porting note : `ext` did not pick up `NatTrans.ext`
+  -- Porting note: `ext` did not pick up `NatTrans.ext`
   refine PresheafedSpace.Hom.ext _ _ rfl <| NatTrans.ext _ _ <| funext fun x => ?_
   · simp only [isoRestrict_hom_c_app, NatTrans.comp_app, eqToHom_refl,
       ofRestrict_c_app, Category.assoc, whiskerRight_id']
@@ -158,13 +158,13 @@ instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g
     generalize_proofs h
     dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
       TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
-    -- Porting note : was `apply (config := { instances := False }) ...`
+    -- Porting note: was `apply (config := { instances := False }) ...`
     -- See https://github.com/leanprover/lean4/issues/2273
     have : IsIso (g.c.app (op <| (h.functor).obj U)) := by
       have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
         ext1
         dsimp only [IsOpenMap.functor_obj_coe]
-        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
+        -- Porting note: slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
         rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
           ← Set.image_image]
       rw [this]
@@ -173,7 +173,7 @@ instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g
       have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
         ext1
         dsimp only [Opens.map_coe, IsOpenMap.functor_obj_coe, comp_base]
-        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
+        -- Porting note: slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
         rw [coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
           ← Set.image_image g.base f.base, Set.preimage_image_eq _ hg.base_open.inj]
       rw [this]
@@ -185,7 +185,7 @@ instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g
 noncomputable def invApp (U : Opens X) :
     X.presheaf.obj (op U) ⟶ Y.presheaf.obj (op (H.openFunctor.obj U)) :=
   X.presheaf.map (eqToHom (by
-    -- Porting note : was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
+    -- Porting note: was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
     -- See https://github.com/leanprover-community/mathlib4/issues/5026
     -- I think this is because `Set.preimage_image_eq _ H.base_open.inj` can't see through a
     -- structure
@@ -201,7 +201,7 @@ theorem inv_naturality {U V : (Opens X)ᵒᵖ} (i : U ⟶ V) :
       H.invApp (unop U) ≫ Y.presheaf.map (H.openFunctor.op.map i) := by
   simp only [invApp, ← Category.assoc]
   rw [IsIso.comp_inv_eq]
-  -- Porting note : `simp` can't pick up `f.c.naturality`
+  -- Porting note: `simp` can't pick up `f.c.naturality`
   -- See https://github.com/leanprover-community/mathlib4/issues/5026
   simp only [Category.assoc, ← X.presheaf.map_comp]
   erw [f.c.naturality]
@@ -216,7 +216,7 @@ theorem inv_invApp (U : Opens X) :
     inv (H.invApp U) =
       f.c.app (op (H.openFunctor.obj U)) ≫
         X.presheaf.map (eqToHom (by
-          -- Porting note : was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
+          -- Porting note: was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
           -- See https://github.com/leanprover-community/mathlib4/issues/5026
           -- I think this is because `Set.preimage_image_eq _ H.base_open.inj` can't see through a
           -- structure
@@ -232,7 +232,7 @@ theorem inv_invApp (U : Opens X) :
 theorem invApp_app (U : Opens X) :
     H.invApp U ≫ f.c.app (op (H.openFunctor.obj U)) =
       X.presheaf.map (eqToHom (by
-        -- Porting note : was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
+        -- Porting note: was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
         -- See https://github.com/leanprover-community/mathlib4/issues/5026
         -- I think this is because `Set.preimage_image_eq _ H.base_open.inj` can't see through a
         -- structure
@@ -269,7 +269,7 @@ theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
 /-- An isomorphism is an open immersion. -/
 instance ofIso {X Y : PresheafedSpace C} (H : X ≅ Y) : IsOpenImmersion H.hom where
   base_open := (TopCat.homeoOfIso ((forget C).mapIso H)).openEmbedding
-  -- Porting note : `inferInstance` will fail if Lean is not told that `H.hom.c` is iso
+  -- Porting note: `inferInstance` will fail if Lean is not told that `H.hom.c` is iso
   c_iso _ := letI : IsIso H.hom.c := c_isIso_of_iso H.hom; inferInstance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_iso AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIso
 
@@ -288,7 +288,7 @@ instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
       exact Set.preimage_image_eq _ hf.inj
     convert_to IsIso (Y.presheaf.map (𝟙 _))
     · congr
-    · -- Porting note : was `apply Subsingleton.helim; rw [this]`
+    · -- Porting note: was `apply Subsingleton.helim; rw [this]`
       -- See https://github.com/leanprover/lean4/issues/2273
       congr
       simp only [unop_op]
@@ -311,7 +311,7 @@ theorem ofRestrict_invApp {C : Type*} [Category C] (X : PresheafedSpace C) {Y :
 
 /-- An open immersion is an iso if the underlying continuous map is epi. -/
 theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f := by
-  -- Porting Note : was `apply (config := { instances := False }) ...`
+  -- Porting note: was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
   have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U) := by
     intro U
@@ -364,7 +364,7 @@ def pullbackConeOfLeftFst :
                   apply LE.le.antisymm
                   · rintro _ ⟨_, h₁, h₂⟩
                     use (TopCat.pullbackIsoProdSubtype _ _).inv ⟨⟨_, _⟩, h₂⟩
-                    -- Porting note : need a slight hand holding
+                    -- Porting note: need a slight hand holding
                     change _ ∈ _ ⁻¹' _ ∧ _
                     simpa using h₁
                   · rintro _ ⟨x, h₁, rfl⟩
@@ -374,7 +374,7 @@ def pullbackConeOfLeftFst :
         induction U using Opposite.rec'
         induction V using Opposite.rec'
         simp only [Quiver.Hom.unop_op, Category.assoc, Functor.op_map, inv_naturality_assoc]
-        -- Porting note : the following lemmas are not picked up by `simp`
+        -- Porting note: the following lemmas are not picked up by `simp`
         -- See https://github.com/leanprover-community/mathlib4/issues/5026
         erw [g.c.naturality_assoc, TopCat.Presheaf.pushforwardObj_map, ← Y.presheaf.map_comp,
           ← Y.presheaf.map_comp]
@@ -382,11 +382,11 @@ def pullbackConeOfLeftFst :
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left_fst AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftFst
 
 theorem pullback_cone_of_left_condition : pullbackConeOfLeftFst f g ≫ f = Y.ofRestrict _ ≫ g := by
-  -- Porting note : `ext` did not pick up `NatTrans.ext`
+  -- Porting note: `ext` did not pick up `NatTrans.ext`
   refine PresheafedSpace.Hom.ext _ _ ?_ <| NatTrans.ext _ _ <| funext fun U => ?_
   · simpa using pullback.condition
   · induction U using Opposite.rec'
-    -- Porting note : `NatTrans.comp_app` is not picked up by `dsimp`
+    -- Porting note: `NatTrans.comp_app` is not picked up by `dsimp`
     -- Perhaps see : https://github.com/leanprover-community/mathlib4/issues/5026
     rw [NatTrans.comp_app]
     dsimp only [comp_c_app, unop_op, whiskerRight_app, pullbackConeOfLeftFst]
@@ -422,14 +422,14 @@ def pullbackConeOfLeftLift : s.pt ⟶ (pullbackConeOfLeft f g).pt where
                 dsimp only [Opens.map, IsOpenMap.functor, Functor.op]
                 congr 2
                 let s' : PullbackCone f.base g.base := PullbackCone.mk s.fst.base s.snd.base
-                  -- Porting note : in mathlib3, this is just an underscore
+                  -- Porting note: in mathlib3, this is just an underscore
                   (congr_arg Hom.base s.condition)
 
                 have : _ = s.snd.base := limit.lift_π s' WalkingCospan.right
                 conv_lhs =>
                   erw [← this]
                   dsimp
-                  -- Porting note : need a bit more hand holding here about function composition
+                  -- Porting note: need a bit more hand holding here about function composition
                   rw [coe_comp, show ∀ f g, f ∘ g = fun x => f (g x) from fun _ _ => rfl]
                   erw [← Set.preimage_preimage]
                 erw [Set.preimage_image_eq _
@@ -445,7 +445,7 @@ def pullbackConeOfLeftLift : s.pt ⟶ (pullbackConeOfLeft f g).pt where
 -- this lemma is not a `simp` lemma, because it is an implementation detail
 theorem pullbackConeOfLeftLift_fst :
     pullbackConeOfLeftLift f g s ≫ (pullbackConeOfLeft f g).fst = s.fst := by
-  -- Porting note : `ext` did not pick up `NatTrans.ext`
+  -- Porting note: `ext` did not pick up `NatTrans.ext`
   refine PresheafedSpace.Hom.ext _ _ ?_ <| NatTrans.ext _ _ <| funext fun x => ?_
   · change pullback.lift _ _ _ ≫ pullback.fst = _
     simp
@@ -465,7 +465,7 @@ theorem pullbackConeOfLeftLift_fst :
 -- this lemma is not a `simp` lemma, because it is an implementation detail
 theorem pullbackConeOfLeftLift_snd :
     pullbackConeOfLeftLift f g s ≫ (pullbackConeOfLeft f g).snd = s.snd := by
-  -- Porting note : `ext` did not pick up `NatTrans.ext`
+  -- Porting note: `ext` did not pick up `NatTrans.ext`
   refine PresheafedSpace.Hom.ext _ _ ?_ <| NatTrans.ext _ _ <| funext fun x => ?_
   · change pullback.lift _ _ _ ≫ pullback.snd = _
     simp
@@ -565,7 +565,7 @@ def lift (H : Set.range g.base ⊆ Set.range f.base) : Y ⟶ X :=
 
 @[simp, reassoc]
 theorem lift_fac (H : Set.range g.base ⊆ Set.range f.base) : lift f g H ≫ f = g := by
-  -- Porting note : this instance was automatic
+  -- Porting note: this instance was automatic
   letI := pullback_snd_isIso_of_range_subset _ _ H
   erw [Category.assoc]; rw [IsIso.inv_comp_eq]; exact pullback.condition
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.lift_fac AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift_fac
@@ -710,7 +710,7 @@ variable {X Y Z : SheafedSpace C} (f : X ⟶ Z) (g : Y ⟶ Z)
 
 variable [H : SheafedSpace.IsOpenImmersion f]
 
--- Porting note : in mathlib3, this local notation is often followed by a space to avoid confusion
+-- Porting note: in mathlib3, this local notation is often followed by a space to avoid confusion
 -- with the forgetful functor, now it is often wrapped in a parenthesis
 local notation "forget" => SheafedSpace.forgetToPresheafedSpace
 
@@ -839,7 +839,7 @@ theorem of_stalk_iso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.
     [H : ∀ x : X.1, IsIso (PresheafedSpace.stalkMap f x)] : SheafedSpace.IsOpenImmersion f :=
   { base_open := hf
     c_iso := fun U => by
-      -- Porting note : was `apply (config := { instances := False }) ...`
+      -- Porting note: was `apply (config := { instances := False }) ...`
       -- See https://github.com/leanprover/lean4/issues/2273
       have h := TopCat.Presheaf.app_isIso_of_stalkFunctor_map_iso
           (show Y.sheaf ⟶ (TopCat.Sheaf.pushforward _ f.base).obj X.sheaf from ⟨f.c⟩)
@@ -857,7 +857,7 @@ end OfStalkIso
 
 section Prod
 
--- Porting note : here `ι` should have same universe level as morphism of `C`, so needs explicit
+-- Porting note: here `ι` should have same universe level as morphism of `C`, so needs explicit
 -- universe level now
 variable [HasLimits C] {ι : Type v} (F : Discrete ι ⥤ SheafedSpace.{_, v, v} C) [HasColimit F]
   (i : Discrete ι)
@@ -873,7 +873,7 @@ theorem sigma_ι_openEmbedding : OpenEmbedding (colimit.ι F i).base := by
   rw [← Iso.eq_comp_inv] at this
   cases i
   rw [this, ← Category.assoc]
-  -- Porting note : `simp_rw` can't use `TopCat.openEmbedding_iff_comp_isIso` and
+  -- Porting note: `simp_rw` can't use `TopCat.openEmbedding_iff_comp_isIso` and
   -- `TopCat.openEmbedding_iff_isIso_comp`.
   -- See https://github.com/leanprover-community/mathlib4/issues/5026
   erw [TopCat.openEmbedding_iff_comp_isIso, TopCat.openEmbedding_iff_comp_isIso,
@@ -893,7 +893,7 @@ theorem image_preimage_is_empty (j : Discrete ι) (h : i ≠ j) (U : Opens (F.ob
     HasColimit.isoOfNatIso Discrete.natIsoFunctor ≪≫ TopCat.sigmaIsoSigma.{v, v} _).hom eq
   simp_rw [CategoryTheory.Iso.trans_hom, ← TopCat.comp_app, ← PresheafedSpace.comp_base] at eq
   rw [ι_preservesColimitsIso_inv] at eq
-  -- Porting note : without this `erw`, change does not work
+  -- Porting note: without this `erw`, change does not work
   erw [← comp_apply, ← comp_apply] at eq
   change
     ((SheafedSpace.forget C).map (colimit.ι F i) ≫ _) y =
@@ -919,11 +919,11 @@ instance sigma_ι_isOpenImmersion [HasStrictTerminalObjects C] :
     suffices IsIso <| (colimit.ι (F ⋙ SheafedSpace.forgetToPresheafedSpace) i ≫
         (preservesColimitIso SheafedSpace.forgetToPresheafedSpace F).inv).c.app <|
       op (H.isOpenMap.functor.obj U) by
-      -- Porting note : just `convert` is very slow, so helps it a bit
+      -- Porting note: just `convert` is very slow, so helps it a bit
       convert this using 2 <;> congr
     rw [PresheafedSpace.comp_c_app,
       ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π]
-    -- Porting note : this instance created manually to make the `inferInstance` below work
+    -- Porting note: this instance created manually to make the `inferInstance` below work
     have inst1 : IsIso (preservesColimitIso forgetToPresheafedSpace F).inv.c :=
       PresheafedSpace.c_isIso_of_iso _
     rsuffices : IsIso
@@ -1076,7 +1076,7 @@ instance forgetToTopPreservesPullbackOfLeft :
   change PreservesLimit _ <|
     (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) ⋙
     PresheafedSpace.forget _
-  -- Porting note : was `apply (config := { instances := False }) ...`
+  -- Porting note: was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
   have : PreservesLimit
       (cospan ((cospan f g ⋙ forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace).map
@@ -1125,18 +1125,18 @@ instance forgetToPresheafedSpaceReflectsPullbackOfRight :
 
 theorem pullback_snd_isIso_of_range_subset (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
     IsIso (pullback.snd : pullback f g ⟶ _) := by
-  -- Porting note : was `apply (config := { instances := False }) ...`
+  -- Porting note: was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
   have h1 := @ReflectsIsomorphisms.reflects (F := LocallyRingedSpace.forgetToSheafedSpace) _ _ _
   refine @h1 _ _ _ ?_; clear h1
-  -- Porting note : was `apply (config := { instances := False }) ...`
+  -- Porting note: was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
   have h2 := @ReflectsIsomorphisms.reflects
     (F := SheafedSpace.forgetToPresheafedSpace (C := CommRingCat)) _ _ _
   refine @h2 _ _ _ ?_; clear h2
   erw [← PreservesPullback.iso_hom_snd
       (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) f g]
-  -- Porting note : was `inferInstance`
+  -- Porting note: was `inferInstance`
   exact @IsIso.comp_isIso _ _ _ _ _ _ _ _ <|
     PresheafedSpace.IsOpenImmersion.pullback_snd_isIso_of_range_subset _ _ H'
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.pullback_snd_is_iso_of_range_subset AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_snd_isIso_of_range_subset
@@ -1147,14 +1147,14 @@ image is contained in the image of `f`, we can lift this morphism to a unique `Y
 commutes with these maps.
 -/
 def lift (H' : Set.range g.1.base ⊆ Set.range f.1.base) : Y ⟶ X :=
-  -- Porting note : added instance manually
+  -- Porting note: added instance manually
   have := pullback_snd_isIso_of_range_subset f g H'
   inv (pullback.snd : pullback f g ⟶ _) ≫ pullback.fst
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.lift AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift
 
 @[simp, reassoc]
 theorem lift_fac (H' : Set.range g.1.base ⊆ Set.range f.1.base) : lift f g H' ≫ f = g := by
-  -- Porting note : added instance manually
+  -- Porting note: added instance manually
   haveI := pullback_snd_isIso_of_range_subset f g H'
   erw [Category.assoc]; rw [IsIso.inv_comp_eq]; exact pullback.condition
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.lift_fac AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_fac
@@ -1165,7 +1165,7 @@ theorem lift_uniq (H' : Set.range g.1.base ⊆ Set.range f.1.base) (l : Y ⟶ X)
 
 theorem lift_range (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
     Set.range (lift f g H').1.base = f.1.base ⁻¹' Set.range g.1.base := by
-  -- Porting note : added instance manually
+  -- Porting note: added instance manually
   have := pullback_snd_isIso_of_range_subset f g H'
   dsimp only [lift]
   have : _ = (pullback.fst : pullback f g ⟶ _).val.base :=
@@ -1173,7 +1173,7 @@ theorem lift_range (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
       (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forget _) f g
   rw [LocallyRingedSpace.comp_val, SheafedSpace.comp_base, ← this, ← Category.assoc, coe_comp]
   rw [Set.range_comp, Set.range_iff_surjective.mpr, Set.image_univ]
-  -- Porting note : change `rw` to `erw` on this lemma
+  -- Porting note: change `rw` to `erw` on this lemma
   erw [TopCat.pullback_fst_range]
   ext
   constructor
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

No changes to tactic file, it's just boring fixes throughout the library.

This follows on from #6964.

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -160,8 +160,8 @@ instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g
       TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
     -- Porting note : was `apply (config := { instances := False }) ...`
     -- See https://github.com/leanprover/lean4/issues/2273
-    have : IsIso (g.c.app (op <| (h.functor).obj U))
-    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
+    have : IsIso (g.c.app (op <| (h.functor).obj U)) := by
+      have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
         ext1
         dsimp only [IsOpenMap.functor_obj_coe]
         -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
@@ -169,8 +169,8 @@ instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g
           ← Set.image_image]
       rw [this]
       infer_instance
-    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
-    · have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
+    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U))) := by
+      have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
         ext1
         dsimp only [Opens.map_coe, IsOpenMap.functor_obj_coe, comp_base]
         -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
@@ -313,8 +313,8 @@ theorem ofRestrict_invApp {C : Type*} [Category C] (X : PresheafedSpace C) {Y :
 theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f := by
   -- Porting Note : was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
-  have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U)
-  · intro U
+  have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U) := by
+    intro U
     have : U = op (h.openFunctor.obj ((Opens.map f.base).obj (unop U))) := by
       induction U using Opposite.rec' with | h U => ?_
       cases U
@@ -322,8 +322,8 @@ theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f
       congr
       exact (Set.image_preimage_eq _ ((TopCat.epi_iff_surjective _).mp h')).symm
     convert @IsOpenImmersion.c_iso _ _ _ _ _ h ((Opens.map f.base).obj (unop U))
-  have : IsIso f.base
-  · let t : X ≃ₜ Y :=
+  have : IsIso f.base := by
+    let t : X ≃ₜ Y :=
       (Homeomorph.ofEmbedding _ h.base_open.toEmbedding).trans
         { toFun := Subtype.val
           invFun := fun x =>
@@ -724,8 +724,9 @@ instance forgetMapIsOpenImmersion : PresheafedSpace.IsOpenImmersion ((forget).ma
 #align algebraic_geometry.SheafedSpace.is_open_immersion.forget_map_is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetMapIsOpenImmersion
 
 instance hasLimit_cospan_forget_of_left : HasLimit (cospan f g ⋙ forget) := by
-  have : HasLimit (cospan ((cospan f g ⋙ forget).map Hom.inl) ((cospan f g ⋙ forget).map Hom.inr))
-  · change HasLimit (cospan ((forget).map f) ((forget).map g))
+  have : HasLimit (cospan ((cospan f g ⋙ forget).map Hom.inl)
+      ((cospan f g ⋙ forget).map Hom.inr)) := by
+    change HasLimit (cospan ((forget).map f) ((forget).map g))
     infer_instance
   apply hasLimitOfIso (diagramIsoCospan _).symm
 #align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left
@@ -736,8 +737,9 @@ instance hasLimit_cospan_forget_of_left' :
 #align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left' AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left'
 
 instance hasLimit_cospan_forget_of_right : HasLimit (cospan g f ⋙ forget) := by
-  have : HasLimit (cospan ((cospan g f ⋙ forget).map Hom.inl) ((cospan g f ⋙ forget).map Hom.inr))
-  · change HasLimit (cospan ((forget).map g) ((forget).map f))
+  have : HasLimit (cospan ((cospan g f ⋙ forget).map Hom.inl)
+      ((cospan g f ⋙ forget).map Hom.inr)) := by
+    change HasLimit (cospan ((forget).map g) ((forget).map f))
     infer_instance
   apply hasLimitOfIso (diagramIsoCospan _).symm
 #align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right
@@ -768,8 +770,8 @@ instance sheafedSpaceForgetPreservesOfLeft : PreservesLimit (cospan f g) (Sheafe
     inferInstance <| by
       have : PreservesLimit
         (cospan ((cospan f g ⋙ forget).map Hom.inl)
-          ((cospan f g ⋙ forget).map Hom.inr)) (PresheafedSpace.forget C)
-      · dsimp
+          ((cospan f g ⋙ forget).map Hom.inr)) (PresheafedSpace.forget C) := by
+        dsimp
         infer_instance
       apply preservesLimitOfIsoDiagram _ (diagramIsoCospan _).symm
 #align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft
@@ -1080,11 +1082,11 @@ instance forgetToTopPreservesPullbackOfLeft :
       (cospan ((cospan f g ⋙ forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace).map
         WalkingCospan.Hom.inl)
       ((cospan f g ⋙ forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace).map
-        WalkingCospan.Hom.inr)) (PresheafedSpace.forget CommRingCat)
-  · dsimp; infer_instance
+        WalkingCospan.Hom.inr)) (PresheafedSpace.forget CommRingCat) := by
+    dsimp; infer_instance
   have : PreservesLimit (cospan f g ⋙ forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace)
-    (PresheafedSpace.forget CommRingCat)
-  · apply preservesLimitOfIsoDiagram _ (diagramIsoCospan _).symm
+      (PresheafedSpace.forget CommRingCat) := by
+    apply preservesLimitOfIsoDiagram _ (diagramIsoCospan _).symm
   apply Limits.compPreservesLimit
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_Top_preserves_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToTopPreservesPullbackOfLeft
 
chore: space after (#8178)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -892,7 +892,7 @@ theorem image_preimage_is_empty (j : Discrete ι) (h : i ≠ j) (U : Opens (F.ob
   simp_rw [CategoryTheory.Iso.trans_hom, ← TopCat.comp_app, ← PresheafedSpace.comp_base] at eq
   rw [ι_preservesColimitsIso_inv] at eq
   -- Porting note : without this `erw`, change does not work
-  erw [←comp_apply, ←comp_apply] at eq
+  erw [← comp_apply, ← comp_apply] at eq
   change
     ((SheafedSpace.forget C).map (colimit.ι F i) ≫ _) y =
       ((SheafedSpace.forget C).map (colimit.ι F j) ≫ _) x at eq
feat(Topology/Sheaves/Functors): Specialize pullback-pushforward adjunction to sheaves over topological spaces. (#7722)

Port of https://github.com/leanprover-community/mathlib/pull/17561

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

Diff
@@ -840,7 +840,7 @@ theorem of_stalk_iso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.
       -- Porting note : was `apply (config := { instances := False }) ...`
       -- See https://github.com/leanprover/lean4/issues/2273
       have h := TopCat.Presheaf.app_isIso_of_stalkFunctor_map_iso
-          (show Y.sheaf ⟶ (TopCat.Sheaf.pushforward f.base).obj X.sheaf from ⟨f.c⟩)
+          (show Y.sheaf ⟶ (TopCat.Sheaf.pushforward _ f.base).obj X.sheaf from ⟨f.c⟩)
       refine @h _ ?_
       rintro ⟨_, y, hy, rfl⟩
       specialize H y
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
@@ -685,7 +685,7 @@ theorem isIso_of_subset {X Y : PresheafedSpace C} (f : X ⟶ Y)
     (hU : (U : Set Y.carrier) ⊆ Set.range f.base) : IsIso (f.c.app <| op U) := by
   have : U = H.base_open.isOpenMap.functor.obj ((Opens.map f.base).obj U) := by
     ext1
-    exact (Set.inter_eq_left_iff_subset.mpr hU).symm.trans Set.image_preimage_eq_inter_range.symm
+    exact (Set.inter_eq_left.mpr hU).symm.trans Set.image_preimage_eq_inter_range.symm
   convert H.c_iso ((Opens.map f.base).obj U)
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.is_iso_of_subset AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isIso_of_subset
 
chore: move (locally) ringed spaces out of AlgebraicGeometry (#7330)

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

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

See Zulip.

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
 import Mathlib.Topology.Category.TopCat.Limits.Pullbacks
-import Mathlib.AlgebraicGeometry.LocallyRingedSpace
+import Mathlib.Geometry.RingedSpace.LocallyRingedSpace
 
 #align_import algebraic_geometry.open_immersion.basic from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1"
 
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
@@ -64,7 +64,7 @@ namespace AlgebraicGeometry
 
 universe v v₁ v₂ u
 
-variable {C : Type _} [Category C]
+variable {C : Type*} [Category C]
 
 /-- An open immersion of PresheafedSpaces is an open embedding `f : X ⟶ U ⊆ Y` of the underlying
 spaces, such that the sheaf map `Y(V) ⟶ f _* X(V)` is an iso for each `V ⊆ U`.
@@ -300,7 +300,7 @@ instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict
 
 @[elementwise, simp]
-theorem ofRestrict_invApp {C : Type _} [Category C] (X : PresheafedSpace C) {Y : TopCat}
+theorem ofRestrict_invApp {C : Type*} [Category C] (X : PresheafedSpace C) {Y : TopCat}
     {f : Y ⟶ TopCat.of X.carrier} (h : OpenEmbedding f) (U : Opens (X.restrict h).carrier) :
     (PresheafedSpace.IsOpenImmersion.ofRestrict X h).invApp U = 𝟙 _ := by
   delta invApp
chore: use · instead of . (#6085)
Diff
@@ -220,7 +220,7 @@ theorem inv_invApp (U : Opens X) :
           -- See https://github.com/leanprover-community/mathlib4/issues/5026
           -- I think this is because `Set.preimage_image_eq _ H.base_open.inj` can't see through a
           -- structure
-          apply congr_arg (op .); ext
+          apply congr_arg (op ·); ext
           dsimp [openFunctor, IsOpenMap.functor]
           rw [Set.preimage_image_eq _ H.base_open.inj])) := by
   rw [← cancel_epi (H.invApp U), IsIso.hom_inv_id]
@@ -236,7 +236,7 @@ theorem invApp_app (U : Opens X) :
         -- See https://github.com/leanprover-community/mathlib4/issues/5026
         -- I think this is because `Set.preimage_image_eq _ H.base_open.inj` can't see through a
         -- structure
-        apply congr_arg (op .); ext
+        apply congr_arg (op ·); ext
         dsimp [openFunctor, IsOpenMap.functor]
         rw [Set.preimage_image_eq _ H.base_open.inj])) :=
   by rw [invApp, Category.assoc, IsIso.inv_hom_id, Category.comp_id]
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,15 +2,12 @@
 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.basic
-! 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.Topology.Category.TopCat.Limits.Pullbacks
 import Mathlib.AlgebraicGeometry.LocallyRingedSpace
 
+#align_import algebraic_geometry.open_immersion.basic from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1"
+
 /-!
 # Open immersions of structured spaces
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

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

Diff
@@ -324,7 +324,7 @@ theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f
       dsimp only [Functor.op, Opens.map]
       congr
       exact (Set.image_preimage_eq _ ((TopCat.epi_iff_surjective _).mp h')).symm
-    convert @IsOpenImmersion.c_iso _ _ _ _  _ h ((Opens.map f.base).obj (unop U))
+    convert @IsOpenImmersion.c_iso _ _ _ _ _ h ((Opens.map f.base).obj (unop U))
   have : IsIso f.base
   · let t : X ≃ₜ Y :=
       (Homeomorph.ofEmbedding _ h.base_open.toEmbedding).trans
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
@@ -117,7 +117,7 @@ noncomputable def isoRestrict : X ≅ Y.restrict H.base_open :=
   PresheafedSpace.isoOfComponents (Iso.refl _) <| by
     symm
     fapply NatIso.ofComponents
-    . intro U
+    · intro U
       refine' asIso (f.c.app (op (H.openFunctor.obj (unop U)))) ≪≫ X.presheaf.mapIso (eqToIso _)
       · induction U using Opposite.rec' with | h U => ?_
         cases U
@@ -299,7 +299,7 @@ instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
       apply Subsingleton.helim
       rw [this]
       rfl
-    . infer_instance
+    · infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict
 
 @[elementwise, simp]
@@ -317,7 +317,7 @@ theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f
   -- Porting Note : was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
   have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U)
-  . intro U
+  · intro U
     have : U = op (h.openFunctor.obj ((Opens.map f.base).obj (unop U))) := by
       induction U using Opposite.rec' with | h U => ?_
       cases U
@@ -531,7 +531,7 @@ instance forgetPreservesLimitsOfLeft : PreservesLimit (cospan f g) (forget C) :=
       apply (IsLimit.postcomposeHomEquiv (diagramIsoCospan _) _).toFun
       refine' (IsLimit.equivIsoLimit _).toFun (limit.isLimit (cospan f.base g.base))
       fapply Cones.ext
-      . exact Iso.refl _
+      · exact Iso.refl _
       change ∀ j, _ = 𝟙 _ ≫ _ ≫ _
       simp_rw [Category.id_comp]
       rintro (_ | _ | _) <;> symm
@@ -728,7 +728,7 @@ instance forgetMapIsOpenImmersion : PresheafedSpace.IsOpenImmersion ((forget).ma
 
 instance hasLimit_cospan_forget_of_left : HasLimit (cospan f g ⋙ forget) := by
   have : HasLimit (cospan ((cospan f g ⋙ forget).map Hom.inl) ((cospan f g ⋙ forget).map Hom.inr))
-  . change HasLimit (cospan ((forget).map f) ((forget).map g))
+  · change HasLimit (cospan ((forget).map f) ((forget).map g))
     infer_instance
   apply hasLimitOfIso (diagramIsoCospan _).symm
 #align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left
@@ -740,7 +740,7 @@ instance hasLimit_cospan_forget_of_left' :
 
 instance hasLimit_cospan_forget_of_right : HasLimit (cospan g f ⋙ forget) := by
   have : HasLimit (cospan ((cospan g f ⋙ forget).map Hom.inl) ((cospan g f ⋙ forget).map Hom.inr))
-  . change HasLimit (cospan ((forget).map g) ((forget).map f))
+  · change HasLimit (cospan ((forget).map g) ((forget).map f))
     infer_instance
   apply hasLimitOfIso (diagramIsoCospan _).symm
 #align algebraic_geometry.SheafedSpace.is_open_immersion.has_limit_cospan_forget_of_right AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right
@@ -772,7 +772,7 @@ instance sheafedSpaceForgetPreservesOfLeft : PreservesLimit (cospan f g) (Sheafe
       have : PreservesLimit
         (cospan ((cospan f g ⋙ forget).map Hom.inl)
           ((cospan f g ⋙ forget).map Hom.inr)) (PresheafedSpace.forget C)
-      . dsimp
+      · dsimp
         infer_instance
       apply preservesLimitOfIsoDiagram _ (diagramIsoCospan _).symm
 #align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft
@@ -1013,7 +1013,7 @@ def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) :=
       rw [PresheafedSpace.stalkMap.comp, ← IsIso.eq_inv_comp] at this
       rw [this]
       infer_instance
-    . intro m _ h₂
+    · intro m _ h₂
       rw [← cancel_mono (pullbackConeOfLeft f g).snd]
       exact h₂.trans <| LocallyRingedSpace.Hom.ext _ _
         (PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift_snd f.1 g.1 <|
@@ -1084,10 +1084,10 @@ instance forgetToTopPreservesPullbackOfLeft :
         WalkingCospan.Hom.inl)
       ((cospan f g ⋙ forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace).map
         WalkingCospan.Hom.inr)) (PresheafedSpace.forget CommRingCat)
-  . dsimp; infer_instance
+  · dsimp; infer_instance
   have : PreservesLimit (cospan f g ⋙ forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace)
     (PresheafedSpace.forget CommRingCat)
-  . apply preservesLimitOfIsoDiagram _ (diagramIsoCospan _).symm
+  · apply preservesLimitOfIsoDiagram _ (diagramIsoCospan _).symm
   apply Limits.compPreservesLimit
 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion.forget_to_Top_preserves_pullback_of_left AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToTopPreservesPullbackOfLeft
 
chore: tidy various files (#5458)
Diff
@@ -24,7 +24,7 @@ Abbreviations are also provided for `SheafedSpace`, `LocallyRingedSpace` and `Sc
 
 * `AlgebraicGeometry.PresheafedSpace.IsOpenImmersion`: the `Prop`-valued typeclass asserting
   that a PresheafedSpace hom `f` is an open_immersion.
-* `algebraic_geometry.is_open_immersion`: the `Prop`-valued typeclass asserting
+* `AlgebraicGeometry.IsOpenImmersion`: the `Prop`-valued typeclass asserting
   that a Scheme morphism `f` is an open_immersion.
 * `AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict`: The source of an
   open immersion is isomorphic to the restriction of the target onto the image.
@@ -98,13 +98,13 @@ namespace PresheafedSpace.IsOpenImmersion
 
 open PresheafedSpace
 
-local notation "is_open_immersion" => PresheafedSpace.IsOpenImmersion
+local notation "IsOpenImmersion" => PresheafedSpace.IsOpenImmersion
 
 attribute [instance] IsOpenImmersion.c_iso
 
 section
 
-variable {X Y : PresheafedSpace C} {f : X ⟶ Y} (H : is_open_immersion f)
+variable {X Y : PresheafedSpace C} {f : X ⟶ Y} (H : IsOpenImmersion f)
 
 /-- The functor `opens X ⥤ opens Y` associated with an open immersion `f : X ⟶ Y`. -/
 abbrev openFunctor :=
@@ -149,13 +149,13 @@ theorem isoRestrict_inv_ofRestrict : H.isoRestrict.inv ≫ f = Y.ofRestrict _ :=
   rw [Iso.inv_comp_eq, isoRestrict_hom_ofRestrict]
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.iso_restrict_inv_of_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict_inv_ofRestrict
 
-instance mono [H : is_open_immersion f] : Mono f := by
+instance mono [H : IsOpenImmersion f] : Mono f := by
   rw [← H.isoRestrict_hom_ofRestrict]; apply mono_comp
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.mono AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.mono
 
 /-- The composition of two open immersions is an open immersion. -/
-instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : is_open_immersion f] (g : Y ⟶ Z)
-    [hg : is_open_immersion g] : is_open_immersion (f ≫ g) where
+instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
+    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
   base_open := hg.base_open.comp hf.base_open
   c_iso U := by
     generalize_proofs h
@@ -270,19 +270,19 @@ theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.app_inv_app' AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.app_inv_app'
 
 /-- An isomorphism is an open immersion. -/
-instance ofIso {X Y : PresheafedSpace C} (H : X ≅ Y) : is_open_immersion H.hom where
+instance ofIso {X Y : PresheafedSpace C} (H : X ≅ Y) : IsOpenImmersion H.hom where
   base_open := (TopCat.homeoOfIso ((forget C).mapIso H)).openEmbedding
   -- Porting note : `inferInstance` will fail if Lean is not told that `H.hom.c` is iso
   c_iso _ := letI : IsIso H.hom.c := c_isIso_of_iso H.hom; inferInstance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_iso AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIso
 
 instance (priority := 100) ofIsIso {X Y : PresheafedSpace C} (f : X ⟶ Y) [IsIso f] :
-    is_open_immersion f :=
+    IsOpenImmersion f :=
   AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIso (asIso f)
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_is_iso AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIsIso
 
 instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
-    (hf : OpenEmbedding f) : is_open_immersion (Y.ofRestrict hf) where
+    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
   base_open := hf
   c_iso U := by
     dsimp
@@ -313,7 +313,7 @@ theorem ofRestrict_invApp {C : Type _} [Category C] (X : PresheafedSpace C) {Y :
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.of_restrict_inv_app AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict_invApp
 
 /-- An open immersion is an iso if the underlying continuous map is epi. -/
-theorem to_iso (f : X ⟶ Y) [h : is_open_immersion f] [h' : Epi f.base] : IsIso f := by
+theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f := by
   -- Porting Note : was `apply (config := { instances := False }) ...`
   -- See https://github.com/leanprover/lean4/issues/2273
   have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U)
@@ -338,7 +338,7 @@ theorem to_iso (f : X ⟶ Y) [h : is_open_immersion f] [h' : Epi f.base] : IsIso
   apply isIso_of_components
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_iso AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.to_iso
 
-instance stalk_iso [HasColimits C] [H : is_open_immersion f] (x : X) : IsIso (stalkMap f x) := by
+instance stalk_iso [HasColimits C] [H : IsOpenImmersion f] (x : X) : IsIso (stalkMap f x) := by
   rw [← H.isoRestrict_hom_ofRestrict]
   rw [PresheafedSpace.stalkMap.comp]
   infer_instance
@@ -348,7 +348,7 @@ end
 
 noncomputable section Pullback
 
-variable {X Y Z : PresheafedSpace C} (f : X ⟶ Z) [hf : is_open_immersion f] (g : Y ⟶ Z)
+variable {X Y Z : PresheafedSpace C} (f : X ⟶ Z) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
 
 /-- (Implementation.) The projection map when constructing the pullback along an open immersion.
 -/
@@ -481,7 +481,7 @@ theorem pullbackConeOfLeftLift_snd :
     · rw [s.pt.presheaf.map_id]; erw [Category.comp_id]
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_of_left_lift_snd AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift_snd
 
-instance pullbackConeSndIsOpenImmersion : is_open_immersion (pullbackConeOfLeft f g).snd := by
+instance pullbackConeSndIsOpenImmersion : IsOpenImmersion (pullbackConeOfLeft f g).snd := by
   erw [CategoryTheory.Limits.PullbackCone.mk_snd]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_cone_snd_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeSndIsOpenImmersion
@@ -507,20 +507,20 @@ instance hasPullback_of_right : HasPullback g f :=
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.has_pullback_of_right AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.hasPullback_of_right
 
 /-- Open immersions are stable under base-change. -/
-instance pullbackSndOfLeft : is_open_immersion (pullback.snd : pullback f g ⟶ _) := by
+instance pullbackSndOfLeft : IsOpenImmersion (pullback.snd : pullback f g ⟶ _) := by
   delta pullback.snd
   rw [← limit.isoLimitCone_hom_π ⟨_, pullbackConeOfLeftIsLimit f g⟩ WalkingCospan.right]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_snd_of_left AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackSndOfLeft
 
 /-- Open immersions are stable under base-change. -/
-instance pullbackFstOfRight : is_open_immersion (pullback.fst : pullback g f ⟶ _) := by
+instance pullbackFstOfRight : IsOpenImmersion (pullback.fst : pullback g f ⟶ _) := by
   rw [← pullbackSymmetry_hom_comp_snd]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_fst_of_right AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackFstOfRight
 
-instance pullbackToBaseIsOpenImmersion [is_open_immersion g] :
-    is_open_immersion (limit.π (cospan f g) WalkingCospan.one) := by
+instance pullbackToBaseIsOpenImmersion [IsOpenImmersion g] :
+    IsOpenImmersion (limit.π (cospan f g) WalkingCospan.one) := by
   rw [← limit.w (cospan f g) WalkingCospan.Hom.inl, cospan_map_inl]
   infer_instance
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.pullback_to_base_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackToBaseIsOpenImmersion
@@ -579,7 +579,7 @@ theorem lift_uniq (H : Set.range g.base ⊆ Set.range f.base) (l : Y ⟶ X) (hl
 
 /-- Two open immersions with equal range is isomorphic. -/
 @[simps]
-def isoOfRangeEq [is_open_immersion g] (e : Set.range f.base = Set.range g.base) : X ≅ Y where
+def isoOfRangeEq [IsOpenImmersion g] (e : Set.range f.base = Set.range g.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
@@ -594,7 +594,7 @@ section ToSheafedSpace
 
 variable {X : PresheafedSpace C} (Y : SheafedSpace C)
 
-variable (f : X ⟶ Y.toPresheafedSpace) [H : is_open_immersion f]
+variable (f : X ⟶ Y.toPresheafedSpace) [H : IsOpenImmersion f]
 
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a SheafedSpace, then so is `X`. -/
 def toSheafedSpace : SheafedSpace C where
@@ -632,7 +632,7 @@ instance toSheafedSpace_isOpenImmersion : SheafedSpace.IsOpenImmersion (toSheafe
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.to_SheafedSpace_is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_isOpenImmersion
 
 @[simp]
-theorem sheafedSpace_toSheafedSpace {X Y : SheafedSpace C} (f : X ⟶ Y) [is_open_immersion f] :
+theorem sheafedSpace_toSheafedSpace {X Y : SheafedSpace C} (f : X ⟶ Y) [IsOpenImmersion f] :
     toSheafedSpace Y f = X := by cases X; rfl
 #align algebraic_geometry.PresheafedSpace.is_open_immersion.SheafedSpace_to_SheafedSpace AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.sheafedSpace_toSheafedSpace
 
@@ -642,7 +642,7 @@ section ToLocallyRingedSpace
 
 variable {X : PresheafedSpace CommRingCat} (Y : LocallyRingedSpace)
 
-variable (f : X ⟶ Y.toPresheafedSpace) [H : is_open_immersion f]
+variable (f : X ⟶ Y.toPresheafedSpace) [H : IsOpenImmersion f]
 
 /-- If `X ⟶ Y` is an open immersion, and `Y` is a LocallyRingedSpace, then so is `X`. -/
 def toLocallyRingedSpace : LocallyRingedSpace where
@@ -775,7 +775,6 @@ instance sheafedSpaceForgetPreservesOfLeft : PreservesLimit (cospan f g) (Sheafe
       . dsimp
         infer_instance
       apply preservesLimitOfIsoDiagram _ (diagramIsoCospan _).symm
-
 #align algebraic_geometry.SheafedSpace.is_open_immersion.SheafedSpace_forget_preserves_of_left AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft
 
 instance sheafedSpaceForgetPreservesOfRight : PreservesLimit (cospan g f) (SheafedSpace.forget C) :=
@@ -995,7 +994,7 @@ def pullbackConeOfLeft : PullbackCone f g := by
 instance : LocallyRingedSpace.IsOpenImmersion (pullbackConeOfLeft f g).snd :=
   show PresheafedSpace.IsOpenImmersion (Y.toPresheafedSpace.ofRestrict _) by infer_instance
 
-/-- The constructed `pullback_cone_of_left` is indeed limiting. -/
+/-- The constructed `pullbackConeOfLeft` is indeed limiting. -/
 def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) :=
   PullbackCone.isLimitAux' _ fun s => by
     refine' ⟨LocallyRingedSpace.Hom.mk (PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift
feat: port AlgebraicGeometry.OpenImmersion.Basic (#5046)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Dependencies 11 + 792

793 files ported (98.6%)
322038 lines ported (98.4%)
Show graph

The unported dependencies are