-
Notifications
You must be signed in to change notification settings - Fork 21
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
kclause_to_dimacs.py does not create a correct CNF #226
Comments
another small issue: right now,
besides this fix, i suggest to pin the z3 version in setup.py with |
Thank you @ekuiter ! Will make the fixes this week. |
Hi @ekuiter I'm having issues with using the simplier in 4.12.1. I still apparently get this
This is the updated script so far:
|
AFAICT, it should work. i can't execute your code (pickle.load fails with
maybe you can send me your kclause input file? i am working on an older kmax version (pinned to c6e83a0), so maybe my kclause files are not up to date. |
Here's the kclause file I'm using: kclause.txt. I think Necip switched to using a binary pickled format at some point (though I called it .txt since github restricts by extension). |
|
Good call. Try this: kclause.zip |
I still can't get it to work, not sure what is going on: |
Hi @ekuiter, apologies for the confusion. I have not yet merged the proposed fix. I've updated your Dockerfile to checkout the branch with your suggested fixes: docker-test-branch.zip. See if you get past the encoding issue now. Instead it should show the 'operator not supported' error:
|
I have looked at your file and can reproduce the issue. But I am still not able to find the problem. When I remove constraints from the file, at some point it works. But I've tried now for 2 hours to find the problematic constraint and still couldn't find it (bisection does not work, removing constraints randomly kind of works, but not always... maybe the error is non-deterministic). I'll see if I find another way. Regarding klocalizer: solver.dimacs() has the same problem. The only way to reliably convert a formula into CNF is with the Tactic/Then API, which only exists for the goal class. |
I tried another approach and now have a minimum failing example, although it still has over 2000 constraints: docker-test-branch.zip I exported it into SMTLib and removed all non-boolean variability: min-bool.smt.txt This is either a bug in Z3 or I am using the API wrong. I'll contact the Z3 developers. |
Until we have a better solution, my workaround is to use z3 4.11.2, where the above works fine. |
Understood. Thanks @ekuiter ! |
Hi Paul,
working on my ASE paper from last year, I kind of found (but forgot to look into and report) the following problem in
scripts/kclause_to_dimacs.py
. Now, for a new project, I stumbled across it again, so here's a proper report. :)The file uses the following code to transform its SMT input into CNF/DIMACS:
But the tseitin-cnf tactic in the variable
t
is never used, so thesolver.dimacs()
is just called as-is.As I just reported over at Z3Prover/z3#6577, this kind of usage is actually not allowed in Z3. Yes, it will return a DIMACS file, but this file is generally neither equisatisfiable nor model-count-preserving to the original formula (and Z3 fails to report this correctly). For a possible fix, see the linked issue (tseitin-cnf must be called explicitly, Z3 does not implement a non-Tseitin CNF conversion, apart from setting a higher distributivity_blowup).
All users of this file are affected, in the best case it's only me, as I understand that you only work with the internal SMT representation. Also, it does not affect my ASE paper, as I wrote my own scripts for that. But future users could run into this problem (I only ran into this again because I tried to run #SAT on large feature models and got suspicious results).
Best, Elias
The text was updated successfully, but these errors were encountered: