l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem single_mul_single [Mul G] {a₁ a₂ : G} {b₁ b₂ : k} :
    single a₁ b₁ * single a₂ b₂ = single (a₁ * a₂) (b₁ * b₂) :=
  (sum_single_index (by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
a₁ a₂ : G
b₁ b₂ : k
⊢ (sum (single a₂ b₂) fun a₂ b₂ => single (a₁ * a₂) (0 * b₂)) = 0

Next tactic:
simp only [zero_mul, single_zero, sum_zero]
@[simp]
theorem single_mul_single [Mul G] {a₁ a₂ : G} {b₁ b₂ : k} :
    single a₁ b₁ * single a₂ b₂ = single (a₁ * a₂) (b₁ * b₂) :=
  (sum_single_index (by simp only [zero_mul, single_zero, sum_zero])).trans
    (sum_single_index (by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
a₁ a₂ : G
b₁ b₂ : k
⊢ single (a₁ * a₂) (b₁ * 0) = 0

Next tactic:
rw [mul_zero, single_zero]
@[simp]
theorem single_pow [Monoid G] {a : G} {b : k} : ∀ n : ℕ, single a b ^ n = single (a ^ n) (b ^ n)
  | 0 => by
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Monoid G
a : G
b : k
⊢ single a b ^ 0 = single (a ^ 0) (b ^ 0)

Next tactic:
simp only [pow_zero]
@[simp]
theorem single_pow [Monoid G] {a : G} {b : k} : ∀ n : ℕ, single a b ^ n = single (a ^ n) (b ^ n)
  | 0 => by
    simp only [pow_zero]
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Monoid G
a : G
b : k
⊢ 1 = single 1 1

Next tactic:
rfl
@[simp]
theorem single_pow [Monoid G] {a : G} {b : k} : ∀ n : ℕ, single a b ^ n = single (a ^ n) (b ^ n)
  | 0 => by
    simp only [pow_zero]
    rfl
  | n + 1 => by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Monoid G
a : G
b : k
n : ℕ
⊢ single a b ^ (n + 1) = single (a ^ (n + 1)) (b ^ (n + 1))

Next tactic:
simp only [pow_succ, single_pow n, single_mul_single]
/-- Like `Finsupp.mapDomain_zero`, but for the `1` we define in this file -/
@[simp]
theorem mapDomain_one {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [One α] [One α₂]
    {F : Type*} [OneHomClass F α α₂] (f : F) :
    (mapDomain f (1 : MonoidAlgebra β α) : MonoidAlgebra β α₂) = (1 : MonoidAlgebra β α₂) := by
  

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : One α
inst✝¹ : One α₂
F : Type u_6
inst✝ : OneHomClass F α α₂
f : F
⊢ mapDomain (⇑f) 1 = 1

Next tactic:
simp_rw [one_def, mapDomain_single, map_one]
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
⊢ mapDomain (⇑f) (x * y) = mapDomain (⇑f) x * mapDomain (⇑f) y

Next tactic:
simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
  

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
⊢ (sum x fun a b => sum y fun a_1 b_1 => fun₀ | f a * f a_1 => b * b_1) =
    sum (mapDomain (⇑f) x) fun a₁ b₁ => sum (mapDomain (⇑f) y) fun a₂ b₂ => single (a₁ * a₂) (b₁ * b₂)

Next tactic:
rw [Finsupp.sum_mapDomain_index]
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
  rw [Finsupp.sum_mapDomain_index]
  · 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
⊢ (sum x fun a b => sum y fun a_1 b_1 => fun₀ | f a * f a_1 => b * b_1) =
    sum x fun a m => sum (mapDomain (⇑f) y) fun a₂ b₂ => single (f a * a₂) (m * b₂)

Next tactic:
congr
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
  rw [Finsupp.sum_mapDomain_index]
  · congr
    

Proof state:
case e_g
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
⊢ (fun a b => sum y fun a_1 b_1 => fun₀ | f a * f a_1 => b * b_1) = fun a m =>
    sum (mapDomain (⇑f) y) fun a₂ b₂ => single (f a * a₂) (m * b₂)

Next tactic:
ext a b
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
  rw [Finsupp.sum_mapDomain_index]
  · congr
    ext a b
    

Proof state:
case e_g.h.h
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
a : α
b : β
⊢ (sum y fun a_1 b_1 => fun₀ | f a * f a_1 => b * b_1) = sum (mapDomain (⇑f) y) fun a₂ b₂ => single (f a * a₂) (b * b₂)

Next tactic:
rw [Finsupp.sum_mapDomain_index]
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
  rw [Finsupp.sum_mapDomain_index]
  · congr
    ext a b
    rw [Finsupp.sum_mapDomain_index]
    · 

Proof state:
case e_g.h.h.h_zero
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
a : α
b : β
⊢ ∀ (b_1 : α₂), single (f a * b_1) (b * 0) = 0

Next tactic:
simp
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
  rw [Finsupp.sum_mapDomain_index]
  · congr
    ext a b
    rw [Finsupp.sum_mapDomain_index]
    · simp
    · 

Proof state:
case e_g.h.h.h_add
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
a : α
b : β
⊢ ∀ (b_1 : α₂) (m₁ m₂ : β),
    single (f a * b_1) (b * (m₁ + m₂)) = single (f a * b_1) (b * m₁) + single (f a * b_1) (b * m₂)

Next tactic:
simp [mul_add]
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
  rw [Finsupp.sum_mapDomain_index]
  · congr
    ext a b
    rw [Finsupp.sum_mapDomain_index]
    · simp
    · simp [mul_add]
  · 

Proof state:
case h_zero
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
⊢ ∀ (b : α₂), (sum (mapDomain (⇑f) y) fun a₂ b₂ => single (b * a₂) (0 * b₂)) = 0

Next tactic:
simp
/-- Like `Finsupp.mapDomain_add`, but for the convolutive multiplication we define in this file -/
theorem mapDomain_mul {α : Type*} {β : Type*} {α₂ : Type*} [Semiring β] [Mul α] [Mul α₂]
    {F : Type*} [MulHomClass F α α₂] (f : F) (x y : MonoidAlgebra β α) :
    mapDomain f (x * y) = mapDomain f x * mapDomain f y := by
  simp_rw [mul_def, mapDomain_sum, mapDomain_single, map_mul]
  rw [Finsupp.sum_mapDomain_index]
  · congr
    ext a b
    rw [Finsupp.sum_mapDomain_index]
    · simp
    · simp [mul_add]
  · simp
  · 

Proof state:
case h_add
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁴ : Semiring k
α : Type u_3
β : Type u_4
α₂ : Type u_5
inst✝³ : Semiring β
inst✝² : Mul α
inst✝¹ : Mul α₂
F : Type u_6
inst✝ : MulHomClass F α α₂
f : F
x y : MonoidAlgebra β α
⊢ ∀ (b : α₂) (m₁ m₂ : β),
    (sum (mapDomain (⇑f) y) fun a₂ b₂ => single (b * a₂) ((m₁ + m₂) * b₂)) =
      (sum (mapDomain (⇑f) y) fun a₂ b₂ => single (b * a₂) (m₁ * b₂)) +
        sum (mapDomain (⇑f) y) fun a₂ b₂ => single (b * a₂) (m₂ * b₂)

Next tactic:
simp [add_mul]
/-- The embedding of a magma into its magma algebra. -/
@[simps]
def ofMagma [Mul G] : G →ₙ* MonoidAlgebra k G where
  toFun a := single a 1
  map_mul' a b := by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
a b : G
⊢ (fun a => single a 1) (a * b) = (fun a => single a 1) a * (fun a => single a 1) b

Next tactic:
simp only [mul_def, mul_one, sum_single_index, single_eq_zero, mul_zero]
theorem smul_of [MulOneClass G] (g : G) (r : k) : r • of k G g = single g r := by
  -- Porting note: Was `simp`.
  

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : MulOneClass G
g : G
r : k
⊢ r • (of k G) g = single g r

Next tactic:
rw [of_apply, smul_single', mul_one]
theorem of_injective [MulOneClass G] [Nontrivial k] :
    Function.Injective (of k G) := fun a b h => by
  

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝² : Semiring k
inst✝¹ : MulOneClass G
inst✝ : Nontrivial k
a b : G
h : (of k G) a = (of k G) b
⊢ a = b

Next tactic:
simpa using (single_eq_single_iff _ _ _ _).mp h
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  

Proof state:
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
⊢ (f * single x r) z = f y * r

Next tactic:
classical exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by simp
      calc
        (HMul.hMul (β := MonoidAlgebra k G) f (single x r)) z =
            sum f fun a b => if a = y then b * r else 0 := by simp only [mul_apply, A, H]
        _ = if y ∈ f.support then f y * r else 0 := (f.support.sum_ite_eq' _ _)
        _ = f y * r := by split_ifs with h <;> simp at h <;> simp [h]
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  classical 

Proof state:
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
⊢ (f * single x r) z = f y * r

Next tactic:
exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by simp
      calc
        (HMul.hMul (β := MonoidAlgebra k G) f (single x r)) z =
            sum f fun a b => if a = y then b * r else 0 := by simp only [mul_apply, A, H]
        _ = if y ∈ f.support then f y * r else 0 := (f.support.sum_ite_eq' _ _)
        _ = f y * r := by split_ifs with h <;> simp at h <;> simp [h]
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  classical exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by 

Proof state:
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
a₁ : G
b₁ : k
⊢ (if a₁ * x = z then b₁ * 0 else 0) = 0

Next tactic:
simp
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  classical exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by simp
      calc
        (HMul.hMul (β := MonoidAlgebra k G) f (single x r)) z =
            sum f fun a b => if a = y then b * r else 0 := by 

Proof state:
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
A :
  ∀ (a₁ : G) (b₁ : k),
    (sum (single x r) fun a₂ b₂ => if a₁ * a₂ = z then b₁ * b₂ else 0) = if a₁ * x = z then b₁ * r else 0
⊢ (f * single x r) z = sum f fun a b => if a = y then b * r else 0

Next tactic:
simp only [mul_apply, A, H]
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  classical exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by simp
      calc
        (HMul.hMul (β := MonoidAlgebra k G) f (single x r)) z =
            sum f fun a b => if a = y then b * r else 0 := by simp only [mul_apply, A, H]
        _ = if y ∈ f.support then f y * r else 0 := (f.support.sum_ite_eq' _ _)
        _ = f y * r := by 

Proof state:
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
A :
  ∀ (a₁ : G) (b₁ : k),
    (sum (single x r) fun a₂ b₂ => if a₁ * a₂ = z then b₁ * b₂ else 0) = if a₁ * x = z then b₁ * r else 0
⊢ (if y ∈ f.support then f y * r else 0) = f y * r

Next tactic:
split_ifs with h
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  classical exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by simp
      calc
        (HMul.hMul (β := MonoidAlgebra k G) f (single x r)) z =
            sum f fun a b => if a = y then b * r else 0 := by simp only [mul_apply, A, H]
        _ = if y ∈ f.support then f y * r else 0 := (f.support.sum_ite_eq' _ _)
        _ = f y * r := by split_ifs with h <;> 

Proof state:
case pos
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
A :
  ∀ (a₁ : G) (b₁ : k),
    (sum (single x r) fun a₂ b₂ => if a₁ * a₂ = z then b₁ * b₂ else 0) = if a₁ * x = z then b₁ * r else 0
h : y ∈ f.support
⊢ f y * r = f y * r

Next tactic:
simp at h
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  classical exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by simp
      calc
        (HMul.hMul (β := MonoidAlgebra k G) f (single x r)) z =
            sum f fun a b => if a = y then b * r else 0 := by simp only [mul_apply, A, H]
        _ = if y ∈ f.support then f y * r else 0 := (f.support.sum_ite_eq' _ _)
        _ = f y * r := by split_ifs with h <;> 

Proof state:
case neg
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
A :
  ∀ (a₁ : G) (b₁ : k),
    (sum (single x r) fun a₂ b₂ => if a₁ * a₂ = z then b₁ * b₂ else 0) = if a₁ * x = z then b₁ * r else 0
h : y ∉ f.support
⊢ 0 = f y * r

Next tactic:
simp at h
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  classical exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by simp
      calc
        (HMul.hMul (β := MonoidAlgebra k G) f (single x r)) z =
            sum f fun a b => if a = y then b * r else 0 := by simp only [mul_apply, A, H]
        _ = if y ∈ f.support then f y * r else 0 := (f.support.sum_ite_eq' _ _)
        _ = f y * r := by split_ifs with h <;> simp at h <;> 

Proof state:
case pos
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
A :
  ∀ (a₁ : G) (b₁ : k),
    (sum (single x r) fun a₂ b₂ => if a₁ * a₂ = z then b₁ * b₂ else 0) = if a₁ * x = z then b₁ * r else 0
h : ¬f y = 0
⊢ f y * r = f y * r

Next tactic:
simp [h]
theorem mul_single_apply_aux [Mul G] (f : MonoidAlgebra k G) {r : k} {x y z : G}
    (H : ∀ a, a * x = z ↔ a = y) : (f * single x r) z = f y * r := by
  classical exact
      have A :
        ∀ a₁ b₁,
          ((single x r).sum fun a₂ b₂ => ite (a₁ * a₂ = z) (b₁ * b₂) 0) =
            ite (a₁ * x = z) (b₁ * r) 0 :=
        fun a₁ b₁ => sum_single_index <| by simp
      calc
        (HMul.hMul (β := MonoidAlgebra k G) f (single x r)) z =
            sum f fun a b => if a = y then b * r else 0 := by simp only [mul_apply, A, H]
        _ = if y ∈ f.support then f y * r else 0 := (f.support.sum_ite_eq' _ _)
        _ = f y * r := by split_ifs with h <;> simp at h <;> 

Proof state:
case neg
k : Type u₁
G : Type u₂
H✝ : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
f : MonoidAlgebra k G
r : k
x y z : G
H : ∀ (a : G), a * x = z ↔ a = y
A :
  ∀ (a₁ : G) (b₁ : k),
    (sum (single x r) fun a₂ b₂ => if a₁ * a₂ = z then b₁ * b₂ else 0) = if a₁ * x = z then b₁ * r else 0
h : f y = 0
⊢ 0 = f y * r

Next tactic:
simp [h]
theorem mul_single_one_apply [MulOneClass G] (f : MonoidAlgebra k G) (r : k) (x : G) :
    (HMul.hMul (β := MonoidAlgebra k G) f (single 1 r)) x = f x * r :=
  f.mul_single_apply_aux fun a => by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : MulOneClass G
f : MonoidAlgebra k G
r : k
x a : G
⊢ a * 1 = x ↔ a = x

Next tactic:
rw [mul_one]
theorem mul_single_apply_of_not_exists_mul [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G)
    (h : ¬∃ d, g' = d * g) : (x * single g r) g' = 0 := by
  

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
r : k
g g' : G
x : MonoidAlgebra k G
h : ¬∃ d, g' = d * g
⊢ (x * single g r) g' = 0

Next tactic:
classical
    rw [mul_apply, Finsupp.sum_comm, Finsupp.sum_single_index]
    swap
    · simp_rw [Finsupp.sum, mul_zero, ite_self, Finset.sum_const_zero]
    · apply Finset.sum_eq_zero
      simp_rw [ite_eq_right_iff]
      rintro g'' _hg'' rfl
      exfalso
      exact h ⟨_, rfl⟩
theorem mul_single_apply_of_not_exists_mul [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G)
    (h : ¬∃ d, g' = d * g) : (x * single g r) g' = 0 := by
  classical
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
r : k
g g' : G
x : MonoidAlgebra k G
h : ¬∃ d, g' = d * g
⊢ (x * single g r) g' = 0

Next tactic:
rw [mul_apply, Finsupp.sum_comm, Finsupp.sum_single_index]
theorem mul_single_apply_of_not_exists_mul [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G)
    (h : ¬∃ d, g' = d * g) : (x * single g r) g' = 0 := by
  classical
    rw [mul_apply, Finsupp.sum_comm, Finsupp.sum_single_index]
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
r : k
g g' : G
x : MonoidAlgebra k G
h : ¬∃ d, g' = d * g
⊢ (sum x fun x v => if x * g = g' then v * r else 0) = 0
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
r : k
g g' : G
x : MonoidAlgebra k G
h : ¬∃ d, g' = d * g
⊢ (sum x fun x v => if x * g = g' then v * 0 else 0) = 0

Next tactic:
swap
theorem mul_single_apply_of_not_exists_mul [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G)
    (h : ¬∃ d, g' = d * g) : (x * single g r) g' = 0 := by
  classical
    rw [mul_apply, Finsupp.sum_comm, Finsupp.sum_single_index]
    swap
    · 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
r : k
g g' : G
x : MonoidAlgebra k G
h : ¬∃ d, g' = d * g
⊢ (sum x fun x v => if x * g = g' then v * 0 else 0) = 0

Next tactic:
simp_rw [Finsupp.sum, mul_zero, ite_self, Finset.sum_const_zero]
theorem mul_single_apply_of_not_exists_mul [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G)
    (h : ¬∃ d, g' = d * g) : (x * single g r) g' = 0 := by
  classical
    rw [mul_apply, Finsupp.sum_comm, Finsupp.sum_single_index]
    swap
    · simp_rw [Finsupp.sum, mul_zero, ite_self, Finset.sum_const_zero]
    · 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
r : k
g g' : G
x : MonoidAlgebra k G
h : ¬∃ d, g' = d * g
⊢ (sum x fun x v => if x * g = g' then v * r else 0) = 0

Next tactic:
apply Finset.sum_eq_zero
theorem mul_single_apply_of_not_exists_mul [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G)
    (h : ¬∃ d, g' = d * g) : (x * single g r) g' = 0 := by
  classical
    rw [mul_apply, Finsupp.sum_comm, Finsupp.sum_single_index]
    swap
    · simp_rw [Finsupp.sum, mul_zero, ite_self, Finset.sum_const_zero]
    · apply Finset.sum_eq_zero
      

Proof state:
case h
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
r : k
g g' : G
x : MonoidAlgebra k G
h : ¬∃ d, g' = d * g
⊢ ∀ x_1 ∈ x.support, (fun x v => if x * g = g' then v * r else 0) x_1 (x x_1) = 0

Next tactic:
simp_rw [ite_eq_right_iff]
theorem mul_single_apply_of_not_exists_mul [Mul G] (r : k) {g g' : G} (x : MonoidAlgebra k G)
    (h : ¬∃ d, g' = d * g) : (x * single g r) g' = 0 := by
  classical
    rw [mul_apply, Finsupp.sum_comm, Finsupp.sum_single_index]
    swap
    · simp_rw [Finsupp.sum, mul_zero, ite_self, Finset.sum_const_zero]
    · apply Finset.sum_eq_zero
      simp_rw [ite_eq_right_iff]
      

Proof state:
case h
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Mul G
r : k
g g' : G
x : MonoidAlgebra k G
h : ¬∃ d, g' = d * g
⊢ ∀ x_1 ∈ x.support, x_1 * g = g' → x x_1 * r = 0

Next tactic:
rintro g'' _hg'' rfl