3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-16 23:25:36 +00:00

fix issues 1-10: add missing API bindings across Go, Julia, TypeScript, OCaml, and Java (#9432)

Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/b89f3b76-dfd7-47ec-97dd-8ae5e8e88a4a

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:
Copilot 2026-05-04 09:29:47 -07:00 committed by GitHub
parent eefb644c93
commit 1c6943c2cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 356 additions and 0 deletions

View file

@ -1957,10 +1957,46 @@ export function createApi(Z3: Z3Core, em?: any): Z3HighLevel {
return new FuncDeclImpl(check(Z3.mk_partial_order(contextPtr, sort.ptr, index)));
}
function mkLinearOrder(sort: Sort<Name>, index: number): FuncDecl<Name> {
return new FuncDeclImpl(check(Z3.mk_linear_order(contextPtr, sort.ptr, index)));
}
function mkPiecewiseLinearOrder(sort: Sort<Name>, index: number): FuncDecl<Name> {
return new FuncDeclImpl(check(Z3.mk_piecewise_linear_order(contextPtr, sort.ptr, index)));
}
function mkTreeOrder(sort: Sort<Name>, index: number): FuncDecl<Name> {
return new FuncDeclImpl(check(Z3.mk_tree_order(contextPtr, sort.ptr, index)));
}
function mkTransitiveClosure(f: FuncDecl<Name>): FuncDecl<Name> {
return new FuncDeclImpl(check(Z3.mk_transitive_closure(contextPtr, f.ptr)));
}
function mkChar(ch: number): Expr<Name> {
return new ExprImpl(check(Z3.mk_char(contextPtr, ch)));
}
function mkCharLe(ch1: Expr<Name>, ch2: Expr<Name>): Bool<Name> {
return new BoolImpl(check(Z3.mk_char_le(contextPtr, ch1.ast, ch2.ast)));
}
function mkCharToInt(ch: Expr<Name>): Arith<Name> {
return new ArithImpl(check(Z3.mk_char_to_int(contextPtr, ch.ast)));
}
function mkCharToBV(ch: Expr<Name>): Expr<Name> {
return new ExprImpl(check(Z3.mk_char_to_bv(contextPtr, ch.ast)));
}
function mkCharFromBV(bv: Expr<Name>): Expr<Name> {
return new ExprImpl(check(Z3.mk_char_from_bv(contextPtr, bv.ast)));
}
function mkCharIsDigit(ch: Expr<Name>): Bool<Name> {
return new BoolImpl(check(Z3.mk_char_is_digit(contextPtr, ch.ast)));
}
async function polynomialSubresultants(
p: Arith<Name>,
q: Arith<Name>,
@ -5490,7 +5526,16 @@ export function createApi(Z3: Z3Core, em?: any): Z3HighLevel {
Full,
mkPartialOrder,
mkLinearOrder,
mkPiecewiseLinearOrder,
mkTreeOrder,
mkTransitiveClosure,
mkChar,
mkCharLe,
mkCharToInt,
mkCharToBV,
mkCharFromBV,
mkCharIsDigit,
polynomialSubresultants,
};
cleanup.register(ctx, () => Z3.del_context(contextPtr));

View file

@ -933,6 +933,30 @@ export interface Context<Name extends string = 'main'> {
*/
mkPartialOrder(sort: Sort<Name>, index: number): FuncDecl<Name>;
/**
* Create a linear (total) order relation over a sort.
* @param sort The sort of the relation
* @param index The index of the relation
* @category Operations
*/
mkLinearOrder(sort: Sort<Name>, index: number): FuncDecl<Name>;
/**
* Create a piecewise linear order relation over a sort.
* @param sort The sort of the relation
* @param index The index of the relation
* @category Operations
*/
mkPiecewiseLinearOrder(sort: Sort<Name>, index: number): FuncDecl<Name>;
/**
* Create a tree order relation over a sort.
* @param sort The sort of the relation
* @param index The index of the relation
* @category Operations
*/
mkTreeOrder(sort: Sort<Name>, index: number): FuncDecl<Name>;
/**
* Create the transitive closure of a binary relation.
* The resulting relation is recursive.
@ -941,6 +965,49 @@ export interface Context<Name extends string = 'main'> {
*/
mkTransitiveClosure(f: FuncDecl<Name>): FuncDecl<Name>;
/**
* Create a character literal from a Unicode code point.
* @param ch The Unicode code point
* @category Characters
*/
mkChar(ch: number): Expr<Name>;
/**
* Create a character less-than-or-equal predicate (ch1 ch2).
* @param ch1 First character
* @param ch2 Second character
* @category Characters
*/
mkCharLe(ch1: Expr<Name>, ch2: Expr<Name>): Bool<Name>;
/**
* Convert a character to its integer (Unicode code point) value.
* @param ch The character expression
* @category Characters
*/
mkCharToInt(ch: Expr<Name>): Arith<Name>;
/**
* Convert a character to a bit-vector.
* @param ch The character expression
* @category Characters
*/
mkCharToBV(ch: Expr<Name>): Expr<Name>;
/**
* Convert a bit-vector to a character.
* @param bv The bit-vector expression
* @category Characters
*/
mkCharFromBV(bv: Expr<Name>): Expr<Name>;
/**
* Create a predicate that is true if the character is a decimal digit.
* @param ch The character expression
* @category Characters
*/
mkCharIsDigit(ch: Expr<Name>): Bool<Name>;
/**
* Return the nonzero subresultants of p and q with respect to the "variable" x.
* Note that any subterm that cannot be viewed as a polynomial is assumed to be a variable.