Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::GeminiProver_< Curve >::PolynomialBatcher Class Reference

Class responsible for computation of the batched multilinear polynomials required by the Gemini protocol. More...

#include <gemini.hpp>

Public Member Functions

 PolynomialBatcher (const size_t full_batched_size)
 
bool has_unshifted () const
 
bool has_to_be_shifted_by_one () const
 
bool has_to_be_shifted_by_k () const
 
bool has_interleaved () const
 
void set_unshifted (RefVector< Polynomial > polynomials)
 
void set_to_be_shifted_by_one (RefVector< Polynomial > polynomials)
 
void set_to_be_shifted_by_k (RefVector< Polynomial > polynomials, const size_t shift_magnitude)
 
void set_random_polynomial (Polynomial &&random)
 
void set_interleaved (RefVector< Polynomial > results, std::vector< RefVector< Polynomial > > groups)
 
Polynomial compute_batched (const Fr &challenge, Fr &running_scalar)
 Compute batched polynomial A₀ = F + G/X as the linear combination of all polynomials to be opened.
 
std::pair< Polynomial, Polynomialcompute_partially_evaluated_batch_polynomials (const Fr &r_challenge)
 Compute partially evaluated batched polynomials A₀(X, r) = A₀₊ = F + G/r, A₀(X, -r) = A₀₋ = F - G/r.
 
std::pair< Polynomial, Polynomialcompute_partially_evaluated_interleaved_polynomial (const Fr &r_challenge)
 Compute the partially evaluated polynomials P₊(X, r) and P₋(X, -r)
 
size_t get_group_size ()
 

Private Attributes

size_t full_batched_size = 0
 
bool batched_unshifted_initialized = false
 
Polynomial random_polynomial
 
bool has_random_polynomial = false
 
RefVector< Polynomialunshifted
 
RefVector< Polynomialto_be_shifted_by_one
 
RefVector< Polynomialto_be_shifted_by_k
 
RefVector< Polynomialinterleaved
 
std::vector< RefVector< Polynomial > > groups_to_be_interleaved
 
size_t k_shift_magnitude = 0
 
Polynomial batched_unshifted
 
Polynomial batched_to_be_shifted_by_one
 
Polynomial batched_to_be_shifted_by_k
 
Polynomial batched_interleaved
 
std::vector< Polynomialbatched_group
 

Detailed Description

template<typename Curve>
class bb::GeminiProver_< Curve >::PolynomialBatcher

Class responsible for computation of the batched multilinear polynomials required by the Gemini protocol.

