Documentation

GaudisCrypt.Lib.EC.DUniform

EasyCrypt's duniform (theories/distributions/Distr.ec, theory MUniform) #

duniform s: the uniform distribution on the elements of the list s (the empty sub-distribution for the empty list), with EC's duniform1E and duniformE; and the list operations they are stated with, undup and count. Names are EasyCrypt's.

def GaudisCrypt.EC.undup {α : Type} [DecidableEq α] (s : List α) :
List α

op undup: the list without its duplicates.

Equations
Instances For
    def GaudisCrypt.EC.count {α : Type} (p : α → Prop) [DecidablePred p] (s : List α) :

    op count: the number of elements of s that satisfy p.

    Equations
    Instances For
      noncomputable def GaudisCrypt.EC.duniform {α : Type} [DecidableEq α] (s : List α) :

      op duniform (s : 'a list): the uniform distribution on the elements of s.

      Equations
      Instances For
        theorem GaudisCrypt.EC.duniform_apply {α : Type} [DecidableEq α] (s : List α) (x : α) :
        ↑(duniform s) {x} = if x ∈ s then (↑s.toFinset.card)⁻¹ else 0

        The mass of a point under duniform s.

        theorem GaudisCrypt.EC.duniform_expected {α : Type} [DecidableEq α] (s : List α) (f : α → ENNReal) :
        (duniform s).expected f = ∑ x ∈ s.toFinset, f x / ↑s.toFinset.card

        The expected value under duniform s: the average over the elements of s.

        theorem GaudisCrypt.EC.duniform1E {α : Type} [DecidableEq α] (s : List α) (x : α) :
        mu1 (duniform s) x = if x ∈ s then 1 / ↑(size (undup s)) else 0

        lemma duniform1E.

        theorem GaudisCrypt.EC.duniformE {α : Type} [DecidableEq α] (s : List α) (E : α → Prop) [DecidablePred E] :
        mu (duniform s) E = ↑(count E (undup s)) / ↑(size (undup s))

        lemma duniformE.