Documentation

CslibFrontier.Crypto.Game.RepeatedInversion

Repeated one-way inversion #

The repeated one-way game (repeatedInversionExperiment, [BS23], Attack Game 13.3, p. 539) draws t independent inputs, publishes their images, answers reveal queries with the corresponding seeds, and asks for a preimage of an unrevealed image. It coincides with the d = 1 case (repeatedIterateExperiment_one) of repeatedIterateExperiment, which treats n chains of d iterates as in the iterated generalization of [BS23], Exercise 14.15 (p. 612).

Relative to [BS23], both games take arbitrary t, n, d : ℕ, any seed sampler sample : ProbComp X rather than uniform, and 0-based indices idx q : ℕ; out-of-range reveals return default (or f^[idx q % d] default) and out-of-range claims lose (none). At d = 0 the chain game is degenerate: idx q / 0 = 0 and idx q % 0 = idx q, so every slot lies on chain 0 and the published values are the seeds. On top of that, repeatedIterateExperiment and repeatedIterateUnrevealedExperiment diverge from Exercise 14.15 in three respects (checked in CslibFrontierTests.Crypto.Game.RepeatedInversion):

  1. A claim for slot (i, j) (0 ≤ j < d) checks f^[d - j] x = y_i, so only 1 ≤ b ≤ d is modeled (b > d is not analysed); forbidding reveals at or below the claimed slot compares idx q % d < idx r.1 % d rather than the printed b' ≤ b.
  2. Reveals address 0 ≤ j < d, so the book's j = d (the public value) cannot be requested (slot i * d + d is the next chain's seed, or out-of-range for the last chain).
  3. For non-injective f, a revealed value above the claimed slot can sit past a merge with a side chain, so chainConsistent additionally requires x to iterate to every revealed value above it on its chain (coinciding with chainUnrevealed when f is injective and 0 < d, succProbability_repeatedIterateUnrevealedExperiment_of_injective).

Main definitions #

Main results #

References #

Chains and slots #

def Cslib.Crypto.chainSlot {X : Type} [Inhabited X] (f : X → X) (d : ℕ) (xs : List X) (k : ℕ) :
X

The value of slot k of the chains with seeds xs: position k % d of chain k / d, that is, f^[k % d] of the seed. A slot outside the range holds the iterate of default.

def Cslib.Crypto.chainKeyGen {X : Type} (sample : ProbComp X) (f : X → X) (n d : ℕ) :

Draw n seeds and publish the top f^[d] x of each chain.

def Cslib.Crypto.chainVerify {X : Type} [DecidableEq X] (f : X → X) (d : ℕ) (ys : List X) (k : ℕ) (x : X) :

x, claimed for slot k, leads to the published top of its chain.

def Cslib.Crypto.chainUnrevealed {Q X : Type} (idx : Q → ℕ) (d : ℕ) (q : Q) :
X → (log : List (Q × X)) → Bool

No slot at or below slot idx q on its chain was revealed (the condition of [BS23], Exercise 14.15, with the index corrected).

def Cslib.Crypto.chainConsistent {Q X : Type} [DecidableEq X] (idx : Q → ℕ) (f : X → X) (d : ℕ) (q : Q) (x : X) (log : List (Q × X)) :

chainUnrevealed, and x leads to every value revealed on its chain.

def Cslib.Crypto.chainSigner {Q X : Type} [Inhabited X] (idx : Q → ℕ) (f : X → X) (d : ℕ) :
Signer (List X) Q X

The reveal oracle: a request q is answered with slot idx q.

def Cslib.Crypto.repeatedIterateExperiment {Q X : Type} [Inhabited X] [DecidableEq X] (idx : Q → ℕ) (sample : ProbComp X) (f : X → X) (n d : ℕ) (A : List X → ProbOracleComp (fun (x : Q) => X) (Q × X)) :

The repeated game on n chains of d iterates of f, with the chain-consistent winning condition.

def Cslib.Crypto.repeatedIterateUnrevealedExperiment {Q X : Type} [Inhabited X] [DecidableEq X] (idx : Q → ℕ) (sample : ProbComp X) (f : X → X) (n d : ℕ) (A : List X → ProbOracleComp (fun (x : Q) => X) (Q × X)) :

The same game with the unrevealed winning condition of Exercise 14.15 (index corrected).

def Cslib.Crypto.repeatedInversionExperiment {Q X : Type} [Inhabited X] {Y : Type} [DecidableEq Y] (idx : Q → ℕ) (sample : ProbComp X) (f : X → Y) (t : ℕ) (A : List Y → ProbOracleComp (fun (x : Q) => X) (Q × X)) :

Attack Game 13.3 ([BS23], p. 539), generalized to arbitrary t : ℕ, any seed sampler sample, and 0-based reveal/claim indices idx q (out-of-range reveals return default and out-of-range claims lose).

theorem Cslib.Crypto.repeatedIterateExperiment_one {Q X : Type} [Inhabited X] [DecidableEq X] (idx : Q → ℕ) (sample : ProbComp X) (f : X → X) (t : ℕ) (A : List X → ProbOracleComp (fun (x : Q) => X) (Q × X)) :
repeatedIterateExperiment idx sample f t 1 A = repeatedInversionExperiment idx sample f t A

At d = 1 the chain game is Attack Game 13.3.

The unrevealed winning condition #

theorem Cslib.Crypto.succProbability_repeatedIterateExperiment_le_unrevealed {Q X : Type} [Inhabited X] [DecidableEq X] (idx : Q → ℕ) (sample : ProbComp X) (f : X → X) (n d : ℕ) (A : List X → ProbOracleComp (fun (x : Q) => X) (Q × X)) :

The chain-consistent condition is the stronger one.

theorem Cslib.Crypto.succProbability_repeatedIterateUnrevealedExperiment_of_injective {Q X : Type} [Inhabited X] [DecidableEq X] (idx : Q → ℕ) (sample : ProbComp X) {f : X → X} (hf : Function.Injective f) (n : ℕ) {d : ℕ} (hd : 0 < d) (A : List X → ProbOracleComp (fun (x : Q) => X) (Q × X)) :

For an injective f and 0 < d, the two conditions give the same success probability.