Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::GenericLookupRelationImpl< Settings, FF_ > Class Template Reference

Specifies positions of elements in the tuple of entities received from methods in the Settings class. More...

#include <generic_lookup_relation.hpp>

Public Types

enum  READ_TERM_TYPES { READ_BASIC_TUPLE = 0 , READ_SCALED_TUPLE , READ_ARBITRARY }
 
enum  WRITE_TERM_TYPES { WRITE_BASIC_TUPLE = 0 , WRITE_ARBITRARY }
 
using FF = FF_
 

Static Public Member Functions

static constexpr size_t compute_maximum_read_term_degree ()
 Compute the maximum degree of read terms.
 
static constexpr size_t compute_maximum_write_term_degree ()
 Compute the maximum degree of write terms.
 
static constexpr size_t compute_read_term_product_degree ()
 Compute the degree of of the product of read terms.
 
static constexpr size_t compute_write_term_product_degree ()
 Compute the degree of of the product of write terms.
 
template<typename AllValues >
static bool operation_exists_at_row (const AllValues &row)
 Check if we need to compute the inverse polynomial element value for this row.
 
template<typename AllEntities >
static auto & get_inverse_polynomial (AllEntities &in)
 Get the inverse permutation polynomial (needed to compute its value)
 
template<typename Accumulator , typename AllEntities >
static Accumulator compute_inverse_exists (const AllEntities &in)
 Get selector/wire switching on(1) or off(0) inverse computation.
 
template<typename Accumulator , size_t index, typename AllEntities >
static Accumulator lookup_read_counts (const AllEntities &in)
 Returns the number of times a particular value is written (how many times it is being looked up)
 
template<typename Accumulator , size_t read_index, typename AllEntities >
static Accumulator compute_read_term_predicate (const AllEntities &in)
 Compute if the value from the first set exists in this row.
 
template<typename Accumulator , size_t write_index, typename AllEntities >
static Accumulator compute_write_term_predicate (const AllEntities &in)
 Compute if the value from the second set exists in this row.
 
static constexpr size_t compute_read_term_polynomial_offset (size_t read_index)
 Compute where the polynomials defining a particular read term are located.
 
static constexpr size_t compute_write_term_polynomial_offset (size_t write_index)
 Compute where the polynomials defining a particular write term are located.
 
template<typename Accumulator , size_t read_index, typename AllEntities , typename Parameters >
static Accumulator compute_read_term (const AllEntities &in, const Parameters &params)
 Compute the value of a single item in the set.
 
template<typename Accumulator , size_t write_index, typename AllEntities , typename Parameters >
static Accumulator compute_write_term (const AllEntities &in, const Parameters &params)
 Compute the value of a single item in the set.
 
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters >
static void accumulate (ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &params, const FF &scaling_factor)
 Expression for generic log-derivative-based set permutation.
 

Static Public Attributes

static constexpr size_t READ_TERMS = Settings::READ_TERMS
 
static constexpr size_t WRITE_TERMS = Settings::WRITE_TERMS
 
static constexpr size_t LOOKUP_TUPLE_SIZE = Settings::LOOKUP_TUPLE_SIZE
 
static constexpr size_t READ_TERM_DEGREE = compute_maximum_read_term_degree()
 
static constexpr size_t WRITE_TERM_DEGREE = compute_maximum_write_term_degree()
 
static constexpr size_t FIRST_SUBRELATION_LENGTH
 
static constexpr size_t SECOND_SUBRELATION_LENGTH = std::max(READ_TERM_DEGREE + 1, WRITE_TERM_DEGREE + 2)
 
static constexpr size_t LENGTH = std::max(FIRST_SUBRELATION_LENGTH, SECOND_SUBRELATION_LENGTH)
 
static constexpr size_t INVERSE_POLYNOMIAL_INDEX = 0
 
static constexpr size_t LOOKUP_READ_COUNT_START_POLYNOMIAL_INDEX = 1
 
static constexpr size_t LOOKUP_READ_TERM_PREDICATE_START_POLYNOMIAL_INDEX
 
static constexpr size_t LOOKUP_WRITE_TERM_PREDICATE_START_POLYNOMIAL_INDEX
 
static constexpr size_t LOOKUP_READ_PREDICATE_START_POLYNOMIAL_INDEX
 
static constexpr std::array< size_t, 2 > SUBRELATION_PARTIAL_LENGTHS
 
