-- Module: Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Scheme
Goal:
A : Type u_1
σ : Type u_2
inst : CommRing A
inst_1 : SetLike σ A
inst_2 : AddSubgroupClass σ A
𝒜 : ℕ → σ
inst_3 : GradedRing 𝒜
f : A
m : ℕ
f_deg : f ∈ 𝒜 m
q : (↑(↑(Spec A⁰_ f).toPresheafedSpace : TopCat) : Type u_1)
a b : A
ha : a ∈ carrier f_deg q
hb : b ∈ carrier f_deg q
i : ℕ
g : ℕ → A⁰_ f :=
  fun (j : ℕ) ↦
    HSMul.hSMul (β := A⁰_ f) ((m + m).choose j)
      (if h2 : m + m < j then 0
      else
        if h1 : j ≤ m then
          HMul.hMul (α := HomogeneousLocalization 𝒜 (Submonoid.powers f))
            (HomogeneousLocalization.mk
              { deg := m * i,
                num :=
                  Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i))
                    (HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) a : A) j *
                      HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) b : A) (m - j))
                    ⋯,
                den := Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i)) (f ^ i) ⋯, den_mem := ⋯ })
            (HomogeneousLocalization.mk
              { deg := m * i,
                num :=
                  Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i)) (HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) b : A) m)
                    ⋯,
                den := Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i)) (f ^ i) ⋯, den_mem := ⋯ })
        else
          HMul.hMul (α := HomogeneousLocalization 𝒜 (Submonoid.powers f))
            (HomogeneousLocalization.mk
              { deg := m * i,
                num :=
                  Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i)) (HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) a : A) m)
                    ⋯,
                den := Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i)) (f ^ i) ⋯, den_mem := ⋯ })
            (HomogeneousLocalization.mk
              { deg := m * i,
                num :=
                  Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i))
                    (HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) a : A) (j - m) *
                      HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) b : A) (m + m - j))
                    ⋯,
                den := Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i)) (f ^ i) ⋯, den_mem := ⋯ }))
h :
  Eq (α := HomogeneousLocalization 𝒜 (Submonoid.powers f))
    (HomogeneousLocalization.mk
      { deg := m * i + m * i,
        num :=
          (Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i + m * i))
              (∑ x ∈ range (m + m + 1),
                (m + m).choose x •
                  (HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) a : A) x *
                    HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) b : A) (m + m - x)))
              ⋯ :
            ↥(𝒜 (m * i + m * i))),
        den := (Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i + m * i)) (f ^ (i + i)) ⋯ : ↥(𝒜 (m * i + m * i))),
        den_mem := ⋯ })
    (∑ i ∈ range (m + m + 1), g i)
refine_3 : ∑ i ∈ range (m + m + 1), g i ∈ q.asIdeal
⊢ HomogeneousLocalization.mk
      { deg := m * i + m * i,
        num :=
          (Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i + m * i))
              (∑ x ∈ range (m + m + 1),
                (m + m).choose x •
                  (HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) a : A) x *
                    HPow.hPow (α := A) ((proj 𝒜 i : (a : A) → A) b : A) (m + m - x)))
              ⋯ :
            ↥(𝒜 (m * i + m * i))),
        den := (Subtype.mk (p := fun (x : A) ↦ x ∈ 𝒜 (m * i + m * i)) (f ^ (i + i)) ⋯ : ↥(𝒜 (m * i + m * i))),
        den_mem := ⋯ } ∈
    q.asIdeal

Tactic:
convert_to ∑ i ∈ range (m + m + 1), g i ∈ q.1

Premises used: Finset.range, HAdd.hAdd, OfNat.ofNat, PrimeSpectrum.asIdeal