l3lab/ntp-mathlib huggingface dataset:
/-- Quantitative result associated to the direct comparison test for series: If `∑' i, g i` is
summable, and for all `i`, `‖f i‖₊ ≤ g i`, then `‖∑' i, f i‖₊ ≤ ∑' i, g i`. Note that we
do not assume that `∑' i, f i` is summable, and it might not be the case if `α` is not a complete
space. -/
theorem tsum_of_nnnorm_bounded {f : ι → E} {g : ι → ℝ≥0} {a : ℝ≥0} (hg : HasSum g a)
    (h : ∀ i, ‖f i‖₊ ≤ g i) : ‖∑' i : ι, f i‖₊ ≤ a := by
  simp only [← NNReal.coe_le_coe, ← NNReal.hasSum_coe, coe_nnnorm] at *
  

Proof state:
ι : Type u_1
α : Type u_2
E : Type u_3
F : Type u_4
inst✝¹ : SeminormedAddCommGroup E
inst✝ : SeminormedAddCommGroup F
f : ι → E
g : ι → ℝ≥0
a : ℝ≥0
hg : HasSum (fun a => ↑(g a)) ↑a
h : ∀ (i : ι), ‖f i‖ ≤ ↑(g i)
⊢ ‖∑' (i : ι), f i‖ ≤ ↑a

Next tactic:
exact tsum_of_norm_bounded hg h
lemma Scheme.ofRestrict_val_c_app_self {X : Scheme} (U : Opens X) :
    (X.ofRestrict U.openEmbedding).1.c.app (op U) = X.presheaf.map (eqToHom (by 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X✝ : Scheme
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
      ((Opens.map (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion U))).val.base).op.obj (op U)).unop =
    U

Next tactic:
simp
lemma Scheme.map_basicOpen' (X : Scheme) (U : Opens X) (r : Scheme.Γ.obj (op <| X ∣_ᵤ U)) :
    U.openEmbedding.isOpenMap.functor.obj ((X ∣_ᵤ U).basicOpen r) = X.basicOpen
    (X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op r) := by
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X✝ : Scheme
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
r : ↑(Γ.obj (op (X ∣_ᵤ U)))
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ((X ∣_ᵤ U).basicOpen r) =
    X.basicOpen
      ((X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤)).op) r)

Next tactic:
refine' (Scheme.image_basicOpen (X.ofRestrict U.openEmbedding) r).trans _
lemma Scheme.map_basicOpen' (X : Scheme) (U : Opens X) (r : Scheme.Γ.obj (op <| X ∣_ᵤ U)) :
    U.openEmbedding.isOpenMap.functor.obj ((X ∣_ᵤ U).basicOpen r) = X.basicOpen
    (X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op r) := by
  refine' (Scheme.image_basicOpen (X.ofRestrict U.openEmbedding) r).trans _
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X✝ : Scheme
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
r : ↑(Γ.obj (op (X ∣_ᵤ U)))
⊢ X.basicOpen ((Hom.invApp (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion U))) ⊤) r) =
    X.basicOpen
      ((X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤)).op) r)

Next tactic:
erw [← Scheme.basicOpen_res_eq _ _ (eqToHom U.openEmbedding_obj_top).op]
lemma Scheme.map_basicOpen' (X : Scheme) (U : Opens X) (r : Scheme.Γ.obj (op <| X ∣_ᵤ U)) :
    U.openEmbedding.isOpenMap.functor.obj ((X ∣_ᵤ U).basicOpen r) = X.basicOpen
    (X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op r) := by
  refine' (Scheme.image_basicOpen (X.ofRestrict U.openEmbedding) r).trans _
  erw [← Scheme.basicOpen_res_eq _ _ (eqToHom U.openEmbedding_obj_top).op]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X✝ : Scheme
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
r : ↑(Γ.obj (op (X ∣_ᵤ U)))
⊢ X.basicOpen ((Hom.invApp (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion U))) ⊤) r) =
    X.basicOpen
      ((X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤ = U)).op)
        ((X.presheaf.map (eqToHom (_ : U = (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤)).op) r))

Next tactic:
rw [← comp_apply, ← CategoryTheory.Functor.map_comp, ← op_comp, eqToHom_trans, eqToHom_refl,
    op_id, CategoryTheory.Functor.map_id]
