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 the coequalizer
|
|
|
|
-/
|
|
|
|
|
2015-12-25 20:11:11 +00:00
|
|
|
import .quotient_functor types.equiv
|
2015-04-10 01:45:18 +00:00
|
|
|
|
2016-03-03 15:48:27 +00:00
|
|
|
open quotient eq equiv is_trunc sigma sigma.ops
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
namespace coeq
|
2015-04-23 22:27:56 +00:00
|
|
|
section
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
universe u
|
|
|
|
parameters {A B : Type.{u}} (f g : A → B)
|
|
|
|
|
2015-04-11 00:33:33 +00:00
|
|
|
inductive coeq_rel : B → B → Type :=
|
|
|
|
| Rmk : Π(x : A), coeq_rel (f x) (g x)
|
|
|
|
open coeq_rel
|
|
|
|
local abbreviation R := coeq_rel
|
2015-04-10 01:45:18 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
definition coeq : Type := quotient coeq_rel -- TODO: define this in root namespace
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
definition coeq_i (x : B) : coeq :=
|
2015-04-11 00:33:33 +00:00
|
|
|
class_of R x
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
/- cp is the name Coq uses. I don't know what it abbreviates, but at least it's short :-) -/
|
|
|
|
definition cp (x : A) : coeq_i (f x) = coeq_i (g x) :=
|
2015-04-27 21:34:55 +00:00
|
|
|
eq_of_rel coeq_rel (Rmk f g x)
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
protected definition rec {P : coeq → Type} (P_i : Π(x : B), P (coeq_i x))
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pcp : Π(x : A), P_i (f x) =[cp x] P_i (g x)) (y : coeq) : P y :=
|
2015-04-10 01:45:18 +00:00
|
|
|
begin
|
2015-05-21 04:16:23 +00:00
|
|
|
induction y,
|
|
|
|
{ apply P_i},
|
|
|
|
{ cases H, apply Pcp}
|
2015-04-10 01:45:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
protected definition rec_on [reducible] {P : coeq → Type} (y : coeq)
|
2015-05-22 08:35:38 +00:00
|
|
|
(P_i : Π(x : B), P (coeq_i x)) (Pcp : Π(x : A), P_i (f x) =[cp x] P_i (g x)) : P y :=
|
2015-04-10 01:45:18 +00:00
|
|
|
rec P_i Pcp y
|
|
|
|
|
2015-04-27 21:34:55 +00:00
|
|
|
theorem rec_cp {P : coeq → Type} (P_i : Π(x : B), P (coeq_i x))
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pcp : Π(x : A), P_i (f x) =[cp x] P_i (g x))
|
2016-03-19 15:25:08 +00:00
|
|
|
(x : A) : apd (rec P_i Pcp) (cp x) = Pcp x :=
|
2015-04-28 01:30:20 +00:00
|
|
|
!rec_eq_of_rel
|
2015-04-19 21:56:24 +00:00
|
|
|
|
2015-04-10 01:45:18 +00:00
|
|
|
protected definition elim {P : Type} (P_i : B → P)
|
|
|
|
(Pcp : Π(x : A), P_i (f x) = P_i (g x)) (y : coeq) : P :=
|
2016-06-23 20:49:54 +00:00
|
|
|
rec P_i (λx, pathover_of_eq _ (Pcp x)) y
|
2015-04-10 01:45:18 +00:00
|
|
|
|
|
|
|
protected definition elim_on [reducible] {P : Type} (y : coeq) (P_i : B → P)
|
|
|
|
(Pcp : Π(x : A), P_i (f x) = P_i (g x)) : P :=
|
|
|
|
elim P_i Pcp y
|
|
|
|
|
2015-04-27 21:34:55 +00:00
|
|
|
theorem elim_cp {P : Type} (P_i : B → P) (Pcp : Π(x : A), P_i (f x) = P_i (g x))
|
|
|
|
(x : A) : ap (elim P_i Pcp) (cp x) = Pcp x :=
|
|
|
|
begin
|
2015-05-22 08:35:38 +00:00
|
|
|
apply eq_of_fn_eq_fn_inv !(pathover_constant (cp x)),
|
2016-03-19 15:25:08 +00:00
|
|
|
rewrite [▸*,-apd_eq_pathover_of_eq_ap,↑elim,rec_cp],
|
2015-04-27 21:34:55 +00:00
|
|
|
end
|
2015-04-10 01:45:18 +00:00
|
|
|
|
2015-04-19 21:56:24 +00:00
|
|
|
protected definition elim_type (P_i : B → Type)
|
|
|
|
(Pcp : Π(x : A), P_i (f x) ≃ P_i (g x)) (y : coeq) : Type :=
|
|
|
|
elim P_i (λx, ua (Pcp x)) y
|
|
|
|
|
|
|
|
protected definition elim_type_on [reducible] (y : coeq) (P_i : B → Type)
|
|
|
|
(Pcp : Π(x : A), P_i (f x) ≃ P_i (g x)) : Type :=
|
|
|
|
elim_type P_i Pcp y
|
|
|
|
|
2015-04-27 21:34:55 +00:00
|
|
|
theorem elim_type_cp (P_i : B → Type) (Pcp : Π(x : A), P_i (f x) ≃ P_i (g x))
|
|
|
|
(x : A) : transport (elim_type P_i Pcp) (cp x) = Pcp x :=
|
|
|
|
by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_cp];apply cast_ua_fn
|
2015-04-19 21:56:24 +00:00
|
|
|
|
2016-02-15 20:55:29 +00:00
|
|
|
protected definition rec_prop {P : coeq → Type} [H : Πx, is_prop (P x)]
|
2015-11-20 22:47:11 +00:00
|
|
|
(P_i : Π(x : B), P (coeq_i x)) (y : coeq) : P y :=
|
2016-02-15 20:18:07 +00:00
|
|
|
rec P_i (λa, !is_prop.elimo) y
|
2015-11-20 22:47:11 +00:00
|
|
|
|
2016-02-15 20:55:29 +00:00
|
|
|
protected definition elim_prop {P : Type} [H : is_prop P] (P_i : B → P) (y : coeq) : P :=
|
2016-02-15 20:18:07 +00:00
|
|
|
elim P_i (λa, !is_prop.elim) y
|
2015-11-20 22:47:11 +00:00
|
|
|
|
2015-04-10 01:45:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end coeq
|
2015-05-07 20:35:14 +00:00
|
|
|
|
|
|
|
attribute coeq.coeq_i [constructor]
|
2015-07-07 23:37:06 +00:00
|
|
|
attribute coeq.rec coeq.elim [unfold 8] [recursor 8]
|
|
|
|
attribute coeq.elim_type [unfold 7]
|
|
|
|
attribute coeq.rec_on coeq.elim_on [unfold 6]
|
|
|
|
attribute coeq.elim_type_on [unfold 5]
|
2015-12-25 20:11:11 +00:00
|
|
|
|
|
|
|
/- Flattening -/
|
|
|
|
namespace coeq
|
|
|
|
section
|
|
|
|
open function
|
|
|
|
|
|
|
|
universe u
|
|
|
|
parameters {A B : Type.{u}} (f g : A → B) (P_i : B → Type)
|
|
|
|
(Pcp : Πx : A, P_i (f x) ≃ P_i (g x))
|
|
|
|
|
|
|
|
local abbreviation P := coeq.elim_type f g P_i Pcp
|
|
|
|
|
|
|
|
local abbreviation F : sigma (P_i ∘ f) → sigma P_i :=
|
|
|
|
λz, ⟨f z.1, z.2⟩
|
|
|
|
|
|
|
|
local abbreviation G : sigma (P_i ∘ f) → sigma P_i :=
|
|
|
|
λz, ⟨g z.1, Pcp z.1 z.2⟩
|
|
|
|
|
|
|
|
local abbreviation Pr : Π⦃b b' : B⦄,
|
|
|
|
coeq_rel f g b b' → P_i b ≃ P_i b' :=
|
|
|
|
@coeq_rel.rec A B f g _ Pcp
|
|
|
|
|
|
|
|
local abbreviation P' := quotient.elim_type P_i Pr
|
|
|
|
|
|
|
|
protected definition flattening : sigma P ≃ coeq F G :=
|
|
|
|
begin
|
2016-02-29 20:11:17 +00:00
|
|
|
have H : Πz, P z ≃ P' z,
|
|
|
|
begin
|
|
|
|
intro z, apply equiv_of_eq,
|
|
|
|
have H1 : coeq.elim_type f g P_i Pcp = quotient.elim_type P_i Pr,
|
|
|
|
begin
|
|
|
|
change
|
|
|
|
quotient.rec P_i
|
2016-06-23 20:49:54 +00:00
|
|
|
(λb b' r, coeq_rel.cases_on r (λx, pathover_of_eq _ (ua (Pcp x))))
|
2016-02-29 20:11:17 +00:00
|
|
|
= quotient.rec P_i
|
2016-06-23 20:49:54 +00:00
|
|
|
(λb b' r, pathover_of_eq _ (ua (coeq_rel.cases_on r Pcp))),
|
2016-02-29 20:11:17 +00:00
|
|
|
have H2 : Π⦃b b' : B⦄ (r : coeq_rel f g b b'),
|
2016-06-23 20:49:54 +00:00
|
|
|
coeq_rel.cases_on r (λx, pathover_of_eq _ (ua (Pcp x)))
|
|
|
|
= pathover_of_eq _ (ua (coeq_rel.cases_on r Pcp))
|
2016-02-29 20:11:17 +00:00
|
|
|
:> P_i b =[eq_of_rel (coeq_rel f g) r] P_i b',
|
|
|
|
begin intros b b' r, cases r, reflexivity end,
|
|
|
|
rewrite (eq_of_homotopy3 H2)
|
|
|
|
end,
|
|
|
|
apply ap10 H1
|
|
|
|
end,
|
2016-02-15 21:05:31 +00:00
|
|
|
apply equiv.trans (sigma_equiv_sigma_right H),
|
2015-12-25 20:11:11 +00:00
|
|
|
apply equiv.trans !quotient.flattening.flattening_lemma,
|
|
|
|
fapply quotient.equiv,
|
|
|
|
{ reflexivity },
|
|
|
|
{ intros bp bp',
|
|
|
|
fapply equiv.MK,
|
|
|
|
{ intro r, induction r with b b' r p,
|
|
|
|
induction r with x, exact coeq_rel.Rmk F G ⟨x, p⟩ },
|
|
|
|
{ esimp, intro r, induction r with xp,
|
|
|
|
induction xp with x p,
|
|
|
|
exact quotient.flattening.flattening_rel.mk Pr
|
|
|
|
(coeq_rel.Rmk f g x) p },
|
|
|
|
{ esimp, intro r, induction r with xp,
|
|
|
|
induction xp with x p, reflexivity },
|
|
|
|
{ intro r, induction r with b b' r p,
|
|
|
|
induction r with x, reflexivity } }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end coeq
|