l3lab/ntp-mathlib huggingface dataset:
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat { 

Proof state:
case h.e'_3.h.e'_4.e'_6.e'_4.e'_2.e'_2.e'_8
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_1✝² :
  (↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) →+ ⨁ (i : ι), ↥(gradeBy R (⇑f) i)) =
    (↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j))) →+ ⨁ (i : ι), ↥(gradeBy R (⇑f) i))
e_2✝¹ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
e_3✝ : HEq (fun x => ⨁ (i : ι), ↥(gradeBy R (⇑f) i)) fun x => ⨁ (i : ι), ↥(gradeBy R (⇑f) i)
e_1✝¹ :
  (↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) →+ ⨁ (i : ι), ↥(gradeBy R (⇑f) i)) =
    (↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j))) →+ ⨁ (i : ι), ↥(gradeBy R (⇑f) i))
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
e_4✝ : HEq AddZeroClass.toAdd AddZeroClass.toAdd
e_1✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
⊢ f (Multiplicative.toAdd i + Multiplicative.toAdd j) = f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)

Next tactic:
rw [ AddMonoidHom.map_add]
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat 

Proof state:
case h.e'_3.h.e'_5.e'_5
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_1✝ :
  (↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) →+ ⨁ (i : ι), ↥(gradeBy R (⇑f) i)) =
    (↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j))) →+ ⨁ (i : ι), ↥(gradeBy R (⇑f) i))
⊢ f (Multiplicative.toAdd i + Multiplicative.toAdd j) = f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)
case h.e'_3.h.e'_6.e'_2.h.h.e'_5.h.e'_7
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
x✝ : R[M]
⊢ f (Multiplicative.toAdd i + Multiplicative.toAdd j) = f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)
case h.e'_3.h.e'_6.e'_3
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
⊢ (fun₀ | Multiplicative.toAdd i + Multiplicative.toAdd j => 1) =
    ↑(GradedMonoid.GMul.mul
        { val := fun₀ | Multiplicative.toAdd i => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd i => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd i))) }
        { val := fun₀ | Multiplicative.toAdd j => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd j => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd j))) })

Next tactic:
{ rw [ AddMonoidHom.map_add] }
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat { 

Proof state:
case h.e'_3.h.e'_5.e'_5
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_1✝ :
  (↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) →+ ⨁ (i : ι), ↥(gradeBy R (⇑f) i)) =
    (↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j))) →+ ⨁ (i : ι), ↥(gradeBy R (⇑f) i))
⊢ f (Multiplicative.toAdd i + Multiplicative.toAdd j) = f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)

Next tactic:
rw [ AddMonoidHom.map_add]
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat 

Proof state:
case h.e'_3.h.e'_6.e'_2.h.h.e'_5.h.e'_7
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
x✝ : R[M]
⊢ f (Multiplicative.toAdd i + Multiplicative.toAdd j) = f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)
case h.e'_3.h.e'_6.e'_3
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
⊢ (fun₀ | Multiplicative.toAdd i + Multiplicative.toAdd j => 1) =
    ↑(GradedMonoid.GMul.mul
        { val := fun₀ | Multiplicative.toAdd i => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd i => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd i))) }
        { val := fun₀ | Multiplicative.toAdd j => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd j => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd j))) })

Next tactic:
{ rw [ AddMonoidHom.map_add] }
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat { 

Proof state:
case h.e'_3.h.e'_6.e'_2.h.h.e'_5.h.e'_7
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
x✝ : R[M]
⊢ f (Multiplicative.toAdd i + Multiplicative.toAdd j) = f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)

Next tactic:
rw [ AddMonoidHom.map_add]
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat 

Proof state:
case h.e'_3.h.e'_6.e'_3
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
⊢ (fun₀ | Multiplicative.toAdd i + Multiplicative.toAdd j => 1) =
    ↑(GradedMonoid.GMul.mul
        { val := fun₀ | Multiplicative.toAdd i => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd i => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd i))) }
        { val := fun₀ | Multiplicative.toAdd j => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd j => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd j))) })

Next tactic:
{ rw [ AddMonoidHom.map_add] }
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat { 

Proof state:
case h.e'_3.h.e'_6.e'_3
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
⊢ (fun₀ | Multiplicative.toAdd i + Multiplicative.toAdd j => 1) =
    ↑(GradedMonoid.GMul.mul
        { val := fun₀ | Multiplicative.toAdd i => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd i => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd i))) }
        { val := fun₀ | Multiplicative.toAdd j => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd j => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd j))) })

Next tactic:
rw [ AddMonoidHom.map_add]
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat { rw [ AddMonoidHom.map_add] }
        

