l3lab/ntp-mathlib huggingface dataset:
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
    

Proof state:
case pos
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) (unitsSMul φ u w)
hncan : ¬Cancels u w
⊢ ↑((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B u)) (TransversalPair.set d u))) w.head).1 •
      (↑((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B u)) (TransversalPair.set d u))) w.head).2 * w.head⁻¹) •
        w =
    w

Next tactic:
erw [(d.compl u).equiv_snd_eq_inv_mul]
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]
    

Proof state:
case pos
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) (unitsSMul φ u w)
hncan : ¬Cancels u w
⊢ ↑((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B u)) (TransversalPair.set d u))) w.head).1 •
      ((↑((IsComplement.equiv (_ : IsComplement (↑(toSubgroup A B u)) (TransversalPair.set d u))) w.head).1)⁻¹ *
            w.head *
          w.head⁻¹) •
        w =
    w

Next tactic:
simp
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
  · 

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) (unitsSMul φ u w)
⊢ (let g' := unitsSMulGroup φ d (-u) (unitsSMul φ u w).toReducedWord.head;
    cons (↑g'.1) (-u) ((↑g'.2 * (unitsSMul φ u w).toReducedWord.head⁻¹) • unitsSMul φ u w)
      (_ :
        ↑(unitsSMulGroup φ d (-u) (unitsSMul φ u w).toReducedWord.head).2 * (unitsSMul φ u w).toReducedWord.head⁻¹ *
            (unitsSMul φ u w).toReducedWord.head ∈
          TransversalPair.set d (-u))
      (_ :
        ∀
          u' ∈
            Option.map Prod.fst
              (List.head?
                ((↑(unitsSMulGroup φ d (-u) (unitsSMul φ u w).toReducedWord.head).2 *
                      (unitsSMul φ u w).toReducedWord.head⁻¹) •
                    unitsSMul φ u w).toList),
          ((↑(unitsSMulGroup φ d (-u) (unitsSMul φ u w).toReducedWord.head).2 *
                    (unitsSMul φ u w).toReducedWord.head⁻¹) •
                  unitsSMul φ u w).head ∈
              toSubgroup A B (-u) →
            -u = u')) =
    w

Next tactic:
have hcan2 : Cancels u w := not_not.1 (mt (unitsSMul_cancels_iff _ _ _).2 hcan)
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)
    

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) (unitsSMul φ u w)
hcan2 : Cancels u w
⊢ (let g' := unitsSMulGroup φ d (-u) (unitsSMul φ u w).toReducedWord.head;
    cons (↑g'.1) (-u) ((↑g'.2 * (unitsSMul φ u w).toReducedWord.head⁻¹) • unitsSMul φ u w)
      (_ :
        ↑(unitsSMulGroup φ d (-u) (unitsSMul φ u w).toReducedWord.head).2 * (unitsSMul φ u w).toReducedWord.head⁻¹ *
            (unitsSMul φ u w).toReducedWord.head ∈
          TransversalPair.set d (-u))
      (_ :
        ∀
          u' ∈
            Option.map Prod.fst
              (List.head?
                ((↑(unitsSMulGroup φ d (-u) (unitsSMul φ u w).toReducedWord.head).2 *
                      (unitsSMul φ u w).toReducedWord.head⁻¹) •
                    unitsSMul φ u w).toList),
          ((↑(unitsSMulGroup φ d (-u) (unitsSMul φ u w).toReducedWord.head).2 *
                    (unitsSMul φ u w).toReducedWord.head⁻¹) •
                  unitsSMul φ u w).head ∈
              toSubgroup A B (-u) →
            -u = u')) =
    w

Next tactic:
unfold unitsSMul at hcan ⊢
/-- the equivalence given by multiplication on the left by `t`  -/
@[simps]
noncomputable def unitsSMulEquiv : NormalWord d ≃ NormalWord d :=
  { toFun := unitsSMul φ 1
    invFun := unitsSMul φ (-1),
    left_inv := fun _ => by 

Proof state:
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
x✝ : NormalWord d
⊢ unitsSMul φ (-1) (unitsSMul φ 1 x✝) = x✝

Next tactic:
rw [unitsSMul_neg]
/-- the equivalence given by multiplication on the left by `t`  -/
@[simps]
noncomputable def unitsSMulEquiv : NormalWord d ≃ NormalWord d :=
  { toFun := unitsSMul φ 1
    invFun := unitsSMul φ (-1),
    left_inv := fun _ => by rw [unitsSMul_neg]
    right_inv := fun w => by 

Proof state:
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
w : NormalWord d
⊢ unitsSMul φ 1 (unitsSMul φ (-1) w) = w

Next tactic:
convert unitsSMul_neg _ _ w
/-- the equivalence given by multiplication on the left by `t`  -/
@[simps]
noncomputable def unitsSMulEquiv : NormalWord d ≃ NormalWord d :=
  { toFun := unitsSMul φ 1
    invFun := unitsSMul φ (-1),
    left_inv := fun _ => by rw [unitsSMul_neg]
    right_inv := fun w => by convert unitsSMul_neg _ _ w; 

Proof state:
case h.e'_2.h.e'_7
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
w : NormalWord d
⊢ 1 = - -1

Next tactic:
simp
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  

Proof state:
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
g : ↥A
w : NormalWord d
⊢ unitsSMul φ 1 (↑g • w) = ↑(φ g) • unitsSMul φ 1 w

Next tactic:
unfold unitsSMul
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  

Proof state:
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
g : ↥A
w : NormalWord d
⊢ (if h : Cancels 1 (↑g • w) then unitsSMulWithCancel φ 1 (↑g • w) h
    else
      let g' := unitsSMulGroup φ d 1 (↑g • w).head;
      cons (↑g'.1) 1 ((↑g'.2 * (↑g • w).head⁻¹) • ↑g • w)
        (_ : ↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹ * (↑g • w).head ∈ TransversalPair.set d 1)
        (_ :
          ∀
            u' ∈
              Option.map Prod.fst
                (List.head? ((↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹) • ↑g • w).toList),
            ((↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹) • ↑g • w).head ∈ toSubgroup A B 1 → 1 = u')) =
    ↑(φ g) •
      if h : Cancels 1 w then unitsSMulWithCancel φ 1 w h
      else
        let g' := unitsSMulGroup φ d 1 w.head;
        cons (↑g'.1) 1 ((↑g'.2 * w.head⁻¹) • w)
          (_ : ↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d 1)
          (_ :
            ∀ u' ∈ Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹) • w).toList),
              ((↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B 1 → 1 = u')

Next tactic:
have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    

Proof state:
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
g : ↥A
w : NormalWord d
⊢ Cancels 1 (↑g • w) ↔ Cancels 1 w

Next tactic:
simp [Cancels, Subgroup.mul_mem_cancel_left]
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
  

Proof state:
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
g : ↥A
w : NormalWord d
this : Cancels 1 (↑g • w) ↔ Cancels 1 w
⊢ (if h : Cancels 1 (↑g • w) then unitsSMulWithCancel φ 1 (↑g • w) h
    else
      let g' := unitsSMulGroup φ d 1 (↑g • w).head;
      cons (↑g'.1) 1 ((↑g'.2 * (↑g • w).head⁻¹) • ↑g • w)
        (_ : ↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹ * (↑g • w).head ∈ TransversalPair.set d 1)
        (_ :
          ∀
            u' ∈
              Option.map Prod.fst
                (List.head? ((↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹) • ↑g • w).toList),
            ((↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹) • ↑g • w).head ∈ toSubgroup A B 1 → 1 = u')) =
    ↑(φ g) •
      if h : Cancels 1 w then unitsSMulWithCancel φ 1 w h
      else
        let g' := unitsSMulGroup φ d 1 w.head;
        cons (↑g'.1) 1 ((↑g'.2 * w.head⁻¹) • w)
          (_ : ↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d 1)
          (_ :
            ∀ u' ∈ Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹) • w).toList),
              ((↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B 1 → 1 = u')

Next tactic:
by_cases hcan : Cancels 1 w
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
  by_cases hcan : Cancels 1 w
  · 

Proof state:
case pos
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
g : ↥A
w : NormalWord d
this : Cancels 1 (↑g • w) ↔ Cancels 1 w
hcan : Cancels 1 w
⊢ (if h : Cancels 1 (↑g • w) then unitsSMulWithCancel φ 1 (↑g • w) h
    else
      let g' := unitsSMulGroup φ d 1 (↑g • w).head;
      cons (↑g'.1) 1 ((↑g'.2 * (↑g • w).head⁻¹) • ↑g • w)
        (_ : ↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹ * (↑g • w).head ∈ TransversalPair.set d 1)
        (_ :
          ∀
            u' ∈
              Option.map Prod.fst
                (List.head? ((↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹) • ↑g • w).toList),
            ((↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹) • ↑g • w).head ∈ toSubgroup A B 1 → 1 = u')) =
    ↑(φ g) •
      if h : Cancels 1 w then unitsSMulWithCancel φ 1 w h
      else
        let g' := unitsSMulGroup φ d 1 w.head;
        cons (↑g'.1) 1 ((↑g'.2 * w.head⁻¹) • w)
          (_ : ↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d 1)
          (_ :
            ∀ u' ∈ Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹) • w).toList),
              ((↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B 1 → 1 = u')

Next tactic:
simp [unitsSMulWithCancel, dif_pos (this.2 hcan), dif_pos hcan]
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
  by_cases hcan : Cancels 1 w
  · simp [unitsSMulWithCancel, dif_pos (this.2 hcan), dif_pos hcan]
    

Proof state:
case pos
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
g : ↥A
w : NormalWord d
this : Cancels 1 (↑g • w) ↔ Cancels 1 w
hcan : Cancels 1 w
⊢ consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (↑g • w) (fun g_1 a => ↑g • w)
      (fun g u' w h1 h2 x can =>
        ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
      (_ : Cancels 1 (↑g • w)) =
    ↑(φ g) •
      consRecOn (motive := fun x => Cancels 1 x → NormalWord d) w (fun g a => w)
        (fun g u' w h1 h2 x can =>
          ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
        hcan

Next tactic:
cases w using consRecOn
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
  by_cases hcan : Cancels 1 w
  · simp [unitsSMulWithCancel, dif_pos (this.2 hcan), dif_pos hcan]
    cases w using consRecOn
    · 

Proof state:
case pos.ofGroup
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
g : ↥A
g✝ : G
this : Cancels 1 (↑g • ofGroup g✝) ↔ Cancels 1 (ofGroup g✝)
hcan : Cancels 1 (ofGroup g✝)
⊢ consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (↑g • ofGroup g✝) (fun g_1 a => ↑g • ofGroup g✝)
      (fun g u' w h1 h2 x can =>
        ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
      (_ : Cancels 1 (↑g • ofGroup g✝)) =
    ↑(φ g) •
      consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (ofGroup g✝) (fun g a => ofGroup g✝)
        (fun g u' w h1 h2 x can =>
          ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
        hcan

Next tactic:
simp [Cancels] at hcan
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
  by_cases hcan : Cancels 1 w
  · simp [unitsSMulWithCancel, dif_pos (this.2 hcan), dif_pos hcan]
    cases w using consRecOn
    · simp [Cancels] at hcan
    · 

Proof state:
case pos.cons
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
g : ↥A
g✝ : G
u✝ : ℤˣ
w✝ : NormalWord d
h1✝ : w✝.head ∈ TransversalPair.set d u✝
h2✝ : ∀ u' ∈ Option.map Prod.fst (List.head? w✝.toList), w✝.head ∈ toSubgroup A B u✝ → u✝ = u'
this : Cancels 1 (↑g • cons g✝ u✝ w✝ h1✝ h2✝) ↔ Cancels 1 (cons g✝ u✝ w✝ h1✝ h2✝)
hcan : Cancels 1 (cons g✝ u✝ w✝ h1✝ h2✝)
a✝ :
  cons g✝ u✝ w✝ h1✝ h2✝ = w✝ →
    consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (↑g • cons g✝ u✝ w✝ h1✝ h2✝)
        (fun g_1 a => ↑g • cons g✝ u✝ w✝ h1✝ h2✝)
        (fun g u' w h1 h2 x can =>
          ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
        (_ : Cancels 1 (↑g • cons g✝ u✝ w✝ h1✝ h2✝)) =
      ↑(φ g) •
        consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (cons g✝ u✝ w✝ h1✝ h2✝)
          (fun g a => cons g✝ u✝ w✝ h1✝ h2✝)
          (fun g u' w h1 h2 x can =>
            ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
          hcan
⊢ consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (↑g • cons g✝ u✝ w✝ h1✝ h2✝)
      (fun g_1 a => ↑g • cons g✝ u✝ w✝ h1✝ h2✝)
      (fun g u' w h1 h2 x can =>
        ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
      (_ : Cancels 1 (↑g • cons g✝ u✝ w✝ h1✝ h2✝)) =
    ↑(φ g) •
      consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (cons g✝ u✝ w✝ h1✝ h2✝)
        (fun g a => cons g✝ u✝ w✝ h1✝ h2✝)
        (fun g u' w h1 h2 x can =>
          ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
        hcan

Next tactic:
simp only [smul_cons, consRecOn_cons, mul_smul]
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
  by_cases hcan : Cancels 1 w
  · simp [unitsSMulWithCancel, dif_pos (this.2 hcan), dif_pos hcan]
    cases w using consRecOn
    · simp [Cancels] at hcan
    · simp only [smul_cons, consRecOn_cons, mul_smul]
      

Proof state:
case pos.cons
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
g : ↥A
g✝ : G
u✝ : ℤˣ
w✝ : NormalWord d
h1✝ : w✝.head ∈ TransversalPair.set d u✝
h2✝ : ∀ u' ∈ Option.map Prod.fst (List.head? w✝.toList), w✝.head ∈ toSubgroup A B u✝ → u✝ = u'
this : Cancels 1 (↑g • cons g✝ u✝ w✝ h1✝ h2✝) ↔ Cancels 1 (cons g✝ u✝ w✝ h1✝ h2✝)
hcan : Cancels 1 (cons g✝ u✝ w✝ h1✝ h2✝)
a✝ :
  cons g✝ u✝ w✝ h1✝ h2✝ = w✝ →
    consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (↑g • cons g✝ u✝ w✝ h1✝ h2✝)
        (fun g_1 a => ↑g • cons g✝ u✝ w✝ h1✝ h2✝)
        (fun g u' w h1 h2 x can =>
          ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
        (_ : Cancels 1 (↑g • cons g✝ u✝ w✝ h1✝ h2✝)) =
      ↑(φ g) •
        consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (cons g✝ u✝ w✝ h1✝ h2✝)
          (fun g a => cons g✝ u✝ w✝ h1✝ h2✝)
          (fun g u' w h1 h2 x can =>
            ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
          hcan
⊢ ↑(φ { val := ↑g * g✝, property := (_ : (cons (↑g * g✝) u✝ w✝ h1✝ h2✝).toReducedWord.head ∈ toSubgroup A B 1) }) • w✝ =
    ↑(φ g) • ↑(φ { val := g✝, property := (_ : (cons g✝ u✝ w✝ h1✝ h2✝).toReducedWord.head ∈ toSubgroup A B 1) }) • w✝

Next tactic:
rw [← mul_smul, ← Subgroup.coe_mul, ← map_mul φ]
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
  by_cases hcan : Cancels 1 w
  · simp [unitsSMulWithCancel, dif_pos (this.2 hcan), dif_pos hcan]
    cases w using consRecOn
    · simp [Cancels] at hcan
    · simp only [smul_cons, consRecOn_cons, mul_smul]
      rw [← mul_smul, ← Subgroup.coe_mul, ← map_mul φ]
      

Proof state:
case pos.cons
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
g : ↥A
g✝ : G
u✝ : ℤˣ
w✝ : NormalWord d
h1✝ : w✝.head ∈ TransversalPair.set d u✝
h2✝ : ∀ u' ∈ Option.map Prod.fst (List.head? w✝.toList), w✝.head ∈ toSubgroup A B u✝ → u✝ = u'
this : Cancels 1 (↑g • cons g✝ u✝ w✝ h1✝ h2✝) ↔ Cancels 1 (cons g✝ u✝ w✝ h1✝ h2✝)
hcan : Cancels 1 (cons g✝ u✝ w✝ h1✝ h2✝)
a✝ :
  cons g✝ u✝ w✝ h1✝ h2✝ = w✝ →
    consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (↑g • cons g✝ u✝ w✝ h1✝ h2✝)
        (fun g_1 a => ↑g • cons g✝ u✝ w✝ h1✝ h2✝)
        (fun g u' w h1 h2 x can =>
          ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
        (_ : Cancels 1 (↑g • cons g✝ u✝ w✝ h1✝ h2✝)) =
      ↑(φ g) •
        consRecOn (motive := fun x => Cancels 1 x → NormalWord d) (cons g✝ u✝ w✝ h1✝ h2✝)
          (fun g a => cons g✝ u✝ w✝ h1✝ h2✝)
          (fun g u' w h1 h2 x can =>
            ↑(φ { val := g, property := (_ : (cons g u' w h1 h2).toReducedWord.head ∈ toSubgroup A B 1) }) • w)
          hcan
⊢ ↑(φ { val := ↑g * g✝, property := (_ : (cons (↑g * g✝) u✝ w✝ h1✝ h2✝).toReducedWord.head ∈ toSubgroup A B 1) }) • w✝ =
    ↑(φ (g * { val := g✝, property := (_ : (cons g✝ u✝ w✝ h1✝ h2✝).toReducedWord.head ∈ toSubgroup A B 1) })) • w✝

Next tactic:
rfl
theorem unitsSMul_one_group_smul (g : A) (w : NormalWord d) :
    unitsSMul φ 1 ((g : G) • w) = (φ g : G) • (unitsSMul φ 1 w) := by
  unfold unitsSMul
  have : Cancels 1 ((g : G) • w) ↔ Cancels 1 w := by
    simp [Cancels, Subgroup.mul_mem_cancel_left]
  by_cases hcan : Cancels 1 w
  · simp [unitsSMulWithCancel, dif_pos (this.2 hcan), dif_pos hcan]
    cases w using consRecOn
    · simp [Cancels] at hcan
    · simp only [smul_cons, consRecOn_cons, mul_smul]
      rw [← mul_smul, ← Subgroup.coe_mul, ← map_mul φ]
      rfl
  · 

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
g : ↥A
w : NormalWord d
this : Cancels 1 (↑g • w) ↔ Cancels 1 w
hcan : ¬Cancels 1 w
⊢ (if h : Cancels 1 (↑g • w) then unitsSMulWithCancel φ 1 (↑g • w) h
    else
      let g' := unitsSMulGroup φ d 1 (↑g • w).head;
      cons (↑g'.1) 1 ((↑g'.2 * (↑g • w).head⁻¹) • ↑g • w)
        (_ : ↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹ * (↑g • w).head ∈ TransversalPair.set d 1)
        (_ :
          ∀
            u' ∈
              Option.map Prod.fst
                (List.head? ((↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹) • ↑g • w).toList),
            ((↑(unitsSMulGroup φ d 1 (↑g • w).head).2 * (↑g • w).head⁻¹) • ↑g • w).head ∈ toSubgroup A B 1 → 1 = u')) =
    ↑(φ g) •
      if h : Cancels 1 w then unitsSMulWithCancel φ 1 w h
      else
        let g' := unitsSMulGroup φ d 1 w.head;
        cons (↑g'.1) 1 ((↑g'.2 * w.head⁻¹) • w)
          (_ : ↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹ * w.head ∈ TransversalPair.set d 1)
          (_ :
            ∀ u' ∈ Option.map Prod.fst (List.head? ((↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹) • w).toList),
              ((↑(unitsSMulGroup φ d 1 w.head).2 * w.head⁻¹) • w).head ∈ toSubgroup A B 1 → 1 = u')

Next tactic:
rw [dif_neg (mt this.1 hcan), dif_neg hcan]