l3lab/ntp-mathlib huggingface dataset:
/-- Addition in a ring localization is defined as `⟨a, b⟩ + ⟨c, d⟩ = ⟨b * c + d * a, b * d⟩`.

Should not be confused with `AddLocalization.add`, which is defined as
`⟨a, b⟩ + ⟨c, d⟩ = ⟨a + c, b + d⟩`.
-/
protected irreducible_def add (z w : Localization M) : Localization M :=
  Localization.liftOn₂ z w (fun a b c d => mk ((b : R) * c + d * a) (b * d))
    fun {a a' b b' c c' d d'} h1 h2 =>
    mk_eq_mk_iff.2
      (by
        rw [r_eq_r'] at h1 h2 ⊢
        cases' h1 with t₅ ht₅
        cases' h2 with t₆ ht₆
        use t₅ * t₆
        dsimp only
        calc
          ↑t₅ * ↑t₆ * (↑b' * ↑d' * ((b : R) * c + d * a)) =
              t₆ * (d' * c) * (t₅ * (b' * b)) + t₅ * (b' * a) * (t₆ * (d' * d)) :=
            by ring
          _ = t₅ * t₆ * (b * d * (b' * c' + d' * a')) := by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
z w : Localization M
a a' : R
b b' : ↥M
c c' : R
d d' t₅ : ↥M
ht₅ : ↑t₅ * (↑(a', b').2 * (a, b).1) = ↑t₅ * (↑(a, b).2 * (a', b').1)
t₆ : ↥M
ht₆ : ↑t₆ * (↑(c', d').2 * (c, d).1) = ↑t₆ * (↑(c, d).2 * (c', d').1)
⊢ ↑t₆ * (↑d' * c) * (↑t₅ * (↑b' * ↑b)) + ↑t₅ * (↑b' * a) * (↑t₆ * (↑d' * ↑d)) =
    ↑t₅ * ↑t₆ * (↑b * ↑d * (↑b' * c' + ↑d' * a'))

Next tactic:
rw [ht₆, ht₅]
/-- Addition in a ring localization is defined as `⟨a, b⟩ + ⟨c, d⟩ = ⟨b * c + d * a, b * d⟩`.

Should not be confused with `AddLocalization.add`, which is defined as
`⟨a, b⟩ + ⟨c, d⟩ = ⟨a + c, b + d⟩`.
-/
protected irreducible_def add (z w : Localization M) : Localization M :=
  Localization.liftOn₂ z w (fun a b c d => mk ((b : R) * c + d * a) (b * d))
    fun {a a' b b' c c' d d'} h1 h2 =>
    mk_eq_mk_iff.2
      (by
        rw [r_eq_r'] at h1 h2 ⊢
        cases' h1 with t₅ ht₅
        cases' h2 with t₆ ht₆
        use t₅ * t₆
        dsimp only
        calc
          ↑t₅ * ↑t₆ * (↑b' * ↑d' * ((b : R) * c + d * a)) =
              t₆ * (d' * c) * (t₅ * (b' * b)) + t₅ * (b' * a) * (t₆ * (d' * d)) :=
            by ring
          _ = t₅ * t₆ * (b * d * (b' * c' + d' * a')) := by rw [ht₆, ht₅]; 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
z w : Localization M
a a' : R
b b' : ↥M
c c' : R
d d' t₅ : ↥M
ht₅ : ↑t₅ * (↑(a', b').2 * (a, b).1) = ↑t₅ * (↑(a, b).2 * (a', b').1)
t₆ : ↥M
ht₆ : ↑t₆ * (↑(c', d').2 * (c, d).1) = ↑t₆ * (↑(c, d).2 * (c', d').1)
⊢ ↑t₆ * (↑(c, d).2 * (c', d').1) * (↑t₅ * (↑b' * ↑b)) + ↑t₅ * (↑(a, b).2 * (a', b').1) * (↑t₆ * (↑d' * ↑d)) =
    ↑t₅ * ↑t₆ * (↑b * ↑d * (↑b' * c' + ↑d' * a'))

Next tactic:
ring
theorem add_mk (a b c d) : (mk a b : Localization M) + mk c d =
    mk ((b : R) * c + (d : R) * a) (b * d) := by
  

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
a : R
b : ↥M
c : R
d : ↥M
⊢ mk a b + mk c d = mk (↑b * c + ↑d * a) (b * d)

Next tactic:
show Localization.add (mk a b) (mk c d) = mk _ _
theorem add_mk (a b c d) : (mk a b : Localization M) + mk c d =
    mk ((b : R) * c + (d : R) * a) (b * d) := by
  show Localization.add (mk a b) (mk c d) = mk _ _
  

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
a : R
b : ↥M
c : R
d : ↥M
⊢ Localization.add (mk a b) (mk c d) = mk (↑b * c + ↑d * a) (b * d)

Next tactic:
simp [Localization.add_def]
theorem add_mk_self (a b c) : (mk a b : Localization M) + mk c b = mk (a + c) b := by
  

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
a : R
b : ↥M
c : R
⊢ mk a b + mk c b = mk (a + c) b

Next tactic:
rw [add_mk, mk_eq_mk_iff, r_eq_r']
theorem add_mk_self (a b c) : (mk a b : Localization M) + mk c b = mk (a + c) b := by
  rw [add_mk, mk_eq_mk_iff, r_eq_r']
  

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
a : R
b : ↥M
c : R
⊢ (r' M) (↑b * c + ↑b * a, b * b) (a + c, b)

Next tactic:
refine' (r' M).symm ⟨1, _⟩
theorem add_mk_self (a b c) : (mk a b : Localization M) + mk c b = mk (a + c) b := by
  rw [add_mk, mk_eq_mk_iff, r_eq_r']
  refine' (r' M).symm ⟨1, _⟩
  

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
a : R
b : ↥M
c : R
⊢ ↑1 * (↑(↑b * c + ↑b * a, b * b).2 * (a + c, b).1) = ↑1 * (↑(a + c, b).2 * (↑b * c + ↑b * a, b * b).1)

Next tactic:
simp only [Submonoid.coe_one, Submonoid.coe_mul]
theorem add_mk_self (a b c) : (mk a b : Localization M) + mk c b = mk (a + c) b := by
  rw [add_mk, mk_eq_mk_iff, r_eq_r']
  refine' (r' M).symm ⟨1, _⟩
  simp only [Submonoid.coe_one, Submonoid.coe_mul]
  

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
a : R
b : ↥M
c : R
⊢ 1 * (↑b * ↑b * (a + c)) = 1 * (↑b * (↑b * c + ↑b * a))

Next tactic:
ring
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
⊢ CommMonoidWithZero (Localization M)

Next tactic:
infer_instance
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by infer_instance) with
    add := (· + ·)
    nsmul := (· • ·)
    nsmul_zero := fun x =>
      Localization.induction_on x fun x => by simp only [smul_mk, zero_nsmul, mk_zero]
    nsmul_succ := fun n x =>
      Localization.induction_on x fun x => by simp only [smul_mk, succ_nsmul, add_mk_self]
    add_assoc := fun m n k =>
      Localization.induction_on₃ m n k
        (by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
src✝ : CommMonoidWithZero (Localization M) :=
  let_fun this := inferInstance;
  this
m n k : Localization M
⊢ ∀ (x y z : R × ↥M), mk x.1 x.2 + mk y.1 y.2 + mk z.1 z.2 = mk x.1 x.2 + (mk y.1 y.2 + mk z.1 z.2)

Next tactic:
localization_tac
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by infer_instance) with
    add := (· + ·)
    nsmul := (· • ·)
    nsmul_zero := fun x =>
      Localization.induction_on x fun x => by simp only [smul_mk, zero_nsmul, mk_zero]
    nsmul_succ := fun n x =>
      Localization.induction_on x fun x => by simp only [smul_mk, succ_nsmul, add_mk_self]
    add_assoc := fun m n k =>
      Localization.induction_on₃ m n k
        (by localization_tac)
    zero_add := fun y =>
      Localization.induction_on y
        (by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
src✝ : CommMonoidWithZero (Localization M) :=
  let_fun this := inferInstance;
  this
y : Localization M
⊢ ∀ (y : R × ↥M), 0 + mk y.1 y.2 = mk y.1 y.2

Next tactic:
localization_tac
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by infer_instance) with
    add := (· + ·)
    nsmul := (· • ·)
    nsmul_zero := fun x =>
      Localization.induction_on x fun x => by simp only [smul_mk, zero_nsmul, mk_zero]
    nsmul_succ := fun n x =>
      Localization.induction_on x fun x => by simp only [smul_mk, succ_nsmul, add_mk_self]
    add_assoc := fun m n k =>
      Localization.induction_on₃ m n k
        (by localization_tac)
    zero_add := fun y =>
      Localization.induction_on y
        (by localization_tac)
    add_zero := fun y =>
      Localization.induction_on y
        (by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
src✝ : CommMonoidWithZero (Localization M) :=
  let_fun this := inferInstance;
  this
y : Localization M
⊢ ∀ (y : R × ↥M), mk y.1 y.2 + 0 = mk y.1 y.2

Next tactic:
localization_tac
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by infer_instance) with
    add := (· + ·)
    nsmul := (· • ·)
    nsmul_zero := fun x =>
      Localization.induction_on x fun x => by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
src✝ : CommMonoidWithZero (Localization M) :=
  let_fun this := inferInstance;
  this
x✝ : Localization M
x : R × ↥M
⊢ (fun x x_1 => x • x_1) 0 (mk x.1 x.2) = 0

Next tactic:
simp only [smul_mk, zero_nsmul, mk_zero]
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by infer_instance) with
    add := (· + ·)
    nsmul := (· • ·)
    nsmul_zero := fun x =>
      Localization.induction_on x fun x => by simp only [smul_mk, zero_nsmul, mk_zero]
    nsmul_succ := fun n x =>
      Localization.induction_on x fun x => by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
