intros.
pose proof (SplitPathCompleteness (map posToPath (rangePos max))
(posFunToPathFun f) (rangePosPrefixFree max)).
inversion H; clear H.
exists x.
intros.
pose proof H0 (posToPath p).
rewrite H1.
+ unfold posFunToPathFun.
rewrite posPathInj.
reflexivity.
+ apply in_map_iff.
exists p.
split; auto.
apply posLtInRange.
auto.
Qed.
Definition funToPosFun {A : Type} `{_ : CoArbitrary A} (f : A -> RandomSeed) (p : positive)
: RandomSeed :=
match coarbReverse p with
| Some a => f a
| None   => newRandomSeed
end.
Definition coarbLe {A : Type} `{_ : CoArbitrary A} (x y : A) : Prop :=
Pos.le (coarbitrary x) (coarbitrary y).

Lemma coarbLePreservesLe : forall {A : Type} `{_ : CoArbitrary A} (x y : A),
coarbLe x y -> Pos.le (coarbitrary x) (coarbitrary y).