【发布时间】:2012-03-12 10:14:59
【问题描述】:
假设使用几个内置和用户定义的 Z3 排序,例如Int,Bool,S1,S2,...,有没有办法编写一个通用的排序包装和展开函数,从排序 A 转换到排序 B 并返回?例如
(declare-const a S1)
(declare-const b S2)
(declare-const c Int)
(WRAP[S1] b) ; Expression is of sort S1
(WRAP[S1] c) ; Expression is of sort S1
(WRAP[Int] (WRAP[S1] c)) ; Expression is of sort Int
我目前手动覆盖每个案例,例如
(declare-fun $boolToInt (Bool) Int)
(declare-fun $intToBool (Int) Bool)
(assert (forall ((x Int))
(= x ($boolToInt($intToBool x)))))
(assert (forall ((x Bool))
(= x ($intToBool($boolToInt x)))))
这样的包装可以从一组给定的排序中自动创建,但我更喜欢可能的通用解决方案。
【问题讨论】:
标签: types wrapper z3 parametric-polymorphism