139 const std::vector<FF>& multivariate_challenge,
146 const FF evaluation_challenge_x,
147 const FF batching_challenge_v,
167 const std::vector<FF>& multivariate_challenge,
168 const size_t& log_circuit_size);
245 const FF& small_ipa_eval_challenge,
246 const std::vector<FF>& challenge_polynomial,
247 const FF& inner_product_eval_claim,
248 const FF& vanishing_poly_eval)
254 challenge_polynomial, small_ipa_eval_challenge, vanishing_poly_eval);
256 const FF& concatenated_at_r = small_ipa_evaluations[0];
257 const FF& grand_sum_shifted_eval = small_ipa_evaluations[1];
258 const FF& grand_sum_eval = small_ipa_evaluations[2];
259 const FF& quotient_eval = small_ipa_evaluations[3];
263 FF diff = lagrange_first * grand_sum_eval;
265 (grand_sum_shifted_eval - grand_sum_eval - concatenated_at_r * challenge_poly);
266 diff += lagrange_last * (grand_sum_eval - inner_product_eval_claim) - vanishing_poly_eval * quotient_eval;
273 diff.assert_equal(
FF(0));
276 return (diff.get_value() ==
FF(0).get_value());
278 return (diff ==
FF(0));
295 const FF& gemini_evaluation_challenge,
296 const std::vector<FF>& multilinear_challenge,
297 const FF& inner_product_eval_claim)
302 const FF vanishing_poly_eval = gemini_evaluation_challenge.pow(
SUBGROUP_SIZE) -
FF(1);
305 gemini_evaluation_challenge,
306 compute_challenge_polynomial_coeffs<Curve>(multilinear_challenge),
307 inner_product_eval_claim,
308 vanishing_poly_eval);
323 const FF& evaluation_challenge,
324 const FF& evaluation_challenge_x,
325 const FF& batching_challenge_v,
326 const FF& inner_product_eval_claim)
333 evaluation_challenge,
334 compute_eccvm_challenge_coeffs<Curve>(evaluation_challenge_x, batching_challenge_v),
335 inner_product_eval_claim,
336 vanishing_poly_eval);
349 bool evaluation_challenge_in_small_subgroup =
false;
351 evaluation_challenge_in_small_subgroup = (vanishing_poly_eval.get_value() ==
FF(0).get_value());
353 evaluation_challenge_in_small_subgroup = (vanishing_poly_eval ==
FF(0));
356 if (evaluation_challenge_in_small_subgroup) {
374 const std::vector<FF>& coeffs,
const FF& r,
const FF& vanishing_poly_eval)
379 auto builder = r.get_context();
380 one.convert_constant_to_fixed_witness(
builder);
381 zero.convert_constant_to_fixed_witness(
builder);
386 std::array<FF, SUBGROUP_SIZE> denominators;
387 FF running_power = one;
389 denominators[i] = running_power * r - one;
396 denominators.begin(), denominators.end(), denominators.begin(), [](
FF& d) { return d.invert(); });
410 result.begin(), result.end(), result.begin(), [&](
FF& denominator) { return denominator * numerator; });
432template <
typename Curve>
441 const size_t challenge_poly_length = libra_univariates_length * multivariate_challenge.size() + 1;
446 auto builder = multivariate_challenge[0].get_context();
447 one.convert_constant_to_fixed_witness(
builder);
448 zero.convert_constant_to_fixed_witness(
builder);
451 challenge_polynomial_lagrange[0] = one;
454 size_t round_idx = 0;
455 for (
auto challenge : multivariate_challenge) {
456 size_t current_idx = 1 + libra_univariates_length * round_idx;
457 challenge_polynomial_lagrange[current_idx] = one;
458 for (
size_t idx = current_idx + 1; idx < current_idx + libra_univariates_length; idx++) {
460 challenge_polynomial_lagrange[idx] = challenge_polynomial_lagrange[idx - 1] * challenge;
467 challenge_polynomial_lagrange[idx] = zero;
470 return challenge_polynomial_lagrange;
485template <
typename Curve>
494 auto builder = evaluation_challenge_x.get_context();
495 one.convert_constant_to_fixed_witness(
builder);
496 zero.convert_constant_to_fixed_witness(
builder);
499 for (
size_t poly_idx = 0; poly_idx < NUM_TRANSLATION_EVALUATIONS; poly_idx++) {
500 const size_t start = NUM_DISABLED_ROWS_IN_SUMCHECK * poly_idx;
501 coeffs_lagrange_basis[start] = v_power;
503 for (
size_t idx = start + 1; idx < start + NUM_DISABLED_ROWS_IN_SUMCHECK; idx++) {
504 coeffs_lagrange_basis[idx] = coeffs_lagrange_basis[idx - 1] * evaluation_challenge_x;
507 v_power *= batching_challenge_v;
510 static constexpr size_t challenge_poly_length = NUM_TRANSLATION_EVALUATIONS * NUM_DISABLED_ROWS_IN_SUMCHECK;
514 coeffs_lagrange_basis[idx] = zero;
517 return coeffs_lagrange_basis;
CommitmentKey object over a pairing group 𝔾₁.
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
A Curve-agnostic ZK protocol to prove inner products of small vectors.
std::shared_ptr< typename Flavor::Transcript > transcript
void compute_eccvm_challenge_polynomial(const FF evaluation_challenge_x, const FF batching_challenge_v)
Compute a (public) challenge polynomial from the evaluation and batching challenges.
const Polynomial< FF > & get_batched_polynomial() const
static constexpr size_t WITNESS_MASKING_TERM_LENGTH
typename Curve::ScalarField FF
std::array< bb::Polynomial< FF >, NUM_SMALL_IPA_EVALUATIONS > get_witness_polynomials() const
void compute_challenge_polynomial(const std::vector< FF > &multivariate_challenge)
Computes the challenge polynomial F(X) based on the provided multivariate challenges.
static constexpr size_t MASKED_CONCATENATED_WITNESS_LENGTH
Polynomial< FF > concatenated_polynomial
static constexpr size_t QUOTIENT_LENGTH
static Polynomial< FF > compute_monomial_coefficients(std::span< FF > lagrange_coeffs, const std::array< FF, SUBGROUP_SIZE > &interpolation_domain, const EvaluationDomain< FF > &bn_evaluation_domain)
Given a vector of coefficients of a polynomial in the Lagrange basis over , compute its coefficients ...
static constexpr FF subgroup_generator
std::array< std::string, NUM_SMALL_IPA_EVALUATIONS > evaluation_labels()
std::array< FF, SUBGROUP_SIZE > interpolation_domain
std::array< FF, NUM_SMALL_IPA_EVALUATIONS > evaluation_points(const FF &small_ipa_evaluation_challenge)
void compute_grand_sum_polynomial()
Computes the grand sum polynomial .
static constexpr size_t MASKED_GRAND_SUM_LENGTH
static std::array< Polynomial< FF >, 2 > compute_lagrange_first_and_last(const std::array< FF, SUBGROUP_SIZE > &interpolation_domain, const EvaluationDomain< FF > &bn_evaluation_domain)
Compute monomial coefficients of the first and last Lagrange polynomials.
typename Flavor::Curve Curve
void compute_grand_sum_identity_quotient()
Efficiently compute the quotient of the grand sum identity polynomial by .
Polynomial< FF > grand_sum_polynomial_unmasked
static FF compute_claimed_inner_product(ZKSumcheckData< Flavor > &zk_sumcheck_data, const std::vector< FF > &multivariate_challenge, const size_t &log_circuit_size)
For test purposes: Compute the sum of the Libra constant term and Libra univariates evaluated at Sumc...
const Polynomial< FF > & get_challenge_polynomial() const
static constexpr size_t GRAND_SUM_MASKING_TERM_LENGTH
static constexpr size_t LIBRA_UNIVARIATES_LENGTH
void compute_grand_sum_identity_polynomial()
Compute , where is the fixed generator of .
Polynomial< FF > concatenated_lagrange_form
Polynomial< FF > grand_sum_identity_polynomial
Flavor::CommitmentKey commitment_key
Polynomial< FF > challenge_polynomial_lagrange
EvaluationDomain< FF > bn_evaluation_domain
Polynomial< FF > challenge_polynomial
void prove()
Compute the derived witnesses and and commit to them.
static constexpr size_t GRAND_SUM_IDENTITY_LENGTH
Polynomial< FF > grand_sum_polynomial
Polynomial< FF > grand_sum_identity_quotient
static constexpr size_t SUBGROUP_SIZE
FF compute_claimed_translation_inner_product(TranslationData< typename Flavor::Transcript > &translation_data)
For test purposes: compute the batched evaluation of the last NUM_DISABLED_ROWS_IN_SUMCHECK rows of t...
std::array< FF, SUBGROUP_SIZE > grand_sum_lagrange_coeffs
Verifies the consistency of polynomial evaluations provided by the the prover.
static std::array< FF, NUM_BARYCENTRIC_EVALUATIONS > compute_batched_barycentric_evaluations(const std::vector< FF > &coeffs, const FF &r, const FF &vanishing_poly_eval)
Efficient batch evaluation of the challenge polynomial, Lagrange first, and Lagrange last.
typename Curve::ScalarField FF
static constexpr size_t NUM_BARYCENTRIC_EVALUATIONS
static bool check_libra_evaluations_consistency(const std::array< FF, NUM_SMALL_IPA_EVALUATIONS > &libra_evaluations, const FF &gemini_evaluation_challenge, const std::vector< FF > &multilinear_challenge, const FF &inner_product_eval_claim)
A method required by ZKSumcheck. The challenge polynomial is concatenated from the powers of the sumc...
static void handle_edge_cases(const FF &vanishing_poly_eval)
Check if the random evaluation challenge is in the SmallSubgroup.
static constexpr size_t LIBRA_UNIVARIATES_LENGTH
static std::array< std::string, NUM_SMALL_IPA_EVALUATIONS > evaluation_labels(const std::string &label_prefix)
static bool check_consistency(const std::array< FF, NUM_SMALL_IPA_EVALUATIONS > &small_ipa_evaluations, const FF &small_ipa_eval_challenge, const std::vector< FF > &challenge_polynomial, const FF &inner_product_eval_claim, const FF &vanishing_poly_eval)
Generic consistency check agnostic to challenge polynomial .
static constexpr size_t SUBGROUP_SIZE
static bool check_eccvm_evaluations_consistency(const std::array< FF, NUM_SMALL_IPA_EVALUATIONS > &small_ipa_evaluations, const FF &evaluation_challenge, const FF &evaluation_challenge_x, const FF &batching_challenge_v, const FF &inner_product_eval_claim)
A method required for the verification Translation Evaluations in the ECCVMVerifier....
static std::array< FF, NUM_SMALL_IPA_EVALUATIONS > evaluation_points(const FF &small_ipa_evaluation_challenge)
A class designed to accept the ECCVM Transcript Polynomials, concatenate their masking terms in Lagra...
static constexpr size_t SUBGROUP_SIZE
static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH
static constexpr bool is_stdlib_type
static constexpr ScalarField subgroup_generator_inverse
static constexpr ScalarField subgroup_generator
Entry point for Barretenberg command-line interface.
std::array< std::string, NUM_SMALL_IPA_EVALUATIONS > get_evaluation_labels(const std::string &label_prefix)
Shared by Prover and Verifier. label_prefix is either Libra: or Translation:.
std::array< FF, NUM_SMALL_IPA_EVALUATIONS > compute_evaluation_points(const FF &small_ipa_evaluation_challenge, const FF &subgroup_generator)
The verification of Grand Sum Identity requires the evaluations G(r), A(g * r), A(r),...
std::vector< typename Curve::ScalarField > compute_eccvm_challenge_coeffs(const typename Curve::ScalarField &evaluation_challenge_x, const typename Curve::ScalarField &batching_challenge_v)
Denote and . Given an evaluation challenge and a batching challenge , compute the polynomial whose ...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
This structure is created to contain various polynomials and constants required by ZK Sumcheck.
constexpr field invert() const noexcept
static void batch_invert(std::span< field > coeffs) noexcept
void throw_or_abort(std::string const &err)