Proof state:
case h.e'_3.h.e'_6.e'_3
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
⊢ (fun₀ | Multiplicative.toAdd i + Multiplicative.toAdd j => 1) =
    ↑(GradedMonoid.GMul.mul
        { val := fun₀ | Multiplicative.toAdd i => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd i => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd i))) }
        { val := fun₀ | Multiplicative.toAdd j => 1,
          property := (_ : (fun₀ | Multiplicative.toAdd j => 1) ∈ gradeBy R (⇑f) (f (Multiplicative.toAdd j))) })

Next tactic:
simp only [SetLike.coe_gMul]
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat { rw [ AddMonoidHom.map_add] }
        simp only [SetLike.coe_gMul]
        

Proof state:
case h.e'_3.h.e'_6.e'_3
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
⊢ (fun₀ | Multiplicative.toAdd i + Multiplicative.toAdd j => 1) =
    (fun₀ | Multiplicative.toAdd i => 1) * fun₀ | Multiplicative.toAdd j => 1

Next tactic:
refine Eq.trans (by rw [one_mul]) single_mul_single.symm
/-- Auxiliary definition; the canonical grade decomposition, used to provide
`DirectSum.decompose`. -/
def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i :=
  AddMonoidAlgebra.lift R M _
    { toFun := fun m =>
        DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m))
          ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩
      map_one' :=
        DirectSum.of_eq_of_gradedMonoid_eq
          (by congr 2 <;> simp)
      map_mul' := fun i j => by
        symm
        dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe,
          OneHom.coe_mk, toAdd_mul]
        convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _
        repeat { rw [ AddMonoidHom.map_add] }
        simp only [SetLike.coe_gMul]
        refine Eq.trans (by 

Proof state:
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i j : Multiplicative M
e_2✝ :
  ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i + Multiplicative.toAdd j))) =
    ↥(gradeBy R (⇑f) (f (Multiplicative.toAdd i) + f (Multiplicative.toAdd j)))
⊢ (fun₀ | Multiplicative.toAdd i + Multiplicative.toAdd j => 1) =
    single (Multiplicative.toAdd i + Multiplicative.toAdd j) (1 * 1)

Next tactic:
rw [one_mul]
theorem decomposeAux_single (m : M) (r : R) :
    decomposeAux f (Finsupp.single m r) =
      DirectSum.of (fun i : ι => gradeBy R f i) (f m)
        ⟨Finsupp.single m r, single_mem_gradeBy _ _ _⟩ := by
  

Proof state:
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
m : M
r : R
⊢ ((decomposeAux f) fun₀ | m => r) =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m))
      { val := fun₀ | m => r, property := (_ : (fun₀ | m => r) ∈ gradeBy R (⇑f) (f m)) }

Next tactic:
refine' (lift_single _ _ _).trans _
theorem decomposeAux_single (m : M) (r : R) :
    decomposeAux f (Finsupp.single m r) =
      DirectSum.of (fun i : ι => gradeBy R f i) (f m)
        ⟨Finsupp.single m r, single_mem_gradeBy _ _ _⟩ := by
  refine' (lift_single _ _ _).trans _
  refine' (DirectSum.of_smul R _ _ _).symm.trans _
  

Proof state:
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
m : M
r : R
⊢ (DirectSum.of (fun i => (fun i => ↥(gradeBy R (⇑f) i)) i) (f (Multiplicative.toAdd (Multiplicative.ofAdd m))))
      (r •
        { val := fun₀ | Multiplicative.toAdd (Multiplicative.ofAdd m) => 1,
          property :=
            (_ :
              (fun₀ | Multiplicative.toAdd (Multiplicative.ofAdd m) => 1) ∈
                gradeBy R (⇑f) (f (Multiplicative.toAdd (Multiplicative.ofAdd m)))) }) =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m))
      { val := fun₀ | m => r, property := (_ : (fun₀ | m => r) ∈ gradeBy R (⇑f) (f m)) }

Next tactic:
apply DirectSum.of_eq_of_gradedMonoid_eq
theorem decomposeAux_single (m : M) (r : R) :
    decomposeAux f (Finsupp.single m r) =
      DirectSum.of (fun i : ι => gradeBy R f i) (f m)
        ⟨Finsupp.single m r, single_mem_gradeBy _ _ _⟩ := by
  refine' (lift_single _ _ _).trans _
  refine' (DirectSum.of_smul R _ _ _).symm.trans _
  apply DirectSum.of_eq_of_gradedMonoid_eq
  

Proof state:
case h
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
m : M
r : R
⊢ GradedMonoid.mk (f (Multiplicative.toAdd (Multiplicative.ofAdd m)))
      (r •
        { val := fun₀ | Multiplicative.toAdd (Multiplicative.ofAdd m) => 1,
          property :=
            (_ :
              (fun₀ | Multiplicative.toAdd (Multiplicative.ofAdd m) => 1) ∈
                gradeBy R (⇑f) (f (Multiplicative.toAdd (Multiplicative.ofAdd m)))) }) =
    GradedMonoid.mk (f m) { val := fun₀ | m => r, property := (_ : (fun₀ | m => r) ∈ gradeBy R (⇑f) (f m)) }

