2015-04-07 01:01:08 +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
|
|
|
|
|
|
|
|
|
|
n-truncation of types.
|
|
|
|
|
|
|
|
|
|
Ported from Coq HoTT
|
|
|
|
|
-/
|
|
|
|
|
|
|
|
|
|
/- The hit n-truncation is primitive, declared in init.hit. -/
|
|
|
|
|
|
2015-05-14 02:01:48 +00:00
|
|
|
|
import types.sigma types.pointed
|
2015-04-07 01:01:08 +00:00
|
|
|
|
|
|
|
|
|
open is_trunc eq equiv is_equiv function prod sum sigma
|
|
|
|
|
|
|
|
|
|
namespace trunc
|
|
|
|
|
|
2015-05-21 03:37:43 +00:00
|
|
|
|
protected definition elim [recursor 6] {n : trunc_index} {A : Type} {P : Type}
|
2015-04-07 01:01:08 +00:00
|
|
|
|
[Pt : is_trunc n P] (H : A → P) : trunc n A → P :=
|
2015-04-23 22:27:56 +00:00
|
|
|
|
trunc.rec H
|
2015-04-07 01:01:08 +00:00
|
|
|
|
|
|
|
|
|
protected definition elim_on {n : trunc_index} {A : Type} {P : Type} (aa : trunc n A)
|
|
|
|
|
[Pt : is_trunc n P] (H : A → P) : P :=
|
2015-05-19 05:35:18 +00:00
|
|
|
|
trunc.elim H aa
|
2015-04-07 01:01:08 +00:00
|
|
|
|
|
2015-04-27 21:34:55 +00:00
|
|
|
|
/-
|
|
|
|
|
there are no theorems to eliminate to the universe here,
|
2015-09-02 23:41:19 +00:00
|
|
|
|
because the universe is not a set
|
2015-04-27 21:34:55 +00:00
|
|
|
|
-/
|
|
|
|
|
|
2015-09-22 16:01:55 +00:00
|
|
|
|
end trunc
|
|
|
|
|
|
|
|
|
|
attribute trunc.elim_on [unfold 4]
|
|
|
|
|
attribute trunc.rec [recursor]
|
|
|
|
|
attribute trunc.elim [recursor 6] [unfold 6]
|
|
|
|
|
|
|
|
|
|
namespace trunc
|
2015-04-29 00:48:39 +00:00
|
|
|
|
|
|
|
|
|
variables {X Y Z : Type} {P : X → Type} (A B : Type) (n : trunc_index)
|
|
|
|
|
|
|
|
|
|
local attribute is_trunc_eq [instance]
|
|
|
|
|
|
2015-09-22 16:01:55 +00:00
|
|
|
|
variables {A n}
|
|
|
|
|
definition untrunc_of_is_trunc [reducible] [H : is_trunc n A] : trunc n A → A :=
|
|
|
|
|
trunc.rec id
|
|
|
|
|
|
|
|
|
|
variables (A n)
|
|
|
|
|
definition is_equiv_tr [instance] [constructor] [H : is_trunc n A] : is_equiv (@tr n A) :=
|
2015-04-29 00:48:39 +00:00
|
|
|
|
adjointify _
|
2015-09-22 16:01:55 +00:00
|
|
|
|
(untrunc_of_is_trunc)
|
2015-04-29 00:48:39 +00:00
|
|
|
|
(λaa, trunc.rec_on aa (λa, idp))
|
|
|
|
|
(λa, idp)
|
|
|
|
|
|
2015-09-22 16:01:55 +00:00
|
|
|
|
definition trunc_equiv [constructor] [H : is_trunc n A] : trunc n A ≃ A :=
|
2015-08-07 17:23:00 +00:00
|
|
|
|
(equiv.mk tr _)⁻¹ᵉ
|
2015-04-29 00:48:39 +00:00
|
|
|
|
|
|
|
|
|
definition is_trunc_of_is_equiv_tr [H : is_equiv (@tr n A)] : is_trunc n A :=
|
2015-05-18 22:45:23 +00:00
|
|
|
|
is_trunc_is_equiv_closed n (@tr n _)⁻¹
|
2015-04-29 00:48:39 +00:00
|
|
|
|
|
|
|
|
|
/- Functoriality -/
|
2015-07-07 23:37:06 +00:00
|
|
|
|
definition trunc_functor [unfold 5] (f : X → Y) : trunc n X → trunc n Y :=
|
2015-04-29 00:48:39 +00:00
|
|
|
|
λxx, trunc.rec_on xx (λx, tr (f x))
|
|
|
|
|
|
|
|
|
|
definition trunc_functor_compose (f : X → Y) (g : Y → Z)
|
2015-06-17 19:58:58 +00:00
|
|
|
|
: trunc_functor n (g ∘ f) ~ trunc_functor n g ∘ trunc_functor n f :=
|
2015-04-29 00:48:39 +00:00
|
|
|
|
λxx, trunc.rec_on xx (λx, idp)
|
|
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
|
definition trunc_functor_id : trunc_functor n (@id A) ~ id :=
|
2015-04-29 00:48:39 +00:00
|
|
|
|
λxx, trunc.rec_on xx (λx, idp)
|
|
|
|
|
|
2015-09-22 16:01:55 +00:00
|
|
|
|
definition is_equiv_trunc_functor [constructor] (f : X → Y) [H : is_equiv f]
|
|
|
|
|
: is_equiv (trunc_functor n f) :=
|
2015-04-29 00:48:39 +00:00
|
|
|
|
adjointify _
|
|
|
|
|
(trunc_functor n f⁻¹)
|
|
|
|
|
(λyy, trunc.rec_on yy (λy, ap tr !right_inv))
|
|
|
|
|
(λxx, trunc.rec_on xx (λx, ap tr !left_inv))
|
|
|
|
|
|
2015-08-05 00:17:14 +00:00
|
|
|
|
definition trunc_homotopy {f g : X → Y} (p : f ~ g) : trunc_functor n f ~ trunc_functor n g :=
|
|
|
|
|
λxx, trunc.rec_on xx (λx, ap tr (p x))
|
|
|
|
|
|
2015-05-14 02:01:48 +00:00
|
|
|
|
section
|
|
|
|
|
open equiv.ops
|
2015-09-22 16:01:55 +00:00
|
|
|
|
definition trunc_equiv_trunc [constructor] (f : X ≃ Y) : trunc n X ≃ trunc n Y :=
|
2015-05-14 02:01:48 +00:00
|
|
|
|
equiv.mk _ (is_equiv_trunc_functor n f)
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-29 00:48:39 +00:00
|
|
|
|
section
|
|
|
|
|
open prod.ops
|
2015-09-22 16:01:55 +00:00
|
|
|
|
definition trunc_prod_equiv [constructor] : trunc n (X × Y) ≃ trunc n X × trunc n Y :=
|
2015-05-16 00:23:34 +00:00
|
|
|
|
begin
|
|
|
|
|
fapply equiv.MK,
|
|
|
|
|
{exact (λpp, trunc.rec_on pp (λp, (tr p.1, tr p.2)))},
|
|
|
|
|
{intro p, cases p with xx yy,
|
|
|
|
|
apply (trunc.rec_on xx), intro x,
|
|
|
|
|
apply (trunc.rec_on yy), intro y, exact (tr (x,y))},
|
|
|
|
|
{intro p, cases p with xx yy,
|
|
|
|
|
apply (trunc.rec_on xx), intro x,
|
|
|
|
|
apply (trunc.rec_on yy), intro y, apply idp},
|
|
|
|
|
{intro pp, apply (trunc.rec_on pp), intro p, cases p, apply idp}
|
|
|
|
|
end
|
2015-04-29 00:48:39 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
/- Propositional truncation -/
|
|
|
|
|
|
|
|
|
|
-- should this live in hprop?
|
2015-11-21 07:05:01 +00:00
|
|
|
|
definition merely [reducible] [constructor] (A : Type) : hprop := trunctype.mk (trunc -1 A) _
|
2015-04-29 00:48:39 +00:00
|
|
|
|
|
|
|
|
|
notation `||`:max A `||`:0 := merely A
|
|
|
|
|
notation `∥`:max A `∥`:0 := merely A
|
|
|
|
|
|
2015-11-21 07:05:01 +00:00
|
|
|
|
definition Exists [reducible] [constructor] (P : X → Type) : hprop := ∥ sigma P ∥
|
|
|
|
|
definition or [reducible] [constructor] (A B : Type) : hprop := ∥ A ⊎ B ∥
|
2015-04-29 00:48:39 +00:00
|
|
|
|
|
|
|
|
|
notation `exists` binders `,` r:(scoped P, Exists P) := r
|
|
|
|
|
notation `∃` binders `,` r:(scoped P, Exists P) := r
|
2015-09-30 23:52:34 +00:00
|
|
|
|
notation A ` \/ ` B := or A B
|
2015-04-29 00:48:39 +00:00
|
|
|
|
notation A ∨ B := or A B
|
|
|
|
|
|
2015-09-22 16:01:55 +00:00
|
|
|
|
definition merely.intro [reducible] [constructor] (a : A) : ∥ A ∥ := tr a
|
|
|
|
|
definition exists.intro [reducible] [constructor] (x : X) (p : P x) : ∃x, P x := tr ⟨x, p⟩
|
|
|
|
|
definition or.intro_left [reducible] [constructor] (x : X) : X ∨ Y := tr (inl x)
|
|
|
|
|
definition or.intro_right [reducible] [constructor] (y : Y) : X ∨ Y := tr (inr y)
|
2015-04-29 00:48:39 +00:00
|
|
|
|
|
|
|
|
|
definition is_contr_of_merely_hprop [H : is_hprop A] (aa : merely A) : is_contr A :=
|
|
|
|
|
is_contr_of_inhabited_hprop (trunc.rec_on aa id)
|
|
|
|
|
|
|
|
|
|
section
|
|
|
|
|
open sigma.ops
|
2015-09-22 16:01:55 +00:00
|
|
|
|
definition trunc_sigma_equiv [constructor] : trunc n (Σ x, P x) ≃ trunc n (Σ x, trunc n (P x)) :=
|
2015-04-29 00:48:39 +00:00
|
|
|
|
equiv.MK (λpp, trunc.rec_on pp (λp, tr ⟨p.1, tr p.2⟩))
|
|
|
|
|
(λpp, trunc.rec_on pp (λp, trunc.rec_on p.2 (λb, tr ⟨p.1, b⟩)))
|
|
|
|
|
(λpp, trunc.rec_on pp (λp, sigma.rec_on p (λa bb, trunc.rec_on bb (λb, by esimp))))
|
|
|
|
|
(λpp, trunc.rec_on pp (λp, sigma.rec_on p (λa b, by esimp)))
|
|
|
|
|
|
|
|
|
|
definition trunc_sigma_equiv_of_is_trunc [H : is_trunc n X]
|
|
|
|
|
: trunc n (Σ x, P x) ≃ Σ x, trunc n (P x) :=
|
|
|
|
|
calc
|
|
|
|
|
trunc n (Σ x, P x) ≃ trunc n (Σ x, trunc n (P x)) : trunc_sigma_equiv
|
2015-08-07 17:23:00 +00:00
|
|
|
|
... ≃ Σ x, trunc n (P x) : !trunc_equiv
|
2015-04-29 00:48:39 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-22 16:01:55 +00:00
|
|
|
|
/- the (non-dependent) universal property -/
|
|
|
|
|
definition trunc_arrow_equiv [constructor] [H : is_trunc n B] :
|
|
|
|
|
(trunc n A → B) ≃ (A → B) :=
|
|
|
|
|
begin
|
|
|
|
|
fapply equiv.MK,
|
|
|
|
|
{ intro g a, exact g (tr a)},
|
|
|
|
|
{ intro f x, exact trunc.rec_on x f},
|
|
|
|
|
{ intro f, apply eq_of_homotopy, intro a, reflexivity},
|
|
|
|
|
{ intro g, apply eq_of_homotopy, intro x, exact trunc.rec_on x (λa, idp)},
|
|
|
|
|
end
|
2015-05-07 20:35:14 +00:00
|
|
|
|
|
2015-09-22 16:01:55 +00:00
|
|
|
|
end trunc
|