Skip to content

Commit

Permalink
LIbrary update
Browse files Browse the repository at this point in the history
  • Loading branch information
Rumata888 committed Nov 28, 2023
1 parent 62f6491 commit 910256e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
22 changes: 11 additions & 11 deletions barretenberg/cpp/src/barretenberg/flavor/avm_template.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class AVMTemplate {
public:
DataType permutation_set_column_1; // column 0
DataType permutation_set_column_2; // column 1
DataType permutation_set_column_3; // column 1
DataType permutation_set_column_4; // column 1
DataType permutation_inverses; // column 2
DataType permutation_set_column_3; // column 2
DataType permutation_set_column_4; // column 3
DataType permutation_inverses; // column 4

DEFINE_POINTER_VIEW(NUM_WITNESS_ENTITIES,
&permutation_set_column_1,
Expand Down Expand Up @@ -123,12 +123,12 @@ class AVMTemplate {
class AllEntities : public AllEntities_<DataType, HandleType, NUM_ALL_ENTITIES> {
public:
DataType lagrange_first; // column 0
DataType enable_set_permutation; // column 0
DataType permutation_set_column_1; // column 1
DataType permutation_set_column_2; // column 2
DataType permutation_set_column_3; // column 2
DataType permutation_set_column_4; // column 2
DataType permutation_inverses; // column 3
DataType enable_set_permutation; // column 1
DataType permutation_set_column_1; // column 2
DataType permutation_set_column_2; // column 3
DataType permutation_set_column_3; // column 4
DataType permutation_set_column_4; // column 5
DataType permutation_inverses; // column 6

// defines a method pointer_view that returns the following, with const and non-const variants
DEFINE_POINTER_VIEW(NUM_ALL_ENTITIES,
Expand Down Expand Up @@ -340,7 +340,7 @@ class AVMTemplate {

void deserialize_full_transcript() override
{
// TODO
// TODO. Codepath is dead for now, becaused there is no composer
abort();
// take current proof and put them into the struct
size_t num_bytes_read = 0;
Expand Down Expand Up @@ -370,7 +370,7 @@ class AVMTemplate {

void serialize_full_transcript() override
{
// TODO
// TODO. Codepath is dead for now, becaused there is no composer
abort();
size_t old_proof_length = BaseTranscript<FF>::proof_data.size();
BaseTranscript<FF>::proof_data.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,20 @@ void accumulate_logderivative_lookup_subrelation_contributions(ContainerOverSubr
* @brief Compute generic log-derivative set permutation subrelation accumulation
* @details The generic log-derivative lookup relation consistes of two subrelations. The first demonstrates that the
* inverse polynomial I, defined via I = 1/[(read_term) * (write_term)], has been computed correctly. The second
* establishes the correctness of the lookups themselves based on the log-derivative lookup argument. Note that the
* establishes the correctness of the permutation itself based on the log-derivative argument. Note that the
* latter subrelation is "linearly dependent" in the sense that it establishes that a sum across all rows of the
* execution trace is zero, rather than that some expression holds independently at each row. Accordingly, this
* subrelation is not multiplied by a scaling factor at each accumulation step. The subrelation expressions are
* respectively:
*
* I * (read_term) * (write_term) - 1 = 0
* I * (read_term) * (write_term) - q_{permutation_enabler} = 0
*
* \sum_{i=0}^{n-1} [q_{logderiv_enabler} * I * write_term + I * read_term] = 0
* \sum_{i=0}^{n-1} [q_{write_enabler} * I * write_term + q_{read_enabler} * I * read_term] = 0
*
* The explicit expressions for read_term and write_term are dependent upon the particular structure of the lookup being
* performed and methods for computing them must be defined in the corresponding relation class.
* The explicit expressions for read_term and write_term are dependent upon the particular structure of the permutation
* being performed and methods for computing them must be defined in the corresponding relation class. The entities
* which are used to determine the use of permutation (is it enabled, is the first "read" set enabled, is the second
* "write" set enabled) must be defined in the relation class.
*
* @tparam FF
* @tparam Relation
Expand All @@ -188,6 +190,8 @@ void accumulate_logderivative_permutation_subrelation_contributions(ContainerOve
{
constexpr size_t READ_TERMS = Relation::READ_TERMS;
constexpr size_t WRITE_TERMS = Relation::WRITE_TERMS;

// For now we only do simple permutations over tuples with 1 read and 1 write term
static_assert(READ_TERMS == 1);
static_assert(WRITE_TERMS == 1);

Expand All @@ -202,12 +206,12 @@ void accumulate_logderivative_permutation_subrelation_contributions(ContainerOve
std::array<Accumulator, NUM_TOTAL_TERMS> permutation_terms;
std::array<Accumulator, NUM_TOTAL_TERMS> denominator_accumulator;

// The lookup relation = \sum_j (1 / read_term[j]) - \sum_k (read_counts[k] / write_term[k])
// To get the inverses (1 / read_term[i]), (1 / write_term[i]), we have a commitment to the product of all inverses
// i.e. lookup_inverse = \prod_j (1 / read_term[j]) * \prod_k (1 / write_term[k])
// The purpose of this next section is to derive individual inverse terms using `lookup_inverses`
// i.e. (1 / read_term[i]) = lookup_inverse * \prod_{j /ne i} (read_term[j]) * \prod_k (write_term[k])
// (1 / write_term[i]) = lookup_inverse * \prod_j (read_term[j]) * \prod_{k ne i} (write_term[k])
// The permutation relation = 1 / read_term - 1 / write_term
// To get the inverses (1 / read_term), (1 / write_term), we have a commitment to the product ofinver ses
// i.e. permutation_inverses = (1 / read_term) * (1 / write_term)
// The purpose of this next section is to derive individual inverse terms using `permutation_inverses`
// i.e. (1 / read_term) = permutation_inverse * write_term
// (1 / write_term) = permutation_inverse * read_term
permutation_terms[0] = permutation_relation.template compute_read_term<Accumulator, 0>(in, params);
permutation_terms[1] = permutation_relation.template compute_write_term<Accumulator, 0>(in, params);

Expand Down

0 comments on commit 910256e

Please sign in to comment.