The semantics of get-assignment is not intuitive. It displays the value of named subformulas. From the SMT 2.0 reference (page 62):
get-assignment
is a light-weight and restricted version of get-value that asks for a truth assignment for a selected set of previously entered
formulas.(29) Similarly to several other commands already discussed
(e.g., get-proof), this command can be issued only if the
produce-assignments option, which is false by default, is set to true
(see Section 5.1.7 below). Solvers are not required to support this
option. Like get-value, it can be issued only following a check- sat
command that reports sat or, optionally, also one that reports
unknown, without intervening assertion-set commands. The command
returns a sequence of all pairs (f b) where b is either true or false
and f is the label of a (sub)term of the form (t named f) in the set
of all assertions, with t of sort Bool. Similarly to get-value, when
the response of the most recent check-sat command was sat, and only
then, the set of all assertions is guaranteed to have a model (in the
logic) that agrees with the returned truth assignment.
Here is the same example using two named subformulas (also available online here):
(set-option :produce-assignments true)
(set-logic QF_UF)
(declare-fun a () Bool)
(declare-fun b () Bool)
(assert (! (= (! a :named a_val) b ) :named eq_val))
(check-sat)
(get-assignment)
(set-option :produce-models true)into the preamble and placing(get-value (a b))after(check-sat)yields((a false)(b false)), so the assignment seems to be available (see rise4fun.com/Z3/zGH7). It looks as if(get-assignment)were not supported and as if using it didn't raise an error. - Malte Schwerhoff