l3lab/ntp-mathlib huggingface dataset:
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    rintro ⟨⟩
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝¹ : FreeAlgebra R X
a✝ : Pre R X
⊢ 1 * Quot.mk (Rel R X) a✝ = Quot.mk (Rel R X) a✝

Next tactic:
exact Quot.sound Rel.one_mul
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    rintro ⟨⟩
    exact Quot.sound Rel.one_mul
  mul_one := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a : FreeAlgebra R X), a * 1 = a

Next tactic:
rintro ⟨⟩
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    rintro ⟨⟩
    exact Quot.sound Rel.one_mul
  mul_one := by
    rintro ⟨⟩
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝¹ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) a✝ * 1 = Quot.mk (Rel R X) a✝

Next tactic:
exact Quot.sound Rel.mul_one
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    rintro ⟨⟩
    exact Quot.sound Rel.one_mul
  mul_one := by
    rintro ⟨⟩
    exact Quot.sound Rel.mul_one
  zero_mul := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a : FreeAlgebra R X), 0 * a = 0

Next tactic:
rintro ⟨⟩
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    rintro ⟨⟩
    exact Quot.sound Rel.one_mul
  mul_one := by
    rintro ⟨⟩
    exact Quot.sound Rel.mul_one
  zero_mul := by
    rintro ⟨⟩
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝¹ : FreeAlgebra R X
a✝ : Pre R X
⊢ 0 * Quot.mk (Rel R X) a✝ = 0

Next tactic:
exact Quot.sound Rel.zero_mul
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    rintro ⟨⟩
    exact Quot.sound Rel.one_mul
  mul_one := by
    rintro ⟨⟩
    exact Quot.sound Rel.mul_one
  zero_mul := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_mul
  mul_zero := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a : FreeAlgebra R X), a * 0 = 0

Next tactic:
rintro ⟨⟩
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    rintro ⟨⟩
    exact Quot.sound Rel.one_mul
  mul_one := by
    rintro ⟨⟩
    exact Quot.sound Rel.mul_one
  zero_mul := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_mul
  mul_zero := by
    rintro ⟨⟩
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝¹ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) a✝ * 0 = 0

Next tactic:
exact Quot.sound Rel.mul_zero
instance instDistrib : Distrib (FreeAlgebra R X) where
  left_distrib := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a b c : FreeAlgebra R X), a * (b + c) = a * b + a * c

Next tactic:
rintro ⟨⟩ ⟨⟩ ⟨⟩
instance instDistrib : Distrib (FreeAlgebra R X) where
  left_distrib := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    

Proof state:
case mk.mk.mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝³ : FreeAlgebra R X
a✝² : Pre R X
b✝ : FreeAlgebra R X
a✝¹ : Pre R X
c✝ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) a✝² * (Quot.mk (Rel R X) a✝¹ + Quot.mk (Rel R X) a✝) =
    Quot.mk (Rel R X) a✝² * Quot.mk (Rel R X) a✝¹ + Quot.mk (Rel R X) a✝² * Quot.mk (Rel R X) a✝

Next tactic:
exact Quot.sound Rel.left_distrib
instance instDistrib : Distrib (FreeAlgebra R X) where
  left_distrib := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.left_distrib
  right_distrib := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a b c : FreeAlgebra R X), (a + b) * c = a * c + b * c

Next tactic:
rintro ⟨⟩ ⟨⟩ ⟨⟩
instance instDistrib : Distrib (FreeAlgebra R X) where
  left_distrib := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.left_distrib
  right_distrib := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    

Proof state:
case mk.mk.mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝³ : FreeAlgebra R X
a✝² : Pre R X
b✝ : FreeAlgebra R X
a✝¹ : Pre R X
c✝ : FreeAlgebra R X
a✝ : Pre R X
⊢ (Quot.mk (Rel R X) a✝² + Quot.mk (Rel R X) a✝¹) * Quot.mk (Rel R X) a✝ =
    Quot.mk (Rel R X) a✝² * Quot.mk (Rel R X) a✝ + Quot.mk (Rel R X) a✝¹ * Quot.mk (Rel R X) a✝

Next tactic:
exact Quot.sound Rel.right_distrib
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a b c : FreeAlgebra R X), a + b + c = a + (b + c)

