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

ModGadget: miss equal word constraint comparing to upstream #972

Open
DreamWuGit opened this issue Sep 21, 2023 · 0 comments
Open

ModGadget: miss equal word constraint comparing to upstream #972

DreamWuGit opened this issue Sep 21, 2023 · 0 comments

Comments

@DreamWuGit
Copy link
Member

DreamWuGit commented Sep 21, 2023

in the upstream's ModGadget, there is additional field eq: IsEqualWordGadget<F, Word32Cell<F>, Word32Cell<F>>, and relevant constraint in here, need to investigate if we need , seems corner case handling.

        let eq = IsEqualWordGadget::construct(cb, a, &a_or_zero);
        let lt = LtWordGadget::construct(cb, &r.to_word(), &n.to_word());
        // Constrain the aux variable a_or_zero to be =a or =0 if n==0:
        // (a == a_or_zero) ^ (n == 0 & a_or_zero == 0)
        cb.add_constraint(
            " (1 - (a == a_or_zero)) * ( 1 - (n == 0) * (a_or_zero == 0)",
            (1.expr() - eq.expr()) * (1.expr() - n_is_zero.expr() * a_or_is_zero.expr()),
        );
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

2 participants