src✝ : CommMonoidWithZero (Localization M) :=
  let_fun this := inferInstance;
  this
n : ℕ
x✝ : Localization M
x : R × ↥M
⊢ (fun x x_1 => x • x_1) (n + 1) (mk x.1 x.2) = mk x.1 x.2 + (fun x x_1 => x • x_1) n (mk x.1 x.2)

Next tactic:
simp only [smul_mk, succ_nsmul, add_mk_self]
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by infer_instance) with
    add := (· + ·)
    nsmul := (· • ·)
    nsmul_zero := fun x =>
      Localization.induction_on x fun x => by simp only [smul_mk, zero_nsmul, mk_zero]
    nsmul_succ := fun n x =>
      Localization.induction_on x fun x => by simp only [smul_mk, succ_nsmul, add_mk_self]
    add_assoc := fun m n k =>
      Localization.induction_on₃ m n k
        (by localization_tac)
    zero_add := fun y =>
      Localization.induction_on y
        (by localization_tac)
    add_zero := fun y =>
      Localization.induction_on y
        (by localization_tac)
    add_comm := fun y z =>
      Localization.induction_on₂ z y
        (by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
src✝ : CommMonoidWithZero (Localization M) :=
  let_fun this := inferInstance;
  this
y z : Localization M
⊢ ∀ (x y : R × ↥M), mk y.1 y.2 + mk x.1 x.2 = mk x.1 x.2 + mk y.1 y.2

Next tactic:
localization_tac
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by infer_instance) with
    add := (· + ·)
    nsmul := (· • ·)
    nsmul_zero := fun x =>
      Localization.induction_on x fun x => by simp only [smul_mk, zero_nsmul, mk_zero]
    nsmul_succ := fun n x =>
      Localization.induction_on x fun x => by simp only [smul_mk, succ_nsmul, add_mk_self]
    add_assoc := fun m n k =>
      Localization.induction_on₃ m n k
        (by localization_tac)
    zero_add := fun y =>
      Localization.induction_on y
        (by localization_tac)
    add_zero := fun y =>
      Localization.induction_on y
        (by localization_tac)
    add_comm := fun y z =>
      Localization.induction_on₂ z y
        (by localization_tac)
    left_distrib := fun m n k =>
      Localization.induction_on₃ m n k
        (by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
src✝ : CommMonoidWithZero (Localization M) :=
  let_fun this := inferInstance;
  this
m n k : Localization M
⊢ ∀ (x y z : R × ↥M), mk x.1 x.2 * (mk y.1 y.2 + mk z.1 z.2) = mk x.1 x.2 * mk y.1 y.2 + mk x.1 x.2 * mk z.1 z.2

Next tactic:
localization_tac
instance : CommSemiring (Localization M) :=
  { (show CommMonoidWithZero (Localization M) by infer_instance) with
    add := (· + ·)
    nsmul := (· • ·)
    nsmul_zero := fun x =>
      Localization.induction_on x fun x => by simp only [smul_mk, zero_nsmul, mk_zero]
    nsmul_succ := fun n x =>
      Localization.induction_on x fun x => by simp only [smul_mk, succ_nsmul, add_mk_self]
    add_assoc := fun m n k =>
      Localization.induction_on₃ m n k
        (by localization_tac)
    zero_add := fun y =>
      Localization.induction_on y
        (by localization_tac)
    add_zero := fun y =>
      Localization.induction_on y
        (by localization_tac)
    add_comm := fun y z =>
      Localization.induction_on₂ z y
        (by localization_tac)
    left_distrib := fun m n k =>
      Localization.induction_on₃ m n k
        (by localization_tac)
    right_distrib := fun m n k =>
      Localization.induction_on₃ m n k
        (by 

Proof state:
R : Type u_1
inst✝³ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝² : CommSemiring S
inst✝¹ : Algebra R S
P : Type u_3
inst✝ : CommSemiring P
src✝ : CommMonoidWithZero (Localization M) :=
  let_fun this := inferInstance;
  this
m n k : Localization M
⊢ ∀ (x y z : R × ↥M), (mk x.1 x.2 + mk y.1 y.2) * mk z.1 z.2 = mk x.1 x.2 * mk z.1 z.2 + mk y.1 y.2 * mk z.1 z.2

Next tactic:
localization_tac
instance {S : Type*} [Monoid S] [DistribMulAction S R] [IsScalarTower S R R] :
    DistribMulAction S (Localization M) where
  smul_zero s := by 

Proof state:
R : Type u_1
inst✝⁶ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁵ : CommSemiring S✝
inst✝⁴ : Algebra R S✝
P : Type u_3
inst✝³ : CommSemiring P
S : Type u_4
inst✝² : Monoid S
inst✝¹ : DistribMulAction S R
inst✝ : IsScalarTower S R R
s : S
⊢ s • 0 = 0

Next tactic:
simp only [← Localization.mk_zero 1, Localization.smul_mk, smul_zero]
instance {S : Type*} [Monoid S] [DistribMulAction S R] [IsScalarTower S R R] :
    DistribMulAction S (Localization M) where
  smul_zero s := by simp only [← Localization.mk_zero 1, Localization.smul_mk, smul_zero]
  smul_add s x y :=
    Localization.induction_on₂ x y <|
      Prod.rec fun r₁ x₁ =>
        Prod.rec fun r₂ x₂ => by
          

Proof state:
R : Type u_1
inst✝⁶ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁵ : CommSemiring S✝
inst✝⁴ : Algebra R S✝
P : Type u_3
inst✝³ : CommSemiring P
S : Type u_4
inst✝² : Monoid S
inst✝¹ : DistribMulAction S R
inst✝ : IsScalarTower S R R
s : S
x y : Localization M
r₁ : R
x₁ : ↥M
r₂ : R
x₂ : ↥M
⊢ s • (mk (r₁, x₁).1 (r₁, x₁).2 + mk (r₂, x₂).1 (r₂, x₂).2) =
    s • mk (r₁, x₁).1 (r₁, x₁).2 + s • mk (r₂, x₂).1 (r₂, x₂).2

Next tactic:
simp only [Localization.smul_mk, Localization.add_mk, smul_add, mul_comm _ (s • _),
            mul_comm _ r₁, mul_comm _ r₂, smul_mul_assoc]
instance {S : Type*} [Semiring S] [Module S R] [IsScalarTower S R R] : Module S (Localization M) :=
  { inferInstanceAs (DistribMulAction S (Localization M)) with
    zero_smul :=
      Localization.ind <|
        Prod.rec <| by
          intros
          simp only [Localization.smul_mk, zero_smul, mk_zero]
    add_smul := fun s₁ s₂ =>
      Localization.ind <|
        Prod.rec <| by
          

Proof state:
R : Type u_1
inst✝⁶ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁵ : CommSemiring S✝
inst✝⁴ : Algebra R S✝
P : Type u_3
inst✝³ : CommSemiring P
S : Type u_4
inst✝² : Semiring S
inst✝¹ : Module S R
inst✝ : IsScalarTower S R R
src✝ : DistribMulAction S (Localization M) := inferInstanceAs (DistribMulAction S (Localization M))
s₁ s₂ : S
⊢ ∀ (fst : R) (snd : ↥M),
    (s₁ + s₂) • mk (fst, snd).1 (fst, snd).2 = s₁ • mk (fst, snd).1 (fst, snd).2 + s₂ • mk (fst, snd).1 (fst, snd).2

Next tactic:
intros
instance {S : Type*} [Semiring S] [Module S R] [IsScalarTower S R R] : Module S (Localization M) :=
  { inferInstanceAs (DistribMulAction S (Localization M)) with
    zero_smul :=
      Localization.ind <|
        Prod.rec <| by
          intros
          simp only [Localization.smul_mk, zero_smul, mk_zero]
    add_smul := fun s₁ s₂ =>
      Localization.ind <|
        Prod.rec <| by
          intros
          

Proof state:
R : Type u_1
inst✝⁶ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁵ : CommSemiring S✝
inst✝⁴ : Algebra R S✝
P : Type u_3
inst✝³ : CommSemiring P
S : Type u_4
inst✝² : Semiring S
inst✝¹ : Module S R
inst✝ : IsScalarTower S R R
src✝ : DistribMulAction S (Localization M) := inferInstanceAs (DistribMulAction S (Localization M))
s₁ s₂ : S
fst✝ : R
snd✝ : ↥M
⊢ (s₁ + s₂) • mk (fst✝, snd✝).1 (fst✝, snd✝).2 =
    s₁ • mk (fst✝, snd✝).1 (fst✝, snd✝).2 + s₂ • mk (fst✝, snd✝).1 (fst✝, snd✝).2

Next tactic:
simp only [Localization.smul_mk, add_smul, add_mk_self]
instance {S : Type*} [Semiring S] [Module S R] [IsScalarTower S R R] : Module S (Localization M) :=
  { inferInstanceAs (DistribMulAction S (Localization M)) with
    zero_smul :=
      Localization.ind <|
        Prod.rec <| by
          

Proof state:
R : Type u_1
inst✝⁶ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁵ : CommSemiring S✝
inst✝⁴ : Algebra R S✝
P : Type u_3
inst✝³ : CommSemiring P
S : Type u_4
inst✝² : Semiring S
inst✝¹ : Module S R
inst✝ : IsScalarTower S R R
src✝ : DistribMulAction S (Localization M) := inferInstanceAs (DistribMulAction S (Localization M))
⊢ ∀ (fst : R) (snd : ↥M), 0 • mk (fst, snd).1 (fst, snd).2 = 0

Next tactic:
intros
instance {S : Type*} [Semiring S] [Module S R] [IsScalarTower S R R] : Module S (Localization M) :=
  { inferInstanceAs (DistribMulAction S (Localization M)) with
    zero_smul :=
      Localization.ind <|
        Prod.rec <| by
          intros
          

Proof state:
R : Type u_1
inst✝⁶ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁵ : CommSemiring S✝
inst✝⁴ : Algebra R S✝
P : Type u_3
inst✝³ : CommSemiring P
S : Type u_4
inst✝² : Semiring S
inst✝¹ : Module S R
inst✝ : IsScalarTower S R R
src✝ : DistribMulAction S (Localization M) := inferInstanceAs (DistribMulAction S (Localization M))
fst✝ : R
snd✝ : ↥M
⊢ 0 • mk (fst✝, snd✝).1 (fst✝, snd✝).2 = 0

Next tactic:
simp only [Localization.smul_mk, zero_smul, mk_zero]
instance algebra {S : Type*} [CommSemiring S] [Algebra S R] : Algebra S (Localization M) where
  toRingHom :=
    RingHom.comp
      { Localization.monoidOf M with
        toFun := (monoidOf M).toMap
        map_zero' := by 

Proof state:
R : Type u_1
inst✝⁵ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁴ : CommSemiring S✝
inst✝³ : Algebra R S✝
P : Type u_3
inst✝² : CommSemiring P
S : Type u_4
inst✝¹ : CommSemiring S
inst✝ : Algebra S R
src✝ : Submonoid.LocalizationMap M (Localization M) := monoidOf M
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := ⇑(Submonoid.LocalizationMap.toMap (monoidOf M)),
              map_one' := (_ : OneHom.toFun (↑src✝.toMonoidHom) 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : R),
                OneHom.toFun (↑src✝.toMonoidHom) (x * y) =
                  OneHom.toFun (↑src✝.toMonoidHom) x * OneHom.toFun (↑src✝.toMonoidHom) y) })
      0 =
    0

Next tactic:
rw [← mk_zero (1 : M), mk_one_eq_monoidOf_mk]
instance algebra {S : Type*} [CommSemiring S] [Algebra S R] : Algebra S (Localization M) where
  toRingHom :=
    RingHom.comp
      { Localization.monoidOf M with
        toFun := (monoidOf M).toMap
        map_zero' := by rw [← mk_zero (1 : M), mk_one_eq_monoidOf_mk]
        map_add' := fun x y => by
          

Proof state:
R : Type u_1
inst✝⁵ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁴ : CommSemiring S✝
inst✝³ : Algebra R S✝
P : Type u_3
inst✝² : CommSemiring P
S : Type u_4
inst✝¹ : CommSemiring S
inst✝ : Algebra S R
src✝ : Submonoid.LocalizationMap M (Localization M) := monoidOf M
x y : R
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := ⇑(Submonoid.LocalizationMap.toMap (monoidOf M)),
              map_one' := (_ : OneHom.toFun (↑src✝.toMonoidHom) 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : R),
                OneHom.toFun (↑src✝.toMonoidHom) (x * y) =
                  OneHom.toFun (↑src✝.toMonoidHom) x * OneHom.toFun (↑src✝.toMonoidHom) y) })
      (x + y) =
    OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := ⇑(Submonoid.LocalizationMap.toMap (monoidOf M)),
                map_one' := (_ : OneHom.toFun (↑src✝.toMonoidHom) 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : R),
                  OneHom.toFun (↑src✝.toMonoidHom) (x * y) =
                    OneHom.toFun (↑src✝.toMonoidHom) x * OneHom.toFun (↑src✝.toMonoidHom) y) })
        x +
      OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := ⇑(Submonoid.LocalizationMap.toMap (monoidOf M)),
                map_one' := (_ : OneHom.toFun (↑src✝.toMonoidHom) 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : R),
                  OneHom.toFun (↑src✝.toMonoidHom) (x * y) =
                    OneHom.toFun (↑src✝.toMonoidHom) x * OneHom.toFun (↑src✝.toMonoidHom) y) })
        y

