19 std::shared_ptr<Transcript> transcript,
21 : transcript(
std::move(transcript))
28 size_t last_subtable_size =
op_queue->get_current_subtable_size();
41 Polynomial reversed_batched_left_tables(left_table[0].size());
42 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
43 reversed_batched_left_tables.
add_scaled(left_table[idx], degree_check_challenges[idx]);
45 return reversed_batched_left_tables.
reverse();
52 const std::vector<FF>& shplonk_batching_challenges,
55 const Polynomial& reversed_batched_left_tables,
56 const std::vector<FF>& evals)
60 Polynomial shplonk_batched_quotient(merged_table[0].size());
63 for (
size_t idx_table = 0; idx_table < 3; idx_table++) {
64 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
65 FF challenge = shplonk_batching_challenges[(idx_table *
NUM_WIRES) + idx];
69 shplonk_batched_quotient.
add_scaled(left_table[idx], challenge);
70 }
else if (idx_table == 1) {
72 shplonk_batched_quotient.
add_scaled(right_table[idx], challenge);
75 shplonk_batched_quotient.
add_scaled(merged_table[idx], challenge);
78 shplonk_batched_quotient.
at(0) -= challenge * eval;
85 Polynomial reversed_batched_left_tables_copy(reversed_batched_left_tables);
86 reversed_batched_left_tables_copy.
at(0) -= evals.back();
87 reversed_batched_left_tables_copy.
factor_roots(kappa_inv);
88 shplonk_batched_quotient.
add_scaled(reversed_batched_left_tables_copy, shplonk_batching_challenges.back());
90 return shplonk_batched_quotient;
95 const FF& shplonk_opening_challenge,
99 const std::vector<FF>& shplonk_batching_challenges,
103 const std::vector<FF>& evals)
107 Polynomial shplonk_partially_evaluated_batched_quotient(
std::move(shplonk_batched_quotient));
108 shplonk_partially_evaluated_batched_quotient *= -(shplonk_opening_challenge - kappa);
111 for (
size_t idx_table = 0; idx_table < 3; idx_table++) {
112 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
113 FF challenge = shplonk_batching_challenges[(idx_table *
NUM_WIRES) + idx];
115 if (idx_table == 0) {
117 shplonk_partially_evaluated_batched_quotient.
add_scaled(left_table[idx], challenge);
118 }
else if (idx_table == 1) {
120 shplonk_partially_evaluated_batched_quotient.
add_scaled(right_table[idx], challenge);
123 shplonk_partially_evaluated_batched_quotient.
add_scaled(merged_table[idx], challenge);
126 shplonk_partially_evaluated_batched_quotient.
at(0) -= challenge * eval;
131 reversed_batched_left_tables.
at(0) -= evals.back();
132 shplonk_partially_evaluated_batched_quotient.
add_scaled(reversed_batched_left_tables,
133 shplonk_batching_challenges.back() *
134 (shplonk_opening_challenge - kappa) *
135 (shplonk_opening_challenge - kappa_inv).invert());
138 .opening_pair = { shplonk_opening_challenge,
FF(0) } };
140 return shplonk_opening_claim;
163 left_table =
op_queue->construct_current_ultra_ops_subtable_columns();
164 right_table =
op_queue->construct_previous_ultra_ops_table_columns();
166 left_table =
op_queue->construct_previous_ultra_ops_table_columns();
167 right_table =
op_queue->construct_current_ultra_ops_subtable_columns();
171 const size_t shift_size = left_table[0].size();
172 transcript->send_to_verifier(
"shift_size",
static_cast<uint32_t
>(shift_size));
175 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
184 transcript->send_to_verifier(
"REVERSED_BATCHED_LEFT_TABLES",
188 std::vector<FF> shplonk_batching_challenges =
192 const FF kappa =
transcript->template get_challenge<FF>(
"kappa");
193 const FF kappa_inv = kappa.
invert();
196 std::vector<FF> evals;
198 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
199 evals.emplace_back(left_table[idx].evaluate(kappa));
202 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
203 evals.emplace_back(right_table[idx].evaluate(kappa));
206 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
207 evals.emplace_back(merged_table[idx].evaluate(kappa));
212 evals.emplace_back(reversed_batched_left_tables.
evaluate(kappa_inv));
213 transcript->send_to_verifier(
"REVERSED_BATCHED_LEFT_TABLES_EVAL", evals.back());
219 shplonk_batching_challenges,
222 reversed_batched_left_tables,
228 FF shplonk_opening_challenge =
transcript->template get_challenge<FF>(
"shplonk_opening_challenge");
232 shplonk_opening_challenge,
236 shplonk_batching_challenges,
239 reversed_batched_left_tables,
Commitment commit(PolynomialSpan< const Fr > polynomial) const
Uses the ProverSRS to create a commitment to p(X)
static const size_t OP_QUEUE_SIZE
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
MergeProver(const std::shared_ptr< ECCOpQueue > &op_queue, std::shared_ptr< Transcript > transcript, MergeSettings settings=MergeSettings::PREPEND)
Create MergeProver.
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
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
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.
static Polynomial compute_degree_check_polynomial(const std::array< Polynomial, NUM_WIRES > &left_table, const std::vector< FF > °ree_check_challenges)
Compute the batched polynomial for the degree check.
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.
Entry point for Barretenberg command-line interface.
MergeSettings
The MergeSettings define whether an current subtable will be added at the beginning (PREPEND) or at t...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
constexpr field invert() const noexcept