privacy-scaling-explorations / zkevm-circuits

https://privacy-scaling-explorations.github.io/zkevm-circuits/
Other
821 stars 841 forks source link

is_zero can be implemented without witnessing the inverse #1799

Closed themighty1 closed 3 months ago

themighty1 commented 3 months ago

Describe the feature you would like

The current is_zero gadget witnesses an inverse https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/main/gadgets/src/is_zero.rs

however, it is possible to constrain a value to be zero without witnessing the inverse but using just this expression: [(b * b + b) + (b * b - b)]

That expression evaluates to zero only when b == 0

Additional context

No response

themighty1 commented 3 months ago

sry, i misunderstood the purpose of is_zero