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

Proof state:
case intro.intro.intro.intro.intro.intro.right
R : Type u
inst✝ : CommRing R
U : (Opens ↑(PrimeSpectrum.Top R))ᵒᵖ
a : (x : ↥U.unop) → Localizations R ↑x
ha :
  a ∈
    {
            toSubmonoid :=
              {
                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)) },
            add_mem' :=
              (_ :
                ∀ {a b : (x : ↥U.unop) → Localizations R ↑x},
                  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 →
                    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),
                        ∃ V,
                          ∃ (_ : ↑x ∈ V),
                            ∃ i,
                              PrelocalPredicate.pred (isFractionPrelocal R) fun x =>
                                (a + b) ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)),
            zero_mem' :=
              (_ :
                ∀ (x : ↥U.unop),
                  ∃ V,
                    ∃ (_ : ↑x ∈ V),
                      ∃ i,
                        PrelocalPredicate.pred (isFractionPrelocal R) fun x =>
                          OfNat.ofNat 0
                            ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) })
                              x)) }.toSubmonoid.toSubsemigroup.carrier
x : ↥U.unop
V : Opens ↑(PrimeSpectrum.Top R)
m : ↑x ∈ V
i : V ⟶ U.unop
r s : R
w✝ :
  ∀ (x : ↥V),
    s ∉ (↑x).asIdeal ∧
      (fun x => a ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) x *
          (algebraMap R (Localizations R ↑x)) s =
        (algebraMap R (Localizations R ↑x)) r
y : ↥V
nm : s ∉ (↑y).asIdeal
w :
  (fun x => a ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) y * (algebraMap R (Localizations R ↑y)) s =
    (algebraMap R (Localizations R ↑y)) r
⊢ (fun x => (-a) ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) y *
      (algebraMap R (Localizations R ↑y)) s =
    (algebraMap R (Localizations R ↑y)) (-r)

Next tactic:
simp only [RingHom.map_neg, Pi.neg_apply]