当前位置: 首页>>代码示例>>Python>>正文


Python walkers.DagWalker类代码示例

本文整理汇总了Python中pysmt.walkers.DagWalker的典型用法代码示例。如果您正苦于以下问题:Python DagWalker类的具体用法?Python DagWalker怎么用?Python DagWalker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DagWalker类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, env=None, invalidate_memoization=None):
        DagWalker.__init__(self,
                           env=env,
                           invalidate_memoization=invalidate_memoization)
        self.mgr = self.env.formula_manager
        self.check_symbol = self.mgr.FreshSymbol(types.BOOL)

        # The walker returns a pair (L, m) where m is a
        # quantifier-free formula (the matrix) and L is a list of
        # pairs (Q, vars) where Q is either mgr.Exists or mgr.ForAll
        # and vars is a frozenset of variables.  The semantics is that
        # the input formula is equivalent to res computed as follows:
        # res = m
        # for Q, vars in L:
        #    res = Q(vars, res)
        self.set_function(self.walk_error, *op.ALL_TYPES)
        self.set_function(self.walk_quantifier, *op.QUANTIFIERS)
        self.set_function(self.walk_theory_op, *op.THEORY_OPERATORS)
        self.set_function(self.walk_constant, *op.CONSTANTS)
        self.set_function(self.walk_theory_relation, *op.RELATIONS)

        self.set_function(self.walk_symbol, op.SYMBOL)
        self.set_function(self.walk_function, op.FUNCTION)
        self.set_function(self.walk_ite, op.ITE)
        self.set_function(self.walk_conj_disj, op.AND, op.OR)
        self.set_function(self.walk_not, op.NOT)
        self.set_function(self.walk_iff, op.IFF)
        self.set_function(self.walk_implies, op.IMPLIES)
开发者ID:agriggio,项目名称:pysmt,代码行数:28,代码来源:rewritings.py

示例2: __init__

 def __init__(self, environment, btor):
     DagWalker.__init__(self, environment)
     self.mgr = environment.formula_manager
     self._get_type = environment.stc.get_type
     self._back_memoization = {}
     self._btor = btor
     self.declared_vars = {}
     self.function_declarations = {}
     return
开发者ID:sureshgl,项目名称:pysmt,代码行数:9,代码来源:btor.py

示例3: test_undefined_node

    def test_undefined_node(self):
        varA = Symbol("At", INT)

        dag_walker = DagWalker()
        with self.assertRaises(UnsupportedOperatorError):
            dag_walker.walk(varA)

        tree_walker = TreeWalker()
        with self.assertRaises(UnsupportedOperatorError):
            tree_walker.walk(varA)
开发者ID:bogiebro,项目名称:pysmt,代码行数:10,代码来源:test_walkers.py

示例4: __init__

    def __init__(self, environment):
        DagWalker.__init__(self, environment)
        self.backconversion = {}
        self.mgr = environment.formula_manager
        self._get_type = environment.stc.get_type

        # Maps a Symbol into the corresponding internal yices instance
        self.symbol_to_decl = {}
        # Maps an internal yices instance into the corresponding symbol
        self.decl_to_symbol = {}
开发者ID:sureshgl,项目名称:pysmt,代码行数:10,代码来源:yices.py

