barretenberg
Loading...
Searching...
No Matches
relation_definer.hpp
Go to the documentation of this file.
1
8#pragma once
9#include <cstddef>
10#include <tuple>
11namespace proof_system::honk::sumcheck {
12
27 public:
28 // This constant defines how many columns are bundled together to form each set. For example, in this case we are
29 // bundling tuples of (permutation_set_column_1, permutation_set_column_2) to be a permutation of
30 // (permutation_set_column_3,permutation_set_column_4). As the tuple has 2 elements, set the value to 2
31 constexpr static size_t COLUMNS_PER_SET = 2;
32
40 template <typename AllEntities> static inline bool inverse_polynomial_is_computed_at_row(const AllEntities& in)
41 {
42 return (in.enable_tuple_set_permutation == 1);
43 }
44
61 template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
62 {
63
64 return std::forward_as_tuple(
65 in.tuple_permutation_inverses, /* The polynomial containing the inverse product*/
66 in.enable_tuple_set_permutation, /* The polynomial enabling the product check subrelation */
67 in.enable_tuple_set_permutation, /* Enables adding first set to the sum */
68 in.enable_tuple_set_permutation, /* Enables adding second set to the sum */
69 in.permutation_set_column_3, /* The first entry in the first set tuple */
70 in.permutation_set_column_4, /* The second entry in the first set tuple */
71 in.permutation_set_column_1, /* The first entry in the second set tuple */
72 in.permutation_set_column_2); /* The second entry in the second set tuple */
73 }
74
91 template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
92 {
93 return std::forward_as_tuple(
94 in.tuple_permutation_inverses, /* The polynomial containing the inverse product*/
95 in.enable_tuple_set_permutation, /* The polynomial enabling the product check subrelation */
96 in.enable_tuple_set_permutation, /* Enables adding first set to the sum */
97 in.enable_tuple_set_permutation, /* Enables adding second set to the sum */
98 in.permutation_set_column_3, /* The first entry in the first set tuple */
99 in.permutation_set_column_4, /* The second entry in the first set tuple */
100 in.permutation_set_column_1, /* The first entry in the second set tuple */
101 in.permutation_set_column_2); /* The second entry in the second set tuple */
102 }
103};
104
119 public:
120 // This constant defines how many columns are bundled together to form each set. For example, in this case we are
121 // permuting entries in the column with itself (self_permutation_column), so we choose just one
122 constexpr static size_t COLUMNS_PER_SET = 1;
123
131 template <typename AllEntities> static inline bool inverse_polynomial_is_computed_at_row(const AllEntities& in)
132 {
133 return (in.enable_single_column_permutation == 1);
134 }
135
152 template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
153 {
154
155 return std::forward_as_tuple(
156 in.single_permutation_inverses, /* The polynomial containing the inverse product*/
157 in.enable_single_column_permutation, /* The polynomial enabling the product check subrelation */
158 in.enable_first_set_permutation, /* Enables adding first set to the sum */
159 in.enable_second_set_permutation, /* Enables adding second set to the sum */
160 in.self_permutation_column, /* The first set column */
161 in.self_permutation_column /* The second set column which in this case is the same as the first set column
162 */
163 );
164 }
165
182 template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
183 {
184 return std::forward_as_tuple(
185 in.single_permutation_inverses, /* The polynomial containing the inverse product*/
186 in.enable_single_column_permutation, /* The polynomial enabling the product check subrelation */
187 in.enable_first_set_permutation, /* Enables adding first set to the sum */
188 in.enable_second_set_permutation, /* Enables adding second set to the sum */
189 in.self_permutation_column, /* The first set column */
190 in.self_permutation_column /* The second set column which in this case is the same as the first set column
191 */
192 );
193 }
194};
195
196#define DEFINE_IMPLEMENTATIONS_FOR_SETTINGS(RelationImplementation, flavor, Settings) \
197 template class RelationImplementation<Settings, flavor::FF>; \
198 template <typename FF_> using RelationImplementation##Settings = RelationImplementation<Settings, FF_>; \
199 DEFINE_SUMCHECK_RELATION_CLASS(RelationImplementation##Settings, flavor);
200
201#define DEFINE_IMPLEMENTATIONS_FOR_ALL_SETTINGS(RelationImplementation, flavor) \
202 DEFINE_IMPLEMENTATIONS_FOR_SETTINGS(RelationImplementation, flavor, ExampleTuplePermutationSettings); \
203 DEFINE_IMPLEMENTATIONS_FOR_SETTINGS(RelationImplementation, flavor, ExampleSameWirePermutationSettings);
204
205#define DECLARE_IMPLEMENTATIONS_FOR_SETTINGS(RelationImplementation, flavor, Settings) \
206 extern template class RelationImplementation<Settings, flavor::FF>; \
207 template <typename FF_> using RelationImplementation##Settings = RelationImplementation<Settings, FF_>; \
208 DECLARE_SUMCHECK_RELATION_CLASS(RelationImplementation##Settings, flavor);
209
210#define DECLARE_IMPLEMENTATIONS_FOR_ALL_SETTINGS(RelationImplementation, flavor) \
211 DECLARE_IMPLEMENTATIONS_FOR_SETTINGS(RelationImplementation, flavor, ExampleTuplePermutationSettings); \
212 DECLARE_IMPLEMENTATIONS_FOR_SETTINGS(RelationImplementation, flavor, ExampleSameWirePermutationSettings);
213} // namespace proof_system::honk::sumcheck
This class contains an example of how to set PermutationSettings classes used by the GenericPermutati...
Definition: relation_definer.hpp:118
static auto get_nonconst_entities(AllEntities &in)
Get all the entities for the permutation when need to update them.
Definition: relation_definer.hpp:182
static auto get_const_entities(const AllEntities &in)
Get all the entities for the permutation when we don't need to update them.
Definition: relation_definer.hpp:152
static bool inverse_polynomial_is_computed_at_row(const AllEntities &in)
If this method returns true on a row of values, then the inverse polynomial at this index....
Definition: relation_definer.hpp:131
This class contains an example of how to set PermutationSettings classes used by the GenericPermutati...
Definition: relation_definer.hpp:26
static auto get_const_entities(const AllEntities &in)
Get all the entities for the permutation when we don't need to update them.
Definition: relation_definer.hpp:61
static bool inverse_polynomial_is_computed_at_row(const AllEntities &in)
If this method returns true on a row of values, then the inverse polynomial at this index....
Definition: relation_definer.hpp:40
static auto get_nonconst_entities(AllEntities &in)
Get all the entities for the permutation when need to update them.
Definition: relation_definer.hpp:91