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

feat: optimise normalisation over binary values #600

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

DavePearce
Copy link
Collaborator

For a normalisation (~ X) arises for a binary column X (or expression resulting in a binary value) then, in fact, no normalisation is actually required. Instead, we can just return X since it is already normalised. This is a useful optimisation since it will save an inverse column, along with two constraints.

For a normalisation `(~ X)` arises for a binary column `X` (or
expression resulting in a binary value) then, in fact, no normalisation
is actually required.  Instead, we can just return `X` since it is
already normalised.  This is a useful optimisation since it will save an
inverse column, along with two constraints.
@DavePearce DavePearce linked an issue Jan 24, 2025 that may be closed by this pull request
Test_Type_05 was broken because it had a binary BIT with value 2 in its
accepts data.
@DavePearce DavePearce merged commit ea36be0 into main Jan 24, 2025
3 checks passed
@DavePearce DavePearce deleted the 381-optimising-zero-checks branch January 24, 2025 03:58
@OlivierBBB
Copy link

OlivierBBB commented Jan 24, 2025

I believe this feature was already in rust-corset, right ? Just for completeness there is an associated optimization for if ... then ... else ... constraints, when the condition is binary. I did notice a while back that we were producing a lot of inverses that didn't need to exist.

@DavePearce
Copy link
Collaborator Author

DavePearce commented Jan 24, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimising Zero Checks
2 participants