/-- The functions satisfying `isLocallyFraction` form a subring.
-/
def sectionsSubring (U : (Opens (PrimeSpectrum.Top R))ᵒᵖ) :
    Subring (∀ x : U.unop, Localizations R x) where
  carrier := { f | (isLocallyFraction R).pred f }
  zero_mem' := by
    refine' fun x => ⟨unop U, x.2, 𝟙 _, 0, 1, fun y => ⟨_, _⟩⟩
    · rw [← Ideal.ne_top_iff_one]; exact y.1.IsPrime.1
    · simp
  one_mem' := by
    refine' fun x => ⟨unop U, x.2, 𝟙 _, 1, 1, fun y => ⟨_, _⟩⟩
    · rw [← Ideal.ne_top_iff_one]; exact y.1.IsPrime.1
    · simp
  add_mem' := by
    intro a b ha hb x
    rcases ha x with ⟨Va, ma, ia, ra, sa, wa⟩
    rcases hb x with ⟨Vb, mb, ib, rb, sb, wb⟩
    refine' ⟨Va ⊓ Vb, ⟨ma, mb⟩, Opens.infLELeft _ _ ≫ ia, ra * sb + rb * sa, sa * sb, _⟩
    intro y
    rcases wa (Opens.infLELeft _ _ y) with ⟨nma, wa⟩
    rcases wb (Opens.infLERight _ _ y) with ⟨nmb, wb⟩
    fconstructor
    · intro H; cases y.1.IsPrime.mem_or_mem H <;> contradiction
    · simp only [add_mul, RingHom.map_add, Pi.add_apply, RingHom.map_mul]
      erw [← wa, ← wb]
      simp only [mul_assoc]
      congr 2
      rw [mul_comm]
  neg_mem' := by
    intro a ha x
    rcases ha x with ⟨V, m, i, r, s, w⟩
    refine' ⟨V, m, i, -r, s, _⟩
    intro y
    rcases w y with ⟨nm, w⟩
    fconstructor
    · exact nm
    · simp only [RingHom.map_neg, Pi.neg_apply]
      erw [← w]
      simp only [neg_mul]
  mul_mem' := by
    intro a b ha hb x
    rcases ha x with ⟨Va, ma, ia, ra, sa, wa⟩
    rcases hb x with ⟨Vb, mb, ib, rb, sb, wb⟩
    refine' ⟨Va ⊓ Vb, ⟨ma, mb⟩, Opens.infLELeft _ _ ≫ ia, ra * rb, sa * sb, _⟩
    intro y
    rcases wa (Opens.infLELeft _ _ y) with ⟨nma, wa⟩
    rcases wb (Opens.infLERight _ _ y) with ⟨nmb, wb⟩
    fconstructor
    · intro H; cases y.1.IsPrime.mem_or_mem H <;> contradiction
    · simp only [Pi.mul_apply, RingHom.map_mul]
      erw [← wa, ← wb]
      

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.right
R : Type u
inst✝ : CommRing R
U : (Opens ↑(PrimeSpectrum.Top R))ᵒᵖ
a b : (x : ↥U.unop) → Localizations R ↑x
ha : a ∈ {f | PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate f}
hb : b ∈ {f | PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate f}
x : ↥U.unop
Va : Opens ↑(PrimeSpectrum.Top R)
ma : ↑x ∈ Va
ia : Va ⟶ U.unop
ra sa : R
wa✝ :
  ∀ (x : ↥Va),
    sa ∉ (↑x).asIdeal ∧
      (fun x => a ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) x *
          (algebraMap R (Localizations R ↑x)) sa =
        (algebraMap R (Localizations R ↑x)) ra
Vb : Opens ↑(PrimeSpectrum.Top R)
mb : ↑x ∈ Vb
ib : Vb ⟶ U.unop
rb sb : R
wb✝ :
  ∀ (x : ↥Vb),
    sb ∉ (↑x).asIdeal ∧
      (fun x => b ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) x *
          (algebraMap R (Localizations R ↑x)) sb =
        (algebraMap R (Localizations R ↑x)) rb
y : ↥(Va ⊓ Vb)
nma : sa ∉ (↑((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Va) }) y)).asIdeal
wa :
  (fun x => a ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x))
        ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Va) }) y) *
      (algebraMap R (Localizations R ↑((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Va) }) y))) sa =
    (algebraMap R (Localizations R ↑((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Va) }) y))) ra
nmb : sb ∉ (↑((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Vb) }) y)).asIdeal
wb :
  (fun x => b ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x))
        ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Vb) }) y) *
      (algebraMap R (Localizations R ↑((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Vb) }) y))) sb =
    (algebraMap R (Localizations R ↑((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Vb) }) y))) rb
⊢ a { val := ↑y, property := (_ : ↑y ∈ ↑U.unop) } * b { val := ↑y, property := (_ : ↑y ∈ ↑U.unop) } *
      ((algebraMap R (Localizations R ↑y)) sa * (algebraMap R (Localizations R ↑y)) sb) =
    (fun x => a ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x))
          ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Va) }) y) *
        (algebraMap R (Localizations R ↑((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Va) }) y))) sa *
      ((fun x => b ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x))
          ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Vb) }) y) *
        (algebraMap R (Localizations R ↑((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑Vb) }) y))) sb)

Next tactic:
simp only [mul_left_comm, mul_assoc, mul_comm]