l3lab/ntp-mathlib huggingface dataset:
/-- The opposite of a `MonoidAlgebra R I` equivalent as a ring to
the `MonoidAlgebra Rᵐᵒᵖ Iᵐᵒᵖ` over the opposite ring, taking elements to their opposite. -/
@[simps! (config := { simpRhs := true }) apply symm_apply]
protected noncomputable def opRingEquiv [Monoid G] :
    (MonoidAlgebra k G)ᵐᵒᵖ ≃+* MonoidAlgebra kᵐᵒᵖ Gᵐᵒᵖ :=
  { opAddEquiv.symm.trans <|
      (Finsupp.mapRange.addEquiv (opAddEquiv : k ≃+ kᵐᵒᵖ)).trans <| Finsupp.domCongr opEquiv with
    map_mul' := by
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      rw [Equiv.toFun_as_coe, AddEquiv.toEquiv_eq_coe]; erw [AddEquiv.coe_toEquiv]
      rw [← AddEquiv.coe_toAddMonoidHom]
      refine Iff.mpr (AddMonoidHom.map_mul_iff (R := (MonoidAlgebra k G)ᵐᵒᵖ)
        (S := MonoidAlgebra kᵐᵒᵖ Gᵐᵒᵖ) _) ?_
      -- Porting note: Was `ext`.
      refine AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₁ => AddMonoidHom.ext fun r₁ =>
        AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₂ => AddMonoidHom.ext fun r₂ => ?_
      -- Porting note: `reducible` cannot be `local` so proof gets long.
      simp only [AddMonoidHom.coe_comp, AddEquiv.coe_toAddMonoidHom, opAddEquiv_apply,
        Function.comp_apply, singleAddHom_apply, AddMonoidHom.compr₂_apply, AddMonoidHom.coe_mul,
        AddMonoidHom.coe_mulLeft, AddMonoidHom.compl₂_apply]
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [AddEquiv.trans_apply, AddEquiv.trans_apply, AddEquiv.trans_apply, AddEquiv.trans_apply,
        AddEquiv.trans_apply, AddEquiv.trans_apply, MulOpposite.opAddEquiv_symm_apply]
      rw [MulOpposite.unop_mul (α := MonoidAlgebra k G)]
      -- This was not needed before leanprover/lean4#2644
      erw [unop_op, unop_op, single_mul_single]
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Monoid G
src✝ : (G →₀ k)ᵐᵒᵖ ≃+ (Gᵐᵒᵖ →₀ kᵐᵒᵖ) :=
  AddEquiv.trans (AddEquiv.symm opAddEquiv) (AddEquiv.trans (mapRange.addEquiv opAddEquiv) (Finsupp.domCongr opEquiv))
i₁ : G
r₁ : k
i₂ : G
r₂ : k
⊢ (Finsupp.domCongr opEquiv) ((mapRange.addEquiv opAddEquiv) (single (i₂ * i₁) (r₂ * r₁))) =
    (Finsupp.domCongr opEquiv) ((mapRange.addEquiv opAddEquiv) fun₀ | i₁ => r₁) *
      (Finsupp.domCongr opEquiv) ((mapRange.addEquiv opAddEquiv) fun₀ | i₂ => r₂)

Next tactic:
simp
theorem opRingEquiv_single [Monoid G] (r : k) (x : G) :
    MonoidAlgebra.opRingEquiv (op (single x r)) = single (op x) (op r) := by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Monoid G
r : k
x : G
⊢ MonoidAlgebra.opRingEquiv (op (single x r)) = single (op x) (op r)

Next tactic:
simp
theorem opRingEquiv_symm_single [Monoid G] (r : kᵐᵒᵖ) (x : Gᵐᵒᵖ) :
    MonoidAlgebra.opRingEquiv.symm (single x r) = op (single x.unop r.unop) := by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Monoid G
r : kᵐᵒᵖ
x : Gᵐᵒᵖ
⊢ (RingEquiv.symm MonoidAlgebra.opRingEquiv) (single x r) = op (single (unop x) (unop r))

Next tactic:
simp
/-- A submodule over `k` which is stable under scalar multiplication by elements of `G` is a
submodule over `MonoidAlgebra k G`  -/
def submoduleOfSMulMem (W : Submodule k V) (h : ∀ (g : G) (v : V), v ∈ W → of k G g • v ∈ W) :
    Submodule (MonoidAlgebra k G) V where
  carrier := W
  zero_mem' := W.zero_mem'
  add_mem' := W.add_mem'
  smul_mem' := by
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : Monoid G
V : Type u_3
inst✝³ : AddCommMonoid V
inst✝² : Module k V
inst✝¹ : Module (MonoidAlgebra k G) V
inst✝ : IsScalarTower k (MonoidAlgebra k G) V
W : Submodule k V
h : ∀ (g : G), ∀ v ∈ W, (of k G) g • v ∈ W
⊢ ∀ (c : MonoidAlgebra k G) {x : V},
    x ∈
        {
              toAddSubsemigroup :=
                { carrier := ↑W, add_mem' := (_ : ∀ {a b : V}, a ∈ W.carrier → b ∈ W.carrier → a + b ∈ W.carrier) },
              zero_mem' := (_ : 0 ∈ W.carrier) }.toAddSubsemigroup.carrier →
      c • x ∈
        {
              toAddSubsemigroup :=
                { carrier := ↑W, add_mem' := (_ : ∀ {a b : V}, a ∈ W.carrier → b ∈ W.carrier → a + b ∈ W.carrier) },
              zero_mem' := (_ : 0 ∈ W.carrier) }.toAddSubsemigroup.carrier

Next tactic:
intro f v hv
/-- A submodule over `k` which is stable under scalar multiplication by elements of `G` is a
submodule over `MonoidAlgebra k G`  -/
def submoduleOfSMulMem (W : Submodule k V) (h : ∀ (g : G) (v : V), v ∈ W → of k G g • v ∈ W) :
    Submodule (MonoidAlgebra k G) V where
  carrier := W
  zero_mem' := W.zero_mem'
  add_mem' := W.add_mem'
  smul_mem' := by
    intro f v hv
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : Monoid G
V : Type u_3
inst✝³ : AddCommMonoid V
inst✝² : Module k V
inst✝¹ : Module (MonoidAlgebra k G) V
inst✝ : IsScalarTower k (MonoidAlgebra k G) V
W : Submodule k V
h : ∀ (g : G), ∀ v ∈ W, (of k G) g • v ∈ W
f : MonoidAlgebra k G
v : V
hv :
  v ∈
    {
          toAddSubsemigroup :=
            { carrier := ↑W, add_mem' := (_ : ∀ {a b : V}, a ∈ W.carrier → b ∈ W.carrier → a + b ∈ W.carrier) },
          zero_mem' := (_ : 0 ∈ W.carrier) }.toAddSubsemigroup.carrier
⊢ f • v ∈
    {
          toAddSubsemigroup :=
            { carrier := ↑W, add_mem' := (_ : ∀ {a b : V}, a ∈ W.carrier → b ∈ W.carrier → a + b ∈ W.carrier) },
          zero_mem' := (_ : 0 ∈ W.carrier) }.toAddSubsemigroup.carrier

Next tactic:
rw [← Finsupp.sum_single f, Finsupp.sum, Finset.sum_smul]
/-- A submodule over `k` which is stable under scalar multiplication by elements of `G` is a
submodule over `MonoidAlgebra k G`  -/
def submoduleOfSMulMem (W : Submodule k V) (h : ∀ (g : G) (v : V), v ∈ W → of k G g • v ∈ W) :
    Submodule (MonoidAlgebra k G) V where
  carrier := W
  zero_mem' := W.zero_mem'
  add_mem' := W.add_mem'
  smul_mem' := by
    intro f v hv
    rw [← Finsupp.sum_single f, Finsupp.sum, Finset.sum_smul]
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : Monoid G
V : Type u_3
inst✝³ : AddCommMonoid V
inst✝² : Module k V
inst✝¹ : Module (MonoidAlgebra k G) V
inst✝ : IsScalarTower k (MonoidAlgebra k G) V
W : Submodule k V
h : ∀ (g : G), ∀ v ∈ W, (of k G) g • v ∈ W
f : MonoidAlgebra k G
v : V
hv :
  v ∈
    {
          toAddSubsemigroup :=
            { carrier := ↑W, add_mem' := (_ : ∀ {a b : V}, a ∈ W.carrier → b ∈ W.carrier → a + b ∈ W.carrier) },
          zero_mem' := (_ : 0 ∈ W.carrier) }.toAddSubsemigroup.carrier
⊢ ∑ i in f.support, (fun₀ | i => f i) • v ∈
    {
          toAddSubsemigroup :=
            { carrier := ↑W, add_mem' := (_ : ∀ {a b : V}, a ∈ W.carrier → b ∈ W.carrier → a + b ∈ W.carrier) },
          zero_mem' := (_ : 0 ∈ W.carrier) }.toAddSubsemigroup.carrier

Next tactic:
simp_rw [← smul_of, smul_assoc]
/-- A submodule over `k` which is stable under scalar multiplication by elements of `G` is a
submodule over `MonoidAlgebra k G`  -/
def submoduleOfSMulMem (W : Submodule k V) (h : ∀ (g : G) (v : V), v ∈ W → of k G g • v ∈ W) :
    Submodule (MonoidAlgebra k G) V where
  carrier := W
  zero_mem' := W.zero_mem'
  add_mem' := W.add_mem'
  smul_mem' := by
    intro f v hv
    rw [← Finsupp.sum_single f, Finsupp.sum, Finset.sum_smul]
    simp_rw [← smul_of, smul_assoc]
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : Monoid G
V : Type u_3
inst✝³ : AddCommMonoid V
inst✝² : Module k V
inst✝¹ : Module (MonoidAlgebra k G) V
inst✝ : IsScalarTower k (MonoidAlgebra k G) V
W : Submodule k V
h : ∀ (g : G), ∀ v ∈ W, (of k G) g • v ∈ W
f : MonoidAlgebra k G
v : V
hv :
  v ∈
    {
          toAddSubsemigroup :=
            { carrier := ↑W, add_mem' := (_ : ∀ {a b : V}, a ∈ W.carrier → b ∈ W.carrier → a + b ∈ W.carrier) },
          zero_mem' := (_ : 0 ∈ W.carrier) }.toAddSubsemigroup.carrier
⊢ ∑ x in f.support, f x • (of k G) x • v ∈ ↑W

Next tactic:
exact Submodule.sum_smul_mem W _ fun g _ => h g v hv
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (sum_add_index ?_ ?_) ?_ <;>
        simp only [add_mul, zero_mul, single_zero, single_add, forall_true_iff, sum_zero, sum_add]
    zero_mul := fun f => by
      simp only [mul_def]
      exact sum_zero_index
    mul_zero := fun f => by
      simp only [mul_def]
      exact Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_zero_index)) sum_zero
    nsmul := fun n f => n • f
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    nsmul_zero := by
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
⊢ ∀ (x : k[G]), (fun n f => n • f) 0 x = 0

Next tactic:
intros
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (sum_add_index ?_ ?_) ?_ <;>
        simp only [add_mul, zero_mul, single_zero, single_add, forall_true_iff, sum_zero, sum_add]
    zero_mul := fun f => by
      simp only [mul_def]
      exact sum_zero_index
    mul_zero := fun f => by
      simp only [mul_def]
      exact Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_zero_index)) sum_zero
    nsmul := fun n f => n • f
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    nsmul_zero := by
      intros
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
x✝ : k[G]
⊢ (fun n f => n • f) 0 x✝ = 0

Next tactic:
refine Finsupp.ext fun _ => ?_
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (sum_add_index ?_ ?_) ?_ <;>
        simp only [add_mul, zero_mul, single_zero, single_add, forall_true_iff, sum_zero, sum_add]
    zero_mul := fun f => by
      simp only [mul_def]
      exact sum_zero_index
    mul_zero := fun f => by
      simp only [mul_def]
      exact Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_zero_index)) sum_zero
    nsmul := fun n f => n • f
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    nsmul_zero := by
      intros
      refine Finsupp.ext fun _ => ?_
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
x✝¹ : k[G]
x✝ : G
⊢ ((fun n f => n • f) 0 x✝¹) x✝ = 0 x✝

Next tactic:
simp [-nsmul_eq_mul, add_smul]
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (sum_add_index ?_ ?_) ?_ <;>
        simp only [add_mul, zero_mul, single_zero, single_add, forall_true_iff, sum_zero, sum_add]
    zero_mul := fun f => by
      simp only [mul_def]
      exact sum_zero_index
    mul_zero := fun f => by
      simp only [mul_def]
      exact Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_zero_index)) sum_zero
    nsmul := fun n f => n • f
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    nsmul_zero := by
      intros
      refine Finsupp.ext fun _ => ?_
      simp [-nsmul_eq_mul, add_smul]
    nsmul_succ := by
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
⊢ ∀ (n : ℕ) (x : k[G]), (fun n f => n • f) (n + 1) x = x + (fun n f => n • f) n x

Next tactic:
intros
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (sum_add_index ?_ ?_) ?_ <;>
        simp only [add_mul, zero_mul, single_zero, single_add, forall_true_iff, sum_zero, sum_add]
    zero_mul := fun f => by
      simp only [mul_def]
      exact sum_zero_index
    mul_zero := fun f => by
      simp only [mul_def]
      exact Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_zero_index)) sum_zero
    nsmul := fun n f => n • f
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    nsmul_zero := by
      intros
      refine Finsupp.ext fun _ => ?_
      simp [-nsmul_eq_mul, add_smul]
    nsmul_succ := by
      intros
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
n✝ : ℕ
x✝ : k[G]
⊢ (fun n f => n • f) (n✝ + 1) x✝ = x✝ + (fun n f => n • f) n✝ x✝

Next tactic:
refine Finsupp.ext fun _ => ?_
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (sum_add_index ?_ ?_) ?_ <;>
        simp only [add_mul, zero_mul, single_zero, single_add, forall_true_iff, sum_zero, sum_add]
    zero_mul := fun f => by
      simp only [mul_def]
      exact sum_zero_index
    mul_zero := fun f => by
      simp only [mul_def]
      exact Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_zero_index)) sum_zero
    nsmul := fun n f => n • f
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    nsmul_zero := by
      intros
      refine Finsupp.ext fun _ => ?_
      simp [-nsmul_eq_mul, add_smul]
    nsmul_succ := by
      intros
      refine Finsupp.ext fun _ => ?_
      -- Porting note: The definition of `nsmul_succ` is different, so next line is required.
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
n✝ : ℕ
x✝¹ : k[G]
x✝ : G
⊢ ((fun n f => n • f) (n✝ + 1) x✝¹) x✝ = (x✝¹ + (fun n f => n • f) n✝ x✝¹) x✝

Next tactic:
simp only [fun n => Nat.add_comm n 1]
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (sum_add_index ?_ ?_) ?_ <;>
        simp only [add_mul, zero_mul, single_zero, single_add, forall_true_iff, sum_zero, sum_add]
    zero_mul := fun f => by
      simp only [mul_def]
      exact sum_zero_index
    mul_zero := fun f => by
      simp only [mul_def]
      exact Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_zero_index)) sum_zero
    nsmul := fun n f => n • f
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    nsmul_zero := by
      intros
      refine Finsupp.ext fun _ => ?_
      simp [-nsmul_eq_mul, add_smul]
    nsmul_succ := by
      intros
      refine Finsupp.ext fun _ => ?_
      -- Porting note: The definition of `nsmul_succ` is different, so next line is required.
      simp only [fun n => Nat.add_comm n 1]
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
n✝ : ℕ
x✝¹ : k[G]
x✝ : G
⊢ ((1 + n✝) • x✝¹) x✝ = (x✝¹ + n✝ • x✝¹) x✝

Next tactic:
simp [-nsmul_eq_mul, add_smul]
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
f g h : k[G]
⊢ f * (g + h) = f * g + f * h

Next tactic:
haveI := Classical.decEq G
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
f g h : k[G]
this : DecidableEq G
⊢ f * (g + h) = f * g + f * h

Next tactic:
simp only [mul_def]
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
f g h : k[G]
this : DecidableEq G
⊢ (sum f fun a₁ b₁ => sum (g + h) fun a₂ b₂ => single (a₁ + a₂) (b₁ * b₂)) =
    (sum f fun a₁ b₁ => sum g fun a₂ b₂ => single (a₁ + a₂) (b₁ * b₂)) +
      sum f fun a₁ b₁ => sum h fun a₂ b₂ => single (a₁ + a₂) (b₁ * b₂)

Next tactic:
refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        

Proof state:
case refine_1
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
f g h : k[G]
this : DecidableEq G
a₁ : G
b₁ : k
⊢ ∀ a ∈ g.support ∪ h.support, single (a₁ + a) (b₁ * 0) = 0

Next tactic:
simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        

Proof state:
case refine_2
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
f g h : k[G]
this : DecidableEq G
a₁ : G
b₁ : k
⊢ ∀ a ∈ g.support ∪ h.support,
    ∀ (b₁_1 b₂ : k), single (a₁ + a) (b₁ * (b₁_1 + b₂)) = single (a₁ + a) (b₁ * b₁_1) + single (a₁ + a) (b₁ * b₂)

Next tactic:
simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        

Proof state:
case refine_3
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
f g h : k[G]
this : DecidableEq G
⊢ (sum f fun a₁ b₁ => (sum g fun a₂ b₂ => single (a₁ + a₂) (b₁ * b₂)) + sum h fun a₂ b₂ => single (a₁ + a₂) (b₁ * b₂)) =
    (sum f fun a₁ b₁ => sum g fun a₂ b₂ => single (a₁ + a₂) (b₁ * b₂)) +
      sum f fun a₁ b₁ => sum h fun a₂ b₂ => single (a₁ + a₂) (b₁ * b₂)

Next tactic:
simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
f g h : k[G]
⊢ (f + g) * h = f * h + g * h

Next tactic:
haveI := Classical.decEq G
instance nonUnitalNonAssocSemiring : NonUnitalNonAssocSemiring k[G] :=
  { Finsupp.addCommMonoid with
    -- Porting note: `refine` & `exact` are required because `simp` behaves differently.
    left_distrib := fun f g h => by
      haveI := Classical.decEq G
      simp only [mul_def]
      refine Eq.trans (congr_arg (sum f) (funext₂ fun a₁ b₁ => sum_add_index ?_ ?_)) ?_ <;>
        simp only [mul_add, mul_zero, single_zero, single_add, forall_true_iff, sum_add]
    right_distrib := fun f g h => by
      haveI := Classical.decEq G
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : Add G
src✝ : AddCommMonoid (G →₀ k) := Finsupp.addCommMonoid
f g h : k[G]
this : DecidableEq G
⊢ (f + g) * h = f * h + g * h

Next tactic:
simp only [mul_def]