Next tactic:
rintro ⟨⟩ ⟨⟩ ⟨⟩
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    

Proof state:
case mk.mk.mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝³ : FreeAlgebra R X
a✝² : Pre R X
b✝ : FreeAlgebra R X
a✝¹ : Pre R X
c✝ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) a✝² + Quot.mk (Rel R X) a✝¹ + Quot.mk (Rel R X) a✝ =
    Quot.mk (Rel R X) a✝² + (Quot.mk (Rel R X) a✝¹ + Quot.mk (Rel R X) a✝)

Next tactic:
exact Quot.sound Rel.add_assoc
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a : FreeAlgebra R X), 0 + a = a

Next tactic:
rintro ⟨⟩
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝¹ : FreeAlgebra R X
a✝ : Pre R X
⊢ 0 + Quot.mk (Rel R X) a✝ = Quot.mk (Rel R X) a✝

Next tactic:
exact Quot.sound Rel.zero_add
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a : FreeAlgebra R X), a + 0 = a

Next tactic:
rintro ⟨⟩
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝¹ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) a✝ + 0 = Quot.mk (Rel R X) a✝

Next tactic:
change Quot.mk _ _ = _
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝¹ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) (a✝ + 0) = Quot.mk (Rel R X) a✝

Next tactic:
rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (x : FreeAlgebra R X), (fun x x_1 => x • x_1) 0 x = 0

Next tactic:
rintro ⟨⟩
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    rintro ⟨⟩
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
x✝ : FreeAlgebra R X
a✝ : Pre R X
⊢ (fun x x_1 => x • x_1) 0 (Quot.mk (Rel R X) a✝) = 0

Next tactic:
change Quot.mk _ (_ * _) = _
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    rintro ⟨⟩
    change Quot.mk _ (_ * _) = _
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
x✝ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) (Pre.ofScalar ((algebraMap ℕ R) 0) * a✝) = 0

Next tactic:
rw [map_zero]
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    rintro ⟨⟩
    change Quot.mk _ (_ * _) = _
    rw [map_zero]
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
x✝ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) (Pre.ofScalar 0 * a✝) = 0

Next tactic:
exact Quot.sound Rel.zero_mul
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    rintro ⟨⟩
    change Quot.mk _ (_ * _) = _
    rw [map_zero]
    exact Quot.sound Rel.zero_mul
  nsmul_succ n := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
n : ℕ
⊢ ∀ (x : FreeAlgebra R X), (fun x x_1 => x • x_1) (n + 1) x = x + (fun x x_1 => x • x_1) n x

Next tactic:
rintro ⟨a⟩
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    rintro ⟨⟩
    change Quot.mk _ (_ * _) = _
    rw [map_zero]
    exact Quot.sound Rel.zero_mul
  nsmul_succ n := by
    rintro ⟨a⟩
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
n : ℕ
x✝ : FreeAlgebra R X
a : Pre R X
⊢ (fun x x_1 => x • x_1) (n + 1) (Quot.mk (Rel R X) a) =
    Quot.mk (Rel R X) a + (fun x x_1 => x • x_1) n (Quot.mk (Rel R X) a)

Next tactic:
dsimp only [HSMul.hSMul, instSMul, Quot.map]
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    rintro ⟨⟩
    change Quot.mk _ (_ * _) = _
    rw [map_zero]
    exact Quot.sound Rel.zero_mul
  nsmul_succ n := by
    rintro ⟨a⟩
    dsimp only [HSMul.hSMul, instSMul, Quot.map]
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
n : ℕ
x✝ : FreeAlgebra R X
a : Pre R X
⊢ Quot.mk (Rel R X) (Pre.ofScalar ((algebraMap ℕ R) (n + 1)) * a) =
    Quot.mk (Rel R X) a + Quot.mk (Rel R X) (Pre.ofScalar ((algebraMap ℕ R) n) * a)

Next tactic:
rw [map_add, map_one, add_comm, mk_mul, mk_mul, ← one_add_mul (_ : FreeAlgebra R X)]
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    rintro ⟨⟩
    change Quot.mk _ (_ * _) = _
    rw [map_zero]
    exact Quot.sound Rel.zero_mul
  nsmul_succ n := by
    rintro ⟨a⟩
    dsimp only [HSMul.hSMul, instSMul, Quot.map]
    rw [map_add, map_one, add_comm, mk_mul, mk_mul, ← one_add_mul (_ : FreeAlgebra R X)]
    

