Display declarations parsed from an SMT-LIB2 file

一曲冷凌霜 提交于 2019-12-07 22:58:31

问题


I'm using Z3 with Java API. In my SMT-LIB2 file, there are several variables:

(declare-fun x0 () Int)
(declare-fun x1 () Bool)
; alot more  

I want to get all these variables, and store them in an array of Expr. From the example distributed with z3, I find the API SMTLIBDecls that get declarations parsed from an SMT-LIB1 file, but there is no similar API for SMT-LIB2. How can I get the declarations?

Thanks.


回答1:


There is currently no function for this purpose, but it is easy to get the declarations by traversing the expressions. This has previously been asked for C/C++, but the answer applies to Java as well: Z3 4.3.1 C-API parse_smtlib2_string: Where to get declarations from?

Additionally, these posts may be of interest as well: Traversing Z3_ast tree in C/C++, How to find out if a z3_ast corresponds to a clause?



来源:https://stackoverflow.com/questions/23620627/display-declarations-parsed-from-an-smt-lib2-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!