Documentation ¶
Index ¶
- Variables
- func ChallengeNames(sorted []*Wire, logNbInstances int, prefix string) []string
- func ProofSize(c Circuit, logNbInstances int) int
- func Verify(c Circuit, assignment WireAssignment, proof Proof, ...) error
- type AddGate
- type Circuit
- type Gate
- type IdentityGate
- type MulGate
- type NegGate
- type Option
- type Proof
- type SubGate
- type Wire
- type WireAssignment
Constants ¶
This section is empty.
Variables ¶
var Gates = map[string]Gate{ "identity": IdentityGate{}, "add": AddGate{}, "sub": SubGate{}, "neg": NegGate{}, "mul": MulGate(2), }
Gates defined by name
Functions ¶
func ChallengeNames ¶
func ProofSize ¶
ProofSize computes how large the proof for a circuit would be. It needs nbUniqueOutputs to be set
func Verify ¶
func Verify(c Circuit, assignment WireAssignment, proof Proof, transcriptSettings fiatshamir.Settings, options ...Option) error
Verify the consistency of the claimed output with the claimed input Unlike in Prove, the assignment argument need not be complete
Types ¶
type AddGate ¶
type AddGate struct{}
func (AddGate) Evaluate ¶
func (g AddGate) Evaluate(x ...small_rational.SmallRational) (res small_rational.SmallRational)
type Circuit ¶
type Circuit []Wire
func (Circuit) MemoryRequirements ¶
MemoryRequirements returns an increasing vector of memory allocation sizes required for proving a GKR statement
type Gate ¶
type Gate interface { Evaluate(...small_rational.SmallRational) small_rational.SmallRational Degree() int }
Gate must be a low-degree polynomial
type IdentityGate ¶
type IdentityGate struct{}
func (IdentityGate) Degree ¶
func (IdentityGate) Degree() int
func (IdentityGate) Evaluate ¶
func (IdentityGate) Evaluate(input ...small_rational.SmallRational) small_rational.SmallRational
type MulGate ¶
type MulGate int
func (MulGate) Evaluate ¶
func (g MulGate) Evaluate(x ...small_rational.SmallRational) (res small_rational.SmallRational)
type NegGate ¶
type NegGate struct{}
func (NegGate) Evaluate ¶
func (g NegGate) Evaluate(element ...small_rational.SmallRational) (neg small_rational.SmallRational)
type Option ¶
type Option func(*settings)
func WithPool ¶
func WithPool(pool *polynomial.Pool) Option
func WithSortedCircuit ¶
func WithWorkers ¶
func WithWorkers(workers *utils.WorkerPool) Option
type Proof ¶
type Proof []sumcheck.Proof // for each layer, for each wire, a sumcheck (for each variable, a polynomial)
func Prove ¶
func Prove(c Circuit, assignment WireAssignment, transcriptSettings fiatshamir.Settings, options ...Option) (Proof, error)
Prove consistency of the claimed assignment
func (Proof) SerializeToBigInts ¶
SerializeToBigInts flattens a proof object into the given slice of big.Ints useful in gnark hints. TODO: Change propagation: Once this is merged, it will duplicate some code in std/gkr/bn254Prover.go. Remove that in favor of this
type SubGate ¶
type SubGate struct{}
func (SubGate) Evaluate ¶
func (g SubGate) Evaluate(element ...small_rational.SmallRational) (diff small_rational.SmallRational)
type Wire ¶
type Wire struct { Gate Gate Inputs []*Wire // if there are no Inputs, the wire is assumed an input wire // contains filtered or unexported fields }
func TopologicalSort ¶
TopologicalSort sorts the wires in order of dependence. Such that for any wire, any one it depends on occurs before it. It tries to stick to the input order as much as possible. An already sorted list will remain unchanged. It also sets the nbOutput flags, and a dummy IdentityGate for input wires. Worst-case inefficient O(n^2), but that probably won't matter since the circuits are small. Furthermore, it is efficient with already-close-to-sorted lists, which are the expected input
type WireAssignment ¶
type WireAssignment map[*Wire]polynomial.MultiLin
WireAssignment is assignment of values to the same wire across many instances of the circuit
func (WireAssignment) Complete ¶
func (a WireAssignment) Complete(c Circuit) WireAssignment
Complete the circuit evaluation from input values
func (WireAssignment) NumInstances ¶
func (a WireAssignment) NumInstances() int
func (WireAssignment) NumVars ¶
func (a WireAssignment) NumVars() int