plookup

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 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(vk kzg.VerifyingKey, proof ProofLookupTables) error

VerifyLookupTables verifies that a ProofLookupTables proof is correct.

func VerifyLookupVector

func VerifyLookupVector(vk kzg.VerifyingKey, 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(pk kzg.ProvingKey, f, t []fr.Vector) (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 fr.Vector 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(pk kzg.ProvingKey, f, t fr.Vector) (ProofLookupVector, error)

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

/!\IMPORTANT/!\

If the table t is already committed 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.

Jump to

Keyboard shortcuts

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