diff --git a/src/api/dotnet/Params.cs b/src/api/dotnet/Params.cs
index 23b037c78..8268fa69f 100644
--- a/src/api/dotnet/Params.cs
+++ b/src/api/dotnet/Params.cs
@@ -31,98 +31,108 @@ namespace Microsoft.Z3
///
/// Adds a parameter setting.
///
- public void Add(Symbol name, bool value)
+ public Params Add(Symbol name, bool value)
{
Contract.Requires(name != null);
Native.Z3_params_set_bool(Context.nCtx, NativeObject, name.NativeObject, (value) ? 1 : 0);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(Symbol name, uint value)
+ public Params Add(Symbol name, uint value)
{
Contract.Requires(name != null);
Native.Z3_params_set_uint(Context.nCtx, NativeObject, name.NativeObject, value);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(Symbol name, double value)
+ public Params Add(Symbol name, double value)
{
Contract.Requires(name != null);
Native.Z3_params_set_double(Context.nCtx, NativeObject, name.NativeObject, value);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(Symbol name, string value)
+ public Params Add(Symbol name, string value)
{
Contract.Requires(value != null);
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, name.NativeObject, Context.MkSymbol(value).NativeObject);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(Symbol name, Symbol value)
+ public Params Add(Symbol name, Symbol value)
{
Contract.Requires(name != null);
Contract.Requires(value != null);
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, name.NativeObject, value.NativeObject);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(string name, bool value)
+ public Params Add(string name, bool value)
{
Native.Z3_params_set_bool(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, (value) ? 1 : 0);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(string name, uint value)
+ public Params Add(string name, uint value)
{
Native.Z3_params_set_uint(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(string name, double value)
+ public Params Add(string name, double value)
{
Native.Z3_params_set_double(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(string name, Symbol value)
+ public Params Add(string name, Symbol value)
{
Contract.Requires(value != null);
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value.NativeObject);
+ return this;
}
///
/// Adds a parameter setting.
///
- public void Add(string name, string value)
+ public Params Add(string name, string value)
{
Contract.Requires(name != null);
Contract.Requires(value != null);
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, Context.MkSymbol(value).NativeObject);
+ return this;
}
///
diff --git a/src/api/dotnet/Solver.cs b/src/api/dotnet/Solver.cs
index 4b8ff4cf6..568ac79bf 100644
--- a/src/api/dotnet/Solver.cs
+++ b/src/api/dotnet/Solver.cs
@@ -57,6 +57,48 @@ namespace Microsoft.Z3
}
}
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(string name, bool value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(string name, uint value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(string name, double value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(string name, string value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(string name, Symbol value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(Symbol name, bool value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(Symbol name, uint value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(Symbol name, double value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(Symbol name, string value) { Parameters = Context.MkParams().Add(name, value); }
+ ///
+ /// Sets parameter on the solver
+ ///
+ public void Set(Symbol name, Symbol value) { Parameters = Context.MkParams().Add(name, value); }
+
+
///
/// Retrieves parameter descriptions for solver.
///
@@ -140,11 +182,11 @@ namespace Microsoft.Z3
/// using the Boolean constants in ps.
///
///
- /// This API is an alternative to with assumptions for extracting unsat cores.
+ /// This API is an alternative to with assumptions for extracting unsat cores.
/// Both APIs can be used in the same solver. The unsat core will contain a combination
/// of the Boolean variables provided using
/// and the Boolean literals
- /// provided using with assumptions.
+ /// provided using with assumptions.
///
public void AssertAndTrack(BoolExpr[] constraints, BoolExpr[] ps)
{
@@ -165,11 +207,11 @@ namespace Microsoft.Z3
/// using the Boolean constant p.
///
///
- /// This API is an alternative to with assumptions for extracting unsat cores.
+ /// This API is an alternative to with assumptions for extracting unsat cores.
/// Both APIs can be used in the same solver. The unsat core will contain a combination
/// of the Boolean variables provided using
/// and the Boolean literals
- /// provided using with assumptions.
+ /// provided using with assumptions.
///
public void AssertAndTrack(BoolExpr constraint, BoolExpr p)
{
@@ -256,6 +298,25 @@ namespace Microsoft.Z3
return lboolToStatus(r);
}
+ ///
+ /// Checks whether the assertions in the solver are consistent or not.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Status Check(IEnumerable assumptions)
+ {
+ Z3_lbool r;
+ BoolExpr[] asms = assumptions.ToArray();
+ if (asms.Length == 0)
+ r = (Z3_lbool)Native.Z3_solver_check(Context.nCtx, NativeObject);
+ else
+ r = (Z3_lbool)Native.Z3_solver_check_assumptions(Context.nCtx, NativeObject, (uint)asms.Length, AST.ArrayToNative(asms));
+ return lboolToStatus(r);
+ }
+
///
/// Retrieve fixed assignments to the set of variables in the form of consequences.
/// Each consequence is an implication of the form
@@ -284,10 +345,10 @@ namespace Microsoft.Z3
}
///
- /// The model of the last Check.
+ /// The model of the last Check(params Expr[] assumptions).
///
///
- /// The result is null if Check was not invoked before,
+ /// The result is null if Check(params Expr[] assumptions) was not invoked before,
/// if its results was not SATISFIABLE, or if model production is not enabled.
///
public Model Model
@@ -303,10 +364,10 @@ namespace Microsoft.Z3
}
///
- /// The proof of the last Check.
+ /// The proof of the last Check(params Expr[] assumptions).
///
///
- /// The result is null if Check was not invoked before,
+ /// The result is null if Check(params Expr[] assumptions) was not invoked before,
/// if its results was not UNSATISFIABLE, or if proof production is disabled.
///
public Expr Proof