21 const std::shared_ptr<Transcript>& transcript)
23 , transcript(transcript)
29 size_t last_subtable_size =
op_queue->get_current_subtable_size();
43 Polynomial reversed_batched_left_tables(left_table[0].size());
44 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
45 reversed_batched_left_tables.
add_scaled(left_table[idx], degree_check_challenges[idx]);
47 return reversed_batched_left_tables.
reverse();
54 const std::vector<FF>& shplonk_batching_challenges,
57 const Polynomial& reversed_batched_left_tables,
58 const std::vector<FF>& evals)
62 Polynomial shplonk_batched_quotient(merged_table[0].size());
65 for (
size_t idx_table = 0; idx_table < 3; idx_table++) {
66 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
67 FF challenge = shplonk_batching_challenges[(idx_table *
NUM_WIRES) + idx];
71 shplonk_batched_quotient.
add_scaled(left_table[idx], challenge);
72 }
else if (idx_table == 1) {
74 shplonk_batched_quotient.
add_scaled(right_table[idx], challenge);
77 shplonk_batched_quotient.
add_scaled(merged_table[idx], challenge);
80 shplonk_batched_quotient.
at(0) -= challenge * eval;
87 Polynomial reversed_batched_left_tables_copy(reversed_batched_left_tables);
88 reversed_batched_left_tables_copy.
at(0) -= evals.back();
89 reversed_batched_left_tables_copy.
factor_roots(kappa_inv);
90 shplonk_batched_quotient.
add_scaled(reversed_batched_left_tables_copy, shplonk_batching_challenges.back());
92 return shplonk_batched_quotient;
97 const FF& shplonk_opening_challenge,
101 const std::vector<FF>& shplonk_batching_challenges,
105 const std::vector<FF>& evals)
109 Polynomial shplonk_partially_evaluated_batched_quotient(
std::move(shplonk_batched_quotient));
110 shplonk_partially_evaluated_batched_quotient *= -(shplonk_opening_challenge - kappa);
113 for (
size_t idx_table = 0; idx_table < 3; idx_table++) {
114 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
115 FF challenge = shplonk_batching_challenges[(idx_table *
NUM_WIRES) + idx];
117 if (idx_table == 0) {
119 shplonk_partially_evaluated_batched_quotient.
add_scaled(left_table[idx], challenge);
120 }
else if (idx_table == 1) {
122 shplonk_partially_evaluated_batched_quotient.
add_scaled(right_table[idx], challenge);
125 shplonk_partially_evaluated_batched_quotient.
add_scaled(merged_table[idx], challenge);
128 shplonk_partially_evaluated_batched_quotient.
at(0) -= challenge * eval;
133 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;
165 left_table =
op_queue->construct_current_ultra_ops_subtable_columns();
166 right_table =
op_queue->construct_previous_ultra_ops_table_columns();
168 left_table =
op_queue->construct_previous_ultra_ops_table_columns();
169 right_table =
op_queue->construct_current_ultra_ops_subtable_columns();
173 const size_t shift_size = left_table[0].size();
174 transcript->send_to_verifier(
"shift_size",
static_cast<uint32_t
>(shift_size));
177 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
186 transcript->send_to_verifier(
"REVERSED_BATCHED_LEFT_TABLES",
190 std::vector<FF> shplonk_batching_challenges =
194 const FF kappa =
transcript->template get_challenge<FF>(
"kappa");
195 const FF kappa_inv = kappa.
invert();
198 std::vector<FF> evals;
200 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
201 evals.emplace_back(left_table[idx].evaluate(kappa));
204 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
205 evals.emplace_back(right_table[idx].evaluate(kappa));
208 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
209 evals.emplace_back(merged_table[idx].evaluate(kappa));
214 evals.emplace_back(reversed_batched_left_tables.
evaluate(kappa_inv));
215 transcript->send_to_verifier(
"REVERSED_BATCHED_LEFT_TABLES_EVAL", evals.back());
221 shplonk_batching_challenges,
224 reversed_batched_left_tables,
230 FF shplonk_opening_challenge =
transcript->template get_challenge<FF>(
"shplonk_opening_challenge");
234 shplonk_opening_challenge,
238 shplonk_batching_challenges,
241 reversed_batched_left_tables,
CommitmentKey object over a pairing group 𝔾₁.
Commitment commit(PolynomialSpan< const Fr > polynomial) const
Uses the ProverSRS to create a commitment to p(X)
bool initialized() const
Checks the commitment key is properly initialized.
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
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
MergeProver(const std::shared_ptr< ECCOpQueue > &op_queue, const MergeSettings settings=MergeSettings::PREPEND, const CommitmentKey &commitment_key=CommitmentKey(), const std::shared_ptr< Transcript > &transcript=std::make_shared< 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.
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
Fr evaluate(const Fr &z, size_t target_size) 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 add_scaled(PolynomialSpan< const Fr > other, Fr scaling_factor) &
adds the polynomial q(X) 'other', multiplied by a scaling factor.
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