Finite-attempt uniform interval and integer-box sampling #
Draw a fixed number of capped fair-bit samples and retain the first valid index. Exhaustion is
an explicit none, never an unbounded retry. Conditioned on success the result is uniform;
the unconditional law retains its failure mass. Bounds and all attempt/coordinate counts are
runtime inputs. The strict PPT implementation uses unary resource parameters.
At a positive interval bound, let p = (dyadicSize bound - bound) / dyadicSize bound.
The exact failure mass is p ^ attempts; every valid index has mass
(1 - p ^ attempts) / bound. The box success mass is (1 - p ^ attempts) ^ dimension, with
bound = 2 * radius + 1, and every Boolean test has unconditional error at most
dimension * (1 / 2) ^ attempts. No conditioning is part of the sampled program.
An empty interval always fails. Zero dimension returns some [] without drawing even when
attempts is zero; radius zero is a singleton reference box but can still suffer retry failure.
These samplers are only a foundation for cryptographic realizations: a simulator's full
transcript/error and an extractor's implementation require separate proofs.
Main definitions #
Cslib.Probability.sampleUniformInterval: bounded retry with an explicit failure result.Cslib.Probability.intervalFailure,Cslib.Probability.intervalSuccess: exact event masses.Cslib.Probability.sampleIntegerBox: coordinatewise finite-attempt integer-box sampling.Cslib.Probability.integerBoxLaw: the exact mathematical uniform reference law.
Main results #
Cslib.Probability.eval_sampleUniformInterval_none,Cslib.Probability.eval_sampleUniformInterval_some_toReal: the full interval law.Cslib.Probability.sampleUniformInterval_conditional: conditional uniformity at observable success events.Cslib.Probability.sampleUniformInterval_test_error_le: unconditional interval error, including the binary-bound implementation.Cslib.Probability.eval_sampleIntegerBox_some,Cslib.Probability.eval_sampleIntegerBox_none: the full joint success/failure law.Cslib.Probability.sampleIntegerBox_test_error_le: explicit unconditional statistical error.Cslib.Probability.sampleIntegerBox_support: exact output dimension and integer bounds.
The probability that one capped draw is rejected. At bound zero every draw is rejected.
Instances For
With no attempts, exhaustion is immediate.
The capped sampler is also a binary natural sampler followed by binary capping. This identity permits a binary implementation without writing the numerical bound in unary.
A capped draw has equal mass at each valid index.
All the excess dyadic mass is the rejection sentinel.
The retry law, including the remaining failure event. All unused draws are integrated out.
A capped draw is never above its sentinel.
The exact exhaustion probability after a finite number of attempts.
Every valid index has the same geometric-series mass; invalid indices have zero mass.
Positive bounds accept with probability at least one half on each attempt.
Exhaustion is exponentially unlikely at a positive bound; zero remains a separate case.
A real-valued form of the complete success law, with no conditioning away of failure.
The denominator used for conditioning is exactly the probability of success.
Conditioned on the observable success event, every valid interval value has probability
1 / bound. Positivity of the attempt budget and bound makes this conditioning meaningful.
Total mass retained by the finite-attempt sampler.
Instances For
The successful part of the full sampler law is its success mass times exact uniformity.
Sample each coordinate of [-radius,radius]^dimension with its own finite attempt budget.
The result is a list of exactly dimension integers on success. Radius is a unary resource in the
strict PPT certificate; this definition makes no logarithmic-radius complexity claim.
Instances For
An empty box has one point and needs no samples, even with no attempts.
The full successful box law is the exact uniform box law scaled by the probability that all coordinate samplers succeed. It includes zero dimension and zero attempts.
Real-valued joint success masses, using only the displayed retry-error parameters.
The exact total box exhaustion probability. Failure is present in the joint law, rather than discarded by conditioning.
The unconditional failure error is at most the dimension times the per-coordinate dyadic retry error. In particular, dimension zero has zero error even when attempts is zero.
Given success, the box has exactly its uniform product law. A positive attempt budget makes that event observable; the empty box already has its separate exact no-draw law.
For a positive interval, every Boolean test has unconditional error at most the dyadic retry-failure bound against exact uniformity. This applies to binary cryptographic bounds too; it neither discards failure nor asserts an exact non-dyadic fair-bit sampler.
The zero bound is an exact, total failure case.
No attempt can produce a valid index for an empty interval.
Every successful bounded sample lies in the intended integer box with the exact dimension.