Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
relation_types.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
10#include <algorithm>
11
12template <typename T>
13concept IsField = std::same_as<T, bb::fr> /* || std::same_as<T, grumpkin::fr> */;
14
15namespace bb {
16
17template <typename T>
19 { std::get<0>(T::SUBRELATION_LINEARLY_INDEPENDENT) } -> std::convertible_to<bool>;
20};
21
30template <typename Relation, size_t subrelation_index> constexpr bool subrelation_is_linearly_independent()
31{
33 return std::get<subrelation_index>(Relation::SUBRELATION_LINEARLY_INDEPENDENT);
34 } else {
35 return true;
36 }
37}
38
69template <typename Relation, typename AllEntities>
70concept isSkippable = requires(const AllEntities& input) {
71 { Relation::skip(input) } -> std::same_as<bool>;
72};
73
83template <typename Flavor, typename ProverPolynomialsOrPartiallyEvaluatedMultivariates, typename EdgeType>
85 requires(const ProverPolynomialsOrPartiallyEvaluatedMultivariates& input, const EdgeType edge_idx) {
86 { Flavor::skip_entire_row(input, edge_idx) } -> std::same_as<bool>;
87 };
88
96template <typename RelationImpl> class Relation : public RelationImpl {
97 public:
98 using FF = typename RelationImpl::FF;
99
100 static constexpr size_t RELATION_LENGTH = *std::max_element(RelationImpl::SUBRELATION_PARTIAL_LENGTHS.begin(),
101 RelationImpl::SUBRELATION_PARTIAL_LENGTHS.end());
102
105
107
108 // These are commonly needed, most importantly, for explicitly instantiating
109 // compute_foo_numerator/denomintor.
112};
113} // namespace bb
static bool skip_entire_row(const ProverPolynomialsOrPartiallyEvaluatedMultivariates &polynomials, const EdgeType edge_idx)
When evaluating the sumcheck protocol - can we skip evaluation of all relations for a given row?...
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
ArrayOfValues< FF, RelationImpl::SUBRELATION_PARTIAL_LENGTHS > SumcheckArrayOfValuesOverSubrelations
typename RelationImpl::FF FF
static constexpr size_t RELATION_LENGTH
TupleOfUnivariates< FF, RelationImpl::SUBRELATION_PARTIAL_LENGTHS > SumcheckTupleOfUnivariatesOverSubrelations
std::tuple_element_t< 0, SumcheckArrayOfValuesOverSubrelations > ValueAccumulator0
std::tuple_element_t< 0, SumcheckTupleOfUnivariatesOverSubrelations > UnivariateAccumulator0
Check if the flavor has a static skip method to determine if accumulation of all relations can be ski...
The templates defined herein facilitate sharing the relation arithmetic between the prover and the ve...
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
HomogeneousTupleToArray< TupleOfValues< FF, LENGTHS > > ArrayOfValues
constexpr bool subrelation_is_linearly_independent()
Check whether a given subrelation is linearly independent from the other subrelations.
typename TupleOfContainersOverArray< bb::Univariate, FF, LENGTHS >::type TupleOfUnivariates
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13