diff --git a/src/api/dotnet/Context.cs b/src/api/dotnet/Context.cs index 6d322394c..35fe6611d 100644 --- a/src/api/dotnet/Context.cs +++ b/src/api/dotnet/Context.cs @@ -236,7 +236,7 @@ namespace Microsoft.Z3 /// /// Create a new enumeration sort. /// - public EnumSort MkEnumSort(Symbol name, Symbol[] enumNames) + public EnumSort MkEnumSort(Symbol name, params Symbol[] enumNames) { Contract.Requires(name != null); Contract.Requires(enumNames != null); @@ -252,7 +252,7 @@ namespace Microsoft.Z3 /// /// Create a new enumeration sort. /// - public EnumSort MkEnumSort(string name, string[] enumNames) + public EnumSort MkEnumSort(string name, params string[] enumNames) { Contract.Requires(enumNames != null); Contract.Ensures(Contract.Result() != null); @@ -3219,7 +3219,7 @@ namespace Microsoft.Z3 /// /// Create a probe that always evaluates to . /// - public Probe Const(double val) + public Probe ConstProbe(double val) { Contract.Ensures(Contract.Result() != null); diff --git a/src/api/dotnet/Solver.cs b/src/api/dotnet/Solver.cs index fe3a42fa4..8c07ef31e 100644 --- a/src/api/dotnet/Solver.cs +++ b/src/api/dotnet/Solver.cs @@ -117,6 +117,50 @@ namespace Microsoft.Z3 } } + /// + /// Assert multiple constraints into the solver, and track them (in the unsat) core + /// using the Boolean constants in ps. + /// + /// + /// 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. + /// + public void AssertAndTrack(BoolExpr[] constraints, BoolExpr[] ps) + { + Contract.Requires(constraints != null); + Contract.Requires(Contract.ForAll(constraints, c => c != null)); + Contract.Requires(Contract.ForAll(ps, c => c != null)); + Context.CheckContextMatch(constraints); + Context.CheckContextMatch(ps); + if (constraints.Length != ps.Length) + throw new Z3Exception("Argument size mismatch"); + + for (int i = 0 ; i < constraints.Length; i++) + Native.Z3_solver_assert_and_track(Context.nCtx, NativeObject, constraints[i].NativeObject, ps[i].NativeObject); + } + + /// + /// Assert a constraint into the solver, and track it (in the unsat) core + /// using the Boolean constant p. + /// + /// + /// 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. + /// + public void AssertAndTrack(BoolExpr constraint, BoolExpr p) + { + Contract.Requires(constraint != null); + Contract.Requires(p != null); + Context.CheckContextMatch(constraint); + Context.CheckContextMatch(p); + + Native.Z3_solver_assert_and_track(Context.nCtx, NativeObject, constraint.NativeObject, p.NativeObject); + } + /// /// The number of assertions in the solver. ///