Skip to content

Instantly share code, notes, and snippets.

@madnight
Created September 19, 2023 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madnight/f1d0f4d2d21b645549365056c4d4ae75 to your computer and use it in GitHub Desktop.
Save madnight/f1d0f4d2d21b645549365056c4d4ae75 to your computer and use it in GitHub Desktop.
Proof that Identity Morphism is Unique
Section Category.
Variable Obj : Type.
Variable Hom : Obj -> Obj -> Type.
Variable composition : forall {X Y Z : Obj}, Hom Y Z -> Hom X Y -> Hom X Z.
Notation "g 'o' f" := (composition g f) (at level 50).
Variable id : forall {X : Obj}, Hom X X.
Hypothesis id_left : forall {X Y : Obj} (f : Hom X Y), id o f = f.
Hypothesis id_right : forall {X Y : Obj} (f : Hom X Y), f o id = f.
Theorem id_unique : forall {X : Obj} (id1 id2 : Hom X X),
(forall {Y : Obj} (f : Hom Y X), id1 o f = f) ->
(forall {Y : Obj} (f : Hom X Y), f o id1 = f) ->
(forall {Y : Obj} (f : Hom Y X), id2 o f = f) ->
(forall {Y : Obj} (f : Hom X Y), f o id2 = f) ->
id1 = id2.
Proof.
intros X id1 id2 H1 H2 H3 H4.
transitivity (id o id1).
- symmetry.
apply id_left.
- transitivity (id o id2).
+ rewrite H2.
symmetry.
rewrite H4.
reflexivity.
+ apply id_left.
Qed.
End Category.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment