l3lab/ntp-mathlib huggingface dataset:
instance {A : Type*} [Semiring A] [Algebra R A] :
    Algebra (Localization S) (LocalizedModule S A) :=
  Algebra.ofModule
    (by
      intro r x₁ x₂
      obtain ⟨y, s, rfl : IsLocalization.mk' _ y s = r⟩ := IsLocalization.mk'_surjective S r
      obtain ⟨⟨a₁, s₁⟩, rfl : mk a₁ s₁ = x₁⟩ := Quotient.exists_rep x₁
      obtain ⟨⟨a₂, s₂⟩, rfl : mk a₂ s₂ = x₂⟩ := Quotient.exists_rep x₂
      rw [mk_mul_mk, ← Localization.mk_eq_mk', mk_smul_mk, mk_smul_mk, mk_mul_mk, mul_assoc,
        smul_mul_assoc])
    (by
      intro r x₁ x₂
      obtain ⟨y, s, rfl : IsLocalization.mk' _ y s = r⟩ := IsLocalization.mk'_surjective S r
      

Proof state:
case 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
x₁ x₂ : LocalizedModule S A
y : R
s : ↥S
⊢ x₁ * IsLocalization.mk' (Localization S) y s • x₂ = IsLocalization.mk' (Localization S) y s • (x₁ * x₂)

Next tactic:
obtain ⟨⟨a₁, s₁⟩, rfl : mk a₁ s₁ = x₁⟩ := Quotient.exists_rep x₁
instance {A : Type*} [Semiring A] [Algebra R A] :
    Algebra (Localization S) (LocalizedModule S A) :=
  Algebra.ofModule
    (by
      intro r x₁ x₂
      obtain ⟨y, s, rfl : IsLocalization.mk' _ y s = r⟩ := IsLocalization.mk'_surjective S r
      obtain ⟨⟨a₁, s₁⟩, rfl : mk a₁ s₁ = x₁⟩ := Quotient.exists_rep x₁
      obtain ⟨⟨a₂, s₂⟩, rfl : mk a₂ s₂ = x₂⟩ := Quotient.exists_rep x₂
      rw [mk_mul_mk, ← Localization.mk_eq_mk', mk_smul_mk, mk_smul_mk, mk_mul_mk, mul_assoc,
        smul_mul_assoc])
    (by
      intro r x₁ x₂
      obtain ⟨y, s, rfl : IsLocalization.mk' _ y s = r⟩ := IsLocalization.mk'_surjective S r
      obtain ⟨⟨a₁, s₁⟩, rfl : mk a₁ s₁ = x₁⟩ := Quotient.exists_rep x₁
      

Proof state:
case intro.intro.intro.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
x₂ : LocalizedModule S A
y : R
s : ↥S
a₁ : A
s₁ : ↥S
⊢ mk a₁ s₁ * IsLocalization.mk' (Localization S) y s • x₂ = IsLocalization.mk' (Localization S) y s • (mk a₁ s₁ * x₂)

Next tactic:
obtain ⟨⟨a₂, s₂⟩, rfl : mk a₂ s₂ = x₂⟩ := Quotient.exists_rep x₂
instance {A : Type*} [Semiring A] [Algebra R A] :
    Algebra (Localization S) (LocalizedModule S A) :=
  Algebra.ofModule
    (by
      intro r x₁ x₂
      obtain ⟨y, s, rfl : IsLocalization.mk' _ y s = r⟩ := IsLocalization.mk'_surjective S r
      obtain ⟨⟨a₁, s₁⟩, rfl : mk a₁ s₁ = x₁⟩ := Quotient.exists_rep x₁
      obtain ⟨⟨a₂, s₂⟩, rfl : mk a₂ s₂ = x₂⟩ := Quotient.exists_rep x₂
      rw [mk_mul_mk, ← Localization.mk_eq_mk', mk_smul_mk, mk_smul_mk, mk_mul_mk, mul_assoc,
        smul_mul_assoc])
    (by
      intro r x₁ x₂
      obtain ⟨y, s, rfl : IsLocalization.mk' _ y s = r⟩ := IsLocalization.mk'_surjective S r
      obtain ⟨⟨a₁, s₁⟩, rfl : mk a₁ s₁ = x₁⟩ := Quotient.exists_rep x₁
      obtain ⟨⟨a₂, s₂⟩, rfl : mk a₂ s₂ = x₂⟩ := Quotient.exists_rep x₂
      

Proof state:
case intro.intro.intro.mk.intro.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
y : R
s : ↥S
a₁ : A
s₁ : ↥S
a₂ : A
s₂ : ↥S
⊢ mk a₁ s₁ * IsLocalization.mk' (Localization S) y s • mk a₂ s₂ =
    IsLocalization.mk' (Localization S) y s • (mk a₁ s₁ * mk a₂ s₂)

Next tactic:
rw [mk_mul_mk, ← Localization.mk_eq_mk', mk_smul_mk, mk_smul_mk, mk_mul_mk, mul_left_comm,
        mul_smul_comm]
theorem algebraMap_mk {A : Type*} [Semiring A] [Algebra R A] (a : R) (s : S) :
    algebraMap _ _ (Localization.mk a s) = mk (algebraMap R A a) s := 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
a : R
s : ↥S
⊢ (algebraMap (Localization S) (LocalizedModule S A)) (Localization.mk a s) = mk ((algebraMap R A) a) s

Next tactic:
rw [Algebra.algebraMap_eq_smul_one]
theorem algebraMap_mk {A : Type*} [Semiring A] [Algebra R A] (a : R) (s : S) :
    algebraMap _ _ (Localization.mk a s) = mk (algebraMap R A a) s := by
  rw [Algebra.algebraMap_eq_smul_one]
  

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
a : R
s : ↥S
⊢ Localization.mk a s • 1 = mk ((algebraMap R A) a) s

Next tactic:
change _ • mk _ _ = _
theorem algebraMap_mk {A : Type*} [Semiring A] [Algebra R A] (a : R) (s : S) :
    algebraMap _ _ (Localization.mk a s) = mk (algebraMap R A a) s := by
  rw [Algebra.algebraMap_eq_smul_one]
  change _ • mk _ _ = _
  

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
a : R
s : ↥S
⊢ Localization.mk a s • mk 1 1 = mk ((algebraMap R A) a) s

Next tactic:
rw [mk_smul_mk, Algebra.algebraMap_eq_smul_one, mul_one]
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (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✝¹ : Semiring A
inst✝ : Algebra R A
src✝ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
⊢ Module R (LocalizedModule S A)

Next tactic:
infer_instance
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (LocalizedModule S A) by infer_instance with
    commutes' := 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
src✝¹ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
src✝ : Module R (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
⊢ ∀ (r : R) (x : LocalizedModule S A),
    { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
            map_add' :=
              (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
          r *
        x =
      x *
        { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
            map_add' :=
              (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
          r

Next tactic:
intro r x
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (LocalizedModule S A) by infer_instance with
    commutes' := by
      intro r x
      

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
src✝¹ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
src✝ : Module R (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
r : R
x : LocalizedModule S A
⊢ { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
        r *
      x =
    x *
      { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
        r

Next tactic:
obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (LocalizedModule S A) by infer_instance with
    commutes' := by
      intro r x
      obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
      

Proof state:
case intro.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
src✝¹ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
src✝ : Module R (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
r : R
a : A
s : ↥S
⊢ { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
        r *
      mk a s =
    mk a s *
      { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
        r

Next tactic:
dsimp
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (LocalizedModule S A) by infer_instance with
    commutes' := by
      intro r x
      obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
      dsimp
      

Proof state:
case intro.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
src✝¹ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
src✝ : Module R (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
r : R
a : A
s : ↥S
⊢ (algebraMap (Localization S) (LocalizedModule S A)) ((algebraMap R (Localization S)) r) * mk a s =
    mk a s * (algebraMap (Localization S) (LocalizedModule S A)) ((algebraMap R (Localization S)) r)

Next tactic:
rw [← Localization.mk_one_eq_algebraMap, algebraMap_mk, mk_mul_mk, mk_mul_mk, mul_comm,
        Algebra.commutes]
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (LocalizedModule S A) by infer_instance with
    commutes' := by
      intro r x
      obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
      dsimp
      rw [← Localization.mk_one_eq_algebraMap, algebraMap_mk, mk_mul_mk, mk_mul_mk, mul_comm,
        Algebra.commutes]
    smul_def' := 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
src✝¹ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
src✝ : Module R (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
⊢ ∀ (r : R) (x : LocalizedModule S A),
    r • x =
      { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
            map_add' :=
              (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
          r *
        x

Next tactic:
intro r x
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (LocalizedModule S A) by infer_instance with
    commutes' := by
      intro r x
      obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
      dsimp
      rw [← Localization.mk_one_eq_algebraMap, algebraMap_mk, mk_mul_mk, mk_mul_mk, mul_comm,
        Algebra.commutes]
    smul_def' := by
      intro r x
      

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
src✝¹ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
src✝ : Module R (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
r : R
x : LocalizedModule S A
⊢ r • x =
    { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
        r *
      x

Next tactic:
obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (LocalizedModule S A) by infer_instance with
    commutes' := by
      intro r x
      obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
      dsimp
      rw [← Localization.mk_one_eq_algebraMap, algebraMap_mk, mk_mul_mk, mk_mul_mk, mul_comm,
        Algebra.commutes]
    smul_def' := by
      intro r x
      obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
      

Proof state:
case intro.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
src✝¹ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
src✝ : Module R (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
r : R
a : A
s : ↥S
⊢ r • mk a s =
    { toMonoidHom := ↑src✝¹, map_zero' := (_ : OneHom.toFun (↑↑src✝¹) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝¹) (x + y) = OneHom.toFun (↑↑src✝¹) x + OneHom.toFun (↑↑src✝¹) y) }
        r *
      mk a s

Next tactic:
dsimp
instance algebra' {A : Type*} [Semiring A] [Algebra R A] : Algebra R (LocalizedModule S A) :=
  { (algebraMap (Localization S) (LocalizedModule S A)).comp (algebraMap R <| Localization S),
    show Module R (LocalizedModule S A) by infer_instance with
    commutes' := by
      intro r x
      obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
      dsimp
      rw [← Localization.mk_one_eq_algebraMap, algebraMap_mk, mk_mul_mk, mk_mul_mk, mul_comm,
        Algebra.commutes]
    smul_def' := by
      intro r x
      obtain ⟨⟨a, s⟩, rfl : mk a s = x⟩ := Quotient.exists_rep x
      dsimp
      

Proof state:
case intro.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
src✝¹ : R →+* LocalizedModule S A :=
  RingHom.comp (algebraMap (Localization S) (LocalizedModule S A)) (algebraMap R (Localization S))
src✝ : Module R (LocalizedModule S A) :=
  let_fun this := inferInstance;
  this
r : R
a : A
s : ↥S
⊢ r • mk a s = (algebraMap (Localization S) (LocalizedModule S A)) ((algebraMap R (Localization S)) r) * mk a s

Next tactic:
rw [← Localization.mk_one_eq_algebraMap, algebraMap_mk, mk_mul_mk, smul'_mk,
        Algebra.smul_def, one_mul]
/-- The function `m ↦ m / 1` as an `R`-linear map.
-/
@[simps]
def mkLinearMap : M →ₗ[R] LocalizedModule S M where
  toFun m := mk m 1
  map_add' x y := by 

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
x y : M
⊢ (fun m => mk m 1) (x + y) = (fun m => mk m 1) x + (fun m => mk m 1) y

Next tactic:
simp [mk_add_mk]
/-- For any `s : S`, there is an `R`-linear map given by `a/b ↦ a/(b*s)`.
-/
@[simps]
def divBy (s : S) : LocalizedModule S M →ₗ[R] LocalizedModule S M where
  toFun p :=
    p.liftOn (fun p => mk p.1 (s * p.2)) fun ⟨a, b⟩ ⟨a', b'⟩ ⟨c, eq1⟩ =>
      mk_eq.mpr ⟨c, by 

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
s : ↥S
p : LocalizedModule S M
x✝² x✝¹ : M × ↥S
a : M
b : ↥S
a' : M
b' : ↥S
x✝ : (a, b) ≈ (a', b')
c : ↥S
eq1 : c • (a', b').2 • (a, b).1 = c • (a, b).2 • (a', b').1
⊢ c • (s * (a', b').2) • (a, b).1 = c • (s * (a, b).2) • (a', b').1

Next tactic:
rw [mul_smul, mul_smul, smul_comm c, eq1, smul_comm s]
/-- For any `s : S`, there is an `R`-linear map given by `a/b ↦ a/(b*s)`.
-/
@[simps]
def divBy (s : S) : LocalizedModule S M →ₗ[R] LocalizedModule S M where
  toFun p :=
    p.liftOn (fun p => mk p.1 (s * p.2)) fun ⟨a, b⟩ ⟨a', b'⟩ ⟨c, eq1⟩ =>
      mk_eq.mpr ⟨c, by rw [mul_smul, mul_smul, smul_comm c, eq1, smul_comm s]⟩
  map_add' x y :=
    x.induction_on₂
      (by
        

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
s : ↥S
x y : LocalizedModule S M
⊢ ∀ (m m' : M) (s_1 s' : ↥S),
    (fun p =>
          liftOn p (fun p => mk p.1 (s * p.2))
            (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → (fun p => mk p.1 (s * p.2)) x = (fun p => mk p.1 (s * p.2)) x_1))
        (mk m s_1 + mk m' s') =
      (fun p =>
            liftOn p (fun p => mk p.1 (s * p.2))
              (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → (fun p => mk p.1 (s * p.2)) x = (fun p => mk p.1 (s * p.2)) x_1))
          (mk m s_1) +
        (fun p =>
            liftOn p (fun p => mk p.1 (s * p.2))
              (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → (fun p => mk p.1 (s * p.2)) x = (fun p => mk p.1 (s * p.2)) x_1))
          (mk m' s')

Next tactic:
intro m₁ m₂ t₁ t₂
/-- For any `s : S`, there is an `R`-linear map given by `a/b ↦ a/(b*s)`.
-/
@[simps]
def divBy (s : S) : LocalizedModule S M →ₗ[R] LocalizedModule S M where
  toFun p :=
    p.liftOn (fun p => mk p.1 (s * p.2)) fun ⟨a, b⟩ ⟨a', b'⟩ ⟨c, eq1⟩ =>
      mk_eq.mpr ⟨c, by rw [mul_smul, mul_smul, smul_comm c, eq1, smul_comm s]⟩
  map_add' x y :=
    x.induction_on₂
      (by
        intro m₁ m₂ t₁ t₂
        

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
s : ↥S
x y : LocalizedModule S M
m₁ m₂ : M
t₁ t₂ : ↥S
⊢ (fun p =>
        liftOn p (fun p => mk p.1 (s * p.2))
          (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → (fun p => mk p.1 (s * p.2)) x = (fun p => mk p.1 (s * p.2)) x_1))
      (mk m₁ t₁ + mk m₂ t₂) =
    (fun p =>
          liftOn p (fun p => mk p.1 (s * p.2))
            (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → (fun p => mk p.1 (s * p.2)) x = (fun p => mk p.1 (s * p.2)) x_1))
        (mk m₁ t₁) +
      (fun p =>
          liftOn p (fun p => mk p.1 (s * p.2))
            (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → (fun p => mk p.1 (s * p.2)) x = (fun p => mk p.1 (s * p.2)) x_1))
        (mk m₂ t₂)

Next tactic:
simp only [mk_add_mk, LocalizedModule.liftOn_mk, mul_smul, ← smul_add, mul_assoc,
          mk_cancel_common_left s]
/-- For any `s : S`, there is an `R`-linear map given by `a/b ↦ a/(b*s)`.
-/
@[simps]
def divBy (s : S) : LocalizedModule S M →ₗ[R] LocalizedModule S M where
  toFun p :=
    p.liftOn (fun p => mk p.1 (s * p.2)) fun ⟨a, b⟩ ⟨a', b'⟩ ⟨c, eq1⟩ =>
      mk_eq.mpr ⟨c, by rw [mul_smul, mul_smul, smul_comm c, eq1, smul_comm s]⟩
  map_add' x y :=
    x.induction_on₂
      (by
        intro m₁ m₂ t₁ t₂
        simp only [mk_add_mk, LocalizedModule.liftOn_mk, mul_smul, ← smul_add, mul_assoc,
          mk_cancel_common_left s]
        

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
s : ↥S
x y : LocalizedModule S M
m₁ m₂ : M
t₁ t₂ : ↥S
⊢ mk (t₂ • m₁ + t₁ • m₂) (s * (t₁ * t₂)) = mk (t₂ • m₁ + t₁ • m₂) (t₁ * (s * t₂))

Next tactic:
rw [show s * (t₁ * t₂) = t₁ * (s * t₂) by
            ext
            simp only [Submonoid.coe_mul]
            ring]
/-- For any `s : S`, there is an `R`-linear map given by `a/b ↦ a/(b*s)`.
-/
@[simps]
def divBy (s : S) : LocalizedModule S M →ₗ[R] LocalizedModule S M where
  toFun p :=
    p.liftOn (fun p => mk p.1 (s * p.2)) fun ⟨a, b⟩ ⟨a', b'⟩ ⟨c, eq1⟩ =>
      mk_eq.mpr ⟨c, by rw [mul_smul, mul_smul, smul_comm c, eq1, smul_comm s]⟩
  map_add' x y :=
    x.induction_on₂
      (by
        intro m₁ m₂ t₁ t₂
        simp only [mk_add_mk, LocalizedModule.liftOn_mk, mul_smul, ← smul_add, mul_assoc,
          mk_cancel_common_left s]
        rw [show s * (t₁ * t₂) = t₁ * (s * t₂) by
            

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
s : ↥S
x y : LocalizedModule S M
m₁ m₂ : M
t₁ t₂ : ↥S
⊢ s * (t₁ * t₂) = t₁ * (s * t₂)

Next tactic:
ext
/-- For any `s : S`, there is an `R`-linear map given by `a/b ↦ a/(b*s)`.
-/
@[simps]
def divBy (s : S) : LocalizedModule S M →ₗ[R] LocalizedModule S M where
  toFun p :=
    p.liftOn (fun p => mk p.1 (s * p.2)) fun ⟨a, b⟩ ⟨a', b'⟩ ⟨c, eq1⟩ =>
      mk_eq.mpr ⟨c, by rw [mul_smul, mul_smul, smul_comm c, eq1, smul_comm s]⟩
  map_add' x y :=
    x.induction_on₂
      (by
        intro m₁ m₂ t₁ t₂
        simp only [mk_add_mk, LocalizedModule.liftOn_mk, mul_smul, ← smul_add, mul_assoc,
          mk_cancel_common_left s]
        rw [show s * (t₁ * t₂) = t₁ * (s * t₂) by
            ext
            

Proof state:
case a
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
s : ↥S
x y : LocalizedModule S M
m₁ m₂ : M
t₁ t₂ : ↥S
⊢ ↑(s * (t₁ * t₂)) = ↑(t₁ * (s * t₂))

Next tactic:
simp only [Submonoid.coe_mul]
/-- For any `s : S`, there is an `R`-linear map given by `a/b ↦ a/(b*s)`.
-/
@[simps]
def divBy (s : S) : LocalizedModule S M →ₗ[R] LocalizedModule S M where
  toFun p :=
    p.liftOn (fun p => mk p.1 (s * p.2)) fun ⟨a, b⟩ ⟨a', b'⟩ ⟨c, eq1⟩ =>
      mk_eq.mpr ⟨c, by rw [mul_smul, mul_smul, smul_comm c, eq1, smul_comm s]⟩
  map_add' x y :=
    x.induction_on₂
      (by
        intro m₁ m₂ t₁ t₂
        simp only [mk_add_mk, LocalizedModule.liftOn_mk, mul_smul, ← smul_add, mul_assoc,
          mk_cancel_common_left s]
        rw [show s * (t₁ * t₂) = t₁ * (s * t₂) by
            ext
            simp only [Submonoid.coe_mul]
            

Proof state:
case a
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
s : ↥S
x y : LocalizedModule S M
m₁ m₂ : M
t₁ t₂ : ↥S
⊢ ↑s * (↑t₁ * ↑t₂) = ↑t₁ * (↑s * ↑t₂)

Next tactic:
ring
/-- For any `s : S`, there is an `R`-linear map given by `a/b ↦ a/(b*s)`.
-/
@[simps]
def divBy (s : S) : LocalizedModule S M →ₗ[R] LocalizedModule S M where
  toFun p :=
    p.liftOn (fun p => mk p.1 (s * p.2)) fun ⟨a, b⟩ ⟨a', b'⟩ ⟨c, eq1⟩ =>
      mk_eq.mpr ⟨c, by rw [mul_smul, mul_smul, smul_comm c, eq1, smul_comm s]⟩
  map_add' x y :=
    x.induction_on₂
      (by
        intro m₁ m₂ t₁ t₂
        simp only [mk_add_mk, LocalizedModule.liftOn_mk, mul_smul, ← smul_add, mul_assoc,
          mk_cancel_common_left s]
        rw [show s * (t₁ * t₂) = t₁ * (s * t₂) by
            ext
            simp only [Submonoid.coe_mul]
            ring])
      y
  map_smul' r x :=
    x.inductionOn <| by
      intro
      dsimp only
      

Proof state:
R : Type u
inst✝² : CommSemiring R
S : Submonoid R
M : Type v
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
s : ↥S
r : R
x : LocalizedModule S M
a✝ : M × ↥S
⊢ liftOn (r • ⟦a✝⟧) (fun p => mk p.1 (s * p.2))
      (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → mk x.1 (s * x.2) = mk x_1.1 (s * x_1.2)) =
    (RingHom.id R) r •
      liftOn ⟦a✝⟧ (fun p => mk p.1 (s * p.2))
        (_ : ∀ (x x_1 : M × ↥S), x ≈ x_1 → mk x.1 (s * x.2) = mk x_1.1 (s * x_1.2))

Next tactic:
change liftOn (mk _ _) _ _ = r • (liftOn (mk _ _) _ _)