l3lab/ntp-mathlib huggingface dataset:
@[to_additive]
instance commMonoid : CommMonoid (Localization S) where
  mul := (· * ·)
  one := 1
  mul_assoc x y z := show (x.mul S y).mul S z = x.mul S (y.mul S z) by
    rw [Localization.mul]; apply (r S).commMonoid.mul_assoc
  mul_comm x y := show x.mul S y = y.mul S x by
    rw [Localization.mul]; apply (r S).commMonoid.mul_comm
  mul_one x := show x.mul S (.one S) = x by
    rw [Localization.mul, Localization.one]; apply (r S).commMonoid.mul_one
  one_mul x := show (Localization.one S).mul S x = x by
    rw [Localization.mul, Localization.one]; apply (r S).commMonoid.one_mul
  npow := Localization.npow S
  npow_zero x := show Localization.npow S 0 x = .one S by
    rw [Localization.npow, Localization.one]; 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
x : Localization S
⊢ Monoid.npow 0 x = One.one

Next tactic:
apply (r S).commMonoid.npow_zero
@[to_additive]
instance commMonoid : CommMonoid (Localization S) where
  mul := (· * ·)
  one := 1
  mul_assoc x y z := show (x.mul S y).mul S z = x.mul S (y.mul S z) by
    rw [Localization.mul]; apply (r S).commMonoid.mul_assoc
  mul_comm x y := show x.mul S y = y.mul S x by
    rw [Localization.mul]; apply (r S).commMonoid.mul_comm
  mul_one x := show x.mul S (.one S) = x by
    rw [Localization.mul, Localization.one]; apply (r S).commMonoid.mul_one
  one_mul x := show (Localization.one S).mul S x = x by
    rw [Localization.mul, Localization.one]; apply (r S).commMonoid.one_mul
  npow := Localization.npow S
  npow_zero x := show Localization.npow S 0 x = .one S by
    rw [Localization.npow, Localization.one]; apply (r S).commMonoid.npow_zero
  npow_succ n x := show .npow S n.succ x = x.mul S (.npow S n x) by
    

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
n : ℕ
x : Localization S
⊢ Localization.npow S (Nat.succ n) x = Localization.mul S x (Localization.npow S n x)

Next tactic:
rw [Localization.npow, Localization.mul]
@[to_additive]
instance commMonoid : CommMonoid (Localization S) where
  mul := (· * ·)
  one := 1
  mul_assoc x y z := show (x.mul S y).mul S z = x.mul S (y.mul S z) by
    rw [Localization.mul]; apply (r S).commMonoid.mul_assoc
  mul_comm x y := show x.mul S y = y.mul S x by
    rw [Localization.mul]; apply (r S).commMonoid.mul_comm
  mul_one x := show x.mul S (.one S) = x by
    rw [Localization.mul, Localization.one]; apply (r S).commMonoid.mul_one
  one_mul x := show (Localization.one S).mul S x = x by
    rw [Localization.mul, Localization.one]; apply (r S).commMonoid.one_mul
  npow := Localization.npow S
  npow_zero x := show Localization.npow S 0 x = .one S by
    rw [Localization.npow, Localization.one]; apply (r S).commMonoid.npow_zero
  npow_succ n x := show .npow S n.succ x = x.mul S (.npow S n x) by
    rw [Localization.npow, Localization.mul]; 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
n : ℕ
x : Localization S
⊢ Monoid.npow (Nat.succ n) x = Mul.mul x (Monoid.npow n x)

Next tactic:
apply (r S).commMonoid.npow_succ
@[to_additive]
instance commMonoid : CommMonoid (Localization S) where
  mul := (· * ·)
  one := 1
  mul_assoc x y z := show (x.mul S y).mul S z = x.mul S (y.mul S z) by
    rw [Localization.mul]; apply (r S).commMonoid.mul_assoc
  mul_comm x y := show x.mul S y = y.mul S x by
    

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
x y : Localization S
⊢ Localization.mul S x y = Localization.mul S y x

Next tactic:
rw [Localization.mul]
@[to_additive]
instance commMonoid : CommMonoid (Localization S) where
  mul := (· * ·)
  one := 1
  mul_assoc x y z := show (x.mul S y).mul S z = x.mul S (y.mul S z) by
    rw [Localization.mul]; apply (r S).commMonoid.mul_assoc
  mul_comm x y := show x.mul S y = y.mul S x by
    rw [Localization.mul]; 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
x y : Localization S
⊢ Mul.mul x y = Mul.mul y x

