|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Prover-side eq(X, r) polynomial over Boolean hypercube. More...
#include <eq_polynomial.hpp>
Static Public Member Functions | |
| static Polynomial< FF > | construct (std::span< const FF > challenges, size_t log_num_monomials) |
| Construct eq(X, r) coefficient table over Boolean hypercube {0,1}^d. | |
| static FF | compute_scaling_factor (std::span< const FF > challenge) |
| Compute the scaling factor C = ∏_i (1 - r_i) for coordinate transformation. | |
| static std::vector< FF > | transform_challenge (std::span< const FF > challenges) |
| Transform challenges r_i to γ_i = r_i / (1 - r_i) for optimal method. | |
| static Polynomial< FF > | construct_eq_with_edge_cases (std::span< const FF > r, size_t log_num_monomials) |
| Fallback method: direct construction of eq(X, r) coefficient table for edge cases. | |
Prover-side eq(X, r) polynomial over Boolean hypercube.
eq(X, r) = ∏_{i=0}^{d-1} ((1 - r_i)(1 - X_i) + r_i X_i) = ∏_{i=0}^{d-1} (b_i + a_i X_i), where a_i = 2r_i - 1, b_i = 1 - r_i
This class provides two construction strategies:
In production, challenges are typically generated by hashing the transcript, so with high probability no r_i = 1, and the optimal method is used.
Definition at line 42 of file eq_polynomial.hpp.
|
inlinestatic |
Compute the scaling factor C = ∏_i (1 - r_i) for coordinate transformation.
Used to detect edge cases: if C = 0, then at least one r_i = 1, and we must use the fallback method.
| challenge | The evaluation point r = (r_0, ..., r_{d-1}) |
Definition at line 80 of file eq_polynomial.hpp.
|
inlinestatic |
Construct eq(X, r) coefficient table over Boolean hypercube {0,1}^d.
Automatically selects between optimal and fallback methods based on challenge values:
| challenges | The evaluation point r = (r_0, ..., r_{d-1}) |
| log_num_monomials | The dimension d (must equal challenges.size()) |
Definition at line 56 of file eq_polynomial.hpp.
|
inlinestatic |
Fallback method: direct construction of eq(X, r) coefficient table for edge cases.
Builds the 2^d coefficient table incrementally by processing one Boolean variable at a time. Each iteration doubles the table size by appending coefficients for X_i = 1 to those for X_i = 0.
Algorithm: For each variable i ∈ {0, ..., d-1}:
Cost analysis:
| r | The evaluation point r = (r_0, ..., r_{d-1}) |
| log_num_monomials | The dimension d (must equal r.size()) |
Definition at line 141 of file eq_polynomial.hpp.
|
inlinestatic |
Transform challenges r_i to γ_i = r_i / (1 - r_i) for optimal method.
The coordinate transformation eq(X, r) = C · ∏_i (1 + γ_i X_i) enables use of the optimal pow_β algorithm. Uses batch inversion for efficiency.
| challenges | The evaluation point r = (r_0, ..., r_{d-1}) |
Definition at line 101 of file eq_polynomial.hpp.