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

cs.IsZero is not efficient #132

Closed
gbotrel opened this issue Sep 3, 2021 · 0 comments
Closed

cs.IsZero is not efficient #132

gbotrel opened this issue Sep 3, 2021 · 0 comments
Assignees
Milestone

Comments

@gbotrel
Copy link
Collaborator

gbotrel commented Sep 3, 2021

cs.IsZero(a) returns 1 if a == 0 and 0 otherwise.

Replace current circuit code by these 3 constraints (instead of binary decomposition):

m * (1 - m) = 0       // constrain m to be 0 or 1
m * a = 0                // constrain m to be 0 if a != 0
_ = inverse(m + a) // constrain m to be 1 if a == 0

m is computed by the solver such that m = 1 - a^(modulus - 1)

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

1 participant