35 const std::vector<FF>& challenges)
39 .end_ = points.size(),
45 static_cast<void*
>(coefficients.data()),
static_cast<const void*
>(points.data()),
sizeof(
FF) * points.size());
47 return generic_evaluate_mle<FF>(challenges, coefficients);
51 const HonkProof& proof,
const std::vector<std::vector<fr>>& public_inputs_vec_nt)
56 public_inputs_ct.reserve(public_inputs_vec_nt.size());
58 for (
const auto& vec : public_inputs_vec_nt) {
59 std::vector<FF> vec_ct;
60 vec_ct.reserve(vec.size());
61 for (
const auto& el : vec) {
64 public_inputs_ct.push_back(vec_ct);
73 const stdlib::Proof<Builder>& stdlib_proof_with_pi_flag,
const std::vector<std::vector<FF>>& public_inputs)
81 using ClaimBatch = ClaimBatcher::Batch;
85 StdlibProof stdlib_proof = stdlib_proof_with_pi_flag;
86 bool_t<Builder> pi_validation = !bool_t<Builder>(stdlib_proof.at(0));
90 pi_validation.unset_free_witness_tag();
91 stdlib_proof.erase(stdlib_proof.begin());
94 throw_or_abort(
"AvmRecursiveVerifier::verify_proof: public inputs size mismatch");
96 for (
const auto& public_input : public_inputs) {
98 throw_or_abort(
"AvmRecursiveVerifier::verify_proof: public input size mismatch");
108 for (
auto& comm :
key->get_all()) {
109 comm.unset_free_witness_tag();
112 info(
"AVM vk hash in recursive verifier: ",
vk_hash);
114 RelationParams relation_parameters;
127 for (
size_t j = 0; j < public_inputs[i].size(); j++) {
131 public_inputs[i][j].unset_free_witness_tag();
135 for (
auto [comm, label] :
zip_view(commitments.get_wires(), commitments.get_wires_labels())) {
136 comm =
transcript->template receive_from_prover<Commitment>(label);
140 relation_parameters.beta = beta;
141 relation_parameters.gamma = gamma;
144 for (
auto [label, commitment] :
zip_view(commitments.get_derived_labels(), commitments.get_derived())) {
145 commitment =
transcript->template receive_from_prover<Commitment>(label);
149 one.convert_constant_to_fixed_witness(&
builder);
151 std::vector<FF> padding_indicator_array(
key->log_fixed_circuit_size);
152 std::ranges::fill(padding_indicator_array, one);
155 const FF alpha =
transcript->template get_challenge<FF>(
"Sumcheck:alpha");
157 SumcheckVerifier<Flavor> sumcheck(
transcript, alpha,
key->log_fixed_circuit_size);
159 std::vector<FF> gate_challenges =
160 transcript->template get_dyadic_powers_of_challenge<FF>(
"Sumcheck:gate_challenge",
key->log_fixed_circuit_size);
164 SumcheckOutput<Flavor> output = sumcheck.verify(relation_parameters, gate_challenges, padding_indicator_array);
165 vinfo(
"verified sumcheck: ", (output.verified));
169 output.claimed_evaluations.get(C::public_inputs_cols_0_),
170 output.claimed_evaluations.get(C::public_inputs_cols_1_),
171 output.claimed_evaluations.get(C::public_inputs_cols_2_),
172 output.claimed_evaluations.get(C::public_inputs_cols_3_),
179 pi_validation.must_imply(public_input_evaluation == claimed_evaluations[i],
180 format(
"public_input_evaluation failed at column ", i));
184 auto unshifted_comms = commitments.get_unshifted();
185 auto unshifted_evals = output.claimed_evaluations.get_unshifted();
186 auto shifted_comms = commitments.get_to_be_shifted();
187 auto shifted_evals = output.claimed_evaluations.get_shifted();
191 std::vector<std::string> unshifted_batching_challenge_labels;
192 unshifted_batching_challenge_labels.reserve(unshifted_comms.size() - 1);
193 for (
size_t idx = 0; idx < unshifted_comms.size() - 1; idx++) {
194 unshifted_batching_challenge_labels.push_back(
"rho_" +
std::to_string(idx));
196 std::vector<std::string> shifted_batching_challenge_labels;
197 shifted_batching_challenge_labels.reserve(shifted_comms.size());
198 for (
size_t idx = 0; idx < shifted_comms.size(); idx++) {
199 shifted_batching_challenge_labels.push_back(
"rho_" +
std::to_string(unshifted_comms.size() - 1 + idx));
203 auto unshifted_challenges =
transcript->template get_challenges<FF>(unshifted_batching_challenge_labels);
204 auto shifted_challenges =
transcript->template get_challenges<FF>(shifted_batching_challenge_labels);
209 Commitment::batch_mul(
210 std::vector<Commitment>(unshifted_comms.begin() + 1, unshifted_comms.end()), unshifted_challenges, 128);
212 Commitment squashed_shifted = Commitment::batch_mul(
213 std::vector<Commitment>(shifted_comms.begin(), shifted_comms.end()), shifted_challenges, 128);
217 unshifted_challenges.begin(), unshifted_challenges.end(), unshifted_evals.begin() + 1, unshifted_evals[0]);
219 FF squashed_shifted_eval =
220 std::inner_product(shifted_challenges.begin(), shifted_challenges.end(), shifted_evals.begin(),
FF(0));
223 ClaimBatcher squashed_claim_batcher{ .unshifted = ClaimBatch{ .commitments =
RefVector(squashed_unshifted),
224 .evaluations =
RefVector(squashed_unshifted_eval) },
225 .shifted = ClaimBatch{ .commitments =
RefVector(squashed_shifted),
226 .evaluations =
RefVector(squashed_shifted_eval) } };
227 auto opening_claim = Shplemini::compute_batch_opening_claim(
228 padding_indicator_array, squashed_claim_batcher, output.challenge, Commitment::one(&
builder),
transcript);
233 info(
"AVM Recursive verifier builder failed with error: ",
builder.err());
236 return pairing_points;
#define AVM_NUM_PUBLIC_INPUT_COLUMNS
#define AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH
An efficient verifier for the evaluation proofs of multilinear polynomials and their shifts.
NativeFlavor::VerifierCommitments_< Commitment, VerificationKey > VerifierCommitments
AvmRecursiveFlavorSettings::Curve Curve
AvmRecursiveFlavorSettings::PCS PCS
std::shared_ptr< Transcript > transcript
typename Flavor::VerifierCommitments VerifierCommitments
stdlib::Proof< Builder > StdlibProof
std::shared_ptr< VerificationKey > key
stdlib::recursion::PairingPoints< Curve > PairingPoints
FF evaluate_public_input_column(const std::vector< FF > &points, const std::vector< FF > &challenges)
PairingPoints verify_proof(const HonkProof &proof, const std::vector< std::vector< fr > > &public_inputs_vec_nt)
typename Flavor::CircuitBuilder Builder
AvmRecursiveVerifier(Builder &builder, const std::shared_ptr< VerificationKey > &vkey)
typename Flavor::Commitment Commitment
A simple wrapper around a vector of stdlib field elements representing a proof.
Implements boolean logic in-circuit.
std::string format(Args... args)
constexpr std::size_t MAX_AVM_TRACE_SIZE
std::vector< fr > HonkProof
RefVector(T &, Ts &...) -> RefVector< T >
Deduction guide for the RefVector class. Allows for RefVector {a, b, c} without explicit template par...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
For a small integer N = virtual_log_n and a given witness x = log_n, compute in-circuit an indicator_...
static BackingMemory allocate(size_t size)
A shared pointer array template that represents a virtual array filled with zeros up to virtual_size_...
size_t start_
The starting index of the memory-backed range.
Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini.
Container for parameters used by the grand product (permutation, lookup) Honk relations.
An object storing two EC points that represent the inputs to a pairing check.
void throw_or_abort(std::string const &err)