Biased coins: a non-uniform coupling worked out #
bernoulli p is the coin that comes up true with probability p. For p ≠ 1/2
it is not the uniform distribution on Bool, and no bijection of Bool carries
it to itself, so liftR_uniform_bij and rHoare_bij_step cannot relate two
differently-biased coins. Negation does carry bernoulli p to bernoulli (1 - p),
which is a pushforward coupling: rHoare_bernoulli_flip turns it into a pRHL
sampling step, and bernoulli_flip_program_eq shows a bernoulli p sample can be
renamed as the negation of a bernoulli (1 - p) sample inside any program.
Main results #
bernoulli_apply_true,bernoulli_apply_false— the two massesbernoulli_ne_uniform,bernoulli_third_ne_uniform— a coin whose two masses differ is not uniformbernoulli_bind_not— negation pushesbernoulli ptobernoulli (1 - p)liftR_bernoulli_not— the resulting couplingrHoare_bernoulli_flip— the pRHL sampling stepbernoulli_flip_program_eq— the two programs are equalprTrue_bernoulli_bind,prTrue_bernoulli— the unary averaging rule applied
The distribution #
sampleFrom (bernoulli p) never fails.
A Bernoulli coin can be uniform only if its two masses agree.
The coupling #
bernoulli p and bernoulli (1 - p) are coupled by Boolean negation.
Unlike the uniform bijection coupling, the two marginals here are different
distributions: negation is a bijection of Bool that does not preserve
bernoulli p unless p = 1/2.
The pRHL step #
pRHL sampling step for two coins of complementary bias: a bernoulli p
sample on the left is matched by the negated bernoulli (1 - p) sample on the
right.
Sampling bernoulli p and negating is sampling bernoulli (1 - p), inside an
arbitrary continuation. Derived from the coupling step at eqPre/eqPost.
The unary rule applied #
The success probability of a game that starts with a biased coin is the
p-weighted average of the two branch probabilities.
A biased coin returns true with probability exactly p.
Cross-check of the coupling against the unary rule: negating a bernoulli p
coin is a bernoulli (1 - p) coin, both routes giving 1 - p.
Satisfiability witness #
The hypotheses of rHoare_bernoulli_flip are inhabited at a concretely
non-uniform bias: p = 1/3 gives a coupling of the 1/3-coin with the
2/3-coin, and bernoulli_ne_uniform shows the 1/3-coin is not uniform, so the
step is not a disguised uniform one.
1/3 ≠ 2/3, transported to ℝ≥0∞.
The 1/3-coin is not the uniform distribution on Bool.
A concrete coupling of the 1/3-coin with the 2/3-coin. Its two marginals
are distinct distributions, and the left one is not uniform
(bernoulli_third_ne_uniform).
The two marginals of liftR_bernoulli_third differ.