mirror of
https://github.com/Z3Prover/z3
synced 2026-06-19 23:26:30 +00:00
Add missing API functions to Go, OCaml, and TypeScript bindings
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
3f6acc45ed
commit
282db840de
6 changed files with 100 additions and 0 deletions
|
|
@ -27,3 +27,40 @@ func (c *Context) MkStore(array, index, value *Expr) *Expr {
|
|||
func (c *Context) MkConstArray(sort *Sort, value *Expr) *Expr {
|
||||
return newExpr(c, C.Z3_mk_const_array(c.ptr, sort.ptr, value.ptr))
|
||||
}
|
||||
|
||||
// MkSelectN creates a multi-index array read (select) operation.
|
||||
func (c *Context) MkSelectN(array *Expr, indices []*Expr) *Expr {
|
||||
idxs := make([]C.Z3_ast, len(indices))
|
||||
for i, idx := range indices {
|
||||
idxs[i] = idx.ptr
|
||||
}
|
||||
var idxsPtr *C.Z3_ast
|
||||
if len(idxs) > 0 {
|
||||
idxsPtr = &idxs[0]
|
||||
}
|
||||
return newExpr(c, C.Z3_mk_select_n(c.ptr, array.ptr, C.uint(len(idxs)), idxsPtr))
|
||||
}
|
||||
|
||||
// MkStoreN creates a multi-index array write (store) operation.
|
||||
func (c *Context) MkStoreN(array *Expr, indices []*Expr, value *Expr) *Expr {
|
||||
idxs := make([]C.Z3_ast, len(indices))
|
||||
for i, idx := range indices {
|
||||
idxs[i] = idx.ptr
|
||||
}
|
||||
var idxsPtr *C.Z3_ast
|
||||
if len(idxs) > 0 {
|
||||
idxsPtr = &idxs[0]
|
||||
}
|
||||
return newExpr(c, C.Z3_mk_store_n(c.ptr, array.ptr, C.uint(len(idxs)), idxsPtr, value.ptr))
|
||||
}
|
||||
|
||||
// MkArrayDefault returns the default value of an array.
|
||||
func (c *Context) MkArrayDefault(array *Expr) *Expr {
|
||||
return newExpr(c, C.Z3_mk_array_default(c.ptr, array.ptr))
|
||||
}
|
||||
|
||||
// MkArrayExt returns the extensionality witness for two arrays.
|
||||
// Two arrays are equal if and only if they are equal on the index returned by MkArrayExt.
|
||||
func (c *Context) MkArrayExt(a1, a2 *Expr) *Expr {
|
||||
return newExpr(c, C.Z3_mk_array_ext(c.ptr, a1.ptr, a2.ptr))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue