Z3

from z3 import *

#定义类型
x = Int('x')
y = Int('y')
z = Int('z')
n = x+y>=3
bit = BitVec('a',32)
#创建求解器 s = Solver() #添加约束条件 s.add(y==2*x-7) s.add(5*x+3*y+2*z==3) s.add(3*x+z==7) print s.check() #检测条件是否OK print s.model() #列出求解结果 sat #列出求解满足条件值 #公式化简 print simplify(x < y + x + 2) print simplify(And(x + 1 >= 3, x**2 + x**2 + y**2 + 2 >= 5)) #遍历表达式 print "num args: ", n.num_args() print "children: ", n.children() print "1st child:", n.arg(0) print "2nd child:", n.arg(1) print "operator: ", n.decl() print "op name: ", n.decl().name()

 https://arabelatso.github.io/2018/06/14/Z3%20API%20in%20Python/

你可能感兴趣的:(Z3)