41 : proving_key(
std::move(input_proving_key))
43 , prover_polynomials(*proving_key)
44 , commitment_key(commitment_key)
53 FF vk_hash =
vk->get_hash();
54 transcript->add_to_hash_buffer(
"avm_vk_hash", vk_hash);
55 vinfo(
"AVM vk hash in prover: ", vk_hash);
73 C::public_inputs_cols_0_,
74 C::public_inputs_cols_1_,
75 C::public_inputs_cols_2_,
76 C::public_inputs_cols_3_,
79 for (
size_t i = 0; i < public_input_columns.size(); ++i) {
81 size_t public_input_col_size = public_input_col.
size();
89 j < public_input_col_size ? public_input_col.
at(j) :
FF(0));
106 batch.commit_and_send_to_verifier(
transcript);
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] :
150 batch.commit_and_send_to_verifier(
transcript);
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_short_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));
219 auto add_scaled_batched =
223 for (
auto& poly : batched_polys) {
229 std::atomic<size_t> next_poly(0);
235 if (poly_id >= sources.size()) {
238 if (poly_id == skip_idx) {
242 const size_t start_idx = sources[poly_id].start_index();
243 const size_t end_idx = sources[poly_id].end_index();
244 for (
size_t idx = start_idx; idx < end_idx; idx++) {
245 batched_polys[slot_id].at(idx) += scalars[poly_id] * sources[poly_id][idx];
250 for (
const auto& poly : batched_polys) {
257 size_t max_idx_shifted = index_of_max_end_index(shifted_polys);
260 batched_shifted *= shifted_challenges[max_idx_shifted];
261 add_scaled_batched(batched_shifted, shifted_polys, shifted_challenges, max_idx_shifted);
269 size_t max_idx_unshifted = unshifted_polys[max_idx_left_side].end_index() >
277 if (unshifted_polys[max_idx_unshifted].end_index() > batched_shifted.
end_index()) {
278 batched_unshifted =
std::move(unshifted_polys[max_idx_unshifted]);
279 batched_unshifted *= unshifted_challenges[max_idx_unshifted];
280 batched_unshifted += batched_shifted;
286 batched_unshifted += batched_shifted;
287 batched_unshifted.
add_scaled(unshifted_polys[max_idx_unshifted], unshifted_challenges[max_idx_unshifted]);
290 add_scaled_batched(batched_unshifted,
294 add_scaled_batched(batched_unshifted,
299 : unshifted_polys.size());
303 PolynomialBatcher polynomial_batcher(circuit_dyadic_size);
304 polynomial_batcher.set_unshifted(
RefVector{ batched_unshifted });
305 polynomial_batcher.set_to_be_shifted_by_one(
RefVector{ batched_shifted });
#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.
size_t start_index() const
std::size_t virtual_size() const
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_COMMITMENTS > &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
Flavor::Polynomial Polynomial
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
constexpr auto WIRES_TO_BE_SHIFTED_START_IDX
constexpr std::array< std::size_t, AVM_NUM_PUBLIC_INPUT_COLUMNS > AVM_PUBLIC_INPUTS_COLUMN_LENGTHS
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 has_duplicates_hint=false, uint32_t measured_duplicate_count=0)