Definitions and Instances for OracleInterface #
We define OracleInterface, which is a type class that augments a type with an oracle interface
for that type. The interface specifies the type of queries, the type of responses, and the
oracle's behavior for a given underlying element of the type.
OracleInterface is used to restrict the verifier's access to the input oracle statements and the
prover's messages in an interactive oracle reduction (see Basic.lean).
We define OracleInterface instances for common types:
Univariate and multivariate polynomials. These instances turn polynomials into oracles for which one can query at a point, and the response is the evaluation of the polynomial on that point.
Vectors. This instance turns vectors into oracles for which one can query specific positions.
OracleInterface is a type class that provides an oracle interface for a type Message.
It consists of:
- a query type
Query, - a response type
Response, - a function
answerthat given a messagem : Messageand a queryq : Query, returns a responser : Response.
TODO: turn (Query, Response) into a general PFunctor (i.e. Response : Query → Type) This
allows for better compositionality of OracleInterface, including (indexed) sum, instead of
requiring indexed family of OracleInterfaces.
However, this won't be possible until OracleSpec is changed to be an alias for PFunctor
dtumad: Eventually I think we should directly use OracleContext instead?
- Query : Type v
- toOC : OracleContext (Query Message) (ReaderM Message)
Instances
Instances For
Instances For
Instances For
Instances For
The default instance for OracleInterface, where the query is trivial (a Unit) and the
response returns the data. We do not register this as an instance, instead explicitly calling it
where necessary.
Instances For
Converts an indexed type family of oracle interfaces into an oracle specification.
Notation: [v]ₒ for when the oracle interfaces can be inferred, and [v]ₒ'O for when the oracle
interfaces need to be specified.
Instances For
Converts an indexed type family of oracle interfaces into an oracle specification.
Notation: [v]ₒ for when the oracle interfaces can be inferred, and [v]ₒ'O for when the oracle
interfaces need to be specified.
Instances For
Converts an indexed type family of oracle interfaces into an oracle specification.
Notation: [v]ₒ for when the oracle interfaces can be inferred, and [v]ₒ'O for when the oracle
interfaces need to be specified.
Instances For
Given an underlying data for an indexed type family of oracle interfaces v,
we can give an implementation of all queries to the interface defined by v
Instances For
Any function type has a canonical OracleInterface instance, whose answer is the function
itself.
The tensor product oracle interface for the product of two types α and β, each with its own
oracle interface, is defined as:
- The query & response types are the product of the two query & response types.
- The oracle will run both oracles and return the pair of responses.
This is a low priority instance since we do not expect to have this behavior often. See instProd
for the sum behavior on the interface.
The product oracle interface for the product of two types α and β, each with its own oracle
interface, is defined as:
- The query & response types are the sum type of the two query & response types.
- The oracle will answer depending on the input query.
This is the behavior more often assumed, i.e. when we send multiple oracle messages in a round.
See instTensor for the tensor product behavior on the interface.
The indexed tensor product oracle interface for the dependent product of a type family v,
indexed by ι, each having an oracle interface, is defined as:
- The query & response types are the dependent product of the query & response types of the type family.
- The oracle, on a given query specifying the index
iof the type family, will run the oracle ofv iand return the response.
This is a low priority instance since we do not expect to have this behavior often. See
instProdForall for the product behavior on the interface (with dependent sums for the query and
response types).
The indexed product oracle interface for the dependent product of a type family v, indexed by
ι, each having an oracle interface, is defined as:
- The query & response types are the dependent product of the query & response types of the type family.
- The oracle, on a given query specifying the index
iof the type family, will run the oracle ofv iand return the response.
This is the behavior usually assumed, i.e. when we send multiple oracle messages in a round.
See instTensorForall for the tensor product behavior on the interface.
Combines multiple oracle specifications into a single oracle by routing queries to the appropriate underlying oracle. Takes:
- A base oracle specification
oSpec - An indexed type family
TwithOracleInterfaceinstances - Values of that type family Returns a stateless oracle that routes queries to the appropriate underlying oracle.
Instances For
Combines multiple oracle specifications into a single oracle by routing queries to the appropriate underlying oracle. Takes:
- A base oracle specification
oSpec - Two indexed type families
T₁andT₂withOracleInterfaceinstances - Values of those type families Returns a stateless oracle that routes queries to the appropriate underlying oracle.
Instances For
A message type together with a OracleInterface instance is said to have oracle distance
(at most) d if for any two distinct messages, there is at most d queries that distinguish
them, i.e.
#{q | OracleInterface.answer a q = OracleInterface.answer b q} ≤ d.
This property corresponds to the distance of a code, when the oracle instance is to encode the
message and the query is a position of the codeword. In particular, it applies to
(Mv)Polynomial.
Instances For
Univariate polynomials can be accessed via evaluation queries.
Univariate polynomials with degree at most d can be accessed via evaluation queries.
Univariate polynomials with degree less than d can be accessed via evaluation queries.
Multivariate polynomials can be accessed via evaluation queries.
Multivariate polynomials with individual degree at most d can be accessed via evaluation
queries.
Vectors of the form List.Vector α n can be accessed via queries on their indices.
Vectors of the form Vector α n can be accessed via queries on their indices.
Schwartz-Zippel-type distance bound for multivariable polynomials of degree ≤ d.
The bound is Fintype.card σ * d * Fintype.card R ^ (Fintype.card σ - 1) (the earlier
bound Fintype.card σ * d was false; see counterexample in comment history).