Next tactic:
refine' Sigma.subtype_ext rfl _
theorem decomposeAux_single (m : M) (r : R) :
    decomposeAux f (Finsupp.single m r) =
      DirectSum.of (fun i : ι => gradeBy R f i) (f m)
        ⟨Finsupp.single m r, single_mem_gradeBy _ _ _⟩ := by
  refine' (lift_single _ _ _).trans _
  refine' (DirectSum.of_smul R _ _ _).symm.trans _
  apply DirectSum.of_eq_of_gradedMonoid_eq
  refine' Sigma.subtype_ext rfl _
  

Proof state:
case h
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
m : M
r : R
⊢ ↑(GradedMonoid.mk (f (Multiplicative.toAdd (Multiplicative.ofAdd m)))
          (r •
            { val := fun₀ | Multiplicative.toAdd (Multiplicative.ofAdd m) => 1,
              property :=
                (_ :
                  (fun₀ | Multiplicative.toAdd (Multiplicative.ofAdd m) => 1) ∈
                    gradeBy R (⇑f) (f (Multiplicative.toAdd (Multiplicative.ofAdd m)))) })).snd =
    ↑(GradedMonoid.mk (f m) { val := fun₀ | m => r, property := (_ : (fun₀ | m => r) ∈ gradeBy R (⇑f) (f m)) }).snd

Next tactic:
refine' (Finsupp.smul_single' _ _ _).trans _
theorem decomposeAux_single (m : M) (r : R) :
    decomposeAux f (Finsupp.single m r) =
      DirectSum.of (fun i : ι => gradeBy R f i) (f m)
        ⟨Finsupp.single m r, single_mem_gradeBy _ _ _⟩ := by
  refine' (lift_single _ _ _).trans _
  refine' (DirectSum.of_smul R _ _ _).symm.trans _
  apply DirectSum.of_eq_of_gradedMonoid_eq
  refine' Sigma.subtype_ext rfl _
  refine' (Finsupp.smul_single' _ _ _).trans _
  

Proof state:
case h
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
m : M
r : R
⊢ (fun₀ | Multiplicative.toAdd (Multiplicative.ofAdd m) => r * 1) =
    ↑(GradedMonoid.mk (f m) { val := fun₀ | m => r, property := (_ : (fun₀ | m => r) ∈ gradeBy R (⇑f) (f m)) }).snd

Next tactic:
rw [mul_one]
theorem decomposeAux_single (m : M) (r : R) :
    decomposeAux f (Finsupp.single m r) =
      DirectSum.of (fun i : ι => gradeBy R f i) (f m)
        ⟨Finsupp.single m r, single_mem_gradeBy _ _ _⟩ := by
  refine' (lift_single _ _ _).trans _
  refine' (DirectSum.of_smul R _ _ _).symm.trans _
  apply DirectSum.of_eq_of_gradedMonoid_eq
  refine' Sigma.subtype_ext rfl _
  refine' (Finsupp.smul_single' _ _ _).trans _
  rw [mul_one]
  

Proof state:
case h
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
m : M
r : R
⊢ (fun₀ | Multiplicative.toAdd (Multiplicative.ofAdd m) => r) =
    ↑(GradedMonoid.mk (f m) { val := fun₀ | m => r, property := (_ : (fun₀ | m => r) ∈ gradeBy R (⇑f) (f m)) }).snd

Next tactic:
rfl
theorem decomposeAux_coe {i : ι} (x : gradeBy R f i) :
    decomposeAux f ↑x = DirectSum.of (fun i => gradeBy R f i) i x := by
  

Proof state:
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : ↥(gradeBy R (⇑f) i)
⊢ (decomposeAux f) ↑x = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) x

Next tactic:
obtain ⟨x, hx⟩ := x
theorem decomposeAux_coe {i : ι} (x : gradeBy R f i) :
    decomposeAux f ↑x = DirectSum.of (fun i => gradeBy R f i) i x := by
  obtain ⟨x, hx⟩ := x
  

Proof state:
case mk
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
hx : x ∈ gradeBy R (⇑f) i
⊢ (decomposeAux f) ↑{ val := x, property := hx } =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) { val := x, property := hx }

Next tactic:
revert hx
theorem decomposeAux_coe {i : ι} (x : gradeBy R f i) :
    decomposeAux f ↑x = DirectSum.of (fun i => gradeBy R f i) i x := by
  obtain ⟨x, hx⟩ := x
  revert hx
  

Proof state:
case mk
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝⁴ : DecidableEq M
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
⊢ ∀ (hx : x ∈ gradeBy R (⇑f) i),
    (decomposeAux f) ↑{ val := x, property := hx } =
      (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) { val := x, property := hx }

Next tactic:
refine' Finsupp.induction x _ _