theorem carrier.add_mem (q : Spec.T A⁰_ f) {a b : A} (ha : a ∈ carrier f_deg q)
    (hb : b ∈ carrier f_deg q) : a + b ∈ carrier f_deg q := by
  refine' fun i => (q.2.mem_or_mem _).elim id id
  change (Quotient.mk'' ⟨_, _, _, _⟩ : A⁰_ f) ∈ q.1; dsimp only [Subtype.coe_mk]
  simp_rw [← pow_add, map_add, add_pow, mul_comm, ← nsmul_eq_mul]
  let g : ℕ → A⁰_ f := fun j => (m + m).choose j •
      if h2 : m + m < j then (0 : A⁰_ f)
      else
        -- Porting note: inlining `l`, `r` causes a "can't synth HMul A⁰_ f A⁰_ f ?" error
        if h1 : j ≤ m then
          letI l : A⁰_ f := Quotient.mk''
            ⟨m * i, ⟨proj 𝒜 i a ^ j * proj 𝒜 i b ^ (m - j), ?_⟩,
              ⟨_, by rw [mul_comm]; mem_tac⟩, ⟨i, rfl⟩⟩
          letI r : A⁰_ f := Quotient.mk''
            ⟨m * i, ⟨proj 𝒜 i b ^ m, by mem_tac⟩,
              ⟨_, by rw [mul_comm]; mem_tac⟩, ⟨i, rfl⟩⟩
          l * r
        else
          letI l : A⁰_ f := Quotient.mk''
            ⟨m * i, ⟨proj 𝒜 i a ^ m, by mem_tac⟩,
              ⟨_, by rw [mul_comm]; mem_tac⟩, ⟨i, rfl⟩⟩
          letI r : A⁰_ f := Quotient.mk''
            ⟨m * i, ⟨proj 𝒜 i a ^ (j - m) * proj 𝒜 i b ^ (m + m - j), ?_⟩,
              ⟨_, by rw [mul_comm]; mem_tac⟩, ⟨i, rfl⟩⟩
          l * r
  rotate_left
  · rw [(_ : m * i = _)]
    -- Porting note: it seems unification with mul_mem is more fiddly reducing value of mem_tac
    apply GradedMonoid.toGradedMul.mul_mem (i := j • i) (j := (m - j) • i) <;> mem_tac_aux
    rw [← add_smul, Nat.add_sub_of_le h1]; rfl
  · rw [(_ : m * i = _)]
    apply GradedMonoid.toGradedMul.mul_mem (i := (j-m) • i) (j := (m + m - j) • i) <;> mem_tac_aux
    rw [← add_smul]; congr; zify [le_of_not_lt h2, le_of_not_le h1]; abel
  convert_to ∑ i in range (m + m + 1), g i ∈ q.1; swap
  · refine' q.1.sum_mem fun j _ => nsmul_mem _ _; split_ifs
    exacts [q.1.zero_mem, q.1.mul_mem_left _ (hb i), q.1.mul_mem_right _ (ha i)]
  rw [HomogeneousLocalization.ext_iff_val, HomogeneousLocalization.val_mk'']
  change _ = (algebraMap (HomogeneousLocalization.Away 𝒜 f) (Localization.Away f)) _
  dsimp only [Subtype.coe_mk]; rw [map_sum, mk_sum]
  apply Finset.sum_congr rfl fun j hj => _
  intro j hj
  change _ = HomogeneousLocalization.val _
  rw [HomogeneousLocalization.smul_val]
  

