Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8995131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:34:43+00:00 2026-06-15T23:34:43+00:00

The following program generates a Z3 model that cannot be printed (that is, print

  • 0

The following program generates a Z3 model that cannot be printed (that is, print solver.model() throws an exception), using the latest version of Z3 from the master git branch (commit 89c1785b):

x = Int('x')
a = Array('a', IntSort(), BoolSort())
b = Array('b', IntSort(), BoolSort())
c = Array('c', BoolSort(), BoolSort())

e = ForAll(x, Or(Not(a[x]), c[b[x]]))
print e

solver = Solver()
solver.add(e)
c = solver.check()
print c
if c == sat:
    print solver.model()

produces:

ForAll(x, Or(Not(a[x]), c[b[x]]))
sat
Traceback (most recent call last):
  File "z3bug.py", line 16, in <module>
    print solver.model()
  File "src/api/python/z3.py", line 5177, in __repr__
  File "src/api/python/z3printer.py", line 939, in obj_to_string
  File "src/api/python/z3printer.py", line 841, in __call__
  File "src/api/python/z3printer.py", line 831, in main
  File "src/api/python/z3printer.py", line 760, in pp_model
  File "src/api/python/z3printer.py", line 794, in pp_func_interp
  File "src/api/python/z3.py", line 5088, in else_value
  File "src/api/python/z3.py", line 818, in _to_expr_ref
  File "src/api/python/z3core.py", line 2307, in Z3_get_ast_kind
z3types.Z3Exception: 'invalid argument'

I can also reproduce the same behavior in the online z3py interface, at http://rise4fun.com/Z3Py/lfQG. Slightly more debugging suggests that the model’s assignment for c is a z3.FuncInterp that throws an ‘invalid argument’ exception when you call else_value() on it.

Is this a bug in Z3, or are my expectations not quite right? My expectation was that it should always be possible to get the else_value() of a FuncInterp, since otherwise it’s not a complete function, but perhaps this is not always correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:34:44+00:00Added an answer on June 15, 2026 at 11:34 pm

    This is a bug in the Z3 Python printer. I fixed the bug, and the fix is already available at codeplex.

    http://z3.codeplex.com/SourceControl/changeset/f8014f54c18a

    To get the fix (now), we have to retrieve the “work-in-progress” (unstable) branch. The fix will be available in the master branch in the next official release. To retrieve the unstable branch, we should use:

    git clone https://git01.codeplex.com/z3 -b unstable
    

    Another option is to use print solver.model().sexpr(). It will use Z3 internal printer instead of the Python based one.

    Regarding else_value(), its value may not be specified by Z3. The meaning it: it is a “don’t care”. That is, any interpretation can be used to satisfy the formula.
    I also fixed the Z3 Python API to return None when the else_value is not specified.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following program that generates a multiplication table. A formatting problem arises
I am writing a program that generates random text based on the Markov model.
I have the following program flow: User fills in form My app generates a
Am using the following program for generate the Token,based on the time(current time).It was
I have a java program that generates an HTML file. The Java program takes
The following complies but at run time throws an exception. What I am trying
Using the Generator class from http://unpythonic.blogspot.com/2007/08/using-threads-in-pygtk.html , the following code makes my program fail:
I am trying to create program that will allow me to convert from Collada
I am generating WSDL/XSD for SOAP services from a UML model using IBM Rational
i need a quick hint regarding the following exercise question: Write a program that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.