2015-02-26 18:19:54 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Module: algebra.category.constructions
|
|
|
|
Authors: Floris van Doorn
|
|
|
|
-/
|
|
|
|
|
2015-03-03 21:38:18 +00:00
|
|
|
import .basic algebra.precategory.constructions types.equiv types.trunc
|
2015-02-26 18:19:54 +00:00
|
|
|
|
2015-02-28 06:16:20 +00:00
|
|
|
--open eq eq.ops equiv category.ops iso category is_trunc
|
2015-03-03 21:38:18 +00:00
|
|
|
open eq category equiv iso is_equiv category.ops is_trunc iso.iso function sigma
|
2015-02-26 18:19:54 +00:00
|
|
|
|
|
|
|
namespace category
|
|
|
|
|
2015-02-28 06:16:20 +00:00
|
|
|
namespace set
|
2015-03-03 21:38:18 +00:00
|
|
|
local attribute is_equiv_subtype_eq [instance]
|
|
|
|
definition iso_of_equiv {A B : Precategory_hset} (f : A ≃ B) : A ≅ B :=
|
|
|
|
iso.MK (to_fun f)
|
|
|
|
(equiv.to_inv f)
|
|
|
|
(eq_of_homotopy (sect (to_fun f)))
|
|
|
|
(eq_of_homotopy (retr (to_fun f)))
|
|
|
|
|
|
|
|
definition equiv_of_iso {A B : Precategory_hset} (f : A ≅ B) : A ≃ B :=
|
|
|
|
equiv.MK (to_hom f)
|
|
|
|
(iso.to_inv f)
|
|
|
|
(ap10 (right_inverse (to_hom f)))
|
|
|
|
(ap10 (left_inverse (to_hom f)))
|
|
|
|
|
|
|
|
definition is_equiv_iso_of_equiv (A B : Precategory_hset) : is_equiv (@iso_of_equiv A B) :=
|
|
|
|
adjointify _ (λf, equiv_of_iso f)
|
|
|
|
(λf, iso.eq_mk idp)
|
|
|
|
(λf, equiv.eq_mk idp)
|
|
|
|
local attribute is_equiv_iso_of_equiv [instance]
|
|
|
|
|
|
|
|
open sigma.ops
|
|
|
|
definition subtype_eq_inv {A : Type} {B : A → Type} [H : Πa, is_hprop (B a)] (u v : Σa, B a)
|
|
|
|
: u = v → u.1 = v.1 :=
|
|
|
|
(subtype_eq u v)⁻¹ᵉ
|
|
|
|
local attribute subtype_eq_inv [reducible]
|
|
|
|
definition is_equiv_subtype_eq_inv {A : Type} {B : A → Type} [H : Πa, is_hprop (B a)] (u v : Σa, B a)
|
|
|
|
: is_equiv (subtype_eq_inv u v) :=
|
|
|
|
_
|
|
|
|
|
|
|
|
definition iso_of_eq_eq_compose (A B : hset) : @iso_of_eq _ _ A B =
|
|
|
|
@iso_of_equiv A B ∘ @equiv_of_eq A B ∘ subtype_eq_inv _ _ ∘
|
|
|
|
@ap _ _ (to_fun (trunctype.sigma_char 0)) A B :=
|
|
|
|
eq_of_homotopy (λp, eq.rec_on p idp)
|
|
|
|
|
2015-02-28 06:16:20 +00:00
|
|
|
definition equiv_equiv_iso (A B : Precategory_hset) : (A ≃ B) ≃ (A ≅ B) :=
|
2015-03-03 21:38:18 +00:00
|
|
|
equiv.MK (λf, iso_of_equiv f)
|
2015-02-28 06:16:20 +00:00
|
|
|
(λf, equiv.MK (to_hom f)
|
|
|
|
(iso.to_inv f)
|
|
|
|
(ap10 (right_inverse (to_hom f)))
|
|
|
|
(ap10 (left_inverse (to_hom f))))
|
|
|
|
(λf, iso.eq_mk idp)
|
|
|
|
(λf, equiv.eq_mk idp)
|
|
|
|
|
|
|
|
definition equiv_eq_iso (A B : Precategory_hset) : (A ≃ B) = (A ≅ B) :=
|
|
|
|
ua !equiv_equiv_iso
|
|
|
|
|
2015-03-13 14:32:48 +00:00
|
|
|
definition is_univalent_hset (A B : Precategory_hset) : is_equiv (@iso_of_eq _ _ A B) :=
|
2015-03-03 21:38:18 +00:00
|
|
|
have H : is_equiv (@iso_of_equiv A B ∘ @equiv_of_eq A B ∘ subtype_eq_inv _ _ ∘
|
|
|
|
@ap _ _ (to_fun (trunctype.sigma_char 0)) A B), from
|
|
|
|
@is_equiv_compose _ _ _ _ _
|
|
|
|
(@is_equiv_compose _ _ _ _ _
|
|
|
|
(@is_equiv_compose _ _ _ _ _
|
|
|
|
_
|
|
|
|
(@is_equiv_subtype_eq_inv _ _ _ _ _))
|
|
|
|
!univalence)
|
|
|
|
!is_equiv_iso_of_equiv,
|
|
|
|
(iso_of_eq_eq_compose A B)⁻¹ ▹ H
|
2015-02-28 06:16:20 +00:00
|
|
|
|
2015-03-03 21:38:18 +00:00
|
|
|
end set
|
2015-02-26 18:19:54 +00:00
|
|
|
|
|
|
|
definition category_hset [reducible] [instance] : category hset :=
|
2015-03-13 14:32:48 +00:00
|
|
|
category.mk' hset precategory_hset set.is_univalent_hset
|
2015-02-26 18:19:54 +00:00
|
|
|
|
|
|
|
definition Category_hset [reducible] : Category :=
|
|
|
|
Category.mk hset category_hset
|
|
|
|
|
|
|
|
namespace ops
|
|
|
|
abbreviation set := Category_hset
|
|
|
|
end ops
|
|
|
|
|
2015-03-13 14:32:48 +00:00
|
|
|
section functor
|
|
|
|
open functor nat_trans
|
|
|
|
|
|
|
|
variables {C : Precategory} {D : Category} {F G : D ^c C}
|
|
|
|
definition eq_of_iso_functor_ob (η : F ≅ G) (c : C) : F c = G c :=
|
|
|
|
by apply eq_of_iso; apply componentwise_iso; exact η
|
|
|
|
|
2015-03-23 18:32:20 +00:00
|
|
|
local attribute functor.to_fun_hom [quasireducible]
|
2015-03-13 14:32:48 +00:00
|
|
|
definition eq_of_iso_functor (η : F ≅ G) : F = G :=
|
|
|
|
begin
|
2015-03-13 22:27:29 +00:00
|
|
|
fapply functor_eq,
|
2015-03-13 14:32:48 +00:00
|
|
|
{exact (eq_of_iso_functor_ob η)},
|
2015-03-13 22:27:29 +00:00
|
|
|
{intros (c, c', f), --unfold eq_of_iso_functor_ob, --TODO: report: this fails
|
2015-03-13 14:32:48 +00:00
|
|
|
apply concat,
|
|
|
|
{apply (ap (λx, to_hom x ∘ to_fun_hom F f ∘ _)), apply (retr iso_of_eq)},
|
|
|
|
apply concat,
|
|
|
|
{apply (ap (λx, _ ∘ to_fun_hom F f ∘ (to_hom x)⁻¹)), apply (retr iso_of_eq)},
|
|
|
|
apply inverse, apply naturality_iso}
|
|
|
|
end
|
|
|
|
|
|
|
|
definition iso_of_eq_eq_of_iso_functor (η : F ≅ G) : iso_of_eq (eq_of_iso_functor η) = η :=
|
|
|
|
begin
|
|
|
|
apply iso.eq_mk,
|
|
|
|
apply nat_trans_eq_mk,
|
|
|
|
intro c,
|
2015-03-13 22:27:29 +00:00
|
|
|
rewrite natural_map_hom_of_eq, esimp {eq_of_iso_functor},
|
|
|
|
rewrite ap010_functor_eq, esimp {hom_of_eq,eq_of_iso_functor_ob},
|
|
|
|
rewrite (retr iso_of_eq),
|
2015-03-13 14:32:48 +00:00
|
|
|
end
|
2015-03-13 22:27:29 +00:00
|
|
|
|
2015-03-13 14:32:48 +00:00
|
|
|
definition eq_of_iso_functor_iso_of_eq (p : F = G) : eq_of_iso_functor (iso_of_eq p) = p :=
|
|
|
|
begin
|
2015-03-13 22:27:29 +00:00
|
|
|
apply functor_eq2,
|
|
|
|
intro c,
|
|
|
|
esimp {eq_of_iso_functor},
|
|
|
|
rewrite ap010_functor_eq,
|
|
|
|
esimp {eq_of_iso_functor_ob},
|
|
|
|
rewrite componentwise_iso_iso_of_eq,
|
|
|
|
rewrite (sect iso_of_eq)
|
2015-03-13 14:32:48 +00:00
|
|
|
end
|
|
|
|
|
2015-03-13 22:27:29 +00:00
|
|
|
definition is_univalent_functor (D : Category) (C : Precategory) : is_univalent (D ^c C) :=
|
2015-03-13 14:32:48 +00:00
|
|
|
λF G, adjointify _ eq_of_iso_functor
|
|
|
|
iso_of_eq_eq_of_iso_functor
|
|
|
|
eq_of_iso_functor_iso_of_eq
|
|
|
|
|
|
|
|
end functor
|
|
|
|
|
2015-03-13 22:27:29 +00:00
|
|
|
definition Category_functor_of_precategory (D : Category) (C : Precategory) : Category :=
|
|
|
|
category.MK (D ^c C) (is_univalent_functor D C)
|
2015-03-13 14:32:48 +00:00
|
|
|
|
2015-03-13 22:27:29 +00:00
|
|
|
definition Category_functor (D : Category) (C : Category) : Category :=
|
|
|
|
Category_functor_of_precategory D C
|
|
|
|
|
|
|
|
namespace ops
|
|
|
|
infixr `^c2`:35 := Category_functor
|
|
|
|
end ops
|
2015-03-13 14:32:48 +00:00
|
|
|
|
2015-02-26 18:19:54 +00:00
|
|
|
end category
|