mirror of
https://github.com/Z3Prover/z3
synced 2026-01-25 03:24:01 +00:00
Add missing API methods across language bindings (#8150)
* Initial plan * Add API coherence improvements for C#, Python, C++, and TypeScript - C#: Add SubstituteFuns method to Expr class - Python: Add update method to ExprRef class - C++: Add update method to expr class - TypeScript: Add complete Statistics API with Statistics interface, StatisticsEntry interface, StatisticsImpl class, and statistics() methods for Solver, Optimize, and Fixedpoint Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Add Z3_stats import and Statistics types to TypeScript bindings - Add Z3_stats to imports in types.ts and high-level.ts - Add Statistics and StatisticsEntry to type imports in high-level.ts - Fixes missing type references identified in code review Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
6c90b7ec3f
commit
319db5dbb1
5 changed files with 258 additions and 0 deletions
|
|
@ -1154,6 +1154,30 @@ class ExprRef(AstRef):
|
|||
else:
|
||||
return []
|
||||
|
||||
def update(self, *args):
|
||||
"""Update the arguments of the expression.
|
||||
|
||||
Return a new expression with the same function declaration and updated arguments.
|
||||
The number of new arguments must match the current number of arguments.
|
||||
|
||||
>>> f = Function('f', IntSort(), IntSort(), IntSort())
|
||||
>>> a = Int('a')
|
||||
>>> b = Int('b')
|
||||
>>> c = Int('c')
|
||||
>>> t = f(a, b)
|
||||
>>> t.update(c, c)
|
||||
f(c, c)
|
||||
"""
|
||||
if z3_debug():
|
||||
_z3_assert(is_app(self), "Z3 application expected")
|
||||
_z3_assert(len(args) == self.num_args(), "Number of arguments does not match")
|
||||
_z3_assert(all([is_expr(arg) for arg in args]), "Z3 expressions expected")
|
||||
num = len(args)
|
||||
_args = (Ast * num)()
|
||||
for i in range(num):
|
||||
_args[i] = args[i].as_ast()
|
||||
return _to_expr_ref(Z3_update_term(self.ctx_ref(), self.as_ast(), num, _args), self.ctx)
|
||||
|
||||
def from_string(self, s):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue