20 : transcript(
std::move(transcript))
24 const size_t append_offset =
op_queue->get_append_offset();
26 op_queue->merge_fixed_append(append_offset);
36 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
37 reversed_batched_left_tables.
add_scaled(left_table[idx], degree_check_challenges[idx]);
39 return reversed_batched_left_tables.
reverse();
46 const std::vector<FF>& shplonk_batching_challenges,
49 const Polynomial& reversed_batched_left_tables,
50 const std::vector<FF>& evals)
54 Polynomial shplonk_batched_quotient(merged_table[0].size());
57 for (
size_t idx_table = 0; idx_table < 3; idx_table++) {
58 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
59 FF challenge = shplonk_batching_challenges[(idx_table *
NUM_WIRES) + idx];
63 shplonk_batched_quotient.
add_scaled(left_table[idx], challenge);
64 }
else if (idx_table == 1) {
66 shplonk_batched_quotient.
add_scaled(right_table[idx], challenge);
69 shplonk_batched_quotient.
add_scaled(merged_table[idx], challenge);
72 if (!shplonk_batched_quotient.
is_empty()) {
73 shplonk_batched_quotient.
at(0) -= challenge * eval;
81 Polynomial reversed_batched_left_tables_copy(reversed_batched_left_tables);
82 if (!reversed_batched_left_tables_copy.
is_empty()) {
83 reversed_batched_left_tables_copy.
at(0) -= evals.back();
85 reversed_batched_left_tables_copy.
factor_roots(kappa_inv);
86 shplonk_batched_quotient.
add_scaled(reversed_batched_left_tables_copy, shplonk_batching_challenges.back());
88 return shplonk_batched_quotient;
93 const FF& shplonk_opening_challenge,
97 const std::vector<FF>& shplonk_batching_challenges,
101 const std::vector<FF>& evals)
105 Polynomial shplonk_partially_evaluated_batched_quotient(
std::move(shplonk_batched_quotient));
106 shplonk_partially_evaluated_batched_quotient *= -(shplonk_opening_challenge - kappa);
109 for (
size_t idx_table = 0; idx_table < 3; idx_table++) {
110 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
111 FF challenge = shplonk_batching_challenges[(idx_table *
NUM_WIRES) + idx];
113 if (idx_table == 0) {
115 shplonk_partially_evaluated_batched_quotient.
add_scaled(left_table[idx], challenge);
116 }
else if (idx_table == 1) {
118 shplonk_partially_evaluated_batched_quotient.
add_scaled(right_table[idx], challenge);
121 shplonk_partially_evaluated_batched_quotient.
add_scaled(merged_table[idx], challenge);
124 if (!shplonk_partially_evaluated_batched_quotient.
is_empty()) {
125 shplonk_partially_evaluated_batched_quotient.
at(0) -= challenge * eval;
131 if (!reversed_batched_left_tables.
is_empty()) {
132 reversed_batched_left_tables.
at(0) -= evals.back();
134 shplonk_partially_evaluated_batched_quotient.
add_scaled(reversed_batched_left_tables,
135 shplonk_batching_challenges.back() *
136 (shplonk_opening_challenge - kappa) *
137 (shplonk_opening_challenge - kappa_inv).invert());
140 .opening_pair = { shplonk_opening_challenge,
FF(0) } };
142 return shplonk_opening_claim;
163 left_table =
op_queue->construct_table_columns_up_to_tail();
164 right_table =
op_queue->construct_current_ultra_ops_subtable_columns();
171 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
180 transcript->send_to_verifier(
"REVERSED_BATCHED_LEFT_TABLES",
184 std::vector<FF> shplonk_batching_challenges =
188 const FF kappa =
transcript->template get_challenge<FF>(
"kappa");
189 const FF kappa_inv = kappa.
invert();
192 std::vector<FF> evals;
194 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
195 evals.emplace_back(left_table[idx].evaluate(kappa));
198 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
199 evals.emplace_back(right_table[idx].evaluate(kappa));
202 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
203 evals.emplace_back(merged_table[idx].evaluate(kappa));
208 evals.emplace_back(reversed_batched_left_tables.
evaluate(kappa_inv));
209 transcript->send_to_verifier(
"REVERSED_BATCHED_LEFT_TABLES_EVAL", evals.back());
215 shplonk_batching_challenges,
218 reversed_batched_left_tables,
224 FF shplonk_opening_challenge =
transcript->template get_challenge<FF>(
"shplonk_opening_challenge");
228 shplonk_opening_challenge,
232 shplonk_batching_challenges,
235 reversed_batched_left_tables,
#define BB_BENCH_NAME(name)
Commitment commit(PolynomialSpan< const Fr > polynomial) const
Uses the ProverSRS to create a commitment to p(X)
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.
static constexpr size_t NUM_WIRES
std::shared_ptr< ECCOpQueue > op_queue
std::vector< FF > MergeProof
BB_PROFILE MergeProof construct_proof()
Prove proper construction of the aggregate Goblin ECC op queue polynomials T_j.
std::vector< std::string > labels_degree_check
Polynomial compute_degree_check_polynomial(const std::array< Polynomial, NUM_WIRES > &left_table, const std::vector< FF > °ree_check_challenges) const
Compute the batched polynomial for the degree check.
static OpeningClaim compute_shplonk_opening_claim(Polynomial &shplonk_batched_quotient, const FF &shplonk_opening_challenge, const std::array< Polynomial, NUM_WIRES > &left_table, const std::array< Polynomial, NUM_WIRES > &right_table, const std::array< Polynomial, NUM_WIRES > &merged_table, const std::vector< FF > &shplonk_batching_challenges, const FF &kappa, const FF &kappa_inv, Polynomial &reversed_batched_left_tables, const std::vector< FF > &evals)
Compute the partially evaluated Shplonk batched quotient and the resulting opening claim.
std::vector< std::string > labels_shplonk_batching_challenges
MergeProver(const std::shared_ptr< ECCOpQueue > &op_queue, std::shared_ptr< Transcript > transcript)
Create MergeProver.
std::shared_ptr< Transcript > transcript
CommitmentKey pcs_commitment_key
static Polynomial compute_shplonk_batched_quotient(const std::array< Polynomial, NUM_WIRES > &left_table, const std::array< Polynomial, NUM_WIRES > &right_table, const std::array< Polynomial, NUM_WIRES > &merged_table, const std::vector< FF > &shplonk_batching_challenges, const FF &kappa, const FF &kappa_inv, const Polynomial &reversed_batched_left_tables, const std::vector< FF > &evals)
Compute the batched Shplonk quotient polynomial.
size_t fixed_append_shift_size
bb::CommitmentKey< Curve > CommitmentKey
void add_scaled(PolynomialSpan< const Fr > other, const Fr &scaling_factor)
adds the polynomial q(X) 'other', multiplied by a scaling factor.
Fr evaluate(const Fr &z) const
Polynomial reverse() const
Returns the polynomial equal to the reverse of self.
Fr & at(size_t index)
Our mutable accessor, unlike operator[]. We abuse precedent a bit to differentiate at() and operator[...
void factor_roots(const Fr &root)
Divides p(X) by (X-r) in-place. Assumes that p(rⱼ)=0 for all j.
Polynomial p and an opening pair (r,v) such that p(r) = v.
static constexpr size_t NUM_ROWS_PER_OP
static constexpr size_t ZK_ULTRA_OPS
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
constexpr field invert() const noexcept