-- Module: Mathlib.GroupTheory.PushoutI
Goal:
ι : Type u_1
G : ι → Type u_2
H : Type u_3
inst : (i : ι) → Group (G i)
inst_1 : Group H
φ : (i : ι) → MonoidHom.{u_3, u_2} H (G i)
d : Transversal (G := G) φ
inst_2 : DecidableEq ι
inst_3 : (i : ι) → DecidableEq (G i)
w : Word G
i : ι
h : H
hw :
  ∀ (i : ι) (g : G i),
    Sigma.mk (β := fun (i : ι) ↦ G i) i g ∈ w.toList (M := G) →
      (↑((⋯.equiv (S := (↑(φ i).range : Set (G i))) (T := d.set (G := G) i) :
                  (a : G i) → (↑(↑(φ i).range : Set (G i)) : Type u_2) × (↑(d.set i) : Type u_2))
                g).2 :
          G i) =
        g
hφw :
  ∀ (j : ι) (g : G j),
    Sigma.mk (β := fun (i : ι) ↦ G i) j g ∈
        (HSMul.hSMul (α := CoprodI G)
              ((CoprodI.of (M := G) : (a : G i) → CoprodI G) ((φ i : (a : H) → G i) h) : CoprodI G) w).toList
          (M := G) →
      (↑((⋯.equiv (S := (↑(φ j).range : Set (G j))) (T := d.set (G := G) j) :
                  (a : G j) → (↑(↑(φ j).range : Set (G j)) : Type u_2) × (↑(d.set j) : Type u_2))
                g).2 :
          G j) =
        g
hhead :
  Eq.{u_2 + 1} (α := G i)
    ((↑((⋯.equiv (S := (↑(φ i).range : Set (G i))) (T := d.set (G := G) i) :
                (a : G i) → (↑(↑(φ i).range : Set (G i)) : Type u_2) × (↑(d.set i) : Type u_2))
              (Word.Pair.head (M := G) ((Word.equivPair (M := G) i : (a : Word G) → Word.Pair G i) w) : G i)).2 :
        G i) :
      G i)
    (Word.Pair.head (M := G) ((Word.equivPair (M := G) i : (a : Word G) → Word.Pair G i) w) : G i)
hh1 : ¬h = 1
refine_1 :
  Sigma.mk (β := fun (i : ι) ↦ G i) i
        (HMul.hMul (α := G i) (β := G i) ((φ i : (a : H) → G i) h : G i)
          (if h : ∃ (h : w.toList (M := G) ≠ []), (w.toList (M := G).head h).fst (β := fun (i : ι) ↦ G i) = i then
              Eq.rec (motive := fun (x : ι) (h : (w.toList (M := G).head ⋯).fst (β := fun (i : ι) ↦ G i) = x) ↦ G x)
                ((w.toList (M := G).head ⋯).snd (β := fun (i : ι) ↦ G i)) ⋯
            else 1 :
            G i)) ∈
      w.toList (M := G).tail ∨
    w.toList (M := G).head? =
        some
          (Sigma.mk (β := fun (i : ι) ↦ G i) i
            (if h : ∃ (h : w.toList (M := G) ≠ []), (w.toList (M := G).head h).fst (β := fun (i : ι) ↦ G i) = i then
              Eq.rec (motive := fun (x : ι) (h : (w.toList (M := G).head ⋯).fst (β := fun (i : ι) ↦ G i) = x) ↦ G x)
                ((w.toList (M := G).head ⋯).snd (β := fun (i : ι) ↦ G i)) ⋯
            else 1)) ∨
      ¬w.fstIdx (M := G) = some i ∧
        Eq.{u_2 + 1} (α := G i)
          (if h : ∃ (h : w.toList (M := G) ≠ []), (w.toList (M := G).head h).fst (β := fun (i : ι) ↦ G i) = i then
            Eq.rec (motive := fun (x : ι) (h : (w.toList (M := G).head ⋯).fst (β := fun (i : ι) ↦ G i) = x) ↦ G x)
              ((w.toList (M := G).head ⋯).snd (β := fun (i : ι) ↦ G i)) ⋯
          else 1)
          1
⊢ Sigma.mk (β := fun (i : ι) ↦ G i) i
        (HMul.hMul (α := G i) (β := G i) ((φ i : (a : H) → G i) h : G i)
          (Word.Pair.head (M := G) ((Word.equivPair (M := G) i : (a : Word G) → Word.Pair G i) w) : G i)) ∈
      w.toList (M := G).tail ∨
    w.toList (M := G).head? =
        some
          (Sigma.mk (β := fun (i : ι) ↦ G i) i
            (Word.Pair.head (M := G) ((Word.equivPair (M := G) i : (a : Word G) → Word.Pair G i) w))) ∨
      ¬w.fstIdx (M := G) = some i ∧
        Eq.{u_2 + 1} (α := G i)
          (Word.Pair.head (M := G) ((Word.equivPair (M := G) i : (a : Word G) → Word.Pair G i) w) : G i) (1 : G i)

Tactic:
rw [Word.equivPair_head]

Premises used: Monoid.CoprodI.Word.equivPair_head