Proof state:
R : Type u_1
A : Type u_2
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : Algebra R A
𝒜 : ℕ → Submodule R A
inst✝ : GradedAlgebra 𝒜
f : A
m : ℕ
f_deg : f ∈ 𝒜 m
q : ↑↑(Spec A⁰_ f).toSheafedSpace.toPresheafedSpace
a b : A
ha : a ∈ carrier f_deg q
hb : b ∈ carrier f_deg q
i : ℕ
g : ℕ → A⁰_ f :=
  fun j =>
    Nat.choose (m + m) j •
      if h2 : m + m < j then 0
      else
        if h1 : j ≤ m then
          Quotient.mk''
              { deg := m * i,
                num :=
                  { val := (proj 𝒜 i) a ^ j * (proj 𝒜 i) b ^ (m - j),
                    property := (_ : (proj 𝒜 i) a ^ j * (proj 𝒜 i) b ^ (m - j) ∈ 𝒜 (m * i)) },
                den := { val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) },
                den_mem := (_ : ∃ y, (fun x => f ^ x) y = ↑{ val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) }) } *
            Quotient.mk''
              { deg := m * i,
                num :=
                  { val := (proj 𝒜 i) b ^ m,
                    property :=
                      (_ :
                        ↑((LinearMap.comp (DFinsupp.lapply i) (AlgHom.toLinearMap ↑(decomposeAlgEquiv 𝒜))) b) ^ m ∈
                          𝒜 (m • i)) },
                den := { val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) },
                den_mem := (_ : ∃ y, (fun x => f ^ x) y = ↑{ val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) }) }
        else
          Quotient.mk''
              { deg := m * i,
                num :=
                  { val := (proj 𝒜 i) a ^ m,
                    property :=
                      (_ :
                        ↑((LinearMap.comp (DFinsupp.lapply i) (AlgHom.toLinearMap ↑(decomposeAlgEquiv 𝒜))) a) ^ m ∈
                          𝒜 (m • i)) },
                den := { val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) },
                den_mem := (_ : ∃ y, (fun x => f ^ x) y = ↑{ val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) }) } *
            Quotient.mk''
              { deg := m * i,
                num :=
                  { val := (proj 𝒜 i) a ^ (j - m) * (proj 𝒜 i) b ^ (m + m - j),
                    property := (_ : (proj 𝒜 i) a ^ (j - m) * (proj 𝒜 i) b ^ (m + m - j) ∈ 𝒜 (m * i)) },
                den := { val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) },
                den_mem := (_ : ∃ y, (fun x => f ^ x) y = ↑{ val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) }) }
e_1✝ : Quotient (Setoid.ker (HomogeneousLocalization.NumDenSameDeg.embedding 𝒜 (Submonoid.powers f))) = A⁰_ f
j : ℕ
hj : j ∈ range (m + m + 1)
⊢ Localization.mk (Nat.choose (m + m) j • ((proj 𝒜 i) a ^ j * (proj 𝒜 i) b ^ (m + m - j)))
      { val := f ^ (i + i),
        property :=
          (_ : ↑{ val := f ^ (i + i), property := (_ : f ^ (i + i) ∈ 𝒜 (m * i + m * i)) } ∈ Submonoid.powers f) } =
    Nat.choose (m + m) j •
      HomogeneousLocalization.val
        (if h2 : m + m < j then 0
        else
          if h1 : j ≤ m then
            Quotient.mk''
                { deg := m * i,
                  num :=
                    { val := (proj 𝒜 i) a ^ j * (proj 𝒜 i) b ^ (m - j),
                      property := (_ : (proj 𝒜 i) a ^ j * (proj 𝒜 i) b ^ (m - j) ∈ 𝒜 (m * i)) },
                  den := { val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) }, den_mem := (_ : ∃ y, f ^ y = f ^ i) } *
              Quotient.mk''
                { deg := m * i,
                  num :=
                    { val := (proj 𝒜 i) b ^ m,
                      property :=
                        (_ :
                          ↑((LinearMap.comp (DFinsupp.lapply i) (AlgHom.toLinearMap ↑(decomposeAlgEquiv 𝒜))) b) ^ m ∈
                            𝒜 (m • i)) },
                  den := { val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) }, den_mem := (_ : ∃ y, f ^ y = f ^ i) }
          else
            Quotient.mk''
                { deg := m * i,
                  num :=
                    { val := (proj 𝒜 i) a ^ m,
                      property :=
                        (_ :
                          ↑((LinearMap.comp (DFinsupp.lapply i) (AlgHom.toLinearMap ↑(decomposeAlgEquiv 𝒜))) a) ^ m ∈
                            𝒜 (m • i)) },
                  den := { val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) }, den_mem := (_ : ∃ y, f ^ y = f ^ i) } *
              Quotient.mk''
                { deg := m * i,
                  num :=
                    { val := (proj 𝒜 i) a ^ (j - m) * (proj 𝒜 i) b ^ (m + m - j),
                      property := (_ : (proj 𝒜 i) a ^ (j - m) * (proj 𝒜 i) b ^ (m + m - j) ∈ 𝒜 (m * i)) },
                  den := { val := f ^ i, property := (_ : f ^ i ∈ 𝒜 (m * i)) }, den_mem := (_ : ∃ y, f ^ y = f ^ i) })

Next tactic:
split_ifs with h2 h1