lean2/hott/types/pointed.hlean

77 lines
2.1 KiB
Text
Raw Normal View History

/-
Copyright (c) 2014 Jakob von Raumer. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jakob von Raumer, Floris van Doorn
Ported from Coq HoTT
-/
open core is_trunc
2014-12-12 04:14:53 +00:00
structure pointed [class] (A : Type) :=
2014-12-12 04:14:53 +00:00
(point : A)
namespace pointed
variables {A B : Type}
definition pt [H : pointed A] := point A
2014-12-12 04:14:53 +00:00
-- Any contractible type is pointed
definition pointed_of_is_contr [instance] (A : Type) [H : is_contr A] : pointed A :=
pointed.mk !center
2014-12-12 04:14:53 +00:00
-- A pi type with a pointed target is pointed
definition pointed_pi [instance] (P : A → Type) [H : Πx, pointed (P x)]
: pointed (Πx, P x) :=
pointed.mk (λx, pt)
2014-12-12 04:14:53 +00:00
-- A sigma type of pointed components is pointed
definition pointed_sigma [instance] (P : A → Type) [G : pointed A]
[H : pointed (P pt)] : pointed (Σx, P x) :=
pointed.mk ⟨pt,pt⟩
2014-12-12 04:14:53 +00:00
definition pointed_prod [instance] (A B : Type) [H1 : pointed A] [H2 : pointed B]
: pointed (A × B) :=
pointed.mk (pt,pt)
2014-12-12 04:14:53 +00:00
definition pointed_loop [instance] (a : A) : pointed (a = a) :=
pointed.mk idp
2014-12-12 04:14:53 +00:00
definition pointed_fun_closed (f : A → B) [H : pointed A] : pointed B :=
pointed.mk (f pt)
end pointed
structure Pointed :=
{carrier : Type}
(Point : carrier)
open pointed Pointed
namespace Pointed
attribute carrier [coercion]
protected definition mk' (A : Type) [H : pointed A] : Pointed := Pointed.mk (point A)
definition pointed_carrier [instance] (A : Pointed) : pointed (carrier A) :=
pointed.mk (Point A)
definition Loop_space [reducible] (A : Pointed) : Pointed :=
Pointed.mk' (point A = point A)
definition Iterated_loop_space (A : Pointed) (n : ) : Pointed :=
nat.rec_on n A (λn X, Loop_space X)
prefix `Ω`:95 := Loop_space
notation `Ω[`:95 n:0 `]`:0 A:95 := Iterated_loop_space A n
end Pointed
namespace pointed
export Pointed (hiding cases_on destruct mk)
abbreviation Cases_on := @Pointed.cases_on
abbreviation Destruct := @Pointed.destruct
abbreviation Mk := @Pointed.mk
definition iterated_loop_space (A : Type) [H : pointed A] (n : ) : Type :=
carrier (Iterated_loop_space (Pointed.mk' A) n)
end pointed