lemma Scheme.map_basicOpen' (X : Scheme) (U : Opens X) (r : Scheme.Γ.obj (op <| X ∣_ᵤ U)) :
    U.openEmbedding.isOpenMap.functor.obj ((X ∣_ᵤ U).basicOpen r) = X.basicOpen
    (X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op r) := by
  refine' (Scheme.image_basicOpen (X.ofRestrict U.openEmbedding) r).trans _
  erw [← Scheme.basicOpen_res_eq _ _ (eqToHom U.openEmbedding_obj_top).op]
  rw [← comp_apply, ← CategoryTheory.Functor.map_comp, ← op_comp, eqToHom_trans, eqToHom_refl,
    op_id, CategoryTheory.Functor.map_id]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X✝ : Scheme
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
r : ↑(Γ.obj (op (X ∣_ᵤ U)))
⊢ X.basicOpen ((Hom.invApp (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion U))) ⊤) r) =
    X.basicOpen ((𝟙 (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤)))) r)

Next tactic:
congr
lemma Scheme.map_basicOpen' (X : Scheme) (U : Opens X) (r : Scheme.Γ.obj (op <| X ∣_ᵤ U)) :
    U.openEmbedding.isOpenMap.functor.obj ((X ∣_ᵤ U).basicOpen r) = X.basicOpen
    (X.presheaf.map (eqToHom U.openEmbedding_obj_top.symm).op r) := by
  refine' (Scheme.image_basicOpen (X.ofRestrict U.openEmbedding) r).trans _
  erw [← Scheme.basicOpen_res_eq _ _ (eqToHom U.openEmbedding_obj_top).op]
  rw [← comp_apply, ← CategoryTheory.Functor.map_comp, ← op_comp, eqToHom_trans, eqToHom_refl,
    op_id, CategoryTheory.Functor.map_id]
  congr
  

Proof state:
case e_f.e_a
C : Type u
inst✝ : Category.{v, u} C
X✝ : Scheme
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
r : ↑(Γ.obj (op (X ∣_ᵤ U)))
⊢ Hom.invApp (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion U))) ⊤ =
    𝟙 (X.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤)))

Next tactic:
exact PresheafedSpace.IsOpenImmersion.ofRestrict_invApp _ _ _
lemma Scheme.map_basicOpen (X : Scheme) (U : Opens X) (r : Scheme.Γ.obj (op <| X ∣_ᵤ U)) :
    U.openEmbedding.isOpenMap.functor.obj ((X ∣_ᵤ U).basicOpen r) = X.basicOpen r := by
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X✝ : Scheme
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
r : ↑(Γ.obj (op (X ∣_ᵤ U)))
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ((X ∣_ᵤ U).basicOpen r) = X.basicOpen r

Next tactic:
rw [Scheme.map_basicOpen', Scheme.basicOpen_res_eq]
lemma Scheme.map_basicOpen_map (X : Scheme) (U : Opens X) (r : X.presheaf.obj (op U)) :
    U.openEmbedding.isOpenMap.functor.obj ((X ∣_ᵤ U).basicOpen <|
    X.presheaf.map (eqToHom U.openEmbedding_obj_top).op r) = X.basicOpen r := by
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X✝ : Scheme
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
r : ↑(X.presheaf.obj (op U))
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
      ((X ∣_ᵤ U).basicOpen
        ((X.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤ = U)).op) r)) =
    X.basicOpen r

