induction ls; intuition.
simpl.
comp_simp.
simpl.
rewrite evalDist_ret_0.
eapply rat0_le_all.
intuition.
simpl.
inline_first.
eapply leRat_trans.
eapply (evalDist_bind_event_le _ _ (fun z => eqb x z)).
eapply eqRat_impl_leRat.
apply RndNat_eq_any.
intuition.
assert (Pr
[lsR <-$
(lsb' <-$ compMap (Bvector_EqDec eta) (fun _ : A => { 0 , 1 }^eta) ls;
ret (a0 :: lsb')%list);
ret (if in_dec (EqDec_dec (Bvector_EqDec eta)) x lsR then true else false)
] ==
Pr
[lsR <-$ compMap (Bvector_EqDec eta) (fun _ : A => { 0 , 1 }^eta) ls;
ret (if in_dec (EqDec_dec (Bvector_EqDec eta)) x lsR then true else false)
]).
inline_first.
comp_skip.
destruct (in_dec (EqDec_dec (Bvector_EqDec eta)) x (a0 :: x0)).
simpl in i.
intuition; subst.
rewrite eqb_refl in *.
discriminate.
destruct (in_dec (EqDec_dec (Bvector_EqDec eta)) x x0); intuition.
simpl in n; intuition.
destruct (in_dec (EqDec_dec (Bvector_EqDec eta)) x x0); intuition.
rewrite H1.
rewrite IHls.
reflexivity.
eapply leRat_trans.
2:{
eapply eqRat_impl_leRat.
symmetry.
cutrewrite (S (length ls) = 1 + (length ls))%nat.
apply ratAdd_num.
trivial.
}
reflexivity.
Qed.
End FixedInRndList.
Section RndInAdaptive.
Variable A B C : Set.
Local Open Scope rat_scope.

(* Specifications: *)
Theorem orb_prob :
forall (A B : Set)(c : Comp A)(f : A -> Comp B) evt1 evt2 k1 k2,
Pr[x <-$ c; ret (evt1 x)] <= k1 ->
(forall a, In a (getSupport c) -> evt1 a = false -> Pr[y <-$ f a; ret (evt2 y)] <= k2) ->
Pr[x <-$ c; y <-$ f x; ret (evt1 x || evt2 y)] <= k1 + k2.