Skip to content

Instantly share code, notes, and snippets.

@AlecsFerra
Created March 13, 2026 10:08
Show Gist options
  • Select an option

  • Save AlecsFerra/7ba3b144393f042724263083e7df8cbe to your computer and use it in GitHub Desktop.

Select an option

Save AlecsFerra/7ba3b144393f042724263083e7df8cbe to your computer and use it in GitHub Desktop.
import Mathlib
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.Algebra.Group.Subgroup.Ker
import Mathlib.Data.List.Chain
import Mathlib.Algebra.Group.Int.Defs
import Mathlib.Algebra.BigOperators.Group.List.Defs
namespace FreeGroup
theorem map_injective' {α β : Type*} {f : α → β}
(hf : Function.Injective f) : Function.Injective (map f) := by
by_cases Nonempty α
· have map_inv : Function.LeftInverse (map (Function.invFun f)) (map f) := by
intro x
have hgf : (Function.invFun f) ∘ f = id := by
funext
apply Function.leftInverse_invFun hf
simp [map.comp, hgf]
exact map_inv.injective
· simp [not_nonempty_iff] at *
intro x y _
exact Subsingleton.elim x y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment