Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
gemini.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
8
15
52namespace bb {
53
68namespace gemini {
77template <class Fr> inline std::vector<Fr> powers_of_rho(const Fr rho, const size_t num_powers)
78{
79 std::vector<Fr> rhos = { Fr(1), rho };
80 rhos.reserve(num_powers);
81 for (size_t j = 2; j < num_powers; j++) {
82 rhos.emplace_back(rhos[j - 1] * rho);
83 }
84 return rhos;
85};
86
94template <class Fr> inline std::vector<Fr> powers_of_evaluation_challenge(const Fr r, const size_t num_squares)
95{
96 std::vector<Fr> squares = { r };
97 squares.reserve(num_squares);
98 for (size_t j = 1; j < num_squares; j++) {
99 squares.emplace_back(squares[j - 1].sqr());
100 }
101 return squares;
102};
103} // namespace gemini
104
105template <typename Curve> class GeminiProver_ {
106 using Fr = typename Curve::ScalarField;
110
111 public:
130
131 size_t full_batched_size = 0; // size of the full batched polynomial (generally the circuit size)
133
134 Polynomial random_polynomial; // random polynomial used for ZK
136
137 RefVector<Polynomial> unshifted; // set of unshifted polynomials
138 RefVector<Polynomial> to_be_shifted_by_one; // set of polynomials to be left shifted by 1
139 RefVector<Polynomial> to_be_shifted_by_k; // set of polynomials to be right shifted by k
140 RefVector<Polynomial> interleaved; // the interleaved polynomials used in Translator
141 std::vector<RefVector<Polynomial>> groups_to_be_interleaved; // groups of polynomials to be interleaved
142
143 size_t k_shift_magnitude = 0; // magnitude of right-shift-by-k (assumed even)
144
145 Polynomial batched_unshifted; // linear combination of unshifted polynomials
146 Polynomial batched_to_be_shifted_by_one; // linear combination of to-be-shifted polynomials
147 Polynomial batched_to_be_shifted_by_k; // linear combination of to-be-shifted-by-k polynomials
148 Polynomial batched_interleaved; // linear combination of interleaved polynomials
149 // linear combination of the groups to be interleaved where polynomial i in the batched group is obtained by
150 // linearly combining the i-th polynomial in each group
152
153 public:
159
160 bool has_unshifted() const { return unshifted.size() > 0; }
161 bool has_to_be_shifted_by_one() const { return to_be_shifted_by_one.size() > 0; }
162 bool has_to_be_shifted_by_k() const { return to_be_shifted_by_k.size() > 0; }
163 bool has_interleaved() const { return interleaved.size() > 0; }
164
165 // Set references to the polynomials to be batched
166 void set_unshifted(RefVector<Polynomial> polynomials) { unshifted = polynomials; }
168 void set_to_be_shifted_by_k(RefVector<Polynomial> polynomials, const size_t shift_magnitude)
169 {
171 k_shift_magnitude % 2, static_cast<size_t>(0), "k must be even for the formulas herein to be valid");
172 to_be_shifted_by_k = polynomials;
173 k_shift_magnitude = shift_magnitude;
174 }
175
176 // Initialize the random polynomial used to add randomness to the batched polynomials for ZK
178 {
180 random_polynomial = random;
181 }
182
184 {
185 // Ensure the Gemini subprotocol for interleaved polynomials operates correctly
186 if (groups[0].size() % 2 != 0) {
187 throw_or_abort("Group size must be even ");
188 }
189 interleaved = results;
191 }
192
201 Polynomial compute_batched(const Fr& challenge, Fr& running_scalar)
202 {
203 BB_BENCH_NAME("compute_batched");
204 // lambda for batching polynomials; updates the running scalar in place
205 auto batch = [&](Polynomial& batched, const RefVector<Polynomial>& polynomials_to_batch) {
206 for (auto& poly : polynomials_to_batch) {
207 batched.add_scaled(poly, running_scalar);
208 running_scalar *= challenge;
209 }
210 };
211
212 Polynomial full_batched(full_batched_size);
213
214 // if necessary, add randomness to the full batched polynomial for ZK
216 full_batched += random_polynomial; // A₀ += rand
217 }
218
219 // compute the linear combination F of the unshifted polynomials
220 if (has_unshifted()) {
222 full_batched += batched_unshifted; // A₀ += F
223 }
224
225 // compute the linear combination G of the to-be-shifted polynomials
228 full_batched += batched_to_be_shifted_by_one.shifted(); // A₀ += G/X
229 }
230
231 // compute the linear combination H of the to-be-shifted-by-k polynomials
235 full_batched += batched_to_be_shifted_by_k.right_shifted(k_shift_magnitude); // A₀ += X^k * H
236 }
237
238 // compute the linear combination of the interleaved polynomials and groups
239 if (has_interleaved()) {
241 for (size_t i = 0; i < groups_to_be_interleaved[0].size(); ++i) {
243 }
244
245 for (size_t i = 0; i < groups_to_be_interleaved.size(); ++i) {
246 batched_interleaved.add_scaled(interleaved[i], running_scalar);
247 // Use parallel chunking for the batching operations
248 parallel_for([this, running_scalar, i](const ThreadChunk& chunk) {
249 for (size_t j = 0; j < groups_to_be_interleaved[0].size(); ++j) {
250 batched_group[j].add_scaled_chunk(chunk, groups_to_be_interleaved[i][j], running_scalar);
251 }
252 });
253 running_scalar *= challenge;
254 }
255
256 full_batched += batched_interleaved;
257 }
258
259 return full_batched;
260 }
261
265 template <size_t N>
267 const size_t full_batched_size,
268 const std::array<Fr, N>& challenges,
269 const bool shift = false)
270 {
271 BB_BENCH_NAME("compute_batched");
272
273 size_t challenge_idx = 0;
274
275 if (shift) {
276 auto full_batched = Polynomial::shiftable(full_batched_size);
277 for (auto& poly : polynomials_to_batch) {
278 full_batched.add_scaled(poly, challenges[challenge_idx]);
279 challenge_idx += 1;
280 }
281 return full_batched;
282 }
283
284 Polynomial full_batched(full_batched_size);
285 for (auto& poly : polynomials_to_batch) {
286 full_batched.add_scaled(poly, challenges[challenge_idx]);
287 challenge_idx += 1;
288 }
289
290 return full_batched;
291 }
292
302 {
303 // Initialize A₀₊ and compute A₀₊ += Random and A₀₊ += F as necessary
304 Polynomial A_0_pos(full_batched_size); // A₀₊
305
307 A_0_pos += random_polynomial; // A₀₊ += random
308 }
309 if (has_unshifted()) {
310 A_0_pos += batched_unshifted; // A₀₊ += F
311 }
312
314 Fr r_pow_k = r_challenge.pow(k_shift_magnitude); // r^k
316 A_0_pos += batched_to_be_shifted_by_k; // A₀₊ += r^k * H
317 }
318
319 Polynomial A_0_neg = A_0_pos;
320
322 Fr r_inv = r_challenge.invert(); // r⁻¹
323 batched_to_be_shifted_by_one *= r_inv; // G = G/r
324
325 A_0_pos += batched_to_be_shifted_by_one; // A₀₊ += G/r
326 A_0_neg -= batched_to_be_shifted_by_one; // A₀₋ -= G/r
327 }
328
329 return { A_0_pos, A_0_neg };
330 };
343 {
344 Polynomial P_pos(batched_group[0]);
345 Polynomial P_neg(batched_group[0]);
346
347 Fr current_r_shift_pos = r_challenge;
348 Fr current_r_shift_neg = -r_challenge;
349 for (size_t i = 1; i < batched_group.size(); i++) {
350 P_pos.add_scaled(batched_group[i], current_r_shift_pos);
351 P_neg.add_scaled(batched_group[i], current_r_shift_neg);
352 current_r_shift_pos *= r_challenge;
353 current_r_shift_neg *= -r_challenge;
354 }
355
356 return { P_pos, P_neg };
357 }
358
359 size_t get_group_size() { return batched_group.size(); }
360 };
361
362 static std::vector<Polynomial> compute_fold_polynomials(const size_t log_n,
363 std::span<const Fr> multilinear_challenge,
364 const Polynomial& A_0,
365 const bool& has_zk = false);
366
368 const size_t log_n,
369 PolynomialBatcher& polynomial_batcher,
370 const Fr& r_challenge,
371 const std::vector<Polynomial>& batched_groups_to_be_concatenated = {});
372
374 Polynomial&& A_0_pos,
375 Polynomial&& A_0_neg,
376 std::vector<Polynomial>&& fold_polynomials,
377 const Fr& r_challenge);
378
379 template <typename Transcript>
380 static std::vector<Claim> prove(const Fr circuit_size,
381 PolynomialBatcher& polynomial_batcher,
382 std::span<Fr> multilinear_challenge,
383 const CommitmentKey<Curve>& commitment_key,
384 const std::shared_ptr<Transcript>& transcript,
385 bool has_zk = false);
386
387}; // namespace bb
388
389template <typename Curve> class GeminiVerifier_ {
390 using Fr = typename Curve::ScalarField;
391 using GroupElement = typename Curve::Element;
394
395 public:
409 ClaimBatcher& claim_batcher,
410 auto& transcript)
411
412 {
413 const size_t log_n = multilinear_challenge.size();
414 const bool has_interleaved = claim_batcher.interleaved.has_value();
415
416 const Fr rho = transcript->template get_challenge<Fr>("rho");
417
418 GroupElement batched_commitment_unshifted = GroupElement::zero();
419 GroupElement batched_commitment_to_be_shifted = GroupElement::zero();
420
421 Fr batched_evaluation = Fr(0);
422 Fr batching_scalar = Fr(1);
423 for (auto [eval, comm] :
424 zip_view(claim_batcher.get_unshifted().evaluations, claim_batcher.get_unshifted().commitments)) {
425 batched_evaluation += eval * batching_scalar;
426 batched_commitment_unshifted += comm * batching_scalar;
427 batching_scalar *= rho;
428 }
429
430 for (auto [eval, comm] :
431 zip_view(claim_batcher.get_shifted().evaluations, claim_batcher.get_shifted().commitments)) {
432 batched_evaluation += eval * batching_scalar;
433 batched_commitment_to_be_shifted += comm * batching_scalar;
434 batching_scalar *= rho;
435 }
436
437 // Get polynomials Fold_i, i = 1,...,m-1 from transcript
438 const std::vector<Commitment> commitments = get_fold_commitments(log_n, transcript);
439
440 // compute vector of powers of random evaluation point r
441 const Fr r = transcript->template get_challenge<Fr>("Gemini:r");
442 const std::vector<Fr> r_squares = gemini::powers_of_evaluation_challenge(r, log_n);
443
444 // Get evaluations a_i, i = 0,...,m-1 from transcript
445 const std::vector<Fr> evaluations = get_gemini_evaluations(log_n, transcript);
446
447 // C₀_r_pos = ∑ⱼ ρʲ⋅[fⱼ] + r⁻¹⋅∑ⱼ ρᵏ⁺ʲ [gⱼ], the commitment to A₀₊
448 // C₀_r_neg = ∑ⱼ ρʲ⋅[fⱼ] - r⁻¹⋅∑ⱼ ρᵏ⁺ʲ [gⱼ], the commitment to A₀₋
449 GroupElement C0_r_pos = batched_commitment_unshifted;
450 GroupElement C0_r_neg = batched_commitment_unshifted;
451
452 Fr r_inv = r.invert();
453 if (!batched_commitment_to_be_shifted.is_point_at_infinity()) {
454 batched_commitment_to_be_shifted = batched_commitment_to_be_shifted * r_inv;
455 C0_r_pos += batched_commitment_to_be_shifted;
456 C0_r_neg -= batched_commitment_to_be_shifted;
457 }
458
459 // If verifying the opening for the translator VM, we reconstruct the commitment of the batched interleaved
460 // polynomials, "partially evaluated" in r and -r, using the commitments in the interleaved groups
461 GroupElement C_P_pos = GroupElement::zero();
462 GroupElement C_P_neg = GroupElement::zero();
463 if (has_interleaved) {
464 size_t interleaved_group_size = claim_batcher.get_groups_to_be_interleaved_size();
465 Fr current_r_shift_pos = Fr(1);
466 Fr current_r_shift_neg = Fr(1);
467 std::vector<Fr> r_shifts_pos;
468 std::vector<Fr> r_shifts_neg;
469 for (size_t i = 0; i < interleaved_group_size; ++i) {
470 r_shifts_pos.emplace_back(current_r_shift_pos);
471 r_shifts_neg.emplace_back(current_r_shift_neg);
472 current_r_shift_pos *= r;
473 current_r_shift_neg *= (-r);
474 }
475
476 for (auto [group_commitments, interleaved_evaluation] : zip_view(
477 claim_batcher.get_interleaved().commitments_groups, claim_batcher.get_interleaved().evaluations)) {
478 // Compute the contribution from each group j of commitments Gⱼ = {C₀, C₁, C₂, C₃, ..., Cₛ₋₁} where
479 // s is assumed even C_P_pos += ∑ᵢ ρᵏ⁺ᵐ⁺ʲ⋅ rⁱ ⋅ Cᵢ C_P_neg += ∑ᵢ ρᵏ⁺ᵐ⁺ʲ⋅ (-r)ⁱ ⋅ Cᵢ
480 for (size_t i = 0; i < interleaved_group_size; ++i) {
481 C_P_pos += group_commitments[i] * batching_scalar * r_shifts_pos[i];
482 C_P_neg += group_commitments[i] * batching_scalar * r_shifts_neg[i];
483 }
484 batched_evaluation += interleaved_evaluation * batching_scalar;
485 batching_scalar *= rho;
486 }
487 }
488
489 Fr p_neg = Fr(0);
490 Fr p_pos = Fr(0);
491 if (has_interleaved) {
492 p_pos = transcript->template receive_from_prover<Fr>("Gemini:P_0_pos");
493 p_neg = transcript->template receive_from_prover<Fr>("Gemini:P_0_neg");
494 }
495 std::vector<Fr> padding_indicator_array(log_n, Fr{ 1 });
496
497 // Compute the evaluations Aₗ(r^{2ˡ}) for l = 0, ..., m-1
498 std::vector<Fr> gemini_fold_pos_evaluations = compute_fold_pos_evaluations(
499 padding_indicator_array, batched_evaluation, multilinear_challenge, r_squares, evaluations, p_neg);
500 // Extract the evaluation A₀(r) = A₀₊(r) + P₊(r^s)
501 auto full_a_0_pos = gemini_fold_pos_evaluations[0];
502 std::vector<OpeningClaim<Curve>> fold_polynomial_opening_claims;
503 fold_polynomial_opening_claims.reserve(2 * log_n + 2);
504
505 // ( [A₀₊], r, A₀₊(r) )
506 fold_polynomial_opening_claims.emplace_back(OpeningClaim<Curve>{ { r, full_a_0_pos - p_pos }, C0_r_pos });
507 // ( [A₀₋], -r, A₀-(-r) )
508 fold_polynomial_opening_claims.emplace_back(OpeningClaim<Curve>{ { -r, evaluations[0] }, C0_r_neg });
509 for (size_t l = 0; l < log_n - 1; ++l) {
510 // ([Aₗ], r^{2ˡ}, Aₗ(r^{2ˡ}) )
511 fold_polynomial_opening_claims.emplace_back(
512 OpeningClaim<Curve>{ { r_squares[l + 1], gemini_fold_pos_evaluations[l + 1] }, commitments[l] });
513 // ([Aₗ], −r^{2ˡ}, Aₗ(−r^{2ˡ}) )
514 fold_polynomial_opening_claims.emplace_back(
515 OpeningClaim<Curve>{ { -r_squares[l + 1], evaluations[l + 1] }, commitments[l] });
516 }
517 if (has_interleaved) {
518 uint32_t interleaved_group_size = claim_batcher.get_groups_to_be_interleaved_size();
519 Fr r_pow = r.pow(interleaved_group_size);
520 fold_polynomial_opening_claims.emplace_back(OpeningClaim<Curve>{ { r_pow, p_pos }, C_P_pos });
521 fold_polynomial_opening_claims.emplace_back(OpeningClaim<Curve>{ { r_pow, p_neg }, C_P_neg });
522 }
523
524 return fold_polynomial_opening_claims;
525 }
526
535 static std::vector<Commitment> get_fold_commitments([[maybe_unused]] const size_t virtual_log_n, auto& transcript)
536 {
537 std::vector<Commitment> fold_commitments;
538 fold_commitments.reserve(virtual_log_n - 1);
539 for (size_t i = 0; i < virtual_log_n - 1; ++i) {
540 const Commitment commitment =
541 transcript->template receive_from_prover<Commitment>("Gemini:FOLD_" + std::to_string(i + 1));
542 fold_commitments.emplace_back(commitment);
543 }
544 return fold_commitments;
545 }
546
556 static std::vector<Fr> get_gemini_evaluations(const size_t virtual_log_n, auto& transcript)
557 {
558 std::vector<Fr> gemini_evaluations;
559 gemini_evaluations.reserve(virtual_log_n);
560
561 for (size_t i = 1; i <= virtual_log_n; ++i) {
562 const Fr evaluation = transcript->template receive_from_prover<Fr>("Gemini:a_" + std::to_string(i));
563 gemini_evaluations.emplace_back(evaluation);
564 }
565 return gemini_evaluations;
566 }
567
602 static std::vector<Fr> compute_fold_pos_evaluations(std::span<const Fr> padding_indicator_array,
603 const Fr& batched_evaluation,
604 std::span<const Fr> evaluation_point, // size = virtual_log_n
605 std::span<const Fr> challenge_powers, // size = virtual_log_n
606 std::span<const Fr> fold_neg_evals, // size = virtual_log_n
607 Fr p_neg = Fr(0))
608 {
609 const size_t virtual_log_n = evaluation_point.size();
610
611 std::vector<Fr> evals(fold_neg_evals.begin(), fold_neg_evals.end());
612
613 Fr eval_pos_prev = batched_evaluation;
614
615 Fr zero{ 0 };
616 if constexpr (Curve::is_stdlib_type) {
617 zero.convert_constant_to_fixed_witness(fold_neg_evals[0].get_context());
618 }
619
620 std::vector<Fr> fold_pos_evaluations;
621 fold_pos_evaluations.reserve(virtual_log_n);
622
623 // Add the contribution of P-((-r)ˢ) to get A_0(-r), which is 0 if there are no interleaved polynomials
624 evals[0] += p_neg;
625 // Solve the sequence of linear equations
626 for (size_t l = virtual_log_n; l != 0; --l) {
627 // Get r²⁽ˡ⁻¹⁾
628 const Fr& challenge_power = challenge_powers[l - 1];
629 // Get uₗ₋₁
630 const Fr& u = evaluation_point[l - 1];
631 const Fr& eval_neg = evals[l - 1];
632 // Get A₍ₗ₋₁₎(−r²⁽ˡ⁻¹⁾)
633 // Compute the numerator
634 Fr eval_pos = ((challenge_power * eval_pos_prev * 2) - eval_neg * (challenge_power * (Fr(1) - u) - u));
635 // Divide by the denominator
636 eval_pos *= (challenge_power * (Fr(1) - u) + u).invert();
637
638 // If current index is bigger than log_n, we propagate `batched_evaluation` to the next
639 // round. Otherwise, current `eval_pos` A₍ₗ₋₁₎(−r²⁽ˡ⁻¹⁾) becomes `eval_pos_prev` in the round l-2.
640 eval_pos_prev =
641 padding_indicator_array[l - 1] * eval_pos + (Fr{ 1 } - padding_indicator_array[l - 1]) * eval_pos_prev;
642 // If current index is bigger than log_n, we emplace 0, which is later multiplied against
643 // Commitment::one().
644 fold_pos_evaluations.emplace_back(padding_indicator_array[l - 1] * eval_pos_prev);
645 }
646
647 std::reverse(fold_pos_evaluations.begin(), fold_pos_evaluations.end());
648
649 return fold_pos_evaluations;
650 }
651};
652
653} // namespace bb
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:88
#define BB_BENCH_NAME(name)
Definition bb_bench.hpp:218
CommitmentKey object over a pairing group 𝔾₁.
Class responsible for computation of the batched multilinear polynomials required by the Gemini proto...
Definition gemini.hpp:129
std::pair< Polynomial, Polynomial > compute_partially_evaluated_interleaved_polynomial(const Fr &r_challenge)
Compute the partially evaluated polynomials P₊(X, r) and P₋(X, -r)
Definition gemini.hpp:342
void set_to_be_shifted_by_one(RefVector< Polynomial > polynomials)
Definition gemini.hpp:167
void set_interleaved(RefVector< Polynomial > results, std::vector< RefVector< Polynomial > > groups)
Definition gemini.hpp:183
void set_random_polynomial(Polynomial &&random)
Definition gemini.hpp:177
RefVector< Polynomial > interleaved
Definition gemini.hpp:140
std::vector< RefVector< Polynomial > > groups_to_be_interleaved
Definition gemini.hpp:141
RefVector< Polynomial > to_be_shifted_by_k
Definition gemini.hpp:139
void set_to_be_shifted_by_k(RefVector< Polynomial > polynomials, const size_t shift_magnitude)
Definition gemini.hpp:168
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.
Definition gemini.hpp:201
void set_unshifted(RefVector< Polynomial > polynomials)
Definition gemini.hpp:166
std::vector< Polynomial > batched_group
Definition gemini.hpp:151
static Polynomial compute_batched(RefArray< Polynomial, N > &polynomials_to_batch, const size_t full_batched_size, const std::array< Fr, N > &challenges, const bool shift=false)
Compute batched polynomial.
Definition gemini.hpp:266
RefVector< Polynomial > to_be_shifted_by_one
Definition gemini.hpp:138
std::pair< Polynomial, Polynomial > compute_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.
Definition gemini.hpp:301
RefVector< Polynomial > unshifted
Definition gemini.hpp:137
PolynomialBatcher(const size_t full_batched_size)
Definition gemini.hpp:154
bb::Polynomial< Fr > Polynomial
Definition gemini.hpp:108
static std::vector< Claim > construct_univariate_opening_claims(const size_t log_n, Polynomial &&A_0_pos, Polynomial &&A_0_neg, std::vector< Polynomial > &&fold_polynomials, const Fr &r_challenge)
Computes/aggragates d+1 univariate polynomial opening claims of the form {polynomial,...
typename Curve::ScalarField Fr
Definition gemini.hpp:106
static std::vector< Claim > prove(const Fr circuit_size, PolynomialBatcher &polynomial_batcher, std::span< Fr > multilinear_challenge, const CommitmentKey< Curve > &commitment_key, const std::shared_ptr< Transcript > &transcript, bool has_zk=false)
static std::pair< Polynomial, Polynomial > compute_partially_evaluated_batch_polynomials(const size_t log_n, PolynomialBatcher &polynomial_batcher, const Fr &r_challenge, const std::vector< Polynomial > &batched_groups_to_be_concatenated={})
typename Curve::AffineElement Commitment
Definition gemini.hpp:107
static std::vector< Polynomial > compute_fold_polynomials(const size_t log_n, std::span< const Fr > multilinear_challenge, const Polynomial &A_0, const bool &has_zk=false)
Computes d-1 fold polynomials Fold_i, i = 1, ..., d-1.
static std::vector< OpeningClaim< Curve > > reduce_verification(std::span< Fr > multilinear_challenge, ClaimBatcher &claim_batcher, auto &transcript)
Returns univariate opening claims for the Fold polynomials to be checked later.
Definition gemini.hpp:408
typename Curve::ScalarField Fr
Definition gemini.hpp:390
static std::vector< Commitment > get_fold_commitments(const size_t virtual_log_n, auto &transcript)
Receive the fold commitments from the prover. This method is used by Shplemini where padding may be e...
Definition gemini.hpp:535
static std::vector< Fr > get_gemini_evaluations(const size_t virtual_log_n, auto &transcript)
Receive the fold evaluations from the prover. This method is used by Shplemini where padding may be e...
Definition gemini.hpp:556
typename Curve::Element GroupElement
Definition gemini.hpp:391
typename Curve::AffineElement Commitment
Definition gemini.hpp:392
Unverified claim (C,r,v) for some witness polynomial p(X) such that.
Definition claim.hpp:53
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
Polynomial shifted() const
Returns a Polynomial the left-shift of self.
Polynomial right_shifted(const size_t magnitude) const
Returns a Polynomial equal to the right-shift-by-magnitude of self.
void add_scaled(PolynomialSpan< const Fr > other, Fr scaling_factor) &
adds the polynomial q(X) 'other', multiplied by a scaling factor.
static Polynomial shiftable(size_t virtual_size)
Utility to create a shiftable polynomial of given virtual size.
Polynomial p and an opening pair (r,v) such that p(r) = v.
Definition claim.hpp:34
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
Definition ref_array.hpp:22
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
typename Group::element Element
Definition grumpkin.hpp:55
static constexpr bool is_stdlib_type
Definition grumpkin.hpp:62
typename Group::affine_element AffineElement
Definition grumpkin.hpp:56
std::vector< Fr > powers_of_evaluation_challenge(const Fr r, const size_t num_squares)
Compute squares of folding challenge r.
Definition gemini.hpp:94
std::vector< Fr > powers_of_rho(const Fr rho, const size_t num_powers)
Compute powers of challenge ρ
Definition gemini.hpp:77
Entry point for Barretenberg command-line interface.
void parallel_for(size_t num_iterations, const std::function< void(size_t)> &func)
Definition thread.cpp:111
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::string to_string(bb::avm2::ValueTag tag)
Curve::ScalarField Fr
RefVector< Commitment > commitments
RefVector< Fr > evaluations
std::vector< RefVector< Commitment > > commitments_groups
Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini.
uint32_t get_groups_to_be_interleaved_size()
InterleavedBatch get_interleaved()
std::optional< InterleavedBatch > interleaved
constexpr field invert() const noexcept
void throw_or_abort(std::string const &err)