我想消除表达式并使用z3将最终结果转换为cnf,但是,有一个错误说“(错误”策略失败:操作符不支持,在调用此策略之前应用简化器“)”有什么问题脚本?
(set-option :produce-models true)
(declare-var t Real)
(declare-var tc Real)
(declare-var t1 Real)
(declare-var t1c Real)
(assert
(and
(not (and (and (<= 0.0 t)(<= 0.0 t1))(= t1c 2.0)(= tc 1.0)))
(not (and (and (<= 0.0 t)(<= 0.0 t1))(< 2.0 t1c)(= tc 1.0)))
(not (and (and (and (<= 0.0 t)(<= 0.0 t1))(< 1.0 tc)) (= t1c 2.0)))
(not (and (and (and (<= 0.0 t)(<= 0.0 t1))(< 1.0 tc)) (< 2.0 t1c)))
(or (and (and (and (<= 0.0 t)(<= 0.0 t1))(<= 0.0 t1c))(<= 0.0 tc)(< tc 1.0))
(and (and (and (<= 0.0 t) (<= 0.0 t1))(<= 0.0 t1c))(< 1.0 tc)(< t1c 2.0))
(and (and (and (<= 0.0 t)(<= 0.0 t1))(< 1.0 tc)) (= t1c 2.0))
(and (and (and (<= 0.0 t) (<= 0.0 t1))(<= 0.0 t1c))
(= tc 1.0)
(or (and (and (and (<= 0.0 t) (<= 0.0 t1))(<= 0.0 t1c))
(< t1c 2.0)
(= tc 1.0)
)
(and (and (<= 0.0 t)(<= 0.0 t1))(= t1c 2.0)(= tc 1.0))
)
)
)
)
)
(apply (then ctx-solver-simplify propagate-values (par-then (repeat (or-else split-clause skip)) propagate-ineqs) tseitin-cnf))
答案 0 :(得分:2)
某些策略(例如tseitin-cnf
)假设已删除某些运算符(例如and
,distinct
,...)。在您的示例中,问题是嵌套在公式中的运算符and
的出现。您可以使用策略(! simplify :elim-and true)
消除它。
这是更新的脚本:
(apply (then (! simplify :elim-and true) ctx-solver-simplify propagate-values (par-then (repeat (or-else split-clause skip)) propagate-ineqs) tseitin-cnf))
话虽如此,在下一个版本中,我们将使tseitin-cnf
的策略更加“用户友好”。也就是说,它会在需要时自动应用所需的转换。