forked from aclements/go-z3
/
array.wrap.go
74 lines (66 loc) · 1.76 KB
/
array.wrap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Generated by genwrap.go. DO NOT EDIT
package z3
import "runtime"
/*
#cgo LDFLAGS: -lz3
#include <z3.h>
#include <stdlib.h>
*/
import "C"
// Eq returns a Value that is true if l and r are equal.
func (l Array) Eq(r Array) Bool {
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_eq(ctx.c, l.c, r.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(r)
return Bool(val)
}
// NE returns a Value that is true if l and r are not equal.
func (l Array) NE(r Array) Bool {
return l.ctx.Distinct(l, r)
}
// Select returns the value of array x at index i.
//
// i's sort must match x's domain. The result has the sort of x's
// range.
func (x Array) Select(i Value) Value {
// Generated from array.go:63.
ctx := x.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_select(ctx.c, x.c, i.impl().c)
})
runtime.KeepAlive(x)
runtime.KeepAlive(i)
return val.lift(KindUnknown)
}
// Store returns an array y that's identical to x except that
// y.Select(i) == v.
//
// i's sort must match x's domain and v's sort must match x's range.
// The result has the same sort as x.
func (x Array) Store(i Value, v Value) Array {
// Generated from array.go:71.
ctx := x.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_store(ctx.c, x.c, i.impl().c, v.impl().c)
})
runtime.KeepAlive(x)
runtime.KeepAlive(i)
runtime.KeepAlive(v)
return Array(val)
}
// Default returns the default value of an array, for arrays that can
// be represented as finite maps plus a default value.
//
// This is useful for extracting array values interpreted by models.
func (x Array) Default() Value {
// Generated from array.go:78.
ctx := x.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_array_default(ctx.c, x.c)
})
runtime.KeepAlive(x)
return val.lift(KindUnknown)
}