Plurality amplification for probabilistic computations #
For a list xs : List α over a type with decidable equality, Cslib.ProbComp.plurality default xs
returns the element of xs occurring most frequently (breaking ties in favor of the first element
in xs achieving the maximum frequency, and returning default on []). Whenever an element a
appears strictly more than xs.length / 2 times, plurality default xs = a
(Cslib.ProbComp.plurality_eq_of_length_lt_two_mul_count), because any two distinct elements appear
at most xs.length times in total (Cslib.ProbComp.count_add_count_le_length_of_ne).
By Hoeffding's inequality (Cslib.Probability.PMF.pi_sum_le_mean_sub), if a probabilistic
computation program : ProbComp α outputs a with probability at least 1 / 2 + γ (0 ≤ γ), then
the plurality of k independent runs differs from a with probability at most exp (-2 * k * γ²)
(Cslib.ProbComp.toOuterMeasure_plurality_replicate_ne_toReal_le), and therefore outputs a with
probability at least 1 - exp (-2 * k * γ²) ≥ 1 - 2^{-(2 * γ² * k)}
(Cslib.ProbComp.one_sub_exp_le_eval_plurality_replicate_toReal,
Cslib.ProbComp.one_sub_two_rpow_le_eval_plurality_replicate_toReal).
Main definitions #
Cslib.ProbComp.plurality: most frequent element of a list, with tie-breaking by first occurrence and a default value on[].
Main results #
Cslib.ProbComp.count_add_count_le_length_of_ne: two distinct elements appear at mostxs.lengthtimes in total.Cslib.ProbComp.plurality_eq_of_length_lt_two_mul_count: strict majority implies plurality.Cslib.ProbComp.toOuterMeasure_plurality_replicate_ne_toReal_le,Cslib.ProbComp.one_sub_exp_le_eval_plurality_replicate_toReal,Cslib.ProbComp.one_sub_two_rpow_le_eval_plurality_replicate_toReal: Hoeffding concentration for the plurality ofkindependent runs of aProbComp αwith marginγabove1 / 2.
The most frequent element of xs, breaking ties in favor of the earliest element of xs
achieving the maximum frequency, or default when xs is empty.
Two distinct elements appear at most xs.length times in total.
Whenever a appears strictly more than half the time in xs, plurality default xs = a.
Plurality concentration for k independent trials. If a closed probabilistic program
program : ProbComp α outputs a with probability at least 1 / 2 + γ (for 0 ≤ γ), then the
plurality of k independent runs differs from a with probability at most
exp (-2 * k * γ²).
Plurality success probability for k independent trials. If program outputs a with
probability at least 1 / 2 + γ (0 ≤ γ), then the plurality of k independent runs outputs a
with probability at least 1 - exp (-2 * k * γ²) ≥ 1 - 2^{-(2 * γ² * k)}.
Base-2 exponential form of one_sub_exp_le_eval_plurality_replicate_toReal.