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

Use logarithmic derivatives instead of exponentiation for range checks #581

Closed
Tracked by #551
ThomasPiellard opened this issue Mar 16, 2023 · 0 comments
Closed
Tracked by #551
Assignees

Comments

@ThomasPiellard
Copy link
Collaborator

ThomasPiellard commented Mar 16, 2023

Currently for verifying in circuit that (f_i)_i is a subset of a table (s_i)_i, we record the f_i, use a hint to compute the multiplicity e_i of the f_i and we check using a random challenge x that Pi_i (x-s_i)^e_i = Pi_i (x-f_i). The e_i are themselves internal variables and this computation leads to a lot of exponentiations.

We should use the logarithmic derivatives (taken from Caulk) to rather check that Sum_i e_i / (x-s_i) = Sum_i 1 / (x-f_i). Those are rational functions, but as long as x is not in the set of poles (that is it does not belong to {f_1, .., f_n} ) Schwartz Zippel lemma (univariate case) works exactly as for polynomials (in fact for polynomials we just avoid the set of poles which is the infinity when sampling a random challenge).

This would save all the exponentiations by the e_i.

Here is the ref for the logarithmic derivative

@gbotrel gbotrel added the zk-evm label Mar 16, 2023
ivokub added a commit that referenced this issue Mar 24, 2023
* feat: range checks using log derivative, fixes #581

* feat: compute constraints for log-deriv range check

* feat: use unchecked division

* chore: cleanup test

* feat: compress groth16 linear expression

* docs: refer to log-derivate idea paper

* fix: include exponents in commitment

* test: more cleanup

* fix: compute a bit more complex fake commit

* test: update circuit statistics

---------

Co-authored-by: Ivo Kubjas <ivo.kubjas@consensys.net>
@ivokub ivokub closed this as completed Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants