将列表(在 Rise4Fun 上)上的包含操作公理化为
(declare-fun Seq.in ((List Int) Int) Bool)
(assert (forall ((e Int))
(not (Seq.in nil e))))
(assert (forall ((xs (List Int)) (e Int))
(iff
(not (= xs nil))
(=
(Seq.in xs e)
(or
(= e (head xs))
(Seq.in (tail xs) e))))))
使 Z3 4.0 能够反驳断言
(declare-const x Int)
(assert (Seq.in nil x))
(check-sat) ; UNSAT, as expected
在我眼里等价的公理化
(assert (forall ((xs (List Int)) (e Int))
(ite (= xs nil)
(= (Seq.in xs e) false)
(=
(Seq.in xs e)
(or
(= e (head xs))
(Seq.in (tail xs) e))))))
结果unknown
。
这可能是触发器的问题,还是 List 域特有的东西可以解释行为差异?