2#include "barretenberg/commitment_schemes/commitment_key.hpp"
3#include "barretenberg/commitment_schemes/kzg/kzg.hpp"
4#include "barretenberg/ecc/curves/bn254/bn254.hpp"
6#include "barretenberg/flavor/flavor_macros.hpp"
7#include "barretenberg/polynomials/univariate.hpp"
8#include "barretenberg/relations/relation_parameters.hpp"
9#include "barretenberg/relations/relation_types.hpp"
12#include "relation_definitions_fwd.hpp"
34 using GroupElement = Curve::Element;
35 using Commitment = Curve::AffineElement;
36 using CommitmentHandle = Curve::AffineElement;
39 using PolynomialHandle = std::span<FF>;
46 static constexpr size_t NUM_WIRES = 5;
51 static constexpr size_t NUM_ALL_ENTITIES = 12;
54 static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 5;
56 static constexpr size_t NUM_WITNESS_ENTITIES = 7;
59 using Relations = std::tuple<sumcheck::GenericPermutationRelation<sumcheck::ExampleTuplePermutationSettings, FF>>;
61 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
66 static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH = MAX_PARTIAL_RELATION_LENGTH + 1;
67 static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;
72 using SumcheckTupleOfTuplesOfUnivariates =
decltype(create_sumcheck_tuple_of_tuples_of_univariates<Relations>());
73 using TupleOfArraysOfValues =
decltype(create_tuple_of_arrays_of_values<Relations>());
82 using DataType = DataType_;
83 DEFINE_FLAVOR_MEMBERS(DataType,
85 enable_tuple_set_permutation,
86 enable_single_column_permutation,
87 enable_first_set_permutation,
88 enable_second_set_permutation)
92 return { lagrange_first,
93 enable_tuple_set_permutation,
94 enable_single_column_permutation,
95 enable_first_set_permutation,
96 enable_second_set_permutation };
108 template <
typename DataType>
class WitnessEntities {
110 DEFINE_FLAVOR_MEMBERS(DataType,
111 permutation_set_column_1,
112 permutation_set_column_2,
113 permutation_set_column_3,
114 permutation_set_column_4,
115 self_permutation_column,
116 tuple_permutation_inverses,
117 single_permutation_inverses)
121 return { permutation_set_column_1,
122 permutation_set_column_2,
123 permutation_set_column_3,
124 permutation_set_column_4,
125 self_permutation_column };
139 template <
typename DataType>
class AllEntities {
141 DEFINE_FLAVOR_MEMBERS(DataType,
143 enable_tuple_set_permutation,
144 enable_single_column_permutation,
145 enable_first_set_permutation,
146 enable_second_set_permutation,
147 permutation_set_column_1,
148 permutation_set_column_2,
149 permutation_set_column_3,
150 permutation_set_column_4,
151 self_permutation_column,
152 tuple_permutation_inverses,
153 single_permutation_inverses)
158 permutation_set_column_1, permutation_set_column_2, permutation_set_column_3, permutation_set_column_4
163 return { lagrange_first,
164 enable_tuple_set_permutation,
165 enable_single_column_permutation,
166 enable_first_set_permutation,
167 enable_second_set_permutation,
168 permutation_set_column_1,
169 permutation_set_column_2,
170 permutation_set_column_3,
171 permutation_set_column_4,
172 self_permutation_column,
173 tuple_permutation_inverses,
174 single_permutation_inverses };
193 std::array<PolynomialHandle, 3> get_table_column_wires() {
return {}; };
212 using Base = AllEntities<FF>;
228 [[nodiscard]]
size_t get_polynomial_size()
const {
return enable_tuple_set_permutation.size(); }
229 [[nodiscard]]
AllValues get_row(
const size_t row_idx)
const
249 for (
auto& poly : this->get_all()) {
258 template <
size_t LENGTH>
using ProverUnivariates = AllEntities<barretenberg::Univariate<FF, LENGTH>>;
279 using Base = AllEntities<std::string>;
283 : AllEntities<std::string>()
285 Base::permutation_set_column_1 =
"PERMUTATION_SET_COLUMN_1";
286 Base::permutation_set_column_2 =
"PERMUTATION_SET_COLUMN_2";
287 Base::permutation_set_column_3 =
"PERMUTATION_SET_COLUMN_3";
288 Base::permutation_set_column_4 =
"PERMUTATION_SET_COLUMN_4";
289 Base::self_permutation_column =
"SELF_PERMUTATION_COLUMN";
290 Base::tuple_permutation_inverses =
"TUPLE_PERMUTATION_INVERSES";
291 Base::single_permutation_inverses =
"SINGLE_PERMUTATION_INVERSES";
293 Base::lagrange_first =
"__LAGRANGE_FIRST";
294 Base::enable_tuple_set_permutation =
"__ENABLE_SET_PERMUTATION";
295 Base::enable_single_column_permutation =
"__ENABLE_SINGLE_COLUMN_PERMUTATION";
296 Base::enable_first_set_permutation =
"__ENABLE_FIRST_SET_PERMUTATION";
297 Base::enable_second_set_permutation =
"__ENABLE_SECOND_SET_PERMUTATION";
306 lagrange_first = verification_key->lagrange_first;
307 enable_tuple_set_permutation = verification_key->enable_tuple_set_permutation;
308 enable_single_column_permutation = verification_key->enable_single_column_permutation;
309 enable_first_set_permutation = verification_key->enable_first_set_permutation;
310 enable_second_set_permutation = verification_key->enable_second_set_permutation;
320 uint32_t circuit_size;
321 Commitment column_0_comm;
322 Commitment column_1_comm;
323 Commitment permutation_inverses_comm;
324 std::vector<barretenberg::Univariate<FF, BATCHED_RELATION_PARTIAL_LENGTH>> sumcheck_univariates;
325 std::array<FF, NUM_ALL_ENTITIES> sumcheck_evaluations;
327 std::vector<Commitment> zm_cq_comms;
328 Commitment zm_cq_comm;
329 Commitment zm_pi_comm;
337 void deserialize_full_transcript()
344 void serialize_full_transcript()
357DECLARE_IMPLEMENTATIONS_FOR_ALL_SETTINGS(GenericPermutationRelationImpl,
flavor::ToyAVM)
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
Definition: ref_vector.hpp:20
Definition: polynomial.hpp:12
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
Definition: transcript.hpp:62
Base class template containing circuit-specifying data.
Definition: flavor.hpp:85
Base proving key class.
Definition: flavor.hpp:101
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
Definition: toy_avm.hpp:210
A container for commitment labels.
Definition: toy_avm.hpp:277
A container for storing the partially evaluated multivariates produced by sumcheck.
Definition: toy_avm.hpp:242
A container for polynomials handles; only stores spans.
Definition: toy_avm.hpp:219
The proving key is responsible for storing the polynomials used by the prover.
Definition: toy_avm.hpp:186
Derived class that defines proof structure for ECCVM proofs, as well as supporting functions.
Definition: toy_avm.hpp:318
Definition: toy_avm.hpp:301
This class provides an example flavor for using GenericPermutationRelations with various settings to ...
Definition: toy_avm.hpp:30
AllEntities< barretenberg::Univariate< FF, LENGTH > > ProverUnivariates
A container for univariates used during Protogalaxy folding and sumcheck.
Definition: toy_avm.hpp:258
WitnessEntities< Commitment > WitnessCommitments
A container for the witness commitments.
Definition: toy_avm.hpp:269
ProverUnivariates< MAX_PARTIAL_RELATION_LENGTH > ExtendedEdges
A container for univariates produced during the hot loop in sumcheck.
Definition: toy_avm.hpp:263
CommitmentKey object over a pairing group 𝔾₁.
Definition: commitment_key.hpp:35
Definition: verification_key.hpp:25
Definition: zip_view.hpp:159
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
This file contains the template for the generic permutation that can be specialized to enforce variou...
Defines particular circuit builder types expected to be used for circuit construction in stdlib and c...
Definition: claim.hpp:6
This file contains settings for the General Permutation Relation implementations and (in the future) ...