问题
Some values of uninterpreted functions can be unconstrained during the search. For example, if in smt query only f(1)
is called, then f(2)
, f(3)
can be anything. Is there a way (some option may be) to know which values were not used during the solving and therefore can be anything?
回答1:
For quantifier free problems, you can achieve that by using the option :model-partial
to true
.
Here is an example (also available here):
(set-option :model-partial true)
(declare-fun f (Int) Int)
(assert (> (f 0) 0))
(assert (< (f 1) 0))
(check-sat)
(get-model)
In this example, we get the output:
sat
(model
(define-fun f ((x!1 Int)) Int
(ite (= x!1 0) 1
(ite (= x!1 1) (- 1)
#unspecified)))
)
BTW, in the next release (Z3 4.3.2), this option is renamed to :model.partial
. In the next release, the options are grouped in modules.
来源:https://stackoverflow.com/questions/15388999/can-z3-output-anything-for-unconstrained-values-of-uf