Documentation

CslibFrontier.Crypto.Computational.PseudorandomFunction.PrefixHybrid.Eager

Eager tables for prefix hybrids #

Sampling a prefix label at its first use has the same law as reading it from an independent uniform table sampled before the client runs. Table indices must encode the actual prefixes, including their lengths. This lets the fixed-width GGM expansion and the variable-length cascade use the same argument with different finite index types.

For the cascade this is the eager hybrid rule in [BS23], v0.6, Section 4.6.1 (printed pp. 152–153), applied at a whole-block cut as in Section 6.4.2 (printed pp. 229–230). The equality includes adaptive queries and the client's private coins.

theorem Cslib.Crypto.prefixLabelGame_eq_eager {α Q : Type} [Fintype Q] [DecidableEq Q] (key : Q ↪ List Bool) (index : List Bool → Q) (valid : List Bool → Bool) (cut width : ℕ) (hkey : ∀ (query : List Bool), valid query = true → key (index query) = List.take cut query) (respond : List Bool → List Bool → List Bool) (program : Probability.WordOracleComp Unit α) :
PMF.map Prod.fst ((OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifOracle k)) fun (request : Unit × List Bool) (cache : List (List Bool × List Bool)) => if valid request.2 = true then PMF.map (fun (x : List Bool × List (List Bool × List Bool)) => match x with | (label, next) => (respond request.2 label, next)) (memoize (fun (x : List Bool) => BitString.uniformList width) (List.take cut request.2) cache) else PMF.pure ([], cache)) program).run []) = (Probability.PMF.uniformOfFintype (Q → BitString width)).bind fun (table : Q → BitString width) => OracleComp.interpret (OracleComp.sumHandler ProbComp.unifOracle fun (request : Unit × List Bool) => PMF.pure (if valid request.2 = true then respond request.2 (List.ofFn (table (index request.2))) else [])) program

An injective encoding of the visited prefixes identifies a lazy prefix-label cache with a uniform table. The reply can depend on the whole query as well as its label. Invalid queries return the empty word on both sides.

theorem Cslib.Crypto.eval_prefixHybridGame_eq_eager_of_index {Q : Type} [Fintype Q] [DecidableEq Q] (key : Q ↪ List Bool) (index : List Bool → Q) (valid : ℕ → List Bool → Bool) (family : List Bool → List Bool → List Bool) (adversary : OracleDistinguisher) (n cut : ℕ) (hkey : ∀ (query : List Bool), valid n query = true → key (index query) = List.take cut query) :
(prefixHybridGame valid family adversary n cut).eval = (Probability.PMF.uniformOfFintype (Q → BitString n)).bind fun (table : Q → BitString n) => OracleComp.interpret (OracleComp.sumHandler ProbComp.unifOracle fun (request : Unit × List Bool) => PMF.pure (if valid n request.2 = true then family (List.ofFn (table (index request.2))) (List.drop cut request.2) else [])) (adversary n [])

Use a finite index for the prefixes that valid queries can visit.

theorem Cslib.Crypto.eval_prefixHybridGame_eq_eager (valid : ℕ → List Bool → Bool) (family : List Bool → List Bool → List Bool) (adversary : OracleDistinguisher) (n cut : ℕ) [Fintype { word : List Bool // word.length ≤ cut }] :
(prefixHybridGame valid family adversary n cut).eval = (Probability.PMF.uniformOfFintype ({ word : List Bool // word.length ≤ cut } → BitString n)).bind fun (table : { word : List Bool // word.length ≤ cut } → BitString n) => OracleComp.interpret (OracleComp.sumHandler ProbComp.unifOracle fun (request : Unit × List Bool) => PMF.pure (if valid n request.2 = true then family (List.ofFn (table ⟨List.take cut request.2, ⋯⟩)) (List.drop cut request.2) else [])) (adversary n [])

Sample one independent label per bit word of length at most cut. A query shorter than the cut uses its entire word as its index, and a longer query uses its truncated prefix.