|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Log-derivative lookup argument relation for establishing DataBus reads. More...
#include <databus_lookup_relation.hpp>
Classes | |
| struct | BusData |
| struct | BusData< 0, AllEntities > |
| struct | BusData< 1, AllEntities > |
| struct | BusData< 2, AllEntities > |
| struct | BusData< 3, AllEntities > |
| struct | BusData< 4, AllEntities > |
Public Types | |
| using | FF = FF_ |
Static Public Member Functions | |
| template<typename T , size_t N> | |
| static constexpr std::array< T, N *NUM_BUS_COLUMNS > | repeat_per_bus (const std::array< T, N > &pattern) |
| template<typename AllEntities > | |
| static bool | skip (const AllEntities &in) |
| template<typename Accumulator , size_t bus_idx, typename AllEntities > | |
| static Accumulator | get_read_selector (const AllEntities &in) |
| Compute scalar for read term in log derivative lookup argument. | |
| template<typename Accumulator , size_t bus_idx, typename AllEntities , typename Parameters > | |
| static Accumulator | compute_table_term (const AllEntities &in, const Parameters ¶ms) |
| Compute write term denominator in log derivative lookup argument. | |
| template<typename Accumulator , typename AllEntities , typename Parameters > | |
| static Accumulator | compute_lookup_term (const AllEntities &in, const Parameters ¶ms) |
| Compute read term denominator in log derivative lookup argument. | |
| template<size_t bus_idx, typename Polynomials > | |
| static void | compute_logderivative_inverse (Polynomials &polynomials, auto &relation_parameters, const size_t circuit_size, const size_t start_index=0) |
| Construct the polynomial \(I\) whose components are the inverse of the product of the read and write terms. | |
| template<typename FF , size_t bus_idx, typename ContainerOverSubrelations , typename AllEntities , typename Parameters > | |
| static void | accumulate_subrelation_contributions (ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters ¶ms, const FF &scaling_factor) |
| Accumulate the subrelation contributions for reads from a single databus column. | |
| template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters > | |
| static void | accumulate (ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters ¶ms, const FF &scaling_factor) |
| Accumulate the log derivative databus lookup argument subrelation contributions for each databus column. | |
Static Public Attributes | |
| static constexpr size_t | INVERSE_READ_SUBREL_LENGTH = 6 |
| static constexpr size_t | INVERSE_WRITE_SUBREL_LENGTH = 6 |
| static constexpr size_t | LOOKUP_SUBREL_LENGTH = 6 |
| static constexpr size_t | NUM_SUB_RELATION_PER_IDX = 3 |
| static constexpr std::array< size_t, NUM_SUB_RELATION_PER_IDX > | PER_BUS_SUBREL_LENGTHS |
| static constexpr std::array< bool, NUM_SUB_RELATION_PER_IDX > | PER_BUS_LIN_INDEPENDENT { true, true, false } |
| static constexpr std::array< size_t, NUM_SUB_RELATION_PER_IDX *NUM_BUS_COLUMNS > | SUBRELATION_PARTIAL_LENGTHS |
| static constexpr std::array< bool, NUM_SUB_RELATION_PER_IDX *NUM_BUS_COLUMNS > | SUBRELATION_LINEARLY_INDEPENDENT |
Log-derivative lookup argument relation for establishing DataBus reads.
Each column of the databus can be thought of as a table from which we can look up values. The log-derivative lookup argument seeks to prove lookups from a column by establishing the following sum:
\[ \sum_{i=0}^{n-1} q_{\text{logderiv_lookup},i} \cdot \frac{1}{\text{lookup_term}_i} - \text{read_count}_i \cdot \frac{1}{\text{table_term}_i} = 0 \]
where the lookup and table terms are both of the form \(\text{value}_i + \text{idx}_i \cdot \beta + \gamma\). This expression is motivated by taking the derivative of the log of a more conventional grand product style set equivalence argument (see e.g. https://eprint.iacr.org/2022/1530.pdf for details). For the table term, the (idx, value) pair comes from the "table" (bus column), and for the lookup term the (idx, value) pair comes from wires 1 and 2 which should contain a valid entry in the table.
Each column of the DataBus requires its own set of subrelations. The column being read is selected via a unique product, i.e. a lookup from bus column \(j\) is selected via \(q_{\text{busread}} \cdot q_j\) (j = 1,2,...).
For each bus column j, the inverse polynomial \(I_j\) stores \(1/(L \cdot T_j)\) at active rows. Inverse correctness is enforced by two separate subrelations gated by disjoint conditions:
Subrelation 1a (Inverse correctness on read rows):
\[ (I_j \cdot L \cdot T_j - 1) \cdot \text{is\_read}_j = 0 \]
Subrelation 1b (Inverse correctness on write rows):
\[ (I_j \cdot L \cdot T_j - 1) \cdot \text{count}_j = 0 \]
Subrelation 2 (Lookup identity):
\[ \sum_{i=0}^{n-1} [\text{is\_read}_j \cdot T_j - \text{count}_j \cdot L] \cdot I_j = 0 \]
At inactive rows (is_read = 0, count = 0), neither (1a) nor (1b) constrains I, but the lookup identity contribution is zero regardless. The prover gets no free degrees of freedom.
Definition at line 61 of file databus_lookup_relation.hpp.
| using bb::DatabusLookupRelationImpl< FF_ >::FF = FF_ |
Definition at line 63 of file databus_lookup_relation.hpp.
|
inlinestatic |
Accumulate the log derivative databus lookup argument subrelation contributions for each databus column.
| accumulator | transformed to evals + C(in(X)...)*scaling_factor |
| in | an std::array containing the fully extended Accumulator edges. |
| params | contains beta, gamma, and public_input_delta, .... |
| scaling_factor | optional term to scale the evaluation before adding to evals. |
Definition at line 328 of file databus_lookup_relation.hpp.
|
inlinestatic |
Accumulate the subrelation contributions for reads from a single databus column.
Three subrelations are required per bus column: (1a) Inverse correctness on read rows: (I*L*T - 1) * is_read = 0 (1b) Inverse correctness on write rows: (I*L*T - 1) * count = 0 (2) Lookup identity (linearly dependent): (is_read*T - count*L) * I = 0
Definition at line 281 of file databus_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 lookup_term and table_term, then \(I_i = (\text{lookup_term}_i \cdot \text{table_term}_i)^{-1}\).
Definition at line 232 of file databus_lookup_relation.hpp.
|
inlinestatic |
Compute read term denominator in log derivative lookup argument.
Definition at line 205 of file databus_lookup_relation.hpp.
|
inlinestatic |
Compute write term denominator in log derivative lookup argument.
Definition at line 184 of file databus_lookup_relation.hpp.
|
inlinestatic |
Compute scalar for read term in log derivative lookup argument.
The selector indicating read from bus column \(j\) is given by \(q_{\text{busread}} \cdot q_j\), where \(j \in \{1, 2, 3, 4, 5\}\).
Definition at line 168 of file databus_lookup_relation.hpp.
|
inlinestaticconstexpr |
Definition at line 84 of file databus_lookup_relation.hpp.
|
inlinestatic |
Definition at line 100 of file databus_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 68 of file databus_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 69 of file databus_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 70 of file databus_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 71 of file databus_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 81 of file databus_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 75 of file databus_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 97 of file databus_lookup_relation.hpp.
|
staticconstexpr |
Definition at line 95 of file databus_lookup_relation.hpp.