コード例 #1
0
 def __init__(self):
     # For conditions subject to equality isomorphism, this maps
     # from realms (specifically, Interpreter instances) to
     # equivalence classes of expressions.  Each equivalence class
     # contains the set of known expressions that evaluate to the
     # same literal value.  Specifically,
     #   {Interpreter: RepMap}
     #   RepMap := {HashableAst literal (e.g., 2 or f!0): Reps}
     #   Reps   := AstSet of expressions that evaluate to the representative
     self.__repmaps = collections.defaultdict(
         lambda: collections.defaultdict(z3util.AstSet))
     # Set of isomorphism conditions for value isomorphisms.
     self.__conds = z3util.AstSet()
コード例 #2
0
def expr_vars(e):
    """Return an AstSet of uninterpreted constants in e.

    Uninterpreted constants are what people normally think of as
    "variables".  This is in contrast with interpreted constants such
    as the number 2.  Note that this will also return values that
    belong to universes of uninterpreted sorts, since there is no
    distinguishable difference between these and other uninterpreted
    constants.
    """

    res = z3util.AstSet()

    def rec(e):
        if not z3.is_ast(e):
            return
        if z3.is_const(e) and e.decl().kind() == z3.Z3_OP_UNINTERPRETED:
            res.add(e)
            return
        for child in e.children():
            rec(child)

    rec(simsym.unwrap(e))
    return res