l3lab/ntp-mathlib huggingface dataset:
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    

Proof state:
case intro.intro.refine_1
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) x = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
i : ↑s
⊢ (X.presheaf.map (homOfLE (_ : X.basicOpen ((X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f) ≤ ↑↑i)).op)
      ((X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) x) =
    0

Next tactic:
convert congr_arg (X.presheaf.map (homOfLE _).op) H
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · 

Proof state:
case h.e'_2
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) x = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
i : ↑s
⊢ (X.presheaf.map (homOfLE (_ : X.basicOpen ((X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f) ≤ ↑↑i)).op)
      ((X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) x) =
    (X.presheaf.map (homOfLE ?intro.intro.refine_1.convert_1).op)
      ((X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) x)

Next tactic:
simp only [← comp_apply, ← Functor.map_comp]
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      

Proof state:
case h.e'_2
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) x = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
i : ↑s
⊢ (X.presheaf.map
        ((homOfLE (_ : ↑↑i ≤ U)).op ≫
          (homOfLE (_ : X.basicOpen ((X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f) ≤ ↑↑i)).op))
      x =
    (X.presheaf.map ((homOfLE (_ : X.basicOpen f ≤ U)).op ≫ (homOfLE ?intro.intro.refine_1.convert_1).op)) x

Next tactic:
rfl
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · 

Proof state:
case h.e'_3
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) x = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
i : ↑s
⊢ 0 = (X.presheaf.map (homOfLE ?intro.intro.refine_1.convert_1).op) 0

Next tactic:
rw [map_zero]
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      

