Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId > Class Template Reference

Log-derivative lookup argument for a single DataBus column. More...

#include <databus_lookup_relation.hpp>

Public Types

using FF = FF_
 

Static Public Member Functions

template<typename AllEntities >
static bool skip (const AllEntities &in)
 
template<typename Accumulator , typename AllEntities >
static Accumulator get_read_selector (const AllEntities &in)
 Compute scalar for read term in log derivative lookup argument.
 
template<typename Accumulator , typename AllEntities , typename Parameters >
static Accumulator compute_table_term (const AllEntities &in, const Parameters &params)
 Write term denominator: value + databus_id·β + γ.
 
template<typename Accumulator , typename AllEntities , typename Parameters >
static Accumulator compute_lookup_term (const AllEntities &in, const Parameters &params)
 Read term denominator: w_l + w_r·β + γ. Bus-independent.
 
template<typename Polynomials >
static void compute_logderivative_inverse (Polynomials &polynomials, auto &relation_parameters, const size_t circuit_size, const size_t start_index=0)
 Compute the column's inverse polynomial \(I_i = (L_i · T_i)^{-1}\) at active rows.
 
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters >
static void accumulate (ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &params, const FF &scaling_factor)
 Accumulate this column's four subrelation contributions. (1a) (I*L*T - 1) * is_read = 0 (1b) (I*L*T - 1) * count = 0 (2) (is_read*T - count*L)*I = 0 (linearly dependent — summed across trace) (3) (1 - indicator) * count = 0 (read_counts vanish outside the bus's data rows)
 

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 READ_COUNT_LOCALITY_SUBREL_LENGTH = 3
 
static constexpr std::array< size_t, 4 > SUBRELATION_PARTIAL_LENGTHS
 
static constexpr std::array< bool, 4 > SUBRELATION_LINEARLY_INDEPENDENT { true, true, false, true }
 
static constexpr bool IS_SINGLE_BUS_LOOKUP = true
 
static constexpr bool HAS_LOGDERIVATIVE_INVERSE_COMPUTATION = true
 

Detailed Description

template<typename FF_, auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
class bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >

Log-derivative lookup argument for a single DataBus column.

Each bus column (kernel_calldata, app_calldata_0, …, returndata) is its own table; this relation establishes that reads from one column are well-formed. The relation is parameterized on the EntityId values for the column's five entities — value, read_counts, inverses, indicator, selector — so the flavor binds a concrete bus at typedef time and the C++ side sees a fixed-shape relation with no bus loop. A flavor with N buses simply lists N independent SingleBusLookupRelation instantiations in its Relations_<FF> tuple.

Per-column subrelations (4 total):

(1a) Inverse correctness on read rows: (I · L · T − 1) · is_read = 0 (per-row, deg 5) (1b) Inverse correctness on write rows: (I · L · T − 1) · count = 0 (per-row, deg 4) (2) Lookup identity (linearly dep'nt): Σ_rows (is_read · T − count · L) · I = 0 (deg 4) (3) Read-count locality: (1 − indicator) · count = 0 (per-row, deg 2)

Where L = w_l + w_r·β + γ (read term) and T = value + databus_id·β + γ (table term). is_read = q_busread · selector. Subrelations (1a)/(1b)/(2) all share length 6 to amortize the common I·L·T − 1 factor across rows; (3) uses length 3 since it has no shared computation.

Definition at line 40 of file databus_lookup_relation.hpp.

Member Typedef Documentation

◆ FF

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
using bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::FF = FF_

Definition at line 42 of file databus_lookup_relation.hpp.

Member Function Documentation

◆ accumulate()

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters >
static void bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::accumulate ( ContainerOverSubrelations &  accumulator,
const AllEntities in,
const Parameters &  params,
const FF scaling_factor 
)
inlinestatic

Accumulate this column's four subrelation contributions. (1a) (I*L*T - 1) * is_read = 0 (1b) (I*L*T - 1) * count = 0 (2) (is_read*T - count*L)*I = 0 (linearly dependent — summed across trace) (3) (1 - indicator) * count = 0 (read_counts vanish outside the bus's data rows)