static constexpr std::array< bool, 2 > SUBRELATION_LINEARLY_INDEPENDENT = { true, false }
 We apply the power polynomial only to the first subrelation.
 

Detailed Description

template<typename Settings, typename FF_>
class bb::GenericLookupRelationImpl< Settings, FF_ >

Specifies positions of elements in the tuple of entities received from methods in the Settings class.

Definition at line 38 of file generic_lookup_relation.hpp.

Member Typedef Documentation

◆ FF

template<typename Settings , typename FF_ >
using bb::GenericLookupRelationImpl< Settings, FF_ >::FF = FF_

Definition at line 40 of file generic_lookup_relation.hpp.

Member Enumeration Documentation

◆ READ_TERM_TYPES

template<typename Settings , typename FF_ >
enum bb::GenericLookupRelationImpl::READ_TERM_TYPES
Enumerator
READ_BASIC_TUPLE 
READ_SCALED_TUPLE 
READ_ARBITRARY 

Definition at line 46 of file generic_lookup_relation.hpp.

◆ WRITE_TERM_TYPES

template<typename Settings , typename FF_ >
enum bb::GenericLookupRelationImpl::WRITE_TERM_TYPES
Enumerator
WRITE_BASIC_TUPLE 
WRITE_ARBITRARY 

Definition at line 52 of file generic_lookup_relation.hpp.

Member Function Documentation

◆ accumulate()

template<typename Settings , typename FF_ >
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters >
static void bb::GenericLookupRelationImpl< Settings, FF_ >::accumulate ( ContainerOverSubrelations &  accumulator,
const AllEntities &  in,
const Parameters &  params,
const FF scaling_factor 
)
inlinestatic

Expression for generic log-derivative-based set permutation.

Parameters
accumulatortransformed to evals + C(in(X)...)*scaling_factor
inan std::array containing the fully extended Accumulator edges.
relation_paramscontains beta, gamma, and public_input_delta, ....
scaling_factoroptional term to scale the evaluation before adding to evals.

Definition at line 464 of file generic_lookup_relation.hpp.

◆ compute_inverse_exists()

template<typename Settings , typename FF_ >
template<typename Accumulator , typename AllEntities >
static Accumulator bb::GenericLookupRelationImpl< Settings, FF_ >::compute_inverse_exists ( const AllEntities &  in)
inlinestatic

Get selector/wire switching on(1) or off(0) inverse computation.

Definition at line 242 of file generic_lookup_relation.hpp.

◆ compute_maximum_read_term_degree()

template<typename Settings , typename FF_ >
static constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::compute_maximum_read_term_degree ( )
inlinestaticconstexpr

Compute the maximum degree of read terms.

We need this to evaluate the length of the subrelations correctly

Returns
constexpr size_t

Definition at line 64 of file generic_lookup_relation.hpp.

◆ compute_maximum_write_term_degree()

template<typename Settings , typename FF_ >
static constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::compute_maximum_write_term_degree ( )
inlinestaticconstexpr

Compute the maximum degree of write terms.

We need this to evaluate the length of the subrelations correctly

Returns
constexpr size_t

Definition at line 87 of file generic_lookup_relation.hpp.

◆ compute_read_term()

template<typename Settings , typename FF_ >
template<typename Accumulator , size_t read_index, typename AllEntities , typename Parameters >
static Accumulator bb::GenericLookupRelationImpl< Settings, FF_ >::compute_read_term ( const AllEntities &  in,
const Parameters &  params 
)
inlinestatic

Compute the value of a single item in the set.

Computes the polynomial \gamma + \sum_{i=0}^{num_columns}(column_i*\beta^i), so the tuple of columns is in the first set

Template Parameters
read_indexThe chosen polynomial relation
Parameters
paramsUsed for beta and gamma

Definition at line 384 of file generic_lookup_relation.hpp.

◆ compute_read_term_polynomial_offset()

template<typename Settings , typename FF_ >
static constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::compute_read_term_polynomial_offset ( size_t  read_index)
inlinestaticconstexpr

Compute where the polynomials defining a particular read term are located.

We pass polynomials involved in read an write terms from settings as a tuple of references. However, depending on the type of read term different number of polynomials can be used to compute it. So we need to compute the offset in the tuple iteratively

Parameters
read_indexIndex of the read term
Returns
constexpr size_t

Definition at line 317 of file generic_lookup_relation.hpp.

◆ compute_read_term_predicate()

