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, const Parameters &, const FF &scaling_factor) |
Expression for the Ultra 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::UltraArithmeticRelationImpl< FF_ >::FF = FF_ |
Definition at line 14 of file ultra_arithmetic_relation.hpp.
|
inlinestatic |
Expression for the Ultra Arithmetic gate.
This relation encapsulates several idenitities, toggled by the value of q_arith in [0, 1, 2, 3, ...].
The whole formula is:
q_arith * ( ( (-1/2) * (q_arith - 3) * q_m * w_1 * w_2 + q_1 * w_1 + q_2 * w_2 + q_3 * w_3 + q_4 * w_4 + q_c ) + (q_arith - 1)*( α * (q_arith - 2) * (w_1 + w_4 - w_1_omega + q_m) + w_4_omega) ) = 0
This formula results in several cases depending on q_arith:
q_1 * w_1 + q_2 * w_2 + q_3 * w_3 + q_4 * w_4 + q_c + 2 * w_4_omega = 0
w_1 + w_4 - w_1_omega + q_m = 0 (we are reusing q_m here)
(q_arith - 3)* q_m * w_1 * w_ 2 + q_1 * w_1 + q_2 * w_2 + q_3 * w_3 + q_4 * w_4 + q_c + (q_arith - 1) * w_4_omega = 0
w_1 + w_4 - w_1_omega + q_m = 0
The problem that q_m is used both in both equations can be dealt with by appropriately changing selector values at the next gate. Then we can treat (q_arith - 1) as a simulated q_6 selector and scale q_m to handle (q_arith - 3) at product.
The relation is defined as C(in(X)...) = q_arith * [ -1/2(q_arith - 3)(q_m * w_r * w_l) + (q_l * w_l) + (q_r * w_r) + (q_o * w_o) + (q_4 * w_4) + q_c + (q_arith - 1)w_4_shift ]
q_arith * (q_arith - 2) * (q_arith - 1) * (w_l + w_4 - w_l_shift + q_m)
evals | transformed to evals + C(in(X)...)*scaling_factor |
in | an std::array containing the fully extended Univariate edges. |
parameters | contains beta, gamma, and public_input_delta, .... |
scaling_factor | optional term to scale the evaluation before adding to evals. |
Definition at line 79 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.