Opening multivariate polynomials using Gemini requires the computation of three batched polynomials. The first, here denoted A₀, is a linear combination of all polynomials to be opened. If we denote the linear combinations (based on challenge rho) of the unshifted, to-be-shifted-by-1, and to-be-right-shifted-by-k polynomials by F, G, and H respectively, then A₀ = F + G/X + X^k*H. (Note: 'k' is assumed even and thus a factor (-1)^k in not needed for the evaluation at -r). This polynomial is "folded" in Gemini to produce d-1 univariate polynomials Fold_i, i = 1, ..., d-1. The second and third are the partially evaluated batched polynomials A₀₊ = F

  • G/r + r^K*H, and A₀₋ = F - G/r + r^K*H. These are required in order to prove the opening of shifted polynomials G_i/X, X^k*H_i and from the commitments to their unshifted counterparts G_i and H_i.
    Note
    TODO(https://github.com/AztecProtocol/barretenberg/issues/1223): There are certain operations herein that could be made more efficient by e.g. reusing already initialized polynomials, possibly at the expense of clarity.

Definition at line 123 of file gemini.hpp.

Constructor & Destructor Documentation

◆ PolynomialBatcher()

template<typename Curve >
bb::GeminiProver_< Curve >::PolynomialBatcher::PolynomialBatcher ( const size_t  full_batched_size)
inline

Definition at line 148 of file gemini.hpp.

Member Function Documentation

◆ compute_batched()

template<typename Curve >
Polynomial bb::GeminiProver_< Curve >::PolynomialBatcher::compute_batched ( const Fr challenge,
Fr running_scalar 
)
inline

Compute batched polynomial A₀ = F + G/X as the linear combination of all polynomials to be opened.

If the random polynomial is set, it is added to the batched polynomial for ZK

Parameters
challengebatching challenge
running_scalarpower of the batching challenge
Returns
Polynomial A₀

Definition at line 195 of file gemini.hpp.

◆ compute_partially_evaluated_batch_polynomials()

template<typename Curve >
std::pair< Polynomial, Polynomial > bb::GeminiProver_< Curve >::PolynomialBatcher::compute_partially_evaluated_batch_polynomials ( const Fr r_challenge)
inline

Compute partially evaluated batched polynomials A₀(X, r) = A₀₊ = F + G/r, A₀(X, -r) = A₀₋ = F - G/r.

If the random polynomial is set, it is added to each batched polynomial for ZK

Parameters
r_challengepartial evaluation challenge
Returns
std::pair<Polynomial, Polynomial> {A₀₊, A₀₋}

Definition at line 257 of file gemini.hpp.

◆ compute_partially_evaluated_interleaved_polynomial()

template<typename Curve >
std::pair< Polynomial, Polynomial > bb::GeminiProver_< Curve >::PolynomialBatcher::compute_partially_evaluated_interleaved_polynomial ( const Fr r_challenge)
inline

Compute the partially evaluated polynomials P₊(X, r) and P₋(X, -r)

If the interleaved polynomials are set, the full partially evaluated identites A₀(r) and A₀(-r) contain the contributions of P₊(r^s) and P₋(r^s) respectively where s is the size of the interleaved group assumed even. This function computes P₊(X) = ∑ r^i Pᵢ(X) and P₋(X) = ∑ (-r)^i Pᵢ(X) where Pᵢ(X) is the i-th polynomial in the batched group.

Parameters
r_challengepartial evaluation challenge
Returns
std::pair<Polynomial, Polynomial> {P₊, P₋}

Definition at line 298 of file gemini.hpp.

◆ get_group_size()

template<typename Curve >
size_t bb::GeminiProver_< Curve >::PolynomialBatcher::get_group_size ( )
inline

Definition at line 315 of file gemini.hpp.

◆ has_interleaved()

template<typename Curve >
bool bb::GeminiProver_< Curve >::PolynomialBatcher::has_interleaved ( ) const
inline

Definition at line 157 of file gemini.hpp.

◆ has_to_be_shifted_by_k()

template<typename Curve >
bool bb::GeminiProver_< Curve >::PolynomialBatcher::has_to_be_shifted_by_k ( ) const
inline

Definition at line 156 of file gemini.hpp.

◆ has_to_be_shifted_by_one()

template<typename Curve >
bool bb::GeminiProver_< Curve >::PolynomialBatcher::has_to_be_shifted_by_one ( ) const
inline

Definition at line 155 of file gemini.hpp.

◆ has_unshifted()

template<typename Curve >
bool bb::GeminiProver_< Curve >::PolynomialBatcher::has_unshifted ( ) const
inline

Definition at line 154 of file gemini.hpp.

◆ set_interleaved()

template<typename Curve >
void bb::GeminiProver_< Curve >::PolynomialBatcher::set_interleaved ( RefVector< Polynomial results,
std::vector< RefVector< Polynomial > >  groups 
)
inline

Definition at line 177 of file gemini.hpp.

◆ set_random_polynomial()

template<typename Curve >
void bb::GeminiProver_< Curve >::PolynomialBatcher::set_random_polynomial ( Polynomial &&  random)
inline

Definition at line 171 of file gemini.hpp.

◆ set_to_be_shifted_by_k()

template<typename Curve >
void bb::GeminiProver_< Curve >::PolynomialBatcher::set_to_be_shifted_by_k ( RefVector< Polynomial polynomials,
const size_t  shift_magnitude 
)
inline

Definition at line 162 of file gemini.hpp.

◆ set_to_be_shifted_by_one()

template<typename Curve >
void bb::GeminiProver_< Curve >::PolynomialBatcher::set_to_be_shifted_by_one ( RefVector< Polynomial polynomials)
inline

Definition at line 161 of file gemini.hpp.

◆ set_unshifted()

template<typename Curve >
void bb::GeminiProver_< Curve >::PolynomialBatcher::set_unshifted ( RefVector< Polynomial polynomials)
inline

Definition at line 160 of file gemini.hpp.

Member Data Documentation

◆ batched_group

template<typename Curve >
std::vector<Polynomial> bb::GeminiProver_< Curve >::PolynomialBatcher::batched_group
private

Definition at line 145 of file gemini.hpp.

◆ batched_interleaved

template<typename Curve >
Polynomial bb::GeminiProver_< Curve >::PolynomialBatcher::batched_interleaved
private

Definition at line 142 of file gemini.hpp.

◆ batched_to_be_shifted_by_k

template<typename Curve >
Polynomial bb::GeminiProver_< Curve >::PolynomialBatcher::batched_to_be_shifted_by_k
private

Definition at line 141 of file gemini.hpp.

◆ batched_to_be_shifted_by_one

template<typename Curve >
Polynomial bb::GeminiProver_< Curve >::PolynomialBatcher::batched_to_be_shifted_by_one
private

Definition at line 140 of file gemini.hpp.

◆ batched_unshifted

template<typename Curve >
Polynomial bb::GeminiProver_< Curve >::PolynomialBatcher::batched_unshifted
private

Definition at line 139 of file gemini.hpp.

◆ batched_unshifted_initialized

template<typename Curve >
bool bb::GeminiProver_< Curve >::PolynomialBatcher::batched_unshifted_initialized = false
private

Definition at line 126 of file gemini.hpp.

◆ full_batched_size

template<typename Curve >
size_t bb::GeminiProver_< Curve >::PolynomialBatcher::full_batched_size = 0
private

Definition at line 125 of file gemini.hpp.

◆ groups_to_be_interleaved

template<typename Curve >
std::vector<RefVector<Polynomial> > bb::GeminiProver_< Curve >::PolynomialBatcher::groups_to_be_interleaved
private

Definition at line 135 of file gemini.hpp.

◆ has_random_polynomial

template<typename Curve >
bool bb::GeminiProver_< Curve >::PolynomialBatcher::has_random_polynomial = false
private

Definition at line 129 of file gemini.hpp.

◆ interleaved

template<typename Curve >
RefVector<Polynomial> bb::GeminiProver_< Curve >::PolynomialBatcher::interleaved
private

Definition at line 134 of file gemini.hpp.

◆ k_shift_magnitude

template<typename Curve >
size_t bb::GeminiProver_< Curve >::PolynomialBatcher::k_shift_magnitude = 0
private

Definition at line 137 of file gemini.hpp.

◆ random_polynomial

template<typename Curve >
Polynomial bb::GeminiProver_< Curve >::PolynomialBatcher::random_polynomial
private

Definition at line 128 of file gemini.hpp.

◆ to_be_shifted_by_k

template<typename Curve >
RefVector<Polynomial> bb::GeminiProver_< Curve >::PolynomialBatcher::to_be_shifted_by_k
private

Definition at line 133 of file gemini.hpp.

◆ to_be_shifted_by_one

template<typename Curve >
RefVector<Polynomial> bb::GeminiProver_< Curve >::PolynomialBatcher::to_be_shifted_by_one
private

Definition at line 132 of file gemini.hpp.

◆ unshifted

template<typename Curve >
RefVector<Polynomial> bb::GeminiProver_< Curve >::PolynomialBatcher::unshifted
private

Definition at line 131 of file gemini.hpp.


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