template<typename Settings , typename FF_ >
template<typename Accumulator , size_t read_index, typename AllEntities >
static Accumulator bb::GenericLookupRelationImpl< Settings, FF_ >::compute_read_term_predicate ( const AllEntities &  in)
inlinestatic

Compute if the value from the first set exists in this row.

Template Parameters
read_indexKept for compatibility with lookups, behavior doesn't change

Definition at line 277 of file generic_lookup_relation.hpp.

◆ compute_read_term_product_degree()

template<typename Settings , typename FF_ >
static constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::compute_read_term_product_degree ( )
inlinestaticconstexpr

Compute the degree of of the product of read terms.

The degree of the inverse polynomial check subrelation is dependent on this value

Returns
constexpr size_t

Definition at line 109 of file generic_lookup_relation.hpp.

◆ compute_write_term()

template<typename Settings , typename FF_ >
template<typename Accumulator , size_t write_index, typename AllEntities , typename Parameters >
static Accumulator bb::GenericLookupRelationImpl< Settings, FF_ >::compute_write_term ( const AllEntities &  in,
const Parameters &  params 
)
inlinestatic

Compute the value of a single item in the set.

Computes the polynomial \gamma + \sum_{i=0}^{num_columns}(column_i*\beta^i), so the tuple of columns is in the second set

Template Parameters
write_indexKept for compatibility with lookups, behavior doesn't change
Parameters
paramsUsed for beta and gamma

Definition at line 430 of file generic_lookup_relation.hpp.

◆ compute_write_term_polynomial_offset()

template<typename Settings , typename FF_ >
static constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::compute_write_term_polynomial_offset ( size_t  write_index)
inlinestaticconstexpr

Compute where the polynomials defining a particular write term are located.

We pass polynomials involved in read an write terms from settings as a tuple of references. However, depending on the type of term different number of polynomials can be used to compute it. So we need to compute the offset in the tuple iteratively

Parameters
write_indexIndex of the write term
Returns
constexpr size_t

Definition at line 353 of file generic_lookup_relation.hpp.

◆ compute_write_term_predicate()

template<typename Settings , typename FF_ >
template<typename Accumulator , size_t write_index, typename AllEntities >
static Accumulator bb::GenericLookupRelationImpl< Settings, FF_ >::compute_write_term_predicate ( const AllEntities &  in)
inlinestatic

Compute if the value from the second set exists in this row.

Template Parameters
write_indexKept for compatibility with lookups, behavior doesn't change

Definition at line 295 of file generic_lookup_relation.hpp.

◆ compute_write_term_product_degree()

template<typename Settings , typename FF_ >
static constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::compute_write_term_product_degree ( )
inlinestaticconstexpr

Compute the degree of of the product of write terms.

The degree of the inverse polynomial check subrelation is dependent on this value

Returns
constexpr size_t

Definition at line 133 of file generic_lookup_relation.hpp.

◆ get_inverse_polynomial()

template<typename Settings , typename FF_ >
template<typename AllEntities >
static auto & bb::GenericLookupRelationImpl< Settings, FF_ >::get_inverse_polynomial ( AllEntities &  in)
inlinestatic

Get the inverse permutation polynomial (needed to compute its value)

Definition at line 230 of file generic_lookup_relation.hpp.

◆ lookup_read_counts()

template<typename Settings , typename FF_ >
template<typename Accumulator , size_t index, typename AllEntities >
static Accumulator bb::GenericLookupRelationImpl< Settings, FF_ >::lookup_read_counts ( const AllEntities &  in)
inlinestatic

Returns the number of times a particular value is written (how many times it is being looked up)

Lookup read counts should be independent columns, so there is no need to call a separate function

Template Parameters
Accumulator
indexThe index of the write predicate to which this count belongs
AllEntities
Parameters
in
Returns
Accumulator

Definition at line 262 of file generic_lookup_relation.hpp.

◆ operation_exists_at_row()

template<typename Settings , typename FF_ >
template<typename AllValues >
static bool bb::GenericLookupRelationImpl< Settings, FF_ >::operation_exists_at_row ( const AllValues &  row)
inlinestatic

Check if we need to compute the inverse polynomial element value for this row.

This proxies to a method in the Settings class

Parameters
rowAll values at row

Definition at line 220 of file generic_lookup_relation.hpp.

Member Data Documentation

