如何在Z3中以SMTLIB格式表示集合成员身份?

如何在Z3中以SMTLIB格式表示集合成员身份?,z3,smt,cvc4,Z3,Smt,Cvc4,我尝试使用SMTLIB格式来表示Z3中的集合成员身份: (declare-const a (Set Int)) ;; the next two lines parse correctly in CVC4, but not Z3: (assert (= a (as emptyset (Set Int)))) (assert (member 12 a)) ;; these work in both solvers (assert (= a (union a a))) (assert (subse

我尝试使用SMTLIB格式来表示Z3中的集合成员身份:

(declare-const a (Set Int))

;; the next two lines parse correctly in CVC4, but not Z3:
(assert (= a (as emptyset (Set Int))))
(assert (member 12 a))

;; these work in both solvers
(assert (= a (union a a)))
(assert (subset a a))
(assert (= a (intersection a a)))
(check-sat)
函数
emptyset
member
似乎按照CVC4中的预期进行解析,但不是在Z3中


通过检查API(例如,这里:),Z3在编程上确实支持空集和成员身份,但是如何用SMTLIB语法表达这些呢?

Z3和CVC4对集合使用稍微不同的符号确实令人恼火。在z3中,集合本质上是一个具有布尔范围的数组。基于此类推,您的程序编码为:

(declare-const a (Set Int))

(assert (= a ((as const (Set Int)) false)))
(assert (select a 12))

(assert (= a (union a a)))
(assert (subset a a))
(assert (= a (intersection a a)))
(check-sat)
z3接受原样并生成
unsat
。但是你会发现CVC4现在不喜欢这个节目

如果SMTLib运动将集合理论标准化,那将是一件好事,而且确实有这样一个建议(),但我认为它还没有被解决者采纳,也没有得到SMTLib委员会的批准