Next tactic:
apply (r S).commMonoid.mul_comm
/-- Dependent recursion principle for `Localizations`: given elements `f a b : p (mk a b)`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d` (with the correct coercions),
then `f` is defined on the whole `Localization S`. -/
@[to_additive (attr := elab_as_elim)
    "Dependent recursion principle for `AddLocalizations`: given elements `f a b : p (mk a b)`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d` (with the correct coercions),
then `f` is defined on the whole `AddLocalization S`."]
def rec {p : Localization S → Sort u} (f : ∀ (a : M) (b : S), p (mk a b))
    (H : ∀ {a c : M} {b d : S} (h : r S (a, b) (c, d)),
      (Eq.ndrec (f a b) (mk_eq_mk_iff.mpr h) : p (mk c d)) = f c d) (x) : p x :=
  Quot.rec (fun y ↦ Eq.ndrec (f y.1 y.2) (by 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
p : Localization S → Sort u
f : (a : M) → (b : ↥S) → p (mk a b)
H : ∀ {a c : M} {b d : ↥S} (h : (r S) (a, b) (c, d)), (_ : mk a b = mk c d) ▸ f a b = f c d
x : Localization S
y : M × ↥S
⊢ mk y.1 y.2 = Quot.mk Setoid.r y

Next tactic:
rfl
/-- Dependent recursion principle for `Localizations`: given elements `f a b : p (mk a b)`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d` (with the correct coercions),
then `f` is defined on the whole `Localization S`. -/
@[to_additive (attr := elab_as_elim)
    "Dependent recursion principle for `AddLocalizations`: given elements `f a b : p (mk a b)`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d` (with the correct coercions),
then `f` is defined on the whole `AddLocalization S`."]
def rec {p : Localization S → Sort u} (f : ∀ (a : M) (b : S), p (mk a b))
    (H : ∀ {a c : M} {b d : S} (h : r S (a, b) (c, d)),
      (Eq.ndrec (f a b) (mk_eq_mk_iff.mpr h) : p (mk c d)) = f c d) (x) : p x :=
  Quot.rec (fun y ↦ Eq.ndrec (f y.1 y.2) (by rfl)) (fun y z h ↦ by 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
p : Localization S → Sort u
f : (a : M) → (b : ↥S) → p (mk a b)
H : ∀ {a c : M} {b d : ↥S} (h : (r S) (a, b) (c, d)), (_ : mk a b = mk c d) ▸ f a b = f c d
x : Localization S
y z : M × ↥S
h : Setoid.r y z
⊢ (_ : Quot.mk Setoid.r y = Quot.mk Setoid.r z) ▸ (fun y => (_ : mk y.1 y.2 = mk y.1 y.2) ▸ f y.1 y.2) y =
    (fun y => (_ : mk y.1 y.2 = mk y.1 y.2) ▸ f y.1 y.2) z

Next tactic:
cases y
/-- Dependent recursion principle for `Localizations`: given elements `f a b : p (mk a b)`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d` (with the correct coercions),
then `f` is defined on the whole `Localization S`. -/
@[to_additive (attr := elab_as_elim)
    "Dependent recursion principle for `AddLocalizations`: given elements `f a b : p (mk a b)`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d` (with the correct coercions),
then `f` is defined on the whole `AddLocalization S`."]
def rec {p : Localization S → Sort u} (f : ∀ (a : M) (b : S), p (mk a b))
    (H : ∀ {a c : M} {b d : S} (h : r S (a, b) (c, d)),
      (Eq.ndrec (f a b) (mk_eq_mk_iff.mpr h) : p (mk c d)) = f c d) (x) : p x :=
  Quot.rec (fun y ↦ Eq.ndrec (f y.1 y.2) (by rfl)) (fun y z h ↦ by cases y; 

Proof state:
case mk
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
p : Localization S → Sort u
f : (a : M) → (b : ↥S) → p (mk a b)
H : ∀ {a c : M} {b d : ↥S} (h : (r S) (a, b) (c, d)), (_ : mk a b = mk c d) ▸ f a b = f c d
x : Localization S
z : M × ↥S
fst✝ : M
snd✝ : ↥S
h : Setoid.r (fst✝, snd✝) z
⊢ (_ : Quot.mk Setoid.r (fst✝, snd✝) = Quot.mk Setoid.r z) ▸
      (fun y => (_ : mk y.1 y.2 = mk y.1 y.2) ▸ f y.1 y.2) (fst✝, snd✝) =
    (fun y => (_ : mk y.1 y.2 = mk y.1 y.2) ▸ f y.1 y.2) z

Next tactic:
cases z
/-- Dependent recursion principle for `Localizations`: given elements `f a b : p (mk a b)`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d` (with the correct coercions),
then `f` is defined on the whole `Localization S`. -/
@[to_additive (attr := elab_as_elim)
    "Dependent recursion principle for `AddLocalizations`: given elements `f a b : p (mk a b)`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d` (with the correct coercions),
then `f` is defined on the whole `AddLocalization S`."]
def rec {p : Localization S → Sort u} (f : ∀ (a : M) (b : S), p (mk a b))
    (H : ∀ {a c : M} {b d : S} (h : r S (a, b) (c, d)),
      (Eq.ndrec (f a b) (mk_eq_mk_iff.mpr h) : p (mk c d)) = f c d) (x) : p x :=
  Quot.rec (fun y ↦ Eq.ndrec (f y.1 y.2) (by rfl)) (fun y z h ↦ by cases y; cases z; 

Proof state:
case mk.mk
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
p : Localization S → Sort u
f : (a : M) → (b : ↥S) → p (mk a b)
H : ∀ {a c : M} {b d : ↥S} (h : (r S) (a, b) (c, d)), (_ : mk a b = mk c d) ▸ f a b = f c d
x : Localization S
fst✝¹ : M
snd✝¹ : ↥S
fst✝ : M
snd✝ : ↥S
h : Setoid.r (fst✝¹, snd✝¹) (fst✝, snd✝)
⊢ (_ : Quot.mk Setoid.r (fst✝¹, snd✝¹) = Quot.mk Setoid.r (fst✝, snd✝)) ▸
      (fun y => (_ : mk y.1 y.2 = mk y.1 y.2) ▸ f y.1 y.2) (fst✝¹, snd✝¹) =
    (fun y => (_ : mk y.1 y.2 = mk y.1 y.2) ▸ f y.1 y.2) (fst✝, snd✝)

Next tactic:
exact H h
@[to_additive]
theorem mk_mul (a c : M) (b d : S) : mk a b * mk c d = mk (a * c) (b * d) :=
  show Localization.mul S _ _ = _ by 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
a c : M
b d : ↥S
⊢ Localization.mul S (mk a b) (mk c d) = mk (a * c) (b * d)

Next tactic:
rw [Localization.mul]
@[to_additive]
theorem mk_mul (a c : M) (b d : S) : mk a b * mk c d = mk (a * c) (b * d) :=
  show Localization.mul S _ _ = _ by rw [Localization.mul]; 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
a c : M
b d : ↥S
⊢ Mul.mul (mk a b) (mk c d) = mk (a * c) (b * d)

Next tactic:
rfl
@[to_additive]
theorem mk_one : mk 1 (1 : S) = 1 :=
  show mk _ _ = .one S by 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
⊢ mk 1 1 = Localization.one S

Next tactic:
rw [Localization.one]
@[to_additive]
theorem mk_one : mk 1 (1 : S) = 1 :=
  show mk _ _ = .one S by rw [Localization.one]; 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
⊢ mk 1 1 = One.one

Next tactic:
rfl
@[to_additive]
theorem mk_pow (n : ℕ) (a : M) (b : S) : mk a b ^ n = mk (a ^ n) (b ^ n) :=
  show Localization.npow S _ _ = _ by 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
n : ℕ
a : M
b : ↥S
⊢ Localization.npow S n (mk a b) = mk (a ^ n) (b ^ n)

Next tactic:
rw [Localization.npow]
@[to_additive]
theorem mk_pow (n : ℕ) (a : M) (b : S) : mk a b ^ n = mk (a ^ n) (b ^ n) :=
  show Localization.npow S _ _ = _ by rw [Localization.npow]; 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
n : ℕ
a : M
b : ↥S
⊢ Monoid.npow n (mk a b) = mk (a ^ n) (b ^ n)

Next tactic:
rfl
/-- Non-dependent recursion principle for localizations: given elements `f a b : p`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d`,
then `f` is defined on the whole `Localization S`. -/
-- Porting note: the attribute `elab_as_elim` fails with `unexpected eliminator resulting type p`
-- @[to_additive (attr := elab_as_elim)
@[to_additive
    "Non-dependent recursion principle for `AddLocalization`s: given elements `f a b : p`
for all `a b`, such that `r S (a, b) (c, d)` implies `f a b = f c d`,
then `f` is defined on the whole `Localization S`."]
def liftOn {p : Sort u} (x : Localization S) (f : M → S → p)
    (H : ∀ {a c : M} {b d : S}, r S (a, b) (c, d) → f a b = f c d) : p :=
  rec f (fun h ↦ (by 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
p : Sort u
x : Localization S
f : M → ↥S → p
H : ∀ {a c : M} {b d : ↥S}, (r S) (a, b) (c, d) → f a b = f c d
a✝ c✝ : M
b✝ d✝ : ↥S
h : (r S) (a✝, b✝) (c✝, d✝)
⊢ (_ : mk a✝ b✝ = mk c✝ d✝) ▸ f a✝ b✝ = f c✝ d✝

Next tactic:
simpa only [eq_rec_constant] using H h
@[to_additive]
theorem r_of_eq {x y : M × S} (h : ↑y.2 * x.1 = ↑x.2 * y.1) : r S x y :=
  r_iff_exists.2 ⟨1, by 

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
x y : M × ↥S
h : ↑y.2 * x.1 = ↑x.2 * y.1
⊢ ↑1 * (↑y.2 * x.1) = ↑1 * (↑x.2 * y.1)

Next tactic:
rw [h]
@[to_additive]
theorem mk_self (a : S) : mk (a : M) a = 1 := by
  

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
a : ↥S
⊢ mk (↑a) a = 1

Next tactic:
symm
@[to_additive]
theorem mk_self (a : S) : mk (a : M) a = 1 := by
  symm
  

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
a : ↥S
⊢ 1 = mk (↑a) a

Next tactic:
rw [← mk_one, mk_eq_mk_iff]
@[to_additive]
theorem mk_self (a : S) : mk (a : M) a = 1 := by
  symm
  rw [← mk_one, mk_eq_mk_iff]
  

Proof state:
M : Type u_1
inst✝² : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝¹ : CommMonoid N
P : Type u_3
inst✝ : CommMonoid P
a : ↥S
⊢ (r S) (1, 1) (↑a, a)

Next tactic:
exact one_rel a
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        

Proof state:
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' : M
b b' : ↥S
h : (r S) (a, b) (a', b')
⊢ (r S) (c • a, b) (c • a', b')

Next tactic:
cases' b with b hb
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        cases' b with b hb
        

Proof state:
case mk
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' : M
b' : ↥S
b : M
hb : b ∈ S
h : (r S) (a, { val := b, property := hb }) (a', b')
⊢ (r S) (c • a, { val := b, property := hb }) (c • a', b')

Next tactic:
cases' b' with b' hb'
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        cases' b with b hb
        cases' b' with b' hb'
        

Proof state:
case mk.mk
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' b : M
hb : b ∈ S
b' : M
hb' : b' ∈ S
h : (r S) (a, { val := b, property := hb }) (a', { val := b', property := hb' })
⊢ (r S) (c • a, { val := b, property := hb }) (c • a', { val := b', property := hb' })

Next tactic:
rw [r_eq_r'] at h ⊢
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        cases' b with b hb
        cases' b' with b' hb'
        rw [r_eq_r'] at h ⊢
        

Proof state:
case mk.mk
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' b : M
hb : b ∈ S
b' : M
hb' : b' ∈ S
h : (r' S) (a, { val := b, property := hb }) (a', { val := b', property := hb' })
⊢ (r' S) (c • a, { val := b, property := hb }) (c • a', { val := b', property := hb' })

Next tactic:
cases' h with t ht
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        cases' b with b hb
        cases' b' with b' hb'
        rw [r_eq_r'] at h ⊢
        cases' h with t ht
        

Proof state:
case mk.mk.intro
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' b : M
hb : b ∈ S
b' : M
hb' : b' ∈ S
t : ↥S
ht :
  ↑t * (↑(a', { val := b', property := hb' }).2 * (a, { val := b, property := hb }).1) =
    ↑t * (↑(a, { val := b, property := hb }).2 * (a', { val := b', property := hb' }).1)
⊢ (r' S) (c • a, { val := b, property := hb }) (c • a', { val := b', property := hb' })

Next tactic:
use t
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        cases' b with b hb
        cases' b' with b' hb'
        rw [r_eq_r'] at h ⊢
        cases' h with t ht
        use t
        

Proof state:
case h
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' b : M
hb : b ∈ S
b' : M
hb' : b' ∈ S
t : ↥S
ht :
  ↑t * (↑(a', { val := b', property := hb' }).2 * (a, { val := b, property := hb }).1) =
    ↑t * (↑(a, { val := b, property := hb }).2 * (a', { val := b', property := hb' }).1)
⊢ ↑t * (↑(c • a', { val := b', property := hb' }).2 * (c • a, { val := b, property := hb }).1) =
    ↑t * (↑(c • a, { val := b, property := hb }).2 * (c • a', { val := b', property := hb' }).1)

Next tactic:
dsimp only [Subtype.coe_mk] at ht ⊢
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        cases' b with b hb
        cases' b' with b' hb'
        rw [r_eq_r'] at h ⊢
        cases' h with t ht
        use t
        dsimp only [Subtype.coe_mk] at ht ⊢
-- TODO: this definition should take `SMulCommClass R M M` instead of `IsScalarTower R M M` if
-- we ever want to generalize to the non-commutative case.
        

Proof state:
case h
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' b : M
hb : b ∈ S
b' : M
hb' : b' ∈ S
t : ↥S
ht : ↑t * (b' * a) = ↑t * (b * a')
⊢ ↑t * (b' * c • a) = ↑t * (b * c • a')

Next tactic:
haveI : SMulCommClass R M M :=
          ⟨fun r m₁ m₂ ↦ by simp_rw [smul_eq_mul, mul_comm m₁, smul_mul_assoc]⟩
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        cases' b with b hb
        cases' b' with b' hb'
        rw [r_eq_r'] at h ⊢
        cases' h with t ht
        use t
        dsimp only [Subtype.coe_mk] at ht ⊢
-- TODO: this definition should take `SMulCommClass R M M` instead of `IsScalarTower R M M` if
-- we ever want to generalize to the non-commutative case.
        haveI : SMulCommClass R M M :=
          ⟨fun r m₁ m₂ ↦ by 

Proof state:
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' b : M
hb : b ∈ S
b' : M
hb' : b' ∈ S
t : ↥S
ht : ↑t * (b' * a) = ↑t * (b * a')
r : R
m₁ m₂ : M
⊢ r • m₁ • m₂ = m₁ • r • m₂

Next tactic:
simp_rw [smul_eq_mul, mul_comm m₁, smul_mul_assoc]
/-- Scalar multiplication in a monoid localization is defined as `c • ⟨a, b⟩ = ⟨c • a, b⟩`. -/
protected irreducible_def smul [SMul R M] [IsScalarTower R M M] (c : R) (z : Localization S) :
  Localization S :=
    Localization.liftOn z (fun a b ↦ mk (c • a) b)
      (fun {a a' b b'} h ↦ mk_eq_mk_iff.2 (by
        cases' b with b hb
        cases' b' with b' hb'
        rw [r_eq_r'] at h ⊢
        cases' h with t ht
        use t
        dsimp only [Subtype.coe_mk] at ht ⊢
-- TODO: this definition should take `SMulCommClass R M M` instead of `IsScalarTower R M M` if
-- we ever want to generalize to the non-commutative case.
        haveI : SMulCommClass R M M :=
          ⟨fun r m₁ m₂ ↦ by simp_rw [smul_eq_mul, mul_comm m₁, smul_mul_assoc]⟩
        

Proof state:
case h
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
z : Localization S
a a' b : M
hb : b ∈ S
b' : M
hb' : b' ∈ S
t : ↥S
ht : ↑t * (b' * a) = ↑t * (b * a')
this : SMulCommClass R M M
⊢ ↑t * (b' * c • a) = ↑t * (b * c • a')

Next tactic:
simp only [mul_smul_comm, ht]
theorem smul_mk [SMul R M] [IsScalarTower R M M] (c : R) (a b) :
    c • (mk a b : Localization S) = mk (c • a) b := by
 

Proof state:
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
a : M
b : ↥S
⊢ c • mk a b = mk (c • a) b

Next tactic:
simp only [HSMul.hSMul, instHSMul, SMul.smul, instSMulLocalization, Localization.smul]
theorem smul_mk [SMul R M] [IsScalarTower R M M] (c : R) (a b) :
    c • (mk a b : Localization S) = mk (c • a) b := by
 simp only [HSMul.hSMul, instHSMul, SMul.smul, instSMulLocalization, Localization.smul]
 

Proof state:
M : Type u_1
inst✝⁴ : CommMonoid M
S : Submonoid M
N : Type u_2
inst✝³ : CommMonoid N
P : Type u_3
inst✝² : CommMonoid P
R : Type u_4
R₁ : Type u_5
R₂ : Type u_6
inst✝¹ : SMul R M
inst✝ : IsScalarTower R M M
c : R
a : M
b : ↥S
⊢ liftOn (mk a b) (fun a b => mk (SMul.smul c a) b)
      (_ :
        ∀ {a c_1 : M} {b d : ↥S},
          (r S) (a, b) (c_1, d) → (fun a b => mk (SMul.smul c a) b) a b = (fun a b => mk (SMul.smul c a) b) c_1 d) =
    mk (SMul.smul c a) b

Next tactic:
show liftOn (mk a b) (fun a b => mk (c • a) b) _ = _