在线使用Z3 SMT 2.0的一些有效性证明

时间:2013-05-04 14:38:58

标签: z3

引理:forall x:R,x<>。 0 - > (x / x)= 1。

证明:

(declare-const x Real)
(push)
(assert (or (> x 0) (< x 0)))
(assert (not (= (/ x x) 1)))
(check-sat)

,输出为:

unsat

QED。

引理:forall x y:R,x&lt;&gt; 0,y&lt;&gt; 0 - &gt; (x / x + y / y)= 2。

证明:

(declare-const x Real)
(declare-const y Real)
(push)
(assert (or (> x 0) (< x 0)))
(assert (or (> y 0) (< y 0)))
(assert (not (= (+ (/ x x) (/ y y)) 2)))
(check-sat)

,输出为:

unsat

QED。

引理:forall x y:R,x&lt;&gt; 0,y&lt;&gt; 0 - &gt; (x / x + x / y)=((x + y)/ y)。

证明:

(declare-const x Real)
(declare-const y Real)
(push)
(assert (or (> x 0) (< x 0)))
(assert (or (> y 0) (< y 0)))
(assert (not (= (+ (/ x x) (/ x y)) (/ (+ x y) y))))
(check-sat)

,输出为:

unsat

QED。

使用Coq + Maple

证明了这些引理

http://coq.inria.fr/V8.2pl1/contribs/MapleMode.Examples.html

并在

在线使用Z3Py

Some proofs of validity using Z3Py online and a strategy proposed by Nikolaj Bjorner

如果我使用Z3 SMT 2.0的样张是正确的,并且您知道使用Z3 SMT 2.0更直接的形式来证明它们,请告诉我。非常感谢。

1 个答案:

答案 0 :(得分:2)

你的编码没有错。您还可以考虑以下编码,这些编码更接近您要证明的引理(也可在线获取here):

(assert (not (forall ((x Real)) (=> (not (= x 0)) (= (/ x x) 1)))))
(check-sat)

(reset)
(assert (not (forall ((x Real) (y Real)) (=> (and (not (= x 0))
                                                  (not (= y 0)))
                                             (= (+ (/ x x) (/ y y)) 2)))))
(check-sat)

(reset)
(assert (not (forall ((x Real) (y Real)) (=> (and (not (= x 0))
                                                  (not (= y 0)))
                                             (= (+ (/ x x) (/ x y)) (/ (+ x y) y))))))
(check-sat)
相关问题