Public Member Functions | |
| def | __init__ |
| def | __del__ |
| def | num_args |
| def | arg_value |
| def | value |
| def | as_list |
| def | __repr__ |
Data Fields | |
| entry | |
| ctx | |
Store the value of the interpretation of a function in a particular point.
| def __init__ | ( | self, | |
| entry, | |||
| ctx | |||
| ) |
| def __del__ | ( | self | ) |
| def __repr__ | ( | self | ) |
| def arg_value | ( | self, | |
| idx | |||
| ) |
Return the value of argument `idx`.
>>> f = Function('f', IntSort(), IntSort(), IntSort())
>>> s = Solver()
>>> s.add(f(0, 1) == 10, f(1, 2) == 20, f(1, 0) == 10)
>>> s.check()
sat
>>> m = s.model()
>>> f_i = m[f]
>>> f_i.num_entries()
3
>>> e = f_i.entry(0)
>>> e
[0, 1, 10]
>>> e.num_args()
2
>>> e.arg_value(0)
0
>>> e.arg_value(1)
1
>>> try:
... e.arg_value(2)
... except IndexError:
... print("index error")
index error
Definition at line 5146 of file z3py.py.
05146 05147 def arg_value(self, idx): 05148 """Return the value of argument `idx`. 05149 05150 >>> f = Function('f', IntSort(), IntSort(), IntSort()) 05151 >>> s = Solver() 05152 >>> s.add(f(0, 1) == 10, f(1, 2) == 20, f(1, 0) == 10) 05153 >>> s.check() 05154 sat 05155 >>> m = s.model() 05156 >>> f_i = m[f] 05157 >>> f_i.num_entries() 05158 3 05159 >>> e = f_i.entry(0) 05160 >>> e 05161 [0, 1, 10] 05162 >>> e.num_args() 05163 2 05164 >>> e.arg_value(0) 05165 0 05166 >>> e.arg_value(1) 05167 1 05168 >>> try: 05169 ... e.arg_value(2) 05170 ... except IndexError: 05171 ... print("index error") 05172 index error 05173 """ 05174 if idx >= self.num_args(): 05175 raise IndexError 05176 return _to_expr_ref(Z3_func_entry_get_arg(self.ctx.ref(), self.entry, idx), self.ctx)
| def as_list | ( | self | ) |
Return entry `self` as a Python list.
>>> f = Function('f', IntSort(), IntSort(), IntSort())
>>> s = Solver()
>>> s.add(f(0, 1) == 10, f(1, 2) == 20, f(1, 0) == 10)
>>> s.check()
sat
>>> m = s.model()
>>> f_i = m[f]
>>> f_i.num_entries()
3
>>> e = f_i.entry(0)
>>> e.as_list()
[0, 1, 10]
Definition at line 5199 of file z3py.py.
Referenced by FuncEntry.__repr__().
05199 05200 def as_list(self): 05201 """Return entry `self` as a Python list. 05202 >>> f = Function('f', IntSort(), IntSort(), IntSort()) 05203 >>> s = Solver() 05204 >>> s.add(f(0, 1) == 10, f(1, 2) == 20, f(1, 0) == 10) 05205 >>> s.check() 05206 sat 05207 >>> m = s.model() 05208 >>> f_i = m[f] 05209 >>> f_i.num_entries() 05210 3 05211 >>> e = f_i.entry(0) 05212 >>> e.as_list() 05213 [0, 1, 10] 05214 """ 05215 args = [ self.arg_value(i) for i in range(self.num_args())] 05216 args.append(self.value()) 05217 return args
| def num_args | ( | self | ) |
Return the number of arguments in the given entry.
>>> f = Function('f', IntSort(), IntSort(), IntSort())
>>> s = Solver()
>>> s.add(f(0, 1) == 10, f(1, 2) == 20, f(1, 0) == 10)
>>> s.check()
sat
>>> m = s.model()
>>> f_i = m[f]
>>> f_i.num_entries()
3
>>> e = f_i.entry(0)
>>> e.num_args()
2
Definition at line 5128 of file z3py.py.
Referenced by FuncEntry.arg_value(), and FuncEntry.as_list().
05128 05129 def num_args(self): 05130 """Return the number of arguments in the given entry. 05131 05132 >>> f = Function('f', IntSort(), IntSort(), IntSort()) 05133 >>> s = Solver() 05134 >>> s.add(f(0, 1) == 10, f(1, 2) == 20, f(1, 0) == 10) 05135 >>> s.check() 05136 sat 05137 >>> m = s.model() 05138 >>> f_i = m[f] 05139 >>> f_i.num_entries() 05140 3 05141 >>> e = f_i.entry(0) 05142 >>> e.num_args() 05143 2 05144 """ 05145 return int(Z3_func_entry_get_num_args(self.ctx.ref(), self.entry))
| def value | ( | self | ) |
Return the value of the function at point `self`.
>>> f = Function('f', IntSort(), IntSort(), IntSort())
>>> s = Solver()
>>> s.add(f(0, 1) == 10, f(1, 2) == 20, f(1, 0) == 10)
>>> s.check()
sat
>>> m = s.model()
>>> f_i = m[f]
>>> f_i.num_entries()
3
>>> e = f_i.entry(0)
>>> e
[0, 1, 10]
>>> e.num_args()
2
>>> e.value()
10
Definition at line 5177 of file z3py.py.
Referenced by FuncEntry.as_list().
05177 05178 def value(self): 05179 """Return the value of the function at point `self`. 05180 05181 >>> f = Function('f', IntSort(), IntSort(), IntSort()) 05182 >>> s = Solver() 05183 >>> s.add(f(0, 1) == 10, f(1, 2) == 20, f(1, 0) == 10) 05184 >>> s.check() 05185 sat 05186 >>> m = s.model() 05187 >>> f_i = m[f] 05188 >>> f_i.num_entries() 05189 3 05190 >>> e = f_i.entry(0) 05191 >>> e 05192 [0, 1, 10] 05193 >>> e.num_args() 05194 2 05195 >>> e.value() 05196 10 05197 """ 05198 return _to_expr_ref(Z3_func_entry_get_value(self.ctx.ref(), self.entry), self.ctx)
Definition at line 5120 of file z3py.py.
Referenced by ArithRef.__add__(), BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), ArithRef.__div__(), BitVecRef.__div__(), ExprRef.__eq__(), Probe.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), Probe.__ge__(), ArrayRef.__getitem__(), ApplyResult.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), Probe.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), Probe.__le__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), Probe.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), ArithRef.__mul__(), BitVecRef.__mul__(), ExprRef.__ne__(), Probe.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), BitVecRef.__rlshift__(), ArithRef.__rmod__(), BitVecRef.__rmod__(), ArithRef.__rmul__(), BitVecRef.__rmul__(), BitVecRef.__ror__(), ArithRef.__rpow__(), BitVecRef.__rrshift__(), BitVecRef.__rshift__(), ArithRef.__rsub__(), BitVecRef.__rsub__(), BitVecRef.__rxor__(), ArithRef.__sub__(), BitVecRef.__sub__(), BitVecRef.__xor__(), DatatypeSortRef.accessor(), Fixedpoint.add_rule(), Optimize.add_soft(), Tactic.apply(), AlgebraicNumRef.approx(), ExprRef.arg(), FuncEntry.arg_value(), ApplyResult.as_expr(), Fixedpoint.assert_exprs(), QuantifierRef.body(), BoolSortRef.cast(), DatatypeSortRef.constructor(), ApplyResult.convert_model(), ExprRef.decl(), RatNumRef.denominator(), FuncDeclRef.domain(), ArraySortRef.domain(), Fixedpoint.get_answer(), Fixedpoint.get_assertions(), Fixedpoint.get_cover_delta(), Fixedpoint.get_rules(), SortRef.kind(), ArrayRef.mk_default(), Optimize.model(), SortRef.name(), FuncDeclRef.name(), QuantifierRef.no_pattern(), RatNumRef.numerator(), Fixedpoint.param_descrs(), Optimize.param_descrs(), Tactic.param_descrs(), Fixedpoint.parse_file(), Fixedpoint.parse_string(), QuantifierRef.pattern(), Fixedpoint.query(), FuncDeclRef.range(), ArraySortRef.range(), DatatypeSortRef.recognizer(), Fixedpoint.set(), Optimize.set(), Tactic.solver(), ExprRef.sort(), BoolRef.sort(), QuantifierRef.sort(), ArithRef.sort(), BitVecRef.sort(), ArrayRef.sort(), DatatypeRef.sort(), Fixedpoint.statistics(), Optimize.statistics(), Solver.to_smt2(), Fixedpoint.update_rule(), FuncEntry.value(), QuantifierRef.var_name(), and QuantifierRef.var_sort().
Definition at line 5120 of file z3py.py.
Referenced by FuncEntry::__del__(), FuncEntry::arg_value(), FuncEntry::num_args(), and FuncEntry::value().
1.7.6.1