-
Notifications
You must be signed in to change notification settings - Fork 106
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
Arrabiata: prepare constraints for cross-terms computation #2702
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2702 +/- ##
=========================================
Coverage ? 72.10%
=========================================
Files ? 257
Lines ? 61154
Branches ? 0
=========================================
Hits ? 44094
Misses ? 17060
Partials ? 0 ☔ View full report in Codecov by Sentry. |
4f07a8a
to
f713363
Compare
a35fa79
to
0ef15d6
Compare
70addbd
to
0129e25
Compare
0129e25
to
32a4f93
Compare
32a4f93
to
97fbed5
Compare
97fbed5
to
9eff145
Compare
0b6dd27
to
594f689
Compare
6b94b8b
to
bb75668
Compare
mvpoly/src/lib.rs
Outdated
polys: Vec<T>, | ||
combiner1: F, | ||
combiner2: F, | ||
eval1: [F; N], | ||
eval2: [F; N], | ||
u1: F, | ||
u2: F, |
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.
I m not sure I understand what is computed here ?
the text mentioned combining the polys with one combiner, and we have two of them here.
I understand that the two combiners are the alpha from each instances we fold ?
But then I don't get the assymetrical role ?
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.
arrabiata/tests/constraints.rs
Outdated
|
||
// This test is mostly an example to show to compute the cross-terms when we do | ||
// have the expressions, and some evaluations. | ||
// It doesn't test anything in particular. It is mostly an "integration" test. |
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.
A way to make this test test thing would be to checked the cross term property
poly(a +r*b) = poly(a) + r^n poly(b) + \sum_i r^i cross_term_i(a,b)
Also a nit: I wouldn't call that an integration test
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.
"Also a nit: I wouldn't call that an integration test"
That's the reason "integration" is double quoted.
mvpoly/src/lib.rs
Outdated
// Computing α'^i * value, and adding it to the next power of r | ||
let alpha_i = combiner2.pow([i as u64]); | ||
// Handling 0^0 = 1 |
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.
isn't combiner a random term that cannot be zero ?
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.
Yes, but it was monstly for the tests (see test directory). I didn't handle it initially. Even if the case is negligible, I think it is ok to have it. Maybe we should fail instead?
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.
I'd ignore it to simplify the code, and remove the testing with zero, but do as you feel
mvpoly/src/utils.rs
Outdated
/// It is useful when the number of nested loop is large and the size of the | ||
/// loops is large as well. `filter_map` is used to avoid computing the indices | ||
/// that are not needed and avoid a `capacity_overflow` error. | ||
pub fn compute_indices_nested_loop_upper_bound( |
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.
I would not expose this function, keep this implementation, and expose compute_indices_nested_loop implemented with that implementation, while computing the upper bound on the fly with a max.
Then we have one function instead of two, which is the efficient variant, and only need one argument
I could not convinced my self of the correctness of the algorithm, and there is no test that reassure me. |
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.
I'd like a test on the defining property of cross terms to convince me of the correctness of the algorithm, which I wasn't able to check manually
mvpoly/src/lib.rs
Outdated
/// linearly combined using the power of a combiner, often called `α`. | ||
/// Powers of the combiner are considered as an additional variable of the | ||
/// multi-variate polynomials, therefore increasing the degree of the sum of all | ||
/// polynomials by one. In other words, if we combine (M + 1) polynomials |
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.
See the comment just above:
/// Powers of the combiner are considered as an additional variable of the
/// multi-variate polynomials, therefore increasing the degree of the sum of all
/// polynomials by one.
Instead of having a power, we do consider them as a different variable.
mvpoly/src/lib.rs
Outdated
/// cross-terms of the polynomial: | ||
/// | ||
/// ```text | ||
/// P(X_1, ..., X_N, α_1, ..., α_M) = P_1(X_1, ..., X_N) |
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.
See https://hackmd.io/@dannywillems/Syo5MBq90#Computation-of-cross-terms-for-shifted-polynomials. And we also discussed it in the past in person. Agreed to have more comments and more PBT. |
44f7e95
to
2f3661d
Compare
We do suppose evaluations of the public inputs will be given after the witness.
1d283cd
to
b6a4e54
Compare
b6a4e54
to
00a6119
Compare
impl From<Column> for usize { | ||
fn from(val: Column) -> usize { | ||
match val { | ||
Column::X(i) => i, | ||
_ => unimplemented!("Only the private inputs are supported for now"), | ||
Column::PublicInput(i) => NUMBER_OF_COLUMNS + i, |
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.
Doesn't having (at least) a full columns for PI can create issue on the perfs of the verifier.
More importantely, this translate in the folder verifier which will handle a big PI.
We can use the PLONK way to handle PI to avoid a PI being linear in the number of rows
Since this is not the topic of the PR, we can see that later
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.
Yes, I want to investigate other solutions to handle PI.
/// the polynomial `P`, i.e. `D`. | ||
/// | ||
/// The output is a map of `D` values that represents the cross-terms | ||
/// for each power of `r`. |
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.
I'd add in the description of the funciton something like the following to summarize
let res = compute_cross_terms_scaled(P,eval1,eval2,u1,u2,scalar1,scalar2)
let P'[X_1, ..., X_n,U,Alpha] be P homogenised by U and scaled by Alpha
Then for all r,
P'(eval_1,u1,scalar1) + r^{D+1} P'(eval_2,u2,scalar2) + \sum_{i=1}^{D} r^i res[i] =
P'(eval_1 +reval_2, u1 + ru_2,scalar1+r*scalar2)
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.
Sure, I'll do it in a follow-up.
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.
Updated in the HackMD.
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.
I did not check the maths but the test is convincing enough
This pull request prepares the constraints to compute the cross-terms after the different columns and arguments have been computed. Challenges must be treated as a variable, and will be in a future PR.
Previous attempt: #2695