diff options
| author | Tim Blazytko <tim.blazytko@rub.de> | 2016-01-07 15:59:03 +0100 |
|---|---|---|
| committer | Tim Blazytko <tim.blazytko@rub.de> | 2016-01-07 15:59:03 +0100 |
| commit | 1bb7dab40c4f102e68e9ce1d9ed6d27a6a051064 (patch) | |
| tree | 502f6af3d3f88279973ba995838f6453fc764f7c | |
| parent | 9c449fc9d7333ee1ca005241fdc48d811d1f9132 (diff) | |
| download | miasm-1bb7dab40c4f102e68e9ce1d9ed6d27a6a051064.tar.gz miasm-1bb7dab40c4f102e68e9ce1d9ed6d27a6a051064.zip | |
smt2_translator: added smt2_assert and smt2_or to smt_helper. refactored other smt2_helpers to work with multiple arguments
Diffstat (limited to '')
| -rw-r--r-- | miasm2/expression/smt2_helper.py | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/miasm2/expression/smt2_helper.py b/miasm2/expression/smt2_helper.py index f7737116..53d323e8 100644 --- a/miasm2/expression/smt2_helper.py +++ b/miasm2/expression/smt2_helper.py @@ -23,11 +23,22 @@ def smt2_implies(a, b): return "(=> {} {})".format(a, b) -def smt2_and(a, b): +def smt2_and(*args): """ - Conjunction: a and b + Conjunction: a and b and c ... """ - return "(and {} {})".format(a, b) + # transform args into strings + args = [str(arg) for arg in args] + return "(and {})".format(' '.join(args)) + + +def smt2_or(*args): + """ + Disjunction: a or b or c ... + """ + # transform args into strings + args = [str(arg) for arg in args] + return "(or {})".format(' '.join(args)) def smt2_ite(cond, a, b): @@ -37,11 +48,20 @@ def smt2_ite(cond, a, b): return "(ite {} {} {})".format(cond, a, b) -def smt2_distinct(a, b): +def smt2_distinct(*args): + """ + Distinction: a != b != c != ... + """ + # transform args into strings + args = [str(arg) for arg in args] + return "(distinct {})".format(' '.join(args)) + + +def smt2_assert(expr): """ - Distinction: a != b + Assertion that @expr holds """ - return "(distinct {} {})".format(a, b) + return "(assert {})".format(expr) # definitions |