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
|
|
|
|
-/
|
|
|
|
|
|
2014-12-12 18:17:50 +00:00
|
|
|
|
prelude
|
2015-12-08 17:57:55 +00:00
|
|
|
|
import .nat .logic .equiv .pathover
|
2016-02-15 19:40:25 +00:00
|
|
|
|
open eq nat sigma unit sigma.ops
|
2015-12-09 22:20:52 +00:00
|
|
|
|
--set_option class.force_new true
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
/- Truncation levels -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
inductive trunc_index : Type₀ :=
|
|
|
|
|
| minus_two : trunc_index
|
|
|
|
|
| succ : trunc_index → trunc_index
|
2015-02-23 20:33:35 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
open trunc_index
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
/-
|
|
|
|
|
notation for trunc_index is -2, -1, 0, 1, ...
|
2016-03-08 05:16:45 +00:00
|
|
|
|
from 0 and up this comes from the way numerals are parsed in Lean.
|
|
|
|
|
Any structure with a 0, a 1, and a + have numerals defined in them.
|
2016-03-02 22:19:44 +00:00
|
|
|
|
-/
|
|
|
|
|
|
|
|
|
|
notation `ℕ₋₂` := trunc_index -- input using \N-2
|
|
|
|
|
|
|
|
|
|
definition has_zero_trunc_index [instance] [priority 2000] : has_zero ℕ₋₂ :=
|
|
|
|
|
has_zero.mk (succ (succ minus_two))
|
|
|
|
|
|
|
|
|
|
definition has_one_trunc_index [instance] [priority 2000] : has_one ℕ₋₂ :=
|
|
|
|
|
has_one.mk (succ (succ (succ minus_two)))
|
|
|
|
|
|
|
|
|
|
namespace trunc_index
|
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
|
2016-02-26 22:00:28 +00:00
|
|
|
|
postfix `.+1`:(max+1) := trunc_index.succ
|
|
|
|
|
postfix `.+2`:(max+1) := λn, (n .+1 .+1)
|
2016-02-25 00:43:50 +00:00
|
|
|
|
|
2015-12-10 19:37:11 +00:00
|
|
|
|
--addition, where we add two to the result
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition add_plus_two [reducible] (n m : ℕ₋₂) : ℕ₋₂ :=
|
2014-12-12 04:14:53 +00:00
|
|
|
|
trunc_index.rec_on m n (λ k l, l .+1)
|
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
infix ` +2+ `:65 := trunc_index.add_plus_two
|
|
|
|
|
|
2015-12-10 19:37:11 +00:00
|
|
|
|
-- addition of trunc_indices, where results smaller than -2 are changed to -2
|
2016-02-25 00:43:50 +00:00
|
|
|
|
protected definition add (n m : ℕ₋₂) : ℕ₋₂ :=
|
2015-12-10 19:37:11 +00:00
|
|
|
|
trunc_index.cases_on m
|
|
|
|
|
(trunc_index.cases_on n -2 (λn', (trunc_index.cases_on n' -2 id)))
|
|
|
|
|
(λm', trunc_index.cases_on m'
|
|
|
|
|
(trunc_index.cases_on n -2 id)
|
2016-02-26 22:00:28 +00:00
|
|
|
|
(add_plus_two n))
|
2015-12-10 19:37:11 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
/- we give a weird name to the reflexivity step to avoid overloading le.refl
|
|
|
|
|
(which can be used if types.trunc is imported) -/
|
|
|
|
|
inductive le (a : ℕ₋₂) : ℕ₋₂ → Type :=
|
|
|
|
|
| tr_refl : le a a
|
|
|
|
|
| step : Π {b}, le a b → le a (b.+1)
|
2015-12-09 05:02:05 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
end trunc_index
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
definition has_le_trunc_index [instance] [priority 2000] : has_le ℕ₋₂ :=
|
|
|
|
|
has_le.mk trunc_index.le
|
2016-02-25 00:43:50 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
attribute trunc_index.add [reducible]
|
|
|
|
|
|
|
|
|
|
definition has_add_trunc_index [instance] [priority 2000] : has_add ℕ₋₂ :=
|
|
|
|
|
has_add.mk trunc_index.add
|
|
|
|
|
|
|
|
|
|
namespace trunc_index
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition sub_two [reducible] (n : ℕ) : ℕ₋₂ :=
|
2015-06-04 05:12:05 +00:00
|
|
|
|
nat.rec_on n -2 (λ n k, k.+1)
|
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition add_two [reducible] (n : ℕ₋₂) : ℕ :=
|
|
|
|
|
trunc_index.rec_on n nat.zero (λ n k, nat.succ k)
|
|
|
|
|
|
2016-02-26 22:00:28 +00:00
|
|
|
|
postfix `.-2`:(max+1) := sub_two
|
|
|
|
|
postfix `.-1`:(max+1) := λn, (n .-2 .+1)
|
2015-06-04 05:12:05 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
definition of_nat [coercion] [reducible] (n : ℕ) : ℕ₋₂ :=
|
2016-02-25 00:43:50 +00:00
|
|
|
|
n.-2.+2
|
|
|
|
|
|
|
|
|
|
definition succ_le_succ {n m : ℕ₋₂} (H : n ≤ m) : n.+1 ≤ m.+1 :=
|
|
|
|
|
by induction H with m H IH; apply le.tr_refl; exact le.step IH
|
|
|
|
|
|
|
|
|
|
definition minus_two_le (n : ℕ₋₂) : -2 ≤ n :=
|
|
|
|
|
by induction n with n IH; apply le.tr_refl; exact le.step IH
|
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
end trunc_index open trunc_index
|
|
|
|
|
|
|
|
|
|
namespace is_trunc
|
|
|
|
|
|
|
|
|
|
export [notation] [coercion] trunc_index
|
2016-02-25 00:43:50 +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
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_internal (n : ℕ₋₂) : 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
|
2016-02-15 19:40:25 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
structure is_trunc [class] (n : ℕ₋₂) (A : Type) :=
|
2015-02-21 00:30:32 +00:00
|
|
|
|
(to_internal : is_trunc_internal n A)
|
2016-02-15 19:40:25 +00:00
|
|
|
|
|
2016-03-02 22:19:44 +00:00
|
|
|
|
open nat num trunc_index
|
2016-02-15 19:40:25 +00:00
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
|
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
|
2016-02-15 20:18:07 +00:00
|
|
|
|
abbreviation is_prop := is_trunc -1
|
|
|
|
|
abbreviation is_set := is_trunc 0
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
|
|
variables {A B : Type}
|
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_succ_intro (A : Type) (n : ℕ₋₂) [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]
|
2016-02-25 00:43:50 +00:00
|
|
|
|
(n : ℕ₋₂) [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
|
|
|
|
|
|
|
|
|
/- 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
|
|
|
|
|
2016-02-15 20:55:29 +00:00
|
|
|
|
definition prop_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) :=
|
2016-02-15 20:55:29 +00:00
|
|
|
|
is_contr.mk !eq_of_is_contr (λ p, !prop_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
|
2016-02-25 00:43:50 +00:00
|
|
|
|
theorem is_trunc_succ [instance] [priority 900] (A : Type) (n : ℕ₋₂)
|
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
|
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
theorem is_trunc_of_le.{l} (A : Type.{l}) {n m : ℕ₋₂} (Hnm : n ≤ m)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
[Hn : is_trunc n A] : is_trunc m A :=
|
2016-02-25 00:43:50 +00:00
|
|
|
|
begin
|
|
|
|
|
induction Hnm with m Hnm IH,
|
|
|
|
|
{ exact Hn},
|
|
|
|
|
{ exact _}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
definition is_trunc_of_imp_is_trunc {n : ℕ₋₂} (H : A → is_trunc (n.+1) A)
|
2015-08-31 16:23:34 +00:00
|
|
|
|
: is_trunc (n.+1) A :=
|
|
|
|
|
@is_trunc_succ_intro _ _ (λx y, @is_trunc_eq _ _ (H x) x y)
|
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_of_imp_is_trunc_of_le {n : ℕ₋₂} (Hn : -1 ≤ n) (H : A → is_trunc n A)
|
2015-08-31 16:23:34 +00:00
|
|
|
|
: is_trunc n A :=
|
2016-02-25 00:43:50 +00:00
|
|
|
|
begin
|
|
|
|
|
cases Hn with n' Hn': apply is_trunc_of_imp_is_trunc H
|
|
|
|
|
end
|
2015-08-31 16:23:34 +00:00
|
|
|
|
|
2015-11-02 17:28:22 +00:00
|
|
|
|
-- these must be definitions, because we need them to compute sometimes
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_of_is_contr (A : Type) (n : ℕ₋₂) [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
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_succ_of_is_prop (A : Type) (n : ℕ₋₂) [H : is_prop A]
|
2014-12-12 04:14:53 +00:00
|
|
|
|
: is_trunc (n.+1) A :=
|
2016-02-25 00:43:50 +00:00
|
|
|
|
is_trunc_of_le A (show -1 ≤ n.+1, from succ_le_succ (minus_two_le n))
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_succ_succ_of_is_set (A : Type) (n : ℕ₋₂) [H : is_set A]
|
2014-12-12 04:14:53 +00:00
|
|
|
|
: is_trunc (n.+2) A :=
|
2016-02-25 00:43:50 +00:00
|
|
|
|
is_trunc_of_le A (show 0 ≤ n.+2, from succ_le_succ (succ_le_succ (minus_two_le n)))
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:55:29 +00:00
|
|
|
|
/- props -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
definition is_prop.elim [H : is_prop A] (x y : A) : x = y :=
|
2015-04-25 03:04:24 +00:00
|
|
|
|
!center
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:55:29 +00:00
|
|
|
|
definition is_contr_of_inhabited_prop {A : Type} [H : is_prop A] (x : A) : is_contr A :=
|
2016-02-15 20:18:07 +00:00
|
|
|
|
is_contr.mk x (λy, !is_prop.elim)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
theorem is_prop_of_imp_is_contr {A : Type} (H : A → is_contr A) : is_prop 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,
|
2016-02-29 20:31:23 +00:00
|
|
|
|
have H2 : 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
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
theorem is_prop.mk {A : Type} (H : ∀x y : A, x = y) : is_prop A :=
|
|
|
|
|
is_prop_of_imp_is_contr (λ x, is_contr.mk x (H x))
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
theorem is_prop_elim_self {A : Type} {H : is_prop A} (x : A) : is_prop.elim x x = idp :=
|
|
|
|
|
!is_prop.elim
|
2015-05-29 18:50:19 +00:00
|
|
|
|
|
2016-02-15 20:55:29 +00:00
|
|
|
|
/- sets -/
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
theorem is_set.mk (A : Type) (H : ∀(x y : A) (p q : x = y), p = q) : is_set A :=
|
|
|
|
|
@is_trunc_succ_intro _ _ (λ x y, is_prop.mk (H x y))
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
definition is_set.elim [H : is_set A] ⦃x y : A⦄ (p q : x = y) : p = q :=
|
|
|
|
|
!is_prop.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))
|
|
|
|
|
|
2016-02-15 19:40:25 +00:00
|
|
|
|
definition ap_pr1_center_eq_sigma_eq {A : Type} {a x : A} (p : a = x)
|
|
|
|
|
: ap pr₁ (center_eq ⟨x, p⟩) = p :=
|
|
|
|
|
by induction p; reflexivity
|
|
|
|
|
|
|
|
|
|
definition ap_pr1_center_eq_sigma_eq' {A : Type} {a x : A} (p : x = a)
|
|
|
|
|
: ap pr₁ (center_eq ⟨x, p⟩) = p⁻¹ :=
|
|
|
|
|
by induction p; reflexivity
|
|
|
|
|
|
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)
|
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
definition is_prop_empty : is_prop empty :=
|
|
|
|
|
is_prop.mk (λx, !empty.elim x)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
local attribute is_contr_unit is_prop_empty [instance]
|
2015-08-06 20:37:52 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_unit [instance] (n : ℕ₋₂) : is_trunc n unit :=
|
2015-08-06 20:37:52 +00:00
|
|
|
|
!is_trunc_of_is_contr
|
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_empty [instance] (n : ℕ₋₂) : is_trunc (n.+1) empty :=
|
2016-02-15 20:18:07 +00:00
|
|
|
|
!is_trunc_succ_of_is_prop
|
2015-08-06 20:37:52 +00:00
|
|
|
|
|
2014-12-12 04:14:53 +00:00
|
|
|
|
/- interaction with equivalences -/
|
|
|
|
|
|
|
|
|
|
section
|
|
|
|
|
open is_equiv equiv
|
|
|
|
|
|
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
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
theorem is_trunc_is_equiv_closed (n : ℕ₋₂) (f : A → B) [H : is_equiv f]
|
2015-02-21 00:30:32 +00:00
|
|
|
|
[HA : is_trunc n A] : is_trunc n B :=
|
2016-03-03 15:48:27 +00:00
|
|
|
|
begin
|
|
|
|
|
revert A HA B f H, induction n with n IH: intros,
|
|
|
|
|
{ exact is_contr_is_equiv_closed f},
|
|
|
|
|
{ apply is_trunc_succ_intro, intro x y,
|
|
|
|
|
exact IH (f⁻¹ x = f⁻¹ y) _ (x = y) (ap f⁻¹)⁻¹ !is_equiv_inv}
|
|
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_is_equiv_closed_rev (n : ℕ₋₂) (f : A → B) [H : is_equiv f]
|
2015-04-29 00:48:39 +00:00
|
|
|
|
[HA : is_trunc n B] : is_trunc n A :=
|
|
|
|
|
is_trunc_is_equiv_closed n f⁻¹
|
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_equiv_closed (n : ℕ₋₂) (f : A ≃ B) [HA : is_trunc n A]
|
2015-02-21 00:30:32 +00:00
|
|
|
|
: is_trunc n B :=
|
|
|
|
|
is_trunc_is_equiv_closed n (to_fun f)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_equiv_closed_rev (n : ℕ₋₂) (f : A ≃ B) [HA : is_trunc n B]
|
2015-04-29 00:48:39 +00:00
|
|
|
|
: is_trunc n A :=
|
|
|
|
|
is_trunc_is_equiv_closed n (to_inv f)
|
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
definition is_equiv_of_is_prop [constructor] [HA : is_prop A] [HB : is_prop B]
|
2015-05-29 18:50:19 +00:00
|
|
|
|
(f : A → B) (g : B → A) : is_equiv f :=
|
2016-02-15 20:18:07 +00:00
|
|
|
|
is_equiv.mk f g (λb, !is_prop.elim) (λa, !is_prop.elim) (λa, !is_set.elim)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-04-22 19:12:25 +00:00
|
|
|
|
definition is_equiv_of_is_contr [constructor] [HA : is_contr A] [HB : is_contr B]
|
|
|
|
|
(f : A → B) : is_equiv f :=
|
|
|
|
|
is_equiv.mk f (λx, !center) (λb, !is_prop.elim) (λa, !is_prop.elim) (λa, !is_set.elim)
|
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
definition equiv_of_is_prop [constructor] [HA : is_prop A] [HB : is_prop B]
|
2015-05-29 18:50:19 +00:00
|
|
|
|
(f : A → B) (g : B → A) : A ≃ B :=
|
2016-02-15 20:18:07 +00:00
|
|
|
|
equiv.mk f (is_equiv_of_is_prop f g)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
definition equiv_of_iff_of_is_prop [unfold 5] [HA : is_prop A] [HB : is_prop B] (H : A ↔ B) : A ≃ B :=
|
|
|
|
|
equiv_of_is_prop (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 -/
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition is_trunc_lift [instance] [priority 1450] (A : Type) (n : ℕ₋₂)
|
2015-09-02 23:41:19 +00:00
|
|
|
|
[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
|
2016-02-15 19:40:25 +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₂)
|
|
|
|
|
|
2016-02-15 20:18:07 +00:00
|
|
|
|
definition is_prop.elimo [H : is_prop (C a)] : c =[p] c₂ :=
|
|
|
|
|
pathover_of_eq_tr !is_prop.elim
|
2015-05-22 08:35:38 +00:00
|
|
|
|
|
|
|
|
|
definition is_trunc_pathover [instance]
|
2016-02-25 00:43:50 +00:00
|
|
|
|
(n : ℕ₋₂) [H : is_trunc (n.+1) (C a)] : is_trunc n (c =[p] c₂) :=
|
2015-05-22 08:35:38 +00:00
|
|
|
|
is_trunc_equiv_closed_rev n !pathover_equiv_eq_tr
|
|
|
|
|
|
|
|
|
|
variables {p c c₂}
|
2016-02-15 20:18:07 +00:00
|
|
|
|
theorem is_set.elimo (q q' : c =[p] c₂) [H : is_set (C a)] : q = q' :=
|
|
|
|
|
!is_prop.elim
|
2015-05-22 08:35:38 +00:00
|
|
|
|
|
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
|
|
|
|
|
2016-02-15 19:40:25 +00:00
|
|
|
|
end is_trunc
|
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
structure trunctype (n : ℕ₋₂) :=
|
2016-02-15 19:40:25 +00:00
|
|
|
|
(carrier : Type)
|
|
|
|
|
(struct : is_trunc n carrier)
|
|
|
|
|
|
2016-02-16 01:59:38 +00:00
|
|
|
|
notation n `-Type` := trunctype n
|
|
|
|
|
abbreviation Prop := -1-Type
|
|
|
|
|
abbreviation Set := 0-Type
|
2016-02-15 19:40:25 +00:00
|
|
|
|
|
2016-02-16 01:59:38 +00:00
|
|
|
|
attribute trunctype.carrier [coercion]
|
|
|
|
|
attribute trunctype.struct [instance] [priority 1400]
|
2015-09-02 23:41:19 +00:00
|
|
|
|
|
2016-02-16 01:59:38 +00:00
|
|
|
|
protected abbreviation Prop.mk := @trunctype.mk -1
|
|
|
|
|
protected abbreviation Set.mk := @trunctype.mk (-1.+1)
|
2015-09-02 23:41:19 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
protected definition trunctype.mk' [constructor] (n : ℕ₋₂) (A : Type) [H : is_trunc n A]
|
2016-02-16 01:59:38 +00:00
|
|
|
|
: n-Type :=
|
|
|
|
|
trunctype.mk A H
|
2015-09-02 23:41:19 +00:00
|
|
|
|
|
2016-02-16 01:59:38 +00:00
|
|
|
|
namespace is_trunc
|
2015-09-02 23:41:19 +00:00
|
|
|
|
|
2016-02-25 00:43:50 +00:00
|
|
|
|
definition tlift.{u v} [constructor] {n : ℕ₋₂} (A : trunctype.{u} n)
|
2015-09-02 23:41:19 +00:00
|
|
|
|
: trunctype.{max u v} n :=
|
2016-02-15 19:40:25 +00:00
|
|
|
|
trunctype.mk (lift A) !is_trunc_lift
|
2015-09-02 23:41:19 +00:00
|
|
|
|
|
|
|
|
|
end is_trunc
|