2015-02-26 18:19:54 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Jakob von Raumer. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Jakob von Raumer
|
|
|
|
-/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-25 04:20:59 +00:00
|
|
|
import .iso
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-09-03 04:46:11 +00:00
|
|
|
open iso is_equiv equiv eq is_trunc
|
2015-02-26 18:19:54 +00:00
|
|
|
|
|
|
|
-- A category is a precategory extended by a witness
|
|
|
|
-- that the function from paths to isomorphisms,
|
2014-12-12 04:14:53 +00:00
|
|
|
-- is an equivalecnce.
|
2015-02-26 18:19:54 +00:00
|
|
|
namespace category
|
2015-03-13 14:32:48 +00:00
|
|
|
definition is_univalent [reducible] {ob : Type} (C : precategory ob) :=
|
2015-05-14 02:01:48 +00:00
|
|
|
Π(a b : ob), is_equiv (iso_of_eq : a = b → a ≅ b)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-26 18:19:54 +00:00
|
|
|
structure category [class] (ob : Type) extends parent : precategory ob :=
|
2015-04-25 04:20:59 +00:00
|
|
|
mk' :: (iso_of_path_equiv : is_univalent parent)
|
2014-12-22 01:18:38 +00:00
|
|
|
|
2015-02-26 18:19:54 +00:00
|
|
|
attribute category [multiple-instances]
|
|
|
|
|
|
|
|
abbreviation iso_of_path_equiv := @category.iso_of_path_equiv
|
|
|
|
|
2015-09-02 23:41:19 +00:00
|
|
|
definition category.mk [reducible] [unfold 2] {ob : Type} (C : precategory ob)
|
2015-04-25 04:20:59 +00:00
|
|
|
(H : Π (a b : ob), is_equiv (iso_of_eq : a = b → a ≅ b)) : category ob :=
|
|
|
|
precategory.rec_on C category.mk' H
|
2015-02-26 18:19:54 +00:00
|
|
|
|
|
|
|
section basic
|
|
|
|
variables {ob : Type} [C : category ob]
|
2014-12-12 04:14:53 +00:00
|
|
|
include C
|
|
|
|
|
|
|
|
-- Make iso_of_path_equiv a class instance
|
|
|
|
-- TODO: Unsafe class instance?
|
2015-01-26 19:31:12 +00:00
|
|
|
attribute iso_of_path_equiv [instance]
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-09-03 04:46:11 +00:00
|
|
|
definition eq_equiv_iso [constructor] (a b : ob) : (a = b) ≃ (a ≅ b) :=
|
|
|
|
equiv.mk iso_of_eq _
|
|
|
|
|
2015-03-13 22:27:29 +00:00
|
|
|
definition eq_of_iso [reducible] {a b : ob} : a ≅ b → a = b :=
|
2015-05-14 02:01:48 +00:00
|
|
|
iso_of_eq⁻¹ᶠ
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-21 07:24:00 +00:00
|
|
|
definition iso_of_eq_eq_of_iso {a b : ob} (p : a ≅ b) : iso_of_eq (eq_of_iso p) = p :=
|
|
|
|
right_inv iso_of_eq p
|
|
|
|
|
|
|
|
definition hom_of_eq_eq_of_iso {a b : ob} (p : a ≅ b) : hom_of_eq (eq_of_iso p) = to_hom p :=
|
|
|
|
ap to_hom !iso_of_eq_eq_of_iso
|
|
|
|
|
|
|
|
definition inv_of_eq_eq_of_iso {a b : ob} (p : a ≅ b) : inv_of_eq (eq_of_iso p) = to_inv p :=
|
|
|
|
ap to_inv !iso_of_eq_eq_of_iso
|
|
|
|
|
2015-09-03 04:46:11 +00:00
|
|
|
theorem eq_of_iso_refl {a : ob} : eq_of_iso (iso.refl a) = idp :=
|
|
|
|
inv_eq_of_eq idp
|
|
|
|
|
2015-02-28 00:50:06 +00:00
|
|
|
definition is_trunc_1_ob : is_trunc 1 ob :=
|
2014-12-12 04:14:53 +00:00
|
|
|
begin
|
2015-04-30 18:00:39 +00:00
|
|
|
apply is_trunc_succ_intro, intro a b,
|
2015-02-21 00:30:32 +00:00
|
|
|
fapply is_trunc_is_equiv_closed,
|
2015-02-28 00:50:06 +00:00
|
|
|
exact (@eq_of_iso _ _ a b),
|
2015-02-21 00:30:32 +00:00
|
|
|
apply is_equiv_inv,
|
2014-12-12 04:14:53 +00:00
|
|
|
end
|
2015-02-26 18:19:54 +00:00
|
|
|
end basic
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-26 18:19:54 +00:00
|
|
|
-- Bundled version of categories
|
|
|
|
-- we don't use Category.carrier explicitly, but rather use Precategory.carrier (to_Precategory C)
|
|
|
|
structure Category : Type :=
|
|
|
|
(carrier : Type)
|
|
|
|
(struct : category carrier)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-26 18:19:54 +00:00
|
|
|
attribute Category.struct [instance] [coercion]
|
2015-02-21 00:30:32 +00:00
|
|
|
|
2015-09-02 23:41:19 +00:00
|
|
|
definition Category.to_Precategory [constructor] [coercion] [reducible] (C : Category)
|
|
|
|
: Precategory :=
|
2015-02-26 18:19:54 +00:00
|
|
|
Precategory.mk (Category.carrier C) C
|
2015-02-21 00:30:32 +00:00
|
|
|
|
2015-09-02 23:41:19 +00:00
|
|
|
definition category.Mk [constructor] [reducible] := Category.mk
|
|
|
|
definition category.MK [constructor] [reducible] (C : Precategory)
|
2015-04-25 04:20:59 +00:00
|
|
|
(H : is_univalent C) : Category := Category.mk C (category.mk C H)
|
2015-02-21 00:30:32 +00:00
|
|
|
|
2015-02-26 18:19:54 +00:00
|
|
|
definition Category.eta (C : Category) : Category.mk C C = C :=
|
|
|
|
Category.rec (λob c, idp) C
|
2015-02-21 00:30:32 +00:00
|
|
|
|
|
|
|
end category
|