Documentation

GaudisCrypt.Lib.EC.DInterval

EasyCrypt's DInterval (theories/distributions/DInterval.ec) #

dinter i j (EC's [i..j]): the uniform distribution on the integers from i to j. Only what ported developments use is here. Names are EasyCrypt's.

theorem GaudisCrypt.EC.range_nodup (m n : ℤ) :
(range m n).Nodup

The elements of range m n are distinct.

theorem GaudisCrypt.EC.undup_range (m n : ℤ) :
undup (range m n) = range m n

undup (range m n) = range m n.

theorem GaudisCrypt.EC.duniform_ll {α : Type} [DecidableEq α] (s : List α) (hs : s ≠ []) :

duniform s is lossless for a list with an element.

noncomputable def GaudisCrypt.EC.dinter (i j : ℤ) :

op dinter (i j : int) = duniform (range i (j + 1)): EC's [i..j].

Equations
Instances For
    theorem GaudisCrypt.EC.dinter1E (i j x : ℤ) :
    mu1 (dinter i j) x = if i ≤ x ∧ x ≤ j then 1 / ↑(j - i + 1) else 0

    lemma dinter1E.

    theorem GaudisCrypt.SubProbability.ext_singleton {α : Type} {μ ν : SubProbability α} (h : ∀ (x : α), ↑μ {x} = ↑ν {x}) :
    μ = ν

    Sub-distributions with the same point masses are equal.

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

    lemma dexcepted1E, as a point mass: the mass of x under d \ P is 0 on P, else that under d divided by the mass d gives to ¬ P.

    theorem GaudisCrypt.EC.dinter_apply (i j x : ℤ) :
    ↑(dinter i j) {x} = if i ≤ x ∧ x ≤ j then (↑(range i (j + 1)).toFinset.card)⁻¹ else 0

    The mass of a point of the interval under dinter i j.

    theorem GaudisCrypt.EC.dinter_dexcepted (i j i' j' : ℤ) (h : i ≤ i' ∧ i' ≤ j' ∧ j' ≤ j) :
    (dexcepted (dinter i j) fun (v : ℤ) => ¬(i' ≤ v ∧ v ≤ j')) = dinter i' j'

    The uniform distribution on an interval, conditioned on a sub-interval, is the uniform distribution on the sub-interval (what EC computes with dexcepted1E, weight_dinter, dinter1E, dinterE in Dice4_6.ec's D4_Sample).