/-- 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]
      

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 ∈
    {
          toSubsemigroup :=
            { carrier := {f | PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate f},
              mul_mem' :=
                (_ :
                  ∀ {a b : (x : ↥U.unop) → Localizations R ↑x},
                    a ∈ {f | PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate f} →
                      b ∈ {f | PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate f} →
                        ∀ (x : ↥U.unop),
                          ∃ V,
                            ∃ (_ : ↑x ∈ V),
                              ∃ i,
                                PrelocalPredicate.pred (isFractionPrelocal R) fun x =>
                                  (a * b) ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) },
          one_mem' :=
            (_ :
              ∀ (x : ↥U.unop),
                ∃ V,
                  ∃ (_ : ↑x ∈ V),
                    ∃ i,
                      PrelocalPredicate.pred (isFractionPrelocal R) fun x =>
                        OfNat.ofNat 1
                          ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) }.toSubsemigroup.carrier
hb :
  b ∈
    {
          toSubsemigroup :=
            { carrier := {f | PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate f},
              mul_mem' :=
                (_ :
                  ∀ {a b : (x : ↥U.unop) → Localizations R ↑x},
                    a ∈ {f | PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate f} →
                      b ∈ {f | PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate f} →
                        ∀ (x : ↥U.unop),
                          ∃ V,
                            ∃ (_ : ↑x ∈ V),
                              ∃ i,
                                PrelocalPredicate.pred (isFractionPrelocal R) fun x =>
                                  (a * b) ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) },
          one_mem' :=
            (_ :
              ∀ (x : ↥U.unop),
                ∃ V,
                  ∃ (_ : ↑x ∈ V),
                    ∃ i,
                      PrelocalPredicate.pred (isFractionPrelocal R) fun x =>
                        OfNat.ofNat 1
                          ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) }.toSubsemigroup.carrier
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) } *
        ((algebraMap R (Localizations R ↑y)) sa * (algebraMap R (Localizations R ↑y)) sb) +
      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 *
        (algebraMap R (Localizations R ↑y)) sb +
      (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 ↑y)) sa

Next tactic:
simp only [mul_assoc]