Documentation

CslibFrontier.Crypto.Game.HiddenBit

Guessing a hidden bit #

A distinguishing game between two experiments e false and e true has a bit-guessing form: draw a uniform hidden bit b, run e b and win when the output equals b. Experiment.guessBit e is that experiment. The distinguishing advantage is twice the bias of the bit-guessing experiment over a fair coin, and a guess that does not depend on the hidden bit is right with probability exactly one half.

Main definitions #

Main results #

theorem Cslib.Crypto.Game.succProbability_uniform_bool_beq (g : Bool → Game) :
↑(succProbability ((Probability.PMF.uniformOfFintype Bool).bind fun (bit : Bool) => PMF.map (fun (guess : Bool) => guess == bit) (g bit))) = (1 - ↑(g false).succProbability + ↑(g true).succProbability) / 2

For any Boolean-indexed family of games g : Bool → Game, sampling a uniform hidden bit bit ← PMF.uniformOfFintype Bool and outputting guess == bit for guess ← g bit succeeds with probability (1 - succProbability (g false) + succProbability (g true)) / 2. This is succProbability_uniform_bool_xor with the complementary output convention.

The advantage between g false and g true is twice the guessing advantage of the game that guesses a uniform hidden bit bit with the output of g bit.

Guessing a uniform hidden bit with a guess drawn from m, independently of the bit, leaves the outcome a fair coin.

The bit-guessing form of the experiments e false and e true: draw a uniform hidden bit b, run e b and return whether its output equals b.

The advantage between e false and e true is twice the guessing advantage of their bit-guessing form.