l3lab/ntp-mathlib huggingface dataset:
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    

Proof state:
case h.refine'_1.intro.intro.intro
X✝¹ : Scheme
X✝ : Scheme
hX✝ : IsReduced X✝
U✝ : Opens ↑↑X✝.toPresheafedSpace
s✝ : ↑(X✝.presheaf.obj (op U✝))
hs✝ : X✝.basicOpen s✝ = ⊥
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hx✝ :
  ∀ (x : ↥U),
    ∃ V,
      ∃ (_ : ↑x ∈ V),
        ∃ x,
          (fun X U =>
              ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
                X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
            X V
hX : IsReduced X
s : ↑(X.presheaf.obj (op U))
hs : X.basicOpen s = ⊥
x : ↥U
V : Opens ↑↑X.toPresheafedSpace
hx : ↑x ∈ V
i : V ⟶ U
H : V ⊓ ⊥ = ⊥ → ∀ (x : ↥V), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) ((X.presheaf.map i.op) s) = 0
⊢ (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0

Next tactic:
specialize H inf_bot_eq ⟨x, hx⟩
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    

Proof state:
case h.refine'_1.intro.intro.intro
X✝¹ : Scheme
X✝ : Scheme
hX✝ : IsReduced X✝
U✝ : Opens ↑↑X✝.toPresheafedSpace
s✝ : ↑(X✝.presheaf.obj (op U✝))
hs✝ : X✝.basicOpen s✝ = ⊥
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hx✝ :
  ∀ (x : ↥U),
    ∃ V,
      ∃ (_ : ↑x ∈ V),
        ∃ x,
          (fun X U =>
              ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
                X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
            X V
hX : IsReduced X
s : ↑(X.presheaf.obj (op U))
hs : X.basicOpen s = ⊥
x : ↥U
V : Opens ↑↑X.toPresheafedSpace
hx : ↑x ∈ V
i : V ⟶ U
H : (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) { val := ↑x, property := hx }) ((X.presheaf.map i.op) s) = 0
⊢ (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0

Next tactic:
erw [TopCat.Presheaf.germ_res_apply] at H
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    

Proof state:
case h.refine'_1.intro.intro.intro
X✝¹ : Scheme
X✝ : Scheme
hX✝ : IsReduced X✝
U✝ : Opens ↑↑X✝.toPresheafedSpace
s✝ : ↑(X✝.presheaf.obj (op U✝))
hs✝ : X✝.basicOpen s✝ = ⊥
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hx✝ :
  ∀ (x : ↥U),
    ∃ V,
      ∃ (_ : ↑x ∈ V),
        ∃ x,
          (fun X U =>
              ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
                X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
            X V
hX : IsReduced X
s : ↑(X.presheaf.obj (op U))
hs : X.basicOpen s = ⊥
x : ↥U
V : Opens ↑↑X.toPresheafedSpace
hx : ↑x ∈ V
i : V ⟶ U
H :
  (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X))
        ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U) }) { val := ↑x, property := hx }))
      s =
    0
