diff --git a/src/api/dotnet/NativeContext.cs b/src/api/dotnet/NativeContext.cs
index 57f3f96de..00ac55c67 100644
--- a/src/api/dotnet/NativeContext.cs
+++ b/src/api/dotnet/NativeContext.cs
@@ -6,6 +6,7 @@ using System.Linq;
namespace Microsoft.Z3
{
+ using Z3_symbol = System.IntPtr;
using Z3_config = System.IntPtr;
using Z3_context = System.IntPtr;
using Z3_ast = System.IntPtr;
@@ -56,6 +57,67 @@ namespace Microsoft.Z3
#endregion
+ #region Quantifiers
+ ///
+ /// Create a universal Quantifier.
+ ///
+ ///
+ /// Creates a forall formula, where is the weight,
+ /// is an array of patterns, is an array
+ /// with the sorts of the bound variables, is an array with the
+ /// 'names' of the bound variables, and is the body of the
+ /// quantifier. Quantifiers are associated with weights indicating the importance of
+ /// using the quantifier during instantiation.
+ /// Note that the bound variables are de-Bruijn indices created using .
+ /// Z3 applies the convention that the last element in and
+ /// refers to the variable with index 0, the second to last element
+ /// of and refers to the variable
+ /// with index 1, etc.
+ ///
+ /// the sorts of the bound variables.
+ /// names of the bound variables
+ /// the body of the quantifier.
+ /// quantifiers are associated with weights indicating the importance of using the quantifier during instantiation. By default, pass the weight 0.
+ /// array containing the patterns created using MkPattern.
+ /// array containing the anti-patterns created using MkPattern.
+ /// optional symbol to track quantifier.
+ /// optional symbol to track skolem constants.
+ public Z3_ast MkForall(Z3_sort[] sorts, Symbol[] names, Z3_ast body, uint weight = 1, Z3_ast[] patterns = null, Z3_ast[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
+ {
+ return MkQuantifier(true, sorts, names, body, weight, patterns, noPatterns, quantifierID, skolemID);
+ }
+
+ ///
+ /// Create a quantified expression either forall or exists
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private Z3_ast MkQuantifier(bool is_forall, Z3_sort[] sorts, Symbol[] names, Z3_ast body, uint weight, Z3_ast[] patterns, Z3_ast[] noPatterns, Symbol quantifierID, Symbol skolemID)
+ {
+ Debug.Assert(sorts != null);
+ Debug.Assert(names != null);
+ Debug.Assert(body != null);
+ Debug.Assert(sorts.Length == names.Length);
+ Debug.Assert(sorts.All(s => s != IntPtr.Zero));
+ Debug.Assert(names.All(n => n != null));
+ Debug.Assert(patterns == null || patterns.All(p => p != IntPtr.Zero));
+ Debug.Assert(noPatterns == null || noPatterns.All(np => np != IntPtr.Zero));
+ uint numPatterns = patterns == null ? 0 : (uint)patterns.Length;
+ uint numNoPatterns = noPatterns == null ? 0 : (uint)noPatterns.Length;
+ Z3_symbol[] _names = Symbol.ArrayToNative(names);
+ return Native.Z3_mk_quantifier_ex(nCtx, (byte)(is_forall ? 1 : 0), weight, quantifierID.NativeObject, skolemID.NativeObject, numPatterns, patterns, numNoPatterns, noPatterns, (uint)sorts.Length, sorts, _names, body);
+ }
+
+ #endregion
+
#region Options
///
/// Selects the format used for pretty-printing expressions.
diff --git a/src/api/dotnet/NativeFuncInterp.cs b/src/api/dotnet/NativeFuncInterp.cs
index 718462af9..bac3add04 100644
--- a/src/api/dotnet/NativeFuncInterp.cs
+++ b/src/api/dotnet/NativeFuncInterp.cs
@@ -30,6 +30,7 @@ namespace Microsoft.Z3
{
#if false
+
///
/// An Entry object represents an element in the finite map used to encode
/// a function interpretation.
@@ -187,7 +188,7 @@ namespace Microsoft.Z3
#endif
- #region Internal
+ #region Internal
NativeContext Context;
IntPtr NativeObject;
internal NativeFuncInterp(NativeContext ctx, IntPtr obj)