【问题标题】:Bug with check-sat when passed assumptions通过假设时检查坐的错误
【发布时间】:2012-12-17 20:38:20
【问题描述】:

我们今天遇到了这个看似严重的错误。

考虑this Z3 script。 (为完整起见,转载如下。)

公式不满足。我们首先用一个额外的假设检查公式,并按预期得到unsat。然而,当我们第二次检查它时,没有任何假设,Z3 现在报告sat。当我们要求一个模型时,我们得到一个明显错误的模型(本质上与(distinct 1 1) 相矛盾)。

如果我们用(push)(pop) 包围第一个(check-sat ...),则结果与预期一致。这表明当 check-sat 被传递额外的假设时,它会对上下文应用不合理的简化。

我们是否可能以不正确的方式使用check-sat

(set-option :produce-unsat-cores true)
(set-option :produce-models true)

(declare-const start25 Bool)
(declare-const bf07 Bool)
(declare-const bf19 Bool)
(declare-const lt06 Int)
(declare-const ef08 Int)
(declare-const ef110 Int)

(declare-fun whileM4 (Int) Int)

(assert start25)
(assert (=> start25 (distinct lt06 1)))
(assert (=> start25 (= lt06 (whileM4 0))))
(assert (=> (not bf07) (= ef08 0)))
(assert (=> bf07 (= ef08 (whileM4 (+ 0 1)))))
(assert (=> start25 (not (< (whileM4 0) 1))))
(assert (=> start25 (= (whileM4 0) ef08)))
(assert (=> start25 (and (=> bf07 (< 0 1)) (=> (< 0 1) bf07))))
(assert (=> (not bf19) (= ef110 (+ 0 1))))
(assert (=> bf19 (= ef110 (whileM4 (+ (+ 0 1) 1)))))
(assert (=> bf07 (not (< (whileM4 (+ 0 1)) 1))))
(assert (=> bf07 (= (whileM4 (+ 0 1)) ef110)))
(assert (=> bf07 (and (=> bf19 (< (+ 0 1) 1)) (=> (< (+ 0 1) 1) bf19))))

(push) ; comment out to produce bug
(check-sat (not bf19))
(pop)  ; comment out to produce bug

(check-sat)

【问题讨论】:

    标签: z3 smt


    【解决方案1】:

    感谢您报告错误。该错误影响所有 Z3

    http://z3.codeplex.com/SourceControl/changeset/8c211dd4fcd3

    为了获得工作中的分支,我们使用

    git clone https://git01.codeplex.com/z3 -b unstable
    

    使用“work-in-progress”分支可能不方便,因为您还会获得其他更新和修改。因此,另一种选择是手动将修复应用到您正在使用的版本。 请注意,修复是一个非常small modification

    【讨论】:

    • 你知道吗,4.3.1(和 git 上的 master)是我们尝试过的最新版本 :) 谢谢!
    • 我的意思是,我在你报告后修复了这个错误 :)
    • 我明白了 :) 顺便说一句,我们是否正确地观察到 push/pop 周围可以防止错误,还是巧合?
    • 是的,你是对的。推/弹出将防止错误。在 Z3 中,push 有两种:内部和用户/外部。我们不能在不一致的上下文中执行内部push,因为当我们执行(内部)pop 时,我们将丢失描述不一致的所有信息。对于用户/外部推送,Z3 将保留所有必要的信息。通过在check-sat 之前执行用户/外部push,您可以防止触发错误的场景。我在“发行说明”中描述了这个场景。
    • (...作为一名优秀的学者,我应该指出 Etienne Kneuss 是第一个注意到不一致结果的人。)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-15
    • 1970-01-01
    • 1970-01-01
    • 2014-11-20
    相关资源
    最近更新 更多