theorem unitsSMul_neg (u : ℤˣ) (w : NormalWord d) :
    unitsSMul φ (-u) (unitsSMul φ u w) = w := by
  rw [unitsSMul]
  split_ifs with hcan
  · have hncan : ¬ Cancels u w := (unitsSMul_cancels_iff _ _ _).1 hcan
    unfold unitsSMul
    simp only [dif_neg hncan]
    simp [unitsSMulWithCancel, unitsSMulGroup, (d.compl u).equiv_snd_eq_inv_mul]
    -- This used to be the end of the proof before leanprover/lean4#2644
    erw [(d.compl u).equiv_snd_eq_inv_mul]
    simp
  · have hcan2 : Cancels u w := not_not.1 (mt (unitsSMul_cancels_iff _ _ _).2 hcan)
    unfold unitsSMul at hcan ⊢
    

Proof state:
case neg
G : Type u_1
inst✝³ : Group G
A B : Subgroup G
φ : ↥A ≃* ↥B
H : Type u_2
inst✝² : Group H
M : Type u_3
inst✝¹ : Monoid M
d : TransversalPair G A B
inst✝ : DecidableEq G
u : ℤˣ
w : NormalWord d
hcan :
  ¬Cancels (-u)
      (if h : Cancels u w then unitsSMulWithCancel φ u w h
      else
        let g' := unitsSMulGroup φ d u w.head;
        cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
          (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
          (_ :
            ∀ u' ∈ Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
              ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u → u = u'))
hcan2 : Cancels u w
⊢ (let g' :=
      unitsSMulGroup φ d (-u)
        (if h : Cancels u w then unitsSMulWithCancel φ u w h
            else
              let g' := unitsSMulGroup φ d u w.head;
              cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                (_ :
                  ∀ u' ∈ Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                    ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                      u = u')).toReducedWord.head;
    cons (↑g'.1) (-u)
      ((↑g'.2 *
          (if h : Cancels u w then unitsSMulWithCancel φ u w h
                else
                  let g' := unitsSMulGroup φ d u w.head;
                  cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                    (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                    (_ :
                      ∀
                        u' ∈
                          Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                        ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                          u = u')).toReducedWord.head⁻¹) •
        if h : Cancels u w then unitsSMulWithCancel φ u w h
        else
          let g' := unitsSMulGroup φ d u w.head;
          cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
            (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
            (_ :
              ∀ u' ∈ Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u → u = u'))
      (_ :
        ↑(unitsSMulGroup φ d (-u)
                    (if h : Cancels u w then unitsSMulWithCancel φ u w h
                        else
                          let g' := unitsSMulGroup φ d u w.head;
                          cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                            (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                            (_ :
                              ∀
                                u' ∈
                                  Option.map Prod.fst
                                    (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                                ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                                  u = u')).toReducedWord.head).2 *
              (if h : Cancels u w then unitsSMulWithCancel φ u w h
                    else
                      let g' := unitsSMulGroup φ d u w.head;
                      cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                        (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                        (_ :
                          ∀
                            u' ∈
                              Option.map Prod.fst
                                (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                            ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                              u = u')).toReducedWord.head⁻¹ *
            (if h : Cancels u w then unitsSMulWithCancel φ u w h
                else
                  let g' := unitsSMulGroup φ d u w.head;
                  cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                    (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                    (_ :
                      ∀
                        u' ∈
                          Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                        ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                          u = u')).toReducedWord.head ∈
          TransversalPair.set d (-u))
      (_ :
        ∀
          u' ∈
            Option.map Prod.fst
              (List.head?
                ((↑(unitsSMulGroup φ d (-u)
                            (if h : Cancels u w then unitsSMulWithCancel φ u w h
                                else
                                  let g' := unitsSMulGroup φ d u w.head;
                                  cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                                    (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                                    (_ :
                                      ∀
                                        u' ∈
                                          Option.map Prod.fst
                                            (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                                        ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                                          u = u')).toReducedWord.head).2 *
                      (if h : Cancels u w then unitsSMulWithCancel φ u w h
                            else
                              let g' := unitsSMulGroup φ d u w.head;
                              cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                                (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                                (_ :
                                  ∀
                                    u' ∈
                                      Option.map Prod.fst
                                        (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                                    ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                                      u = u')).toReducedWord.head⁻¹) •
                    if h : Cancels u w then unitsSMulWithCancel φ u w h
                    else
                      let g' := unitsSMulGroup φ d u w.head;
                      cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                        (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                        (_ :
                          ∀
                            u' ∈
                              Option.map Prod.fst
                                (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                            ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                              u = u')).toList),
          ((↑(unitsSMulGroup φ d (-u)
                          (if h : Cancels u w then unitsSMulWithCancel φ u w h
                              else
                                let g' := unitsSMulGroup φ d u w.head;
                                cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                                  (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                                  (_ :
                                    ∀
                                      u' ∈
                                        Option.map Prod.fst
                                          (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                                      ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                                        u = u')).toReducedWord.head).2 *
                    (if h : Cancels u w then unitsSMulWithCancel φ u w h
                          else
                            let g' := unitsSMulGroup φ d u w.head;
                            cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                              (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                              (_ :
                                ∀
                                  u' ∈
                                    Option.map Prod.fst
                                      (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                                  ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u →
                                    u = u')).toReducedWord.head⁻¹) •
                  if h : Cancels u w then unitsSMulWithCancel φ u w h
                  else
                    let g' := unitsSMulGroup φ d u w.head;
                    cons (↑g'.1) u ((↑g'.2 * w.head⁻¹) • w)
                      (_ : ↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d u)
                      (_ :
                        ∀
                          u' ∈
                            Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).toList),
                          ((↑(unitsSMulGroup φ d u w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B u → u = u')).head ∈
              toSubgroup A B (-u) →
            -u = u')) =
    w

Next tactic:
simp only [dif_pos hcan2] at hcan ⊢