22 distributions with finite support, and then specializes it to
33 `DBool.dbool`, `drange` and `duniform`. ^*)
44
5- require import AllCore List StdOrder StdBigop Distr DBool.
5+ require import AllCore List StdOrder StdBigop Distr DBool Finite .
66require EventPartitioning.
77import RealOrder Bigreal BRA.
88
9- (*& Are the elements in the support of a distribution the
10- same as the elements of a list? &*)
11-
12- op support_is (d : ' a distr) (xs : ' a list) : bool =
13- forall (y : ' a), y \i n d <=> y \i n xs.
14-
159(*& General abstract theory &*)
1610
1711abstract theory TotalGeneral.
@@ -102,13 +96,13 @@ hoare; call (_ : true); auto; smt().
10296qed.
10397
10498lemma total_prob' (dt' : t distr) (supp : t list) (i' : input) &m :
105- is_lossless dt' => uniq supp => support_is dt' supp =>
99+ is_lossless dt' => is_finite_for (support dt' ) supp =>
106100 Pr[Rand(M).f(dt' , i' ) @ &m : res] =
107101 big predT
108102 (fun x' => mu1 dt' x' * Pr[M.main(i' , x' ) @ &m : res])
109103 supp.
110104proof.
111- move => dt' _ll uniq_supp support_is_dt ' _supp.
105+ move => dt'_ll [ uniq_supp supp_iff].
112106have -> :
113107 Pr[Rand(M).f(dt' , i' ) @ &m : res] = Pr[RandAux.f(dt' , i' ) @ &m : res].
114108 byequiv (_ : ={dt, i, glob M} ==> ={res}) => // ; proc; sim.
@@ -134,13 +128,13 @@ end section.
134128(*& total probability lemma for distributions with finite support &*)
135129
136130lemma total_prob (M <: T) (dt : t distr) (supp : t list) (i : input) &m :
137- is_lossless dt => uniq supp => support_is dt supp =>
131+ is_lossless dt => is_finite_for (support dt) supp =>
138132 Pr[Rand(M).f(dt, i) @ &m : res] =
139133 big predT
140134 (fun (x : t) => mu1 dt x * Pr[M.main(i, x) @ &m : res])
141135 supp.
142136proof.
143- move => dt_ll uniq_supp support_is_dt_supp .
137+ move => dt_ll iff_supp_dt_supp .
144138by apply (total_prob' M).
145139qed.
146140
@@ -205,10 +199,8 @@ proof.
205199move => lt_m_n.
206200rewrite (total_prob M (drange m n) (range m n)).
207201by rewrite drange_ll.
208- by rewrite range_uniq.
209- rewrite /support_is => j; split => [j_in_drange | j_in_range].
210- rewrite mem_range; by rewrite supp_drange in j_in_drange.
211- rewrite supp_drange; by rewrite mem_range in j_in_range.
202+ rewrite /is_finite_for.
203+ smt(range_uniq mem_range supp_drange).
212204rewrite (big_weight_simp M) // ; by move => j /mem_range.
213205qed.
214206
@@ -255,8 +247,7 @@ proof.
255247move => uniq_xs xs_ne_nil.
256248rewrite (total_prob M (duniform xs) xs).
257249by rewrite duniform_ll.
258- by rewrite uniq_xs.
259- rewrite /support_is => y; smt(supp_duniform).
250+ smt(supp_duniform).
260251by rewrite (big_weight_simp M).
261252qed.
262253
0 commit comments