Skip to content

Commit

Permalink
change purported evaluations to claimed evauluations
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards2225 committed May 22, 2023
1 parent c8dc6dc commit e5a5fb0
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/honk/flavor/flavor.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TEST(Flavor, StandardGetters)
Flavor::VerificationKey verification_key;
Flavor::ProverPolynomials prover_polynomials;
Flavor::ExtendedEdges<Flavor::NUM_ALL_ENTITIES> edges;
Flavor::PurportedEvaluations evals;
Flavor::ClaimedEvaluations evals;
Flavor::CommitmentLabels commitment_labels;

// Globals are also available through STL container sizes
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/honk/flavor/standard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ class Standard {
* @brief A container for the polynomials evaluations produced during sumcheck, which are purported to be the
* evaluations of polynomials committed in earlier rounds.
*/
class PurportedEvaluations : public AllEntities<FF, FF> {
class ClaimedEvaluations : public AllEntities<FF, FF> {
public:
using Base = AllEntities<FF, FF>;
using Base::Base;
PurportedEvaluations(std::array<FF, NUM_ALL_ENTITIES> _data_in) { this->_data = _data_in; }
ClaimedEvaluations(std::array<FF, NUM_ALL_ENTITIES> _data_in) { this->_data = _data_in; }
};

/**
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/honk/flavor/ultra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ class Ultra {
* @brief A container for the polynomials evaluations produced during sumcheck, which are purported to be the
* evaluations of polynomials committed in earlier rounds.
*/
class PurportedEvaluations : public AllEntities<FF, FF> {
class ClaimedEvaluations : public AllEntities<FF, FF> {
public:
using Base = AllEntities<FF, FF>;
using Base::Base;
PurportedEvaluations(std::array<FF, NUM_ALL_ENTITIES> _data_in) { this->_data = _data_in; }
ClaimedEvaluations(std::array<FF, NUM_ALL_ENTITIES> _data_in) { this->_data = _data_in; }
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class StandardRelationConsistency : public testing::Test {
public:
using Flavor = honk::flavor::Standard;
using FF = typename Flavor::FF;
using PurportedEvaluations = typename Flavor::PurportedEvaluations;
using ClaimedEvaluations = typename Flavor::ClaimedEvaluations;
// TODO(#390): Move MAX_RELATION_LENGTH into Flavor and simplify this.

template <size_t t> using ExtendedEdges = typename Flavor::template ExtendedEdges<t>;
Expand Down Expand Up @@ -82,7 +82,7 @@ class StandardRelationConsistency : public testing::Test {
* @return std::array<FF, NUM_UNIVARIATES> such that result[j] = univariates[j].value_at(i)
*/
template <size_t univariate_length>
static PurportedEvaluations transposed_univariate_array_at(ExtendedEdges<univariate_length> univariates, size_t i)
static ClaimedEvaluations transposed_univariate_array_at(ExtendedEdges<univariate_length> univariates, size_t i)
{
ASSERT(i < univariate_length);
std::array<FF, Flavor::NUM_ALL_ENTITIES> result;
Expand Down Expand Up @@ -117,7 +117,7 @@ class StandardRelationConsistency : public testing::Test {
Univariate<FF, FULL_RELATION_LENGTH> expected_evals_index{ 0 };
for (size_t i = 0; i < FULL_RELATION_LENGTH; ++i) {
// Get an array of the same size as `extended_edges` with only the i-th element of each extended edge.
PurportedEvaluations evals_i = transposed_univariate_array_at(extended_edges, i);
ClaimedEvaluations evals_i = transposed_univariate_array_at(extended_edges, i);
// Evaluate the relation
relation.add_full_relation_value_contribution(
expected_evals_index.value_at(i), evals_i, relation_parameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TEST(RelationCorrectness, StandardRelationCorrectness)
using Flavor = honk::flavor::Standard;
using FF = typename Flavor::FF;
using ProverPolynomials = typename Flavor::ProverPolynomials;
using PurportedEvaluations = typename Flavor::PurportedEvaluations;
using ClaimedEvaluations = typename Flavor::ClaimedEvaluations;

// Create a composer and a dummy circuit with a few gates
auto composer = StandardHonkComposer();
Expand Down Expand Up @@ -115,7 +115,7 @@ TEST(RelationCorrectness, StandardRelationCorrectness)
for (size_t i = 0; i < prover.key->circuit_size; i++) {
// Compute an array containing all the evaluations at a given row i

PurportedEvaluations evaluations_at_index_i;
ClaimedEvaluations evaluations_at_index_i;
size_t poly_idx = 0;
for (auto& polynomial : prover_polynomials) {
evaluations_at_index_i[poly_idx] = polynomial[i];
Expand Down Expand Up @@ -154,7 +154,7 @@ TEST(RelationCorrectness, UltraRelationCorrectness)
using Flavor = honk::flavor::Ultra;
using FF = typename Flavor::FF;
using ProverPolynomials = typename Flavor::ProverPolynomials;
using PurportedEvaluations = typename Flavor::PurportedEvaluations;
using ClaimedEvaluations = typename Flavor::ClaimedEvaluations;

// Create a composer and then add an assortment of gates designed to ensure that the constraint(s) represented
// by each relation are non-trivially exercised.
Expand Down Expand Up @@ -379,7 +379,7 @@ TEST(RelationCorrectness, UltraRelationCorrectness)
fr result = 0;
for (size_t i = 0; i < prover.key->circuit_size; i++) {
// Compute an array containing all the evaluations at a given row i
PurportedEvaluations evaluations_at_index_i;
ClaimedEvaluations evaluations_at_index_i;
size_t poly_idx = 0;
for (auto& polynomial : prover_polynomials) {
evaluations_at_index_i[poly_idx] = polynomial[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class UltraRelationConsistency : public testing::Test {
public:
using Flavor = honk::flavor::Ultra;
using FF = typename Flavor::FF;
using PurportedEvaluations = typename Flavor::PurportedEvaluations;
using ClaimedEvaluations = typename Flavor::ClaimedEvaluations;

// TODO(#390): Move MAX_RELATION_LENGTH into Flavor and simplify this.
template <size_t t> using ExtendedEdges = typename Flavor::template ExtendedEdges<t>;
Expand Down Expand Up @@ -83,7 +83,7 @@ class UltraRelationConsistency : public testing::Test {
* @return std::array<FF, NUM_UNIVARIATES> such that result[j] = univariates[j].value_at(i)
*/
template <size_t univariate_length>
static PurportedEvaluations transposed_univariate_array_at(ExtendedEdges<univariate_length> univariates, size_t i)
static ClaimedEvaluations transposed_univariate_array_at(ExtendedEdges<univariate_length> univariates, size_t i)
{
ASSERT(i < univariate_length);
std::array<FF, Flavor::NUM_ALL_ENTITIES> result;
Expand Down Expand Up @@ -118,7 +118,7 @@ class UltraRelationConsistency : public testing::Test {
Univariate<FF, FULL_RELATION_LENGTH> expected_evals_index{ 0 };
for (size_t i = 0; i < FULL_RELATION_LENGTH; ++i) {
// Get an array of the same size as `extended_edges` with only the i-th element of each extended edge.
PurportedEvaluations evals_i = transposed_univariate_array_at(extended_edges, i);
ClaimedEvaluations evals_i = transposed_univariate_array_at(extended_edges, i);
// Evaluate the relation
relation.add_full_relation_value_contribution(
expected_evals_index.value_at(i), evals_i, relation_parameters);
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ template <typename Flavor, class Transcript, template <class> class... Relations
public:
using FF = typename Flavor::FF;
using PartiallyEvaluatedMultivariates = typename Flavor::PartiallyEvaluatedMultivariates;
using PurportedEvaluations = typename Flavor::PurportedEvaluations;
using ClaimedEvaluations = typename Flavor::ClaimedEvaluations;

static constexpr size_t MAX_RELATION_LENGTH = std::max({ Relations<FF>::RELATION_LENGTH... });
static constexpr size_t NUM_POLYNOMIALS = Flavor::NUM_ALL_ENTITIES;
Expand Down Expand Up @@ -123,7 +123,7 @@ template <typename Flavor, class Transcript, template <class> class... Relations
}

// Final round: Extract multivariate evaluations from partially_evaluated_polynomials and add to transcript
PurportedEvaluations multivariate_evaluations;
ClaimedEvaluations multivariate_evaluations;
size_t evaluation_idx = 0;
for (auto& polynomial : partially_evaluated_polynomials) { // TODO(#391) zip
multivariate_evaluations[evaluation_idx] = polynomial[0];
Expand Down Expand Up @@ -178,7 +178,7 @@ template <typename Flavor, class Transcript, template <class> class... Relations
}

// Final round
PurportedEvaluations purported_evaluations =
ClaimedEvaluations purported_evaluations =
transcript.template receive_from_prover<std::array<FF, NUM_POLYNOMIALS>>("Sumcheck:evaluations");

FF full_honk_relation_purported_value = round.compute_full_honk_relation_purported_value(
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ namespace proof_system::honk::sumcheck {
*/
template <typename Flavor> struct SumcheckOutput {
using FF = typename Flavor::FF;
using PurportedEvaluations = typename Flavor::PurportedEvaluations;
using ClaimedEvaluations = typename Flavor::ClaimedEvaluations;
// u = (u_0, ..., u_{d-1})
std::vector<FF> challenge_point;
// Evaluations in `u` of the polynomials used in Sumcheck
PurportedEvaluations purported_evaluations;
ClaimedEvaluations purported_evaluations;

SumcheckOutput()
: purported_evaluations(std::array<FF, Flavor::NUM_ALL_ENTITIES>()){};

SumcheckOutput(const std::vector<FF>& _challenge_point, const PurportedEvaluations& _purported_evaluations)
SumcheckOutput(const std::vector<FF>& _challenge_point, const ClaimedEvaluations& _purported_evaluations)
: challenge_point(_challenge_point)
, purported_evaluations(_purported_evaluations){};

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ template <typename Flavor, template <class> class... Relations> class SumcheckRo
using FF = typename Flavor::FF;
template <size_t univariate_length>
using ExtendedEdges = typename Flavor::template ExtendedEdges<univariate_length>;
using PurportedEvaluations = typename Flavor::PurportedEvaluations;
using ClaimedEvaluations = typename Flavor::ClaimedEvaluations;

bool round_failed = false;
size_t round_size; // a power of 2
Expand Down Expand Up @@ -218,7 +218,7 @@ template <typename Flavor, template <class> class... Relations> class SumcheckRo
* together, with appropriate scaling factors, produces the expected value of the full Honk relation. This value is
* checked against the final value of the target total sum, defined as sigma_d.
*/
FF compute_full_honk_relation_purported_value(PurportedEvaluations purported_evaluations,
FF compute_full_honk_relation_purported_value(ClaimedEvaluations purported_evaluations,
const RelationParameters<FF>& relation_parameters,
const PowUnivariate<FF>& pow_univariate,
const FF alpha)
Expand Down Expand Up @@ -316,7 +316,7 @@ template <typename Flavor, template <class> class... Relations> class SumcheckRo
*/
template <size_t relation_idx = 0>
// TODO(#224)(Cody): Input should be an array?
void accumulate_relation_evaluations(PurportedEvaluations purported_evaluations,
void accumulate_relation_evaluations(ClaimedEvaluations purported_evaluations,
const RelationParameters<FF>& relation_parameters)
{
std::get<relation_idx>(relations).add_full_relation_value_contribution(
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using namespace proof_system::honk::sumcheck;
using Flavor = flavor::Standard;
using FF = typename Flavor::FF;
using ProverPolynomials = typename Flavor::ProverPolynomials;
using PurportedEvaluations = typename Flavor::PurportedEvaluations;
using ClaimedEvaluations = typename Flavor::ClaimedEvaluations;

const size_t NUM_POLYNOMIALS = Flavor::NUM_ALL_ENTITIES;
const size_t max_relation_length = 5;
Expand Down Expand Up @@ -187,7 +187,7 @@ static FF compute_full_purported_value(std::array<FF, NUM_POLYNOMIALS>& input_va
const RelationParameters<FF>& relation_parameters,
const FF alpha)
{
PurportedEvaluations purported_evaluations;
ClaimedEvaluations purported_evaluations;
purported_evaluations.w_l = input_values[0];
purported_evaluations.w_r = input_values[1];
purported_evaluations.w_o = input_values[2];
Expand Down

0 comments on commit e5a5fb0

Please sign in to comment.