Bounded repetition of probabilistic programs #
OracleComp.replicate collects the results of an ordinary List.mapM traversal in execution
order. Closed runs draw independent samples, even when the output type is infinite. Efficiency
is certified separately in Computability.Probabilistic.Repeat.
Main definitions #
Cslib.OracleComp.replicate: collect a bounded number of runs.Cslib.OracleComp.countTrue,.testProbabilityLT: count successes and test rational thresholds.Cslib.OracleComp.repeatAll: run repeated Boolean trials, accepting when all accept.
Main results #
Cslib.OracleComp.replicate_add,.replicate_snoc: split an execution into segments.Cslib.OracleComp.evalWith_repeatAll_true,.evalWith_repeatAll_true_toReal: independent repetition multiplies acceptance probabilities under any stateless handler.Cslib.ProbComp.eval_replicate: finite outputs have the independent product law.Cslib.ProbComp.eval_replicate_iid: the independent law on arbitrary output types.Cslib.ProbComp.eval_replicate_map: transport a sampling law through repeated draws.Cslib.ProbComp.eval_replicate_splice: draw one coordinate first without changing the joint law.Cslib.ProbComp.eval_countTrue: the success count is a sum of independent indicators.Cslib.ProbComp.countTrue_le: every supported success count respects the trial budget.Cslib.ProbComp.eval_replicate_of_uniform: realize the joint law from independent finite seeds.Cslib.ProbComp.eval_replicate_of_uniformList: collect independent draws from one flat bit list.Cslib.ProbComp.toOuterMeasure_replicate_forall: all runs pass a test with the power of the one-run probability.
References #
Adapted from Languages/Probabilistic/Repeat.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8, using the existing typed program interface and list
traversal.
Collect the results of a bounded number of runs in execution order.
Instances For
Zero runs return the empty list.
count + 1 runs make one run, then count more, and list its result first.
Split repeated runs into two consecutive segments.
Split off the last draw of a repeated program.
Deterministic postprocessing commutes with collecting the draws.
Count the true results of a bounded number of runs of a Boolean program.
Instances For
Compare an empirical acceptance rate with a rational threshold by natural cross-products. Accuracy theorems require a positive count and denominator; the program is total at zero.
Instances For
Run count copies of a Boolean program in sequence, returning false as soon as one run
returns false and true when all runs return true.
Instances For
Zero repetitions of a Boolean program accept unconditionally.
count + 1 repetitions run the program once, continuing if it accepts and rejecting
otherwise.
The probability that count independent sequential runs all return true under a stateless
handler h is the count-th power of the single-run probability.
The real probability that count independent sequential runs all return true under a
stateless handler h is the count-th power of the single-run real probability.
A supported collected result has the prescribed length and supported entries.
Draw one designated coordinate first, then insert it between independent prefix and suffix draws. This preserves the complete joint law, including repeated sample values.
An encoded sampling law lifts to repeated draws without requiring either type to be finite or the encoding to be injective. The order and multiplicity of all draws are preserved.
Independent repetition on arbitrary output types, including integers and failure options. Unlike the finite-product specialization, this law needs no finiteness assumption.
Repeated closed runs have the independent product law for any finite output distribution.
Counting successful repeated trials is the sum of independent Boolean indicators.
Repeated closed runs use independent uniform seeds, including at count zero. The output type need not be finite.
One flat uniform bit list supplies independent seeds for every repeated run, including zero repetitions and zero-width seeds.
Every one of n independent runs satisfies a test with the n-th power of the probability
of one run.
The probability that count independent sequential runs of a closed probabilistic program
all accept is the count-th power of the single-run acceptance probability.
The real probability that count independent sequential runs of a closed probabilistic program
all accept is the count-th power of the single-run real acceptance probability.