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

#include <elliptic_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.
 
static constexpr FF get_curve_b ()
 
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters >
static void accumulate (ContainerOverSubrelations &accumulators, const AllEntities &in, const Parameters &, const FF &scaling_factor)
 Expression for elliptic curve point addition and doubling.
 

Static Public Attributes

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

Detailed Description

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

Definition at line 14 of file elliptic_relation.hpp.

Member Typedef Documentation

◆ FF

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

Definition at line 16 of file elliptic_relation.hpp.

Member Function Documentation

◆ accumulate()

template<typename FF_ >
template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters >
static void bb::EllipticRelationImpl< FF_ >::accumulate ( ContainerOverSubrelations &  accumulators,
const AllEntities &  in,
const Parameters &  ,
const FF scaling_factor 
)
inlinestatic

Expression for elliptic curve point addition and doubling.

This relation implements elliptic curve addition/subtraction and doubling operations in short Weierstrass form: y^2 = x^3 + b. Given two distinct points P1 = (x1, y1) and P2 = (x2, y2), compute P3 = P1 ± P2 = (x3, y3) or given a point P1 = (x1, y1), compute P3 = 2*P1 = (x3, y3).

Addition/doubling subrelation constraints are toggled on and off via scaling by: q_elliptic * (1 - q_is_double) and q_elliptic * q_is_double respectively.

Point addition constraints:

Subrelation 0 (x-coordinate): Formula: x3 = lambda^2 - x1 - x2, where lambda = (q_sign * y2 - y1) / (x2 - x1) Constraint (via cancellation of denominator and assumption that q_sign^2 = 1): (x3 + x1 + x2)(x2 - x1)^2 - (y2^2 - y1^2 + 2*q_sign*y2*y1) = 0

Subrelation 1 (y-coordinate): Formula: y3 = lambda * (x1 - x3) - y1 Constraint: (y3 + y1)(x2 - x1) + (q_sign*y2 - y1)(x3 - x1) = 0

Point doubling constraints:

Subrelation 0 (x-coordinate): Formula: x3 = lambda^2 - 2*x1, where lambda = (3*x1^2) / (2*y1) Constraint (via cancellation of denominator and using x1^3 = y1^2 - b): (x3 + 2*x1)*4*y1^2 - 9*x1*(y1^2 - b) = 0

Subrelation 1 (y-coordinate): Formula: y3 = lambda * (x1 - x3) - y1 Constraint: (y3 + y1)(x2 - x1) + (q_sign*y2 - y1)(x3 - x1) = 0

Parameters
accumulatorstransformed to accumulators + C(in(X)...)*scaling_factor
inan std::array containing the fully extended Univariate edges.
parameterscontains beta, gamma, and public_input_delta, ....
scaling_factoroptional term to scale the evaluation before adding to accumulators.

Definition at line 80 of file elliptic_relation.hpp.

◆ get_curve_b()

template<typename FF_ >
static constexpr FF bb::EllipticRelationImpl< FF_ >::get_curve_b ( )
inlinestaticconstexpr

Definition at line 30 of file elliptic_relation.hpp.

◆ skip()

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

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

Definition at line 27 of file elliptic_relation.hpp.

Member Data Documentation

◆ SUBRELATION_PARTIAL_LENGTHS

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

Definition at line 18 of file elliptic_relation.hpp.


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