|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#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 ¶ms, 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 |
Definition at line 12 of file ultra_arithmetic_relation.hpp.
| using bb::ArithmeticRelationImpl< FF_ >::FF = FF_ |
Definition at line 14 of file ultra_arithmetic_relation.hpp.
|
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.
| evals | transformed to evals + C(in(X)...)*scaling_factor |
| in | Inputs to the relation algebra |
| parameters | Unused in this relation |
| scaling_factor | optional term to scale the evaluation before adding to evals. |
Definition at line 64 of file ultra_arithmetic_relation.hpp.
|
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.
|
staticconstexpr |
Definition at line 16 of file ultra_arithmetic_relation.hpp.