Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

ModGadget: miss equal word constraint comparing to upstream #972

@DreamWuGit

Description

@DreamWuGit

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()),
        );

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions