theorem preimage_eq (a b : A) (k : ℕ) (a_mem : a ∈ 𝒜 k) (b_mem1 : b ∈ 𝒜 k)
    (b_mem2 : b ∈ Submonoid.powers f) :
    toFun f ⁻¹'
        (@PrimeSpectrum.basicOpen (A⁰_ f) _ (Quotient.mk'' ⟨k, ⟨a, a_mem⟩, ⟨b, b_mem1⟩, b_mem2⟩) :
          Set (PrimeSpectrum (HomogeneousLocalization.Away 𝒜 f))) =
      {x | x.1 ∈ (pbo f) ⊓ pbo a} := by
  classical
  ext1 y
  constructor <;> intro hy
  · refine' ⟨y.2, _⟩
    rw [Set.mem_preimage, SetLike.mem_coe, PrimeSpectrum.mem_basicOpen] at hy
    rw [ProjectiveSpectrum.mem_coe_basicOpen]
    intro a_mem_y
    apply hy
    rw [toFun, mem_carrier_iff, HomogeneousLocalization.val_mk'', Subtype.coe_mk]
    dsimp; rcases b_mem2 with ⟨k, hk⟩
    dsimp at hk
    simp only [show (mk a ⟨b, ⟨k, hk⟩⟩ : Away f) =
      Localization.mk 1 (⟨f ^ k, ⟨_, rfl⟩⟩ : Submonoid.powers f) * mk a 1 by
        rw [mk_mul, one_mul, mul_one]; congr; rw [hk]]
    exact Ideal.mul_mem_left _ _ (Ideal.subset_span ⟨_, a_mem_y, rfl⟩)
  · change y.1 ∈ ProjectiveSpectrum.basicOpen 𝒜 f ⊓ ProjectiveSpectrum.basicOpen 𝒜 a at hy
    rcases hy with ⟨hy1, hy2⟩
    rw [ProjectiveSpectrum.mem_coe_basicOpen] at hy1 hy2
    rw [Set.mem_preimage, toFun, SetLike.mem_coe, PrimeSpectrum.mem_basicOpen]
    intro rid; dsimp at rid
    rcases MemCarrier.clear_denominator _ rid with ⟨c, N, acd, eq1⟩
    rw [Algebra.smul_def] at eq1
    change Localization.mk (f ^ N) 1 * Localization.mk _ _ = Localization.mk _ _ at eq1
    rw [mk_mul, one_mul, mk_eq_mk', IsLocalization.eq] at eq1
    rcases eq1 with ⟨⟨_, ⟨M, rfl⟩⟩, eq1⟩
    rw [Submonoid.coe_one, one_mul] at eq1
    simp only [Subtype.coe_mk] at eq1
    have : a * f ^ N * f ^ M ∈ y.val.asHomogeneousIdeal.toIdeal := by
      rw [mul_comm _ (f ^ N), mul_comm _ (f ^ M), eq1]
      refine' mul_mem_left _ _ (mul_mem_left _ _ (sum_mem _ fun i _ => mul_mem_left _ _ _))
      generalize_proofs h₁ h₂; exact (Classical.choose_spec h₂).1
    rcases y.1.isPrime.mem_or_mem this with (H1 | H3)
    

Proof state:
case h.mpr.intro.intro.intro.intro.intro.mk.intro.inl
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)))))
a b : A
k : ℕ
a_mem : a ∈ 𝒜 k
b_mem1 : b ∈ 𝒜 k
b_mem2 : b ∈ Submonoid.powers f
y : ↑↑(LocallyRingedSpace.restrict Proj (_ : OpenEmbedding ⇑(Opens.inclusion (pbo f)))).toSheafedSpace.toPresheafedSpace
hy1 : f ∉ (↑y).asHomogeneousIdeal
hy2 : a ∉ (↑y).asHomogeneousIdeal
rid :
  Quotient.mk''
      { deg := k, num := { val := a, property := a_mem }, den := { val := b, property := b_mem1 }, den_mem := b_mem2 } ∈
    carrier y
c : ↑(⇑(algebraMap A (Away f)) '' ↑(↑y).asHomogeneousIdeal) →₀ Away f
N : ℕ
acd : (y_1 : Away f) → y_1 ∈ image (⇑c) c.support → A
M : ℕ
eq1 :
  f ^ M * (f ^ N * a) =
    f ^ M *
      (b *
        (algebraMap A A)
          (∑ i in attach c.support,
            acd (c ↑i) (_ : c ↑i ∈ image (⇑c) c.support) *
              Exists.choose (_ : ↑↑i ∈ ⇑(algebraMap A (Away f)) '' ↑(↑y).asHomogeneousIdeal)))
this : a * f ^ N * f ^ M ∈ HomogeneousIdeal.toIdeal (↑y).asHomogeneousIdeal
H1 : a * f ^ N ∈ HomogeneousIdeal.toIdeal (↑y).asHomogeneousIdeal
⊢ False
case h.mpr.intro.intro.intro.intro.intro.mk.intro.inr
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)))))
a b : A
k : ℕ
a_mem : a ∈ 𝒜 k
b_mem1 : b ∈ 𝒜 k
b_mem2 : b ∈ Submonoid.powers f
y : ↑↑(LocallyRingedSpace.restrict Proj (_ : OpenEmbedding ⇑(Opens.inclusion (pbo f)))).toSheafedSpace.toPresheafedSpace
hy1 : f ∉ (↑y).asHomogeneousIdeal
hy2 : a ∉ (↑y).asHomogeneousIdeal
rid :
  Quotient.mk''
      { deg := k, num := { val := a, property := a_mem }, den := { val := b, property := b_mem1 }, den_mem := b_mem2 } ∈
    carrier y
c : ↑(⇑(algebraMap A (Away f)) '' ↑(↑y).asHomogeneousIdeal) →₀ Away f
N : ℕ
acd : (y_1 : Away f) → y_1 ∈ image (⇑c) c.support → A
M : ℕ
eq1 :
  f ^ M * (f ^ N * a) =
    f ^ M *
      (b *
        (algebraMap A A)
          (∑ i in attach c.support,
            acd (c ↑i) (_ : c ↑i ∈ image (⇑c) c.support) *
              Exists.choose (_ : ↑↑i ∈ ⇑(algebraMap A (Away f)) '' ↑(↑y).asHomogeneousIdeal)))
this : a * f ^ N * f ^ M ∈ HomogeneousIdeal.toIdeal (↑y).asHomogeneousIdeal
H3 : f ^ M ∈ HomogeneousIdeal.toIdeal (↑y).asHomogeneousIdeal
⊢ False

Next tactic:
rcases y.1.isPrime.mem_or_mem H1 with (H1 | H2)