如何在 Z3_mk_forall_const 中声明常量以用作绑定变量? [英] How to declare constants to use as bound variables in Z3_mk_forall_const?
问题描述
假设我想在以下公式中对 x 和 y 进行普遍量化:
Suppose I want to universally quantify x and y in the following formula:
f(x,y) <=> x=y
使用 Z3_mk_forall_const
.我必须首先构造上面的公式,它需要 Z3_ast
类型的常量 x 和 y.使用 Z3_mk_const
创建 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?
推荐答案
是的,有一个替代方案;您可以使用 Z3_mk_forall 使用 de-Bruijn 变量索引.您可以使用以下方法创建索引变量,而不是常量Z3_mk_bound 然后传递一组它们的排序 (sorts) 和名称 (decl_names) 到 mk_forall 或 mk_exists.
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.
这篇关于如何在 Z3_mk_forall_const 中声明常量以用作绑定变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!