Proof state:
case mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
n : ℕ
x✝ : FreeAlgebra R X
a : Pre R X
⊢ Quot.mk (Rel R X) (Pre.ofScalar (1 + (algebraMap ℕ R) n)) * Quot.mk (Rel R X) a =
    (1 + Quot.mk (Rel R X) (Pre.ofScalar ((algebraMap ℕ R) n))) * Quot.mk (Rel R X) a

Next tactic:
congr 1
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_comm
  nsmul := (· • ·)
  nsmul_zero := by
    rintro ⟨⟩
    change Quot.mk _ (_ * _) = _
    rw [map_zero]
    exact Quot.sound Rel.zero_mul
  nsmul_succ n := by
    rintro ⟨a⟩
    dsimp only [HSMul.hSMul, instSMul, Quot.map]
    rw [map_add, map_one, add_comm, mk_mul, mk_mul, ← one_add_mul (_ : FreeAlgebra R X)]
    congr 1
    

Proof state:
case mk.e_a
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
n : ℕ
x✝ : FreeAlgebra R X
a : Pre R X
⊢ Quot.mk (Rel R X) (Pre.ofScalar (1 + (algebraMap ℕ R) n)) = 1 + Quot.mk (Rel R X) (Pre.ofScalar ((algebraMap ℕ R) n))

Next tactic:
exact Quot.sound Rel.add_scalar
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a b : FreeAlgebra R X), a + b = b + a

Next tactic:
rintro ⟨⟩ ⟨⟩
instance instAddCommMonoid : AddCommMonoid (FreeAlgebra R X) where
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.add_assoc
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound Rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound Rel.add_comm, Quot.sound Rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    

Proof state:
case mk.mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝² : FreeAlgebra R X
a✝¹ : Pre R X
b✝ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) a✝¹ + Quot.mk (Rel R X) a✝ = Quot.mk (Rel R X) a✝ + Quot.mk (Rel R X) a✝¹

Next tactic:
exact Quot.sound Rel.add_comm
instance : Semiring (FreeAlgebra R X) where
  __ := instMonoidWithZero R X
  __ := instAddCommMonoid R X
  __ := instDistrib R X
  natCast n := Quot.mk _ (n : R)
  natCast_zero := by 

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
src✝² : MonoidWithZero (FreeAlgebra R X) := instMonoidWithZero R X
src✝¹ : AddCommMonoid (FreeAlgebra R X) := instAddCommMonoid R X
src✝ : Distrib (FreeAlgebra R X) := instDistrib R X
⊢ NatCast.natCast 0 = 0

Next tactic:
simp
instance : Semiring (FreeAlgebra R X) where
  __ := instMonoidWithZero R X
  __ := instAddCommMonoid R X
  __ := instDistrib R X
  natCast n := Quot.mk _ (n : R)
  natCast_zero := by simp; 

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
src✝² : MonoidWithZero (FreeAlgebra R X) := instMonoidWithZero R X
src✝¹ : AddCommMonoid (FreeAlgebra R X) := instAddCommMonoid R X
src✝ : Distrib (FreeAlgebra R X) := instDistrib R X
⊢ Quot.mk (Rel R X) (Pre.ofScalar 0) = 0

Next tactic:
rfl
instance : Semiring (FreeAlgebra R X) where
  __ := instMonoidWithZero R X
  __ := instAddCommMonoid R X
  __ := instDistrib R X
  natCast n := Quot.mk _ (n : R)
  natCast_zero := by simp; rfl
  natCast_succ n := by 

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
src✝² : MonoidWithZero (FreeAlgebra R X) := instMonoidWithZero R X
src✝¹ : AddCommMonoid (FreeAlgebra R X) := instAddCommMonoid R X
src✝ : Distrib (FreeAlgebra R X) := instDistrib R X
n : ℕ
⊢ NatCast.natCast (n + 1) = NatCast.natCast n + 1

