Sums of oracle interfaces #
A program may call two interfaces at once: a query of spec₁ ⊕ₒ spec₂ is a query of either,
answered as there. A program with private coins is the main instance (probOracleSpec), with
uniform sampling on the left; a forger calling a signer and a hash function, and the prover and
verifier oracles of an interactive protocol, are others.
OracleComp.sumHandler left right answers the two kinds of call with handlers in the same monad,
and OracleComp.liftLeft and OracleComp.liftRight embed a program over one side. Interpreting
an embedded program uses only the corresponding handler (interpret_sumHandler_liftLeft).
Main definitions #
Cslib.OracleSpec.sum, notationspec₁ ⊕ₒ spec₂: the disjoint sum of two interfaces.Cslib.OracleSpec.empty: the interface without queries.Cslib.OracleComp.sumHandler: answer the two sides with separate handlers.Cslib.OracleComp.liftLeft,Cslib.OracleComp.liftRight: embed a program over one side.
Main results #
Cslib.OracleComp.interpret_sumHandler_liftLeft,Cslib.OracleComp.interpret_sumHandler_liftRight: an embedded program uses only its own side's handler.Cslib.OracleComp.interpret_sumHandler: interpretation distributes over the two sides.
References #
- For the underlying oracle-program design, see the
VCVio credit in
Languages.Probabilistic.Basic.
The disjoint sum of two interfaces: a query of either, answered as there.
Instances For
The disjoint sum of two interfaces: a query of either, answered as there.
Instances For
The interface without queries, for a party that uses no oracle.
Instances For
Answer the calls of the left interface with left and those of the right with right.
Instances For
sumHandler answers a left query .inl q with left q.
sumHandler answers a right query .inr q with right q.
A program over the left interface, as a program over the sum.
Instances For
A program over the right interface, as a program over the sum.
Instances For
Lifting pure a from the left interface yields pure a.
Lifting pure a from the right interface yields pure a.
liftLeft commutes with monadic bind >>=.
liftRight commutes with monadic bind >>=.
liftLeft commutes with functorial map <$>.
liftRight commutes with functorial map <$>.
Lifting a single query query q from the left interface produces query (.inl q).
Lifting a single query query q from the right interface produces query (.inr q).
An embedded left program uses only the left handler.
An embedded right program uses only the right handler.
Interpretation distributes over the two sides of a combined handler.