Next tactic:
simp only [← mk_one_eq_monoidOf_mk, add_mk, Submonoid.coe_one, one_mul, add_comm]
instance algebra {S : Type*} [CommSemiring S] [Algebra S R] : Algebra S (Localization M) where
  toRingHom :=
    RingHom.comp
      { Localization.monoidOf M with
        toFun := (monoidOf M).toMap
        map_zero' := by rw [← mk_zero (1 : M), mk_one_eq_monoidOf_mk]
        map_add' := fun x y => by
          simp only [← mk_one_eq_monoidOf_mk, add_mk, Submonoid.coe_one, one_mul, add_comm] }
      (algebraMap S R)
  smul_def' s :=
    Localization.ind <|
      Prod.rec <| by
        intro r x
        dsimp
        simp only [← mk_one_eq_monoidOf_mk, mk_mul, Localization.smul_mk, one_mul,
          Algebra.smul_def]
  commutes' s :=
    Localization.ind <|
      Prod.rec <| by
        intro r x
        dsimp
        

Proof state:
R : Type u_1
inst✝⁵ : CommSemiring R
M : Submonoid R
S✝ : Type u_2
inst✝⁴ : CommSemiring S✝
inst✝³ : Algebra R S✝
P : Type u_3
inst✝² : CommSemiring P
S : Type u_4
inst✝¹ : CommSemiring S
inst✝ : Algebra S R
s : S
r : R
x : ↥M
⊢ (Submonoid.LocalizationMap.toMap (monoidOf M)) ((algebraMap S R) s) * mk r x =
    mk r x * (Submonoid.LocalizationMap.toMap (monoidOf M)) ((algebraMap S R) s)

Next tactic:
simp only [← mk_one_eq_monoidOf_mk, mk_mul, Localization.smul_mk, one_mul, mul_one,
          Algebra.commutes]