3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-09 18:40:51 +00:00

Merge pull request #8500 from Z3Prover/copilot/update-functional-datatype

Add datatype_update_field to C++, Python, TypeScript, and OCaml bindings
This commit is contained in:
Nikolaj Bjorner 2026-02-07 10:11:54 -08:00 committed by GitHub
commit 3bd5b5a5d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 64 additions and 0 deletions

View file

@ -4819,6 +4819,13 @@ export function createApi(Z3: Z3Core): Z3HighLevel {
return _toExpr(check(Z3.substitute_funs(contextPtr, t.ast, from, to)));
}
function updateField(t: DatatypeExpr<Name>, fieldAccessor: FuncDecl<Name>, newValue: Expr<Name>): DatatypeExpr<Name> {
_assertContext(t);
_assertContext(fieldAccessor);
_assertContext(newValue);
return _toExpr(check(Z3.datatype_update_field(contextPtr, fieldAccessor.ptr, t.ast, newValue.ast))) as DatatypeExpr<Name>;
}
function ast_from_string(s: string): Ast<Name> {
const sort_names: Z3_symbol[] = [];
const sorts: Z3_sort[] = [];
@ -4998,6 +5005,7 @@ export function createApi(Z3: Z3Core): Z3HighLevel {
substitute,
substituteVars,
substituteFuns,
updateField,
simplify,
/////////////

View file

@ -808,6 +808,9 @@ export interface Context<Name extends string = 'main'> {
/** @category Operations */
substituteFuns(t: Expr<Name>, ...substitutions: [FuncDecl<Name>, Expr<Name>][]): Expr<Name>;
/** @category Operations */
updateField(t: DatatypeExpr<Name>, fieldAccessor: FuncDecl<Name>, newValue: Expr<Name>): DatatypeExpr<Name>;
simplify(expr: Expr<Name>): Promise<Expr<Name>>;
/** @category Operations */