Theorem: IsFreeGroupoid.path_nonempty_of_hom
File: Mathlib/GroupTheory/NielsenSchreier.lean

tactic: rintro ⟨p⟩
state_before: G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
⊢ Nonempty (a ⟶ b) → Nonempty (Path (IsFreeGroupoid.symgen a) (IsFreeGroupoid.symgen b))

tactic: rw [← @WeaklyConnectedComponent.eq (Generators G), eq_comm, ← FreeGroup.of_injective.eq_iff, ←
  mul_inv_eq_one]
state_before: case intro
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
⊢ Nonempty (Path (IsFreeGroupoid.symgen a) (IsFreeGroupoid.symgen b))

tactic: let X := FreeGroup (WeaklyConnectedComponent <| Generators G)
state_before: case intro
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
⊢ FreeGroup.of (WeaklyConnectedComponent.mk (IsFreeGroupoid.symgen b)) *
      (FreeGroup.of (WeaklyConnectedComponent.mk (IsFreeGroupoid.symgen a)))⁻¹ =
    1

tactic: let f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
state_before: case intro
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
⊢ FreeGroup.of (WeaklyConnectedComponent.mk (IsFreeGroupoid.symgen b)) *
      (FreeGroup.of (WeaklyConnectedComponent.mk (IsFreeGroupoid.symgen a)))⁻¹ =
    1

tactic: let F : G ⥤ CategoryTheory.SingleObj.{u} (X : Type u) := SingleObj.differenceFunctor f
state_before: case intro
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
⊢ FreeGroup.of (WeaklyConnectedComponent.mk (IsFreeGroupoid.symgen b)) *
      (FreeGroup.of (WeaklyConnectedComponent.mk (IsFreeGroupoid.symgen a)))⁻¹ =
    1

tactic: change (F.map p) = ((@CategoryTheory.Functor.const G _ _ (SingleObj.category X)).obj ()).map p
state_before: case intro
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
F : G ⥤ CategoryTheory.SingleObj X := differenceFunctor f
⊢ FreeGroup.of (WeaklyConnectedComponent.mk (IsFreeGroupoid.symgen b)) *
      (FreeGroup.of (WeaklyConnectedComponent.mk (IsFreeGroupoid.symgen a)))⁻¹ =
    1

tactic: congr
state_before: case intro
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
F : G ⥤ CategoryTheory.SingleObj X := differenceFunctor f
⊢ F.map p = ((Functor.const G).obj ()).map p

tactic: ext
state_before: case intro.h.e_5.h.e_self
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
F : G ⥤ CategoryTheory.SingleObj X := differenceFunctor f
⊢ F = (Functor.const G).obj ()

tactic: rw [Functor.const_obj_map, id_as_one, differenceFunctor_map, @mul_inv_eq_one _ _ (f _)]
state_before: case intro.h.e_5.h.e_self.h
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
F : G ⥤ CategoryTheory.SingleObj X := differenceFunctor f
a✝ b✝ : Generators G
e✝ : a✝ ⟶ b✝
⊢ F.map (of e✝) = ((Functor.const G).obj ()).map (of e✝)

tactic: apply congr_arg FreeGroup.of
state_before: case intro.h.e_5.h.e_self.h
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
F : G ⥤ CategoryTheory.SingleObj X := differenceFunctor f
a✝ b✝ : Generators G
e✝ : a✝ ⟶ b✝
⊢ f b✝ =
    f
      (let_fun this := a✝;
      this)

tactic: apply (WeaklyConnectedComponent.eq _ _).mpr
state_before: case intro.h.e_5.h.e_self.h
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
F : G ⥤ CategoryTheory.SingleObj X := differenceFunctor f
a✝ b✝ : Generators G
e✝ : a✝ ⟶ b✝
⊢ WeaklyConnectedComponent.mk b✝ =
    WeaklyConnectedComponent.mk
      (let_fun this := a✝;
      this)

tactic: exact ⟨Hom.toPath (Sum.inr (by assumption))⟩
state_before: case intro.h.e_5.h.e_self.h
G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
F : G ⥤ CategoryTheory.SingleObj X := differenceFunctor f
a✝ b✝ : Generators G
e✝ : a✝ ⟶ b✝
⊢ Nonempty
    (Path b✝
      (let_fun this := a✝;
      this))

tactic: assumption
state_before: G : Type u
inst✝¹ : Groupoid G
inst✝ : IsFreeGroupoid G
a b : G
p : a ⟶ b
X : Type u := FreeGroup (WeaklyConnectedComponent (Generators G))
f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
F : G ⥤ CategoryTheory.SingleObj X := differenceFunctor f
a✝ b✝ : Generators G
e✝ : a✝ ⟶ b✝
⊢ (let_fun this := a✝;
    this) ⟶
    b✝