Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <logderiv_lookup_relation.hpp>
Public Types | |
using | FF = FF_ |
Static Public Member Functions | |
template<typename AllEntities > | |
static bool | skip (const AllEntities &in) |
template<typename AllValues > | |
static bool | operation_exists_at_row (const AllValues &row) |
Does the provided row contain data relevant to table lookups; Used to determine whether the polynomial of inverses must be computed at a given row. | |
template<typename AllEntities > | |
static auto & | get_inverse_polynomial (AllEntities &in) |
template<typename Accumulator , typename AllEntities > | |
static Accumulator | compute_inverse_exists (const AllEntities &in) |
template<typename Accumulator , size_t index, typename AllEntities > | |
static Accumulator | lookup_read_counts (const AllEntities &in) |
template<typename Accumulator , size_t write_index, typename AllEntities , typename Parameters > | |
static Accumulator | compute_write_term (const AllEntities &in, const Parameters ¶ms) |
template<typename Accumulator , size_t read_index, typename AllEntities , typename Parameters > | |
static Accumulator | compute_read_term (const AllEntities &in, const Parameters ¶ms) |
template<typename Polynomials > | |
static void | compute_logderivative_inverse (Polynomials &polynomials, auto &relation_parameters, const size_t circuit_size) |
Construct the polynomial I whose components are the inverse of the product of the read and write terms. | |
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters > | |
static void | accumulate (ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters ¶ms, const FF &scaling_factor) |
Log-derivative style lookup argument for conventional lookups form tables with 3 or fewer columns. | |
Static Public Attributes | |
static constexpr size_t | WRITE_TERMS = 1 |
static constexpr size_t | INVERSE_SUBRELATION_LENGTH = 5 |
static constexpr size_t | LOOKUP_SUBRELATION_LENGTH = 5 |
static constexpr size_t | BOOLEAN_CHECK_SUBRELATION_LENGTH |
static constexpr std::array< size_t, 3 > | SUBRELATION_PARTIAL_LENGTHS |
static constexpr std::array< size_t, 3 > | TOTAL_LENGTH_ADJUSTMENTS |
static constexpr std::array< bool, 3 > | SUBRELATION_LINEARLY_INDEPENDENT = { true, false, true } |
Definition at line 19 of file logderiv_lookup_relation.hpp.
using bb::LogDerivLookupRelationImpl< FF_ >::FF = FF_ |
Definition at line 21 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Log-derivative style lookup argument for conventional lookups form tables with 3 or fewer columns.
The identity to be checked is of the form
\sum{i=0}^{n-1} \frac{read_counts_i}{write_term_i} - \frac{q_lookup}{read_term_i} = 0
where write_term = table_col_1 + \gamma + table_col_2 * \eta_1 + table_col_3 * \eta_2 + table_index * \eta_3 and read_term = derived_table_entry_1 + \gamma + derived_table_entry_2 * \eta_1 + derived_table_entry_3 * \eta_2
In practice this identity is expressed in terms of polynomials by defining a polynomial of inverses I_i = \frac{1}{read_term_i\cdot write_term_i} then rewriting the above identity as
(1) \sum{i=0}^{n-1} (read_counts_i\cdot I_i\cdot read_term_i) - (q_lookup\cdot I_i\cdot write_term_i) = 0
This requires a second subrelation to check that polynomial I was computed correctly. For all i, it must hold that
(2) I_i\cdot read_term_i\cdot write_term_i - 1 = 0
Note that (1) is 'linearly dependent' in the sense that it holds only as a sum across the entire execution trace. (2) on the other hand holds independently at every row. Finally, note that to avoid unnecessary computation, we only compute I_i at indices where the relation is 'active', i.e. on rows which either contain a lookup gate or table data that has been read. For inactive rows i, we set I_i = 0. We can thus rewrite (2) as
(2) I_i\cdot read_term_i\cdot write_term_i - is_active_i
where is_active = q_lookup + read_tags - q_lookup\cdot read_tags
and read_tags is a polynomial taking boolean values indicating whether the table entry at the corresponding row has been read or not. the last (third) subrelation consists of checking that the read_tag is a boolean value we argue that this is enough for the soundness of the relation. note that read_tags is not constrained to be related to the readcounts values. however, if the read_tags are assured to be 0 or 1, the only thing a cheating prover could do is to skip over an inversion when are not supposed to skip over it. we argue that this does not give the prover any advantage, as it would only mean an element from the lookup table is removed. this means that if a proof verifies, we still have that the provers set is a subset of the lookup table, as the only freedome the prover has is to make the lookup table smaller. the boolean check is still necessary, as otherwise has_inverse, is a leanier function of read_tags, and the the prover can set it to zero (by picking a non-binary value for read_tags) even when we have a read gate in the row.
Definition at line 251 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Definition at line 72 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Construct the polynomial I whose components are the inverse of the product of the read and write terms.
If the denominators of log derivative lookup relation are read_term and write_term, then I_i = (read_term_i*write_term_i)^{-1}.
Definition at line 172 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Definition at line 118 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Definition at line 91 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Definition at line 68 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Definition at line 83 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Does the provided row contain data relevant to table lookups; Used to determine whether the polynomial of inverses must be computed at a given row.
In order to avoid unnecessary computation, the polynomial of inverses I is only computed for rows at which the lookup relation is "active". It is active if either (1) the present row contains a lookup gate (i.e. q_lookup == 1), or (2) the present row contains table data that has been looked up in this circuit (lookup_read_tags == 1, or equivalently, if the row in consideration has index i, the data in polynomials table_i has been utlized in the circuit).
Definition at line 61 of file logderiv_lookup_relation.hpp.
|
inlinestatic |
Definition at line 45 of file logderiv_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 26 of file logderiv_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 24 of file logderiv_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 25 of file logderiv_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 43 of file logderiv_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 29 of file logderiv_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 37 of file logderiv_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 22 of file logderiv_lookup_relation.hpp.