Documentation

GaudisCrypt.Lib.EC.Dexcepted

EasyCrypt's excepted distributions (theories/distributions/Dexcepted.ec) #

d \ P is dexcepted d P (Distr.lean). Only what ported developments use is here: its expectation, losslessness, and the two-step sampling identity of the theory TwoStepSampling (stated on distributions; EasyCrypt's module S and its procedures direct/indirect are replaced by the distributions they sample).

theorem GaudisCrypt.EC.dexcepted_expected {α : Type} (d : SubProbability α) (P : α → Prop) (hd : is_lossless d) (hex : ∃ (a : α), ¬P a ∧ ↑d {a} ≠ 0) (F : α → ENNReal) :
(dexcepted d P).expected F = (∑' (a : α), if P a then 0 else ↑d {a} * F a) * (∑' (a : α), if P a then 0 else ↑d {a})⁻¹

The expectation under d \ P: the restriction of d to ¬ P, normalized.

theorem GaudisCrypt.EC.dexcepted_ll {α : Type} (d : SubProbability α) (P : α → Prop) (hd : is_lossless d) (hex : ∃ (a : α), ¬P a ∧ ↑d {a} ≠ 0) :

lemma dexcepted_ll: d \ P is lossless when d is and some ¬ P outcome has positive probability (EC's mu d P < mu d predT).

theorem GaudisCrypt.EC.dexcepted_indirect {α : Type} (d : SubProbability α) (P : α → Prop) (hd : is_lossless d) :
(do let r ← d if P r then dexcepted d P else pure r) = dexcepted d P

EC's TwoStepSampling.ll_direct_indirect_eq (for dt _ = d), as an equality of distributions: sampling d, and resampling from d \ P if the draw is in P, is sampling d \ P (d lossless).