78 const size_t num_polynomials,
79 const size_t num_to_be_shifted,
80 const size_t num_to_be_right_shifted_by_k,
81 const std::vector<Fr>& mle_opening_point,
83 size_t num_interleaved = 0,
84 size_t num_to_be_interleaved = 0)
93 bool has_virtual_rounds = (mle_opening_point.size() > log_size);
97 if (has_virtual_rounds) {
105 const size_t total_num_to_be_shifted = num_to_be_shifted + num_to_be_right_shifted_by_k;
107 const size_t num_not_to_be_shifted = num_polynomials - total_num_to_be_shifted;
111 for (
size_t idx = log_size; idx < mle_opening_point.size(); idx++) {
112 ebz_factor *= (
Fr(1) - mle_opening_point[idx]);
116 for (
size_t idx = 0; idx < num_not_to_be_shifted; idx++) {
124 for (
size_t idx = 0; idx < num_to_be_shifted; idx++) {
137 for (
size_t idx = 0; idx < num_to_be_right_shifted_by_k; idx++) {
160 if (num_interleaved > 0) {
176 for (
size_t idx = 0; idx < num_zero_polynomials; idx++) {
189 const size_t num_interleaved,
190 const size_t group_size,
194 size_t N = 1 << u_challenge.size();
195 size_t MINI_CIRCUIT_N = N / group_size;
204 std::vector<Fr> c_evaluations;
207 for (
size_t i = 0; i < num_interleaved; ++i) {
210 for (
size_t j = 0; j < group_size; j++) {
214 for (
size_t k = 0; k < MINI_CIRCUIT_N; k++) {
220 chunk_polynomial.
at(k) = tmp;
221 interleaved_polynomial.
at(k * group_size + j) = tmp;
223 group.emplace_back(chunk_polynomial);
226 groups.emplace_back(
group);
228 interleaved_polynomials.emplace_back(interleaved_polynomial);
230 c_evaluations.emplace_back(interleaved_polynomial.
evaluate_mle(u_challenge));
235 for (
size_t i = 0; i < num_interleaved; ++i) {
236 std::vector<Commitment> group_commitment;
237 for (
size_t j = 0; j < group_size; j++) {
238 group_commitment.emplace_back(
ck.
commit(groups[i][j]));
240 groups_commitments.emplace_back(group_commitment);
243 return { groups, interleaved_polynomials, c_evaluations, groups_commitments };
246 template <
typename Flavor>
248 const size_t sumcheck_univariate_length,
249 std::vector<Fr>& challenge,
255 for (
size_t idx = 0; idx < log_n; idx++) {
256 bb::Polynomial<Fr> round_univariate = mock_sumcheck_polynomials.libra_univariates[idx];
258 round_univariate.
at(0) += mock_sumcheck_polynomials.libra_running_sum;
264 round_univariate.
evaluate(challenge[idx]) });
266 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_to_be_shifted_by_k(RefVector< Polynomial > polynomials, const size_t shift_magnitude)
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,...
Polynomial right_shifted(const size_t magnitude) const
Returns a Polynomial equal to the right-shift-by-magnitude of self.
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 and shifted polynomials in Shplemini.
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.
MockClaimGenerator(const size_t poly_size, const size_t num_polynomials, const size_t num_to_be_shifted, const size_t num_to_be_right_shifted_by_k, 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.
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
PolynomialBatcher polynomial_batcher
typename Curve::ScalarField Fr
static constexpr size_t k_magnitude
MockClaimGenerator(const size_t n, const size_t num_zero_polynomials)
ClaimData to_be_right_shifted_by_k
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