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 ⊢
    simp only [dif_pos hcan2] at hcan ⊢
    cases w using consRecOn with
    | ofGroup => simp [Cancels] at hcan2
    | cons g u' w h1 h2 ih =>
      clear ih
      simp only [unitsSMulGroup, SetLike.coe_sort_coe, unitsSMulWithCancel, id_eq, consRecOn_cons,
        group_smul_head, IsComplement.equiv_mul_left, map_mul, Submonoid.coe_mul, coe_toSubmonoid,
        toSubgroupEquiv_neg_apply, mul_inv_rev]
      cases hcan2.2
      have : ((d.compl (-u)).equiv w.head).1 = 1 :=
        (d.compl (-u)).equiv_fst_eq_one_of_mem_of_one_mem _ h1
      apply NormalWord.ext
      · -- This used to `simp [this]` before leanprover/lean4#2644
        

Proof state:
case neg.cons.refl.h1
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 : ℤˣ
g : G
w : NormalWord d
h1 :
  w.head ∈
    TransversalPair.set d
      { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
h2 :
  ∀ u' ∈ Option.map Prod.fst (List.head? w.toList),
    w.head ∈
        toSubgroup A B
          { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } →
      { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } = u'
hcan✝ :
  ¬Cancels (-u)
      (if h :
          Cancels u
            (cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } w
              h1 h2) then
        unitsSMulWithCancel φ u
          (cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } w h1
            h2)
          h
      else
        let g' :=
          unitsSMulGroup φ d u
            (cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } w
                  h1 h2).toReducedWord.head;
        cons (↑g'.1) u
          ((↑g'.2 *
              (cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } w
                      h1 h2).toReducedWord.head⁻¹) •
            cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } w h1
              h2)
          (_ :
            ↑(unitsSMulGroup φ d u
                        (cons g
                              { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                              w h1 h2).toReducedWord.head).2 *
                  (cons g
                          { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                            inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                          w h1 h2).toReducedWord.head⁻¹ *
                (cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                      w h1 h2).toReducedWord.head ∈
              TransversalPair.set d u)
          (_ :
            ∀
              u' ∈
                Option.map Prod.fst
                  (List.head?
                    ((↑(unitsSMulGroup φ d u
                                (cons g
                                      { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                        inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                      w h1 h2).toReducedWord.head).2 *
                          (cons g
                                  { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                    inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                  w h1 h2).toReducedWord.head⁻¹) •
                        cons g
                          { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                            inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                          w h1 h2).toList),
              ((↑(unitsSMulGroup φ d u
                              (cons g
                                    { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                      inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                    w h1 h2).toReducedWord.head).2 *
                        (cons g
                                { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                  inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                w h1 h2).toReducedWord.head⁻¹) •
                      cons g
                        { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                        w h1 h2).head ∈
                  toSubgroup A B u →
                u = u'))
hcan2 :
  Cancels u
    (cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } w h1 h2)
hcan :
  ¬Cancels (-u)
      (unitsSMulWithCancel φ u
        (cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } w h1
          h2)
        hcan2)
this : ((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B (-u))) (TransversalPair.set d (-u)))) w.head).1 = 1
⊢ (cons
          (↑((toSubgroupEquiv φ (-u))
              ((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B (-u))) (TransversalPair.set d (-u))))
                  (↑((toSubgroupEquiv φ u)
                        { val := g,
                          property :=
                            (_ :
                              (cons g
                                      { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                        inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                      w h1 h2).toReducedWord.head ∈
                                toSubgroup A B u) }) *
                    w.head)).1))
          (-u)
          ((↑((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B (-u))) (TransversalPair.set d (-u))))
                    (↑((toSubgroupEquiv φ u)
                          { val := g,
                            property :=
                              (_ :
                                (cons g
                                        { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                          inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                        w h1 h2).toReducedWord.head ∈
                                  toSubgroup A B u) }) *
                      w.head)).2 *
              (w.head⁻¹ *
                (↑((toSubgroupEquiv φ u)
                      { val := g,
                        property :=
                          (_ :
                            (cons g
                                    { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                      inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                    w h1 h2).toReducedWord.head ∈
                              toSubgroup A B u) }))⁻¹)) •
            ↑((toSubgroupEquiv φ u)
                  { val := g,
                    property :=
                      (_ :
                        (cons g
                                { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                  inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                w h1 h2).toReducedWord.head ∈
                          toSubgroup A B u) }) •
              w)
          (_ :
            ((↑((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B (-u))) (TransversalPair.set d (-u))))
                          (↑((toSubgroupEquiv φ u)
                                { val := g,
                                  property :=
                                    (_ :
                                      (cons g
                                              { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                                inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                              w h1 h2).toReducedWord.head ∈
                                        toSubgroup A B u) }) *
                            w.head)).2 *
                    (w.head⁻¹ *
                      (↑((toSubgroupEquiv φ u)
                            { val := g,
                              property :=
                                (_ :
                                  (cons g
                                          { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                            inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                          w h1 h2).toReducedWord.head ∈
                                    toSubgroup A B u) }))⁻¹)) •
                  ↑((toSubgroupEquiv φ u)
                        { val := g,
                          property :=
                            (_ :
                              (cons g
                                      { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                        inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                      w h1 h2).toReducedWord.head ∈
                                toSubgroup A B u) }) •
                    w).head ∈
              TransversalPair.set d (-u))
          (_ :
            ∀
              u' ∈
                Option.map Prod.fst
                  (List.head?
                    ((↑((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B (-u))) (TransversalPair.set d (-u))))
                                (↑((toSubgroupEquiv φ u)
                                      { val := g,
                                        property :=
                                          (_ :
                                            (cons g
                                                    { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                                      inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                                    w h1 h2).toReducedWord.head ∈
                                              toSubgroup A B u) }) *
                                  w.head)).2 *
                          (w.head⁻¹ *
                            (↑((toSubgroupEquiv φ u)
                                  { val := g,
                                    property :=
                                      (_ :
                                        (cons g
                                                { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                                  inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                                w h1 h2).toReducedWord.head ∈
                                          toSubgroup A B u) }))⁻¹)) •
                        ↑((toSubgroupEquiv φ u)
                              { val := g,
                                property :=
                                  (_ :
                                    (cons g
                                            { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                              inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                            w h1 h2).toReducedWord.head ∈
                                      toSubgroup A B u) }) •
                          w).toList),
              ((↑((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B (-u))) (TransversalPair.set d (-u))))
                              (↑((toSubgroupEquiv φ u)
                                    { val := g,
                                      property :=
                                        (_ :
                                          (cons g
                                                  { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                                    inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                                  w h1 h2).toReducedWord.head ∈
                                            toSubgroup A B u) }) *
                                w.head)).2 *
                        (w.head⁻¹ *
                          (↑((toSubgroupEquiv φ u)
                                { val := g,
                                  property :=
                                    (_ :
                                      (cons g
                                              { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                                inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                              w h1 h2).toReducedWord.head ∈
                                        toSubgroup A B u) }))⁻¹)) •
                      ↑((toSubgroupEquiv φ u)
                            { val := g,
                              property :=
                                (_ :
                                  (cons g
                                          { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1),
                                            inv_val := (_ : -↑u⁻¹ * -↑u = 1) }
                                          w h1 h2).toReducedWord.head ∈
                                    toSubgroup A B u) }) •
                        w).head ∈
                  toSubgroup A B (-u) →
                -u = u')).toReducedWord.head =
    (cons g { val := -↑u, inv := -↑u⁻¹, val_inv := (_ : -↑u * -↑u⁻¹ = 1), inv_val := (_ : -↑u⁻¹ * -↑u = 1) } w h1
          h2).toReducedWord.head

Next tactic:
dsimp