Proof state:
case intro.intro.refine_1.convert_1
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) x = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
i : ↑s
⊢ X.basicOpen ((X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f) ≤ X.basicOpen f

Next tactic:
simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
  

Proof state:
case intro.intro.refine_2
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : x |_ X.basicOpen f = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
H' :
  ∀ (i : ↑s), ∃ n, (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f ^ n * (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) x = 0
⊢ ∃ n, f ^ n * x = 0

Next tactic:
choose n hn using H'
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
  choose n hn using H'
  

Proof state:
case intro.intro.refine_2
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : x |_ X.basicOpen f = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
n : ↑s → ℕ
hn : ∀ (i : ↑s), (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f ^ n i * (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) x = 0
⊢ ∃ n, f ^ n * x = 0

Next tactic:
haveI := hs.to_subtype
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
  choose n hn using H'
  haveI := hs.to_subtype
  

Proof state:
case intro.intro.refine_2
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : x |_ X.basicOpen f = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
n : ↑s → ℕ
hn : ∀ (i : ↑s), (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f ^ n i * (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) x = 0
this : Finite ↑s
⊢ ∃ n, f ^ n * x = 0

Next tactic:
cases nonempty_fintype s
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
  choose n hn using H'
  haveI := hs.to_subtype
  cases nonempty_fintype s
  

Proof state:
case intro.intro.refine_2.intro
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : x |_ X.basicOpen f = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
n : ↑s → ℕ
hn : ∀ (i : ↑s), (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f ^ n i * (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) x = 0
this : Finite ↑s
val✝ : Fintype ↑s
⊢ ∃ n, f ^ n * x = 0

Next tactic:
use Finset.univ.sup n
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
  choose n hn using H'
  haveI := hs.to_subtype
  cases nonempty_fintype s
  use Finset.univ.sup n
  

Proof state:
case h
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : x |_ X.basicOpen f = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
n : ↑s → ℕ
hn : ∀ (i : ↑s), (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f ^ n i * (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) x = 0
this : Finite ↑s
val✝ : Fintype ↑s
⊢ f ^ Finset.sup Finset.univ n * x = 0

Next tactic:
suffices ∀ i : s, X.presheaf.map (homOfLE (h₁ i)).op (f ^ Finset.univ.sup n * x) = 0 by
    subst e
    apply TopCat.Sheaf.eq_of_locally_eq X.sheaf fun i : s => (i : Opens X.carrier)
    intro i
    rw [map_zero]
    apply this
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
  choose n hn using H'
  haveI := hs.to_subtype
  cases nonempty_fintype s
  use Finset.univ.sup n
  suffices ∀ i : s, X.presheaf.map (homOfLE (h₁ i)).op (f ^ Finset.univ.sup n * x) = 0 by
    

Proof state:
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
x f : ↑(X.presheaf.obj (op U))
H : x |_ X.basicOpen f = 0
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
e : U = ⨆ i, ↑↑i
h₁ : ∀ (i : ↑s), ↑↑i ≤ U
n : ↑s → ℕ
hn : ∀ (i : ↑s), (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) f ^ n i * (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) x = 0
this✝ : Finite ↑s
val✝ : Fintype ↑s
this : ∀ (i : ↑s), (X.presheaf.map (homOfLE (_ : ↑↑i ≤ U)).op) (f ^ Finset.sup Finset.univ n * x) = 0
⊢ f ^ Finset.sup Finset.univ n * x = 0

Next tactic:
subst e
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
  choose n hn using H'
  haveI := hs.to_subtype
  cases nonempty_fintype s
  use Finset.univ.sup n
  suffices ∀ i : s, X.presheaf.map (homOfLE (h₁ i)).op (f ^ Finset.univ.sup n * x) = 0 by
    subst e
    

Proof state:
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
n : ↑s → ℕ
this✝ : Finite ↑s
val✝ : Fintype ↑s
hU : IsCompact (⨆ i, ↑↑i).carrier
x f : ↑(X.presheaf.obj (op (⨆ i, ↑↑i)))
H : x |_ X.basicOpen f = 0
h₁ : ∀ (i : ↑s), ↑↑i ≤ ⨆ i, ↑↑i
hn :
  ∀ (i : ↑s),
    (X.presheaf.map (homOfLE (_ : ↑↑i ≤ ⨆ i, ↑↑i)).op) f ^ n i * (X.presheaf.map (homOfLE (_ : ↑↑i ≤ ⨆ i, ↑↑i)).op) x =
      0
this : ∀ (i : ↑s), (X.presheaf.map (homOfLE (_ : ↑↑i ≤ ⨆ i, ↑↑i)).op) (f ^ Finset.sup Finset.univ n * x) = 0
⊢ f ^ Finset.sup Finset.univ n * x = 0

Next tactic:
apply TopCat.Sheaf.eq_of_locally_eq X.sheaf fun i : s => (i : Opens X.carrier)
/-- If `x : Γ(X, U)` is zero on `D(f)` for some `f : Γ(X, U)`, and `U` is quasi-compact, then
`f ^ n * x = 0` for some `n`. -/
theorem exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact (X : Scheme.{u})
    {U : Opens X.carrier} (hU : IsCompact U.1) (x f : X.presheaf.obj (op U))
    (H : x |_ X.basicOpen f = 0) : ∃ n : ℕ, f ^ n * x = 0 := by
  obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_finset_affine_union U.1).mp ⟨hU, U.2⟩
  replace e : U = iSup fun i : s => (i : Opens X.carrier)
  · ext1; simpa using e
  have h₁ : ∀ i : s, i.1.1 ≤ U := by
    intro i
    change (i : Opens X.carrier) ≤ U
    rw [e]
    -- porting note: `exact le_iSup _ _` no longer works
    exact le_iSup (fun (i : s) => (i : Opens (X.toPresheafedSpace))) _
  have H' := fun i : s =>
    exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isAffineOpen X i.1.2
      (X.presheaf.map (homOfLE (h₁ i)).op x) (X.presheaf.map (homOfLE (h₁ i)).op f) ?_
  swap
  · delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict at H ⊢
    convert congr_arg (X.presheaf.map (homOfLE _).op) H
    · simp only [← comp_apply, ← Functor.map_comp]
      rfl
    · rw [map_zero]
      simp only [Scheme.basicOpen_res, ge_iff_le, inf_le_right]
  choose n hn using H'
  haveI := hs.to_subtype
  cases nonempty_fintype s
  use Finset.univ.sup n
  suffices ∀ i : s, X.presheaf.map (homOfLE (h₁ i)).op (f ^ Finset.univ.sup n * x) = 0 by
    subst e
    apply TopCat.Sheaf.eq_of_locally_eq X.sheaf fun i : s => (i : Opens X.carrier)
    

Proof state:
case h
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
Z X : Scheme
s : Set ↑(Scheme.affineOpens X)
hs : Set.Finite s
n : ↑s → ℕ
this✝ : Finite ↑s
val✝ : Fintype ↑s
hU : IsCompact (⨆ i, ↑↑i).carrier
x f : ↑(X.presheaf.obj (op (⨆ i, ↑↑i)))
H : x |_ X.basicOpen f = 0
h₁ : ∀ (i : ↑s), ↑↑i ≤ ⨆ i, ↑↑i
hn :
  ∀ (i : ↑s),
    (X.presheaf.map (homOfLE (_ : ↑↑i ≤ ⨆ i, ↑↑i)).op) f ^ n i * (X.presheaf.map (homOfLE (_ : ↑↑i ≤ ⨆ i, ↑↑i)).op) x =
      0
this : ∀ (i : ↑s), (X.presheaf.map (homOfLE (_ : ↑↑i ≤ ⨆ i, ↑↑i)).op) (f ^ Finset.sup Finset.univ n * x) = 0
⊢ ∀ (i : ↑s),
    ((Scheme.sheaf X).val.map (Opens.leSupr (fun i => ↑↑i) i).op) (f ^ Finset.sup Finset.univ n * x) =
      ((Scheme.sheaf X).val.map (Opens.leSupr (fun i => ↑↑i) i).op) 0

Next tactic:
intro i