Z3
 
Loading...
Searching...
No Matches
UserPropagatorBase.java
Go to the documentation of this file.
1package com.microsoft.z3;
2
3import com.microsoft.z3.Context;
4import com.microsoft.z3.enumerations.Z3_lbool;
5
6public abstract class UserPropagatorBase extends Native.UserPropagatorBase {
7 private Context ctx;
8 private Solver solver;
9
10 public UserPropagatorBase(Context _ctx, Solver _solver) {
11 super(_ctx.nCtx(), _solver.getNativeObject());
12 ctx = _ctx;
13 solver = _solver;
14 }
15
16 public final Context getCtx() {
17 return ctx;
18 }
19
20 public final Solver getSolver() {
21 return solver;
22 }
23
24 @Override
25 protected final void pushWrapper() {
26 push();
27 }
28
29 @Override
30 protected final void popWrapper(int number) {
31 pop(number);
32 }
33
34 @Override
35 protected final void finWrapper() {
36 fin();
37 }
38
39 @Override
40 protected final void eqWrapper(long lx, long ly) {
41 Expr x = new Expr(ctx, lx);
42 Expr y = new Expr(ctx, ly);
43 eq(x, y);
44 }
45
46 @Override
47 protected final boolean onBindingWrapper(long lq, long linst) {
48 Expr q = new Expr(ctx, lq);
49 Expr inst = new Expr(ctx, linst);
50 return on_binding(q, inst);
51 }
52
53 @Override
54 protected final UserPropagatorBase freshWrapper(long lctx) {
55 return fresh(new Context(lctx));
56 }
57
58 @Override
59 protected final void createdWrapper(long last) {
60 created(new Expr(ctx, last));
61 }
62
63 @Override
64 protected final void fixedWrapper(long lvar, long lvalue) {
65 Expr var = new Expr(ctx, lvar);
66 Expr value = new Expr(ctx, lvalue);
67 fixed(var, value);
68 }
69
70 @Override
71 protected final void decideWrapper(long lvar, int bit, boolean is_pos) {
72 Expr var = new Expr(ctx, lvar);
73 decide(var, bit, is_pos);
74 }
75
76 public abstract void push();
77
78 public abstract void pop(int number);
79
80 public abstract UserPropagatorBase fresh(Context ctx);
81
82 public void created(Expr<?> ast) {}
83
84 public void fixed(Expr<?> var, Expr<?> value) {}
85
86 public void eq(Expr<?> x, Expr<?> y) {}
87
88 public boolean on_binding(Expr<?> q, Expr<?> inst) { return true; }
89
90 public void decide(Expr<?> var, int bit, boolean is_pos) {}
91
92 public void fin() {}
93
94 public final void add(Expr<?> expr) {
95 Native.propagateAdd(this, ctx.nCtx(), solver.getNativeObject(), javainfo, expr.getNativeObject());
96 }
97
98 public final boolean conflict(Expr<?>[] fixed) {
99 return conflict(fixed, new Expr[0], new Expr[0]);
100 }
101
102 public final boolean conflict(Expr<?>[] fixed, Expr<?>[] lhs, Expr<?>[] rhs) {
103 return consequence(fixed, lhs, rhs, ctx.mkBool(false));
104 }
105
106 public final boolean consequence(Expr<?>[] fixed, Expr<?>[] lhs, Expr<?>[] rhs, Expr<?> conseq) {
107 return Native.propagateConsequence(
108 this, ctx.nCtx(), solver.getNativeObject(), javainfo,
109 fixed.length, AST.arrayToNative(fixed), lhs.length, AST.arrayToNative(lhs), AST.arrayToNative(rhs), conseq.getNativeObject());
110 }
111
112 public final boolean nextSplit(Expr<?> e, long idx, Z3_lbool phase) {
113 return Native.propagateNextSplit(
114 this, ctx.nCtx(), solver.getNativeObject(), javainfo,
115 e.getNativeObject(), idx, phase.toInt());
116 }
117}
BoolExpr mkBool(boolean value)
Definition Context.java:790
void decide(Expr<?> var, int bit, boolean is_pos)
boolean on_binding(Expr<?> q, Expr<?> inst)
final boolean conflict(Expr<?>[] fixed)
abstract void pop(int number)
final boolean consequence(Expr<?>[] fixed, Expr<?>[] lhs, Expr<?>[] rhs, Expr<?> conseq)
abstract UserPropagatorBase fresh(Context ctx)
final boolean onBindingWrapper(long lq, long linst)
final boolean conflict(Expr<?>[] fixed, Expr<?>[] lhs, Expr<?>[] rhs)
final void eqWrapper(long lx, long ly)
UserPropagatorBase(Context _ctx, Solver _solver)
final void fixedWrapper(long lvar, long lvalue)
final UserPropagatorBase freshWrapper(long lctx)
final void decideWrapper(long lvar, int bit, boolean is_pos)
void fixed(Expr<?> var, Expr<?> value)
final boolean nextSplit(Expr<?> e, long idx, Z3_lbool phase)
static long[] arrayToNative(Z3Object[] a)
Definition Z3Object.java:73
Z3_lbool
Lifted Boolean type: false, undefined, true.
Definition z3_api.h:58