2014-08-12 00:35:25 +00:00
|
|
|
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
-- Author: Jeremy Avigad
|
|
|
|
-- Ported from Coq HoTT
|
|
|
|
import .path
|
2014-09-09 20:20:04 +00:00
|
|
|
open path
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
-- Truncation levels
|
|
|
|
-- -----------------
|
|
|
|
|
|
|
|
inductive Contr (A : Type) : Type :=
|
2014-08-22 22:46:10 +00:00
|
|
|
Contr_mk : Π
|
2014-08-12 00:35:25 +00:00
|
|
|
(center : A)
|
|
|
|
(contr : Πy : A, center ≈ y),
|
|
|
|
Contr A
|
|
|
|
|
2014-09-04 22:03:59 +00:00
|
|
|
definition center {A : Type} (C : Contr A) : A := Contr.rec (λcenter contr, center) C
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
definition contr {A : Type} (C : Contr A) : Πy : A, center C ≈ y :=
|
2014-09-04 22:03:59 +00:00
|
|
|
Contr.rec (λcenter contr, contr) C
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
inductive trunc_index : Type :=
|
2014-08-22 22:46:10 +00:00
|
|
|
minus_two : trunc_index,
|
|
|
|
trunc_S : trunc_index → trunc_index
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
-- TODO: add coercions to / from nat
|
|
|
|
|
|
|
|
-- TODO: note in the Coq version, there is an internal version
|
2014-10-02 17:22:19 +00:00
|
|
|
definition IsTrunc (n : trunc_index) : Type.{1} → Type.{1} :=
|
2014-09-04 22:03:59 +00:00
|
|
|
trunc_index.rec (λA, Contr A) (λn trunc_n A, (Π(x y : A), trunc_n (x ≈ y))) n
|
2014-08-12 00:35:25 +00:00
|
|
|
|
|
|
|
-- TODO: in the Coq version, this is notation
|
2014-09-17 21:39:05 +00:00
|
|
|
definition minus_one := trunc_index.trunc_S trunc_index.minus_two
|
|
|
|
definition IsHProp := IsTrunc minus_one
|
|
|
|
definition IsHSet := IsTrunc (trunc_index.trunc_S minus_one)
|