theorem mem_smul_iff {i j : ι} {m₁ : M i} {m₂ : M j} {w : Word M} :
    ⟨_, m₁⟩ ∈ (of m₂ • w).toList ↔
      (¬i = j ∧ ⟨i, m₁⟩ ∈ w.toList)
      ∨ (m₁ ≠ 1 ∧ ∃ (hij : i = j),(⟨i, m₁⟩ ∈ w.toList.tail) ∨
        (∃ m', ⟨j, m'⟩ ∈ w.toList.head? ∧ m₁ = hij ▸ (m₂ * m')) ∨
        (w.fstIdx ≠ some j ∧ m₁ = hij ▸ m₂)) := by
  rw [of_smul_def, mem_rcons_iff, mem_equivPair_tail_iff, equivPair_head, or_assoc]
  by_cases hij : i = j
  · subst i
    simp only [not_true, ne_eq, false_and, exists_prop, true_and, false_or]
    by_cases hw : ⟨j, m₁⟩ ∈ w.toList.tail
    · simp [hw, show m₁ ≠ 1 from w.ne_one _ (List.mem_of_mem_tail hw)]
    · simp only [hw, false_or, Option.mem_def, ne_eq, and_congr_right_iff]
      intro hm1
      split_ifs with h
      · rcases h with ⟨hnil, rfl⟩
        simp only [List.head?_eq_head _ hnil, Option.some.injEq, ne_eq]
        constructor
        · rintro rfl
          exact Or.inl ⟨_, rfl, rfl⟩
        · rintro (⟨_, h, rfl⟩ | hm')
          · simp [Sigma.ext_iff] at h
            subst h
            rfl
          · simp only [fstIdx, Option.map_eq_some', Sigma.exists,
              exists_and_right, exists_eq_right, not_exists, ne_eq] at hm'
            exact (hm'.1 (w.toList.head hnil).2 (by rw [List.head?_eq_head])).elim
      · revert h
        rw [fstIdx]
        cases w.toList
        · simp
        · simp (config := {contextual := true}) [Sigma.ext_iff]
  · rcases w with ⟨_ | _, _, _⟩ <;>
    

Proof state:
case neg.mk.cons
ι : Type u_1
M : ι → Type u_2
inst✝³ : (i : ι) → Monoid (M i)
N : Type u_3
inst✝² : Monoid N
inst✝¹ : (i : ι) → DecidableEq (M i)
inst✝ : DecidableEq ι
i j : ι
m₁ : M i
m₂ : M j
hij : ¬i = j
head✝ : (i : ι) × M i
tail✝ : List ((i : ι) × M i)
ne_one✝ : ∀ l ∈ head✝ :: tail✝, l.snd ≠ 1
chain_ne✝ : List.Chain' (fun l l' => l.fst ≠ l'.fst) (head✝ :: tail✝)
⊢ ({ fst := i, snd := m₁ } ∈ List.tail { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList ∨
      (i ≠ j ∧
          ∃ (h : { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList ≠ []),
            List.head { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList h =
              { fst := i, snd := m₁ }) ∨
        m₁ ≠ 1 ∧
          ∃ (h : j = i),
            m₁ =
              h ▸
                (let src := (equivPair j) { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ };
                  {
                    head :=
                      m₂ *
                        if h :
                            ∃ (h : { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList ≠ []),
                              (List.head { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList
                                    h).fst =
                                j then
                          (_ :
                              (List.head { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList
                                    (_ :
                                      { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList ≠
                                        [])).fst =
                                j) ▸
                            (List.head { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList
                                (_ :
                                  { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList ≠
                                    [])).snd
                        else 1,
                    tail := src.tail, fstIdx_ne := (_ : fstIdx src.tail ≠ some j) }).head) ↔
    ¬i = j ∧ { fst := i, snd := m₁ } ∈ { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList ∨
      m₁ ≠ 1 ∧
        ∃ (hij : i = j),
          { fst := i, snd := m₁ } ∈
              List.tail { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList ∨
            (∃ m',
                { fst := j, snd := m' } ∈
                    List.head? { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ }.toList ∧
                  m₁ = (_ : j = i) ▸ (m₂ * m')) ∨
              fstIdx { toList := head✝ :: tail✝, ne_one := ne_one✝, chain_ne := chain_ne✝ } ≠ some j ∧
                m₁ = (_ : j = i) ▸ m₂

Next tactic:
simp [or_comm, hij, Ne.symm hij, eq_comm]