Next tactic:
simp
instance : Semiring (FreeAlgebra R X) where
  __ := instMonoidWithZero R X
  __ := instAddCommMonoid R X
  __ := instDistrib R X
  natCast n := Quot.mk _ (n : R)
  natCast_zero := by simp; rfl
  natCast_succ n := by simp; 

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
src✝² : MonoidWithZero (FreeAlgebra R X) := instMonoidWithZero R X
src✝¹ : AddCommMonoid (FreeAlgebra R X) := instAddCommMonoid R X
src✝ : Distrib (FreeAlgebra R X) := instDistrib R X
n : ℕ
⊢ Quot.mk (Rel R X) (Pre.ofScalar (↑n + 1)) = Quot.mk (Rel R X) (Pre.ofScalar ↑n) + 1

Next tactic:
exact Quot.sound Rel.add_scalar
instance {R S A} [CommSemiring R] [CommSemiring S] [CommSemiring A]
    [SMul R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] :
    IsScalarTower R S (FreeAlgebra A X) where
  smul_assoc r s x := by
    

Proof state:
R✝ : Type u_1
inst✝⁷ : CommSemiring R✝
X : Type u_2
R : Type ?u.72981
S : Type ?u.72984
A : Type ?u.72987
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : SMul R S
inst✝² : Algebra R A
inst✝¹ : Algebra S A
inst✝ : IsScalarTower R S A
r : R
s : S
x : FreeAlgebra A X
⊢ (r • s) • x = r • s • x

Next tactic:
change algebraMap S A (r • s) • x = algebraMap R A _ • (algebraMap S A _ • x)
instance {R S A} [CommSemiring R] [CommSemiring S] [CommSemiring A]
    [SMul R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] :
    IsScalarTower R S (FreeAlgebra A X) where
  smul_assoc r s x := by
    change algebraMap S A (r • s) • x = algebraMap R A _ • (algebraMap S A _ • x)
    

Proof state:
R✝ : Type u_1
inst✝⁷ : CommSemiring R✝
X : Type u_2
R : Type ?u.72981
S : Type ?u.72984
A : Type ?u.72987
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : SMul R S
inst✝² : Algebra R A
inst✝¹ : Algebra S A
inst✝ : IsScalarTower R S A
r : R
s : S
x : FreeAlgebra A X
⊢ (algebraMap S A) (r • s) • x = (algebraMap R A) r • (algebraMap S A) s • x

Next tactic:
rw [← smul_assoc]
instance {R S A} [CommSemiring R] [CommSemiring S] [CommSemiring A]
    [SMul R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] :
    IsScalarTower R S (FreeAlgebra A X) where
  smul_assoc r s x := by
    change algebraMap S A (r • s) • x = algebraMap R A _ • (algebraMap S A _ • x)
    rw [← smul_assoc]
    

Proof state:
R✝ : Type u_1
inst✝⁷ : CommSemiring R✝
X : Type u_2
R : Type ?u.72981
S : Type ?u.72984
A : Type ?u.72987
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : SMul R S
inst✝² : Algebra R A
inst✝¹ : Algebra S A
inst✝ : IsScalarTower R S A
r : R
s : S
x : FreeAlgebra A X
⊢ (algebraMap S A) (r • s) • x = ((algebraMap R A) r • (algebraMap S A) s) • x

Next tactic:
congr
instance {R S A} [CommSemiring R] [CommSemiring S] [CommSemiring A]
    [SMul R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] :
    IsScalarTower R S (FreeAlgebra A X) where
  smul_assoc r s x := by
    change algebraMap S A (r • s) • x = algebraMap R A _ • (algebraMap S A _ • x)
    rw [← smul_assoc]
    congr
    

Proof state:
case e_a
R✝ : Type u_1
inst✝⁷ : CommSemiring R✝
X : Type u_2
R : Type ?u.72981
S : Type ?u.72984
A : Type ?u.72987
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : SMul R S
inst✝² : Algebra R A
inst✝¹ : Algebra S A
inst✝ : IsScalarTower R S A
r : R
s : S
x : FreeAlgebra A X
⊢ (algebraMap S A) (r • s) = (algebraMap R A) r • (algebraMap S A) s

