I try to write a custom print for a Z3_ast of Z3 in C, but I do not know how to manage the Z3_ast_kind of Z3_VAR_AST and Z3_FUNC_DECL_AST, I only know how to print the Z3_sort of Z3_VAR_AST (Z3_get_sort), about this variable value I have no ideas ???. And about the Z3_FUNC_DECL_AST, I couldn't find any accessors can get the function name, number of parameters and the parameters. Could you guys please help me? Cheers
相关问题
- How to compute with Quaternion numbers in Z3?
- Z3 real arithmetics and data types theories integr
- Timeout for Z3 Optimize
- Adjusting `simplify` tactic in Z3
- How to setup a Java development environment for Z3
相关文章
- retrieve the matched model in Z3py?
- Simplex in z3 via for-all
- How do I get Z3 to return minimal model?
- How to get z3 to return multiple unsat cores, mult
- ld linking error while compiling z3
- Horn clauses in Z3
- Getting a “good” unsat-core with z3 (logic QF_BV)
- how to get multiple solutions for z3 solver in smt
I suggest you take a look at the file 'python/z3printer.py' in the Z3 distribution. It defines a custom pretty printer in Python. The Z3 python API is just a layer on top of the C API. So, it should be straightforward to convert this printer in C.
Regarding
Z3_VAR_AST
, the functionunsigned Z3_API Z3_get_index_value(__in Z3_context c, __in Z3_ast a);
returns the de-Brujin index for the variable. The meaning of the index is explained here: http://en.wikipedia.org/wiki/De_Bruijn_index The variable names are stored in the quantifier AST. Note that, the names are irrelevant for Z3. They are stored just to make the output nice. The code in
z3printer.py
will keeps a stack with the variable names.Regarding
Z3_FUNC_DECL_AST
, it is easier to handle thanZ3_VAR_AST
. ASTs of this kind are actuallyZ3_func_decl
. Then the following APIs can be used to extract the information you want:Again, the file
z3printer.py
uses all these functions.