l3lab/ntp-mathlib huggingface dataset:
instance {M : Type*} [AddCommGroup M] [Module R M] : AddCommGroup (LocalizedModule S M) :=
  { show AddCommMonoid (LocalizedModule S M) by infer_instance with
    neg := fun p =>
      liftOn p (fun x => LocalizedModule.mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
        rw [mk_eq]
        exact ⟨u, by simpa⟩
    add_left_neg := by
      

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S : Submonoid R
M✝ : Type v
inst✝³ : AddCommMonoid M✝
inst✝² : Module R M✝
M : Type u_1
inst✝¹ : AddCommGroup M
inst✝ : Module R M
src✝ : AddCommMonoid (LocalizedModule S M) :=
  let_fun this := inferInstance;
  this
⊢ ∀ (a : LocalizedModule S M), -a + a = 0

Next tactic:
rintro ⟨m, s⟩
instance {M : Type*} [AddCommGroup M] [Module R M] : AddCommGroup (LocalizedModule S M) :=
  { show AddCommMonoid (LocalizedModule S M) by infer_instance with
    neg := fun p =>
      liftOn p (fun x => LocalizedModule.mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
        rw [mk_eq]
        exact ⟨u, by simpa⟩
    add_left_neg := by
      rintro ⟨m, s⟩
      

Proof state:
case mk.mk
R : Type u
inst✝⁴ : CommSemiring R
S : Submonoid R
M✝ : Type v
inst✝³ : AddCommMonoid M✝
inst✝² : Module R M✝
M : Type u_1
inst✝¹ : AddCommGroup M
inst✝ : Module R M
src✝ : AddCommMonoid (LocalizedModule S M) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S M
m : M
s : ↥S
⊢ -Quot.mk Setoid.r (m, s) + Quot.mk Setoid.r (m, s) = 0

Next tactic:
change
        (liftOn (mk m s) (fun x => mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
              rw [mk_eq]
              exact ⟨u, by simpa⟩) +
            mk m s =
          0
instance {M : Type*} [AddCommGroup M] [Module R M] : AddCommGroup (LocalizedModule S M) :=
  { show AddCommMonoid (LocalizedModule S M) by infer_instance with
    neg := fun p =>
      liftOn p (fun x => LocalizedModule.mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
        rw [mk_eq]
        exact ⟨u, by simpa⟩
    add_left_neg := by
      rintro ⟨m, s⟩
      change
        (liftOn (mk m s) (fun x => mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
              

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S : Submonoid R
M✝ : Type v
inst✝³ : AddCommMonoid M✝
inst✝² : Module R M✝
M : Type u_1
inst✝¹ : AddCommGroup M
inst✝ : Module R M
src✝ : AddCommMonoid (LocalizedModule S M) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S M
m : M
s : ↥S
x✝² x✝¹ : M × ↥S
m1 : M
s1 : ↥S
m2 : M
s2 : ↥S
x✝ : (m1, s1) ≈ (m2, s2)
u : ↥S
hu : u • (m2, s2).2 • (m1, s1).1 = u • (m1, s1).2 • (m2, s2).1
⊢ (fun x => mk (-x.1) x.2) (m1, s1) = (fun x => mk (-x.1) x.2) (m2, s2)

Next tactic:
rw [mk_eq]
instance {M : Type*} [AddCommGroup M] [Module R M] : AddCommGroup (LocalizedModule S M) :=
  { show AddCommMonoid (LocalizedModule S M) by infer_instance with
    neg := fun p =>
      liftOn p (fun x => LocalizedModule.mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
        rw [mk_eq]
        exact ⟨u, by simpa⟩
    add_left_neg := by
      rintro ⟨m, s⟩
      change
        (liftOn (mk m s) (fun x => mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
              rw [mk_eq]
              

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S : Submonoid R
M✝ : Type v
inst✝³ : AddCommMonoid M✝
inst✝² : Module R M✝
M : Type u_1
inst✝¹ : AddCommGroup M
inst✝ : Module R M
src✝ : AddCommMonoid (LocalizedModule S M) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S M
m : M
s : ↥S
x✝² x✝¹ : M × ↥S
m1 : M
s1 : ↥S
m2 : M
s2 : ↥S
x✝ : (m1, s1) ≈ (m2, s2)
u : ↥S
hu : u • (m2, s2).2 • (m1, s1).1 = u • (m1, s1).2 • (m2, s2).1
⊢ ∃ u, u • (m2, s2).2 • -(m1, s1).1 = u • (m1, s1).2 • -(m2, s2).1

Next tactic:
exact ⟨u, by simpa⟩
instance {M : Type*} [AddCommGroup M] [Module R M] : AddCommGroup (LocalizedModule S M) :=
  { show AddCommMonoid (LocalizedModule S M) by infer_instance with
    neg := fun p =>
      liftOn p (fun x => LocalizedModule.mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
        rw [mk_eq]
        exact ⟨u, by simpa⟩
    add_left_neg := by
      rintro ⟨m, s⟩
      change
        (liftOn (mk m s) (fun x => mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
              rw [mk_eq]
              exact ⟨u, by 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S : Submonoid R
M✝ : Type v
inst✝³ : AddCommMonoid M✝
inst✝² : Module R M✝
M : Type u_1
inst✝¹ : AddCommGroup M
inst✝ : Module R M
src✝ : AddCommMonoid (LocalizedModule S M) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S M
m : M
s : ↥S
x✝² x✝¹ : M × ↥S
m1 : M
s1 : ↥S
m2 : M
s2 : ↥S
x✝ : (m1, s1) ≈ (m2, s2)
u : ↥S
hu : u • (m2, s2).2 • (m1, s1).1 = u • (m1, s1).2 • (m2, s2).1
⊢ u • (m2, s2).2 • -(m1, s1).1 = u • (m1, s1).2 • -(m2, s2).1

Next tactic:
simpa
instance {M : Type*} [AddCommGroup M] [Module R M] : AddCommGroup (LocalizedModule S M) :=
  { show AddCommMonoid (LocalizedModule S M) by infer_instance with
    neg := fun p =>
      liftOn p (fun x => LocalizedModule.mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
        rw [mk_eq]
        exact ⟨u, by simpa⟩
    add_left_neg := by
      rintro ⟨m, s⟩
      change
        (liftOn (mk m s) (fun x => mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
              rw [mk_eq]
              exact ⟨u, by simpa⟩) +
            mk m s =
          0
      

Proof state:
case mk.mk
R : Type u
inst✝⁴ : CommSemiring R
S : Submonoid R
M✝ : Type v
inst✝³ : AddCommMonoid M✝
inst✝² : Module R M✝
M : Type u_1
inst✝¹ : AddCommGroup M
inst✝ : Module R M
src✝ : AddCommMonoid (LocalizedModule S M) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S M
m : M
s : ↥S
⊢ liftOn (mk m s) (fun x => mk (-x.1) x.2)
        (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → (fun x => mk (-x.1) x.2) x = (fun x => mk (-x.1) x.2) x_1) +
      mk m s =
    0

Next tactic:
rw [liftOn_mk, mk_add_mk]
instance {M : Type*} [AddCommGroup M] [Module R M] : AddCommGroup (LocalizedModule S M) :=
  { show AddCommMonoid (LocalizedModule S M) by infer_instance with
    neg := fun p =>
      liftOn p (fun x => LocalizedModule.mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
        rw [mk_eq]
        exact ⟨u, by simpa⟩
    add_left_neg := by
      rintro ⟨m, s⟩
      change
        (liftOn (mk m s) (fun x => mk (-x.1) x.2) fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => by
              rw [mk_eq]
              exact ⟨u, by simpa⟩) +
            mk m s =
          0
      rw [liftOn_mk, mk_add_mk]
      

Proof state:
case mk.mk
R : Type u
inst✝⁴ : CommSemiring R
S : Submonoid R
M✝ : Type v
inst✝³ : AddCommMonoid M✝
inst✝² : Module R M✝
M : Type u_1
inst✝¹ : AddCommGroup M
inst✝ : Module R M
src✝ : AddCommMonoid (LocalizedModule S M) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S M
m : M
s : ↥S
⊢ mk (s • -(m, s).1 + (m, s).2 • m) ((m, s).2 * s) = 0

Next tactic:
simp
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
⊢ ∀ (p q p' q' : A × ↥S),
    p ≈ p' →
      q ≈ q' → (fun x₁ x₂ => mk (x₁.1 * x₂.1) (x₁.2 * x₂.2)) p q = (fun x₁ x₂ => mk (x₁.1 * x₂.1) (x₁.2 * x₂.2)) p' q'

Next tactic:
rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          

Proof state:
case mk.mk.mk.mk.intro.intro
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • (b₁, t₁).2 • (a₁, s₁).1 = u₁ • (a₁, s₁).2 • (b₁, t₁).1
u₂ : ↥S
e₂ : u₂ • (b₂, t₂).2 • (a₂, s₂).1 = u₂ • (a₂, s₂).2 • (b₂, t₂).1
⊢ (fun x₁ x₂ => mk (x₁.1 * x₂.1) (x₁.2 * x₂.2)) (a₁, s₁) (a₂, s₂) =
    (fun x₁ x₂ => mk (x₁.1 * x₂.1) (x₁.2 * x₂.2)) (b₁, t₁) (b₂, t₂)

Next tactic:
rw [mk_eq]
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          

Proof state:
case mk.mk.mk.mk.intro.intro
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • (b₁, t₁).2 • (a₁, s₁).1 = u₁ • (a₁, s₁).2 • (b₁, t₁).1
u₂ : ↥S
e₂ : u₂ • (b₂, t₂).2 • (a₂, s₂).1 = u₂ • (a₂, s₂).2 • (b₂, t₂).1
⊢ ∃ u,
    u • ((b₁, t₁).2 * (b₂, t₂).2) • ((a₁, s₁).1 * (a₂, s₂).1) =
      u • ((a₁, s₁).2 * (a₂, s₂).2) • ((b₁, t₁).1 * (b₂, t₂).1)

Next tactic:
use u₁ * u₂
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          

Proof state:
case h
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • (b₁, t₁).2 • (a₁, s₁).1 = u₁ • (a₁, s₁).2 • (b₁, t₁).1
u₂ : ↥S
e₂ : u₂ • (b₂, t₂).2 • (a₂, s₂).1 = u₂ • (a₂, s₂).2 • (b₂, t₂).1
⊢ (u₁ * u₂) • ((b₁, t₁).2 * (b₂, t₂).2) • ((a₁, s₁).1 * (a₂, s₂).1) =
    (u₁ * u₂) • ((a₁, s₁).2 * (a₂, s₂).2) • ((b₁, t₁).1 * (b₂, t₂).1)

Next tactic:
dsimp only at e₁ e₂ ⊢
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          

Proof state:
case h
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (t₁ * t₂) • (a₁ * a₂) = (u₁ * u₂) • (s₁ * s₂) • (b₁ * b₂)

Next tactic:
rw [eq_comm]
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          

Proof state:
case h
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (s₁ * s₂) • (b₁ * b₂) = (u₁ * u₂) • (t₁ * t₂) • (a₁ * a₂)

Next tactic:
trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (s₁ * s₂) • (b₁ * b₂) = (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ • t₁ • a₁) • u₂ • t₂ • a₂ = (u₁ * u₂) • (t₁ * t₂) • (a₁ * a₂)

Next tactic:
rw [e₁, e₂]
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          rw [e₁, e₂]; 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (s₁ * s₂) • (b₁ * b₂) = (u₁ • s₁ • b₁) • u₂ • s₂ • b₂
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ • t₁ • a₁) • u₂ • t₂ • a₂ = (u₁ * u₂) • (t₁ * t₂) • (a₁ * a₂)

Next tactic:
swap
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          rw [e₁, e₂]; swap; 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ • t₁ • a₁) • u₂ • t₂ • a₂ = (u₁ * u₂) • (t₁ * t₂) • (a₁ * a₂)
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (s₁ * s₂) • (b₁ * b₂) = (u₁ • s₁ • b₁) • u₂ • s₂ • b₂

Next tactic:
rw [eq_comm]
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          rw [e₁, e₂]; swap; rw [eq_comm]
          

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (t₁ * t₂) • (a₁ * a₂) = (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (s₁ * s₂) • (b₁ * b₂) = (u₁ • s₁ • b₁) • u₂ • s₂ • b₂

Next tactic:
all_goals
            rw [smul_smul, mul_mul_mul_comm, ← smul_eq_mul, ← smul_eq_mul A, smul_smul_smul_comm,
              mul_smul, mul_smul]
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          rw [e₁, e₂]; swap; rw [eq_comm]
          all_goals
            

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (t₁ * t₂) • (a₁ * a₂) = (u₁ • t₁ • a₁) • u₂ • t₂ • a₂

Next tactic:
rw [smul_smul, mul_mul_mul_comm, ← smul_eq_mul, ← smul_eq_mul A, smul_smul_smul_comm,
              mul_smul, mul_smul]
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          rw [e₁, e₂]; swap; rw [eq_comm]
          all_goals
            

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
m₁ m₂ : LocalizedModule S A
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
b₁ : A
t₁ : ↥S
b₂ : A
t₂ u₁ : ↥S
e₁ : u₁ • t₁ • a₁ = u₁ • s₁ • b₁
u₂ : ↥S
e₂ : u₂ • t₂ • a₂ = u₂ • s₂ • b₂
⊢ (u₁ * u₂) • (s₁ * s₂) • (b₁ * b₂) = (u₁ • s₁ • b₁) • u₂ • s₂ • b₂

Next tactic:
rw [smul_smul, mul_mul_mul_comm, ← smul_eq_mul, ← smul_eq_mul A, smul_smul_smul_comm,
              mul_smul, mul_smul]
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          rw [e₁, e₂]; swap; rw [eq_comm]
          all_goals
            rw [smul_smul, mul_mul_mul_comm, ← smul_eq_mul, ← smul_eq_mul A, smul_smul_smul_comm,
              mul_smul, mul_smul])
    one := mk 1 (1 : S)
    one_mul := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, by simp only [one_mul, one_smul]⟩
    mul_one := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, by simp only [mul_one, one_smul]⟩
    mul_assoc := by
      

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
⊢ ∀ (a b c : LocalizedModule S A), a * b * c = a * (b * c)

Next tactic:
rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨a₃, s₃⟩
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          rw [e₁, e₂]; swap; rw [eq_comm]
          all_goals
            rw [smul_smul, mul_mul_mul_comm, ← smul_eq_mul, ← smul_eq_mul A, smul_smul_smul_comm,
              mul_smul, mul_smul])
    one := mk 1 (1 : S)
    one_mul := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, by simp only [one_mul, one_smul]⟩
    mul_one := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, by simp only [mul_one, one_smul]⟩
    mul_assoc := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨a₃, s₃⟩
      

Proof state:
case mk.mk.mk.mk.mk.mk
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
a✝ : LocalizedModule S A
a₁ : A
s₁ : ↥S
b✝ : LocalizedModule S A
a₂ : A
s₂ : ↥S
c✝ : LocalizedModule S A
a₃ : A
s₃ : ↥S
⊢ Quot.mk Setoid.r (a₁, s₁) * Quot.mk Setoid.r (a₂, s₂) * Quot.mk Setoid.r (a₃, s₃) =
    Quot.mk Setoid.r (a₁, s₁) * (Quot.mk Setoid.r (a₂, s₂) * Quot.mk Setoid.r (a₃, s₃))

Next tactic:
apply mk_eq.mpr _
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Monoid (LocalizedModule S A) :=
  { mul := fun m₁ m₂ =>
      liftOn₂ m₁ m₂ (fun x₁ x₂ => LocalizedModule.mk (x₁.1 * x₂.1) (x₁.2 * x₂.2))
        (by
          rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨b₁, t₁⟩ ⟨b₂, t₂⟩ ⟨u₁, e₁⟩ ⟨u₂, e₂⟩
          rw [mk_eq]
          use u₁ * u₂
          dsimp only at e₁ e₂ ⊢
          rw [eq_comm]
          trans (u₁ • t₁ • a₁) • u₂ • t₂ • a₂
          rw [e₁, e₂]; swap; rw [eq_comm]
          all_goals
            rw [smul_smul, mul_mul_mul_comm, ← smul_eq_mul, ← smul_eq_mul A, smul_smul_smul_comm,
              mul_smul, mul_smul])
    one := mk 1 (1 : S)
    one_mul := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, by simp only [one_mul, one_smul]⟩
    mul_one := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, by simp only [mul_one, one_smul]⟩
    mul_assoc := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨a₃, s₃⟩
      apply mk_eq.mpr _
      

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
S✝ : Submonoid R
M : Type v
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
a✝ : LocalizedModule S A
a₁ : A
s₁ : ↥S
b✝ : LocalizedModule S A
a₂ : A
s₂ : ↥S
c✝ : LocalizedModule S A
a₃ : A
s₃ : ↥S
⊢ ∃ u,
    u •
        ((a₁, s₁).2 * ((a₂, s₂).1 * (a₃, s₃).1, (a₂, s₂).2 * (a₃, s₃).2).2) •
          (((a₁, s₁).1 * (a₂, s₂).1, (a₁, s₁).2 * (a₂, s₂).2).1 * (a₃, s₃).1) =
      u •
        (((a₁, s₁).1 * (a₂, s₂).1, (a₁, s₁).2 * (a₂, s₂).2).2 * (a₃, s₃).2) •
          ((a₁, s₁).1 * ((a₂, s₂).1 * (a₃, s₃).1, (a₂, s₂).2 * (a₃, s₃).2).1)

Next tactic:
use 1