Skip to content

fix: constraint explosion with logical connectives #834

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

Open
DavePearce opened this issue Apr 22, 2025 · 3 comments
Open

fix: constraint explosion with logical connectives #834

DavePearce opened this issue Apr 22, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@DavePearce
Copy link
Collaborator

DavePearce commented Apr 22, 2025

For reasons which aren't completely clear to me, the following does not compile in any useful timeframe:

(defcolumns (X :i16) (Y :i16) (Z :i16))

(defun (bigun)
    (∨
     (∧ (== X 0) (== Y 1))
     (∧ (== X 1) (== Y 2))
     (∧ (== X 2) (== Y 3))
     (∧ (== X 3) (== Y 4))))

(defconstraint c1 ()
  (if (bigun)
      (== Z 0)))

Of course, we understand there is a potential explosion in the size of generated constraints. But, this seems a little out of whack!

@DavePearce DavePearce added the bug Something isn't working label Apr 22, 2025
@DavePearce
Copy link
Collaborator Author

DavePearce commented Apr 22, 2025

Note also that the above can be implemented fairly efficiently like so:

(defconstraint c2a ()
  (if (== X 0)
     (if (== Y 1)
         (== Z 0)))

(defconstraint c2b ()
   (if (== X 1)
     (if (== Y 2)
         (== Z 0)))

(defconstraint c2c ()
   (if (== X 2)
     (if (== Y 3)
         (== Z 0)))

(defconstraint c2d ()
   (if (== X 3)
     (if (== Y 4)
         (== Z 0)))

@DavePearce
Copy link
Collaborator Author

One aspect to consider here is that it is probably not simplifying obvious cases away. For example (x==0) || (x!=0) or (x==0) && (x==1)

@DavePearce
Copy link
Collaborator Author

DavePearce commented Apr 23, 2025

It is definitely not simplifying cases like this: X!=0 || X!=1 ==> 0.

Overall, when spurious cases are removed, we have a similar number of remaining constraints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant