mirror of
https://github.com/Z3Prover/z3
synced 2026-01-25 03:24:01 +00:00
Add missing API methods: Java substituteFuns, TypeScript Fixedpoint and substitution APIs (#8138)
* Initial plan * Add substituteFuns to Java and substitute methods to TypeScript Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Add Fixedpoint (Datalog) API to TypeScript bindings Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Improve error message in Java substituteFuns method Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix TypeScript build error: use .ptr instead of .decl for FuncDecl Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix TypeScript build errors: handle optional symbols and pointer null checks 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
495e1f44ba
commit
6d14d2e3b8
3 changed files with 363 additions and 0 deletions
|
|
@ -188,6 +188,30 @@ public class Expr<R extends Sort> extends AST
|
|||
getNativeObject(), to.length, Expr.arrayToNative(to)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Substitute functions in {@code from} with the expressions in {@code to}.
|
||||
* The expressions in {@code to} can have free variables. The free variable
|
||||
* in {@code to[i]} at de-Bruijn index 0 refers to the first argument of
|
||||
* {@code from[i]}, the free variable at index 1 corresponds to the second
|
||||
* argument, and so on.
|
||||
* Remarks: The arrays {@code from} and {@code to} must have the same size.
|
||||
* @param from Array of function declarations to be substituted
|
||||
* @param to Array of expressions to substitute with
|
||||
* @throws Z3Exception on error
|
||||
* @return an Expr
|
||||
**/
|
||||
public Expr<R> substituteFuns(FuncDecl<?>[] from, Expr<?>[] to)
|
||||
{
|
||||
getContext().checkContextMatch(from);
|
||||
getContext().checkContextMatch(to);
|
||||
if (from.length != to.length) {
|
||||
throw new Z3Exception("Arrays 'from' and 'to' must have the same length");
|
||||
}
|
||||
return (Expr<R>) Expr.create(getContext(), Native.substituteFuns(getContext().nCtx(),
|
||||
getNativeObject(), from.length, AST.arrayToNative(from),
|
||||
Expr.arrayToNative(to)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates (copies) the term to the Context {@code ctx}.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue