Interactive machines with private coins #
An interactive machine M : UC.Machine I E is a stateful probabilistic program that exports
the interface E and imports the interface I. It samples an initial private state with
M.init, and each activation M.handle q answers one query q of E: it may draw private
coins, call I, and update its state. Activations are ProbOracleComp I programs, so a machine is
a program in the sense of CslibFrontier/Languages/Probabilistic/Semantics.lean, not a
distribution.
A machine importing OracleSpec.empty is closed.
These machines are the parties, protocols, ideal functionalities, adversaries and simulators of
the universal-composability (UC) execution in CslibFrontier.Crypto.Protocols.UC.Execution. Their
composition follows the package algebra of state-separating proofs: Machine.comp A P answers each
query of A by running A's activation with its imported calls answered by P, and
Machine.link M Z runs a program Z over E with its calls answered by M, which removes the
interface E.
A budget M.IsBounded t says that the initial sampler and every activation make at most t
calls on every path, counting private samples and calls to I alike
(OracleComp.IsQueryBounded). As everywhere in this library, a call budget bounds interaction, not
running time: pure computation between calls, message sizes and state growth are free.
Main definitions #
Cslib.Crypto.Protocols.UC.Machine: a stateful interactive machine with private coins.Cslib.Crypto.Protocols.UC.Machine.handler,Cslib.Crypto.Protocols.UC.Machine.runFrom: the handler answering the private samples and exported calls of a program, and the stateful run from a given state.Cslib.Crypto.Protocols.UC.Machine.link: run a program against a machine, sampling its initial state.Cslib.Crypto.Protocols.UC.Machine.comp: sequential composition of machines.Cslib.Crypto.Protocols.UC.Machine.id: the machine forwarding every query unchanged.Cslib.Crypto.Protocols.UC.Machine.run: the closed probabilistic program of a program run against a closed machine.Cslib.Crypto.Protocols.UC.Machine.IsBounded: a per-activation call budget.
Main results #
Cslib.Crypto.Protocols.UC.Machine.IsBounded.mono: budgets are monotone.Cslib.Crypto.Protocols.UC.Machine.isBounded_id: the forwarding machine makes one call per activation.Cslib.Crypto.Protocols.UC.Machine.isQueryBounded_closeProgram: closing a program with no imports preserves its call budget.Cslib.Crypto.Protocols.UC.Machine.runFrom_interpret_intertwine,Cslib.Crypto.Protocols.UC.Machine.runFrom_intertwine,Cslib.Crypto.Protocols.UC.Machine.closeEval_runFrom_interpret_le_intertwine,Cslib.Crypto.Protocols.UC.Machine.closeEval_runFrom_le_intertwine: exact and sub-probability state-intertwining laws forMachine.runFrom.Cslib.Crypto.Protocols.UC.Machine.runFrom_interpret_stripNoop,Cslib.Crypto.Protocols.UC.Machine.run_interpret_stripNoop: replacing state-preserving no-op queries bypureleavesMachine.runFromandMachine.runinvariant.
References #
- C. Brzuska, A. Delignat-Lavaud, C. Fournet, K. Kohbrok, M. Kohlweiss, State Separation for Code-Based Game-Playing Proofs: the package algebra.
- R. Canetti, Universally Composable Security: the machines play the role of the interactive Turing machines of the UC framework.
An interactive machine exporting the interface E and importing the interface I: a private
state sampled by init, and for each query q of E an activation that answers it with private
coins, calls to I and an updated state.
- State : Type
The private state.
The initial state sampler.
The activation answering a query of the exported interface.
Run a program over E against M from the state s, returning its result and M's final
state.
Run a program over E against M, starting from a fresh initial state. The exported interface
disappears; what remains calls M's imported interface.
Sequential composition: A.comp P answers a query of A's exported interface by running A's
activation, whose calls to the interface J are answered by P. The imported machine P is
initialized first, as when a program is linked against A and the result against P.
The stateless machine forwarding every query of E to its imported copy of E.
A program with private coins and no external calls, as a closed probabilistic program.
The closed probabilistic program of a program over E run against the closed machine M.
Running programs against machines #
Sequencing runs the second program from the state the first one reached.
Postprocessing the result keeps the machine's final state.
A private sample of the program stays a private sample and leaves the machine untouched.
Closing a returned value returns it.
Closing commutes with sequencing.
Closing commutes with postprocessing.
An embedded closed program is unchanged by closing.
Close an empty-spec probabilistic computation and return its PMF.
Closing a bind distributes over PMF.bind.
Closing a mapped program maps the PMF.
Closing a sampled ProbComp evaluates it directly.
Support of closeEval (p >>= next).
Support of closeEval (f <$> p).
Pointwise monotonicity of closeEval across a shared prefix p.
Support invariant for closeEval (M.runFrom prog s) under a reflexive, transitive state
relation preserved by every allowed machine query.
Two machines M₁ and M₂ sharing an imported interface I, a state invariant R, and a
query invariant Inv produce related post-run continuations when translating an O-program via
h₁ and h₂ preserves R at each Inv-satisfying query.
Direct (uninterpreted) state-intertwining specialization of
Machine.runFrom_interpret_intertwine for two machines sharing an exported interface E.
Interpreting a program through a handler strip whose runs from every state agree with
M.handle leaves M.runFrom unchanged.
Interpreting a program through a handler strip whose runs from every state agree with
M.handle (for instance, replacing state-preserving pure no-op queries with pure) leaves
M.run unchanged.
Sub-probability (clamped) state-intertwining for closeEval: two closed machines M₁ and
M₂ sharing a state relation R, an absorbing trap predicate Trap on M₁ where f assigns
zero mass to y, and a query invariant Inv satisfy the pointwise PMF bound at y whenever
each Inv-satisfying query preserves the bound across R or lands in Trap.
Direct (uninterpreted) specialization of
Machine.closeEval_runFrom_interpret_le_intertwine for two closed machines sharing an exported
interface E.
Closing a program with no external imports preserves its query budget.