3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 02:15:19 +00:00

fix debug build, add access to numerics from model

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-11-17 15:24:54 -08:00
parent e98da4320b
commit d45b8a3ac8
3 changed files with 29 additions and 1 deletions

View file

@ -931,6 +931,26 @@ namespace Microsoft.Z3
return new BoolExpr(this, Native.Z3_mk_xor(nCtx, t1.NativeObject, t2.NativeObject));
}
/// <summary>
/// Create an expression representing <c>t1 xor t2 xor t3 ... </c>.
/// </summary>
public BoolExpr MkXor(IEnumerable<BoolExpr> ts)
{
Debug.Assert(ts != null);
Debug.Assert(ts.All(a => a != null));
CheckContextMatch<BoolExpr>(ts);
BoolExpr r = null;
foreach (var t in ts) {
if (r == null)
r = t;
else
r = MkXor(r, t);
}
if (r == null)
r = MkTrue();
return r;
}
/// <summary>
/// Create an expression representing <c>t[0] and t[1] and ...</c>.
/// </summary>

View file

@ -238,6 +238,14 @@ namespace Microsoft.Z3
return Eval(t, completion);
}
/// <summary>
/// Evaluate expression to a double, assuming it is a numeral already.
/// </summary>
public double Double(Expr t) {
var r = Eval(t, true);
return Native.Z3_get_numeral_double(Context.nCtx, r.NativeObject);
}
/// <summary>
/// The number of uninterpreted sorts that the model has an interpretation for.
/// </summary>

View file

@ -405,7 +405,7 @@ public:
TRACE("opt",
tout << "sat: " << is_sat << " num cores: " << cores.size() << "\n";
for (auto const& c : cores) display_vec(tout, c);
for (auto const& c : cores) display_vec(tout, c.m_core);
tout << "num assumptions: " << m_asms.size() << "\n";);
return is_sat;