◆ FIRST_SUBRELATION_LENGTH

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::FIRST_SUBRELATION_LENGTH
staticconstexpr
Initial value:
=
Settings::INVERSE_EXISTS_POLYNOMIAL_DEGREE) +
1
static constexpr size_t compute_read_term_product_degree()
Compute the degree of of the product of read terms.
static constexpr size_t compute_write_term_product_degree()
Compute the degree of of the product of write terms.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13

Definition at line 159 of file generic_lookup_relation.hpp.

◆ INVERSE_POLYNOMIAL_INDEX

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::INVERSE_POLYNOMIAL_INDEX = 0
staticconstexpr

Definition at line 192 of file generic_lookup_relation.hpp.

◆ LENGTH

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::LENGTH = std::max(FIRST_SUBRELATION_LENGTH, SECOND_SUBRELATION_LENGTH)
staticconstexpr

Definition at line 168 of file generic_lookup_relation.hpp.

◆ LOOKUP_READ_COUNT_START_POLYNOMIAL_INDEX

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::LOOKUP_READ_COUNT_START_POLYNOMIAL_INDEX = 1
staticconstexpr

Definition at line 193 of file generic_lookup_relation.hpp.

◆ LOOKUP_READ_PREDICATE_START_POLYNOMIAL_INDEX

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::LOOKUP_READ_PREDICATE_START_POLYNOMIAL_INDEX
staticconstexpr
Initial value:

Definition at line 198 of file generic_lookup_relation.hpp.

◆ LOOKUP_READ_TERM_PREDICATE_START_POLYNOMIAL_INDEX

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::LOOKUP_READ_TERM_PREDICATE_START_POLYNOMIAL_INDEX
staticconstexpr
Initial value:

Definition at line 194 of file generic_lookup_relation.hpp.

◆ LOOKUP_TUPLE_SIZE

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::LOOKUP_TUPLE_SIZE = Settings::LOOKUP_TUPLE_SIZE
staticconstexpr

Definition at line 56 of file generic_lookup_relation.hpp.

◆ LOOKUP_WRITE_TERM_PREDICATE_START_POLYNOMIAL_INDEX

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::LOOKUP_WRITE_TERM_PREDICATE_START_POLYNOMIAL_INDEX
staticconstexpr
Initial value:

Definition at line 196 of file generic_lookup_relation.hpp.

◆ READ_TERM_DEGREE

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::READ_TERM_DEGREE = compute_maximum_read_term_degree()
staticconstexpr

Definition at line 149 of file generic_lookup_relation.hpp.

◆ READ_TERMS

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::READ_TERMS = Settings::READ_TERMS
staticconstexpr

Definition at line 43 of file generic_lookup_relation.hpp.

◆ SECOND_SUBRELATION_LENGTH

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::SECOND_SUBRELATION_LENGTH = std::max(READ_TERM_DEGREE + 1, WRITE_TERM_DEGREE + 2)
staticconstexpr

Definition at line 166 of file generic_lookup_relation.hpp.

◆ SUBRELATION_LINEARLY_INDEPENDENT

template<typename Settings , typename FF_ >
constexpr std::array<bool, 2> bb::GenericLookupRelationImpl< Settings, FF_ >::SUBRELATION_LINEARLY_INDEPENDENT = { true, false }
staticconstexpr

We apply the power polynomial only to the first subrelation.

The first subrelation establishes correspondence between the inverse polynomial elements and the terms. The second relation computes the inverses of individual terms, which are then summed up with sumcheck

Definition at line 212 of file generic_lookup_relation.hpp.

◆ SUBRELATION_PARTIAL_LENGTHS

template<typename Settings , typename FF_ >
constexpr std::array<size_t, 2> bb::GenericLookupRelationImpl< Settings, FF_ >::SUBRELATION_PARTIAL_LENGTHS
staticconstexpr
Initial value:

Definition at line 201 of file generic_lookup_relation.hpp.

◆ WRITE_TERM_DEGREE

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::WRITE_TERM_DEGREE = compute_maximum_write_term_degree()
staticconstexpr

Definition at line 153 of file generic_lookup_relation.hpp.

◆ WRITE_TERMS

template<typename Settings , typename FF_ >
constexpr size_t bb::GenericLookupRelationImpl< Settings, FF_ >::WRITE_TERMS = Settings::WRITE_TERMS
staticconstexpr

Definition at line 49 of file generic_lookup_relation.hpp.


The documentation for this class was generated from the following file: