Theorem: GroupCat.SurjectiveOfEpiAuxs.h_apply_fromCoset_nin_range
File: Mathlib/Algebra/Category/GroupCat/EpiMono.lean

tactic: change ((τ).symm.trans (g x)).trans τ _ = _
state_before: A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
⊢ ↑(↑h x)
      (fromCoset
        { val := b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
          property :=
            (_ :
              ∃ y,
                Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                  b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) }) =
    fromCoset
      { val := x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
        property :=
          (_ :
            ∃ y,
              Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) }

tactic: simp only [tau, MonoidHom.coe_mk, Equiv.toFun_as_coe, Equiv.coe_trans, Function.comp_apply]
state_before: A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
⊢ ↑((τ.symm.trans (↑g x)).trans τ)
      (fromCoset
        { val := b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
          property :=
            (_ :
              ∃ y,
                Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                  b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) }) =
    fromCoset
      { val := x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
        property :=
          (_ :
            ∃ y,
              Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) }

tactic: rw [Equiv.symm_swap,
  @Equiv.swap_apply_of_ne_of_ne X' _ (fromCoset ⟨f.range.carrier, ⟨1, one_leftCoset _⟩⟩) ∞
    (fromCoset ⟨b *l f.range.carrier, ⟨b, rfl⟩⟩) (fromCoset_ne_of_nin_range _ hb) (by simp)]
state_before: A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
⊢ ↑(Equiv.swap
          (fromCoset
            { val := (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
              property :=
                (_ :
                  ∃ y,
                    Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                      (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) })
          ∞)
      (↑(↑g x)
        (↑(Equiv.swap
                (fromCoset
                  { val := (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
                    property :=
                      (_ :
                        ∃ y,
                          Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                            (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) })
                ∞).symm
          (fromCoset
            { val := b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
              property :=
                (_ :
                  ∃ y,
                    Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                      b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) }))) =
    fromCoset
      { val := x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
        property :=
          (_ :
            ∃ y,
              Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) }

tactic: simp only [g_apply_fromCoset, leftCoset_assoc]
state_before: A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
⊢ ↑(Equiv.swap
          (fromCoset
            { val := (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
              property :=
                (_ :
                  ∃ y,
                    Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                      (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) })
          ∞)
      (↑(↑g x)
        (fromCoset
          { val := b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
            property :=
              (_ :
                ∃ y,
                  Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                    b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) })) =
    fromCoset
      { val := x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
        property :=
          (_ :
            ∃ y,
              Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) }

tactic: refine' Equiv.swap_apply_of_ne_of_ne (fromCoset_ne_of_nin_range _ fun r => hb _) (by simp)
state_before: A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
⊢ ↑(Equiv.swap
          (fromCoset
            { val := (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
              property :=
                (_ :
                  ∃ y,
                    Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                      (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) })
          ∞)
      (fromCoset
        { val := x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
          property :=
            (_ :
              (fun x => x ∈ Set.range (Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier))
                (x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier)) }) =
    fromCoset
      { val := x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
        property :=
          (_ :
            ∃ y,
              Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) }

tactic: convert Subgroup.mul_mem _ (Subgroup.inv_mem _ hx) r
state_before: A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
r : x * b ∈ MonoidHom.range f
⊢ b ∈ MonoidHom.range f

tactic: rw [← mul_assoc, mul_left_inv, one_mul]
state_before: case h.e'_4
A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
r : x * b ∈ MonoidHom.range f
⊢ b = x⁻¹ * (x * b)

tactic: simp
state_before: A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
⊢ fromCoset
      { val := b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
        property :=
          (_ :
            ∃ y,
              Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier y =
                b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier) } ≠
    ∞

tactic: simp
state_before: A B : GroupCat
f : A ⟶ B
x : ↑B
hx : x ∈ MonoidHom.range f
b : ↑B
hb : ¬b ∈ MonoidHom.range f
⊢ fromCoset
      { val := x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier,
        property :=
          (_ :
            (fun x => x ∈ Set.range (Function.swap leftCoset (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier))
              (x * b *l (MonoidHom.range f).toSubmonoid.toSubsemigroup.carrier)) } ≠
    ∞