Z3 to show that if a^3=x*y*z then 3a <= x+y+z

我与影子孤独终老i 提交于 2019-12-10 19:19:10

问题


I'm a total newbie with Z3 (started today). So far liking it a lot. Great tool. Unfortunately the syntax confuses me a bit.

I want to prove that if:

a^3 = xyz = m ( with a, x, y, z, m (0..1) )

then:

3a <= (x+y+z)

I do so by trying to find a model satisfying that:

3a > (x+y+z)

Here is the Z3 code:

(declare-const a Real)
(declare-const x Real)
(declare-const y Real)
(declare-const z Real)
(declare-const m Real)

(assert (> a 0))
(assert (< a 1))
(assert (> x 0))
(assert (< x 1))
(assert (> y 0))
(assert (< y 1))
(assert (> z 0))
(assert (< z 1))
(assert (> m 0))
(assert (< m 1))

(assert (= (* (* a a) a) m))
(assert (= (* (* x y) z) m))
(assert (> (* 3.0 a) (+ (+ z y) x) ))
(check-sat)

The model is unsatisfied.

Have I successfully proved what I wanted? As I said, the syntax confuses me since I'm a total newbie.


回答1:


Your solution is correct.

Explanation: What you wrote is equivalent to:

0 < x < 1
0 < y < 1
0 < z < 1
0 < m < 1
a * a * a = m
x * y * z = m
3 * a > x + y + z

Z3 says this is unsatisfiable. Thus, if

a^3 = xyz = m ( with a, x, y, z, m (0..1) )

then it cannot be the case that:

3a > (x+y+z)

because, if this did occur, then the SMT problem you posed would be satisfiable, which would be a contradiction with the claim by Z3 that the SMT problem is unsatisfiable. If it cannot be the case that 3a > (x+y+z), then it must be the case that 3a <= (x+y+z), which is the statement you originally wanted to prove.




回答2:


I think that your solution is correct. Let me explain a bit about using Z3 to prove validity of a statement A. The key idea is that, in the classical logic, e.g., propositional logic and predicate logic:

  • A is Valid iff negation(A) is Unsatisfiable.

This is a pretty well-known result. You can find it in many textbooks and materials, for example, in page 4 of this slide. So, validity of P -> Q can be proved via checking for unsatisfiability of its negation: P /\ negation(Q).

In particular, for your example,

(a^3 = x*y*z = m) -> (3a <= x+y+z) is Valid,

iff

(a^3 = m) /\ (x*y*z = m) /\ (3a > x+y+z) is Unsatifiable.



来源:https://stackoverflow.com/questions/39039922/z3-to-show-that-if-a3-xyz-then-3a-xyz

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!