示例5: __init__

    def __init__(self, stream, template=".def_%d"):
        DagWalker.__init__(self, invalidate_memoization=True)
        self.stream = stream
        self.write = self.stream.write
        self.openings = 0
        self.name_seed = 0
        self.template = template
        self.names = None
        self.mgr = get_env().formula_manager

        self.set_function(partial(self._walk_nary, "and"), op.AND)
        self.set_function(partial(self._walk_nary, "or"), op.OR)
        self.set_function(partial(self._walk_nary, "not"), op.NOT)
        self.set_function(partial(self._walk_nary, "=>"), op.IMPLIES)
        self.set_function(partial(self._walk_nary, "="), op.IFF)
        self.set_function(partial(self._walk_nary, "+"), op.PLUS)
        self.set_function(partial(self._walk_nary, "-"), op.MINUS)
        self.set_function(partial(self._walk_nary, "*"), op.TIMES)
        self.set_function(partial(self._walk_nary, "pow"), op.POW)
        self.set_function(partial(self._walk_nary, "="), op.EQUALS)
        self.set_function(partial(self._walk_nary, "<="), op.LE)
        self.set_function(partial(self._walk_nary, "<"), op.LT)
        self.set_function(partial(self._walk_nary, "ite"), op.ITE)
        self.set_function(partial(self._walk_nary, "to_real"), op.TOREAL)
        self.set_function(partial(self._walk_nary, "/"), op.DIV)

        self.set_function(partial(self._walk_nary, "bvand"), op.BV_AND)
        self.set_function(partial(self._walk_nary, "bvor"), op.BV_OR)
        self.set_function(partial(self._walk_nary, "bvnot"), op.BV_NOT)
        self.set_function(partial(self._walk_nary, "bvxor"), op.BV_XOR)
        self.set_function(partial(self._walk_nary, "bvadd"), op.BV_ADD)
        self.set_function(partial(self._walk_nary, "bvsub"), op.BV_SUB)
        self.set_function(partial(self._walk_nary, "bvneg"), op.BV_NEG)
        self.set_function(partial(self._walk_nary, "bvmul"), op.BV_MUL)
        self.set_function(partial(self._walk_nary, "bvudiv"), op.BV_UDIV)
        self.set_function(partial(self._walk_nary, "bvurem"), op.BV_UREM)
        self.set_function(partial(self._walk_nary, "bvshl"), op.BV_LSHL)
        self.set_function(partial(self._walk_nary, "bvlshr"), op.BV_LSHR)
        self.set_function(partial(self._walk_nary, "bvult"), op.BV_ULT)
        self.set_function(partial(self._walk_nary, "bvule"), op.BV_ULE)
        self.set_function(partial(self._walk_nary, "bvslt"), op.BV_SLT)
        self.set_function(partial(self._walk_nary, "bvsle"), op.BV_SLE)
        self.set_function(partial(self._walk_nary, "concat"), op.BV_CONCAT)
        self.set_function(partial(self._walk_nary, "bvcomp"), op.BV_COMP)
        self.set_function(partial(self._walk_nary, "bvashr"), op.BV_ASHR)
        self.set_function(partial(self._walk_nary, "bvsdiv"), op.BV_SDIV)
        self.set_function(partial(self._walk_nary, "bvsrem"), op.BV_SREM)
        self.set_function(self.walk_bv_extract, op.BV_EXTRACT)
        self.set_function(self.walk_bv_rotate, op.BV_ROR)
        self.set_function(self.walk_bv_rotate, op.BV_ROL)
        self.set_function(self.walk_bv_extend, op.BV_SEXT)
        self.set_function(self.walk_bv_extend, op.BV_ZEXT)

        self.set_function(partial(self._walk_nary, "select"), op.ARRAY_SELECT)
        self.set_function(partial(self._walk_nary, "store"), op.ARRAY_STORE)
开发者ID:agriggio,项目名称:pysmt,代码行数:55,代码来源:printers.py

示例6: _push_with_children_to_stack

    def _push_with_children_to_stack(self, formula, **kwargs):
        """Add children to the stack."""

        # Deal with quantifiers
        if formula.is_quantifier():
            # 1. We invoke the relevant function (walk_exists or
            #    walk_forall) to print the formula
            fun = self.functions[formula.node_type()]
            res = fun(formula, args=None, **kwargs)

            # 2. We memoize the result
            key = self._get_key(formula, **kwargs)
            self.memoization[key] = res
        else:
            DagWalker._push_with_children_to_stack(self, formula, **kwargs)
开发者ID:agriggio,项目名称:pysmt,代码行数:15,代码来源:printers.py

示例7: __init__

    def __init__(self, environment, ddmanager):
        DagWalker.__init__(self)

        self.environment = environment
        self.fmgr = self.environment.formula_manager
        self.ddmanager = ddmanager
        # Note: Nodes in repycudd are not shared, but they overload all
        # methods to perform comparison. This means that for two
        # wrappers for the variable x, we have that id(x) != id(x1)
        # but x == x1.  Nevertheless, we need to store the ids, since
        # nodes can be moved during operations by the
        # ddManager. Therefore, when using nodes in a map, we should
        # use the ids.
        self.idx2var = {}
        self.var2node = {}
        self.back_memoization = {}
开发者ID:diasalvatore,项目名称:pysmt,代码行数:16,代码来源:bdd.py

示例8: __init__

    def __init__(self, environment, cvc4_exprMgr):
        DagWalker.__init__(self, environment)

        self.cvc4_exprMgr = cvc4_exprMgr
        self.mkExpr = cvc4_exprMgr.mkExpr
        self.mkConst = cvc4_exprMgr.mkConst
        self.mkVar = cvc4_exprMgr.mkVar
        self.realType = cvc4_exprMgr.realType()
        self.intType = cvc4_exprMgr.integerType()
        self.boolType = cvc4_exprMgr.booleanType()

        self.declared_vars = {}
        self.backconversion = {}
        self.mgr = environment.formula_manager
        self._get_type = environment.stc.get_type
        return
开发者ID:diasalvatore,项目名称:pysmt,代码行数:16,代码来源:cvc4.py

示例9: __init__

    def __init__(self, environment, msat_env):
        DagWalker.__init__(self, environment)

        self.msat_env = msat_env
        self.mgr = environment.formula_manager
        self._get_type = environment.stc.get_type

        # Maps a Symbol into the corresponding msat_decl instance in the msat_env
        self.symbol_to_decl = {}
        # Maps a msat_decl instance inside the msat_env into the corresponding
        # Symbol
        self.decl_to_symbol = {}

        self.boolType = mathsat.msat_get_bool_type(self.msat_env)
        self.realType = mathsat.msat_get_rational_type(self.msat_env)
        self.intType = mathsat.msat_get_integer_type(self.msat_env)

        self.back_memoization = {}
        return
开发者ID:bingcao,项目名称:pysmt,代码行数:19,代码来源:msat.py

示例10: __init__

    def __init__(self, environment=None):
        DagWalker.__init__(self, environment)

        self.mgr = self.env.formula_manager
        self._introduced_variables = {}
        self._cnf_pieces = {}
开发者ID:mpreiner,项目名称:pysmt,代码行数:6,代码来源:rewritings.py

