(* Copyright 2012-2017 by Adam Petcher and FCF Contributors.	* * Use of this source code is governed by the license described	* * in the LICENSE file at the root of the source tree.		*)
(* An argument that is used to prove that the "two worlds" style of security definition is equivalent to the "coin flipping" style. *)
Set Implicit Arguments.
intuition.
specialize (support_NoDup c); intuition.
rewrite <- H0 in H1.
destruct ls; intuition.
specialize (getSupport_length_nz H); intuition.
rewrite <- H0 in H2.
simpl in *.
omega.
destruct b.
destruct ls.
unfold sumList; simpl.
eapply ratAdd_eqRat_compat.
symmetry.
eapply getSupport_not_In_evalDist.
intuition.
rewrite <- H0 in H2.
simpl in *.
intuition.
intuition.
destruct b.
inversion H1; clear H1; subst.
simpl in *.
intuition.
destruct ls.
unfold sumList.
simpl.
rewrite <- ratAdd_0_l.
eapply ratAdd_comm.
destruct b.
inversion H1; clear H1; subst.
simpl in *.
intuition.
inversion H1; clear H1; subst.
simpl in *.
intuition.
inversion H5; clear H5; subst.
simpl in *; intuition.
destruct ls.
unfold sumList; simpl.
rewrite ratAdd_comm.
eapply ratAdd_eqRat_compat.
intuition.
symmetry.
eapply getSupport_not_In_evalDist.
intuition.
rewrite <- H0 in H2.
simpl in *.
intuition.
destruct b.
destruct ls.
unfold sumList.
simpl.
rewrite <- ratAdd_0_l.
intuition.
destruct b.
inversion H1; clear H1; subst.
simpl in *.
intuition.
inversion H5; clear H5; subst.
simpl in *; intuition.
inversion H1; clear H1; subst.
simpl in *; intuition.
inversion H1; clear H1; subst.
simpl in *; intuition.
Qed.
intuition.
eapply (eqRat_ratAdd_same_r (evalDist c true)).
symmetry.
rewrite ratAdd_comm.
rewrite ratSubtract_ratAdd_inverse_2.
specialize (@evalDist_lossless _ c); intuition.
rewrite <- H1.
clear H1.
eapply evalDist_bool_support.
intuition.
intuition.
eapply evalDist_le_1.
Qed.

Theorem rndBool_bind :
forall
(f : bool -> Comp bool),
Pr[b <-$ {0, 1}; f b] == (1 / 2) * Pr[f true] + (1 / 2) * Pr[f false].