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

#include <ultra_arithmetic_relation.hpp>

Public Types

using FF = FF_
 

Static Public Member Functions

template<typename AllEntities >
static bool skip (const AllEntities &in)
 Returns true if the contribution from all subrelations for the provided inputs is identically zero.
 
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters >
static void accumulate (ContainerOverSubrelations &evals, const AllEntities &in, BB_UNUSED const Parameters &params, const FF &scaling_factor)
 Expression for the Ultra (width-4) Arithmetic gate.
 

Static Public Attributes

static constexpr std::array< size_t, 2 > SUBRELATION_PARTIAL_LENGTHS
 

Detailed Description

template<typename FF_>
class bb::ArithmeticRelationImpl< FF_ >

Definition at line 12 of file ultra_arithmetic_relation.hpp.

Member Typedef Documentation

◆ FF

template<typename FF_ >
using bb::ArithmeticRelationImpl< FF_ >::FF = FF_

Definition at line 14 of file ultra_arithmetic_relation.hpp.

Member Function Documentation

◆ accumulate()

template<typename FF_ >
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters >
static void bb::ArithmeticRelationImpl< FF_ >::accumulate ( ContainerOverSubrelations &  evals,
const AllEntities &  in,
BB_UNUSED const Parameters &  params,
const FF scaling_factor 
)
inlinestatic

Expression for the Ultra (width-4) Arithmetic gate.

This relation contains two subrelations and encapsulates several identities, toggled by the value of q_arith in [0, 1, 2, 3].

Subrelation 1: q_arith * [ (-1/2) * (q_arith - 3) * (q_m * w_1 * w_2) + \sum_{i=1..4} q_i * w_i + q_c + (q_arith - 1) * w_4_shift]

Subrelation 2: q_arith * (q_arith - 1) * (q_arith - 2) * (w_1 + w_4 - w_1_shift + q_m)

These formulas result in several cases depending on q_arith:

CASE q_arith == 0: Arithmetic gate is completely disabled

CASE q_arith == 1: Conventional 4-wire Ultra arithmetic relation Subrelation 1: q_m * w_1 * w_2 + \sum_{i=1..4} q_i * w_i + q_c Subrelation 2: Disabled

CASE q_arith == 2: Same as above but with an additional linear term: +w_4_shift Subrelation 1: q_m * w_1 * w_2 + [ \sum_{i=1..4} q_i * w_i + q_c + w_4_shift ] * 2 Subrelation 2: Disabled Note: Factor of 2 on the linear term must be accounted for when constructing inputs to the relation.

CASE q_arith == 3: Subrelation 1: [ \sum_{i=1..4} q_i * w_i + q_c + (2 * w_4_shift) ] * 3 Subrelation 2: [ w_1 + w_4 - w_1_shift + q_m ] * 6 Note: We are repurposing q_m here as an additive term in the second subrelation. Note: Factor of 2 on the w_4_shift term must be accounted for when constructing inputs to the relation.

Parameters
evalstransformed to evals + C(in(X)...)*scaling_factor
inInputs to the relation algebra
parametersUnused in this relation
scaling_factoroptional term to scale the evaluation before adding to evals.

Definition at line 64 of file ultra_arithmetic_relation.hpp.

◆ skip()

template<typename FF_ >
template<typename AllEntities >
static bool bb::ArithmeticRelationImpl< FF_ >::skip ( const AllEntities &  in)
inlinestatic

Returns true if the contribution from all subrelations for the provided inputs is identically zero.

Definition at line 25 of file ultra_arithmetic_relation.hpp.

Member Data Documentation

◆ SUBRELATION_PARTIAL_LENGTHS

template<typename FF_ >
constexpr std::array<size_t, 2> bb::ArithmeticRelationImpl< FF_ >::SUBRELATION_PARTIAL_LENGTHS
staticconstexpr
Initial value:
{
6,
5
}

Definition at line 16 of file ultra_arithmetic_relation.hpp.


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