gkr

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Gates = map[string]Gate{
	"identity": IdentityGate{},
	"add":      AddGate{},
	"sub":      SubGate{},
	"neg":      NegGate{},
	"mul":      MulGate(2),
}

Gates defined by name

Functions

func ChallengeNames

func ChallengeNames(sorted []*Wire, logNbInstances int, prefix string) []string

func ProofSize

func ProofSize(c Circuit, logNbInstances int) int

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 added in v0.11.2

type AddGate struct{}

func (AddGate) Degree added in v0.11.2

func (g AddGate) Degree() int

func (AddGate) Evaluate added in v0.11.2

func (g AddGate) Evaluate(x ...fr.Element) (res fr.Element)

type Circuit

type Circuit []Wire

func (Circuit) MemoryRequirements added in v0.9.1

func (c Circuit) MemoryRequirements(nbInstances int) []int

MemoryRequirements returns an increasing vector of memory allocation sizes required for proving a GKR statement

type Gate

type Gate interface {
	Evaluate(...fr.Element) fr.Element
	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 ...fr.Element) fr.Element

type MulGate added in v0.11.2

type MulGate int

func (MulGate) Degree added in v0.11.2

func (g MulGate) Degree() int

func (MulGate) Evaluate added in v0.11.2

func (g MulGate) Evaluate(x ...fr.Element) (res fr.Element)

type NegGate added in v0.11.2

type NegGate struct{}

func (NegGate) Degree added in v0.11.2

func (g NegGate) Degree() int

func (NegGate) Evaluate added in v0.11.2

func (g NegGate) Evaluate(element ...fr.Element) (neg fr.Element)

type Option

type Option func(*settings)

func WithPool

func WithPool(pool *polynomial.Pool) Option

func WithSortedCircuit

func WithSortedCircuit(sorted []*Wire) Option

func WithWorkers added in v0.9.1

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 added in v0.9.1

func (p Proof) SerializeToBigInts(outs []*big.Int)

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 added in v0.11.2

type SubGate struct{}

func (SubGate) Degree added in v0.11.2

func (g SubGate) Degree() int

func (SubGate) Evaluate added in v0.11.2

func (g SubGate) Evaluate(element ...fr.Element) (diff fr.Element)

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 (Wire) IsInput

func (w Wire) IsInput() bool

func (Wire) IsOutput

func (w Wire) IsOutput() bool

func (Wire) NbClaims

func (w Wire) NbClaims() int

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL