Section EagerSampling.
Variable v_firstn : forall n1 n2, Bvector (n1 + n2)%nat -> Bvector n1.
Variable v_skipn : forall n1 n2, Bvector (n1 + n2)%nat -> Bvector n2.
Hypothesis v_firstn_correct : forall n1 n2 v1 v2,  (v_firstn n1 n2 (VectorDef.append v1 v2)) = v1.
Hypothesis v_skipn_correct : forall n1 n2 v1 v2,  (v_skipn n1 n2 (VectorDef.append v1 v2)) = v2.
Hypothesis firstn_skipn_correct : forall n1 n2 (v : Bvector (n1 + n2)), v = (VectorDef.append (v_firstn n1 n2 v) (v_skipn n1 n2 v)).

Lemma sample_split : forall (A : Set) n1 n2 f (a : A),
(forall v1 v2, well_formed_comp (f v1 v2)) ->
evalDist (v <- {0, 1} ^ (n1 + n2)%nat; f (v_firstn n1 n2 v) (v_skipn n1 n2 v)) a ==
evalDist (v1 <- {0, 1} ^ n1; v2 <- {0, 1} ^ n2; f v1 v2) a.