mirror of
https://github.com/Z3Prover/z3
synced 2026-03-04 04:30:23 +00:00
Add missing API bindings: Python BvNand/BvNor/BvXnor, Go MkAsArray/MkRecFuncDecl/AddRecDef/Model.Translate, TS Array.fromFunc/Model.translate, OCaml Model.translate
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
8fad12fe18
commit
28fbe33114
8 changed files with 106 additions and 0 deletions
|
|
@ -1093,6 +1093,9 @@ export function createApi(Z3: Z3Core, em?: any): Z3HighLevel {
|
|||
): SMTArray<Name, [DomainSort], RangeSort> {
|
||||
return new ArrayImpl<[DomainSort], RangeSort>(check(Z3.mk_const_array(contextPtr, domain.ptr, value.ptr)));
|
||||
},
|
||||
fromFunc(f: FuncDecl<Name>): SMTArray<Name> {
|
||||
return new ArrayImpl(check(Z3.mk_as_array(contextPtr, f.ast)));
|
||||
},
|
||||
};
|
||||
const Set = {
|
||||
// reference: https://z3prover.github.io/api/html/namespacez3py.html#a545f894afeb24caa1b88b7f2a324ee7e
|
||||
|
|
@ -2812,6 +2815,11 @@ export function createApi(Z3: Z3Core, em?: any): Z3HighLevel {
|
|||
return this.getUniverse(sort) as AstVector<Name, AnyExpr<Name>>;
|
||||
}
|
||||
|
||||
translate(target: Context<Name>): Model<Name> {
|
||||
const ptr = check(Z3.model_translate(contextPtr, this.ptr, target.ptr));
|
||||
return new (target.Model as unknown as new (ptr: Z3_model) => Model<Name>)(ptr);
|
||||
}
|
||||
|
||||
release() {
|
||||
Z3.model_dec_ref(contextPtr, this.ptr);
|
||||
this._ptr = null;
|
||||
|
|
|
|||
|
|
@ -1883,6 +1883,14 @@ export interface Model<Name extends string = 'main'> extends Iterable<FuncDecl<N
|
|||
*/
|
||||
sortUniverse(sort: Sort<Name>): AstVector<Name, AnyExpr<Name>>;
|
||||
|
||||
/**
|
||||
* Translate the model to a different context.
|
||||
*
|
||||
* @param target - The target context
|
||||
* @returns A new model in the target context
|
||||
*/
|
||||
translate(target: Context<Name>): Model<Name>;
|
||||
|
||||
/**
|
||||
* Manually decrease the reference count of the model
|
||||
* This is automatically done when the model is garbage collected,
|
||||
|
|
@ -2915,6 +2923,12 @@ export interface SMTArrayCreation<Name extends string> {
|
|||
domain: DomainSort,
|
||||
value: SortToExprMap<RangeSort, Name>,
|
||||
): SMTArray<Name, [DomainSort], RangeSort>;
|
||||
|
||||
/**
|
||||
* Create an array from a function declaration.
|
||||
* The resulting array maps each input to the output of the function.
|
||||
*/
|
||||
fromFunc(f: FuncDecl<Name>): SMTArray<Name>;
|
||||
}
|
||||
|
||||
export type NonEmptySortArray<Name extends string = 'main'> = [Sort<Name>, ...Array<Sort<Name>>];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue