-- Module: Mathlib.GroupTheory.CoprodI
Goal:
ι : Type u_1
M : ι → Type u_2
inst : (i : ι) → Monoid (M i)
inst_1 : DecidableEq ι
inst_2 : (i : ι) → DecidableEq (M i)
i j : ι
m : M i
k : ι
g : M k
tail : Word M
h1 : tail.fstIdx (M := M) ≠ some k
h2 : g ≠ 1
ih :
  Membership.mem (γ := List ((i : ι) × M i))
      (toList (M := M)
        (Pair.tail (M := M) (i := j)
          (↑(consRecOn (M := M) (motive := fun (x : Word M) ↦ { p : Pair M j // rcons (M := M) p = x }) tail
                (Subtype.mk (p := fun (p : Pair M j) ↦ rcons (M := M) p = empty (M := M))
                  (Pair.mk (M := M) 1 (empty (M := M)) ⋯) ⋯)
                fun (j_1 : ι) (m : M j_1) (w : Word M) (h1 : ¬w.fstIdx (M := M) = some j_1) (h2 : ¬m = 1)
                  (x : { p : Pair M j // rcons (M := M) p = w }) ↦
                if ij : j = j_1 then
                  Subtype.mk (p := fun (p : Pair M j) ↦ rcons (M := M) p = Word.cons (M := M) m w h1 h2)
                    (Pair.mk (M := M) (Eq.rec (motive := fun (x : ι) (h : j_1 = x) ↦ M x) m ⋯) w ⋯) ⋯
                else
                  Subtype.mk (p := fun (p : Pair M j) ↦ rcons (M := M) p = Word.cons (M := M) m w h1 h2)
                    (Pair.mk (M := M) 1 (Word.cons (M := M) m w h1 h2) ⋯) ⋯) :
            Pair M j)))
      (Sigma.mk (β := fun (i : ι) ↦ M i) i m) ↔
    Sigma.mk (β := fun (i : ι) ↦ M i) i m ∈ tail.toList (M := M).tail ∨
      ¬i = j ∧ ∃ (h : ¬tail.toList (M := M) = []), tail.toList (M := M).head h = Sigma.mk (β := fun (i : ι) ↦ M i) i m
cons :
  Membership.mem (γ := List ((i : ι) × M i))
      (toList (M := M)
        (Pair.tail (M := M) (i := j)
          (↑(if ij : j = k then
                Subtype.mk (p := fun (p : Pair M j) ↦ rcons (M := M) p = Word.cons (M := M) g tail h1 h2)
                  (Pair.mk (M := M) (Eq.rec (motive := fun (x : ι) (h : k = x) ↦ M x) g ⋯) tail ⋯) ⋯
              else
                Subtype.mk (p := fun (p : Pair M j) ↦ rcons (M := M) p = Word.cons (M := M) g tail h1 h2)
                  (Pair.mk (M := M) 1 (Word.cons (M := M) g tail h1 h2) ⋯) ⋯) :
            Pair M j)))
      (Sigma.mk (β := fun (i : ι) ↦ M i) i m) ↔
    Sigma.mk (β := fun (i : ι) ↦ M i) i m ∈ (Word.cons (M := M) g tail h1 h2).toList (M := M).tail ∨
      ¬i = j ∧
        ∃ (h : ¬(Word.cons (M := M) g tail h1 h2).toList (M := M) = []),
          (Word.cons (M := M) g tail h1 h2).toList (M := M).head h = Sigma.mk (β := fun (i : ι) ↦ M i) i m
⊢ Membership.mem (γ := List ((i : ι) × M i))
      (toList (M := M)
        (Pair.tail (M := M) (i := j)
          (↑(consRecOn (M := M) (motive := fun (x : Word M) ↦ { p : Pair M j // rcons (M := M) p = x })
                (Word.cons (M := M) g tail h1 h2)
                (Subtype.mk (p := fun (p : Pair M j) ↦ rcons (M := M) p = empty (M := M))
                  (Pair.mk (M := M) 1 (empty (M := M)) ⋯) ⋯)
                fun (j_1 : ι) (m : M j_1) (w : Word M) (h1 : ¬w.fstIdx (M := M) = some j_1) (h2 : ¬m = 1)
                  (x : { p : Pair M j // rcons (M := M) p = w }) ↦
                if ij : j = j_1 then
                  Subtype.mk (p := fun (p : Pair M j) ↦ rcons (M := M) p = Word.cons (M := M) m w h1 h2)
                    (Pair.mk (M := M) (Eq.rec (motive := fun (x : ι) (h : j_1 = x) ↦ M x) m ⋯) w ⋯) ⋯
                else
                  Subtype.mk (p := fun (p : Pair M j) ↦ rcons (M := M) p = Word.cons (M := M) m w h1 h2)
                    (Pair.mk (M := M) 1 (Word.cons (M := M) m w h1 h2) ⋯) ⋯) :
            Pair M j)))
      (Sigma.mk (β := fun (i : ι) ↦ M i) i m) ↔
    Sigma.mk (β := fun (i : ι) ↦ M i) i m ∈ (Word.cons (M := M) g tail h1 h2).toList (M := M).tail ∨
      ¬i = j ∧
        ∃ (h : ¬(Word.cons (M := M) g tail h1 h2).toList (M := M) = []),
          (Word.cons (M := M) g tail h1 h2).toList (M := M).head h = Sigma.mk (β := fun (i : ι) ↦ M i) i m

Tactic:
simp only [consRecOn_cons]

Premises used: Monoid.CoprodI.Word.consRecOn_cons