示例11: __init__

    def __init__(self, environment, z3_ctx):
        DagWalker.__init__(self, environment)
        self.mgr = environment.formula_manager
        self._get_type = environment.stc.get_type
        self._back_memoization = {}
        self.ctx = z3_ctx

        # Back Conversion
        self._back_fun = {
            z3.Z3_OP_AND: lambda args, expr: self.mgr.And(args),
            z3.Z3_OP_OR: lambda args, expr: self.mgr.Or(args),
            z3.Z3_OP_MUL: lambda args, expr: self.mgr.Times(args),
            z3.Z3_OP_ADD: lambda args, expr: self.mgr.Plus(args),
            z3.Z3_OP_DIV: lambda args, expr: self.mgr.Div(args[0], args[1]),
            z3.Z3_OP_IFF: lambda args, expr: self.mgr.Iff(args[0], args[1]),
            z3.Z3_OP_XOR: lambda args, expr:  self.mgr.Xor(args[0], args[1]),
            z3.Z3_OP_FALSE: lambda args, expr: self.mgr.FALSE(),
            z3.Z3_OP_TRUE: lambda args, expr: self.mgr.TRUE(),
            z3.Z3_OP_GT: lambda args, expr: self.mgr.GT(args[0], args[1]),
            z3.Z3_OP_GE: lambda args, expr: self.mgr.GE(args[0], args[1]),
            z3.Z3_OP_LT: lambda args, expr: self.mgr.LT(args[0], args[1]),
            z3.Z3_OP_LE: lambda args, expr: self.mgr.LE(args[0], args[1]),
            z3.Z3_OP_SUB: lambda args, expr: self.mgr.Minus(args[0], args[1]),
            z3.Z3_OP_NOT: lambda args, expr: self.mgr.Not(args[0]),
            z3.Z3_OP_IMPLIES: lambda args, expr: self.mgr.Implies(args[0], args[1]),
            z3.Z3_OP_ITE: lambda args, expr: self.mgr.Ite(args[0], args[1], args[2]),
            z3.Z3_OP_TO_REAL: lambda args, expr: self.mgr.ToReal(args[0]),
            z3.Z3_OP_BAND : lambda args, expr: self.mgr.BVAnd(args[0], args[1]),
            z3.Z3_OP_BOR : lambda args, expr: self.mgr.BVOr(args[0], args[1]),
            z3.Z3_OP_BXOR : lambda args, expr: self.mgr.BVXor(args[0], args[1]),
            z3.Z3_OP_BNOT : lambda args, expr: self.mgr.BVNot(args[0]),
            z3.Z3_OP_BNEG : lambda args, expr: self.mgr.BVNeg(args[0]),
            z3.Z3_OP_CONCAT : lambda args, expr: self.mgr.BVConcat(args[0], args[1]),
            z3.Z3_OP_ULT : lambda args, expr: self.mgr.BVULT(args[0], args[1]),
            z3.Z3_OP_ULEQ : lambda args, expr: self.mgr.BVULE(args[0], args[1]),
            z3.Z3_OP_SLT : lambda args, expr: self.mgr.BVSLT(args[0], args[1]),
            z3.Z3_OP_SLEQ : lambda args, expr: self.mgr.BVSLE(args[0], args[1]),
            z3.Z3_OP_UGT : lambda args, expr: self.mgr.BVUGT(args[0], args[1]),
            z3.Z3_OP_UGEQ : lambda args, expr: self.mgr.BVUGE(args[0], args[1]),
            z3.Z3_OP_SGT : lambda args, expr: self.mgr.BVSGT(args[0], args[1]),
            z3.Z3_OP_SGEQ : lambda args, expr: self.mgr.BVSGE(args[0], args[1]),
            z3.Z3_OP_BADD : lambda args, expr: self.mgr.BVAdd(args[0], args[1]),
            z3.Z3_OP_BMUL : lambda args, expr: self.mgr.BVMul(args[0], args[1]),
            z3.Z3_OP_BUDIV : lambda args, expr: self.mgr.BVUDiv(args[0], args[1]),
            z3.Z3_OP_BSDIV : lambda args, expr: self.mgr.BVSDiv(args[0], args[1]),
            z3.Z3_OP_BUREM : lambda args, expr: self.mgr.BVURem(args[0], args[1]),
            z3.Z3_OP_BSREM : lambda args, expr: self.mgr.BVSRem(args[0], args[1]),
            z3.Z3_OP_BSHL : lambda args, expr: self.mgr.BVLShl(args[0], args[1]),
            z3.Z3_OP_BLSHR : lambda args, expr: self.mgr.BVLShr(args[0], args[1]),
            z3.Z3_OP_BASHR : lambda args, expr: self.mgr.BVAShr(args[0], args[1]),
            z3.Z3_OP_BSUB : lambda args, expr: self.mgr.BVSub(args[0], args[1]),
            z3.Z3_OP_EXT_ROTATE_LEFT : lambda args, expr: self.mgr.BVRol(args[0], args[1].bv_unsigned_value()),
            z3.Z3_OP_EXT_ROTATE_RIGHT: lambda args, expr: self.mgr.BVRor(args[0], args[1].bv_unsigned_value()),
            z3.Z3_OP_BV2INT: lambda args, expr: self.mgr.BVToNatural(args[0]),
            z3.Z3_OP_POWER : lambda args, expr: self.mgr.Pow(args[0], args[1]),
            z3.Z3_OP_SELECT : lambda args, expr: self.mgr.Select(args[0], args[1]),
            z3.Z3_OP_STORE : lambda args, expr: self.mgr.Store(args[0], args[1], args[2]),
            # Actually use both args, expr
            z3.Z3_OP_SIGN_EXT: lambda args, expr: self.mgr.BVSExt(args[0], z3.get_payload(expr, 0)),
            z3.Z3_OP_ZERO_EXT: lambda args, expr: self.mgr.BVZExt(args[0], z3.get_payload(expr, 0)),
            z3.Z3_OP_ROTATE_LEFT: lambda args, expr: self.mgr.BVRol(args[0], z3.get_payload(expr, 0)),
            z3.Z3_OP_ROTATE_RIGHT: lambda args, expr: self.mgr.BVRor(args[0], z3.get_payload(expr, 0)),
            z3.Z3_OP_EXTRACT: lambda args, expr: self.mgr.BVExtract(args[0],
                                                              z3.get_payload(expr, 1),
                                                              z3.get_payload(expr, 0)),
            # Complex Back Translation
            z3.Z3_OP_EQ : self._back_z3_eq,
            z3.Z3_OP_UMINUS : self._back_z3_uminus,
            z3.Z3_OP_CONST_ARRAY : self._back_z3_const_array,
        }
        # Unique reference to Sorts
        self.z3RealSort = z3.RealSort(self.ctx)
        self.z3BoolSort = z3.BoolSort(self.ctx)
        self.z3IntSort  = z3.IntSort(self.ctx)
        self._z3ArraySorts = {}
        self._z3BitVecSorts = {}
        self._z3Sorts = {}
        # Unique reference to Function Declaration
        self._z3_func_decl_cache = {}
        return
