Interactive (Oracle) Reductions #
This file defines the basic components of a public-coin Interactive Oracle Reduction (IOR). These are interactive protocols between two parties, a prover and a verifier, with the following format:
The protocol proceeds over a number of steps. In each step, either the prover or the verifier sends a message to the other. We assume that this sequence of interactions is fixed in advance, and is described by a protocol specification (see
ProtocolSpec.lean).Note that we do not require interleaving prover's messages with verifier's challenges, for maximum flexibility in defining reductions.
Both parties may have access to some shared oracle, which is modeled as an oracle specification
OracleSpec. These are often probabilistic sampling or random oracles.At the beginning, the prover and verifier both take in an input statement
StmtIn. There are a number of input oracle statementsOStmtInwhose underlying content is known to the prover, but is only available via an oracle interface to the verifier. The prover also takes in a private witnessWitIn.During the interaction, the verifier is assumed to always send uniformly random challenges to the prover. The prover will send messages, which is either available in full to the verifier, or received as oracles. Which is which is specified by the protocol specification.
At the end of the interaction, the verifier performs a computation that outputs a new statement
StmtOut, and specify a subset of the oracles it has received to be the output oracle statements.
Our formulation of IORs can be seen in the literature as F-IORs, where F denotes an arbitrary
class of oracles. See the blueprint for more details about our modeling choices.
We can then specialize our definition to obtain specific instantiations in the literature:
- Interactive Reductions (IRs) are a special kind of IORs where all of the prover's messages are available in full.
- Interactive Oracle Proofs (IOPs) are a special kind of IORs where the output statement is
Boolean (i.e.
accept/reject), there is no oracle output statements, and the output witness is trivial. - Further specialization of IOPs include Vector IOPs, Polynomial IOPs, and so on, are defined in downstream files. Note that vector IOPs is the original definition of IOPs [BCS16], while polynomial IOPs were later introduced in [BCG+19] and others.
- Interactive Proofs (IPs) are a combination of IRs and IOPs.
- Non-Interactive Reductions (for example, folding or accumulation schemes) are IRs with a single message from the prover.
- Non-Interactive Arguments of Knowledge (NARKs) are IPs with a single message from the prover.
We note that this file only defines the type signature of IORs. The semantics of executing an IOR
can be found in Execution.lean, while the security notions are found in the Security folder.
Note the appearance of the various dependencies in the type signatures:
oSpec : OracleSpec ιcomes first, as we expect this to be the ambient (fixed) shared oracle specification for the protocolStmtIncomes next, as the type of the input statement to the protocol- Then we have
OStmtInfor the type of the oracle input statements (for oracle reductions), followed byWitIn, the type of the input witness - Then we have
StmtOutfor the type of the output statement, followed byOStmtOutfor the type of the output oracle statements, and finallyWitOutfor the type of the output witness - Finally, we have
pSpec : ProtocolSpec n, which is the protocol specification for the (oracle) reduction
We arrange things in this way for potential future extensions, where later types may depend on
earlier types (i.e. WitIn, StmtOut, or pSpec may depend on StmtIn; though we do not expect,
say, StmtOut or pSpec to depend on the witness types, as that is not available to the (oracle)
verifier).
- encode : Index → OracleComp oSpec Encoding
- OracleInterface : _root_.OracleInterface Encoding
Instances For
The type signature for the prover's state at each round.
For a protocol with n messages exchanged, there will be (n + 1) prover states, with the first
state before the first message and the last state after the last message.
Instances For
Initialization of prover's state via inputting the statement and witness.
- input : StmtIn × WitIn → PrvState
Instances For
Represents the interaction of a prover for a given protocol specification.
In each step, the prover gets access to the current state, then depending on the direction of the step, the prover either sends a message or receives a challenge, and updates its state accordingly.
For maximum simplicity, we only define the sendMessage function as an oracle computation. All
other functions are pure. We may revisit this decision in the future.
- sendMessage (i : pSpec.MessageIdx) : self.PrvState (↑i).castSucc → OracleComp oSpec (pSpec.Message i × self.PrvState (↑i).succ)
Send a message and update the prover's state
- receiveChallenge (i : pSpec.ChallengeIdx) : self.PrvState (↑i).castSucc → OracleComp oSpec (pSpec.Challenge i → self.PrvState (↑i).succ)
Receive a challenge and update the prover's state
Instances For
The output function of the prover, which takes in the prover's final state and returns an oracle
computation that outputs some specified output type Output
We note that an honest prover may output both the output statement and witness (for easier composability), but an adversarial prover in the knowledge soundness game may only output the witness.
- output : PrvState → OracleComp oSpec Output
Instances For
The type of algorithms that participates in an (interactive) reduction in the role of the prover. This consists of:
PrvState 0, ..., PrvState n: the types for the private state, from before the first message to after the last messageinit : PrvState 0is the initial statesendMessageandreceiveChallengeare the functions for sending and receiving messages for each round, depending on the direction of the round.
This is useful when modeling soundness, since we do not want to mandate that adversarial provers in the soundness game need to input or output anything.
- sendMessage (i : pSpec.MessageIdx) : self.PrvState (↑i).castSucc → OracleComp oSpec (pSpec.Message i × self.PrvState (↑i).succ)
- receiveChallenge (i : pSpec.ChallengeIdx) : self.PrvState (↑i).castSucc → OracleComp oSpec (pSpec.Challenge i → self.PrvState (↑i).succ)
Instances For
The type of algorithms that participates in an (interactive) reduction in the role of the
prover, and returns some specified output type Output. This consists of:
- A
ProverInteractiontype for the interaction with the verifier - An
outputfunction that takes in the algorithm's final state and returns an oracle computation that outputs the output typeOutput
This is useful when modeling knowledge soundness, since we do not want to mandate that adversarial provers in the knowledge soundness game need to input the input statement or witness. We also do not need the adversarial prover to output any output statement, as such values are sourced from the verifier.
- sendMessage (i : pSpec.MessageIdx) : self.PrvState (↑i).castSucc → OracleComp oSpec (pSpec.Message i × self.PrvState (↑i).succ)
- receiveChallenge (i : pSpec.ChallengeIdx) : self.PrvState (↑i).castSucc → OracleComp oSpec (pSpec.Challenge i → self.PrvState (↑i).succ)
- output : self.PrvState (Fin.last n) → OracleComp oSpec Output
Instances For
The type of honest provers for an interactive reduction with n messages. This consists of:
PrvState 0, ...,PrvState nare the types for the prover's state at each roundinputinitializes the prover's state by taking in the input statement and witnesssendMessagetakes in the prover's state, then returns an oracle computation that outputs a message and the next prover's statereceiveChallengetakes in the prover's state, then returns an oracle computation that outputs a function that takes in a challenge and returns the next prover's stateoutputreturns the output statement and witness from the prover's state
Note that the output statement by the prover is present only to facilitate composing honest provers
together. For completeness, we will require that the prover's output statement is always equal to
the verifier's output statement. For soundness and knowledge soundness, we will use more restricted
types of provers (see ProverInteraction and ProverInteractionWithOutput).
- sendMessage (i : pSpec.MessageIdx) : self.PrvState (↑i).castSucc → OracleComp oSpec (pSpec.Message i × self.PrvState (↑i).succ)
- receiveChallenge (i : pSpec.ChallengeIdx) : self.PrvState (↑i).castSucc → OracleComp oSpec (pSpec.Challenge i → self.PrvState (↑i).succ)
- output : self.PrvState (Fin.last n) → OracleComp oSpec (StmtOut × WitOut)
Instances For
A verifier of an interactive protocol is a function that takes in the input statement and the transcript, and performs an oracle computation that outputs a new statement
- verify : StmtIn → pSpec.FullTranscript → OptionT (OracleComp oSpec) StmtOut
Instances For
An (oracle) prover in an interactive oracle reduction is a prover in the non-oracle reduction whose input statement also consists of the underlying messages for the oracle statements
Instances For
An (oracle) verifier of an interactive oracle reduction consists of:
an oracle computation
verifythat outputs the next statement. It may make queries to each of the prover's messages and each of the oracles present in the statement (according to a specified interface defined byOracleInterfaceinstances).output oracle statements
OStmtOut : ιₛₒ → Type, meant to be a subset of the input oracle statements and the prover's oracle messages. Formally, this is specified by an embeddingιₛₒ ↪ ιₛᵢ ⊕ pSpec.MessageIdxand a proof thatOStmtOutis compatible withOStmtInandpSpec.Messagesvia this embedding.
Intuitively, the oracle verifier cannot do anything more in returning the output oracle statements, other than specifying a subset of the ones it has received (and dropping the rest).
- verify : StmtIn → pSpec.Challenges → OptionT (OracleComp (oSpec + ([OStmtIn]ₒ + [pSpec.Message]ₒ))) StmtOut
The core verification logic. Takes the input statement
stmtInand all verifier challengeschallenges(which are determined outside this function, typically by sampling for public-coin protocols). Returns the output statementStmtOutwithin anOracleCompthat has access to external oraclesoSpec, input statement oraclesOStmtIn, and prover message oraclespSpec.Message. An embedding that specifies how each output oracle statement (indexed by
ιₛₒ) is derived. It maps an indexi : ιₛₒto either an indexj : ιₛᵢ(meaningOStmtOut icomes fromOStmtIn j) or an indexk : pSpec.MessageIdx(meaningOStmtOut icomes from the prover's messagepSpec.Message k). This enforces that output oracles are a subset of input oracles or received prover messages.- hEq (i : ιₛₒ) : OStmtOut i = match self.embed i with | Sum.inl j => OStmtIn j | Sum.inr j => pSpec.Message j
A proof term ensuring that the type of each
OStmtOut imatches the type of the corresponding source oracle statement (OStmtIn jorpSpec.Message k) as determined by theembedmapping.
Instances For
An oracle verifier can be seen as a (non-oracle) verifier by providing the oracle interface using its knowledge of the oracle statements and the transcript messages in the clear
Instances For
The number of queries made to the oracle statements and the prover's messages, for a given input statement and challenges.
This is given as an oracle computation itself, since the oracle verifier may be adaptive and has different number of queries depending on the prior responses.
TODO: define once numQueries is defined in OracleComp
Instances For
A non-adaptive oracle verifier is an oracle verifier that makes a fixed list of queries to the input oracle statements and the prover's messages. These queries can depend on the input statement and the challenges, but later queries are not dependent on the responses of previous queries.
Formally, we model this as a tuple of functions:
queryOStmt, which outputs a list of queries to the input oracle statements,queryMsg, which outputs a list of queries to the prover's messages,verify, which outputs the new statement from the query-response pairs.
We allow querying the shared oracle (i.e. probabilistic sampling or random oracles) when deriving the output statement, but not on the list of queries made to the oracle statements or the prover's messages.
Finally, we also allow for choosing a subset of the input oracle statements + the prover's messages to retain for the output oracle statements.
- queryOStmt : StmtIn → ((i : pSpec.ChallengeIdx) → pSpec.Challenge i) → List ((i : ιₛᵢ) × OracleInterface.Query (OStmtIn i))
Makes a list of queries to each of the oracle statements, given the input statement and the challenges
- queryMsg : StmtIn → ((i : pSpec.ChallengeIdx) → pSpec.Challenge i) → List ((i : pSpec.MessageIdx) × OracleInterface.Query (pSpec.Message i))
Makes a list of queries to each of the prover's messages, given the input statement and the challenges
- verify : StmtIn → ((i : pSpec.ChallengeIdx) → pSpec.Challenge i) → List ((i : ιₛᵢ) × (q : OracleInterface.Query (OStmtIn i)) × OracleInterface.Response q) → List ((i : pSpec.MessageIdx) × (q : OracleInterface.Query (pSpec.Message i)) × OracleInterface.Response q) → OracleComp oSpec StmtOut
From the query-response pairs, returns a computation that outputs the new output statement
Instances For
Converts a non-adaptive oracle verifier into the general oracle verifier interface.
This essentially performs the queries via List.mapM, then runs verify on the query-response
pairs.
Instances For
The number of queries made to the i-th oracle statement, for a given input statement and
challenges.
Instances For
The number of queries made to the i-th prover's message, for a given input statement and
challenges.
Instances For
The total number of queries made to the oracle statements and the prover's messages, for a given input statement and challenges.
Instances For
An interactive reduction for a given protocol specification pSpec, and relative to oracles
defined by oSpec, consists of a prover and a verifier.
- prover : Prover oSpec StmtIn WitIn StmtOut WitOut pSpec
- verifier : Verifier oSpec StmtIn StmtOut pSpec
Instances For
An interactive oracle reduction for a given protocol specification pSpec, and relative to
oracles defined by oSpec, consists of a prover and an oracle verifier.
- prover : OracleProver oSpec StmtIn OStmtIn WitIn StmtOut OStmtOut WitOut pSpec
- verifier : OracleVerifier oSpec StmtIn OStmtIn StmtOut OStmtOut pSpec
Instances For
An interactive oracle reduction can be seen as an interactive reduction, via coercing the oracle verifier to a (normal) verifier
Instances For
An interactive proof (IP) is an interactive reduction where the output statement is a
boolean, the output witness is trivial (a Unit), and the relation checks whether the output
statement is true.
Instances For
An interactive oracle proof (IOP) is an interactive oracle reduction where the output
statement is a boolean, while both the output oracle statement & the output witness are
trivial (Unit type).
As a consequence, the output relation in an IOP is effectively a function Bool → Prop, which
we can again assume to be the trivial one (sending true to True).
Instances For
A non-interactive prover is a prover that only sends a single message to the verifier.
Instances For
A non-interactive verifier is a verifier that only receives a single message from the prover.
Instances For
A non-interactive reduction is an interactive reduction with only a single message from the prover to the verifier (and none in the other direction).
Instances For
The trivial / identity verifier, which does not receive any messages from the prover, and returns its input statement as output.
Instances For
The trivial / identity reduction, which consists of the trivial prover and verifier.
Instances For
The trivial / identity prover in an oracle reduction, which unfolds to the trivial prover for the associated non-oracle reduction.
Instances For
The trivial / identity verifier in an oracle reduction, which receives no messages from the prover, and returns its input statement as output.
Instances For
The trivial / identity oracle reduction, which consists of the trivial oracle prover and verifier.
Instances For
Alias of Prover.id.
The trivial / identity prover, which does not send any messages to the verifier, and returns its input context (statement & witness) as output.
Instances For
Alias of Verifier.id.
The trivial / identity verifier, which does not receive any messages from the prover, and returns its input statement as output.
Instances For
Alias of Reduction.id.
The trivial / identity reduction, which consists of the trivial prover and verifier.
Instances For
Alias of OracleProver.id.
The trivial / identity prover in an oracle reduction, which unfolds to the trivial prover for the associated non-oracle reduction.
Instances For
Alias of OracleVerifier.id.
The trivial / identity verifier in an oracle reduction, which receives no messages from the prover, and returns its input statement as output.
Instances For
Alias of OracleReduction.id.
The trivial / identity oracle reduction, which consists of the trivial oracle prover and verifier.
Instances For
A protocol specification with the prover speaking first
Instances
Instances
Instances
A protocol specification with the verifier speaking last
Instances
Instances
A non-interactive protocol specification with a single message from the prover to the verifier
Instances For
Instances
A protocol specification with a single round of interaction consisting of two messages, with the prover speaking first and the verifier speaking last
This notation is currently somewhat ambiguous, given that there are other valid ways of defining a "single-round" protocol, such as letting the verifier speaks first, letting the prover speaks multiple times, etc.
Instances
Alias of ProtocolSpec.IsSingleRound.
A protocol specification with a single round of interaction consisting of two messages, with the prover speaking first and the verifier speaking last
This notation is currently somewhat ambiguous, given that there are other valid ways of defining a "single-round" protocol, such as letting the verifier speaks first, letting the prover speaks multiple times, etc.
Instances For
The first message is the only message from the prover to the verifier
The second message is the only challenge from the verifier to the prover
Instances For
- is_pure : ∃ (sendMessage : (x : pSpec.MessageIdx) → P.PrvState (↑x).castSucc → pSpec.Message x × P.PrvState (↑x).succ), ∀ (i : pSpec.MessageIdx) (st : P.PrvState (↑i).castSucc), P.sendMessage i st = pure (sendMessage i st)
Instances
- is_pure : ∃ (verify : StmtIn → pSpec.FullTranscript → StmtOut), ∀ (stmtIn : StmtIn) (transcript : pSpec.FullTranscript), V.verify stmtIn transcript = pure (verify stmtIn transcript)