29 getenv(
"AVM_MAX_MSM_BATCH_SIZE") !=
nullptr ?
std::stoul(getenv(
"AVM_MAX_MSM_BATCH_SIZE")) : 32;
45 : proving_key(
std::move(input_proving_key))
47 , prover_polynomials(*proving_key)
48 , commitment_key(commitment_key)
57 FF vk_hash =
vk->get_hash();
58 transcript->add_to_hash_buffer(
"avm_vk_hash", vk_hash);
59 vinfo(
"AVM vk hash in prover: ", vk_hash);
77 C::public_inputs_cols_0_,
78 C::public_inputs_cols_1_,
79 C::public_inputs_cols_2_,
80 C::public_inputs_cols_3_,
83 for (
size_t i = 0; i < public_input_columns.size(); ++i) {
85 size_t public_input_col_size = public_input_col.
size();
89 j < public_input_col_size ? public_input_col.
at(j) :
FF(0));
111 BB_BENCH_NAME(
"AvmProver::execute_log_derivative_inverse_round");
116 std::vector<std::function<void()>> tasks;
121 bb::constexpr_for<0, std::tuple_size_v<Flavor::LookupRelations>, 1>([&]<
size_t relation_idx>() {
123 tasks.push_back([&]() {
126 Relation::Settings::INVERSES,
127 Relation::Settings::SRC_SELECTOR,
128 Relation::Settings::DST_SELECTOR);
130 AVM_TRACK_TIME(std::string(
"prove/log_derivative_inverse_round/") + std::string(Relation::NAME),
131 (compute_logderivative_inverse<FF, Relation, Flavor::ProverPolynomials, false>(
142 BB_BENCH_NAME(
"AvmProver::execute_log_derivative_inverse_commitments_round");
145 for (
auto [derived_poly, label] :
163 const FF alpha =
transcript->template get_challenge<FF>(
"Sumcheck:alpha");
166 std::vector<FF> gate_challenges =
transcript->template get_dyadic_powers_of_challenge<FF>(
204 Challenges challenges;
205 auto unshifted_challenges_vec =
transcript->template get_challenges<FF>(challenges.get_unshifted_labels());
206 std::ranges::move(unshifted_challenges_vec, challenges.get_unshifted().begin());
207 auto unshifted_challenges = challenges.get_unshifted();
208 auto shifted_challenges = challenges.get_to_be_shifted();
210 auto index_of_max_end_index = [](
const auto& polys) {
212 auto it = std::ranges::max_element(
213 polys.begin(), polys.end(), [](
const auto&
a,
const auto&
b) { return a.end_index() < b.end_index(); });
216 return static_cast<size_t>(
std::distance(polys.begin(), it));
221 size_t max_idx = index_of_max_end_index(shifted_polys);
224 batched_shifted *= shifted_challenges[max_idx];
225 for (
size_t idx = 0;
const auto [poly, challenge] :
zip_view(shifted_polys, shifted_challenges)) {
226 if (idx != max_idx) {
234 max_idx = index_of_max_end_index(unshifted_polys);
237 batched_unshifted *= unshifted_challenges[max_idx];
238 batched_unshifted += batched_shifted;
239 for (
size_t idx = 0;
const auto [poly, challenge] :
zip_view(unshifted_polys, unshifted_challenges)) {
242 if (idx != max_idx) {
243 batched_unshifted.
add_scaled(poly, challenge);
251 PolynomialBatcher polynomial_batcher(circuit_dyadic_size);
252 polynomial_batcher.set_unshifted(
RefVector{ batched_unshifted });
253 polynomial_batcher.set_to_be_shifted_by_one(
RefVector{ batched_shifted });
#define AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH
#define BB_BENCH_NAME(name)
CommitmentKey object over a pairing group 𝔾₁.
CommitBatch start_batch()
Class responsible for computation of the batched multilinear polynomials required by the Gemini proto...
static void compute_opening_proof(const CK &ck, const ProverOpeningClaim< Curve > &opening_claim, const std::shared_ptr< Transcript > &prover_trancript)
Computes the KZG commitment to an opening proof polynomial at a single evaluation point.
Unverified claim (C,r,v) for some witness polynomial p(X) such that.
void add_scaled(PolynomialSpan< const Fr > other, const Fr &scaling_factor)
adds the polynomial q(X) 'other', multiplied by a scaling factor.
Fr & at(size_t index)
Our mutable accessor, unlike operator[]. We abuse precedent a bit to differentiate at() and operator[...
Polynomial p and an opening pair (r,v) such that p(r) = v.
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static OpeningClaim prove(size_t circuit_size, PolynomialBatcher &polynomial_batcher, std::span< FF > multilinear_challenge, const CommitmentKey< Curve > &commitment_key, const std::shared_ptr< Transcript > &transcript, const std::array< Polynomial, NUM_SMALL_IPA_EVALUATIONS > &libra_polynomials={}, const std::vector< Polynomial > &sumcheck_round_univariates={}, const std::vector< std::array< FF, 3 > > &sumcheck_round_evaluations={})
The implementation of the sumcheck Prover for statements of the form for multilinear polynomials .
DataType & get(ColumnAndShifts c)
static constexpr size_t log_circuit_size
static constexpr size_t circuit_size
void execute_pcs_rounds()
Run the PCS to prove that the claimed evaluations are correct.
std::shared_ptr< Transcript > transcript
SumcheckOutput< Flavor > sumcheck_output
PCSCommitmentKey commitment_key
std::shared_ptr< VerificationKey > vk
void execute_relation_check_rounds()
Run Sumcheck resulting in u = (u_1,...,u_d) challenges and all evaluations at u being calculated.
void execute_preamble_round()
Add vk hash to transcript.
ProverPolynomials prover_polynomials
void execute_log_derivative_inverse_commitments_round()
void execute_log_derivative_inverse_round()
bb::RelationParameters< FF > relation_parameters
AvmProver(std::shared_ptr< ProvingKey > input_proving_key, std::shared_ptr< VerificationKey > vk, const PCSCommitmentKey &commitment_key)
HonkProof construct_proof()
void execute_public_inputs_round()
Add public inputs to transcript.
void execute_wire_commitments_round()
Compute commitments to all of the witness wires (apart from the logderivative inverse wires)
void resize_inverses(AvmFlavor::ProverPolynomials &prover_polynomials, Column inverses_col, Column src_selector_col, Column dst_selector_col)
constexpr auto WIRES_TO_BE_SHIFTED_END_IDX
const size_t AVM_MAX_MSM_BATCH_SIZE
constexpr T round_up_power_2(const T in)
std::vector< fr > HonkProof
void parallel_for(size_t num_iterations, const std::function< void(size_t)> &func)
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
#define AVM_TRACK_TIME(key, body)
void add_to_batch(Polynomial< Fr > &poly, const std::string &label, bool mask)