kdrag.solvers.sympy
Functions
| 
 | Differentiate a z3 expression. | 
| 
 | |
| 
 | Expand a z3 expression. | 
| 
 | Factor a z3 expression. | 
| Create a fresh symbol for use in sympy expressions. | |
| 
 | |
| 
 | Integrate a z3 expression. | 
| 
 | Convert a sympy expression into a z3 expression. | 
| 
 | Compute the limit of a z3 expression. | 
| 
 | Compute the series expansion of a z3 expression. | 
| 
 | |
| 
 | Sympy simplification as an axiom schema. | 
| 
 | Simplify a z3 expression. | 
| 
 | |
| 
 | |
| 
 | Sum a z3 expression. | 
| 
 | Convert a z3 expression into a sympy expression. | 
| 
 | 
- kdrag.solvers.sympy.diff(e: ExprRef, *args)
- Differentiate a z3 expression. >>> x,y = smt.Reals(“x y”) >>> diff(x**2, x) 2*x >>> diff(x**2, x, x) 2 >>> diff(x*x, (x,2)) 2 >>> diff(x*y*x, x) 2*x*y - Parameters:
- e (ExprRef) 
 
- kdrag.solvers.sympy.diff_shim(e: KnuckleClosure) Basic
- Parameters:
- e (KnuckleClosure) 
- Return type:
- Basic 
 
- kdrag.solvers.sympy.expand(e: ExprRef) ExprRef
- Expand a z3 expression. >>> x = smt.Real(“x”) >>> expand((x + 1)**2) x**2 + 2*x + 1 - Parameters:
- e (ExprRef) 
- Return type:
- ExprRef 
 
- kdrag.solvers.sympy.factor(e: ExprRef) ExprRef
- Factor a z3 expression. >>> x = smt.Real(“x”) >>> factor(x**2 + 2*x + 1) (x + 1)**2 - Parameters:
- e (ExprRef) 
- Return type:
- ExprRef 
 
- kdrag.solvers.sympy.fresh_symbol() Symbol
- Create a fresh symbol for use in sympy expressions. >>> x = fresh_symbol() >>> y = fresh_symbol() >>> x != y True - Return type:
- Symbol 
 
- kdrag.solvers.sympy.integ_shim(e: KnuckleClosure, a, b) Basic
- Parameters:
- e (KnuckleClosure) 
- Return type:
- Basic 
 
- kdrag.solvers.sympy.integrate(e, *args)
- Integrate a z3 expression. >>> x = smt.Real(“x”) >>> integrate(x**2, x) x**3*1/3 
- kdrag.solvers.sympy.kdify(e: Basic, **kwargs) ExprRef
- Convert a sympy expression into a z3 expression. >>> x = smt.Real(“x”) >>> kdify(sympify(x + 1)) x + 1 >>> kdify(sympify(sin(x) + 1)) sin(x) + 1 >>> kdify(sympify(x + smt.RatVal(1,3))) x + 1/3 >>> kdify(sympify(x/3)) x*1/3 - Parameters:
- e (Basic) 
- Return type:
- ExprRef 
 
- kdrag.solvers.sympy.limit(e, x, x0)
- Compute the limit of a z3 expression. >>> x = smt.Real(“x”) >>> limit(1/x, x, sympy.oo) 0 >>> limit(1/x, x, 0) # TODO: What to do about this one? inf 
- kdrag.solvers.sympy.series(e, x=None, x0=0, n=6, dir='+')
- Compute the series expansion of a z3 expression. >>> x = smt.Real(“x”) >>> series(sin(x), x, n=2) x + Order(x**2) 
- kdrag.solvers.sympy.shim_ho(f)
- kdrag.solvers.sympy.simp(e: ExprRef) Proof
- Sympy simplification as an axiom schema. Sympy nor the translation to and from z3 are particularly sound. It is very useful though and better than nothing. Your mileage may vary - >>> x = smt.Real("x") >>> simp(sin(x)**2 + cos(x)**2) |= sin(x)**2 + cos(x)**2 == 1 - Parameters:
- e (ExprRef) 
- Return type:
 
- kdrag.solvers.sympy.simplify(e: ExprRef) ExprRef
- Simplify a z3 expression. >>> x = smt.Real(“x”) >>> simplify((x + 1)**2 - x**2) 2*x + 1 >>> simplify(sin(x)**2 + cos(x)**2) 1 - Parameters:
- e (ExprRef) 
- Return type:
- ExprRef 
 
- kdrag.solvers.sympy.solve(constrs: list[BoolRef], vs: list[ExprRef]) list[dict[ExprRef, ExprRef]]
- >>> x,y,z = smt.Reals("x y z") >>> solve([x + y == 1, x - z == 2], [x, y, z]) [{x: z + 2, y: -z - 1}] >>> solve([cos(x) == 3], [x]) # Note that does not return all possible solutions. [{x: 2*pi - acos(3)}, {x: acos(3)}] - Parameters:
- constrs (list[BoolRef]) 
- vs (list[ExprRef]) 
 
- Return type:
- list[dict[ExprRef, ExprRef]] 
 
- kdrag.solvers.sympy.sum_shim(e: KnuckleClosure, a, b) Basic
- Parameters:
- e (KnuckleClosure) 
- Return type:
- Basic 
 
- kdrag.solvers.sympy.summation(e, *args)
- Sum a z3 expression. >>> x,n = smt.Reals(“x n”) >>> summation(x**2, (x, 0, 10)) 385 >>> summation(x, (x, 0, n)) n**2*1/2 + n*1/2 
- kdrag.solvers.sympy.sympify(e: ExprRef, locals=None) Expr
- Convert a z3 expression into a sympy expression. >>> x = smt.Real(“x”) >>> sympify(x + 1) x + 1 >>> sympify(smt.RatVal(1,3)) Fraction(1, 3) >>> sympify(deriv(smt.Lambda([x], cos(sin(x)))))(sympy.abc.x) Derivative(cos(sin(x)), x) >>> sympify(integrate_(smt.Lambda([x], sin(x)), 0,x)) 1 - cos(x) >>> sympify(smt.Lambda([x], x + 1)) Lambda(X__…, X__… + 1) - Parameters:
- e (ExprRef) 
- Return type:
- Expr 
 
- kdrag.solvers.sympy.translate_tuple_args(args)