plookup

package
v0.0.0-...-783462d Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package plookup provides an API to build plookup proofs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompatibleSize = errors.New("the tables in f and t are not of the same size")
	ErrFoldedCommitment = errors.New("the folded commitment is malformed")
	ErrNumberDigests    = errors.New("proof.ts and proof.fs are not of the same length")
)
View Source
var (
	ErrNotInTable          = errors.New("some value in the vector is not in the lookup table")
	ErrPlookupVerification = errors.New("plookup verification failed")
	ErrGenerator           = errors.New("wrong generator")
)

Functions

func VerifyLookupTables

func VerifyLookupTables(srs *kzg.SRS, proof ProofLookupTables) error

VerifyLookupTables verifies that a ProofLookupTables proof is correct.

func VerifyLookupVector

func VerifyLookupVector(srs *kzg.SRS, proof ProofLookupVector) error

VerifyLookupVector verifies that a ProofLookupVector proof is correct

Types

type ProofLookupTables

type ProofLookupTables struct {
	// contains filtered or unexported fields
}

ProofLookupTables proofs that a list of tables

func ProveLookupTables

func ProveLookupTables(srs *kzg.SRS, f, t []Table) (ProofLookupTables, error)

ProveLookupTables generates a proof that f, seen as a multi dimensional table, consists of vectors that are in t. In other words for each i, f[:][i] must be one of the t[:][j].

For instance, if t is the truth table of the XOR function, t will be populated such that t[:][i] contains the i-th entry of the truth table, so t[0][i] XOR t[1][i] = t[2][i].

The Table in f and t are supposed to be of the same size constant size.

type ProofLookupVector

type ProofLookupVector struct {

	// Batch opening proof of h1, h2, z, t
	BatchedProof kzg.BatchOpeningProof

	// Batch opening proof of h1, h2, z shifted by g
	BatchedProofShifted kzg.BatchOpeningProof
	// contains filtered or unexported fields
}

Proof Plookup proof, containing opening proofs

func ProveLookupVector

func ProveLookupVector(srs *kzg.SRS, f, t Table) (ProofLookupVector, error)

ProveLookupVector returns proof that the values in f are in t.

/!\IMPORTANT/!\

If the table t is already commited somewhere (which is the normal workflow before generating a lookup proof), the commitment needs to be done on the table sorted. Otherwise the commitment in proof.t will not be the same as the public commitment: it will contain the same values, but permuted.

type Table

type Table []fr.Element

func (Table) Len

func (t Table) Len() int

Len is the number of elements in the collection.

func (Table) Less

func (t Table) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (Table) Swap

func (t Table) Swap(i, j int)

Swap swaps the elements with indexes i and j.

Jump to

Keyboard shortcuts

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