Z3 这个表达真的不正确吗?

Z3 这个表达真的不正确吗?,z3,Z3,我在调试我的代码,然后我遇到z3说这个表达式是unsat (and (not (>= s 13)) (>= s 0) (>= 13 s) (>= pc0_thread1 0) (>= pc1_thread1 0) (>= pc2_thread1 0) (>= pc3_thread1 0) (>= pc4_thread1 0) (>= pc0_main 0)

我在调试我的代码,然后我遇到z3说这个表达式是unsat

(and (not (>= s 13))
     (>= s 0)
     (>= 13 s)
     (>= pc0_thread1 0)
     (>= pc1_thread1 0)
     (>= pc2_thread1 0)
     (>= pc3_thread1 0)
     (>= pc4_thread1 0)
     (>= pc0_main 0)
     (>= pc0_thread2 0)
     (>= pc1_thread2 0)
     (= 1 pc0_main))
我很惊讶,尝试使用unsat_core函数,但它返回一个空数组。 我遗漏了什么吗?

我正在获得“sat”

(检查sat)

在线运行此示例

我正在获取“sat”

(检查sat)


在线运行此示例

就像Juan一样,我得到了SAT,但我尝试了整数:

(declare-const s Int)
(declare-const pc0_thread1 Int)
(declare-const pc1_thread1 Int)
(declare-const pc2_thread1 Int)
(declare-const pc3_thread1 Int)
(declare-const pc4_thread1 Int)
(declare-const pc0_main Int)
(declare-const pc0_thread2 Int)
(declare-const pc1_thread2 Int)

(assert (and (not (>= s 13))
  (>= s 0)
  (>= 13 s)
  (>= pc0_thread1 0)
  (>= pc1_thread1 0)
  (>= pc2_thread1 0)
  (>= pc3_thread1 0)
  (>= pc4_thread1 0)
  (>= pc0_main 0)
  (>= pc0_thread2 0)
  (>= pc1_thread2 0)
  (= 1 pc0_main))
)

(check-sat)

Zeinab:我猜你使用的不是SMT2前端,而是API。你能给我们提供更多关于这个表达式的信息吗?例如,我们最近收到了一份关于ctx solver simplify策略产生错误结果的错误报告(请参阅),但我必须确切地知道您的目标是什么以及您正在应用的策略。

像Juan一样,我得到了SAT,但我尝试了整数:

(declare-const s Int)
(declare-const pc0_thread1 Int)
(declare-const pc1_thread1 Int)
(declare-const pc2_thread1 Int)
(declare-const pc3_thread1 Int)
(declare-const pc4_thread1 Int)
(declare-const pc0_main Int)
(declare-const pc0_thread2 Int)
(declare-const pc1_thread2 Int)

(assert (and (not (>= s 13))
  (>= s 0)
  (>= 13 s)
  (>= pc0_thread1 0)
  (>= pc1_thread1 0)
  (>= pc2_thread1 0)
  (>= pc3_thread1 0)
  (>= pc4_thread1 0)
  (>= pc0_main 0)
  (>= pc0_thread2 0)
  (>= pc1_thread2 0)
  (= 1 pc0_main))
)

(check-sat)

Zeinab:我猜你使用的不是SMT2前端,而是API。你能给我们提供更多关于这个表达式的信息吗?例如,我们最近收到一份关于ctx solver simplify策略产生错误结果的错误报告(请参阅),但我必须确切地知道您的目标是什么以及您正在应用的策略。

我的错误是我在循环中使用“解算器”,但我没有每次都重置,因此,它拥有来自先前循环迭代的信息,因此产生了错误的结果。 在打印solver.assertions()之后,我知道发生了什么


谢谢大家。

我的错误是我在循环中使用了“解算器”,但我没有每次都重置,因此它包含了以前循环迭代的信息,从而产生了错误的结果。 在打印solver.assertions()之后,我知道发生了什么

谢谢大家