/-- The function between the basic open set `D(f)` in `Proj` to the corresponding basic open set in
`Spec A⁰_f`. This is bundled into a continuous map in `TopComponent.forward`.
-/
def toFun (x : Proj.T| pbo f) : Spec.T A⁰_ f :=
  ⟨carrier x, carrier_ne_top x, fun {x1 x2} hx12 => by
    classical
    rw [mem_carrier_iff] at hx12
    let J := span ((algebraMap A (Away f) : A → (Away f)) '' x.val.asHomogeneousIdeal)
    suffices h : ∀ x y : Localization.Away f, x * y ∈ J → x ∈ J ∨ y ∈ J
    · rw [HomogeneousLocalization.mul_val] at hx12; exact h x1.val x2.val hx12
    clear x1 x2 hx12
    intro x1 x2 hx12
    induction' x1 using Localization.induction_on with data_x1
    induction' x2 using Localization.induction_on with data_x2
    rcases data_x1, data_x2 with ⟨⟨a1, _, ⟨n1, rfl⟩⟩, ⟨a2, _, ⟨n2, rfl⟩⟩⟩
    rcases MemCarrier.clear_denominator' x hx12 with ⟨c, N, acd, eq1⟩
    simp only [Algebra.smul_def] at eq1
    change Localization.mk (f ^ N) 1 * (Localization.mk _ _ * Localization.mk _ _)
      = Localization.mk _ _ at eq1
    simp only [Localization.mk_mul, one_mul] at eq1
    simp only [mk_eq_mk', IsLocalization.eq] at eq1
    rcases eq1 with ⟨⟨_, ⟨M, rfl⟩⟩, eq1⟩
    rw [Submonoid.coe_one, one_mul] at eq1
    change f ^ _ * (_ * _) = f ^ _ * (f ^ _ * f ^ _ * _) at eq1
    have that : a1 * a2 * f ^ N * f ^ M ∈ x.val.asHomogeneousIdeal.toIdeal := ?_
    rcases x.1.isPrime.mem_or_mem (show a1 * a2 * f ^ N * f ^ M ∈ _ from that) with (h1 | rid2)
    rcases x.1.isPrime.mem_or_mem h1 with (h1 | rid1)
    rcases x.1.isPrime.mem_or_mem h1 with (h1 | h2)
    · left;
      simp only [show (Localization.mk a1 ⟨f ^ n1, _⟩ : Away f) =
        Localization.mk a1 1 * Localization.mk 1 (⟨f ^ n1, ⟨n1, rfl⟩⟩ : Submonoid.powers f) by
          rw [Localization.mk_mul, mul_one, one_mul]]
      exact Ideal.mul_mem_right _ _ (Ideal.subset_span ⟨_, h1, rfl⟩)
    · right;
      simp only [show (mk a2 ⟨f ^ n2, _⟩ : Away f) =
        mk a2 1 * Localization.mk 1 (⟨f ^ n2, ⟨n2, rfl⟩⟩ : Submonoid.powers f) by
          rw [Localization.mk_mul, mul_one, one_mul]]
      exact Ideal.mul_mem_right _ _ (Ideal.subset_span ⟨_, h2, rfl⟩)
    · exact False.elim (x.2 (x.1.isPrime.mem_of_pow_mem N rid1))
    · exact False.elim (x.2 (x.1.isPrime.mem_of_pow_mem M rid2))
    · rw [← mul_comm (f ^ M), ← mul_comm (f ^ N), eq1]
      refine' mul_mem_left _ _ (mul_mem_left _ _ (sum_mem _ fun i _ => mul_mem_left _ _ _))
      

Proof state:
case h.H.H.mk.mk.intro.mk.mk.intro.intro.intro.intro.intro.mk.intro.refine_1
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
x✝¹ : ↑(LocallyRingedSpace.toTopCat (LocallyRingedSpace.restrict Proj (_ : OpenEmbedding ⇑(Opens.inclusion (pbo f)))))
x : ↑↑(LocallyRingedSpace.restrict Proj (_ : OpenEmbedding ⇑(Opens.inclusion (pbo f)))).toSheafedSpace.toPresheafedSpace
J : Ideal (Away f) := span (⇑(algebraMap A (Away f)) '' ↑(↑x).asHomogeneousIdeal)
a1 : A
n1 : ℕ
a2 : A
n2 : ℕ
hx12 :
  Localization.mk
        (a1, { val := (fun x => f ^ x) n1, property := (_ : ∃ y, (fun x => f ^ x) y = (fun x => f ^ x) n1) }).1
        (a1, { val := (fun x => f ^ x) n1, property := (_ : ∃ y, (fun x => f ^ x) y = (fun x => f ^ x) n1) }).2 *
      Localization.mk
        (a2, { val := (fun x => f ^ x) n2, property := (_ : ∃ y, (fun x => f ^ x) y = (fun x => f ^ x) n2) }).1
        (a2, { val := (fun x => f ^ x) n2, property := (_ : ∃ y, (fun x => f ^ x) y = (fun x => f ^ x) n2) }).2 ∈
    J
c : ↑(⇑(algebraMap A (Away f)) '' ↑(↑x).asHomogeneousIdeal) →₀ Away f
N : ℕ
acd : (y : Away f) → y ∈ image (⇑c) c.support → A
M : ℕ
eq1 :
  f ^ M * (f ^ N * (a1 * a2)) =
    f ^ M *
      (f ^ n1 * f ^ n2 *
        (algebraMap A A)
          (∑ i in attach c.support,
            acd (c ↑i) (_ : c ↑i ∈ image (⇑c) c.support) *
              Exists.choose (_ : ↑↑i ∈ ⇑(algebraMap A (Away f)) '' ↑(↑x).asHomogeneousIdeal)))
i : { x_1 // x_1 ∈ c.support }
x✝ : i ∈ attach c.support
⊢ Exists.choose (_ : ↑↑i ∈ ⇑(algebraMap A (Away f)) '' ↑(↑x).asHomogeneousIdeal) ∈
    HomogeneousIdeal.toIdeal (↑x).asHomogeneousIdeal

Next tactic:
generalize_proofs h₁ h₂