-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add MLE eval constraints #742
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #742 +/- ##
=======================================
Coverage 92.35% 92.35%
=======================================
Files 91 91
Lines 12450 12450
Branches 12450 12450
=======================================
Hits 11498 11498
Misses 846 846
Partials 106 106 ☔ View full report in Codecov by Sentry. |
204c0c9
to
09633ef
Compare
362200c
to
3e11492
Compare
e92da5e
to
c7bc875
Compare
a9bcbff
to
7c561f8
Compare
89ce052
to
4b3e44d
Compare
7c561f8
to
e813a31
Compare
af634d6
to
ba7d85c
Compare
4b3e44d
to
8c883a3
Compare
ba7d85c
to
0901dcb
Compare
8c883a3
to
cd7b833
Compare
0901dcb
to
45efb37
Compare
cd7b833
to
ebd1199
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r1, 1 of 2 files at r3, all commit messages.
Reviewable status: 1 of 3 files reviewed, 4 unresolved discussions (waiting on @andrewmilson)
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 11 at r3 (raw file):
pub fn mle_eval_check<E: EvalAtRow, const N_VARIABLES: usize>( eval: &mut E, point_meta: PointMeta<N_VARIABLES>,
I think this can be named better. What exactly does this hold?
Is it some precomuptation regarding the MLE evaluation point in EF^N_VARS ?
If so, maybe MleEvalPoint ?
Code quote:
PointMeta
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 12 at r3 (raw file):
eval: &mut E, point_meta: PointMeta<N_VARIABLES>, mle_coeff: E::EF,
What's this?
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 15 at r3 (raw file):
mle_claim: SecureField, eq_evals_at: &EqEvalsMaskAt<E, N_VARIABLES>, eq_evals_is: &EqEvalsMaskIs<E, N_VARIABLES>,
I don't understand what these are. Can they have better names?
Code quote:
eq_evals_at: &EqEvalsMaskAt<E, N_VARIABLES>,
eq_evals_is: &EqEvalsMaskIs<E, N_VARIABLES>,
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 23 at r3 (raw file):
eq_evals_check(eval, point_meta, eq_evals_at, eq_evals_is); let mle_term = mle_coeff * eq_evals_at.curr; inclusive_prefix_sum_check(eval, mle_term, mle_claim, eq_evals_is.first, prefix_sum_at);
Lior suggested another way to do the prefix check, without is_first. I implemented it in logup. The idea is to first subtract claimed_sum/N_ROWS from the values, so that their sum is 0. Now, we dont need is_first, because the diff constraint applies also at the transition from the last row to the first.
- Consider using it.
- Consider reusing code from logup.rs
Code quote:
inclusive_prefix_sum_check(eval, mle_term, mle_claim, eq_evals_is.first, prefix_sum_at);
45efb37
to
eed4ce8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 3 files reviewed, 4 unresolved discussions (waiting on @spapinistarkware)
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 11 at r3 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
I think this can be named better. What exactly does this hold?
Is it some precomuptation regarding the MLE evaluation point in EF^N_VARS ?
If so, maybe MleEvalPoint ?
Done.
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 12 at r3 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
What's this?
Added comment
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 15 at r3 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
I don't understand what these are. Can they have better names?
Refactored to just a single EqEvalsMask
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 23 at r3 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
Lior suggested another way to do the prefix check, without is_first. I implemented it in logup. The idea is to first subtract claimed_sum/N_ROWS from the values, so that their sum is 0. Now, we dont need is_first, because the diff constraint applies also at the transition from the last row to the first.
- Consider using it.
- Consider reusing code from logup.rs
Done 1.
Didn't do 2. as the code in logup.rs seems quite coupled to LogUp
ebd1199
to
fd64e53
Compare
eed4ce8
to
7ece88d
Compare
fd64e53
to
ca1ebb2
Compare
7ece88d
to
5d385e8
Compare
ca1ebb2
to
3bb31ff
Compare
5d385e8
to
134d883
Compare
3bb31ff
to
79642f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 3 unresolved discussions (waiting on @andrewmilson)
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 7 at r4 (raw file):
use crate::examples::xor::prefix_sum_constraints::PrefixSumMask; pub struct MleEvalMask<E: EvalAtRow, const N_VARIABLES: usize> {
- Like before, do we really need a struct here?
- Do we need PrefixSumMask to be a struct? (e.g. does it hold preprocessed data shared by all rows?)
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 7 at r4 (raw file):
use crate::examples::xor::prefix_sum_constraints::PrefixSumMask; pub struct MleEvalMask<E: EvalAtRow, const N_VARIABLES: usize> {
This struct isn't really the Mask I believe, since you are not gonna use it externally as a mask item. It's only here to evaluate the constraints. Whether this stays a struct or becomes a function, rename it to something that conveys this evaluates constraints.
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 9 at r4 (raw file):
pub struct MleEvalMask<E: EvalAtRow, const N_VARIABLES: usize> { /// Mask item on the column that interpolates all MLE coefficients in the lagrange basis. mle_coeff: E::EF,
Is this a coeff or a mask item? Maybe it's a column value? whatever you chose, make the name and documentation consistent.
b4a93a9
to
abf86a1
Compare
79642f9
to
441915c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 3 unresolved discussions (waiting on @spapinistarkware)
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 7 at r4 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
- Like before, do we really need a struct here?
- Do we need PrefixSumMask to be a struct? (e.g. does it hold preprocessed data shared by all rows?)
Removed.
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 7 at r4 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
This struct isn't really the Mask I believe, since you are not gonna use it externally as a mask item. It's only here to evaluate the constraints. Whether this stays a struct or becomes a function, rename it to something that conveys this evaluates constraints.
Thanks
crates/prover/src/examples/xor/mle_eval_constraints.rs
line 9 at r4 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
Is this a coeff or a mask item? Maybe it's a column value? whatever you chose, make the name and documentation consistent.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r1, 3 of 3 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @andrewmilson)
fa8c562
to
614b466
Compare
441915c
to
4994125
Compare
This change is