Next tactic:
simp only [Algebra.algebraMap_eq_smul_one, smul_eq_mul]
instance {R S A} [CommSemiring R] [CommSemiring S] [CommSemiring A]
    [SMul R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] :
    IsScalarTower R S (FreeAlgebra A X) where
  smul_assoc r s x := by
    change algebraMap S A (r • s) • x = algebraMap R A _ • (algebraMap S A _ • x)
    rw [← smul_assoc]
    congr
    simp only [Algebra.algebraMap_eq_smul_one, smul_eq_mul]
    

Proof state:
case e_a
R✝ : Type u_1
inst✝⁷ : CommSemiring R✝
X : Type u_2
R : Type ?u.72981
S : Type ?u.72984
A : Type ?u.72987
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : SMul R S
inst✝² : Algebra R A
inst✝¹ : Algebra S A
inst✝ : IsScalarTower R S A
r : R
s : S
x : FreeAlgebra A X
⊢ (r • s) • 1 = r • 1 * s • 1

Next tactic:
rw [smul_assoc, ← smul_one_mul]
@[simp]
theorem quot_mk_eq_ι (m : X) : Quot.mk (FreeAlgebra.Rel R X) m = ι R m := by 

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
m : X
⊢ Quot.mk (Rel R X) (Pre.of m) = ι R m

Next tactic:
rw [ι_def]
/-- Internal definition used to define `lift` -/
private def liftAux (f : X → A) : FreeAlgebra R X →ₐ[R] A where
  toFun a :=
    Quot.liftOn a (liftFun _ _ f) fun a b h ↦ by
      

Proof state:
R : Type u_1
inst✝² : CommSemiring R
X : Type u_2
A : Type u_3
inst✝¹ : Semiring A
inst✝ : Algebra R A
f : X → A
a✝ : FreeAlgebra R X
a b : Pre R X
h : Rel R X a b
⊢ liftFun R X f a = liftFun R X f b

Next tactic:
induction' h
/-- Internal definition used to define `lift` -/
private def liftAux (f : X → A) : FreeAlgebra R X →ₐ[R] A where
  toFun a :=
    Quot.liftOn a (liftFun _ _ f) fun a b h ↦ by
      induction' h
      · 

Proof state:
case add_scalar
R : Type u_1
inst✝² : CommSemiring R
X : Type u_2
A : Type u_3
inst✝¹ : Semiring A
inst✝ : Algebra R A
f : X → A
a✝ : FreeAlgebra R X
a b : Pre R X
r✝ s✝ : R
⊢ liftFun R X f (Pre.ofScalar (r✝ + s✝)) = liftFun R X f (Pre.ofScalar r✝ + Pre.ofScalar s✝)

Next tactic:
exact (algebraMap R A).map_add _ _
/-- Internal definition used to define `lift` -/
private def liftAux (f : X → A) : FreeAlgebra R X →ₐ[R] A where
  toFun a :=
    Quot.liftOn a (liftFun _ _ f) fun a b h ↦ by
      induction' h
      · exact (algebraMap R A).map_add _ _
      · 

Proof state:
case mul_scalar
R : Type u_1
inst✝² : CommSemiring R
X : Type u_2
A : Type u_3
inst✝¹ : Semiring A
inst✝ : Algebra R A
f : X → A
a✝ : FreeAlgebra R X
a b : Pre R X
r✝ s✝ : R
⊢ liftFun R X f (Pre.ofScalar (r✝ * s✝)) = liftFun R X f (Pre.ofScalar r✝ * Pre.ofScalar s✝)

Next tactic:
exact (algebraMap R A).map_mul _ _
/-- Internal definition used to define `lift` -/
private def liftAux (f : X → A) : FreeAlgebra R X →ₐ[R] A where
  toFun a :=
    Quot.liftOn a (liftFun _ _ f) fun a b h ↦ by
      induction' h
      · exact (algebraMap R A).map_add _ _
      · exact (algebraMap R A).map_mul _ _
      · 

Proof state:
case central_scalar
R : Type u_1
inst✝² : CommSemiring R
X : Type u_2
A : Type u_3
inst✝¹ : Semiring A
inst✝ : Algebra R A
f : X → A
a✝¹ : FreeAlgebra R X
a b : Pre R X
r✝ : R
a✝ : Pre R X
⊢ liftFun R X f (Pre.ofScalar r✝ * a✝) = liftFun R X f (a✝ * Pre.ofScalar r✝)

Next tactic:
apply Algebra.commutes