Documentation

CslibFrontier.Crypto.Primitives.PRF.Invertible

Invertible pseudorandom functions #

An invertible pseudorandom function (iPRF) from domain D to range R with keyspace Key (Hoover, Patel, Persiano and Yeo, Section 4, Definition 4.1) consists of a randomized key generation algorithm gen : ProbComp Key, a deterministic forward evaluation function eval : Key → D → R, and a deterministic inverse function inv : Key → R → Finset D returning the preimage set of a range element y : R under eval k.

What is not proved #

References #

An invertible pseudorandom function (iPRF) from domain D to range R with keyspace Key (Hoover, Patel, Persiano and Yeo, Section 4, Definition 4.1).

  • gen : ProbComp Key

    Randomized key generation algorithm Gen.

  • eval : Key → D → R

    Deterministic forward evaluation F : Key → D → R.

  • inv : Key → R → Finset D

    Deterministic inverse evaluation F⁻¹ : Key → R → Finset D.

Inversion correctness (Definition 4.1) #

def Cslib.Crypto.PRF.InvertiblePRF.IsCorrectKey {Key D R : Type} (iF : InvertiblePRF Key D R) (k : Key) :

Exact inversion correctness for a fixed key k : Key: x ∈ iF.inv k y holds if and only if iF.eval k x = y (Hoover, Patel, Persiano and Yeo, Definition 4.1 & Corollary 4.5).

Unconditional inversion correctness across all keys k : Key.

Inversion correctness on all keys in the support of iF.gen (the probability-one form of Hoover, Patel, Persiano and Yeo, Definition 4.1).

theorem Cslib.Crypto.PRF.InvertiblePRF.isCorrectKey_iff_inv_eq {Key D R : Type} [Fintype D] [DecidableEq R] (iF : InvertiblePRF Key D R) (k : Key) :
iF.IsCorrectKey k ↔ ∀ (y : R), iF.inv k y = {x : D | iF.eval k x = y}

On a finite domain D, iF.IsCorrectKey k holds if and only if iF.inv k y equals the exact preimage filter {x ∈ D | iF.eval k x = y} for every y : R (Hoover, Patel, Persiano and Yeo, Definition 4.1).

theorem Cslib.Crypto.PRF.InvertiblePRF.IsCorrectKey.inv_eq_filter {Key D R : Type} [Fintype D] [DecidableEq R] {iF : InvertiblePRF Key D R} {k : Key} (hk : iF.IsCorrectKey k) (y : R) :
iF.inv k y = {x : D | iF.eval k x = y}

Ideal random-function iPRF #

noncomputable def Cslib.Crypto.PRF.idealInvertiblePRF (D R : Type) [Fintype D] [DecidableEq D] [Fintype R] [DecidableEq R] [Nonempty R] :
InvertiblePRF (D → R) D R

The ideal random-function instantiation of an iPRF on finite types D and R: keys are functions f : D → R sampled uniformly, forward evaluation is function application f x, and inverse evaluation returns the exact preimage set Finset.univ.filter (fun x => f x = y).

Composition with a keyed permutation (Theorem 4.4 and Corollary 4.5) #

def Cslib.Crypto.PRF.InvertiblePRF.compose {Key₁ Key₂ D R : Type} [DecidableEq D] (genP : ProbComp Key₁) (P Pinv : Key₁ → D → D) (S : InvertiblePRF Key₂ D R) :
InvertiblePRF (Key₁ × Key₂) D R

Theorem 4.4 / Corollary 4.5 composition (Hoover, Patel, Persiano and Yeo, Section 4.2): composes a keyed permutation (genP, P, Pinv) on domain D with an invertible function / multinomial sampler S : InvertiblePRF Key₂ D R via

  • gen = (genP, S.gen)
  • eval (k₁, k₂) x = S.eval k₂ (P k₁ x)
  • inv (k₁, k₂) y = {Pinv k₁ z | z ∈ S.inv k₂ y}.
theorem Cslib.Crypto.PRF.InvertiblePRF.isCorrectKey_compose {Key₁ Key₂ D R : Type} [DecidableEq D] {genP : ProbComp Key₁} {P Pinv : Key₁ → D → D} {S : InvertiblePRF Key₂ D R} {k₁ : Key₁} {k₂ : Key₂} (hleft : Function.LeftInverse (Pinv k₁) (P k₁)) (hright : Function.RightInverse (Pinv k₁) (P k₁)) (hS : S.IsCorrectKey k₂) :
(compose genP P Pinv S).IsCorrectKey (k₁, k₂)

Inversion correctness of the Theorem 4.4 composition (per-key form): if P k₁ and Pinv k₁ are mutual inverses on D and S is correct at k₂, then S.compose genP P Pinv is correct at (k₁, k₂).

theorem Cslib.Crypto.PRF.InvertiblePRF.isCorrect_compose {Key₁ Key₂ D R : Type} [DecidableEq D] {genP : ProbComp Key₁} {P Pinv : Key₁ → D → D} {S : InvertiblePRF Key₂ D R} (hP : ∀ (k₁ : Key₁), Function.LeftInverse (Pinv k₁) (P k₁) ∧ Function.RightInverse (Pinv k₁) (P k₁)) (hS : S.IsCorrect) :
(compose genP P Pinv S).IsCorrect

Inversion correctness of the Theorem 4.4 composition (all-key form): if P k₁ and Pinv k₁ are mutual inverses for every key k₁ and S.IsCorrect holds, then (S.compose genP P Pinv).IsCorrect holds.

theorem Cslib.Crypto.PRF.InvertiblePRF.isCorrectOnGen_compose {Key₁ Key₂ D R : Type} [DecidableEq D] {genP : ProbComp Key₁} {P Pinv : Key₁ → D → D} {S : InvertiblePRF Key₂ D R} (hP : ∀ k₁ ∈ genP.eval.support, Function.LeftInverse (Pinv k₁) (P k₁) ∧ Function.RightInverse (Pinv k₁) (P k₁)) (hS : S.IsCorrectOnGen) :
(compose genP P Pinv S).IsCorrectOnGen

Inversion correctness of the Theorem 4.4 composition (gen-support form): if P k₁ and Pinv k₁ are mutual inverses on the support of genP and S.IsCorrectOnGen holds, then (S.compose genP P Pinv).IsCorrectOnGen holds.

def Cslib.Crypto.PRF.InvertiblePRF.composePerm {Key₁ Key₂ D R : Type} [DecidableEq D] (genP : ProbComp Key₁) (E : Key₁ → Equiv.Perm D) (S : InvertiblePRF Key₂ D R) :
InvertiblePRF (Key₁ × Key₂) D R

Specialization of InvertiblePRF.compose to a keyed permutation family E : Key₁ → Equiv.Perm D (matching Cslib.Crypto.PRP).

theorem Cslib.Crypto.PRF.InvertiblePRF.isCorrectKey_composePerm {Key₁ Key₂ D R : Type} [DecidableEq D] (genP : ProbComp Key₁) (E : Key₁ → Equiv.Perm D) {S : InvertiblePRF Key₂ D R} (k₁ : Key₁) {k₂ : Key₂} (hS : S.IsCorrectKey k₂) :
(composePerm genP E S).IsCorrectKey (k₁, k₂)
theorem Cslib.Crypto.PRF.InvertiblePRF.isCorrect_composePerm {Key₁ Key₂ D R : Type} [DecidableEq D] (genP : ProbComp Key₁) (E : Key₁ → Equiv.Perm D) {S : InvertiblePRF Key₂ D R} (hS : S.IsCorrect) :