57 const std::vector<Commitment>& table_commitments,
59 const FF& shplonk_opening_challenge,
60 const std::vector<FF>& shplonk_batching_challenges,
63 const std::vector<FF>& evals)
const
71 for (
auto& commitment : table_commitments) {
74 if constexpr (IsRecursive) {
75 batch_opening_claim.
commitments.emplace_back(Commitment::one(kappa.get_context()));
77 batch_opening_claim.
commitments.emplace_back(Commitment::one());
81 batch_opening_claim.
scalars = { -(shplonk_opening_challenge - kappa) };
82 for (
auto& scalar : shplonk_batching_challenges) {
85 batch_opening_claim.
scalars.back() *=
86 (shplonk_opening_challenge - kappa) * (shplonk_opening_challenge - kappa_inv).invert();
88 batch_opening_claim.
scalars.emplace_back(
FF(0));
89 for (
size_t idx = 0; idx < evals.size(); idx++) {
90 if (idx < evals.size() - 1) {
91 batch_opening_claim.
scalars.back() -= evals[idx] * shplonk_batching_challenges[idx];
93 batch_opening_claim.
scalars.back() -= shplonk_batching_challenges.back() * evals.back() *
94 (shplonk_opening_challenge - kappa) *
95 (shplonk_opening_challenge - kappa_inv).invert();
101 return batch_opening_claim;
119 transcript->load_proof(proof);
124 const FF shift_size = transcript->template receive_from_prover<FF>(
"shift_size");
126 if constexpr (IsRecursive) {
127 BB_ASSERT_GT(uint32_t(shift_size.get_value()), 0U,
"Shift size should always be bigger than 0");
130 BB_ASSERT_GT(shift_size, 0U,
"Shift size should always be bigger than 0");
138 std::vector<Commitment> table_commitments;
139 table_commitments.reserve((3 * NUM_WIRES) + 1);
140 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
144 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
148 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
149 table_commitments.emplace_back(
150 transcript->template receive_from_prover<Commitment>(
"MERGED_TABLE_" +
std::to_string(idx)));
151 merged_table_commitments[idx] = table_commitments.back();
155 std::vector<FF> degree_check_challenges = transcript->template get_challenges<FF>(labels_degree_check);
158 table_commitments.emplace_back(
159 transcript->template receive_from_prover<Commitment>(
"REVERSED_BATCHED_LEFT_TABLES"));
162 std::vector<FF> shplonk_batching_challenges =
163 transcript->template get_challenges<FF>(labels_shplonk_batching_challenges);
166 const FF kappa = transcript->template get_challenge<FF>(
"kappa");
167 const FF kappa_inv = kappa.invert();
168 const FF pow_kappa = kappa.pow(shift_size);
169 const FF pow_kappa_minus_one = pow_kappa * kappa_inv;
172 std::vector<FF> evals;
173 evals.reserve((3 * NUM_WIRES) + 1);
174 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
175 evals.emplace_back(transcript->template receive_from_prover<FF>(
"LEFT_TABLE_EVAL_" +
std::to_string(idx)));
177 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
178 evals.emplace_back(transcript->template receive_from_prover<FF>(
"RIGHT_TABLE_EVAL_" +
std::to_string(idx)));
180 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
181 evals.emplace_back(transcript->template receive_from_prover<FF>(
"MERGED_TABLE_EVAL_" +
std::to_string(idx)));
185 evals.emplace_back(transcript->template receive_from_prover<FF>(
"REVERSED_BATCHED_LEFT_TABLES_EVAL"));
190 if constexpr (IsRecursive) {
191 for (
auto& eval : evals) {
192 eval.set_origin_tag(kappa.get_origin_tag());
194 evals.back().set_origin_tag(degree_check_challenges.back().get_origin_tag());
198 bool concatenation_verified = check_concatenation_identities(evals, pow_kappa);
201 bool degree_check_verified = check_degree_identity(evals, pow_kappa_minus_one, degree_check_challenges);
205 transcript->template receive_from_prover<Commitment>(
"SHPLONK_BATCHED_QUOTIENT");
208 FF shplonk_opening_challenge = transcript->template get_challenge<FF>(
"shplonk_opening_challenge");
212 shplonk_batched_quotient,
213 shplonk_opening_challenge,
214 shplonk_batching_challenges,
223 PairingPoints pairing_points = PCS::reduce_verify_batch_opening_claim(
std::move(batch_opening_claim), transcript);
225 vinfo(
"Merge Verifier: degree check passed: ", degree_check_verified ?
"true" :
"false");
226 vinfo(
"Merge Verifier: concatenation check passed: ", concatenation_verified ?
"true" :
"false");
228 return { pairing_points, merged_table_commitments, degree_check_verified && concatenation_verified };
BatchOpeningClaim< Curve > compute_shplonk_opening_claim(const std::vector< Commitment > &table_commitments, const Commitment &shplonk_batched_quotient, const FF &shplonk_opening_challenge, const std::vector< FF > &shplonk_batching_challenges, const FF &kappa, const FF &kappa_inv, const std::vector< FF > &evals) const