问题
Suppose I want to universally quantify x and y in the following formula:
f(x,y) <=> x=y
using Z3_mk_forall_const
. I will have to first construct the formula above, which requires constants x and y of type Z3_ast
. Using Z3_mk_const
to create x and y results in a global declaration. I would ideally like to avoid that. Is there an alternative?
回答1:
Yes there is an alternative; you can use Z3_mk_forall which uses de-Brujin variable indexes. Instead of constants, you can create indexed variables using Z3_mk_bound and then pass an array of their sorts (sorts) and names (decl_names) to mk_forall or mk_exists.
来源:https://stackoverflow.com/questions/22644077/how-to-declare-constants-to-use-as-bound-variables-in-z3-mk-forall-const