58 const std::vector<Commitment>& table_commitments,
60 const FF& shplonk_opening_challenge,
61 const std::vector<FF>& shplonk_batching_challenges,
64 const std::vector<FF>& evals)
const
72 for (
auto& commitment : table_commitments) {
75 if constexpr (IsRecursive) {
76 batch_opening_claim.
commitments.emplace_back(Commitment::one(kappa.get_context()));
78 batch_opening_claim.
commitments.emplace_back(Commitment::one());
82 batch_opening_claim.
scalars = { -(shplonk_opening_challenge - kappa) };
83 for (
auto& scalar : shplonk_batching_challenges) {
87 FF ratio = (shplonk_opening_challenge - kappa) * (shplonk_opening_challenge - kappa_inv).invert();
88 batch_opening_claim.
scalars.back() *= ratio;
90 batch_opening_claim.
scalars.emplace_back(
FF(0));
91 for (
size_t idx = 0; idx < evals.size(); idx++) {
92 if (idx < evals.size() - 1) {
93 batch_opening_claim.
scalars.back() -= evals[idx] * shplonk_batching_challenges[idx];
95 batch_opening_claim.
scalars.back() -= shplonk_batching_challenges.back() * evals.back() * ratio;
101 return batch_opening_claim;
120 transcript->load_proof(proof);
133 std::vector<Commitment> table_commitments;
134 table_commitments.reserve((3 * NUM_WIRES) + 1);
135 table_commitments.insert(table_commitments.end(),
138 table_commitments.insert(
140 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
141 table_commitments.emplace_back(
142 transcript->template receive_from_prover<Commitment>(
"MERGED_TABLE_" +
std::to_string(idx)));
143 merged_table_commitments[idx] = table_commitments.back();
147 std::vector<FF> degree_check_challenges = transcript->template get_challenges<FF>(labels_degree_check);
150 table_commitments.emplace_back(
151 transcript->template receive_from_prover<Commitment>(
"REVERSED_BATCHED_LEFT_TABLES"));
154 const FF kappa = transcript->template get_challenge<FF>(
"kappa");
155 const FF kappa_inv = kappa.invert();
156 const FF pow_kappa = kappa.pow(shift_size);
157 const FF pow_kappa_minus_one = pow_kappa * kappa_inv;
160 std::vector<FF> evals;
161 evals.reserve((3 * NUM_WIRES) + 1);
162 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
163 evals.emplace_back(transcript->template receive_from_prover<FF>(
"LEFT_TABLE_EVAL_" +
std::to_string(idx)));
165 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
166 evals.emplace_back(transcript->template receive_from_prover<FF>(
"RIGHT_TABLE_EVAL_" +
std::to_string(idx)));
168 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
169 evals.emplace_back(transcript->template receive_from_prover<FF>(
"MERGED_TABLE_EVAL_" +
std::to_string(idx)));
173 evals.emplace_back(transcript->template receive_from_prover<FF>(
"REVERSED_BATCHED_LEFT_TABLES_EVAL"));
180 origin_tags.reserve(evals.size());
182 if constexpr (IsRecursive) {
183 for (
auto& eval : evals) {
184 origin_tags.emplace_back(eval.get_origin_tag());
185 eval.set_origin_tag(pow_kappa.get_origin_tag());
190 bool concatenation_verified = check_concatenation_identities(evals, pow_kappa);
193 bool degree_check_verified = check_degree_identity(evals, pow_kappa_minus_one, degree_check_challenges);
196 if constexpr (IsRecursive) {
197 for (
auto [eval, origin_tag] :
zip_view(evals, origin_tags)) {
198 eval.set_origin_tag(origin_tag);
203 std::vector<FF> shplonk_batching_challenges =
204 transcript->template get_short_challenges<FF>(labels_shplonk_batching_challenges);
208 transcript->template receive_from_prover<Commitment>(
"SHPLONK_BATCHED_QUOTIENT");
211 FF shplonk_opening_challenge = transcript->template get_challenge<FF>(
"shplonk_opening_challenge");
215 shplonk_batched_quotient,
216 shplonk_opening_challenge,
217 shplonk_batching_challenges,
226 PairingPoints pairing_points = PCS::reduce_verify_batch_opening_claim(
std::move(batch_opening_claim), transcript);
228 vinfo(
"Merge Verifier: degree check passed: ", degree_check_verified ?
"true" :
"false");
229 vinfo(
"Merge Verifier: concatenation check passed: ", concatenation_verified ?
"true" :
"false");
231 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