带量词公式中连词消除的Z3策略
是否有一种Z3策略可以将目标(例如,一个带有量词和未解释函数的断言)重写为一组无连接的公式?例如,以下公式:带量词公式中连词消除的Z3策略,z3,Z3,是否有一种Z3策略可以将目标(例如,一个带有量词和未解释函数的断言)重写为一组无连接的公式?例如,以下公式: (declare-fun P (Int) Bool) (declare-fun Q (Int Int) Bool) (declare-fun R (Int Int) Bool) (assert (forall ((x Int)) (! (or (P x) (forall ((x Int) (y Int)) (! (and (Q x
(declare-fun P (Int) Bool)
(declare-fun Q (Int Int) Bool)
(declare-fun R (Int Int) Bool)
(assert (forall ((x Int)) (!
(or
(P x)
(forall ((x Int) (y Int)) (!
(and
(Q x y)
(R x y))
:pattern ((Q x y)) )) )
:pattern ((P x)))))
应该改写为
(declare-fun P (Int) Bool)
(declare-fun Q (Int Int) Bool)
(declare-fun R (Int Int) Bool)
(assert (forall ((x Int)) (!
(or
(P x)
(forall ((x Int) (y Int)) (!
(Q x y)
:pattern ((Q x y)))))
:pattern ((P x)))))
(assert (forall ((x Int)) (!
(or
(P x)
(forall ((x Int) (y Int)) (!
(R x y)
:pattern ((Q x y)))))
:pattern ((P x)))))
您可以通过
(帮助战术)
获得战术列表。搜索“连接词”会产生一些点击,包括使用选项elim_和的策略simplify
,这会从示例中删除所有连接词
重写量词是另一回事。我尝试了一些听起来可能有关联的策略,但没有一个有任何有用的效果
; (help-tactic)
(declare-fun P (Int) Bool)
(declare-fun Q (Int Int) Bool)
(declare-fun R (Int Int) Bool)
(assert (forall ((x Int)) (!
(or
(P x)
(forall ((x Int) (y Int)) (!
(and
(Q x y)
(R x y))
:pattern ((Q x y)) )) )
:pattern ((P x)))))
; (apply (try-for qe-light 5000)) ; no effect
; (apply (try-for qe_rec 5000)) ; appears to fail
; (apply (try-for qe2 5000)) ; appears to fail
(apply
(then
distribute-forall ; no effect
(using-params simplify :elim_and true)
))
;;; RESULT:
; (forall ((x Int))
; (! (let ((a!1 (forall ((x!1 Int) (y Int))
; (! (not (or (not (Q x!1 y)) (not (R x!1 y))))
; :pattern ((Q x!1 y))))))
; (or (P x) a!1))
; :pattern ((P x))))
谢谢你的提示!我也尝试了一些策略和选项,但到目前为止,我无法让Z3拆分这个量词。