69 const size_t num_polynomials,
70 const size_t num_to_be_shifted,
71 const std::vector<Fr>& mle_opening_point,
73 size_t num_interleaved = 0,
74 size_t num_to_be_interleaved = 0)
83 bool has_virtual_rounds = (mle_opening_point.size() > log_size);
87 if (has_virtual_rounds) {
96 const size_t num_not_to_be_shifted = num_polynomials - num_to_be_shifted;
100 for (
size_t idx = log_size; idx < mle_opening_point.size(); idx++) {
101 ebz_factor *= (
Fr(1) - mle_opening_point[idx]);
105 for (
size_t idx = 0; idx < num_not_to_be_shifted; idx++) {
113 for (
size_t idx = 0; idx < num_to_be_shifted; idx++) {
132 if (num_interleaved > 0) {
148 for (
size_t idx = 0; idx < num_zero_polynomials; idx++) {
164 const std::vector<Fr>& custom_unshifted_evals,
172 for (
size_t i = 0; i < custom_unshifted.size(); ++i) {
173 auto& p = custom_unshifted[i];
186 const size_t num_interleaved,
187 const size_t group_size,
191 size_t N = 1 << u_challenge.size();
192 size_t MINI_CIRCUIT_N = N / group_size;
201 std::vector<Fr> c_evaluations;
204 for (
size_t i = 0; i < num_interleaved; ++i) {
207 for (
size_t j = 0; j < group_size; j++) {
211 for (
size_t k = 0; k < MINI_CIRCUIT_N; k++) {
217 chunk_polynomial.
at(k) = tmp;
218 interleaved_polynomial.
at(k * group_size + j) = tmp;
220 group.emplace_back(chunk_polynomial);
223 groups.emplace_back(
group);
225 interleaved_polynomials.emplace_back(interleaved_polynomial);
227 c_evaluations.emplace_back(interleaved_polynomial.
evaluate_mle(u_challenge));
232 for (
size_t i = 0; i < num_interleaved; ++i) {
233 std::vector<Commitment> group_commitment;
234 for (
size_t j = 0; j < group_size; j++) {
235 group_commitment.emplace_back(
ck.
commit(groups[i][j]));
237 groups_commitments.emplace_back(group_commitment);
240 return { groups, interleaved_polynomials, c_evaluations, groups_commitments };
243 template <
typename Flavor>
245 const size_t sumcheck_univariate_length,
246 std::vector<Fr>& challenge,
252 for (
size_t idx = 0; idx < log_n; idx++) {
253 bb::Polynomial<Fr> round_univariate = mock_sumcheck_polynomials.libra_univariates[idx];
255 round_univariate.
at(0) += mock_sumcheck_polynomials.libra_running_sum;
261 round_univariate.
evaluate(challenge[idx]) });
263 mock_sumcheck_polynomials.update_zk_sumcheck_data(challenge[idx], idx);
#define BB_ASSERT_GTE(left, right,...)
CommitmentKey object over a pairing group 𝔾₁.
Commitment commit(PolynomialSpan< const Fr > polynomial) const
Uses the ProverSRS to create a commitment to p(X)
Class responsible for computation of the batched multilinear polynomials required by the Gemini proto...
void set_to_be_shifted_by_one(RefVector< Polynomial > polynomials)
void set_interleaved(RefVector< Polynomial > results, std::vector< RefVector< Polynomial > > groups)
void set_unshifted(RefVector< Polynomial > polynomials)
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.
static Polynomial random(size_t size, size_t start_index=0)
Fr evaluate(const Fr &z, size_t target_size) const
Fr evaluate_mle(std::span< const Fr > evaluation_points, bool shift=false) const
evaluate multi-linear extension p(X_0,…,X_{n-1}) = \sum_i a_i*L_i(X_0,…,X_{n-1}) at u = (u_0,...
Fr & at(size_t index)
Our mutable accessor, unlike operator[]. We abuse precedent a bit to differentiate at() and operator[...
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
typename Group::affine_element AffineElement
group class. Represents an elliptic curve group element. Group is parametrised by Fq and Fr
constexpr T get_msb(const T in)
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::vector< RefVector< Commitment > > commitments_groups
Logic to support batching opening claims for unshifted, shifted and interleaved polynomials in Shplem...
std::optional< Batch > unshifted
std::optional< InterleavedBatch > interleaved
std::vector< Commitment > commitments
std::vector< Polynomial > polys
std::vector< Fr > evaluations
std::vector< std::vector< Polynomial > > groups
std::vector< std::vector< Commitment > > group_commitments
std::vector< Polynomial > polys
Constructs random polynomials, computes commitments and corresponding evaluations.
std::vector< bb::Polynomial< Fr > > round_univariates
std::vector< Fr > const_size_mle_opening_point
std::vector< Commitment > sumcheck_commitments
ClaimBatcher claim_batcher
std::vector< std::array< Fr, 3 > > sumcheck_evaluations
typename Curve::AffineElement Commitment
InterleaveData generate_interleaving_inputs(const std::vector< Fr > &u_challenge, const size_t num_interleaved, const size_t group_size, const CommitmentKey &ck)
InterleaveData interleave_data
MockClaimGenerator(const size_t poly_size, const std::vector< Polynomial > custom_unshifted, const std::vector< Fr > &custom_unshifted_evals, const CommitmentKey &commitment_key)
MockClaimGenerator(const size_t poly_size, const size_t num_polynomials, const size_t num_to_be_shifted, const std::vector< Fr > &mle_opening_point, const CommitmentKey &commitment_key, size_t num_interleaved=0, size_t num_to_be_interleaved=0)
Construct claim data for a set of random polynomials with the specified type.
PolynomialBatcher polynomial_batcher
typename Curve::ScalarField Fr
MockClaimGenerator(const size_t n, const size_t num_zero_polynomials)
void compute_sumcheck_opening_data(const size_t log_n, const size_t sumcheck_univariate_length, std::vector< Fr > &challenge, const CommitmentKey &ck)
This structure is created to contain various polynomials and constants required by ZK Sumcheck.
static field random_element(numeric::RNG *engine=nullptr) noexcept