⊢ (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0

Next tactic:
exact H
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · 

Proof state:
case h.refine'_2
X✝ : Scheme
X : Scheme
hX : IsReduced X
U : Opens ↑↑X.toPresheafedSpace
s : ↑(X.presheaf.obj (op U))
hs : X.basicOpen s = ⊥
⊢ ∀ {X Y : Scheme} (f : X ⟶ Y) [hf : IsOpenImmersion f],
    ∃ U V,
      ∃ (hU : U = ⊤) (hV : V = Set.range ⇑f.val.base),
        (fun X U =>
              ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
                X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
            X { carrier := U, is_open' := (_ : IsOpen U) } →
          (fun X U =>
              ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
                X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
            Y { carrier := V, is_open' := (_ : IsOpen V) }

Next tactic:
rintro X Y f hf
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    

Proof state:
case h.refine'_2
X✝¹ : Scheme
X✝ : Scheme
hX : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s : ↑(X✝.presheaf.obj (op U))
hs : X✝.basicOpen s = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
⊢ ∃ U V,
    ∃ (hU : U = ⊤) (hV : V = Set.range ⇑f.val.base),
      (fun X U =>
            ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
              X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
          X { carrier := U, is_open' := (_ : IsOpen U) } →
        (fun X U =>
            ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
              X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
          Y { carrier := V, is_open' := (_ : IsOpen V) }

Next tactic:
have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      

Proof state:
X✝¹ : Scheme
X✝ : Scheme
hX : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s : ↑(X✝.presheaf.obj (op U))
hs : X✝.basicOpen s = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
⊢ ⇑f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ

Next tactic:
rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
    

Proof state:
case h.refine'_2
X✝¹ : Scheme
X✝ : Scheme
hX : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s : ↑(X✝.presheaf.obj (op U))
hs : X✝.basicOpen s = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
e : ⇑f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ
⊢ ∃ U V,
    ∃ (hU : U = ⊤) (hV : V = Set.range ⇑f.val.base),
      (fun X U =>
            ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
              X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
          X { carrier := U, is_open' := (_ : IsOpen U) } →
        (fun X U =>
            ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
              X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
          Y { carrier := V, is_open' := (_ : IsOpen V) }

Next tactic:
refine' ⟨_, _, e, rfl, _⟩
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
    refine' ⟨_, _, e, rfl, _⟩
    

Proof state:
case h.refine'_2
X✝¹ : Scheme
X✝ : Scheme
hX : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s : ↑(X✝.presheaf.obj (op U))
hs : X✝.basicOpen s = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
e : ⇑f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ
⊢ (fun X U =>
        ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
          X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
      X
      { carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
        is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) } →
    (fun X U =>
        ∀ [inst : IsReduced X] (s : ↑(X.presheaf.obj (op U))),
          X.basicOpen s = ⊥ → ∀ (x : ↥U), (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0)
      Y { carrier := Set.range ⇑f.val.base, is_open' := (_ : IsOpen (Set.range ⇑f.val.base)) }

Next tactic:
rintro H hX s hs ⟨_, x, rfl⟩
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
    refine' ⟨_, _, e, rfl, _⟩
    rintro H hX s hs ⟨_, x, rfl⟩
    

Proof state:
case h.refine'_2.mk.intro
X✝¹ : Scheme
X✝ : Scheme
hX✝ : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s✝ : ↑(X✝.presheaf.obj (op U))
hs✝ : X✝.basicOpen s✝ = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
e : ⇑f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ
H :
  ∀ [inst : IsReduced X]
    (s :
      ↑(X.presheaf.obj
          (op
            { carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }))),
    X.basicOpen s = ⊥ →
      ∀
        (x :
          ↥{ carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }),
        (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0
hX : IsReduced Y
s : ↑(Y.presheaf.obj (op { carrier := Set.range ⇑f.val.base, is_open' := (_ : IsOpen (Set.range ⇑f.val.base)) }))
hs : Y.basicOpen s = ⊥
x : (forget TopCat).obj ↑X.toPresheafedSpace
⊢ (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf Y))
        { val := f.val.base x, property := (_ : ∃ y, f.val.base y = f.val.base x) })
      s =
    0

Next tactic:
haveI := isReducedOfOpenImmersion f
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
    refine' ⟨_, _, e, rfl, _⟩
    rintro H hX s hs ⟨_, x, rfl⟩
    haveI := isReducedOfOpenImmersion f
    

Proof state:
case h.refine'_2.mk.intro
X✝¹ : Scheme
X✝ : Scheme
hX✝ : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s✝ : ↑(X✝.presheaf.obj (op U))
hs✝ : X✝.basicOpen s✝ = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
e : ⇑f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ
H :
  ∀ [inst : IsReduced X]
    (s :
      ↑(X.presheaf.obj
          (op
            { carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }))),
    X.basicOpen s = ⊥ →
      ∀
        (x :
          ↥{ carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }),
        (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0
hX : IsReduced Y
s : ↑(Y.presheaf.obj (op { carrier := Set.range ⇑f.val.base, is_open' := (_ : IsOpen (Set.range ⇑f.val.base)) }))
hs : Y.basicOpen s = ⊥
x : (forget TopCat).obj ↑X.toPresheafedSpace
this : IsReduced X
⊢ (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf Y))
        { val := f.val.base x, property := (_ : ∃ y, f.val.base y = f.val.base x) })
      s =
    0

Next tactic:
specialize H (f.1.c.app _ s) _ ⟨x, by rw [Opens.mem_mk, e]; trivial⟩
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
    refine' ⟨_, _, e, rfl, _⟩
    rintro H hX s hs ⟨_, x, rfl⟩
    haveI := isReducedOfOpenImmersion f
    specialize H (f.1.c.app _ s) _ ⟨x, by 

Proof state:
X✝¹ : Scheme
X✝ : Scheme
hX✝ : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s✝ : ↑(X✝.presheaf.obj (op U))
hs✝ : X✝.basicOpen s✝ = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
e : ⇑f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ
H :
  ∀ [inst : IsReduced X]
    (s :
      ↑(X.presheaf.obj
          (op
            { carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }))),
    X.basicOpen s = ⊥ →
      ∀
        (x :
          ↥{ carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }),
        (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0
hX : IsReduced Y
s : ↑(Y.presheaf.obj (op { carrier := Set.range ⇑f.val.base, is_open' := (_ : IsOpen (Set.range ⇑f.val.base)) }))
hs : Y.basicOpen s = ⊥
x : (forget TopCat).obj ↑X.toPresheafedSpace
this : IsReduced X
⊢ x ∈
    { carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
      is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }

Next tactic:
rw [Opens.mem_mk, e]
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
    refine' ⟨_, _, e, rfl, _⟩
    rintro H hX s hs ⟨_, x, rfl⟩
    haveI := isReducedOfOpenImmersion f
    specialize H (f.1.c.app _ s) _ ⟨x, by rw [Opens.mem_mk, e]; 

Proof state:
X✝¹ : Scheme
X✝ : Scheme
hX✝ : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s✝ : ↑(X✝.presheaf.obj (op U))
hs✝ : X✝.basicOpen s✝ = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
e : ⇑f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ
H :
  ∀ [inst : IsReduced X]
    (s :
      ↑(X.presheaf.obj
          (op
            { carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }))),
    X.basicOpen s = ⊥ →
      ∀
        (x :
          ↥{ carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }),
        (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0
hX : IsReduced Y
s : ↑(Y.presheaf.obj (op { carrier := Set.range ⇑f.val.base, is_open' := (_ : IsOpen (Set.range ⇑f.val.base)) }))
hs : Y.basicOpen s = ⊥
x : (forget TopCat).obj ↑X.toPresheafedSpace
this : IsReduced X
⊢ x ∈ Set.univ

Next tactic:
trivial
theorem eq_zero_of_basicOpen_eq_bot {X : Scheme} [hX : IsReduced X] {U : Opens X.carrier}
    (s : X.presheaf.obj (op U)) (hs : X.basicOpen s = ⊥) : s = 0 := by
  apply TopCat.Presheaf.section_ext X.sheaf U
  conv => intro x; rw [RingHom.map_zero]
  refine' (@reduce_to_affine_global (fun X U =>
     ∀ [IsReduced X] (s : X.presheaf.obj (op U)),
       X.basicOpen s = ⊥ → ∀ x, (X.sheaf.presheaf.germ x) s = 0) _ _ _) X U s hs
  · intro X U hx hX s hs x
    obtain ⟨V, hx, i, H⟩ := hx x
    specialize H (X.presheaf.map i.op s)
    erw [Scheme.basicOpen_res] at H
    rw [hs] at H
    specialize H inf_bot_eq ⟨x, hx⟩
    erw [TopCat.Presheaf.germ_res_apply] at H
    exact H
  · rintro X Y f hf
    have e : f.val.base ⁻¹' Set.range ↑f.val.base = Set.univ := by
      rw [← Set.image_univ, Set.preimage_image_eq _ hf.base_open.inj]
    refine' ⟨_, _, e, rfl, _⟩
    rintro H hX s hs ⟨_, x, rfl⟩
    haveI := isReducedOfOpenImmersion f
    specialize H (f.1.c.app _ s) _ ⟨x, by rw [Opens.mem_mk, e]; trivial⟩
    · 

Proof state:
case h.refine'_2.mk.intro
X✝¹ : Scheme
X✝ : Scheme
hX✝ : IsReduced X✝
U : Opens ↑↑X✝.toPresheafedSpace
s✝ : ↑(X✝.presheaf.obj (op U))
hs✝ : X✝.basicOpen s✝ = ⊥
X Y : Scheme
f : X ⟶ Y
hf : IsOpenImmersion f
e : ⇑f.val.base ⁻¹' Set.range ⇑f.val.base = Set.univ
H :
  ∀ [inst : IsReduced X]
    (s :
      ↑(X.presheaf.obj
          (op
            { carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }))),
    X.basicOpen s = ⊥ →
      ∀
        (x :
          ↥{ carrier := ⇑f.val.base ⁻¹' Set.range ⇑f.val.base,
              is_open' := (_ : IsOpen (⇑f.val.base ⁻¹' Set.range ⇑f.val.base)) }),
        (Presheaf.germ (Sheaf.presheaf (Scheme.sheaf X)) x) s = 0
hX : IsReduced Y
s : ↑(Y.presheaf.obj (op { carrier := Set.range ⇑f.val.base, is_open' := (_ : IsOpen (Set.range ⇑f.val.base)) }))
hs : Y.basicOpen s = ⊥
x : (forget TopCat).obj ↑X.toPresheafedSpace
this : IsReduced X
⊢ X.basicOpen
      ((f.val.c.app (op { carrier := Set.range ⇑f.val.base, is_open' := (_ : IsOpen (Set.range ⇑f.val.base)) })) s) =
    ⊥

Next tactic:
rw [← Scheme.preimage_basicOpen, hs]