2015-04-10 01:45:18 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2015 Floris van Doorn. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Authors: Floris van Doorn
|
|
|
|
|
|
|
|
Declaration of set-quotients
|
|
|
|
-/
|
|
|
|
|
2015-04-11 00:33:33 +00:00
|
|
|
import .type_quotient .trunc
|
2015-04-10 01:45:18 +00:00
|
|
|
|
2015-05-22 08:35:38 +00:00
|
|
|
open eq is_trunc trunc type_quotient equiv
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
namespace quotient
|
2015-04-23 22:27:56 +00:00
|
|
|
section
|
2015-04-11 00:33:33 +00:00
|
|
|
parameters {A : Type} (R : A → A → hprop)
|
|
|
|
-- set-quotients are just truncations of type-quotients
|
|
|
|
definition quotient : Type := trunc 0 (type_quotient (λa a', trunctype.carrier (R a a')))
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
definition class_of (a : A) : quotient :=
|
2015-04-11 00:33:33 +00:00
|
|
|
tr (class_of _ a)
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
definition eq_of_rel {a a' : A} (H : R a a') : class_of a = class_of a' :=
|
2015-04-27 21:34:55 +00:00
|
|
|
ap tr (eq_of_rel _ H)
|
2015-04-10 01:45:18 +00:00
|
|
|
|
2015-04-11 00:33:33 +00:00
|
|
|
theorem is_hset_quotient : is_hset quotient :=
|
2015-04-25 00:21:08 +00:00
|
|
|
begin unfold quotient, exact _ end
|
2015-04-10 01:45:18 +00:00
|
|
|
|
2015-04-19 21:56:24 +00:00
|
|
|
protected definition rec {P : quotient → Type} [Pt : Πaa, is_hset (P aa)]
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pc : Π(a : A), P (class_of a)) (Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a =[eq_of_rel H] Pc a')
|
2015-04-10 01:45:18 +00:00
|
|
|
(x : quotient) : P x :=
|
|
|
|
begin
|
|
|
|
apply (@trunc.rec_on _ _ P x),
|
|
|
|
{ intro x', apply Pt},
|
2015-04-11 00:33:33 +00:00
|
|
|
{ intro y, fapply (type_quotient.rec_on y),
|
2015-04-10 01:45:18 +00:00
|
|
|
{ exact Pc},
|
2015-05-22 08:35:38 +00:00
|
|
|
{ intros, apply equiv.to_inv !(pathover_compose _ tr), apply Pp}}
|
2015-04-10 01:45:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
protected definition rec_on [reducible] {P : quotient → Type} (x : quotient)
|
2015-04-19 21:56:24 +00:00
|
|
|
[Pt : Πaa, is_hset (P aa)] (Pc : Π(a : A), P (class_of a))
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a =[eq_of_rel H] Pc a') : P x :=
|
2015-04-10 01:45:18 +00:00
|
|
|
rec Pc Pp x
|
|
|
|
|
2015-04-27 21:34:55 +00:00
|
|
|
theorem rec_eq_of_rel {P : quotient → Type} [Pt : Πaa, is_hset (P aa)]
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pc : Π(a : A), P (class_of a)) (Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a =[eq_of_rel H] Pc a')
|
|
|
|
{a a' : A} (H : R a a') : apdo (rec Pc Pp) (eq_of_rel H) = Pp H :=
|
|
|
|
!is_hset.elimo
|
2015-04-10 01:45:18 +00:00
|
|
|
|
2015-04-19 21:56:24 +00:00
|
|
|
protected definition elim {P : Type} [Pt : is_hset P] (Pc : A → P)
|
2015-04-10 01:45:18 +00:00
|
|
|
(Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a = Pc a') (x : quotient) : P :=
|
2015-05-22 08:35:38 +00:00
|
|
|
rec Pc (λa a' H, pathover_of_eq (Pp H)) x
|
2015-04-10 01:45:18 +00:00
|
|
|
|
2015-04-19 21:56:24 +00:00
|
|
|
protected definition elim_on [reducible] {P : Type} (x : quotient) [Pt : is_hset P]
|
2015-04-10 01:45:18 +00:00
|
|
|
(Pc : A → P) (Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a = Pc a') : P :=
|
|
|
|
elim Pc Pp x
|
|
|
|
|
2015-04-27 21:34:55 +00:00
|
|
|
theorem elim_eq_of_rel {P : Type} [Pt : is_hset P] (Pc : A → P)
|
2015-04-10 01:45:18 +00:00
|
|
|
(Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a = Pc a') {a a' : A} (H : R a a')
|
2015-04-27 21:34:55 +00:00
|
|
|
: ap (elim Pc Pp) (eq_of_rel H) = Pp H :=
|
|
|
|
begin
|
2015-05-22 08:35:38 +00:00
|
|
|
apply eq_of_fn_eq_fn_inv !(pathover_constant (eq_of_rel H)),
|
|
|
|
rewrite [▸*,-apdo_eq_pathover_of_eq_ap,↑elim,rec_eq_of_rel],
|
2015-04-27 21:34:55 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
/-
|
|
|
|
there are no theorems to eliminate to the universe here,
|
|
|
|
because the universe is generally not a set
|
|
|
|
-/
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
end quotient
|
2015-05-07 20:35:14 +00:00
|
|
|
|
|
|
|
attribute quotient.class_of [constructor]
|
2015-05-27 02:33:27 +00:00
|
|
|
attribute quotient.rec quotient.elim [unfold-c 7] [recursor 7]
|
2015-05-07 20:35:14 +00:00
|
|
|
attribute quotient.rec_on quotient.elim_on [unfold-c 4]
|