theorem mem_equivPair_tail_iff {i j : ι} {w : Word M} (m : M i) :
    (⟨i, m⟩ ∈ (equivPair j w).tail.toList) ↔ ⟨i, m⟩ ∈ w.toList.tail
      ∨ i ≠ j ∧ ∃ h : w.toList ≠ [], w.toList.head h = ⟨i, m⟩ := by
  simp only [equivPair, equivPairAux, ne_eq, Equiv.coe_fn_mk]
  induction w using consRecOn with
  | h_empty => simp
  | h_cons k g tail h1 h2 ih =>
    simp only [consRecOn_cons]
    split_ifs with h
    · subst k
      by_cases hij : j = i <;> 

Proof state:
case pos
ι : 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
tail : Word M
ih :
  { fst := i, snd := m } ∈
      (↑(consRecOn tail
              { val := { head := 1, tail := empty, fstIdx_ne := (_ : ¬none = some j) },
                property :=
                  (_ :
                    (if h : { head := 1, tail := empty, fstIdx_ne := (_ : ¬none = some j) }.head = 1 then
                        { head := 1, tail := empty, fstIdx_ne := (_ : ¬none = some j) }.tail
                      else
                        cons { head := 1, tail := empty, fstIdx_ne := (_ : ¬none = some j) }.head
                          { head := 1, tail := empty, fstIdx_ne := (_ : ¬none = some j) }.tail
                          (_ : fstIdx { head := 1, tail := empty, fstIdx_ne := (_ : ¬none = some j) }.tail ≠ some j)
                          h) =
                      empty) }
              fun j_1 m w h1 h2 x =>
              if ij : j = j_1 then
                { val := { head := (_ : j_1 = j) ▸ m, tail := w, fstIdx_ne := (_ : fstIdx w ≠ some j) },
                  property :=
                    (_ :
                      rcons { head := (_ : j_1 = j) ▸ m, tail := w, fstIdx_ne := (_ : fstIdx w ≠ some j) } =
                        cons m w h1 h2) }
              else
                { val := { head := 1, tail := cons m w h1 h2, fstIdx_ne := (_ : ¬some j_1 = some j) },
                  property :=
                    (_ :
                      (if h : { head := 1, tail := cons m w h1 h2, fstIdx_ne := (_ : ¬some j_1 = some j) }.head = 1 then
                          { head := 1, tail := cons m w h1 h2, fstIdx_ne := (_ : ¬some j_1 = some j) }.tail
                        else
                          cons { head := 1, tail := cons m w h1 h2, fstIdx_ne := (_ : ¬some j_1 = some j) }.head
                            { head := 1, tail := cons m w h1 h2, fstIdx_ne := (_ : ¬some j_1 = some j) }.tail
                            (_ :
                              fstIdx { head := 1, tail := cons m w h1 h2, fstIdx_ne := (_ : ¬some j_1 = some j) }.tail ≠
                                some j)
                            h) =
                        cons m w h1 h2) })).tail.toList ↔
    { fst := i, snd := m } ∈ List.tail tail.toList ∨
      ¬i = j ∧ ∃ (h : ¬tail.toList = []), List.head tail.toList h = { fst := i, snd := m }
g : M j
h1 : fstIdx tail ≠ some j
h2 : g ≠ 1
hij : j = i
⊢ { fst := i, snd := m } ∈
      (↑{ val := { head := (_ : j = j) ▸ g, tail := tail, fstIdx_ne := (_ : fstIdx tail ≠ some j) },
              property :=
                (_ :
                  rcons { head := (_ : j = j) ▸ g, tail := tail, fstIdx_ne := (_ : fstIdx tail ≠ some j) } =
                    cons g tail h1 h2) }).tail.toList ↔
    { fst := i, snd := m } ∈ List.tail (cons g tail h1 h2).toList ∨
      ¬i = j ∧ ∃ (h : ¬(cons g tail h1 h2).toList = []), List.head (cons g tail h1 h2).toList h = { fst := i, snd := m }

Next tactic:
simp_all