[英]Z3 print evaluation result
In Z3, how can we write a program to get the result from evaluation?在Z3中,我们如何编写程序来获得评估结果? By default
model.eval(expression)
will return another expression of the evaluation result.默认情况下,
model.eval(expression)
将返回评估结果的另一个表达式。 How can I assign the result to a type-specific data?如何将结果分配给特定于类型的数据? Below is what I want to do in my program.
下面是我想在我的程序中做的事情。
int a = model.eval(x + 1) // compiler error
Sometimes models are not complete.有时模型并不完整。 For instance, when nothing depends on the value of
x
, then Z3 may not assign any value at all to it, ie, you're free to chose whatever value suits you.例如,当没有任何东西取决于
x
的值时,那么 Z3 可能根本不会为其分配任何值,即您可以自由选择适合您的任何值。 The eval
function has a second argument, which, when set to true
, will enable model completion, ie, eval
will substitute those don't-cares with some legal value (often 0). eval
函数有第二个参数,当设置为true
,将启用模型完成,即eval
将用一些合法值(通常为 0)替换那些无关紧要的值。
Z3-ints are actual integers, not C/C++-ints smaller than 2^32-1, so the conversion is not performed automatically. Z3-int 是实际整数,而不是小于 2^32-1 的 C/C++-int,因此不会自动执行转换。 If you know that in your application this will always be ok, and that
eval
will always return a numeral, then you can use Z3_get_numeral_int to perform that conversion.如果您知道在您的应用程序中这总是可以的,并且
eval
将始终返回一个数字,那么您可以使用Z3_get_numeral_int来执行该转换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.