Documentation

GaudisCrypt.Logic.ECRnd

EC's rnd f g #

rnd f g.

on c₁; x <$ d₁ ~ c₂; y <$ d₂ : P ==> Q couples the two samplings along the bijection f with inverse g, and leaves EC's three conditions in the postcondition of the code before:

(forall rR, rR \in d₂ => rR = f (g rR)) /\
(forall rR, rR \in d₂ => mu1 d₂ rR = mu1 d₁ (g rR)) /\
(forall rL, rL \in d₁ => f rL \in d₂ /\ rL = g (f rL) /\ Q[x := rL, y := f rL])

equiv_rnd f (Logic/PRHLWp.lean) asks instead that f push d₁ to d₂, an equation of distributions that is found for a few shapes of f on the uniform distribution; with the inverse, the conditions are EC's equations.

theorem GaudisCrypt.SubProbability.bind_pure_eq_of_inv {α β : Type} (d₁ : SubProbability α) (d₂ : SubProbability β) (f : α → β) (g : β → α) (h1 : ∀ b ∈ d₂.support, b = f (g b)) (h2 : ∀ b ∈ d₂.support, EC.mu1 d₂ b = EC.mu1 d₁ (g b)) (h3 : ∀ a ∈ d₁.support, f a ∈ d₂.support ∧ a = g (f a)) :
(do let a ← d₁ pure (f a)) = d₂

A bijection between the supports that keeps the point masses pushes d₁ to d₂ (EC's conditions of rnd f g).

@[simp]

The uniform distribution gives all values the same probability: EC's condition mu1 d₂ rR = mu1 d₁ (g rR) of rnd f g for two uniform samplings.

@[simp]

The same for {0,1}.

@[simp]

{0,1} charges both values (EC's dbool_fu), for the conditions of rnd on a coin.

EC's rnd f g: the last statements of both sides are samplings x₁ <$ d₁, x₂ <$ d₂, coupled along f with inverse g (prhlStmt_seq_sample_inv): the postcondition before them is EC's three conditions. f, g are relational terms (§x{1}, §x{2}).

Equations
  • One or more equations did not get rendered due to their size.
Instances For