(* Use of this source code is governed by the license described	* * in the LICENSE file at the root of the source tree.		*)
(* A basic argument about encountering a specific value in a list of randomly-generated values. *)
Section RndDup.
Variable eta : nat.
Definition RndDup_G (A : Set)(ls : list A) (x : Bvector eta) :=
rs <-$ compMap _ (fun _ => {0, 1} ^ eta) ls;
ret (if (in_dec (EqDec_dec _) x rs) then true else false).
(* Definition RndDup_G q (x : Bvector eta) := rs <-$ compMap _ (fun _ => {0, 1} ^ eta) (allNatsLt q); ret (if (in_dec (EqDec_dec _) x rs) then true else false). *)

Theorem bool_Comp_seq :
forall (A : Set)(c1 : Comp bool)(c2 : bool -> Comp A) a,
evalDist (b <-$ c1; c2 b) a ==
(evalDist c1 true * evalDist (c2 true) a) +
(evalDist c1 false * evalDist (c2 false) a).