本文整理汇总了Python中z3.BoolVal方法的典型用法代码示例。如果您正苦于以下问题:Python z3.BoolVal方法的具体用法?Python z3.BoolVal怎么用?Python z3.BoolVal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类z3
的用法示例。
在下文中一共展示了z3.BoolVal方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: query
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def query(self): # May want to change this....
global __property_to_function__
self._populate_properties() # Apply to specific instance of variables
# if self.__query__ is None:
conj = []
for p in self._properties: # combines Test and Var-specific properties
# p.__z3__ = uninterpreted function
# p.__var__ = instantiated z3 BoolVal
# Add the uf, and interpret the uf as always ==ing the instantiated BoolVal
# conj += [p.__z3__, p.__z3__ == p.__var__]
conj += [p.__z3__]
# Add property to property to function map
__property_to_function__[p.__z3__] = p.property.function
return conj
# self.__query__ = query
# return self.__query__
示例2: __init__
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def __init__(self, z3ctx, z3solver):
self.ctx = z3ctx
self.solver = z3solver
self.int_zero = z3.IntVal(0, self.ctx)
self.int_one = z3.IntVal(1, self.ctx)
self.true = z3.BoolVal(True, self.ctx)
self.false = z3.BoolVal(False, self.ctx)
assert to_bool(self.true) is True
assert to_bool(self.false) is False
assert to_bool(self.int_zero) is None
示例3: distinct
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def distinct(self, t, *values):
if len(values) <= 1:
return z3.BoolVal(True, self.ctx)
return self.all(
self.distinct(t, values[1:]),
*[self.neg(self.eq(t, values[0], v1, {})) for v1 in values[1:]])
示例4: visit_EBool
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def visit_EBool(self, b, env):
return z3.BoolVal(b.val, self.ctx)
示例5: visit_bool
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def visit_bool(self, e, env):
return z3.BoolVal(e, self.ctx)
示例6: BoolV
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def BoolV(self, ast): #pylint:disable=unused-argument
# TODO: Here the checks performed by the high level API are mandatory before calling the low level API
# So we can keep the high level API call here
return z3.BoolVal(ast.args[0], ctx=self._context)
示例7: _is_false
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def _is_false(self, e, extra_constraints=(), solver=None, model_callback=None):
return z3.simplify(e).eq(z3.BoolVal(False, ctx=self._context))
示例8: _is_true
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def _is_true(self, e, extra_constraints=(), solver=None, model_callback=None):
return z3.simplify(e).eq(z3.BoolVal(True, ctx=self._context))
示例9: walk_bool_constant
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def walk_bool_constant(self, formula, **kwargs):
_t = z3.BoolVal(formula.constant_value(), ctx=self.ctx)
z3term = _t.as_ast()
z3.Z3_inc_ref(self.ctx.ref(), z3term)
return z3term
示例10: simplify_non_const_hashes
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def simplify_non_const_hashes(expr, sha_ids):
while True:
expr = z3.simplify(expr, expand_select_store=True)
sha_subst = get_sha_subst_non_recursive(expr, sha_ids)
if not sha_subst:
break
expr = z3.substitute(expr, [(s, z3.BoolVal(False)) for s in sha_subst])
return expr
示例11: generate_reaching_constraints
# 需要导入模块: import z3 [as 别名]
# 或者: from z3 import BoolVal [as 别名]
def generate_reaching_constraints(self):
visitor = ConditionVisitor(self.view)
for (
(start, end),
reaching_condition,
) in self.reaching_conditions.items():
or_exprs = []
for condition in reaching_condition:
and_exprs = []
for edge in condition:
if edge.type == BranchType.UnconditionalBranch:
continue
if edge.type == BranchType.TrueBranch:
condition = edge.source[-1].condition
if (
condition.operation
== MediumLevelILOperation.MLIL_VAR
):
condition = self.function.get_ssa_var_definition(
edge.source[-1].ssa_form.condition.src
).src
and_exprs.append(visitor.simplify(condition))
elif edge.type == BranchType.FalseBranch:
condition = edge.source[-1].condition
if (
condition.operation
== MediumLevelILOperation.MLIL_VAR
):
condition = self.function.get_ssa_var_definition(
edge.source[-1].ssa_form.condition.src
).src
and_exprs += Tactic("ctx-solver-simplify")(
Not(visitor.simplify(condition))
)[0]
if and_exprs != []:
or_exprs.append(And(*and_exprs))
if or_exprs:
or_exprs = Tactic("ctx-solver-simplify")(Or(*or_exprs))[0]
reaching_constraint = (
And(*or_exprs)
if len(or_exprs) > 1
else or_exprs[0]
if len(or_exprs)
else BoolVal(True)
)
self._reaching_constraints[(start, end)] = reaching_constraint