From 2d3f6ca71d79cfcb760825050b76b89ec8e1e5d5 Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Wed, 13 Nov 2013 17:15:41 -0800 Subject: [PATCH] add pb constraints to API Signed-off-by: Nikolaj Bjorner --- src/api/dotnet/Context.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/api/dotnet/Context.cs b/src/api/dotnet/Context.cs index ae8b233d1..8ac0c8f98 100644 --- a/src/api/dotnet/Context.cs +++ b/src/api/dotnet/Context.cs @@ -2249,6 +2249,36 @@ namespace Microsoft.Z3 } #endregion + #region Pseudo-Boolean constraints + + /// + /// Create an at-most-k constraint. + /// + public BoolExpr MkAtMost(BoolExpr[] args, uint k) + { + Contract.Requires(args != null); + Contract.Requires(Contract.Result() != null); + CheckContextMatch(args); + return new BoolExpr(this, Native.Z3_mk_atmost(nCtx, (uint) args.Length, + AST.ArrayToNative(args), k)); + } + + /// + /// Create a pseudo-Boolean <= constraint. + /// + public BoolExpr MkPBLe(int[] coeffs, BoolExpr[] args, int k) + { + Contract.Requires(args != null); + Contract.Requires(coeffs != null); + Contract.Requires(args.Length == coeffs.Length); + Contract.Requires(Contract.Result() != null); + CheckContextMatch(args); + return new BoolExpr(this, Native.Z3_mk_pble(nCtx, (uint) args.Length, + AST.ArrayToNative(args), + coeffs, k)); + } + #endregion + #region Numerals #region General Numerals