Timings for Pointwise.v
From HoTT Require Import Basics Types Pointed HSpace.Core HSpace.Coherent.
Local Open Scope pointed_scope.
Local Open Scope mc_mult_scope.
Local Open Scope path_scope.
(** * Pointwise H-space structures *)
(** Whenever [X] is an H-space, so is the type of maps into [X]. Note: When writing [f * g], Coq only finds this instance if [f] is explicitly in the pointed type [[Y -> X, const pt]]. *)
Instance ishspace_map `{Funext} (X : pType) (Y : Type)
`{IsHSpace X} : IsHSpace [Y -> X, const pt].
exact (fun f g y => (f y) * (g y)).
apply hspace_left_identity.
apply hspace_right_identity.
(** If [X] is coherent, so is [[Y -> X, const pt]]. *)
Instance iscoherent_ishspace_map `{Funext} (X : pType) (Y : Type)
`{IsCoherent X} : IsCoherent [Y -> X, const pt].
funext y; exact iscoherent.
(** If [X] is left-invertible, so is [[Y -> X, const pt]]. *)
Instance isleftinvertible_hspace_map `{Funext} (X : pType) (Y : Type)
`{IsHSpace X} `{forall x, IsEquiv (x *.)}
: forall f : [Y -> X, const pt], IsEquiv (f *.).
(* Left multiplication by [f] unifies with [functor_forall]. *)
exact (isequiv_functor_forall (P:=const X) (f:=idmap)
(g:=fun y gy => (f y) * gy)).
(** The pointwise product of two pointed maps into an H-space. This is the operation underlying the H-space structure [ishspace_pmap] on [Y ->** X], but requires no coherence. *)
Definition sgop_pmap {X Y : pType} `{IsHSpace X} (f g : Y ->* X) : Y ->* X.
exact (fun y => (f y) * (g y)).
lhs napply (ap _ (point_eq g)).
lhs napply (ap (.* pt) (point_eq f)).
apply hspace_left_identity.
(** The constant map is a left unit for the pointwise product; this needs no coherence. *)
Definition leftidentity_pmap {X Y : pType} `{IsHSpace X} (g : Y ->* X)
: sgop_pmap pconst g ==* g.
apply hspace_left_identity.
exact (1 @@ concat_1p _ @ concat_A1p _ _)^.
(** The constant map is a right unit for the pointwise product; the base-point coherence forces [right_identity pt = left_identity pt], so this needs [X] coherent. *)
Definition rightidentity_pmap {X Y : pType} `{IsCoherent X} (f : Y ->* X)
: sgop_pmap f pconst ==* f.
apply hspace_right_identity.
lhs napply (concat_p1 _ @ concat_1p _ @ concat_1p _).
(** For the type of pointed maps [Y ->** X], coherence of [X] is needed even to get a non-coherent H-space structure on [Y ->** X]. *)
Instance ishspace_pmap `{Funext} (X Y : pType) `{IsCoherent X}
: IsHSpace (Y ->** X).
intro g; exact (path_pforall (leftidentity_pmap g)).
intro f; exact (path_pforall (rightidentity_pmap f)).
Instance iscoherent_hspace_pmap `{Funext} (X Y : pType) `{IsCoherent X}
: IsCoherent (Y ->** X).
(* Note that [pt] sometimes means the constant map [Y ->* X]. *)
(* Both identities are created using [path_pforall]. *)
refine (ap path_pforall _).
generalize iscoherent as isc.
unfold left_identity, right_identity.
generalize (hspace_left_identity pt).
(** Since [sgop_pmap] is defined pointwise, it commutes with precomposition. *)
Definition sgop_pmap_precompose {X Y W : pType} `{IsHSpace X}
(f g : Y ->* X) (h : W ->* Y)
: sgop_pmap f g o* h ==* sgop_pmap (f o* h) (g o* h).
symmetry; apply concat_pp_V.
(** [sgop_pmap] respects pointed homotopy in each argument. *)
Definition sgop_pmap_phomotopy {X Y : pType} `{IsHSpace X}
{f f' g g' : Y ->* X} (p : f ==* f') (q : g ==* g')
: sgop_pmap f g ==* sgop_pmap f' g'.
intro y; exact (ap011 sg_op (p y) (q y)).
pelim p f f' q g g'; cbn.
symmetry; apply concat_pV.
(** If the H-space structure on [X] is left-invertible, so is the one induced on [Y ->** X]. *)
Instance isleftinvertible_hspace_pmap `{Funext} (X Y : pType)
`{IsCoherent X} `{forall x, IsEquiv (x *.)}
: forall f : Y ->** X, IsEquiv (f *.).
srefine (isequiv_homotopic (equiv_functor_pforall_id _ _) _).
exact (fun a => equiv_hspace_left_op (f a)).
exact (right_identity _ @ point_eq f).
apply path_pforall; snapply Build_pHomotopy.
refine (whiskerL _ iscoherent @ _).
exact (concat_A1p right_identity (point_eq f)).