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

Cannot enable or use get-unsat-assumptions via Python Z3_eval_smtlib2_string #7445

Closed
jbosboom opened this issue Nov 7, 2024 · 0 comments
Closed

Comments

@jbosboom
Copy link

jbosboom commented Nov 7, 2024

Using z3 built from current master abd1674, following the instructions from the README to build and use the Python bindings in a virtualenv, I cannot enable or use get-unsat-assumptions via Z3_eval_smtlib2_string. From the transcript below you can see that:

  • (set-option :produce-unsat-assumptions true) fails saying it's too late to set it
  • the above error message is repeated for further commands on that context (minor bug, may be intended behavior?)
  • with a fresh context, z3 replies unsupported to (get-option :produce-unsat-assumptions) (minor bug)
  • actually trying to use get-unsat-assumptions fails with an error saying to set the option to true (expected given the default is false, but means being unable to set the option is a problem)

Is there another method to set the option to true on the context before sending strings? I can't set it with z3.set_param/set_option.

(venv) [jbosboom@promenade python]$ pwd
/home/jbosboom/github-repos/z3/build/python
(venv) [jbosboom@promenade python]$ python
Python 3.12.7 (main, Oct  1 2024, 11:15:50) [GCC 14.2.1 20240910] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import z3
>>> z3.get_version_string()
'4.13.4'
>>> ctx = z3.Context()
>>> z3.Z3_eval_smtlib2_string(ctx.ref(), '(set-option :produce-unsat-assumptions true)')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jbosboom/github-repos/z3/build/python/z3/z3core.py", line 3612, in Z3_eval_smtlib2_string
    _elems.Check(a0)
  File "/home/jbosboom/github-repos/z3/build/python/z3/z3core.py", line 1566, in Check
    raise self.Exception(self.get_error_message(ctx, err))
z3.z3types.Z3Exception: b'(error "line 1 column 40: error setting \':produce-unsat-assumptions\', option value cannot be modified after initialization")\n'
>>> z3.Z3_eval_smtlib2_string(ctx.ref(), '(get-option :produce-unsat-assumptions)')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jbosboom/github-repos/z3/build/python/z3/z3core.py", line 3612, in Z3_eval_smtlib2_string
    _elems.Check(a0)
  File "/home/jbosboom/github-repos/z3/build/python/z3/z3core.py", line 1566, in Check
    raise self.Exception(self.get_error_message(ctx, err))
z3.z3types.Z3Exception: b'(error "line 1 column 40: error setting \':produce-unsat-assumptions\', option value cannot be modified after initialization")\n'
>>> ctx = z3.Context()
>>> z3.Z3_eval_smtlib2_string(ctx.ref(), '(get-option :produce-unsat-assumptions)')
'unsupported\n; :produce-unsat-assumptions line: 1 position: 1\n'
>>> ctx = z3.Context()
>>> z3.Z3_eval_smtlib2_string(ctx.ref(), '(declare-const a Bool)(assert a)(check-sat-assuming ((not a)))')
'unsat\n'
>>> z3.Z3_eval_smtlib2_string(ctx.ref(), '(get-unsat-assumptions)')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jbosboom/github-repos/z3/build/python/z3/z3core.py", line 3612, in Z3_eval_smtlib2_string
    _elems.Check(a0)
  File "/home/jbosboom/github-repos/z3/build/python/z3/z3core.py", line 1566, in Check
    raise self.Exception(self.get_error_message(ctx, err))
z3.z3types.Z3Exception: b'(error "line 1 column 86: unsat assumptions construction is not enabled, use command (set-option :produce-unsat-assumptions true)")\n'
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

No branches or pull requests

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy