Timings for Closed.v
Require Import HoTT.Basics HoTT.Types.
Require Import Extensions.
Require Import Modality Accessible Nullification Lex Topological.
Require Import Colimits.Pushout Homotopy.Join.Core.
Local Open Scope nat_scope.
Local Open Scope path_scope.
(** * Closed modalities *)
(** We begin by characterizing the modal types. *)
Section ClosedModalTypes.
Definition equiv_inO_closed (A : Type)
: (U -> Contr A) <-> IsEquiv (fun a:A => push (inr a) : Join U A).
simple refine (isequiv_adjointify _ _ _ _).
simple refine (Pushout_rec A _ _ _).
intros u; pose (uac u); exact (center A).
simple refine (Pushout_ind _ _ _ _ z).
pose (contr_inhabited_hprop U u).
intros [u a]; pose (contr_inhabited_hprop U u).
refine (contr_equiv (Join U A) (fun a:A => push (inr a))^-1).
pose (contr_inhabited_hprop U u).
(** Exercise 7.13(ii): Closed modalities *)
Definition Cl (U : HProp) : Modality.
intros X; exact (U -> Contr X).
cbn; intros u; pose (T_inO u).
intros ; exact (Join U X).
pose (contr_inhabited_hprop _ u).
srefine (Pushout_ind B _ _ _ z).
intros u; apply center, B_inO, u.
pose (B_inO (push (inr a)) u).
(** The closed modality is accessible. *)
Instance accmodality_closed (U : HProp)
: IsAccModality (Cl U).
exact (fun _:U => Empty).
apply ooextendable_contr; exact _.
apply (Build_Contr _ ((fst (ext u 1%nat) Empty_rec).1 tt)); intros x.
exact ((fst (snd (ext u 2) (fst (ext u 1%nat) Empty_rec).1
(fun _ => x)) (Empty_ind _)).1 tt).
(** In fact, it is topological, and therefore (assuming univalence) lex. As for topological modalities generally, we don't need to declare these as global instances, but we prove them here as local instances for exposition. *)
Local Instance topological_closed (U : HProp)
: Topological (Cl U)
:= _.
Instance lex_closed `{Univalence} (U : HProp)
: Lex (Cl U).
(** Thus, it also has the following alternative version. *)
Definition Cl' (U : HProp) : Modality
:= Nul (Build_NullGenerators U (fun _ => Empty)).