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
  

Proof state:
case h_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
k : ι
g : M k
tail : Word M
h1 : fstIdx tail ≠ some k
h2 : g ≠ 1
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 }
⊢ { fst := i, snd := m } ∈
      (↑(consRecOn (cons g tail h1 h2)
              { 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 (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:
| h_cons k g tail h1 h2 ih =>
    simp only [consRecOn_cons]
    split_ifs with h
    · subst k
      by_cases hij : j = i <;> simp_all
    · by_cases hik : i = k
      · subst i; simp_all [eq_comm, and_comm, or_comm]
      · simp [hik, Ne.symm hik]