引理:forall x:R,x<>。 0 - > (x / x)= 1。
证明:
x = Real('x')
s = Solver()
s.add(Or(x >0, x < 0), Not(x/x ==1))
print s.check()
,输出为:
unsat
QED。
引理:forall x y:R,x&lt;&gt; 0,y&lt;&gt; 0 - &gt; (x / x + y / y)= 2。
证明:
x, y = Reals('x y')
s = Solver()
s.add(Or(x >0, x < 0), Or(y >0, y < 0), Not(x/x + y/y ==2))
print s.check()
,输出为:
unsat
QED。
引理:forall x y:R,x&lt;&gt; 0,y&lt;&gt; 0 - &gt; (x / x + x / y)=((x + y)/ y)。
证明:
x, y = Reals('x y')
s = Solver()
s.add(Or(x >0, x < 0), Or(y >0, y < 0), Not(x/x + x/y == (x+y)/y))
print s.check()
,输出为:
unsat
QED。
使用Coq + Maple
证明了这些引理http://coq.inria.fr/V8.2pl1/contribs/MapleMode.Examples.html
如果我的Z3Py证明是正确的,并且您知道更直接的表格来证明他们使用Z3Py,请告诉我。非常感谢。
答案 0 :(得分:3)
使用“prove”命令而不是求解器对象,有一种更紧凑的方式。 例如:
x, y = Reals('x y')
prove(Implies(And(Or(x >0, x < 0), Or(y >0, y < 0)), (x/x + x/y == (x+y)/y)))