开发者ID:mpreiner,项目名称:pysmt,代码行数:80,代码来源:z3.py

示例12: __init__

    def __init__(self, environment, z3_ctx):
        DagWalker.__init__(self, environment)
        self.mgr = environment.formula_manager
        self._get_type = environment.stc.get_type
        self._back_memoization = {}
        self.ctx = z3_ctx
        # Forward conversion
        self.set_function(p_(self.walk_nary, z3.Z3_mk_and), op.AND)
        self.set_function(p_(self.walk_nary, z3.Z3_mk_or), op.OR)
        self.set_function(p_(self.walk_nary, z3.Z3_mk_add), op.PLUS)
        self.set_function(p_(self.walk_nary, z3.Z3_mk_mul), op.TIMES)
        self.set_function(p_(self.walk_nary, z3.Z3_mk_sub), op.MINUS)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_implies), op.IMPLIES)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_le), op.LE)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_lt), op.LT)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_eq), op.EQUALS, op.IFF)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_power), op.POW)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_div), op.DIV)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvult), op.BV_ULT)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvule), op.BV_ULE)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvslt), op.BV_SLT)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvsle), op.BV_SLE)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_concat), op.BV_CONCAT)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvor), op.BV_OR)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvand), op.BV_AND)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvxor), op.BV_XOR)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvadd), op.BV_ADD)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvsub), op.BV_SUB)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvmul), op.BV_MUL)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvudiv), op.BV_UDIV)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvurem), op.BV_UREM)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvshl), op.BV_LSHL)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvlshr), op.BV_LSHR)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvsdiv), op.BV_SDIV)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvsrem), op.BV_SREM)
        self.set_function(p_(self.walk_binary, z3.Z3_mk_bvashr), op.BV_ASHR)
        self.set_function(self.walk_quantifier, *op.QUANTIFIERS)

        # Back Conversion
        self._back_fun = {
            z3.Z3_OP_AND: lambda args, expr: self.mgr.And(args),
            z3.Z3_OP_OR: lambda args, expr: self.mgr.Or(args),
            z3.Z3_OP_MUL: lambda args, expr: self.mgr.Times(args),
            z3.Z3_OP_ADD: lambda args, expr: self.mgr.Plus(args),
            z3.Z3_OP_DIV: lambda args, expr: self.mgr.Div(args[0], args[1]),
            z3.Z3_OP_IFF: lambda args, expr: self.mgr.Iff(args[0], args[1]),
            z3.Z3_OP_XOR: lambda args, expr:  self.mgr.Xor(args[0], args[1]),
            z3.Z3_OP_FALSE: lambda args, expr: self.mgr.FALSE(),
            z3.Z3_OP_TRUE: lambda args, expr: self.mgr.TRUE(),
            z3.Z3_OP_GT: lambda args, expr: self.mgr.GT(args[0], args[1]),
            z3.Z3_OP_GE: lambda args, expr: self.mgr.GE(args[0], args[1]),
            z3.Z3_OP_LT: lambda args, expr: self.mgr.LT(args[0], args[1]),
            z3.Z3_OP_LE: lambda args, expr: self.mgr.LE(args[0], args[1]),
            z3.Z3_OP_SUB: lambda args, expr: self.mgr.Minus(args[0], args[1]),
            z3.Z3_OP_NOT: lambda args, expr: self.mgr.Not(args[0]),
            z3.Z3_OP_IMPLIES: lambda args, expr: self.mgr.Implies(args[0], args[1]),
            z3.Z3_OP_ITE: lambda args, expr: self.mgr.Ite(args[0], args[1], args[2]),
            z3.Z3_OP_TO_REAL: lambda args, expr: self.mgr.ToReal(args[0]),
            z3.Z3_OP_BAND : lambda args, expr: self.mgr.BVAnd(args[0], args[1]),
            z3.Z3_OP_BOR : lambda args, expr: self.mgr.BVOr(args[0], args[1]),
            z3.Z3_OP_BXOR : lambda args, expr: self.mgr.BVXor(args[0], args[1]),
            z3.Z3_OP_BNOT : lambda args, expr: self.mgr.BVNot(args[0]),
            z3.Z3_OP_BNEG : lambda args, expr: self.mgr.BVNeg(args[0]),
            z3.Z3_OP_CONCAT : lambda args, expr: self.mgr.BVConcat(args[0], args[1]),
            z3.Z3_OP_ULT : lambda args, expr: self.mgr.BVULT(args[0], args[1]),
            z3.Z3_OP_ULEQ : lambda args, expr: self.mgr.BVULE(args[0], args[1]),
            z3.Z3_OP_SLT : lambda args, expr: self.mgr.BVSLT(args[0], args[1]),
            z3.Z3_OP_SLEQ : lambda args, expr: self.mgr.BVSLE(args[0], args[1]),
            z3.Z3_OP_UGT : lambda args, expr: self.mgr.BVUGT(args[0], args[1]),
            z3.Z3_OP_UGEQ : lambda args, expr: self.mgr.BVUGE(args[0], args[1]),
            z3.Z3_OP_SGT : lambda args, expr: self.mgr.BVSGT(args[0], args[1]),
            z3.Z3_OP_SGEQ : lambda args, expr: self.mgr.BVSGE(args[0], args[1]),
            z3.Z3_OP_BADD : lambda args, expr: self.mgr.BVAdd(args[0], args[1]),
            z3.Z3_OP_BMUL : lambda args, expr: self.mgr.BVMul(args[0], args[1]),
            z3.Z3_OP_BUDIV : lambda args, expr: self.mgr.BVUDiv(args[0], args[1]),
            z3.Z3_OP_BSDIV : lambda args, expr: self.mgr.BVSDiv(args[0], args[1]),
            z3.Z3_OP_BUREM : lambda args, expr: self.mgr.BVURem(args[0], args[1]),
            z3.Z3_OP_BSREM : lambda args, expr: self.mgr.BVSRem(args[0], args[1]),
            z3.Z3_OP_BSHL : lambda args, expr: self.mgr.BVLShl(args[0], args[1]),
            z3.Z3_OP_BLSHR : lambda args, expr: self.mgr.BVLShr(args[0], args[1]),
            z3.Z3_OP_BASHR : lambda args, expr: self.mgr.BVAShr(args[0], args[1]),
            z3.Z3_OP_BSUB : lambda args, expr: self.mgr.BVSub(args[0], args[1]),
            z3.Z3_OP_EXT_ROTATE_LEFT : lambda args, expr: self.mgr.BVRol(args[0], args[1].bv_unsigned_value()),
            z3.Z3_OP_EXT_ROTATE_RIGHT: lambda args, expr: self.mgr.BVRor(args[0], args[1].bv_unsigned_value()),
            z3.Z3_OP_POWER : lambda args, expr: self.mgr.Pow(args[0], args[1]),
            z3.Z3_OP_SELECT : lambda args, expr: self.mgr.Select(args[0], args[1]),
            z3.Z3_OP_STORE : lambda args, expr: self.mgr.Store(args[0], args[1], args[2]),
            # Actually use both args, expr
            z3.Z3_OP_SIGN_EXT: lambda args, expr: self.mgr.BVSExt(args[0], z3.get_payload(expr, 0)),
            z3.Z3_OP_ZERO_EXT: lambda args, expr: self.mgr.BVZExt(args[0], z3.get_payload(expr, 0)),
            z3.Z3_OP_ROTATE_LEFT: lambda args, expr: self.mgr.BVRol(args[0], z3.get_payload(expr, 0)),
            z3.Z3_OP_ROTATE_RIGHT: lambda args, expr: self.mgr.BVRor(args[0], z3.get_payload(expr, 0)),
            z3.Z3_OP_EXTRACT: lambda args, expr: self.mgr.BVExtract(args[0],
                                                              z3.get_payload(expr, 1),
                                                              z3.get_payload(expr, 0)),
            # Complex Back Translation
            z3.Z3_OP_EQ : self._back_z3_eq,
            z3.Z3_OP_UMINUS : self._back_z3_uminus,
            z3.Z3_OP_CONST_ARRAY : self._back_z3_const_array,
        }
#.........这里部分代码省略.........
开发者ID:agriggio,项目名称:pysmt,代码行数:101,代码来源:z3.py

示例13: __init__

 def __init__(self, environment):
     DagWalker.__init__(self, environment)
     self.mgr = environment.formula_manager
     self._get_type = environment.stc.get_type
     self._back_memoization = {}
     return
开发者ID:bogiebro,项目名称:pysmt,代码行数:6,代码来源:z3.py


注:本文中的pysmt.walkers.DagWalker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。