Next tactic:
rw [Scheme.map_basicOpen', Scheme.basicOpen_res_eq, Scheme.basicOpen_res_eq]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base

Next tactic:
dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ Set.range Subtype.val ⊆ Set.range Subtype.val

Next tactic:
rw [Subtype.range_val, Subtype.range_val]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ ↑U ⊆ ↑V

Next tactic:
exact i.le
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
⊢ { obj := fun U => Over.mk (ιOpens U),
          map := fun {U V} i =>
            Over.homMk
              (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.map
      (𝟙 U) =
    𝟙
      ({ obj := fun U => Over.mk (ιOpens U),
            map := fun {U V} i =>
              Over.homMk
                (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                  (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.obj
        U)

Next tactic:
ext1
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
⊢ ({ obj := fun U => Over.mk (ιOpens U),
            map := fun {U V} i =>
              Over.homMk
                (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                  (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.map
        (𝟙 U)).left =
    (𝟙
        ({ obj := fun U => Over.mk (ιOpens U),
              map := fun {U V} i =>
                Over.homMk
                  (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                    (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.obj
          U)).left

Next tactic:
dsimp only [Over.homMk_left, Over.id_left]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    dsimp only [Over.homMk_left, Over.id_left]
    

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
⊢ IsOpenImmersion.lift (ιOpens U) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens U).val.base) =
    𝟙 (Over.mk (ιOpens U)).left

Next tactic:
rw [← cancel_mono (ιOpens U), Category.id_comp,
      IsOpenImmersion.lift_fac]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    dsimp only [Over.homMk_left, Over.id_left]
    rw [← cancel_mono (ιOpens U), Category.id_comp,
      IsOpenImmersion.lift_fac]
  map_comp {U V W} i j := by
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V W : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
j : V ⟶ W
⊢ { obj := fun U => Over.mk (ιOpens U),
          map := fun {U V} i =>
            Over.homMk
              (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.map
      (i ≫ j) =
    { obj := fun U => Over.mk (ιOpens U),
            map := fun {U V} i =>
              Over.homMk
                (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                  (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.map
        i ≫
      { obj := fun U => Over.mk (ιOpens U),
            map := fun {U V} i =>
              Over.homMk
                (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                  (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.map
        j

Next tactic:
ext1
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    dsimp only [Over.homMk_left, Over.id_left]
    rw [← cancel_mono (ιOpens U), Category.id_comp,
      IsOpenImmersion.lift_fac]
  map_comp {U V W} i j := by
    ext1
    

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V W : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
j : V ⟶ W
⊢ ({ obj := fun U => Over.mk (ιOpens U),
            map := fun {U V} i =>
              Over.homMk
                (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                  (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.map
        (i ≫ j)).left =
    ({ obj := fun U => Over.mk (ιOpens U),
              map := fun {U V} i =>
                Over.homMk
                  (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                    (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.map
          i ≫
        { obj := fun U => Over.mk (ιOpens U),
              map := fun {U V} i =>
                Over.homMk
                  (IsOpenImmersion.lift (ιOpens V) (ιOpens U)
                    (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base)) }.map
          j).left

Next tactic:
dsimp only [Over.homMk_left, Over.comp_left]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    dsimp only [Over.homMk_left, Over.id_left]
    rw [← cancel_mono (ιOpens U), Category.id_comp,
      IsOpenImmersion.lift_fac]
  map_comp {U V W} i j := by
    ext1
    dsimp only [Over.homMk_left, Over.comp_left]
    

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V W : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
j : V ⟶ W
⊢ IsOpenImmersion.lift (ιOpens W) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens W).val.base) =
    IsOpenImmersion.lift (ιOpens V) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base) ≫
      IsOpenImmersion.lift (ιOpens W) (ιOpens V) (_ : Set.range ⇑(ιOpens V).val.base ⊆ Set.range ⇑(ιOpens W).val.base)

Next tactic:
rw [← cancel_mono (ιOpens W), Category.assoc]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    dsimp only [Over.homMk_left, Over.id_left]
    rw [← cancel_mono (ιOpens U), Category.id_comp,
      IsOpenImmersion.lift_fac]
  map_comp {U V W} i j := by
    ext1
    dsimp only [Over.homMk_left, Over.comp_left]
    rw [← cancel_mono (ιOpens W), Category.assoc]
    

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V W : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
j : V ⟶ W
⊢ IsOpenImmersion.lift (ιOpens W) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens W).val.base) ≫
      ιOpens W =
    IsOpenImmersion.lift (ιOpens V) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base) ≫
      IsOpenImmersion.lift (ιOpens W) (ιOpens V) (_ : Set.range ⇑(ιOpens V).val.base ⊆ Set.range ⇑(ιOpens W).val.base) ≫
        ιOpens W

Next tactic:
iterate 3 rw [IsOpenImmersion.lift_fac]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    dsimp only [Over.homMk_left, Over.id_left]
    rw [← cancel_mono (ιOpens U), Category.id_comp,
      IsOpenImmersion.lift_fac]
  map_comp {U V W} i j := by
    ext1
    dsimp only [Over.homMk_left, Over.comp_left]
    rw [← cancel_mono (ιOpens W), Category.assoc]
    iterate 3 

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V W : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
j : V ⟶ W
⊢ IsOpenImmersion.lift (ιOpens W) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens W).val.base) ≫
      ιOpens W =
    IsOpenImmersion.lift (ιOpens V) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base) ≫
      IsOpenImmersion.lift (ιOpens W) (ιOpens V) (_ : Set.range ⇑(ιOpens V).val.base ⊆ Set.range ⇑(ιOpens W).val.base) ≫
        ιOpens W

Next tactic:
rw [IsOpenImmersion.lift_fac]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    dsimp only [Over.homMk_left, Over.id_left]
    rw [← cancel_mono (ιOpens U), Category.id_comp,
      IsOpenImmersion.lift_fac]
  map_comp {U V W} i j := by
    ext1
    dsimp only [Over.homMk_left, Over.comp_left]
    rw [← cancel_mono (ιOpens W), Category.assoc]
    iterate 3 

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V W : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
j : V ⟶ W
⊢ ιOpens U =
    IsOpenImmersion.lift (ιOpens V) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base) ≫
      IsOpenImmersion.lift (ιOpens W) (ιOpens V) (_ : Set.range ⇑(ιOpens V).val.base ⊆ Set.range ⇑(ιOpens W).val.base) ≫
        ιOpens W

Next tactic:
rw [IsOpenImmersion.lift_fac]
/-- The functor taking open subsets of `X` to open subschemes of `X`. -/
-- @[simps obj_left obj_hom mapLeft]
def Scheme.restrictFunctor : Opens X ⥤ Over X where
  obj U := Over.mk (ιOpens U)
  map {U V} i :=
    Over.homMk
      (IsOpenImmersion.lift (ιOpens V) (ιOpens U) <| by
          dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict, Opens.coe_inclusion]
          rw [Subtype.range_val, Subtype.range_val]
          exact i.le)
      (IsOpenImmersion.lift_fac _ _ _)
  map_id U := by
    ext1
    dsimp only [Over.homMk_left, Over.id_left]
    rw [← cancel_mono (ιOpens U), Category.id_comp,
      IsOpenImmersion.lift_fac]
  map_comp {U V W} i j := by
    ext1
    dsimp only [Over.homMk_left, Over.comp_left]
    rw [← cancel_mono (ιOpens W), Category.assoc]
    iterate 3 

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V W : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
j : V ⟶ W
⊢ ιOpens U =
    IsOpenImmersion.lift (ιOpens V) (ιOpens U) (_ : Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base) ≫
      ιOpens V

Next tactic:
rw [IsOpenImmersion.lift_fac]
@[simp] lemma Scheme.restrictFunctor_map_left {U V : Opens X} (i : U ⟶ V) :
  (X.restrictFunctor.map i).left = IsOpenImmersion.lift (ιOpens V) (ιOpens U) (by
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base

Next tactic:
dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
@[simp] lemma Scheme.restrictFunctor_map_left {U V : Opens X} (i : U ⟶ V) :
  (X.restrictFunctor.map i).left = IsOpenImmersion.lift (ιOpens V) (ιOpens U) (by
    dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ Set.range ⇑(ContinuousMap.mk Subtype.val) ⊆ Set.range ⇑(ContinuousMap.mk Subtype.val)

Next tactic:
erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]
@[simp] lemma Scheme.restrictFunctor_map_left {U V : Opens X} (i : U ⟶ V) :
  (X.restrictFunctor.map i).left = IsOpenImmersion.lift (ιOpens V) (ιOpens U) (by
    dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ Set.range Subtype.val ⊆ Set.range Subtype.val

Next tactic:
rw [Subtype.range_val, Subtype.range_val]
@[simp] lemma Scheme.restrictFunctor_map_left {U V : Opens X} (i : U ⟶ V) :
  (X.restrictFunctor.map i).left = IsOpenImmersion.lift (ιOpens V) (ιOpens U) (by
    dsimp [ofRestrict, LocallyRingedSpace.ofRestrict, Opens.inclusion]
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    erw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]; rw [Subtype.range_val, Subtype.range_val]
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ ↑U ⊆ ↑V

Next tactic:
exact i.le
@[reassoc]
theorem Scheme.restrictFunctor_map_ofRestrict {U V : Opens X} (i : U ⟶ V) :
    (X.restrictFunctor.map i).1 ≫ ιOpens V = ιOpens U :=
  IsOpenImmersion.lift_fac _ _ (by
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ Set.range ⇑(ιOpens U).val.base ⊆ Set.range ⇑(ιOpens V).val.base

Next tactic:
dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict]
@[reassoc]
theorem Scheme.restrictFunctor_map_ofRestrict {U V : Opens X} (i : U ⟶ V) :
    (X.restrictFunctor.map i).1 ≫ ιOpens V = ιOpens U :=
  IsOpenImmersion.lift_fac _ _ (by
    dsimp [restrict, ofRestrict, LocallyRingedSpace.ofRestrict]
    

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X : Scheme
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
⊢ Set.range Subtype.val ⊆ Set.range Subtype.val

Next tactic:
rw [Subtype.range_val, Subtype.range_val]