Z3 API: Is inspection of AST possible

蓝咒 提交于 2019-12-11 11:14:46

问题


There is no direct way in Z3 to traverse an already existing Z3_ast for an expression, that much seems clear to me from the API. Is there however an indirect way how to, e.g., split a conjunction, substitute a term for a term in a Z3_ast obtained for example by Z3_parse_smtlib2_string or as an interpolant obtained with Z3_get_interpolant (these are output from Z3, so it makes sense to be able to examine them).


回答1:


Traversal is possible, in the C API the functions for that are Z3_get_app_num_args and Z3_get_app_arg. However, this works only if the AST is a function application (an app, cast via Z3_to_app if necessary), other AST types may not have arguments to traverse (e.g., vars and numerals, see Z3_ast_kind).



来源:https://stackoverflow.com/questions/32475007/z3-api-is-inspection-of-ast-possible

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