Theorem: AddMonoidAlgebra.decomposeAux_coe
File: Mathlib/Algebra/MonoidAlgebra/Grading.lean

tactic: obtain ⟨x, hx⟩ := x
state_before: M : Type u_1
ι : Type u_2
R : Type u_3
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
state_after: case mk
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
hx : x ∈ gradeBy R (⇑f) i
⊢ (decomposeAux f) ↑⟨x, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨x, hx⟩

tactic: revert hx
state_before: case mk
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
hx : x ∈ gradeBy R (⇑f) i
⊢ (decomposeAux f) ↑⟨x, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨x, hx⟩
state_after: case mk
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
⊢ ∀ (hx : x ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨x, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨x, hx⟩

tactic: refine Finsupp.induction x ?_ ?_
state_before: case mk
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
⊢ ∀ (hx : x ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨x, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨x, hx⟩
state_after: case mk.refine_1
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
⊢ ∀ (hx : 0 ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨0, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨0, hx⟩

case mk.refine_2
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
⊢ ∀ (a : M) (b : R) (f_1 : M →₀ R),
    a ∉ f_1.support →
      b ≠ 0 →
        (∀ (hx : f_1 ∈ gradeBy R (⇑f) i),
            (decomposeAux f) ↑⟨f_1, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨f_1, hx⟩) →
          ∀ (hx : Finsupp.single a b + f_1 ∈ gradeBy R (⇑f) i),
            (decomposeAux f) ↑⟨Finsupp.single a b + f_1, hx⟩ =
              (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single a b + f_1, hx⟩

tactic: intro hx
state_before: case mk.refine_1
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
⊢ ∀ (hx : 0 ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨0, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨0, hx⟩
state_after: case mk.refine_1
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
hx : 0 ∈ gradeBy R (⇑f) i
⊢ (decomposeAux f) ↑⟨0, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨0, hx⟩

tactic: symm
state_before: case mk.refine_1
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
hx : 0 ∈ gradeBy R (⇑f) i
⊢ (decomposeAux f) ↑⟨0, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨0, hx⟩
state_after: case mk.refine_1
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
hx : 0 ∈ gradeBy R (⇑f) i
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨0, hx⟩ = (decomposeAux f) ↑⟨0, hx⟩

tactic: exact AddMonoidHom.map_zero _
state_before: case mk.refine_1
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
hx : 0 ∈ gradeBy R (⇑f) i
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨0, hx⟩ = (decomposeAux f) ↑⟨0, hx⟩
state_after: no goals

tactic: intro m b y hmy hb ih hmby
state_before: case mk.refine_2
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
⊢ ∀ (a : M) (b : R) (f_1 : M →₀ R),
    a ∉ f_1.support →
      b ≠ 0 →
        (∀ (hx : f_1 ∈ gradeBy R (⇑f) i),
            (decomposeAux f) ↑⟨f_1, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨f_1, hx⟩) →
          ∀ (hx : Finsupp.single a b + f_1 ∈ gradeBy R (⇑f) i),
            (decomposeAux f) ↑⟨Finsupp.single a b + f_1, hx⟩ =
              (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single a b + f_1, hx⟩
state_after: case mk.refine_2
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby⟩

tactic: have : Disjoint (Finsupp.single m b).support y.support := by
  simpa only [Finsupp.support_single_ne_zero _ hb, Finset.disjoint_singleton_left]
state_before: case mk.refine_2
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
this : Disjoint (Finsupp.single m b).support y.support
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby⟩

tactic: rw [mem_gradeBy_iff, Finsupp.support_add_eq this, Finset.coe_union, Set.union_subset_iff]
  at hmby
state_before: case mk.refine_2
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
this : Disjoint (Finsupp.single m b).support y.support
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby✝ : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
hmby : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {i} ∧ ↑y.support ⊆ ⇑f ⁻¹' {i}
this : Disjoint (Finsupp.single m b).support y.support
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby✝⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby✝⟩

tactic: cases' hmby with h1 h2
state_before: case mk.refine_2
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby✝ : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
hmby : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {i} ∧ ↑y.support ⊆ ⇑f ⁻¹' {i}
this : Disjoint (Finsupp.single m b).support y.support
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby✝⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby✝⟩
state_after: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
this : Disjoint (Finsupp.single m b).support y.support
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {i}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {i}
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby⟩

tactic: have : f m = i := by
  rwa [Finsupp.support_single_ne_zero _ hb, Finset.coe_singleton, Set.singleton_subset_iff]
    at h1
state_before: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
this : Disjoint (Finsupp.single m b).support y.support
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {i}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {i}
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
this✝ : Disjoint (Finsupp.single m b).support y.support
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {i}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {i}
this : f m = i
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby⟩

tactic: subst this
state_before: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
this✝ : Disjoint (Finsupp.single m b).support y.support
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {i}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {i}
this : f m = i
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩

tactic: simp only [AlgHom.map_add, Submodule.coe_mk, decomposeAux_single f m]
state_before: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
⊢ (decomposeAux f) ↑⟨Finsupp.single m b + y, hmby⟩ =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b, ⋯⟩ + (decomposeAux f) y =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩

tactic: let ih' := ih h2
state_before: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b, ⋯⟩ + (decomposeAux f) y =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
ih' : (decomposeAux f) ↑⟨y, h2⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, h2⟩ := ih h2
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b, ⋯⟩ + (decomposeAux f) y =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩

tactic: dsimp at ih'
state_before: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
ih' : (decomposeAux f) ↑⟨y, h2⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, h2⟩ := ih h2
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b, ⋯⟩ + (decomposeAux f) y =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
ih' : (decomposeAux f) y = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, h2⟩ := ih h2
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b, ⋯⟩ + (decomposeAux f) y =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩

tactic: rw [ih', ← AddMonoidHom.map_add]
state_before: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
ih' : (decomposeAux f) y = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, h2⟩ := ih h2
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b, ⋯⟩ + (decomposeAux f) y =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
ih' : (decomposeAux f) y = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, h2⟩ := ih h2
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) (⟨Finsupp.single m b, ⋯⟩ + ⟨y, h2⟩) =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩

tactic: apply DirectSum.of_eq_of_gradedMonoid_eq
state_before: case mk.refine_2.intro
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
ih' : (decomposeAux f) y = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, h2⟩ := ih h2
⊢ (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) (⟨Finsupp.single m b, ⋯⟩ + ⟨y, h2⟩) =
    (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨Finsupp.single m b + y, hmby⟩
state_after: case mk.refine_2.intro.h
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
ih' : (decomposeAux f) y = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, h2⟩ := ih h2
⊢ GradedMonoid.mk (f m) (⟨Finsupp.single m b, ⋯⟩ + ⟨y, h2⟩) = GradedMonoid.mk (f m) ⟨Finsupp.single m b + y, hmby⟩

tactic: congr 2
state_before: case mk.refine_2.intro.h
M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
this : Disjoint (Finsupp.single m b).support y.support
ih :
  ∀ (hx : y ∈ gradeBy R (⇑f) (f m)),
    (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) (f m)
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {f m}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {f m}
ih' : (decomposeAux f) y = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) (f m)) ⟨y, h2⟩ := ih h2
⊢ GradedMonoid.mk (f m) (⟨Finsupp.single m b, ⋯⟩ + ⟨y, h2⟩) = GradedMonoid.mk (f m) ⟨Finsupp.single m b + y, hmby⟩
state_after: no goals

tactic: simpa only [Finsupp.support_single_ne_zero _ hb, Finset.disjoint_singleton_left]
state_before: M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
⊢ Disjoint (Finsupp.single m b).support y.support
state_after: no goals

tactic: rwa [Finsupp.support_single_ne_zero _ hb, Finset.coe_singleton, Set.singleton_subset_iff]
  at h1
state_before: M : Type u_1
ι : Type u_2
R : Type u_3
inst✝³ : AddMonoid M
inst✝² : DecidableEq ι
inst✝¹ : AddMonoid ι
inst✝ : CommSemiring R
f : M →+ ι
i : ι
x : R[M]
m : M
b : R
y : M →₀ R
hmy : m ∉ y.support
hb : b ≠ 0
ih : ∀ (hx : y ∈ gradeBy R (⇑f) i), (decomposeAux f) ↑⟨y, hx⟩ = (DirectSum.of (fun i => ↥(gradeBy R (⇑f) i)) i) ⟨y, hx⟩
hmby : Finsupp.single m b + y ∈ gradeBy R (⇑f) i
this : Disjoint (Finsupp.single m b).support y.support
h1 : ↑(Finsupp.single m b).support ⊆ ⇑f ⁻¹' {i}
h2 : ↑y.support ⊆ ⇑f ⁻¹' {i}
⊢ f m = i
state_after: no goals