Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Shared Permutation+Lookup relation arithmetic #559

Merged
merged 10 commits into from
Jul 21, 2023

Conversation

zac-williamson
Copy link
Contributor

Description

For relations that use a grand product, the algebra that defines the relation is contained exclusively within the respective Relation class.

This aligns with how we treat non-grand-product relations and prevents the duplication of complex polynomial algebra (e.g. previously the permutation+grand product algebra was duplicated between the relation class and prover_library.cpp

Checklist:

  • I have reviewed my diff in github, line by line.
  • Every change is related to the PR description.
  • The branch has been merged with/rebased against the head of its merge target.
  • There are no unexpected formatting changes, superfluous debug logs, or commented-out code.
  • There are no circuit changes, OR a cryptographer has been assigned for review.
  • New functions, classes, etc. have been documented according to the doxygen comment format. Classes and structs must have @brief describing the intended functionality.
  • If existing code has been modified, such documentation has been added or updated.
  • No superfluous include directives have been added.
  • I have linked to any issue(s) it resolves.
  • I'm happy for the PR to be merged at the reviewer's next convenience.

@kevaundray kevaundray changed the title chore: shared Permutation+Lookup relation arithmetic chore: Shared Permutation+Lookup relation arithmetic Jun 27, 2023
@zac-williamson zac-williamson force-pushed the zw/shared-permutation-relation-arithmetic branch 2 times, most recently from 259d609 to abf4764 Compare July 17, 2023 09:21
@ledwards2225 ledwards2225 requested review from ledwards2225 and removed request for codygunton July 19, 2023 15:16
@ledwards2225 ledwards2225 force-pushed the zw/shared-permutation-relation-arithmetic branch from 1fde990 to d915994 Compare July 19, 2023 22:43
Copy link
Collaborator

@ledwards2225 ledwards2225 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. One minor change that I think is worth making: I'd like to remove the keyword "permutation" from objects that refer to arbitrary grand products more generally. For example, I would prefer the function compute_permutation_grand_products (which for Ultra computes both the perm and lookup grand products) be called simply compute_grand_products or perhaps compute_grand_product_polynomials. There are several similar instances.

// Assign the grand product polynomial to the relevant std::span member of `full_polynomials` (and its shift)
// For example, for UltraPermutationRelation, this will be `full_polynomials.z_perm`
// For example, for LookupRelation, this will be `full_polynomials.z_lookup`
std::span<FF>& full_polynomial = PermutationRelation::get_grand_product_polynomial(full_polynomials);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a second to work out what was going on here. The fact that it needed to be done this way seems like an indication that something in our full_polynomials/proving_key model could be improved but nothing really to do with this PR

((z_perm_shift + lagrange_last * public_input_delta) * (w_1 + sigma_1 * beta + gamma) *
(w_2 + sigma_2 * beta + gamma) * (w_3 + sigma_3 * beta + gamma))) *
(((z_perm + lagrange_first) *
compute_permutation_numerator<AccumulatorTypes>(input, relation_parameters, 0)) -
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index = 0 concerned me at first until I tracked down the different implementations of get_view. It's minor but would be nice to find a way to improve the interface here. Happy to leave as a possible TODO

@ledwards2225 ledwards2225 force-pushed the zw/shared-permutation-relation-arithmetic branch from ca03767 to 6468684 Compare July 21, 2023 03:37
@ledwards2225 ledwards2225 merged commit 1672005 into master Jul 21, 2023
@ledwards2225 ledwards2225 deleted the zw/shared-permutation-relation-arithmetic branch July 21, 2023 03:51
ludamad pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jul 22, 2023
ludamad pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants