Shared word-forger adapter and state-simulation bridge #
Word-level cryptographic games run a Forger against a stateful word oracle (StateT σ ProbComp),
whereas typed forgery experiments (forgeExperiment) run a ProbOracleComp adversary via
ProbOracleComp.runLogWith against a logging signer. This module provides the shared word-forger
adapter Forger.toTyped and the representation-polymorphic simulation lemma
Forger.eval_runLogWith_rename_state consumed by both MAC and Signature/Bridge.
Main definitions #
Cslib.Crypto.Forger.toTyped: view a word-levelForgerat security parameternas a typed forger forwardingrequest.2to the signing/tagging oracle while leaving coin tosses unchanged.
Main results #
Cslib.Crypto.Forger.eval_runLogWith_rename_state: running a word oracle program with renamed requests against a logging signer, and mapping the log byrepresent, has the same distribution as running it against the word oracle whose state isrepresent logwhenever each oracle step agrees underrepresent.
theorem Cslib.Crypto.Forger.eval_runLogWith_rename_state {Q σ α : Type} (program : Probability.WordOracleComp Unit α) (decode : List Bool → Q) (signer : List (Q × List Bool) → Q → Option (ProbComp (List Bool))) (oracle : Unit × List Bool → StateT σ ProbComp (List Bool)) (represent : List (Q × List Bool) → σ) (step :
∀ (request : Unit × List Bool) (log : List (Q × List Bool)),
PMF.map
(fun (x : List Bool × List (Q × List Bool)) =>
match x with
| (a, log') => (a, represent log'))
(ProbOracleComp.logOracle signer (decode request.2) log).eval = (oracle request (represent log)).eval) :
PMF.map
(fun (x : α × List (Q × List Bool)) =>
match x with
| (a, log) => (a, represent log))
((OracleComp.interpret
(OracleComp.sumHandler (fun (k : ℕ) => OracleComp.query (Sum.inl k)) fun (request : Unit × List Bool) =>
ProbOracleComp.query (decode request.2))
program).runLogWith
signer).eval = ((OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifFin k)) oracle) program).run
(represent [])).eval
Running a word forger with renamed requests against a logging signer, and mapping the log by
represent, is running it against the word oracle whose state is represent log whenever each
oracle call agrees under represent.