Definition at line 159 of file databus_lookup_relation.hpp.

◆ compute_logderivative_inverse()

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
template<typename Polynomials >
static void bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::compute_logderivative_inverse ( Polynomials &  polynomials,
auto &  relation_parameters,
const size_t  circuit_size,
const size_t  start_index = 0 
)
inlinestatic

Compute the column's inverse polynomial \(I_i = (L_i · T_i)^{-1}\) at active rows.

Note
\(I_i = 0\) at rows that are neither a read gate nor have a non-zero read count, so the cost is proportional to the column's actual usage.

Definition at line 118 of file databus_lookup_relation.hpp.

◆ compute_lookup_term()

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
template<typename Accumulator , typename AllEntities , typename Parameters >
static Accumulator bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::compute_lookup_term ( const AllEntities in,
const Parameters &  params 
)
inlinestatic

Read term denominator: w_l + w_r·β + γ. Bus-independent.

Definition at line 98 of file databus_lookup_relation.hpp.

◆ compute_table_term()

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
template<typename Accumulator , typename AllEntities , typename Parameters >
static Accumulator bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::compute_table_term ( const AllEntities in,
const Parameters &  params 
)
inlinestatic

Write term denominator: value + databus_id·β + γ.

Definition at line 83 of file databus_lookup_relation.hpp.

◆ get_read_selector()

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
template<typename Accumulator , typename AllEntities >
static Accumulator bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::get_read_selector ( const AllEntities in)
inlinestatic

Compute scalar for read term in log derivative lookup argument.

Read selector for this bus column: q_busread · selector.

Definition at line 73 of file databus_lookup_relation.hpp.

◆ skip()

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
template<typename AllEntities >
static bool bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::skip ( const AllEntities in)
inlinestatic

Definition at line 63 of file databus_lookup_relation.hpp.

Member Data Documentation

◆ HAS_LOGDERIVATIVE_INVERSE_COMPUTATION

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
constexpr bool bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::HAS_LOGDERIVATIVE_INVERSE_COMPUTATION = true
staticconstexpr

Definition at line 61 of file databus_lookup_relation.hpp.

◆ INVERSE_READ_SUBREL_LENGTH

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
constexpr size_t bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::INVERSE_READ_SUBREL_LENGTH = 6
staticconstexpr

Definition at line 44 of file databus_lookup_relation.hpp.

◆ INVERSE_WRITE_SUBREL_LENGTH

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
constexpr size_t bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::INVERSE_WRITE_SUBREL_LENGTH = 6
staticconstexpr

Definition at line 45 of file databus_lookup_relation.hpp.

◆ IS_SINGLE_BUS_LOOKUP

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
constexpr bool bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::IS_SINGLE_BUS_LOOKUP = true
staticconstexpr

Definition at line 60 of file databus_lookup_relation.hpp.

◆ LOOKUP_SUBREL_LENGTH

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
constexpr size_t bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::LOOKUP_SUBREL_LENGTH = 6
staticconstexpr

Definition at line 46 of file databus_lookup_relation.hpp.

◆ READ_COUNT_LOCALITY_SUBREL_LENGTH

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
constexpr size_t bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::READ_COUNT_LOCALITY_SUBREL_LENGTH = 3
staticconstexpr

Definition at line 47 of file databus_lookup_relation.hpp.

◆ SUBRELATION_LINEARLY_INDEPENDENT

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
constexpr std::array<bool, 4> bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::SUBRELATION_LINEARLY_INDEPENDENT { true, true, false, true }
staticconstexpr

Definition at line 56 of file databus_lookup_relation.hpp.

◆ SUBRELATION_PARTIAL_LENGTHS

template<typename FF_ , auto ValueId, auto ReadCountsId, auto InversesId, auto IndicatorId, auto SelectorId>
constexpr std::array<size_t, 4> bb::SingleBusLookupRelationImpl< FF_, ValueId, ReadCountsId, InversesId, IndicatorId, SelectorId >::SUBRELATION_PARTIAL_LENGTHS
staticconstexpr

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