l3lab/ntp-mathlib huggingface dataset:
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Semiring (LocalizedModule S A) :=
  { show (AddCommMonoid (LocalizedModule S A)) by infer_instance,
    show (Monoid (LocalizedModule S A)) by infer_instance with
    left_distrib := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨a₃, s₃⟩
      apply mk_eq.mpr _
      use 1
      simp only [one_mul, smul_add, mul_add, mul_smul_comm, smul_smul, ← mul_assoc,
        mul_right_comm]
    right_distrib := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨a₃, s₃⟩
      apply mk_eq.mpr _
      use 1
      simp only [one_mul, smul_add, add_mul, smul_smul, ← mul_assoc, smul_mul_assoc,
        mul_right_comm]
    zero_mul := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, by simp only [zero_mul, smul_zero]⟩
    mul_zero := by
      rintro ⟨a, 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
A : Type u_1
inst✝¹ : Semiring A
inst✝ : Algebra R A
S : Submonoid R
src✝¹ : AddCommMonoid (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
src✝ : Monoid (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S A
a : A
s : ↥S
⊢ Quot.mk Setoid.r (a, s) * 0 = 0

Next tactic:
exact mk_eq.mpr ⟨1, by simp only [mul_zero, smul_zero]⟩
instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} :
    Semiring (LocalizedModule S A) :=
  { show (AddCommMonoid (LocalizedModule S A)) by infer_instance,
    show (Monoid (LocalizedModule S A)) by infer_instance with
    left_distrib := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨a₃, s₃⟩
      apply mk_eq.mpr _
      use 1
      simp only [one_mul, smul_add, mul_add, mul_smul_comm, smul_smul, ← mul_assoc,
        mul_right_comm]
    right_distrib := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩ ⟨a₃, s₃⟩
      apply mk_eq.mpr _
      use 1
      simp only [one_mul, smul_add, add_mul, smul_smul, ← mul_assoc, smul_mul_assoc,
        mul_right_comm]
    zero_mul := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, by simp only [zero_mul, smul_zero]⟩
    mul_zero := by
      rintro ⟨a, s⟩
      exact mk_eq.mpr ⟨1, 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
src✝¹ : AddCommMonoid (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
src✝ : Monoid (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S A
a : A
s : ↥S
⊢ 1 • 1 • ((a, s).1 * (0, 1).1) = 1 • ((a, s).2 * (0, 1).2) • 0

Next tactic:
simp only [mul_zero, smul_zero]
instance {A : Type*} [CommSemiring A] [Algebra R A] {S : Submonoid R} :
    CommSemiring (LocalizedModule S A) :=
  { show Semiring (LocalizedModule S A) 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✝¹ : CommSemiring A
inst✝ : Algebra R A
S : Submonoid R
⊢ Semiring (LocalizedModule S A)

Next tactic:
infer_instance
instance {A : Type*} [CommSemiring A] [Algebra R A] {S : Submonoid R} :
    CommSemiring (LocalizedModule S A) :=
  { show Semiring (LocalizedModule S A) by infer_instance with
    mul_comm := 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✝¹ : CommSemiring A
inst✝ : Algebra R A
S : Submonoid R
src✝ : Semiring (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
⊢ ∀ (a b : LocalizedModule S A), a * b = b * a

Next tactic:
rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩
instance {A : Type*} [CommSemiring A] [Algebra R A] {S : Submonoid R} :
    CommSemiring (LocalizedModule S A) :=
  { show Semiring (LocalizedModule S A) by infer_instance with
    mul_comm := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩
      

Proof state:
case 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✝¹ : CommSemiring A
inst✝ : Algebra R A
S : Submonoid R
src✝ : Semiring (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S A
a₁ : A
s₁ : ↥S
b✝ : 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₁)

Next tactic:
exact mk_eq.mpr ⟨1, by simp only [one_smul, mul_comm]⟩
instance {A : Type*} [CommSemiring A] [Algebra R A] {S : Submonoid R} :
    CommSemiring (LocalizedModule S A) :=
  { show Semiring (LocalizedModule S A) by infer_instance with
    mul_comm := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩
      exact mk_eq.mpr ⟨1, 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✝¹ : CommSemiring A
inst✝ : Algebra R A
S : Submonoid R
src✝ : Semiring (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S A
a₁ : A
s₁ : ↥S
b✝ : LocalizedModule S A
a₂ : A
s₂ : ↥S
⊢ 1 • ((a₂, s₂).2 * (a₁, s₁).2) • ((a₁, s₁).1 * (a₂, s₂).1) = 1 • ((a₁, s₁).2 * (a₂, s₂).2) • ((a₂, s₂).1 * (a₁, s₁).1)

Next tactic:
simp only [one_smul, mul_comm]
instance {A : Type*} [CommRing A] [Algebra R A] {S : Submonoid R} :
    CommRing (LocalizedModule S A) :=
  { show (Ring (LocalizedModule S A)) 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✝¹ : CommRing A
inst✝ : Algebra R A
S : Submonoid R
⊢ Ring (LocalizedModule S A)

Next tactic:
infer_instance
instance {A : Type*} [CommRing A] [Algebra R A] {S : Submonoid R} :
    CommRing (LocalizedModule S A) :=
  { show (Ring (LocalizedModule S A)) by infer_instance with
    mul_comm := 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✝¹ : CommRing A
inst✝ : Algebra R A
S : Submonoid R
src✝ : Ring (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
⊢ ∀ (a b : LocalizedModule S A), a * b = b * a

Next tactic:
rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩
instance {A : Type*} [CommRing A] [Algebra R A] {S : Submonoid R} :
    CommRing (LocalizedModule S A) :=
  { show (Ring (LocalizedModule S A)) by infer_instance with
    mul_comm := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩
      

Proof state:
case 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✝¹ : CommRing A
inst✝ : Algebra R A
S : Submonoid R
src✝ : Ring (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S A
a₁ : A
s₁ : ↥S
b✝ : 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₁)

Next tactic:
exact mk_eq.mpr ⟨1, by simp only [one_smul, mul_comm]⟩
instance {A : Type*} [CommRing A] [Algebra R A] {S : Submonoid R} :
    CommRing (LocalizedModule S A) :=
  { show (Ring (LocalizedModule S A)) by infer_instance with
    mul_comm := by
      rintro ⟨a₁, s₁⟩ ⟨a₂, s₂⟩
      exact mk_eq.mpr ⟨1, 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✝¹ : CommRing A
inst✝ : Algebra R A
S : Submonoid R
src✝ : Ring (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
a✝ : LocalizedModule S A
a₁ : A
s₁ : ↥S
b✝ : LocalizedModule S A
a₂ : A
s₂ : ↥S
⊢ 1 • ((a₂, s₂).2 * (a₁, s₁).2) • ((a₁, s₁).1 * (a₂, s₂).1) = 1 • ((a₁, s₁).2 * (a₂, s₂).2) • ((a₂, s₂).1 * (a₁, s₁).1)

Next tactic:
simp only [one_smul, mul_comm]
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
x : LocalizedModule S M
r : R
s : ↥S
⊢ ∀ (p p' : M × ↥S), p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'

Next tactic:
rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            

Proof state:
case mk.mk.intro
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
x : LocalizedModule S M
r : R
s : ↥S
m1 : M
t1 : ↥S
m2 : M
t2 u : ↥S
h : u • (m2, t2).2 • (m1, t1).1 = u • (m1, t1).2 • (m2, t2).1
⊢ (fun p => mk (r • p.1) (s * p.2)) (m1, t1) = (fun p => mk (r • p.1) (s * p.2)) (m2, t2)

Next tactic:
refine' mk_eq.mpr ⟨u, _⟩
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            

Proof state:
case mk.mk.intro
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
x : LocalizedModule S M
r : R
s : ↥S
m1 : M
t1 : ↥S
m2 : M
t2 u : ↥S
h : u • (m2, t2).2 • (m1, t1).1 = u • (m1, t1).2 • (m2, t2).1
⊢ u • (s * (m2, t2).2) • r • (m1, t1).1 = u • (s * (m1, t1).2) • r • (m2, t2).1

Next tactic:
have h' := congr_arg ((s • r) • ·) h
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            

Proof state:
case mk.mk.intro
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
x : LocalizedModule S M
r : R
s : ↥S
m1 : M
t1 : ↥S
m2 : M
t2 u : ↥S
h : u • (m2, t2).2 • (m1, t1).1 = u • (m1, t1).2 • (m2, t2).1
h' : (fun x => (s • r) • x) (u • (m2, t2).2 • (m1, t1).1) = (fun x => (s • r) • x) (u • (m1, t1).2 • (m2, t2).1)
⊢ u • (s * (m2, t2).2) • r • (m1, t1).1 = u • (s * (m1, t1).2) • r • (m2, t2).1

Next tactic:
simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            

Proof state:
case mk.mk.intro
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
x : LocalizedModule S M
r : R
s : ↥S
m1 : M
t1 : ↥S
m2 : M
t2 u : ↥S
h : u • (m2, t2).2 • (m1, t1).1 = u • (m1, t1).2 • (m2, t2).1
h' : (r * (↑s * (↑t2 * ↑u))) • m1 = (r * (↑s * (↑t1 * ↑u))) • m2
⊢ (r * (↑s * (↑t2 * ↑u))) • m1 = (r * (↑s * (↑t1 * ↑u))) • m2

Next tactic:
rw [h']
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
x : LocalizedModule S M
⊢ ∀ {a c : R} {b d : ↥S},
    (Localization.r S) (a, b) (c, d) →
      (fun r s =>
            liftOn x (fun p => mk (r • p.1) (s * p.2))
              (_ :
                ∀ (p p' : M × ↥S), p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
          a b =
        (fun r s =>
            liftOn x (fun p => mk (r • p.1) (s * p.2))
              (_ :
                ∀ (p p' : M × ↥S), p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
          c d

Next tactic:
induction' x using LocalizedModule.induction_on with m t
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        induction' x using LocalizedModule.induction_on with m t
        

Proof state:
case h
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
m : M
t : ↥S
⊢ ∀ {a c : R} {b d : ↥S},
    (Localization.r S) (a, b) (c, d) →
      (fun r s =>
            liftOn (mk m t) (fun p => mk (r • p.1) (s * p.2))
              (_ :
                ∀ (p p' : M × ↥S), p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
          a b =
        (fun r s =>
            liftOn (mk m t) (fun p => mk (r • p.1) (s * p.2))
              (_ :
                ∀ (p p' : M × ↥S), p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
          c d

Next tactic:
rintro r r' s s' h
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        induction' x using LocalizedModule.induction_on with m t
        rintro r r' s s' h
        

Proof state:
case h
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
m : M
t : ↥S
r r' : R
s s' : ↥S
h : (Localization.r S) (r, s) (r', s')
⊢ (fun r s =>
        liftOn (mk m t) (fun p => mk (r • p.1) (s * p.2))
          (_ : ∀ (p p' : M × ↥S), p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
      r s =
    (fun r s =>
        liftOn (mk m t) (fun p => mk (r • p.1) (s * p.2))
          (_ : ∀ (p p' : M × ↥S), p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
      r' s'

Next tactic:
simp only [liftOn_mk, liftOn_mk, mk_eq]
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        induction' x using LocalizedModule.induction_on with m t
        rintro r r' s s' h
        simp only [liftOn_mk, liftOn_mk, mk_eq]
        

Proof state:
case h
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
m : M
t : ↥S
r r' : R
s s' : ↥S
h : (Localization.r S) (r, s) (r', s')
⊢ ∃ u, u • (s' * t) • r • m = u • (s * t) • r' • m

Next tactic:
obtain ⟨u, eq1⟩ := Localization.r_iff_exists.mp h
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        induction' x using LocalizedModule.induction_on with m t
        rintro r r' s s' h
        simp only [liftOn_mk, liftOn_mk, mk_eq]
        obtain ⟨u, eq1⟩ := Localization.r_iff_exists.mp h
        

Proof state:
case h.intro
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
m : M
t : ↥S
r r' : R
s s' : ↥S
h : (Localization.r S) (r, s) (r', s')
u : ↥S
eq1 : ↑u * (↑(r', s').2 * (r, s).1) = ↑u * (↑(r, s).2 * (r', s').1)
⊢ ∃ u, u • (s' * t) • r • m = u • (s * t) • r' • m

Next tactic:
use u
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        induction' x using LocalizedModule.induction_on with m t
        rintro r r' s s' h
        simp only [liftOn_mk, liftOn_mk, mk_eq]
        obtain ⟨u, eq1⟩ := Localization.r_iff_exists.mp h
        use u
        

Proof state:
case h
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
m : M
t : ↥S
r r' : R
s s' : ↥S
h : (Localization.r S) (r, s) (r', s')
u : ↥S
eq1 : ↑u * (↑(r', s').2 * (r, s).1) = ↑u * (↑(r, s).2 * (r', s').1)
⊢ u • (s' * t) • r • m = u • (s * t) • r' • m

Next tactic:
have eq1' := congr_arg (· • t • m) eq1
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        induction' x using LocalizedModule.induction_on with m t
        rintro r r' s s' h
        simp only [liftOn_mk, liftOn_mk, mk_eq]
        obtain ⟨u, eq1⟩ := Localization.r_iff_exists.mp h
        use u
        have eq1' := congr_arg (· • t • m) eq1
        

Proof state:
case h
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
m : M
t : ↥S
r r' : R
s s' : ↥S
h : (Localization.r S) (r, s) (r', s')
u : ↥S
eq1 : ↑u * (↑(r', s').2 * (r, s).1) = ↑u * (↑(r, s).2 * (r', s').1)
eq1' : (fun x => x • t • m) (↑u * (↑(r', s').2 * (r, s).1)) = (fun x => x • t • m) (↑u * (↑(r, s).2 * (r', s').1))
⊢ u • (s' * t) • r • m = u • (s * t) • r' • m

Next tactic:
simp only [← mul_smul, smul_assoc, Submonoid.smul_def, Submonoid.coe_mul] at eq1' ⊢
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        induction' x using LocalizedModule.induction_on with m t
        rintro r r' s s' h
        simp only [liftOn_mk, liftOn_mk, mk_eq]
        obtain ⟨u, eq1⟩ := Localization.r_iff_exists.mp h
        use u
        have eq1' := congr_arg (· • t • m) eq1
        simp only [← mul_smul, smul_assoc, Submonoid.smul_def, Submonoid.coe_mul] at eq1' ⊢
        

Proof state:
case h
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
m : M
t : ↥S
r r' : R
s s' : ↥S
h : (Localization.r S) (r, s) (r', s')
u : ↥S
eq1 : ↑u * (↑(r', s').2 * (r, s).1) = ↑u * (↑(r, s).2 * (r', s').1)
eq1' : (↑u * (↑s' * r) * ↑t) • m = (↑u * (↑s * r') * ↑t) • m
⊢ (↑u * (↑s' * ↑t * r)) • m = (↑u * (↑s * ↑t * r')) • m

Next tactic:
ring_nf at eq1' ⊢
instance : SMul (Localization S) (LocalizedModule S M) where
  smul f x :=
    (Localization.liftOn f
      (fun r s =>
        (liftOn x (fun p => (mk (r • p.1) (s * p.2)))
          (by
            rintro ⟨m1, t1⟩ ⟨m2, t2⟩ ⟨u, h⟩
            refine' mk_eq.mpr ⟨u, _⟩
            have h' := congr_arg ((s • r) • ·) h
            simp only [← mul_smul, smul_eq_mul, mul_comm, mul_left_comm, Submonoid.smul_def,
              Submonoid.coe_mul] at h' ⊢
            rw [h'])))
      (by
        induction' x using LocalizedModule.induction_on with m t
        rintro r r' s s' h
        simp only [liftOn_mk, liftOn_mk, mk_eq]
        obtain ⟨u, eq1⟩ := Localization.r_iff_exists.mp h
        use u
        have eq1' := congr_arg (· • t • m) eq1
        simp only [← mul_smul, smul_assoc, Submonoid.smul_def, Submonoid.coe_mul] at eq1' ⊢
        ring_nf at eq1' ⊢
        

Proof state:
case h
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : Localization S
m : M
t : ↥S
r r' : R
s s' : ↥S
h : (Localization.r S) (r, s) (r', s')
u : ↥S
eq1 : ↑u * (↑(r', s').2 * (r, s).1) = ↑u * (↑(r, s).2 * (r', s').1)
eq1' : (↑u * ↑s' * r * ↑t) • m = (↑u * ↑t * ↑s * r') • m
⊢ (↑u * ↑s' * r * ↑t) • m = (↑u * ↑t * ↑s * r') • m

Next tactic:
rw [eq1']
theorem mk_smul_mk (r : R) (m : M) (s t : S) :
    Localization.mk r s • mk m t = mk (r • m) (s * t) := by
  

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
r : R
m : M
s t : ↥S
⊢ Localization.mk r s • mk m t = mk (r • m) (s * t)

Next tactic:
dsimp only [HSMul.hSMul, SMul.smul]
theorem mk_smul_mk (r : R) (m : M) (s t : S) :
    Localization.mk r s • mk m t = mk (r • m) (s * t) := by
  dsimp only [HSMul.hSMul, SMul.smul]
  

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
r : R
m : M
s t : ↥S
⊢ Localization.liftOn (Localization.mk r s)
      (fun r s =>
        liftOn (mk m t) (fun p => mk (SMul.smul r p.1) (s * p.2))
          (_ : ∀ (p p' : M × ↥S), p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
      (_ :
        ∀ {a c : R} {b d : ↥S},
          (Localization.r S) (a, b) (c, d) →
            (fun r s =>
                  liftOn (mk m t) (fun p => mk (r • p.1) (s * p.2))
                    (_ :
                      ∀ (p p' : M × ↥S),
                        p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
                a b =
              (fun r s =>
                  liftOn (mk m t) (fun p => mk (r • p.1) (s * p.2))
                    (_ :
                      ∀ (p p' : M × ↥S),
                        p ≈ p' → (fun p => mk (r • p.1) (s * p.2)) p = (fun p => mk (r • p.1) (s * p.2)) p'))
                c d) =
    mk (SMul.smul r m) (s * t)

Next tactic:
rw [Localization.liftOn_mk, liftOn_mk]
private theorem one_smul' (m : LocalizedModule S M) : (1 : Localization S) • m = m := by
  

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
m : LocalizedModule S M
⊢ 1 • m = m

Next tactic:
induction' m using LocalizedModule.induction_on with m s