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

Implement Lagrange kernel constraints #247

Merged
merged 237 commits into from
Mar 25, 2024

Conversation

plafer
Copy link
Contributor

@plafer plafer commented Feb 16, 2024

Closes: #240

Builds on: #245

Done:

  • failing test with Air which uses a Lagrange kernel auxiliary column
  • verifier

Left to do:

  • Prover populates OodFrame with Lagrange kernel "frame"
  • Prover evaluates Lagrange kernel transition and boundary constraints
  • Cleanup (including revisiting current API)

Copy link
Collaborator

@irakliyk irakliyk left a comment

Choose a reason for hiding this comment

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

Thank you! Looks good! I left some more comments inline - but these are mostly nits.

One thing I'm still trying to think through is whether we should change anything about how we handle OOD frame structs. But I think this is the last potential change (and I'm not sure if anything should be changed at all on this front).

@Al-Kindi-0 - could you give this another review?

verifier/src/evaluator.rs Outdated Show resolved Hide resolved
prover/src/constraints/evaluator/default.rs Outdated Show resolved Hide resolved
prover/src/constraints/evaluator/default.rs Show resolved Hide resolved
air/src/air/mod.rs Outdated Show resolved Hide resolved
air/src/air/mod.rs Outdated Show resolved Hide resolved
air/src/air/lagrange/frame.rs Show resolved Hide resolved
prover/src/constraints/evaluator/lagrange.rs Outdated Show resolved Hide resolved
prover/src/constraints/evaluator/lagrange.rs Show resolved Hide resolved
air/src/proof/ood_frame.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Al-Kindi-0 Al-Kindi-0 left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!
Left some small comments inline.
There is one thing which should conclude this PR and that is updating the portion related to the DEEP composition polynomial. I am not sure if this should go into this PR (as this one is already big enough and the remaining changes are quite substantial). I think a good improvement to discuss that will be useful for the remaining changes is to see if we can do away with using the coefficient form of the trace column polynomials. This will have some performance advantages, I believe, as well as make some of the changes required to accommodate the Lagrange kernel easy.

air/src/air/context.rs Outdated Show resolved Hide resolved
air/src/air/context.rs Outdated Show resolved Hide resolved
air/src/air/context.rs Outdated Show resolved Hide resolved
Comment on lines 56 to 59
pub fn from_transition(trace_length: usize, num_exemptions: usize) -> Self {
assert!(
num_exemptions > 0,
"invalid number of transition exemptions: must be greater than zero"
);
let exemptions = (trace_length - num_exemptions..trace_length)
.map(|step| get_trace_domain_value_at::<B>(trace_length, step))
.collect();
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest we rename trace_length and keep one constructor. We could rename it constraint_enforcement_domain_size or something better.

air/src/air/lagrange/frame.rs Outdated Show resolved Hide resolved
air/src/air/lagrange/transition.rs Outdated Show resolved Hide resolved
air/src/air/lagrange/transition.rs Outdated Show resolved Hide resolved
prover/src/trace/poly_table.rs Outdated Show resolved Hide resolved

let frame_length = self.trace_info.length().ilog2() as usize + 1;
for i in 0..frame_length - 1 {
let shift = self.blowup() * 2_u32.pow(i as u32) as usize;
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: this could probably be optimized but probably not worth the degradation in readability

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched to (1 << i) - this is arguably more readable due to the removal of both as _.

The benchmarks indeed didn't improve though

prover/src/trace/trace_lde/mod.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@irakliyk irakliyk left a comment

Choose a reason for hiding this comment

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

All looks good! Thank you! As the next steps, we should do the following:

  1. Make a small refactoring mentioned here and also remove the incomplete machinery related to supporting multiple auxiliary trace segments.
  2. Complete the ability to run the full GKR protocol after the main trace commitment is computed (discussed in #257. This may require refactoring how our prover/verifier channels work.
  3. Implement proper handling of DEEP composition for the Lagrange constraints.

@irakliyk irakliyk merged commit 8aced0a into facebook:next Mar 25, 2024
9 checks passed
@plafer plafer mentioned this pull request Mar 26, 2024
irakliyk pushed a commit that referenced this pull request May 9, 2024
irakliyk pushed a commit that referenced this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accomodating more expressive transition constraints
4 participants