Probability notation for Boolean experiments #
Pr[e] is the probability, as a real number, that the Boolean experiment e returns true.
The experiment is either a program e : ProbComp Bool, for which Pr[e] is
(ProbComp.eval e true).toReal, or a distribution e : PMF Bool, for which it is
(e true).toReal. The notation adds no constant: Pr[e] elaborates to exactly these terms, so
every lemma about ENNReal.toReal, PMF and ProbComp.eval applies to it, and the program form
is the distribution form at ProbComp.eval e. The elaborator tries ProbComp Bool first, so a
do block or a chain of binds is read as a program, and falls back to PMF Bool.
Probabilities are real numbers so that advantages and biases are signed differences, as in
|Pr[real] - Pr[ideal]| or Pr[game] - 1 / 2. Nonnegativity is ENNReal.toReal_nonneg.
Events are final returns. The probability that a sample of μ : PMF α lies in a set s is
Pr[(fun x => decide (x ∈ s)) <$> μ], and the probability of an outcome a is
Pr[(· == a) <$> μ]; these are (μ.toOuterMeasure s).toReal and (μ a).toReal. A Boolean game,
a set event and a single outcome therefore share one form.
The notation is scoped: open Cslib.Probability enables it, as does open Probability inside the
namespace Cslib. It then also prints both forms back as Pr[e].
Main definitions #
Pr[e]: the probability that the Boolean experimentereturnstrue, as a real number.
Main results #
Cslib.Probability.PMF.toReal_apply_le_one: a probability is at most one.Cslib.ProbComp.probability_pure: a program that returns a constant.Cslib.ProbComp.probability_bind: after a finite random choice, the probability is the average over the choice.Cslib.Probability.PMF.probability_map_decide_mem,Cslib.ProbComp.probability_map_decide_mem: set events.Cslib.Probability.PMF.probability_map_beq,Cslib.ProbComp.probability_map_beq: single outcomes.
The probability that a sample lies in a set is the probability that testing membership
returns true.
The probability that a program's output lies in a set is the probability that testing
membership returns true.