mirror of
https://github.com/Z3Prover/z3
synced 2025-07-19 02:42:02 +00:00
fix examples and C++ API - build failure
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
93f55605a8
2 changed files with 49 additions and 23 deletions
|
@ -1111,10 +1111,10 @@ namespace z3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline expr concat(expr const& a, expr const& b) {
|
inline expr concat(expr const& a, expr const& b) {
|
||||||
context& ctx = a.ctx();
|
check_context(a, b);
|
||||||
Z3_ast r = Z3_mk_concat(ctx, (Z3_ast) a, (Z3_ast) b);
|
Z3_ast r = Z3_mk_concat(a.ctx(), a, b);
|
||||||
ctx.check_error();
|
a.ctx().check_error();
|
||||||
return expr(ctx, r);
|
return expr(a.ctx(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
class func_entry : public object {
|
class func_entry : public object {
|
||||||
|
|
|
@ -87,6 +87,13 @@ public class InterpolationContext extends Context
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ComputeInterpolantResult
|
||||||
|
{
|
||||||
|
public Z3_lbool status = Z3_lbool.Z3_L_UNDEF;
|
||||||
|
public ASTVector interp = null;
|
||||||
|
public Model model = null;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes an interpolant.
|
* Computes an interpolant.
|
||||||
* Remarks: For more information on interpolation please refer
|
* Remarks: For more information on interpolation please refer
|
||||||
|
@ -94,17 +101,18 @@ public class InterpolationContext extends Context
|
||||||
* well documented.
|
* well documented.
|
||||||
* @throws Z3Exception
|
* @throws Z3Exception
|
||||||
**/
|
**/
|
||||||
public Z3_lbool ComputeInterpolant(Expr pat, Params p, ASTVector interp, Model model)
|
public ComputeInterpolantResult ComputeInterpolant(Expr pat, Params p)
|
||||||
{
|
{
|
||||||
checkContextMatch(pat);
|
checkContextMatch(pat);
|
||||||
checkContextMatch(p);
|
checkContextMatch(p);
|
||||||
|
|
||||||
|
ComputeInterpolantResult res = new ComputeInterpolantResult();
|
||||||
Native.LongPtr n_i = new Native.LongPtr();
|
Native.LongPtr n_i = new Native.LongPtr();
|
||||||
Native.LongPtr n_m = new Native.LongPtr();
|
Native.LongPtr n_m = new Native.LongPtr();
|
||||||
int r = Native.computeInterpolant(nCtx(), pat.getNativeObject(), p.getNativeObject(), n_i, n_m);
|
res.status =Z3_lbool.fromInt(Native.computeInterpolant(nCtx(), pat.getNativeObject(), p.getNativeObject(), n_i, n_m));
|
||||||
interp = new ASTVector(this, n_i.value);
|
if (res.status == Z3_lbool.Z3_L_FALSE) res.interp = new ASTVector(this, n_i.value);
|
||||||
model = new Model(this, n_m.value);
|
if (res.status == Z3_lbool.Z3_L_TRUE) res.model = new Model(this, n_m.value);
|
||||||
return Z3_lbool.fromInt(r);
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -118,16 +126,23 @@ public class InterpolationContext extends Context
|
||||||
return Native.interpolationProfile(nCtx());
|
return Native.interpolationProfile(nCtx());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CheckInterpolantResult
|
||||||
|
{
|
||||||
|
public int return_value = 0;
|
||||||
|
public String error = null;
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Checks the correctness of an interpolant.
|
/// Checks the correctness of an interpolant.
|
||||||
///
|
///
|
||||||
/// Remarks: For more information on interpolation please refer
|
/// Remarks: For more information on interpolation please refer
|
||||||
/// too the function Z3_check_interpolant in the C/C++ API, which is
|
/// too the function Z3_check_interpolant in the C/C++ API, which is
|
||||||
/// well documented.
|
/// well documented.
|
||||||
public int CheckInterpolant(Expr[] cnsts, int[] parents, Expr[] interps, String error, Expr[] theory)
|
public CheckInterpolantResult CheckInterpolant(Expr[] cnsts, int[] parents, Expr[] interps, String error, Expr[] theory)
|
||||||
{
|
{
|
||||||
|
CheckInterpolantResult res = new CheckInterpolantResult();
|
||||||
Native.StringPtr n_err_str = new Native.StringPtr();
|
Native.StringPtr n_err_str = new Native.StringPtr();
|
||||||
int r = Native.checkInterpolant(nCtx(),
|
res.return_value = Native.checkInterpolant(nCtx(),
|
||||||
cnsts.length,
|
cnsts.length,
|
||||||
Expr.arrayToNative(cnsts),
|
Expr.arrayToNative(cnsts),
|
||||||
parents,
|
parents,
|
||||||
|
@ -135,41 +150,52 @@ public class InterpolationContext extends Context
|
||||||
n_err_str,
|
n_err_str,
|
||||||
theory.length,
|
theory.length,
|
||||||
Expr.arrayToNative(theory));
|
Expr.arrayToNative(theory));
|
||||||
error = n_err_str.value;
|
res.error = n_err_str.value;
|
||||||
return r;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ReadInterpolationProblemResult
|
||||||
|
{
|
||||||
|
public int return_value = 0;
|
||||||
|
public Expr[] cnsts;
|
||||||
|
public int[] parents;
|
||||||
|
public String error;
|
||||||
|
public Expr[] theory;
|
||||||
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Reads an interpolation problem from a file.
|
/// Reads an interpolation problem from a file.
|
||||||
///
|
///
|
||||||
/// Remarks: For more information on interpolation please refer
|
/// Remarks: For more information on interpolation please refer
|
||||||
/// too the function Z3_read_interpolation_problem in the C/C++ API, which is
|
/// too the function Z3_read_interpolation_problem in the C/C++ API, which is
|
||||||
/// well documented.
|
/// well documented.
|
||||||
public int ReadInterpolationProblem(String filename, Expr[] cnsts, int[] parents, String error, Expr[] theory)
|
public ReadInterpolationProblemResult ReadInterpolationProblem(String filename, Expr[] cnsts, int[] parents, String error, Expr[] theory)
|
||||||
{
|
{
|
||||||
|
ReadInterpolationProblemResult res = new ReadInterpolationProblemResult();
|
||||||
|
|
||||||
Native.IntPtr n_num = new Native.IntPtr();
|
Native.IntPtr n_num = new Native.IntPtr();
|
||||||
Native.IntPtr n_num_theory = new Native.IntPtr();
|
Native.IntPtr n_num_theory = new Native.IntPtr();
|
||||||
Native.ObjArrayPtr n_cnsts = new Native.ObjArrayPtr();
|
Native.ObjArrayPtr n_cnsts = new Native.ObjArrayPtr();
|
||||||
Native.UIntArrayPtr n_parents = new Native.UIntArrayPtr();
|
Native.UIntArrayPtr n_parents = new Native.UIntArrayPtr();
|
||||||
Native.ObjArrayPtr n_theory = new Native.ObjArrayPtr();
|
Native.ObjArrayPtr n_theory = new Native.ObjArrayPtr();
|
||||||
Native.StringPtr n_err_str = new Native.StringPtr();
|
Native.StringPtr n_err_str = new Native.StringPtr();
|
||||||
int r = Native.readInterpolationProblem(nCtx(), n_num, n_cnsts, n_parents, filename, n_err_str, n_num_theory, n_theory);
|
res.return_value = Native.readInterpolationProblem(nCtx(), n_num, n_cnsts, n_parents, filename, n_err_str, n_num_theory, n_theory);
|
||||||
int num = n_num.value;
|
int num = n_num.value;
|
||||||
int num_theory = n_num_theory.value;
|
int num_theory = n_num_theory.value;
|
||||||
error = n_err_str.value;
|
res.error = n_err_str.value;
|
||||||
cnsts = new Expr[num];
|
res.cnsts = new Expr[num];
|
||||||
parents = new int[num];
|
res.parents = new int[num];
|
||||||
theory = new Expr[num_theory];
|
theory = new Expr[num_theory];
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
cnsts[i] = Expr.create(this, n_cnsts.value[i]);
|
res.cnsts[i] = Expr.create(this, n_cnsts.value[i]);
|
||||||
parents[i] = n_parents.value[i];
|
res.parents[i] = n_parents.value[i];
|
||||||
}
|
}
|
||||||
for (int i = 0; i < num_theory; i++)
|
for (int i = 0; i < num_theory; i++)
|
||||||
theory[i] = Expr.create(this, n_theory.value[i]);
|
res.theory[i] = Expr.create(this, n_theory.value[i]);
|
||||||
return r;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Writes an interpolation problem to a file.
|
/// Writes an interpolation problem to a file.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue