16 const std::vector<FF>& scalars)
18 std::vector<Commitment> points(N);
19 for (
size_t idx = 0; idx < N; ++idx) {
20 points[idx] = _points[idx];
22 return Commitment::batch_mul(points, scalars);
30 BB_BENCH_NAME(
"HypernovaFoldingProver::sumcheck_output_to_accumulator");
33 auto [unshifted_challenges, shifted_challenges] =
37 Polynomial<FF> batched_unshifted_polynomial = batch_polynomials<Flavor::NUM_UNSHIFTED_ENTITIES>(
38 instance->polynomials.get_unshifted(),
instance->dyadic_size(), unshifted_challenges);
39 Polynomial<FF> batched_shifted_polynomial = batch_polynomials<Flavor::NUM_SHIFTED_ENTITIES>(
40 instance->polynomials.get_to_be_shifted(),
instance->dyadic_size(), shifted_challenges);
43 FF batched_unshifted_evaluation(0);
44 FF batched_shifted_evaluation(0);
47 batched_unshifted_evaluation += eval * challenge;
50 batched_shifted_evaluation += eval * challenge;
56 Commitment batched_unshifted_commitment =
batch_mul(verifier_commitments.get_unshifted(), unshifted_challenges);
61 .non_shifted_evaluation = batched_unshifted_evaluation,
62 .shifted_evaluation = batched_shifted_evaluation,
63 .non_shifted_polynomial =
std::move(batched_unshifted_polynomial),
64 .shifted_polynomial =
std::move(batched_shifted_polynomial),
65 .non_shifted_commitment = batched_unshifted_commitment,
66 .shifted_commitment = batched_shifted_commitment,
67 .dyadic_size =
instance->dyadic_size(),
74 const size_t& full_batched_size,
75 const std::vector<FF>& challenges)
79 polynomials_to_batch[0].virtual_size(),
80 "The virtual size of the first polynomial is different from the full batched size.");
82 challenges.size(), N,
"The number of challenges provided does not match the number of polynomials to batch.");
86 size_t min_start = polynomials_to_batch[0].start_index();
87 size_t max_end = polynomials_to_batch[0].end_index();
88 for (
size_t idx = 1; idx < N; idx++) {
89 min_start = std::min(min_start, polynomials_to_batch[idx].start_index());
90 max_end =
std::max(max_end, polynomials_to_batch[idx].end_index());
93 if (min_start < polynomials_to_batch[0].start_index() || max_end > polynomials_to_batch[0].end_index()) {
94 Polynomial<FF> result(max_end - min_start, full_batched_size, min_start);
95 result += polynomials_to_batch[0];
96 for (
size_t idx = 1; idx < N; idx++) {
97 result.
add_scaled(polynomials_to_batch[idx], challenges[idx]);
102 for (
size_t idx = 1; idx < N; idx++) {
103 polynomials_to_batch[0].
add_scaled(polynomials_to_batch[idx], challenges[idx]);
106 return polynomials_to_batch[0];
111 const std::shared_ptr<VerificationKey>& honk_vk)
113 BB_BENCH_NAME(
"HypernovaFoldingProver::instance_to_accumulator");
115 vinfo(
"HypernovaFoldingProver: converting instance to accumulator...");
133 auto sumcheck_output = sumcheck.
prove();
137 vinfo(
"HypernovaFoldingProver: accumulator constructed.");
145 const std::shared_ptr<VerificationKey>& honk_vk)
#define BB_ASSERT_EQ(actual, expected,...)
std::shared_ptr< Napi::ThreadSafeFunction > instance
#define BB_BENCH_NAME(name)
std::shared_ptr< Transcript > transcript
Accumulator sumcheck_output_to_accumulator(MegaSumcheckOutput &sumcheck_output, const std::shared_ptr< ProverInstance > &instance, const std::shared_ptr< VerificationKey > &honk_vk)
Convert the output of the sumcheck run on the incoming instance into an accumulator.
static constexpr size_t NUM_SHIFTED_ENTITIES
static constexpr size_t NUM_UNSHIFTED_ENTITIES
Accumulator instance_to_accumulator(const std::shared_ptr< ProverInstance > &instance, const std::shared_ptr< VerificationKey > &honk_vk=nullptr)
Turn an instance into an accumulator by running Sumcheck.
Flavor::Commitment Commitment
Commitment batch_mul(const RefArray< Commitment, N > &_points, const std::vector< FF > &scalars)
Utility to perform batch mul of commitments.
static Polynomial< FF > batch_polynomials(RefArray< Polynomial< FF >, N > polynomials_to_batch, const size_t &full_batched_size, const std::vector< FF > &challenges)
Batch prover polynomials. Batching happens in place into the first polynomial in the RefArray supplie...
std::pair< HonkProof, Accumulator > fold(Accumulator &&accumulator, const std::shared_ptr< ProverInstance > &instance, const std::shared_ptr< VerificationKey > &honk_vk=nullptr)
Fold an instance into an accumulator.
static constexpr size_t VIRTUAL_LOG_N
Prover for multilinear batching - reduces two polynomial evaluation claims to one via sumcheck.
HonkProof construct_proof()
Construct a multilinear batching proof.
BB_PROFILE MultilinearBatchingProverClaim compute_new_claim()
Compute the batched output claim after sumcheck.
Executes the "Oink" phase of the Honk proving protocol: the initial rounds that commit to witness dat...
void prove(bool emit_alpha=true)
Commit to witnesses, compute relation parameters, and prepare for Sumcheck.
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
void add_scaled(PolynomialSpan< const Fr > other, const Fr &scaling_factor)
adds the polynomial q(X) 'other', multiplied by a scaling factor.
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
The implementation of the sumcheck Prover for statements of the form for multilinear polynomials .
SumcheckOutput< Flavor > prove()
Non-ZK version: Compute round univariate, place it in transcript, compute challenge,...
Entry point for Barretenberg command-line interface.
std::vector< fr > HonkProof
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Prover's claim for multilinear batching - contains polynomials and their evaluation claims.
std::vector< FF > challenge
Contains the evaluations of multilinear polynomials at the challenge point . These are computed by S...
ClaimedEvaluations claimed_evaluations
std::vector< FF > challenge