2015-02-21 00:30:32 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Authors: Jeremy Avigad, Floris van Doorn
|
|
|
|
|
2015-04-25 03:04:24 +00:00
|
|
|
Definition of is_trunc (n-truncatedness)
|
2015-02-23 20:33:35 +00:00
|
|
|
|
2015-04-25 03:04:24 +00:00
|
|
|
Ported from Coq HoTT.
|
2015-02-21 00:30:32 +00:00
|
|
|
-/
|
|
|
|
|
2015-04-25 03:04:24 +00:00
|
|
|
--TODO: can we replace some definitions with a hprop as codomain by theorems?
|
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
prelude
|
2015-12-08 17:57:55 +00:00
|
|
|
import .nat .logic .equiv .pathover
|
2014-12-12 18:17:50 +00:00
|
|
|
open eq nat sigma unit
|
2015-12-08 17:57:55 +00:00
|
|
|
set_option class.force_new true
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
namespace is_trunc
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-23 20:33:35 +00:00
|
|
|
/- Truncation levels -/
|
|
|
|
|
2015-05-05 22:05:07 +00:00
|
|
|
inductive trunc_index : Type₀ :=
|
2015-02-26 01:00:10 +00:00
|
|
|
| minus_two : trunc_index
|
|
|
|
| succ : trunc_index → trunc_index
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-12-08 17:57:55 +00:00
|
|
|
open trunc_index
|
|
|
|
|
|
|
|
definition has_zero_trunc_index [instance] [reducible] : has_zero trunc_index :=
|
|
|
|
has_zero.mk (succ (succ minus_two))
|
|
|
|
|
2015-12-09 05:02:05 +00:00
|
|
|
definition has_one_trunc_index [instance] [reducible] : has_one trunc_index :=
|
|
|
|
has_one.mk (succ (succ (succ minus_two)))
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
/-
|
|
|
|
notation for trunc_index is -2, -1, 0, 1, ...
|
|
|
|
from 0 and up this comes from a coercion from num to trunc_index (via nat)
|
|
|
|
-/
|
2015-12-08 17:57:55 +00:00
|
|
|
notation `-1` := trunc_index.succ trunc_index.minus_two -- ISSUE: -1 gets printed as -2.+1?
|
|
|
|
notation `-2` := trunc_index.minus_two
|
2015-10-01 19:52:28 +00:00
|
|
|
postfix ` .+1`:(max+1) := trunc_index.succ
|
|
|
|
postfix ` .+2`:(max+1) := λn, (n .+1 .+1)
|
2015-10-16 19:15:44 +00:00
|
|
|
notation `ℕ₋₂` := trunc_index
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
namespace trunc_index
|
|
|
|
definition add (n m : trunc_index) : trunc_index :=
|
|
|
|
trunc_index.rec_on m n (λ k l, l .+1)
|
|
|
|
|
2015-05-05 22:05:07 +00:00
|
|
|
definition leq (n m : trunc_index) : Type₀ :=
|
2014-12-12 04:14:53 +00:00
|
|
|
trunc_index.rec_on n (λm, unit) (λ n p m, trunc_index.rec_on m (λ p, empty) (λ m q p, p m) p) m
|
2015-12-09 05:02:05 +00:00
|
|
|
|
|
|
|
definition has_le_trunc_index [instance] [reducible] : has_le trunc_index :=
|
|
|
|
has_le.mk leq
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
end trunc_index
|
|
|
|
|
|
|
|
infix `+2+`:65 := trunc_index.add
|
|
|
|
|
|
|
|
namespace trunc_index
|
2015-12-09 05:02:05 +00:00
|
|
|
definition succ_le_succ {n m : trunc_index} (H : n ≤ m) : n.+1 ≤ m.+1 := proof H qed
|
|
|
|
definition le_of_succ_le_succ {n m : trunc_index} (H : n.+1 ≤ m.+1) : n ≤ m := proof H qed
|
2014-12-12 04:14:53 +00:00
|
|
|
definition minus_two_le (n : trunc_index) : -2 ≤ n := star
|
2015-11-13 22:17:02 +00:00
|
|
|
definition le.refl (n : trunc_index) : n ≤ n := by induction n with n IH; exact star; exact IH
|
2015-02-21 00:30:32 +00:00
|
|
|
definition empty_of_succ_le_minus_two {n : trunc_index} (H : n .+1 ≤ -2) : empty := H
|
2014-12-12 04:14:53 +00:00
|
|
|
end trunc_index
|
2015-02-24 22:09:20 +00:00
|
|
|
definition trunc_index.of_nat [coercion] [reducible] (n : nat) : trunc_index :=
|
2015-06-04 01:41:21 +00:00
|
|
|
(nat.rec_on n -2 (λ n k, k.+1)).+2
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-06-04 05:12:05 +00:00
|
|
|
definition sub_two [reducible] (n : nat) : trunc_index :=
|
|
|
|
nat.rec_on n -2 (λ n k, k.+1)
|
|
|
|
|
2015-10-01 19:52:28 +00:00
|
|
|
postfix ` .-2`:(max+1) := sub_two
|
2015-06-04 05:12:05 +00:00
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
/- truncated types -/
|
|
|
|
|
|
|
|
/-
|
|
|
|
Just as in Coq HoTT we define an internal version of contractibility and is_trunc, but we only
|
|
|
|
use `is_trunc` and `is_contr`
|
|
|
|
-/
|
|
|
|
|
|
|
|
structure contr_internal (A : Type) :=
|
2015-04-28 21:31:26 +00:00
|
|
|
(center : A)
|
|
|
|
(center_eq : Π(a : A), center = a)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
definition is_trunc_internal (n : trunc_index) : Type → Type :=
|
2015-02-21 00:30:32 +00:00
|
|
|
trunc_index.rec_on n
|
|
|
|
(λA, contr_internal A)
|
2014-12-12 18:17:50 +00:00
|
|
|
(λn trunc_n A, (Π(x y : A), trunc_n (x = y)))
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-14 02:01:48 +00:00
|
|
|
end is_trunc open is_trunc
|
2015-02-21 00:30:32 +00:00
|
|
|
structure is_trunc [class] (n : trunc_index) (A : Type) :=
|
|
|
|
(to_internal : is_trunc_internal n A)
|
|
|
|
open nat num is_trunc.trunc_index
|
|
|
|
namespace is_trunc
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
abbreviation is_contr := is_trunc -2
|
|
|
|
abbreviation is_hprop := is_trunc -1
|
2015-02-23 20:33:35 +00:00
|
|
|
abbreviation is_hset := is_trunc 0
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
variables {A B : Type}
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition is_trunc_succ_intro (A : Type) (n : trunc_index) [H : ∀x y : A, is_trunc n (x = y)]
|
2014-12-12 04:14:53 +00:00
|
|
|
: is_trunc n.+1 A :=
|
|
|
|
is_trunc.mk (λ x y, !is_trunc.to_internal)
|
|
|
|
|
2015-04-25 03:04:24 +00:00
|
|
|
definition is_trunc_eq [instance] [priority 1200]
|
|
|
|
(n : trunc_index) [H : is_trunc (n.+1) A] (x y : A) : is_trunc n (x = y) :=
|
2015-05-29 18:50:19 +00:00
|
|
|
is_trunc.mk (is_trunc.to_internal (n.+1) A x y)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-12-09 05:02:05 +00:00
|
|
|
definition is_trunc_eq_zero [instance] [priority 1250] [H : is_trunc 1 A] (x y : A)
|
|
|
|
: is_hset (x = y) :=
|
|
|
|
@is_trunc_eq A 0 H x y
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
/- contractibility -/
|
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition is_contr.mk (center : A) (center_eq : Π(a : A), center = a) : is_contr A :=
|
|
|
|
is_trunc.mk (contr_internal.mk center center_eq)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
definition center (A : Type) [H : is_contr A] : A :=
|
2015-05-29 18:50:19 +00:00
|
|
|
contr_internal.center (is_trunc.to_internal -2 A)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-28 21:31:26 +00:00
|
|
|
definition center_eq [H : is_contr A] (a : A) : !center = a :=
|
2015-06-27 00:09:50 +00:00
|
|
|
contr_internal.center_eq (is_trunc.to_internal -2 A) a
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-24 22:51:16 +00:00
|
|
|
definition eq_of_is_contr [H : is_contr A] (x y : A) : x = y :=
|
2015-04-28 21:31:26 +00:00
|
|
|
(center_eq x)⁻¹ ⬝ (center_eq y)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-03-13 22:27:29 +00:00
|
|
|
definition hprop_eq_of_is_contr {A : Type} [H : is_contr A] {x y : A} (p q : x = y) : p = q :=
|
2015-04-24 22:51:16 +00:00
|
|
|
have K : ∀ (r : x = y), eq_of_is_contr x y = r, from (λ r, eq.rec_on r !con.left_inv),
|
2015-02-28 00:02:18 +00:00
|
|
|
(K p)⁻¹ ⬝ K q
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
theorem is_contr_eq {A : Type} [H : is_contr A] (x y : A) : is_contr (x = y) :=
|
2015-04-24 22:51:16 +00:00
|
|
|
is_contr.mk !eq_of_is_contr (λ p, !hprop_eq_of_is_contr)
|
2015-02-28 06:16:20 +00:00
|
|
|
local attribute is_contr_eq [instance]
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
/- truncation is upward close -/
|
|
|
|
|
|
|
|
-- n-types are also (n+1)-types
|
2015-05-29 18:50:19 +00:00
|
|
|
theorem is_trunc_succ [instance] [priority 900] (A : Type) (n : trunc_index)
|
2015-02-28 06:16:20 +00:00
|
|
|
[H : is_trunc n A] : is_trunc (n.+1) A :=
|
2014-12-12 04:14:53 +00:00
|
|
|
trunc_index.rec_on n
|
2015-02-21 00:30:32 +00:00
|
|
|
(λ A (H : is_contr A), !is_trunc_succ_intro)
|
2015-04-25 03:04:24 +00:00
|
|
|
(λ n IH A (H : is_trunc (n.+1) A), @is_trunc_succ_intro _ _ (λ x y, IH _ _))
|
2014-12-12 04:14:53 +00:00
|
|
|
A H
|
|
|
|
--in the proof the type of H is given explicitly to make it available for class inference
|
|
|
|
|
2015-12-09 05:02:05 +00:00
|
|
|
theorem is_trunc_succ_zero [instance] [priority 950] (A : Type) [H : is_hset A] : is_trunc 1 A :=
|
|
|
|
!is_trunc_succ
|
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
theorem is_trunc_of_leq.{l} (A : Type.{l}) {n m : trunc_index} (Hnm : n ≤ m)
|
2014-12-12 04:14:53 +00:00
|
|
|
[Hn : is_trunc n A] : is_trunc m A :=
|
|
|
|
have base : ∀k A, k ≤ -2 → is_trunc k A → (is_trunc -2 A), from
|
|
|
|
λ k A, trunc_index.cases_on k
|
|
|
|
(λh1 h2, h2)
|
2015-05-05 21:25:35 +00:00
|
|
|
(λk h1 h2, empty.elim (trunc_index.empty_of_succ_le_minus_two h1)),
|
2014-12-12 04:14:53 +00:00
|
|
|
have step : Π (m : trunc_index)
|
|
|
|
(IHm : Π (n : trunc_index) (A : Type), n ≤ m → is_trunc n A → is_trunc m A)
|
|
|
|
(n : trunc_index) (A : Type)
|
|
|
|
(Hnm : n ≤ m .+1) (Hn : is_trunc n A), is_trunc m .+1 A, from
|
|
|
|
λm IHm n, trunc_index.rec_on n
|
2015-02-21 00:30:32 +00:00
|
|
|
(λA Hnm Hn, @is_trunc_succ A m (IHm -2 A star Hn))
|
2014-12-12 04:14:53 +00:00
|
|
|
(λn IHn A Hnm (Hn : is_trunc n.+1 A),
|
2015-04-25 03:04:24 +00:00
|
|
|
@is_trunc_succ_intro A m (λx y, IHm n (x = y) (trunc_index.le_of_succ_le_succ Hnm) _)),
|
2014-12-12 04:14:53 +00:00
|
|
|
trunc_index.rec_on m base step n A Hnm Hn
|
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
definition is_trunc_of_imp_is_trunc {n : trunc_index} (H : A → is_trunc (n.+1) A)
|
|
|
|
: is_trunc (n.+1) A :=
|
|
|
|
@is_trunc_succ_intro _ _ (λx y, @is_trunc_eq _ _ (H x) x y)
|
|
|
|
|
|
|
|
definition is_trunc_of_imp_is_trunc_of_leq {n : trunc_index} (Hn : -1 ≤ n) (H : A → is_trunc n A)
|
|
|
|
: is_trunc n A :=
|
|
|
|
trunc_index.rec_on n (λHn H, empty.rec _ Hn)
|
|
|
|
(λn IH Hn, is_trunc_of_imp_is_trunc)
|
|
|
|
Hn H
|
|
|
|
|
2015-11-02 17:28:22 +00:00
|
|
|
-- these must be definitions, because we need them to compute sometimes
|
|
|
|
definition is_trunc_of_is_contr (A : Type) (n : trunc_index) [H : is_contr A] : is_trunc n A :=
|
2015-12-08 17:57:55 +00:00
|
|
|
trunc_index.rec_on n H (λn H, _)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-11-02 17:28:22 +00:00
|
|
|
definition is_trunc_succ_of_is_hprop (A : Type) (n : trunc_index) [H : is_hprop A]
|
2014-12-12 04:14:53 +00:00
|
|
|
: is_trunc (n.+1) A :=
|
2015-06-10 21:08:46 +00:00
|
|
|
is_trunc_of_leq A (show -1 ≤ n.+1, from star)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-11-02 17:28:22 +00:00
|
|
|
definition is_trunc_succ_succ_of_is_hset (A : Type) (n : trunc_index) [H : is_hset A]
|
2014-12-12 04:14:53 +00:00
|
|
|
: is_trunc (n.+2) A :=
|
2015-12-08 17:57:55 +00:00
|
|
|
@(is_trunc_of_leq A (show 0 ≤ n.+2, from proof star qed)) H
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
/- hprops -/
|
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
definition is_hprop.elim [H : is_hprop A] (x y : A) : x = y :=
|
2015-04-25 03:04:24 +00:00
|
|
|
!center
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition is_contr_of_inhabited_hprop {A : Type} [H : is_hprop A] (x : A) : is_contr A :=
|
2014-12-12 04:14:53 +00:00
|
|
|
is_contr.mk x (λy, !is_hprop.elim)
|
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
theorem is_hprop_of_imp_is_contr {A : Type} (H : A → is_contr A) : is_hprop A :=
|
2015-02-21 00:30:32 +00:00
|
|
|
@is_trunc_succ_intro A -2
|
2014-12-12 04:14:53 +00:00
|
|
|
(λx y,
|
|
|
|
have H2 [visible] : is_contr A, from H x,
|
2015-02-21 00:30:32 +00:00
|
|
|
!is_contr_eq)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
theorem is_hprop.mk {A : Type} (H : ∀x y : A, x = y) : is_hprop A :=
|
2015-02-21 00:30:32 +00:00
|
|
|
is_hprop_of_imp_is_contr (λ x, is_contr.mk x (H x))
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
theorem is_hprop_elim_self {A : Type} {H : is_hprop A} (x : A) : is_hprop.elim x x = idp :=
|
|
|
|
!is_hprop.elim
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
/- hsets -/
|
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
theorem is_hset.mk (A : Type) (H : ∀(x y : A) (p q : x = y), p = q) : is_hset A :=
|
2015-02-21 00:30:32 +00:00
|
|
|
@is_trunc_succ_intro _ _ (λ x y, is_hprop.mk (H x y))
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
definition is_hset.elim [H : is_hset A] ⦃x y : A⦄ (p q : x = y) : p = q :=
|
2015-04-25 03:04:24 +00:00
|
|
|
!is_hprop.elim
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
/- instances -/
|
|
|
|
|
2015-04-27 21:29:56 +00:00
|
|
|
definition is_contr_sigma_eq [instance] [priority 800] {A : Type} (a : A)
|
|
|
|
: is_contr (Σ(x : A), a = x) :=
|
2014-12-20 02:46:06 +00:00
|
|
|
is_contr.mk (sigma.mk a idp) (λp, sigma.rec_on p (λ b q, eq.rec_on q idp))
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-09-26 22:01:33 +00:00
|
|
|
definition is_contr_sigma_eq' [instance] [priority 800] {A : Type} (a : A)
|
|
|
|
: is_contr (Σ(x : A), x = a) :=
|
|
|
|
is_contr.mk (sigma.mk a idp) (λp, sigma.rec_on p (λ b q, eq.rec_on q idp))
|
|
|
|
|
2015-08-06 20:37:52 +00:00
|
|
|
definition is_contr_unit : is_contr unit :=
|
2014-12-12 04:14:53 +00:00
|
|
|
is_contr.mk star (λp, unit.rec_on p idp)
|
|
|
|
|
2015-08-06 20:37:52 +00:00
|
|
|
definition is_hprop_empty : is_hprop empty :=
|
2014-12-12 04:14:53 +00:00
|
|
|
is_hprop.mk (λx, !empty.elim x)
|
|
|
|
|
2015-08-06 20:37:52 +00:00
|
|
|
local attribute is_contr_unit is_hprop_empty [instance]
|
|
|
|
|
|
|
|
definition is_trunc_unit [instance] (n : trunc_index) : is_trunc n unit :=
|
|
|
|
!is_trunc_of_is_contr
|
|
|
|
|
|
|
|
definition is_trunc_empty [instance] (n : trunc_index) : is_trunc (n.+1) empty :=
|
|
|
|
!is_trunc_succ_of_is_hprop
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
/- interaction with equivalences -/
|
|
|
|
|
|
|
|
section
|
|
|
|
open is_equiv equiv
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
--should we remove the following two theorems as they are special cases of
|
|
|
|
--"is_trunc_is_equiv_closed"
|
2015-03-13 22:27:29 +00:00
|
|
|
definition is_contr_is_equiv_closed (f : A → B) [Hf : is_equiv f] [HA: is_contr A]
|
|
|
|
: (is_contr B) :=
|
2015-04-28 21:31:26 +00:00
|
|
|
is_contr.mk (f (center A)) (λp, eq_of_eq_inv !center_eq)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
definition is_contr_equiv_closed (H : A ≃ B) [HA: is_contr A] : is_contr B :=
|
|
|
|
is_contr_is_equiv_closed (to_fun H)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition equiv_of_is_contr_of_is_contr [HA : is_contr A] [HB : is_contr B] : A ≃ B :=
|
2014-12-12 04:14:53 +00:00
|
|
|
equiv.mk
|
|
|
|
(λa, center B)
|
2015-04-28 21:31:26 +00:00
|
|
|
(is_equiv.adjointify (λa, center B) (λb, center A) center_eq center_eq)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
theorem is_trunc_is_equiv_closed (n : trunc_index) (f : A → B) [H : is_equiv f]
|
2015-02-21 00:30:32 +00:00
|
|
|
[HA : is_trunc n A] : is_trunc n B :=
|
2014-12-12 04:14:53 +00:00
|
|
|
trunc_index.rec_on n
|
2015-05-18 22:45:23 +00:00
|
|
|
(λA (HA : is_contr A) B f (H : is_equiv f), is_contr_is_equiv_closed f)
|
2015-02-21 00:30:32 +00:00
|
|
|
(λn IH A (HA : is_trunc n.+1 A) B f (H : is_equiv f), @is_trunc_succ_intro _ _ (λ x y : B,
|
2015-04-25 03:04:24 +00:00
|
|
|
IH (f⁻¹ x = f⁻¹ y) _ (x = y) (ap f⁻¹)⁻¹ !is_equiv_inv))
|
2014-12-12 04:14:53 +00:00
|
|
|
A HA B f H
|
|
|
|
|
2015-04-29 00:48:39 +00:00
|
|
|
definition is_trunc_is_equiv_closed_rev (n : trunc_index) (f : A → B) [H : is_equiv f]
|
|
|
|
[HA : is_trunc n B] : is_trunc n A :=
|
|
|
|
is_trunc_is_equiv_closed n f⁻¹
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
definition is_trunc_equiv_closed (n : trunc_index) (f : A ≃ B) [HA : is_trunc n A]
|
|
|
|
: is_trunc n B :=
|
|
|
|
is_trunc_is_equiv_closed n (to_fun f)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-29 00:48:39 +00:00
|
|
|
definition is_trunc_equiv_closed_rev (n : trunc_index) (f : A ≃ B) [HA : is_trunc n B]
|
|
|
|
: is_trunc n A :=
|
|
|
|
is_trunc_is_equiv_closed n (to_inv f)
|
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
definition is_equiv_of_is_hprop [constructor] [HA : is_hprop A] [HB : is_hprop B]
|
|
|
|
(f : A → B) (g : B → A) : is_equiv f :=
|
2015-04-24 22:51:16 +00:00
|
|
|
is_equiv.mk f g (λb, !is_hprop.elim) (λa, !is_hprop.elim) (λa, !is_hset.elim)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-29 18:50:19 +00:00
|
|
|
definition equiv_of_is_hprop [constructor] [HA : is_hprop A] [HB : is_hprop B]
|
|
|
|
(f : A → B) (g : B → A) : A ≃ B :=
|
2015-02-21 00:30:32 +00:00
|
|
|
equiv.mk f (is_equiv_of_is_hprop f g)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-07-07 23:37:06 +00:00
|
|
|
definition equiv_of_iff_of_is_hprop [unfold 5] [HA : is_hprop A] [HB : is_hprop B] (H : A ↔ B) : A ≃ B :=
|
2015-02-21 00:30:32 +00:00
|
|
|
equiv_of_is_hprop (iff.elim_left H) (iff.elim_right H)
|
2015-01-02 23:46:04 +00:00
|
|
|
|
2015-09-02 23:41:19 +00:00
|
|
|
/- truncatedness of lift -/
|
|
|
|
definition is_trunc_lift [instance] [priority 1450] (A : Type) (n : trunc_index)
|
|
|
|
[H : is_trunc n A] : is_trunc n (lift A) :=
|
|
|
|
is_trunc_equiv_closed _ !equiv_lift
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
/- interaction with the Unit type -/
|
|
|
|
|
2015-04-22 01:56:28 +00:00
|
|
|
open equiv
|
2014-12-12 04:14:53 +00:00
|
|
|
-- A contractible type is equivalent to [Unit]. *)
|
2015-11-18 23:08:38 +00:00
|
|
|
variable (A)
|
2015-02-21 00:30:32 +00:00
|
|
|
definition equiv_unit_of_is_contr [H : is_contr A] : A ≃ unit :=
|
2015-04-24 22:51:16 +00:00
|
|
|
equiv.MK (λ (x : A), ⋆)
|
|
|
|
(λ (u : unit), center A)
|
|
|
|
(λ (u : unit), unit.rec_on u idp)
|
2015-04-28 21:31:26 +00:00
|
|
|
(λ (x : A), center_eq x)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-05-22 08:35:38 +00:00
|
|
|
/- interaction with pathovers -/
|
2015-11-18 23:08:38 +00:00
|
|
|
variable {A}
|
2015-05-22 08:35:38 +00:00
|
|
|
variables {C : A → Type}
|
|
|
|
{a a₂ : A} (p : a = a₂)
|
|
|
|
(c : C a) (c₂ : C a₂)
|
|
|
|
|
|
|
|
definition is_hprop.elimo [H : is_hprop (C a)] : c =[p] c₂ :=
|
|
|
|
pathover_of_eq_tr !is_hprop.elim
|
|
|
|
|
|
|
|
definition is_trunc_pathover [instance]
|
|
|
|
(n : trunc_index) [H : is_trunc (n.+1) (C a)] : is_trunc n (c =[p] c₂) :=
|
|
|
|
is_trunc_equiv_closed_rev n !pathover_equiv_eq_tr
|
|
|
|
|
|
|
|
variables {p c c₂}
|
|
|
|
theorem is_hset.elimo (q q' : c =[p] c₂) [H : is_hset (C a)] : q = q' :=
|
|
|
|
!is_hprop.elim
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
-- TODO: port "Truncated morphisms"
|
|
|
|
|
2015-09-02 23:41:19 +00:00
|
|
|
/- truncated universe -/
|
2015-08-07 17:23:00 +00:00
|
|
|
|
2015-09-02 23:41:19 +00:00
|
|
|
-- TODO: move to root namespace?
|
|
|
|
structure trunctype (n : trunc_index) :=
|
|
|
|
(carrier : Type) (struct : is_trunc n carrier)
|
|
|
|
attribute trunctype.carrier [coercion]
|
2015-10-02 23:54:27 +00:00
|
|
|
attribute trunctype.struct [instance] [priority 1400]
|
2015-09-02 23:41:19 +00:00
|
|
|
|
|
|
|
notation n `-Type` := trunctype n
|
|
|
|
abbreviation hprop := -1-Type
|
|
|
|
abbreviation hset := 0-Type
|
|
|
|
|
|
|
|
protected abbreviation hprop.mk := @trunctype.mk -1
|
|
|
|
protected abbreviation hset.mk := @trunctype.mk (-1.+1)
|
|
|
|
|
2015-10-09 20:21:03 +00:00
|
|
|
protected abbreviation trunctype.mk' [parsing_only] (n : trunc_index) (A : Type)
|
2015-09-02 23:41:19 +00:00
|
|
|
[H : is_trunc n A] : n-Type :=
|
|
|
|
trunctype.mk A H
|
|
|
|
|
|
|
|
definition tlift.{u v} [constructor] {n : trunc_index} (A : trunctype.{u} n)
|
|
|
|
: trunctype.{max u v} n :=
|
|
|
|
trunctype.mk (lift A) (is_trunc_lift _ _)
|
|
|
|
|
|
|
|
end is_trunc
|