Timings for unique_choice.v
Require Import HoTT.Basics HoTT.Truncations.Core.
Definition atmost1 X:=(forall x1 x2:X, (x1 = x2)).
Definition atmost1P {X} (P:X->Type):=
(forall x1 x2:X, P x1 -> P x2 -> (x1 = x2)).
Definition hunique {X} (P:X->Type):=(hexists P) * (atmost1P P).
Lemma atmost {X} {P : X -> Type}:
(forall x, IsHProp (P x)) -> (atmost1P P) -> atmost1 (sig P).
assert (H0: (p =q)) by apply path_ishprop.
Lemma iota {X} (P:X-> Type):
(forall x, IsHProp (P x)) -> (hunique P) -> sig P.
apply (@Trunc_rec (-1) (sig P) );auto.
by apply hprop_allpath, atmost.
Lemma unique_choice {X Y} (R:X->Y->Type) :
(forall x y, IsHProp (R x y)) -> (forall x, (hunique (R x)))
-> {f : X -> Y & forall x, (R x (f x))}.
exists (fun x:X => (pr1 (iota _ (X0 x) (X1 x)))).
exact (pr2 (iota _ (X0 x) (X1 x))).