diff --git a/CMakeLists.txt b/CMakeLists.txt
index 388218639..28ff64568 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,7 +34,7 @@ endif()
################################################################################
set(Z3_VERSION_MAJOR 4)
set(Z3_VERSION_MINOR 8)
-set(Z3_VERSION_PATCH 1)
+set(Z3_VERSION_PATCH 2)
set(Z3_VERSION_TWEAK 0)
set(Z3_VERSION "${Z3_VERSION_MAJOR}.${Z3_VERSION_MINOR}.${Z3_VERSION_PATCH}.${Z3_VERSION_TWEAK}")
set(Z3_FULL_VERSION_STR "${Z3_VERSION}") # Note this might be modified
diff --git a/cmake/msvc_legacy_quirks.cmake b/cmake/msvc_legacy_quirks.cmake
index 36fe82bb3..a8006e2d3 100644
--- a/cmake/msvc_legacy_quirks.cmake
+++ b/cmake/msvc_legacy_quirks.cmake
@@ -8,13 +8,13 @@
# FIXME: All the commented out defines should be removed once
# we are confident it is correct to not set them.
set(Z3_MSVC_LEGACY_DEFINES
- # Don't set `_DEBUG`. The old build sytem sets this but this
+ # Don't set `_DEBUG`. The old build system sets this but this
# is wrong. MSVC will set this depending on which runtime is being used.
# See https://msdn.microsoft.com/en-us/library/b0084kay.aspx
# _DEBUG
# The old build system only set `UNICODE` and `_UNICODE` for x86_64 release.
- # That seems completly wrong so set it for all configurations.
+ # That seems completely wrong so set it for all configurations.
# According to https://blogs.msdn.microsoft.com/oldnewthing/20040212-00/?p=40643/
# `UNICODE` affects Windows headers and `_UNICODE` affects C runtime header files.
# There is some discussion of this define at https://msdn.microsoft.com/en-us/library/dybsewaf.aspx
@@ -116,7 +116,7 @@ z3_add_cxx_flag("/analyze-" REQUIRED)
################################################################################
# By default CMake enables incremental linking for Debug and RelWithDebInfo
-# builds. The old build sytem disables it for all builds so try to do the same
+# builds. The old build system disables it for all builds so try to do the same
# by changing all configurations if necessary
string(TOUPPER "${available_build_types}" _build_types_as_upper)
foreach (_build_type ${_build_types_as_upper})
diff --git a/cmake/z3_add_component.cmake b/cmake/z3_add_component.cmake
index d87ffbe61..8ab6e045d 100644
--- a/cmake/z3_add_component.cmake
+++ b/cmake/z3_add_component.cmake
@@ -7,7 +7,7 @@ function(z3_expand_dependencies output_var)
if (ARGC LESS 2)
message(FATAL_ERROR "Invalid number of arguments")
endif()
- # Remaing args should be component names
+ # Remaining args should be component names
set(_expanded_deps ${ARGN})
set(_old_number_of_deps 0)
list(LENGTH _expanded_deps _number_of_deps)
@@ -33,7 +33,7 @@ function(z3_add_component_dependencies_to_target target_name)
if (NOT (TARGET ${target_name}))
message(FATAL_ERROR "Target \"${target_name}\" does not exist")
endif()
- # Remaing args should be component names
+ # Remaining args should be component names
set(_expanded_deps ${ARGN})
foreach (dependency ${_expanded_deps})
# Ensure this component's dependencies are built before this component.
@@ -219,7 +219,7 @@ macro(z3_add_component component_name)
# Record this component's dependencies
foreach (dependency ${Z3_MOD_COMPONENT_DEPENDENCIES})
if (NOT (TARGET ${dependency}))
- message(FATAL_ERROR "Component \"${component_name}\" depends on a non existant component \"${dependency}\"")
+ message(FATAL_ERROR "Component \"${component_name}\" depends on a non existent component \"${dependency}\"")
endif()
set_property(GLOBAL APPEND PROPERTY Z3_${component_name}_DEPS "${dependency}")
endforeach()
diff --git a/contrib/ci/README.md b/contrib/ci/README.md
index bd1c52792..d0f336f92 100644
--- a/contrib/ci/README.md
+++ b/contrib/ci/README.md
@@ -1,4 +1,4 @@
-# Continous integration scripts
+# Continuous integration scripts
## TravisCI
@@ -45,7 +45,7 @@ the future.
* `Z3_VERBOSE_BUILD_OUTPUT` - Show compile commands in CMake builds (`0` or `1`)
* `Z3_STATIC_BUILD` - Build Z3 binaries and libraries statically (`0` or `1`)
* `Z3_SYSTEM_TEST_GIT_REVISION` - Git revision of [z3test](https://github.com/Z3Prover/z3test). If empty lastest revision will be used.
-* `Z3_WARNINGS_AS_ERRORS` - Set the `WARNINGS_AS_ERRORS` CMake option pased to Z3 (`OFF`, `ON`, or `SERIOUS_ONLY`)
+* `Z3_WARNINGS_AS_ERRORS` - Set the `WARNINGS_AS_ERRORS` CMake option passed to Z3 (`OFF`, `ON`, or `SERIOUS_ONLY`)
### Linux
diff --git a/doc/z3api.cfg.in b/doc/z3api.cfg.in
index 9c4b464c2..e58b561c9 100644
--- a/doc/z3api.cfg.in
+++ b/doc/z3api.cfg.in
@@ -944,7 +944,7 @@ HTML_STYLESHEET =
# user-defined cascading style sheet that is included after the standard
# style sheets created by doxygen. Using this option one can overrule
# certain style aspects. This is preferred over using HTML_STYLESHEET
-# since it does not replace the standard style sheet and is therefor more
+# since it does not replace the standard style sheet and is therefore more
# robust against future updates. Doxygen will copy the style sheet file to
# the output directory.
@@ -1711,7 +1711,7 @@ UML_LOOK = NO
# the class node. If there are many fields or methods and many nodes the
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
# threshold limits the number of items for each type to make the size more
-# managable. Set this to 0 for no limit. Note that the threshold may be
+# manageable. Set this to 0 for no limit. Note that the threshold may be
# exceeded by 50% before the limit is enforced.
UML_LIMIT_NUM_FIELDS = 10
diff --git a/examples/c++/CMakeLists.txt b/examples/c++/CMakeLists.txt
index 0a41d6a93..52758889d 100644
--- a/examples/c++/CMakeLists.txt
+++ b/examples/c++/CMakeLists.txt
@@ -7,8 +7,8 @@ find_package(Z3
REQUIRED
CONFIG
# `NO_DEFAULT_PATH` is set so that -DZ3_DIR has to be passed to find Z3.
- # This should prevent us from accidently picking up an installed
- # copy of Z3. This is here to benefit Z3's build sytem when building
+ # This should prevent us from accidentally picking up an installed
+ # copy of Z3. This is here to benefit Z3's build system when building
# this project. When making your own project you probably shouldn't
# use this option.
NO_DEFAULT_PATH
diff --git a/examples/c++/example.cpp b/examples/c++/example.cpp
index 6faeb3edc..3089f5e2b 100644
--- a/examples/c++/example.cpp
+++ b/examples/c++/example.cpp
@@ -835,6 +835,17 @@ void tst_visit() {
visit(f);
}
+void tst_numeral() {
+ context c;
+ expr x = c.real_val("1/3");
+ double d = 0;
+ if (!x.is_numeral(d)) {
+ std::cout << x << " is not recognized as a numeral\n";
+ return;
+ }
+ std::cout << x << " is " << d << "\n";
+}
+
void incremental_example1() {
std::cout << "incremental example1\n";
context c;
@@ -1212,6 +1223,7 @@ int main() {
tactic_example9(); std::cout << "\n";
tactic_qe(); std::cout << "\n";
tst_visit(); std::cout << "\n";
+ tst_numeral(); std::cout << "\n";
incremental_example1(); std::cout << "\n";
incremental_example2(); std::cout << "\n";
incremental_example3(); std::cout << "\n";
diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt
index c47a4947a..e45c82d37 100644
--- a/examples/c/CMakeLists.txt
+++ b/examples/c/CMakeLists.txt
@@ -24,8 +24,8 @@ find_package(Z3
REQUIRED
CONFIG
# `NO_DEFAULT_PATH` is set so that -DZ3_DIR has to be passed to find Z3.
- # This should prevent us from accidently picking up an installed
- # copy of Z3. This is here to benefit Z3's build sytem when building
+ # This should prevent us from accidentally picking up an installed
+ # copy of Z3. This is here to benefit Z3's build system when building
# this project. When making your own project you probably shouldn't
# use this option.
NO_DEFAULT_PATH
diff --git a/examples/dotnet/Program.cs b/examples/dotnet/Program.cs
index 230aacf6f..47906add4 100644
--- a/examples/dotnet/Program.cs
+++ b/examples/dotnet/Program.cs
@@ -363,10 +363,10 @@ namespace test_mapi
Console.WriteLine("Model = " + s.Model);
- Console.WriteLine("Interpretation of MyArray:\n" + s.Model.FuncInterp(aex.FuncDecl));
+ //Console.WriteLine("Interpretation of MyArray:\n" + s.Model.ConstInterp(aex.FuncDecl));
Console.WriteLine("Interpretation of x:\n" + s.Model.ConstInterp(xc));
Console.WriteLine("Interpretation of f:\n" + s.Model.FuncInterp(fd));
- Console.WriteLine("Interpretation of MyArray as Term:\n" + s.Model.FuncInterp(aex.FuncDecl));
+ //Console.WriteLine("Interpretation of MyArray as Term:\n" + s.Model.ConstInterp(aex.FuncDecl));
}
///
diff --git a/examples/maxsat/CMakeLists.txt b/examples/maxsat/CMakeLists.txt
index 019243ecf..e59486297 100644
--- a/examples/maxsat/CMakeLists.txt
+++ b/examples/maxsat/CMakeLists.txt
@@ -11,8 +11,8 @@ find_package(Z3
REQUIRED
CONFIG
# `NO_DEFAULT_PATH` is set so that -DZ3_DIR has to be passed to find Z3.
- # This should prevent us from accidently picking up an installed
- # copy of Z3. This is here to benefit Z3's build sytem when building
+ # This should prevent us from accidentally picking up an installed
+ # copy of Z3. This is here to benefit Z3's build system when building
# this project. When making your own project you probably shouldn't
# use this option.
NO_DEFAULT_PATH
diff --git a/examples/msf/SolverFoundation.Plugin.Z3/Z3BaseSolver.cs b/examples/msf/SolverFoundation.Plugin.Z3/Z3BaseSolver.cs
index 1c82406be..5297d3e67 100644
--- a/examples/msf/SolverFoundation.Plugin.Z3/Z3BaseSolver.cs
+++ b/examples/msf/SolverFoundation.Plugin.Z3/Z3BaseSolver.cs
@@ -226,7 +226,7 @@ namespace Microsoft.SolverFoundation.Plugin.Z3
}
///
- /// Adds a MSF variable with the coresponding assertion to the Z3 variables.
+ /// Adds a MSF variable with the corresponding assertion to the Z3 variables.
///
/// The MSF id of the variable
internal void AddVariable(int vid)
diff --git a/examples/tptp/CMakeLists.txt b/examples/tptp/CMakeLists.txt
index 8e8dfb8ea..7870e5408 100644
--- a/examples/tptp/CMakeLists.txt
+++ b/examples/tptp/CMakeLists.txt
@@ -7,8 +7,8 @@ find_package(Z3
REQUIRED
CONFIG
# `NO_DEFAULT_PATH` is set so that -DZ3_DIR has to be passed to find Z3.
- # This should prevent us from accidently picking up an installed
- # copy of Z3. This is here to benefit Z3's build sytem when building
+ # This should prevent us from accidentally picking up an installed
+ # copy of Z3. This is here to benefit Z3's build system when building
# this project. When making your own project you probably shouldn't
# use this option.
NO_DEFAULT_PATH
diff --git a/examples/tptp/tptp5.cpp b/examples/tptp/tptp5.cpp
index facbf6c0a..882c2bbe2 100644
--- a/examples/tptp/tptp5.cpp
+++ b/examples/tptp/tptp5.cpp
@@ -233,7 +233,7 @@ class env {
void check_arity(unsigned num_args, unsigned arity) {
if (num_args != arity) {
- throw failure_ex("arity missmatch");
+ throw failure_ex("arity mismatch");
}
}
diff --git a/scripts/mk_project.py b/scripts/mk_project.py
index 174b498e7..8c037f2e5 100644
--- a/scripts/mk_project.py
+++ b/scripts/mk_project.py
@@ -9,7 +9,7 @@ from mk_util import *
# Z3 Project definition
def init_project_def():
- set_version(4, 8, 1, 0)
+ set_version(4, 8, 2, 0)
add_lib('util', [], includes2install = ['z3_version.h'])
add_lib('polynomial', ['util'], 'math/polynomial')
add_lib('sat', ['util'])
diff --git a/scripts/mk_util.py b/scripts/mk_util.py
index e5173931d..5b4d31d3e 100644
--- a/scripts/mk_util.py
+++ b/scripts/mk_util.py
@@ -3494,7 +3494,7 @@ class MakeRuleCmd(object):
needed commands used in Makefile rules
Note that several of the method are meant for use during ``make
install`` and ``make uninstall``. These methods correctly use
- ``$(PREFIX)`` and ``$(DESTDIR)`` and therefore are preferrable
+ ``$(PREFIX)`` and ``$(DESTDIR)`` and therefore are preferable
to writing commands manually which can be error prone.
"""
@classmethod
diff --git a/src/ackermannization/lackr_model_constructor.cpp b/src/ackermannization/lackr_model_constructor.cpp
index 420fbda10..df0aac15e 100644
--- a/src/ackermannization/lackr_model_constructor.cpp
+++ b/src/ackermannization/lackr_model_constructor.cpp
@@ -276,7 +276,7 @@ struct lackr_model_constructor::imp {
SASSERT(a->get_num_args() == 0);
func_decl * const fd = a->get_decl();
expr * val = m_abstr_model->get_const_interp(fd);
- if (val == nullptr) { // TODO: avoid model completetion?
+ if (val == nullptr) { // TODO: avoid model completion?
sort * s = fd->get_range();
val = m_abstr_model->get_some_value(s);
}
diff --git a/src/api/api_context.cpp b/src/api/api_context.cpp
index 4b3b85399..c236ba3e8 100644
--- a/src/api/api_context.cpp
+++ b/src/api/api_context.cpp
@@ -219,7 +219,7 @@ namespace api {
if (m_user_ref_count) {
// Corner case bug: n may be in m_last_result, and this is the only reference to n.
// When, we execute reset() it is deleted
- // To avoid this bug, I bump the reference counter before reseting m_last_result
+ // To avoid this bug, I bump the reference counter before resetting m_last_result
ast_ref node(n, m());
m_last_result.reset();
m_last_result.push_back(std::move(node));
diff --git a/src/api/api_datalog.cpp b/src/api/api_datalog.cpp
index c2f437391..06207cee6 100644
--- a/src/api/api_datalog.cpp
+++ b/src/api/api_datalog.cpp
@@ -210,7 +210,7 @@ extern "C" {
if (!out) {
return Z3_FALSE;
}
- // must start loggging here, since function uses Z3_get_sort_kind above
+ // must start logging here, since function uses Z3_get_sort_kind above
LOG_Z3_get_finite_domain_sort_size(c, s, out);
RESET_ERROR_CODE();
VERIFY(mk_c(c)->datalog_util().try_get_size(to_sort(s), *out));
diff --git a/src/api/api_numeral.cpp b/src/api/api_numeral.cpp
index 2891e8cc4..11afed82e 100644
--- a/src/api/api_numeral.cpp
+++ b/src/api/api_numeral.cpp
@@ -227,6 +227,11 @@ extern "C" {
Z3_CATCH_RETURN("");
}
+ double Z3_API Z3_get_numeral_double(Z3_context c, Z3_ast a) {
+ Z3_string s = Z3_get_numeral_decimal_string(c, a, 12);
+ return std::stod(std::string(s));
+ }
+
Z3_string Z3_API Z3_get_numeral_decimal_string(Z3_context c, Z3_ast a, unsigned precision) {
Z3_TRY;
LOG_Z3_get_numeral_decimal_string(c, a, precision);
diff --git a/src/api/c++/z3++.h b/src/api/c++/z3++.h
index 33af3ddde..07056746d 100644
--- a/src/api/c++/z3++.h
+++ b/src/api/c++/z3++.h
@@ -709,6 +709,7 @@ namespace z3 {
bool is_numeral_u(unsigned& i) const { bool r = 0 != Z3_get_numeral_uint(ctx(), m_ast, &i); check_error(); return r;}
bool is_numeral(std::string& s) const { if (!is_numeral()) return false; s = Z3_get_numeral_string(ctx(), m_ast); check_error(); return true; }
bool is_numeral(std::string& s, unsigned precision) const { if (!is_numeral()) return false; s = Z3_get_numeral_decimal_string(ctx(), m_ast, precision); check_error(); return true; }
+ bool is_numeral(double& d) const { if (!is_numeral()) return false; d = Z3_get_numeral_double(ctx(), m_ast); check_error(); return true; }
/**
\brief Return true if this expression is an application.
*/
diff --git a/src/api/dotnet/AST.cs b/src/api/dotnet/AST.cs
index 2460c50f0..0afff2c42 100644
--- a/src/api/dotnet/AST.cs
+++ b/src/api/dotnet/AST.cs
@@ -17,17 +17,16 @@ Notes:
--*/
+using System.Diagnostics;
using System;
using System.Collections;
using System.Collections.Generic;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
///
/// The abstract syntax tree (AST) class.
///
- [ContractVerification(true)]
public class AST : Z3Object, IComparable
{
///
@@ -114,8 +113,7 @@ namespace Microsoft.Z3
/// A copy of the AST which is associated with
public AST Translate(Context ctx)
{
- Contract.Requires(ctx != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ctx != null);
if (ReferenceEquals(Context, ctx))
return this;
@@ -202,14 +200,13 @@ namespace Microsoft.Z3
///
public string SExpr()
{
- Contract.Ensures(Contract.Result() != null);
return Native.Z3_ast_to_string(Context.nCtx, NativeObject);
}
#region Internal
- internal AST(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
- internal AST(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
+ internal AST(Context ctx) : base(ctx) { Debug.Assert(ctx != null); }
+ internal AST(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
internal class DecRefQueue : IDecRefQueue
{
@@ -246,8 +243,7 @@ namespace Microsoft.Z3
internal static AST Create(Context ctx, IntPtr obj)
{
- Contract.Requires(ctx != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ctx != null);
switch ((Z3_ast_kind)Native.Z3_get_ast_kind(ctx.nCtx, obj))
{
diff --git a/src/api/dotnet/ASTMap.cs b/src/api/dotnet/ASTMap.cs
index f7c1c5914..f678f71c3 100644
--- a/src/api/dotnet/ASTMap.cs
+++ b/src/api/dotnet/ASTMap.cs
@@ -17,15 +17,14 @@ Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
///
/// Map from AST to AST
///
- [ContractVerification(true)]
internal class ASTMap : Z3Object
{
///
@@ -35,7 +34,7 @@ namespace Microsoft.Z3
/// True if is a key in the map, false otherwise.
public bool Contains(AST k)
{
- Contract.Requires(k != null);
+ Debug.Assert(k != null);
return 0 != Native.Z3_ast_map_contains(Context.nCtx, NativeObject, k.NativeObject);
}
@@ -49,8 +48,7 @@ namespace Microsoft.Z3
/// An AST
public AST Find(AST k)
{
- Contract.Requires(k != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(k != null);
return new AST(Context, Native.Z3_ast_map_find(Context.nCtx, NativeObject, k.NativeObject));
}
@@ -62,8 +60,8 @@ namespace Microsoft.Z3
/// The value AST
public void Insert(AST k, AST v)
{
- Contract.Requires(k != null);
- Contract.Requires(v != null);
+ Debug.Assert(k != null);
+ Debug.Assert(v != null);
Native.Z3_ast_map_insert(Context.nCtx, NativeObject, k.NativeObject, v.NativeObject);
}
@@ -74,7 +72,7 @@ namespace Microsoft.Z3
/// An AST
public void Erase(AST k)
{
- Contract.Requires(k != null);
+ Debug.Assert(k != null);
Native.Z3_ast_map_erase(Context.nCtx, NativeObject, k.NativeObject);
}
@@ -119,12 +117,12 @@ namespace Microsoft.Z3
internal ASTMap(Context ctx, IntPtr obj)
: base(ctx, obj)
{
- Contract.Requires(ctx != null);
+ Debug.Assert(ctx != null);
}
internal ASTMap(Context ctx)
: base(ctx, Native.Z3_mk_ast_map(ctx.nCtx))
{
- Contract.Requires(ctx != null);
+ Debug.Assert(ctx != null);
}
internal class DecRefQueue : IDecRefQueue
diff --git a/src/api/dotnet/ASTVector.cs b/src/api/dotnet/ASTVector.cs
index 8b599ca48..fcfa6bd65 100644
--- a/src/api/dotnet/ASTVector.cs
+++ b/src/api/dotnet/ASTVector.cs
@@ -17,8 +17,8 @@ Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -45,13 +45,12 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
return new AST(Context, Native.Z3_ast_vector_get(Context.nCtx, NativeObject, i));
}
set
{
- Contract.Requires(value != null);
+ Debug.Assert(value != null);
Native.Z3_ast_vector_set(Context.nCtx, NativeObject, i, value.NativeObject);
}
@@ -73,7 +72,7 @@ namespace Microsoft.Z3
/// An AST
public void Push(AST a)
{
- Contract.Requires(a != null);
+ Debug.Assert(a != null);
Native.Z3_ast_vector_push(Context.nCtx, NativeObject, a.NativeObject);
}
@@ -85,8 +84,7 @@ namespace Microsoft.Z3
/// A new ASTVector
public ASTVector Translate(Context ctx)
{
- Contract.Requires(ctx != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ctx != null);
return new ASTVector(Context, Native.Z3_ast_vector_translate(Context.nCtx, NativeObject, ctx.nCtx));
}
@@ -232,8 +230,8 @@ namespace Microsoft.Z3
}
#region Internal
- internal ASTVector(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
- internal ASTVector(Context ctx) : base(ctx, Native.Z3_mk_ast_vector(ctx.nCtx)) { Contract.Requires(ctx != null); }
+ internal ASTVector(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
+ internal ASTVector(Context ctx) : base(ctx, Native.Z3_mk_ast_vector(ctx.nCtx)) { Debug.Assert(ctx != null); }
internal class DecRefQueue : IDecRefQueue
{
diff --git a/src/api/dotnet/AlgebraicNum.cs b/src/api/dotnet/AlgebraicNum.cs
index 3687e1f83..cd1e4e922 100644
--- a/src/api/dotnet/AlgebraicNum.cs
+++ b/src/api/dotnet/AlgebraicNum.cs
@@ -16,8 +16,8 @@ Author:
Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
#if !FRAMEWORK_LT_4
using System.Numerics;
@@ -28,7 +28,6 @@ namespace Microsoft.Z3
///
/// Algebraic numbers
///
- [ContractVerification(true)]
public class AlgebraicNum : ArithExpr
{
///
@@ -40,7 +39,6 @@ namespace Microsoft.Z3
/// A numeral Expr of sort Real
public RatNum ToUpper(uint precision)
{
- Contract.Ensures(Contract.Result() != null);
return new RatNum(Context, Native.Z3_get_algebraic_number_upper(Context.nCtx, NativeObject, precision));
}
@@ -54,7 +52,6 @@ namespace Microsoft.Z3
/// A numeral Expr of sort Real
public RatNum ToLower(uint precision)
{
- Contract.Ensures(Contract.Result() != null);
return new RatNum(Context, Native.Z3_get_algebraic_number_lower(Context.nCtx, NativeObject, precision));
}
@@ -65,7 +62,6 @@ namespace Microsoft.Z3
/// The result has at most decimal places.
public string ToDecimal(uint precision)
{
- Contract.Ensures(Contract.Result() != null);
return Native.Z3_get_numeral_decimal_string(Context.nCtx, NativeObject, precision);
}
@@ -74,7 +70,7 @@ namespace Microsoft.Z3
internal AlgebraicNum(Context ctx, IntPtr obj)
: base(ctx, obj)
{
- Contract.Requires(ctx != null);
+ Debug.Assert(ctx != null);
}
#endregion
}
diff --git a/src/api/dotnet/ApplyResult.cs b/src/api/dotnet/ApplyResult.cs
index db2922460..342bf3216 100644
--- a/src/api/dotnet/ApplyResult.cs
+++ b/src/api/dotnet/ApplyResult.cs
@@ -17,8 +17,8 @@ Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -26,7 +26,6 @@ namespace Microsoft.Z3
/// ApplyResult objects represent the result of an application of a
/// tactic to a goal. It contains the subgoals that were produced.
///
- [ContractVerification(true)]
public class ApplyResult : Z3Object
{
///
@@ -44,8 +43,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
- Contract.Ensures(Contract.Result().Length == this.NumSubgoals);
uint n = NumSubgoals;
Goal[] res = new Goal[n];
@@ -67,7 +64,7 @@ namespace Microsoft.Z3
internal ApplyResult(Context ctx, IntPtr obj)
: base(ctx, obj)
{
- Contract.Requires(ctx != null);
+ Debug.Assert(ctx != null);
}
internal class DecRefQueue : IDecRefQueue
diff --git a/src/api/dotnet/ArithExpr.cs b/src/api/dotnet/ArithExpr.cs
index b6beaef0c..53b9db21d 100644
--- a/src/api/dotnet/ArithExpr.cs
+++ b/src/api/dotnet/ArithExpr.cs
@@ -16,12 +16,12 @@ Author:
Notes:
--*/
+using System.Diagnostics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -35,7 +35,7 @@ namespace Microsoft.Z3
internal ArithExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{
- Contract.Requires(ctx != null);
+ Debug.Assert(ctx != null);
}
#endregion
@@ -45,7 +45,7 @@ namespace Microsoft.Z3
private static ArithExpr MkNum(ArithExpr e, double d) { return (ArithExpr)e.Context.MkNumeral(d.ToString(), e.Context.MkRealSort()); }
- /// Operator overloading for arithmetical divsion operator (over reals)
+ /// Operator overloading for arithmetical division operator (over reals)
public static ArithExpr operator /(ArithExpr a, ArithExpr b) { return a.Context.MkDiv(a, b); }
/// Operator overloading for arithmetical operator
diff --git a/src/api/dotnet/ArithSort.cs b/src/api/dotnet/ArithSort.cs
index f19774246..985aec7a9 100644
--- a/src/api/dotnet/ArithSort.cs
+++ b/src/api/dotnet/ArithSort.cs
@@ -17,8 +17,8 @@ Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -28,7 +28,7 @@ namespace Microsoft.Z3
public class ArithSort : Sort
{
#region Internal
- internal ArithSort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
+ internal ArithSort(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
#endregion
};
}
diff --git a/src/api/dotnet/ArrayExpr.cs b/src/api/dotnet/ArrayExpr.cs
index 6c51bfc5b..c53763886 100644
--- a/src/api/dotnet/ArrayExpr.cs
+++ b/src/api/dotnet/ArrayExpr.cs
@@ -16,12 +16,12 @@ Author:
Notes:
--*/
+using System.Diagnostics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -35,7 +35,7 @@ namespace Microsoft.Z3
internal ArrayExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{
- Contract.Requires(ctx != null);
+ Debug.Assert(ctx != null);
}
#endregion
}
diff --git a/src/api/dotnet/ArraySort.cs b/src/api/dotnet/ArraySort.cs
index 47a73ae1f..c5d15938e 100644
--- a/src/api/dotnet/ArraySort.cs
+++ b/src/api/dotnet/ArraySort.cs
@@ -17,15 +17,14 @@ Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
///
/// Array sorts.
///
- [ContractVerification(true)]
public class ArraySort : Sort
{
///
@@ -35,7 +34,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
return Sort.Create(Context, Native.Z3_get_array_sort_domain(Context.nCtx, NativeObject));
}
@@ -48,27 +46,26 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
return Sort.Create(Context, Native.Z3_get_array_sort_range(Context.nCtx, NativeObject));
}
}
#region Internal
- internal ArraySort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
+ internal ArraySort(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
internal ArraySort(Context ctx, Sort domain, Sort range)
: base(ctx, Native.Z3_mk_array_sort(ctx.nCtx, domain.NativeObject, range.NativeObject))
{
- Contract.Requires(ctx != null);
- Contract.Requires(domain != null);
- Contract.Requires(range != null);
+ Debug.Assert(ctx != null);
+ Debug.Assert(domain != null);
+ Debug.Assert(range != null);
}
internal ArraySort(Context ctx, Sort[] domain, Sort range)
: base(ctx, Native.Z3_mk_array_sort_n(ctx.nCtx, (uint)domain.Length, AST.ArrayToNative(domain), range.NativeObject))
{
- Contract.Requires(ctx != null);
- Contract.Requires(domain != null);
- Contract.Requires(range != null);
+ Debug.Assert(ctx != null);
+ Debug.Assert(domain != null);
+ Debug.Assert(range != null);
}
#endregion
};
diff --git a/src/api/dotnet/BitVecExpr.cs b/src/api/dotnet/BitVecExpr.cs
index b019f8845..3efa0e9bd 100644
--- a/src/api/dotnet/BitVecExpr.cs
+++ b/src/api/dotnet/BitVecExpr.cs
@@ -16,12 +16,12 @@ Author:
Notes:
--*/
+using System.Diagnostics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -41,7 +41,7 @@ namespace Microsoft.Z3
#region Internal
/// Constructor for BitVecExpr
- internal BitVecExpr(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
+ internal BitVecExpr(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
#endregion
}
}
diff --git a/src/api/dotnet/BitVecNum.cs b/src/api/dotnet/BitVecNum.cs
index 66054761a..5ee2d2ed8 100644
--- a/src/api/dotnet/BitVecNum.cs
+++ b/src/api/dotnet/BitVecNum.cs
@@ -16,8 +16,8 @@ Author:
Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
#if !FRAMEWORK_LT_4
using System.Numerics;
@@ -28,7 +28,6 @@ namespace Microsoft.Z3
///
/// Bit-vector numerals
///
- [ContractVerification(true)]
public class BitVecNum : BitVecExpr
{
///
@@ -109,7 +108,7 @@ namespace Microsoft.Z3
}
#region Internal
- internal BitVecNum(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
+ internal BitVecNum(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
#endregion
}
}
diff --git a/src/api/dotnet/BitVecSort.cs b/src/api/dotnet/BitVecSort.cs
index d865159f4..fb41e76fe 100644
--- a/src/api/dotnet/BitVecSort.cs
+++ b/src/api/dotnet/BitVecSort.cs
@@ -17,8 +17,8 @@ Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -36,7 +36,7 @@ namespace Microsoft.Z3
}
#region Internal
- internal BitVecSort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
+ internal BitVecSort(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
#endregion
};
}
diff --git a/src/api/dotnet/BoolExpr.cs b/src/api/dotnet/BoolExpr.cs
index c52109352..906090d2a 100644
--- a/src/api/dotnet/BoolExpr.cs
+++ b/src/api/dotnet/BoolExpr.cs
@@ -16,12 +16,12 @@ Author:
Notes:
--*/
+using System.Diagnostics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -32,7 +32,7 @@ namespace Microsoft.Z3
{
#region Internal
/// Constructor for BoolExpr
- internal BoolExpr(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
+ internal BoolExpr(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
#endregion
#region Operators
diff --git a/src/api/dotnet/BoolSort.cs b/src/api/dotnet/BoolSort.cs
index 50f44c858..7fd6706a3 100644
--- a/src/api/dotnet/BoolSort.cs
+++ b/src/api/dotnet/BoolSort.cs
@@ -17,8 +17,8 @@ Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -28,8 +28,8 @@ namespace Microsoft.Z3
public class BoolSort : Sort
{
#region Internal
- internal BoolSort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
- internal BoolSort(Context ctx) : base(ctx, Native.Z3_mk_bool_sort(ctx.nCtx)) { Contract.Requires(ctx != null); }
+ internal BoolSort(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
+ internal BoolSort(Context ctx) : base(ctx, Native.Z3_mk_bool_sort(ctx.nCtx)) { Debug.Assert(ctx != null); }
#endregion
};
}
diff --git a/src/api/dotnet/Constructor.cs b/src/api/dotnet/Constructor.cs
index 527b8bc13..f635d78e4 100644
--- a/src/api/dotnet/Constructor.cs
+++ b/src/api/dotnet/Constructor.cs
@@ -17,15 +17,14 @@ Notes:
--*/
+using System.Diagnostics;
using System;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
///
/// Constructors are used for datatype sorts.
///
- [ContractVerification(true)]
public class Constructor : Z3Object
{
///
@@ -46,7 +45,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
IntPtr constructor = IntPtr.Zero;
IntPtr tester = IntPtr.Zero;
IntPtr[] accessors = new IntPtr[n];
@@ -62,7 +60,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
IntPtr constructor = IntPtr.Zero;
IntPtr tester = IntPtr.Zero;
IntPtr[] accessors = new IntPtr[n];
@@ -78,7 +75,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
IntPtr constructor = IntPtr.Zero;
IntPtr tester = IntPtr.Zero;
IntPtr[] accessors = new IntPtr[n];
@@ -105,9 +101,9 @@ namespace Microsoft.Z3
Sort[] sorts, uint[] sortRefs)
: base(ctx)
{
- Contract.Requires(ctx != null);
- Contract.Requires(name != null);
- Contract.Requires(recognizer != null);
+ Debug.Assert(ctx != null);
+ Debug.Assert(name != null);
+ Debug.Assert(recognizer != null);
n = AST.ArrayLength(fieldNames);
diff --git a/src/api/dotnet/ConstructorList.cs b/src/api/dotnet/ConstructorList.cs
index d625b5ade..9b9ba8561 100644
--- a/src/api/dotnet/ConstructorList.cs
+++ b/src/api/dotnet/ConstructorList.cs
@@ -17,12 +17,12 @@ Notes:
--*/
+using System.Diagnostics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
@@ -43,14 +43,14 @@ namespace Microsoft.Z3
internal ConstructorList(Context ctx, IntPtr obj)
: base(ctx, obj)
{
- Contract.Requires(ctx != null);
+ Debug.Assert(ctx != null);
}
internal ConstructorList(Context ctx, Constructor[] constructors)
: base(ctx)
{
- Contract.Requires(ctx != null);
- Contract.Requires(constructors != null);
+ Debug.Assert(ctx != null);
+ Debug.Assert(constructors != null);
NativeObject = Native.Z3_mk_constructor_list(Context.nCtx, (uint)constructors.Length, Constructor.ArrayToNative(constructors));
}
diff --git a/src/api/dotnet/Context.cs b/src/api/dotnet/Context.cs
index c8decb59b..97541e31f 100644
--- a/src/api/dotnet/Context.cs
+++ b/src/api/dotnet/Context.cs
@@ -18,9 +18,9 @@ Notes:
--*/
using System;
+using System.Diagnostics;
using System.Collections.Generic;
using System.Runtime.InteropServices;
-using System.Diagnostics.Contracts;
using System.Linq;
namespace Microsoft.Z3
@@ -28,7 +28,6 @@ namespace Microsoft.Z3
///
/// The main interaction with Z3 happens via the Context.
///
- [ContractVerification(true)]
public class Context : IDisposable
{
#region Constructors
@@ -66,7 +65,7 @@ namespace Microsoft.Z3
public Context(Dictionary settings)
: base()
{
- Contract.Requires(settings != null);
+ Debug.Assert(settings != null);
lock (creation_lock)
{
@@ -90,7 +89,6 @@ namespace Microsoft.Z3
///
public IntSymbol MkSymbol(int i)
{
- Contract.Ensures(Contract.Result() != null);
return new IntSymbol(this, i);
}
@@ -100,7 +98,6 @@ namespace Microsoft.Z3
///
public StringSymbol MkSymbol(string name)
{
- Contract.Ensures(Contract.Result() != null);
return new StringSymbol(this, name);
}
@@ -110,10 +107,6 @@ namespace Microsoft.Z3
///
internal Symbol[] MkSymbols(string[] names)
{
- Contract.Ensures(names == null || Contract.Result() != null);
- Contract.Ensures(names != null || Contract.Result() == null);
- Contract.Ensures(Contract.Result() == null || Contract.Result().Length == names.Length);
- Contract.Ensures(Contract.Result() == null || Contract.ForAll(Contract.Result(), s => s != null));
if (names == null) return null;
Symbol[] result = new Symbol[names.Length];
@@ -135,7 +128,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
if (m_boolSort == null) m_boolSort = new BoolSort(this); return m_boolSort;
}
}
@@ -147,7 +139,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
if (m_intSort == null) m_intSort = new IntSort(this); return m_intSort;
}
}
@@ -160,7 +151,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
if (m_realSort == null) m_realSort = new RealSort(this); return m_realSort;
}
}
@@ -172,7 +162,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
if (m_stringSort == null) m_stringSort = new SeqSort(this, Native.Z3_mk_string_sort(nCtx));
return m_stringSort;
}
@@ -184,7 +173,6 @@ namespace Microsoft.Z3
///
public BoolSort MkBoolSort()
{
- Contract.Ensures(Contract.Result() != null);
return new BoolSort(this);
}
@@ -193,8 +181,7 @@ namespace Microsoft.Z3
///
public UninterpretedSort MkUninterpretedSort(Symbol s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
CheckContextMatch(s);
return new UninterpretedSort(this, s);
@@ -205,7 +192,6 @@ namespace Microsoft.Z3
///
public UninterpretedSort MkUninterpretedSort(string str)
{
- Contract.Ensures(Contract.Result() != null);
return MkUninterpretedSort(MkSymbol(str));
}
@@ -215,7 +201,6 @@ namespace Microsoft.Z3
///
public IntSort MkIntSort()
{
- Contract.Ensures(Contract.Result() != null);
return new IntSort(this);
}
@@ -225,7 +210,6 @@ namespace Microsoft.Z3
///
public RealSort MkRealSort()
{
- Contract.Ensures(Contract.Result() != null);
return new RealSort(this);
}
@@ -234,7 +218,6 @@ namespace Microsoft.Z3
///
public BitVecSort MkBitVecSort(uint size)
{
- Contract.Ensures(Contract.Result() != null);
return new BitVecSort(this, Native.Z3_mk_bv_sort(nCtx, size));
}
@@ -245,8 +228,7 @@ namespace Microsoft.Z3
///
public SeqSort MkSeqSort(Sort s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
return new SeqSort(this, Native.Z3_mk_seq_sort(nCtx, s.NativeObject));
}
@@ -255,8 +237,7 @@ namespace Microsoft.Z3
///
public ReSort MkReSort(SeqSort s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
return new ReSort(this, Native.Z3_mk_re_sort(nCtx, s.NativeObject));
}
@@ -265,9 +246,8 @@ namespace Microsoft.Z3
///
public ArraySort MkArraySort(Sort domain, Sort range)
{
- Contract.Requires(domain != null);
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(domain != null);
+ Debug.Assert(range != null);
CheckContextMatch(domain);
CheckContextMatch(range);
@@ -279,9 +259,8 @@ namespace Microsoft.Z3
///
public ArraySort MkArraySort(Sort[] domain, Sort range)
{
- Contract.Requires(domain != null);
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(domain != null);
+ Debug.Assert(range != null);
CheckContextMatch(domain);
CheckContextMatch(range);
@@ -293,11 +272,10 @@ namespace Microsoft.Z3
///
public TupleSort MkTupleSort(Symbol name, Symbol[] fieldNames, Sort[] fieldSorts)
{
- Contract.Requires(name != null);
- Contract.Requires(fieldNames != null);
- Contract.Requires(Contract.ForAll(fieldNames, fn => fn != null));
- Contract.Requires(fieldSorts == null || Contract.ForAll(fieldSorts, fs => fs != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
+ Debug.Assert(fieldNames != null);
+ Debug.Assert(fieldNames.All(fn => fn != null));
+ Debug.Assert(fieldSorts == null || fieldSorts.All(fs => fs != null));
CheckContextMatch(name);
CheckContextMatch(fieldNames);
@@ -310,11 +288,10 @@ namespace Microsoft.Z3
///
public EnumSort MkEnumSort(Symbol name, params Symbol[] enumNames)
{
- Contract.Requires(name != null);
- Contract.Requires(enumNames != null);
- Contract.Requires(Contract.ForAll(enumNames, f => f != null));
+ Debug.Assert(name != null);
+ Debug.Assert(enumNames != null);
+ Debug.Assert(enumNames.All(f => f != null));
- Contract.Ensures(Contract.Result() != null);
CheckContextMatch(name);
CheckContextMatch(enumNames);
@@ -326,8 +303,7 @@ namespace Microsoft.Z3
///
public EnumSort MkEnumSort(string name, params string[] enumNames)
{
- Contract.Requires(enumNames != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(enumNames != null);
return new EnumSort(this, MkSymbol(name), MkSymbols(enumNames));
}
@@ -337,9 +313,8 @@ namespace Microsoft.Z3
///
public ListSort MkListSort(Symbol name, Sort elemSort)
{
- Contract.Requires(name != null);
- Contract.Requires(elemSort != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
+ Debug.Assert(elemSort != null);
CheckContextMatch(name);
CheckContextMatch(elemSort);
@@ -351,8 +326,7 @@ namespace Microsoft.Z3
///
public ListSort MkListSort(string name, Sort elemSort)
{
- Contract.Requires(elemSort != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(elemSort != null);
CheckContextMatch(elemSort);
return new ListSort(this, MkSymbol(name), elemSort);
@@ -366,8 +340,7 @@ namespace Microsoft.Z3
/// The size of the sort
public FiniteDomainSort MkFiniteDomainSort(Symbol name, ulong size)
{
- Contract.Requires(name != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
CheckContextMatch(name);
return new FiniteDomainSort(this, name, size);
@@ -383,7 +356,6 @@ namespace Microsoft.Z3
/// The size of the sort
public FiniteDomainSort MkFiniteDomainSort(string name, ulong size)
{
- Contract.Ensures(Contract.Result() != null);
return new FiniteDomainSort(this, MkSymbol(name), size);
}
@@ -402,9 +374,8 @@ namespace Microsoft.Z3
/// referring to one of the recursive datatypes that is declared.
public Constructor MkConstructor(Symbol name, Symbol recognizer, Symbol[] fieldNames = null, Sort[] sorts = null, uint[] sortRefs = null)
{
- Contract.Requires(name != null);
- Contract.Requires(recognizer != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
+ Debug.Assert(recognizer != null);
return new Constructor(this, name, recognizer, fieldNames, sorts, sortRefs);
}
@@ -420,7 +391,6 @@ namespace Microsoft.Z3
///
public Constructor MkConstructor(string name, string recognizer, string[] fieldNames = null, Sort[] sorts = null, uint[] sortRefs = null)
{
- Contract.Ensures(Contract.Result() != null);
return new Constructor(this, MkSymbol(name), MkSymbol(recognizer), MkSymbols(fieldNames), sorts, sortRefs);
}
@@ -430,11 +400,10 @@ namespace Microsoft.Z3
///
public DatatypeSort MkDatatypeSort(Symbol name, Constructor[] constructors)
{
- Contract.Requires(name != null);
- Contract.Requires(constructors != null);
- Contract.Requires(Contract.ForAll(constructors, c => c != null));
+ Debug.Assert(name != null);
+ Debug.Assert(constructors != null);
+ Debug.Assert(constructors.All(c => c != null));
- Contract.Ensures(Contract.Result() != null);
CheckContextMatch(name);
CheckContextMatch(constructors);
@@ -446,9 +415,8 @@ namespace Microsoft.Z3
///
public DatatypeSort MkDatatypeSort(string name, Constructor[] constructors)
{
- Contract.Requires(constructors != null);
- Contract.Requires(Contract.ForAll(constructors, c => c != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(constructors != null);
+ Debug.Assert(constructors.All(c => c != null));
CheckContextMatch(constructors);
return new DatatypeSort(this, MkSymbol(name), constructors);
@@ -461,12 +429,11 @@ namespace Microsoft.Z3
/// list of constructors, one list per sort.
public DatatypeSort[] MkDatatypeSorts(Symbol[] names, Constructor[][] c)
{
- Contract.Requires(names != null);
- Contract.Requires(c != null);
- Contract.Requires(names.Length == c.Length);
- Contract.Requires(Contract.ForAll(0, c.Length, j => c[j] != null));
- Contract.Requires(Contract.ForAll(names, name => name != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(names != null);
+ Debug.Assert(c != null);
+ Debug.Assert(names.Length == c.Length);
+ //Debug.Assert(Contract.ForAll(0, c.Length, j => c[j] != null));
+ Debug.Assert(names.All(name => name != null));
CheckContextMatch(names);
uint n = (uint)names.Length;
@@ -475,7 +442,6 @@ namespace Microsoft.Z3
for (uint i = 0; i < n; i++)
{
Constructor[] constructor = c[i];
- Contract.Assume(Contract.ForAll(constructor, arr => arr != null), "Clousot does not support yet quantified formula on multidimensional arrays");
CheckContextMatch(constructor);
cla[i] = new ConstructorList(this, constructor);
n_constr[i] = cla[i].NativeObject;
@@ -496,12 +462,11 @@ namespace Microsoft.Z3
///
public DatatypeSort[] MkDatatypeSorts(string[] names, Constructor[][] c)
{
- Contract.Requires(names != null);
- Contract.Requires(c != null);
- Contract.Requires(names.Length == c.Length);
- Contract.Requires(Contract.ForAll(0, c.Length, j => c[j] != null));
- Contract.Requires(Contract.ForAll(names, name => name != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(names != null);
+ Debug.Assert(c != null);
+ Debug.Assert(names.Length == c.Length);
+ //Debug.Assert(Contract.ForAll(0, c.Length, j => c[j] != null));
+ //Debug.Assert(names.All(name => name != null));
return MkDatatypeSorts(MkSymbols(names), c);
}
@@ -528,10 +493,9 @@ namespace Microsoft.Z3
///
public FuncDecl MkFuncDecl(Symbol name, Sort[] domain, Sort range)
{
- Contract.Requires(name != null);
- Contract.Requires(range != null);
- Contract.Requires(Contract.ForAll(domain, d => d != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
+ Debug.Assert(range != null);
+ Debug.Assert(domain.All(d => d != null));
CheckContextMatch(name);
CheckContextMatch(domain);
@@ -544,10 +508,9 @@ namespace Microsoft.Z3
///
public FuncDecl MkFuncDecl(Symbol name, Sort domain, Sort range)
{
- Contract.Requires(name != null);
- Contract.Requires(domain != null);
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
+ Debug.Assert(domain != null);
+ Debug.Assert(range != null);
CheckContextMatch(name);
CheckContextMatch(domain);
@@ -561,9 +524,8 @@ namespace Microsoft.Z3
///
public FuncDecl MkFuncDecl(string name, Sort[] domain, Sort range)
{
- Contract.Requires(range != null);
- Contract.Requires(Contract.ForAll(domain, d => d != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(range != null);
+ Debug.Assert(domain.All(d => d != null));
CheckContextMatch(domain);
CheckContextMatch(range);
@@ -575,9 +537,8 @@ namespace Microsoft.Z3
///
public FuncDecl MkFuncDecl(string name, Sort domain, Sort range)
{
- Contract.Requires(range != null);
- Contract.Requires(domain != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(range != null);
+ Debug.Assert(domain != null);
CheckContextMatch(domain);
CheckContextMatch(range);
@@ -592,9 +553,8 @@ namespace Microsoft.Z3
///
public FuncDecl MkFreshFuncDecl(string prefix, Sort[] domain, Sort range)
{
- Contract.Requires(range != null);
- Contract.Requires(Contract.ForAll(domain, d => d != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(range != null);
+ Debug.Assert(domain.All(d => d != null));
CheckContextMatch(domain);
CheckContextMatch(range);
@@ -606,9 +566,8 @@ namespace Microsoft.Z3
///
public FuncDecl MkConstDecl(Symbol name, Sort range)
{
- Contract.Requires(name != null);
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
+ Debug.Assert(range != null);
CheckContextMatch(name);
CheckContextMatch(range);
@@ -620,8 +579,7 @@ namespace Microsoft.Z3
///
public FuncDecl MkConstDecl(string name, Sort range)
{
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(range != null);
CheckContextMatch(range);
return new FuncDecl(this, MkSymbol(name), null, range);
@@ -634,8 +592,7 @@ namespace Microsoft.Z3
///
public FuncDecl MkFreshConstDecl(string prefix, Sort range)
{
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(range != null);
CheckContextMatch(range);
return new FuncDecl(this, prefix, null, range);
@@ -650,8 +607,7 @@ namespace Microsoft.Z3
/// The sort of the variable
public Expr MkBound(uint index, Sort ty)
{
- Contract.Requires(ty != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ty != null);
return Expr.Create(this, Native.Z3_mk_bound(nCtx, index, ty.NativeObject));
}
@@ -663,14 +619,10 @@ namespace Microsoft.Z3
///
public Pattern MkPattern(params Expr[] terms)
{
- Contract.Requires(terms != null);
+ Debug.Assert(terms != null);
if (terms.Length == 0)
throw new Z3Exception("Cannot create a pattern from zero terms");
- Contract.Ensures(Contract.Result() != null);
-
- Contract.EndContractBlock();
-
IntPtr[] termsNative = AST.ArrayToNative(terms);
return new Pattern(this, Native.Z3_mk_pattern(nCtx, (uint)terms.Length, termsNative));
}
@@ -682,9 +634,8 @@ namespace Microsoft.Z3
///
public Expr MkConst(Symbol name, Sort range)
{
- Contract.Requires(name != null);
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
+ Debug.Assert(range != null);
CheckContextMatch(name);
CheckContextMatch(range);
@@ -697,8 +648,7 @@ namespace Microsoft.Z3
///
public Expr MkConst(string name, Sort range)
{
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(range != null);
return MkConst(MkSymbol(name), range);
}
@@ -709,8 +659,7 @@ namespace Microsoft.Z3
///
public Expr MkFreshConst(string prefix, Sort range)
{
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(range != null);
CheckContextMatch(range);
return Expr.Create(this, Native.Z3_mk_fresh_const(nCtx, prefix, range.NativeObject));
@@ -722,8 +671,7 @@ namespace Microsoft.Z3
/// A decl of a 0-arity function
public Expr MkConst(FuncDecl f)
{
- Contract.Requires(f != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(f != null);
return MkApp(f);
}
@@ -733,8 +681,7 @@ namespace Microsoft.Z3
///
public BoolExpr MkBoolConst(Symbol name)
{
- Contract.Requires(name != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
return (BoolExpr)MkConst(name, BoolSort);
}
@@ -744,7 +691,6 @@ namespace Microsoft.Z3
///
public BoolExpr MkBoolConst(string name)
{
- Contract.Ensures(Contract.Result() != null);
return (BoolExpr)MkConst(MkSymbol(name), BoolSort);
}
@@ -754,8 +700,7 @@ namespace Microsoft.Z3
///
public IntExpr MkIntConst(Symbol name)
{
- Contract.Requires(name != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
return (IntExpr)MkConst(name, IntSort);
}
@@ -765,8 +710,7 @@ namespace Microsoft.Z3
///
public IntExpr MkIntConst(string name)
{
- Contract.Requires(name != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
return (IntExpr)MkConst(name, IntSort);
}
@@ -776,8 +720,7 @@ namespace Microsoft.Z3
///
public RealExpr MkRealConst(Symbol name)
{
- Contract.Requires(name != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
return (RealExpr)MkConst(name, RealSort);
}
@@ -787,7 +730,6 @@ namespace Microsoft.Z3
///
public RealExpr MkRealConst(string name)
{
- Contract.Ensures(Contract.Result() != null);
return (RealExpr)MkConst(name, RealSort);
}
@@ -797,8 +739,7 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVConst(Symbol name, uint size)
{
- Contract.Requires(name != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
return (BitVecExpr)MkConst(name, MkBitVecSort(size));
}
@@ -808,7 +749,6 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVConst(string name, uint size)
{
- Contract.Ensures(Contract.Result() != null);
return (BitVecExpr)MkConst(name, MkBitVecSort(size));
}
@@ -820,9 +760,8 @@ namespace Microsoft.Z3
///
public Expr MkApp(FuncDecl f, params Expr[] args)
{
- Contract.Requires(f != null);
- Contract.Requires(args == null || Contract.ForAll(args, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(f != null);
+ Debug.Assert(args == null || args.All(a => a != null));
CheckContextMatch(f);
CheckContextMatch(args);
@@ -834,9 +773,8 @@ namespace Microsoft.Z3
///
public Expr MkApp(FuncDecl f, IEnumerable args)
{
- Contract.Requires(f != null);
- Contract.Requires(args == null || Contract.ForAll(args, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(f != null);
+ Debug.Assert(args == null || args.All( a => a != null));
CheckContextMatch(f);
CheckContextMatch(args);
@@ -849,7 +787,6 @@ namespace Microsoft.Z3
///
public BoolExpr MkTrue()
{
- Contract.Ensures(Contract.Result() != null);
return new BoolExpr(this, Native.Z3_mk_true(nCtx));
}
@@ -859,7 +796,6 @@ namespace Microsoft.Z3
///
public BoolExpr MkFalse()
{
- Contract.Ensures(Contract.Result() != null);
return new BoolExpr(this, Native.Z3_mk_false(nCtx));
}
@@ -869,7 +805,6 @@ namespace Microsoft.Z3
///
public BoolExpr MkBool(bool value)
{
- Contract.Ensures(Contract.Result() != null);
return value ? MkTrue() : MkFalse();
}
@@ -879,9 +814,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkEq(Expr x, Expr y)
{
- Contract.Requires(x != null);
- Contract.Requires(y != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(x != null);
+ Debug.Assert(y != null);
CheckContextMatch(x);
CheckContextMatch(y);
@@ -893,10 +827,9 @@ namespace Microsoft.Z3
///
public BoolExpr MkDistinct(params Expr[] args)
{
- Contract.Requires(args != null);
- Contract.Requires(Contract.ForAll(args, a => a != null));
+ Debug.Assert(args != null);
+ Debug.Assert(args.All(a => a != null));
- Contract.Ensures(Contract.Result() != null);
CheckContextMatch(args);
return new BoolExpr(this, Native.Z3_mk_distinct(nCtx, (uint)args.Length, AST.ArrayToNative(args)));
@@ -907,8 +840,7 @@ namespace Microsoft.Z3
///
public BoolExpr MkNot(BoolExpr a)
{
- Contract.Requires(a != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(a != null);
CheckContextMatch(a);
return new BoolExpr(this, Native.Z3_mk_not(nCtx, a.NativeObject));
@@ -922,10 +854,9 @@ namespace Microsoft.Z3
/// An expression with the same sort as
public Expr MkITE(BoolExpr t1, Expr t2, Expr t3)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Requires(t3 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
+ Debug.Assert(t3 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -938,9 +869,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkIff(BoolExpr t1, BoolExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -952,9 +882,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkImplies(BoolExpr t1, BoolExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -966,9 +895,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkXor(BoolExpr t1, BoolExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -980,9 +908,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkAnd(params BoolExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return new BoolExpr(this, Native.Z3_mk_and(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -993,9 +920,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkAnd(IEnumerable t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return new BoolExpr(this, Native.Z3_mk_and(nCtx, (uint)t.Count(), AST.EnumToNative(t)));
}
@@ -1005,9 +931,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkOr(params BoolExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return new BoolExpr(this, Native.Z3_mk_or(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -1019,9 +944,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkOr(IEnumerable t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return new BoolExpr(this, Native.Z3_mk_or(nCtx, (uint)t.Count(), AST.EnumToNative(t)));
@@ -1035,9 +959,8 @@ namespace Microsoft.Z3
///
public ArithExpr MkAdd(params ArithExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return (ArithExpr)Expr.Create(this, Native.Z3_mk_add(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -1048,9 +971,8 @@ namespace Microsoft.Z3
///
public ArithExpr MkAdd(IEnumerable t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return (ArithExpr)Expr.Create(this, Native.Z3_mk_add(nCtx, (uint)t.Count(), AST.EnumToNative(t)));
@@ -1061,9 +983,8 @@ namespace Microsoft.Z3
///
public ArithExpr MkMul(params ArithExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return (ArithExpr)Expr.Create(this, Native.Z3_mk_mul(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -1074,9 +995,8 @@ namespace Microsoft.Z3
///
public ArithExpr MkMul(IEnumerable t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return (ArithExpr)Expr.Create(this, Native.Z3_mk_mul(nCtx, (uint)t.Count(), AST.EnumToNative(t)));
@@ -1087,9 +1007,8 @@ namespace Microsoft.Z3
///
public ArithExpr MkSub(params ArithExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return (ArithExpr)Expr.Create(this, Native.Z3_mk_sub(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -1100,8 +1019,7 @@ namespace Microsoft.Z3
///
public ArithExpr MkUnaryMinus(ArithExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return (ArithExpr)Expr.Create(this, Native.Z3_mk_unary_minus(nCtx, t.NativeObject));
@@ -1112,9 +1030,8 @@ namespace Microsoft.Z3
///
public ArithExpr MkDiv(ArithExpr t1, ArithExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1127,9 +1044,8 @@ namespace Microsoft.Z3
/// The arguments must have int type.
public IntExpr MkMod(IntExpr t1, IntExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1142,9 +1058,8 @@ namespace Microsoft.Z3
/// The arguments must have int type.
public IntExpr MkRem(IntExpr t1, IntExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1156,9 +1071,8 @@ namespace Microsoft.Z3
///
public ArithExpr MkPower(ArithExpr t1, ArithExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1170,9 +1084,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkLt(ArithExpr t1, ArithExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1184,9 +1097,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkLe(ArithExpr t1, ArithExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1198,9 +1110,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkGt(ArithExpr t1, ArithExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1212,9 +1123,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkGe(ArithExpr t1, ArithExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1233,8 +1143,7 @@ namespace Microsoft.Z3
///
public RealExpr MkInt2Real(IntExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new RealExpr(this, Native.Z3_mk_int2real(nCtx, t.NativeObject));
@@ -1249,8 +1158,7 @@ namespace Microsoft.Z3
///
public IntExpr MkReal2Int(RealExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new IntExpr(this, Native.Z3_mk_real2int(nCtx, t.NativeObject));
@@ -1261,8 +1169,7 @@ namespace Microsoft.Z3
///
public BoolExpr MkIsInteger(RealExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BoolExpr(this, Native.Z3_mk_is_int(nCtx, t.NativeObject));
@@ -1276,8 +1183,7 @@ namespace Microsoft.Z3
/// The argument must have a bit-vector sort.
public BitVecExpr MkBVNot(BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_bvnot(nCtx, t.NativeObject));
@@ -1289,8 +1195,7 @@ namespace Microsoft.Z3
/// The argument must have a bit-vector sort.
public BitVecExpr MkBVRedAND(BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_bvredand(nCtx, t.NativeObject));
@@ -1302,8 +1207,7 @@ namespace Microsoft.Z3
/// The argument must have a bit-vector sort.
public BitVecExpr MkBVRedOR(BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_bvredor(nCtx, t.NativeObject));
@@ -1315,9 +1219,8 @@ namespace Microsoft.Z3
/// The arguments must have a bit-vector sort.
public BitVecExpr MkBVAND(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1330,9 +1233,8 @@ namespace Microsoft.Z3
/// The arguments must have a bit-vector sort.
public BitVecExpr MkBVOR(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1345,9 +1247,8 @@ namespace Microsoft.Z3
/// The arguments must have a bit-vector sort.
public BitVecExpr MkBVXOR(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1360,9 +1261,8 @@ namespace Microsoft.Z3
/// The arguments must have a bit-vector sort.
public BitVecExpr MkBVNAND(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1375,9 +1275,8 @@ namespace Microsoft.Z3
/// The arguments must have a bit-vector sort.
public BitVecExpr MkBVNOR(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1390,9 +1289,8 @@ namespace Microsoft.Z3
/// The arguments must have a bit-vector sort.
public BitVecExpr MkBVXNOR(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1405,8 +1303,7 @@ namespace Microsoft.Z3
/// The arguments must have a bit-vector sort.
public BitVecExpr MkBVNeg(BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_bvneg(nCtx, t.NativeObject));
@@ -1418,9 +1315,8 @@ namespace Microsoft.Z3
/// The arguments must have the same bit-vector sort.
public BitVecExpr MkBVAdd(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1433,9 +1329,8 @@ namespace Microsoft.Z3
/// The arguments must have the same bit-vector sort.
public BitVecExpr MkBVSub(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1448,9 +1343,8 @@ namespace Microsoft.Z3
/// The arguments must have the same bit-vector sort.
public BitVecExpr MkBVMul(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1468,9 +1362,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVUDiv(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1492,9 +1385,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVSDiv(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1511,9 +1403,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVURem(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1532,9 +1423,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVSRem(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1550,9 +1440,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVSMod(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1567,9 +1456,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVULT(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1584,9 +1472,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVSLT(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1601,9 +1488,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVULE(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1618,9 +1504,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVSLE(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1635,9 +1520,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVUGE(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1652,9 +1536,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVSGE(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1669,9 +1552,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVUGT(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1686,9 +1568,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVSGT(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1707,9 +1588,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkConcat(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1727,8 +1607,7 @@ namespace Microsoft.Z3
///
public BitVecExpr MkExtract(uint high, uint low, BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_extract(nCtx, high, low, t.NativeObject));
@@ -1744,8 +1623,7 @@ namespace Microsoft.Z3
///
public BitVecExpr MkSignExt(uint i, BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_sign_ext(nCtx, i, t.NativeObject));
@@ -1762,8 +1640,7 @@ namespace Microsoft.Z3
///
public BitVecExpr MkZeroExt(uint i, BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_zero_ext(nCtx, i, t.NativeObject));
@@ -1777,8 +1654,7 @@ namespace Microsoft.Z3
///
public BitVecExpr MkRepeat(uint i, BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_repeat(nCtx, i, t.NativeObject));
@@ -1798,9 +1674,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVSHL(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1821,9 +1696,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVLSHR(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1846,9 +1720,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVASHR(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1864,8 +1737,7 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVRotateLeft(uint i, BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_rotate_left(nCtx, i, t.NativeObject));
@@ -1880,8 +1752,7 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVRotateRight(uint i, BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_rotate_right(nCtx, i, t.NativeObject));
@@ -1896,9 +1767,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVRotateLeft(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1914,9 +1784,8 @@ namespace Microsoft.Z3
///
public BitVecExpr MkBVRotateRight(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1935,8 +1804,7 @@ namespace Microsoft.Z3
///
public BitVecExpr MkInt2BV(uint n, IntExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BitVecExpr(this, Native.Z3_mk_int2bv(nCtx, n, t.NativeObject));
@@ -1959,8 +1827,7 @@ namespace Microsoft.Z3
///
public IntExpr MkBV2Int(BitVecExpr t, bool signed)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new IntExpr(this, Native.Z3_mk_bv2int(nCtx, t.NativeObject, (byte)(signed ? 1 : 0)));
@@ -1974,9 +1841,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVAddNoOverflow(BitVecExpr t1, BitVecExpr t2, bool isSigned)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -1991,9 +1857,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVAddNoUnderflow(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -2008,9 +1873,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVSubNoOverflow(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -2025,9 +1889,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVSubNoUnderflow(BitVecExpr t1, BitVecExpr t2, bool isSigned)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -2042,9 +1905,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVSDivNoOverflow(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -2059,8 +1921,7 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVNegNoOverflow(BitVecExpr t)
{
- Contract.Requires(t != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
CheckContextMatch(t);
return new BoolExpr(this, Native.Z3_mk_bvneg_no_overflow(nCtx, t.NativeObject));
@@ -2074,9 +1935,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVMulNoOverflow(BitVecExpr t1, BitVecExpr t2, bool isSigned)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -2091,9 +1951,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkBVMulNoUnderflow(BitVecExpr t1, BitVecExpr t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
@@ -2107,10 +1966,9 @@ namespace Microsoft.Z3
///
public ArrayExpr MkArrayConst(Symbol name, Sort domain, Sort range)
{
- Contract.Requires(name != null);
- Contract.Requires(domain != null);
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(name != null);
+ Debug.Assert(domain != null);
+ Debug.Assert(range != null);
return (ArrayExpr)MkConst(name, MkArraySort(domain, range));
}
@@ -2120,9 +1978,8 @@ namespace Microsoft.Z3
///
public ArrayExpr MkArrayConst(string name, Sort domain, Sort range)
{
- Contract.Requires(domain != null);
- Contract.Requires(range != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(domain != null);
+ Debug.Assert(range != null);
return (ArrayExpr)MkConst(MkSymbol(name), MkArraySort(domain, range));
}
@@ -2143,9 +2000,8 @@ namespace Microsoft.Z3
///
public Expr MkSelect(ArrayExpr a, Expr i)
{
- Contract.Requires(a != null);
- Contract.Requires(i != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(a != null);
+ Debug.Assert(i != null);
CheckContextMatch(a);
CheckContextMatch(i);
@@ -2167,9 +2023,8 @@ namespace Microsoft.Z3
///
public Expr MkSelect(ArrayExpr a, params Expr[] args)
{
- Contract.Requires(a != null);
- Contract.Requires(args != null && Contract.ForAll(args, n => n != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(a != null);
+ Debug.Assert(args != null && args.All(n => n != null));
CheckContextMatch(a);
CheckContextMatch(args);
@@ -2196,10 +2051,9 @@ namespace Microsoft.Z3
///
public ArrayExpr MkStore(ArrayExpr a, Expr i, Expr v)
{
- Contract.Requires(a != null);
- Contract.Requires(i != null);
- Contract.Requires(v != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(a != null);
+ Debug.Assert(i != null);
+ Debug.Assert(v != null);
CheckContextMatch(a);
CheckContextMatch(i);
@@ -2227,10 +2081,9 @@ namespace Microsoft.Z3
///
public ArrayExpr MkStore(ArrayExpr a, Expr[] args, Expr v)
{
- Contract.Requires(a != null);
- Contract.Requires(args != null);
- Contract.Requires(v != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(a != null);
+ Debug.Assert(args != null);
+ Debug.Assert(v != null);
CheckContextMatch(args);
CheckContextMatch(a);
@@ -2249,9 +2102,8 @@ namespace Microsoft.Z3
///
public ArrayExpr MkConstArray(Sort domain, Expr v)
{
- Contract.Requires(domain != null);
- Contract.Requires(v != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(domain != null);
+ Debug.Assert(v != null);
CheckContextMatch(domain);
CheckContextMatch(v);
@@ -2271,9 +2123,8 @@ namespace Microsoft.Z3
///
public ArrayExpr MkMap(FuncDecl f, params ArrayExpr[] args)
{
- Contract.Requires(f != null);
- Contract.Requires(args == null || Contract.ForAll(args, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(f != null);
+ Debug.Assert(args == null || args.All(a => a != null));
CheckContextMatch(f);
CheckContextMatch(args);
@@ -2289,8 +2140,7 @@ namespace Microsoft.Z3
///
public Expr MkTermArray(ArrayExpr array)
{
- Contract.Requires(array != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(array != null);
CheckContextMatch(array);
return Expr.Create(this, Native.Z3_mk_array_default(nCtx, array.NativeObject));
@@ -2301,9 +2151,8 @@ namespace Microsoft.Z3
///
public Expr MkArrayExt(ArrayExpr arg1, ArrayExpr arg2)
{
- Contract.Requires(arg1 != null);
- Contract.Requires(arg2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(arg1 != null);
+ Debug.Assert(arg2 != null);
CheckContextMatch(arg1);
CheckContextMatch(arg2);
@@ -2318,8 +2167,7 @@ namespace Microsoft.Z3
///
public SetSort MkSetSort(Sort ty)
{
- Contract.Requires(ty != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ty != null);
CheckContextMatch(ty);
return new SetSort(this, ty);
@@ -2330,8 +2178,7 @@ namespace Microsoft.Z3
///
public ArrayExpr MkEmptySet(Sort domain)
{
- Contract.Requires(domain != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(domain != null);
CheckContextMatch(domain);
return (ArrayExpr)Expr.Create(this, Native.Z3_mk_empty_set(nCtx, domain.NativeObject));
@@ -2342,8 +2189,7 @@ namespace Microsoft.Z3
///
public ArrayExpr MkFullSet(Sort domain)
{
- Contract.Requires(domain != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(domain != null);
CheckContextMatch(domain);
return (ArrayExpr)Expr.Create(this, Native.Z3_mk_full_set(nCtx, domain.NativeObject));
@@ -2354,9 +2200,8 @@ namespace Microsoft.Z3
///
public ArrayExpr MkSetAdd(ArrayExpr set, Expr element)
{
- Contract.Requires(set != null);
- Contract.Requires(element != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(set != null);
+ Debug.Assert(element != null);
CheckContextMatch(set);
CheckContextMatch(element);
@@ -2369,9 +2214,8 @@ namespace Microsoft.Z3
///
public ArrayExpr MkSetDel(ArrayExpr set, Expr element)
{
- Contract.Requires(set != null);
- Contract.Requires(element != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(set != null);
+ Debug.Assert(element != null);
CheckContextMatch(set);
CheckContextMatch(element);
@@ -2383,8 +2227,8 @@ namespace Microsoft.Z3
///
public ArrayExpr MkSetUnion(params ArrayExpr[] args)
{
- Contract.Requires(args != null);
- Contract.Requires(Contract.ForAll(args, a => a != null));
+ Debug.Assert(args != null);
+ Debug.Assert(args.All(a => a != null));
CheckContextMatch(args);
return (ArrayExpr)Expr.Create(this, Native.Z3_mk_set_union(nCtx, (uint)args.Length, AST.ArrayToNative(args)));
@@ -2395,9 +2239,8 @@ namespace Microsoft.Z3
///
public ArrayExpr MkSetIntersection(params ArrayExpr[] args)
{
- Contract.Requires(args != null);
- Contract.Requires(Contract.ForAll(args, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(args != null);
+ Debug.Assert(args.All(a => a != null));
CheckContextMatch(args);
return (ArrayExpr)Expr.Create(this, Native.Z3_mk_set_intersect(nCtx, (uint)args.Length, AST.ArrayToNative(args)));
@@ -2408,9 +2251,8 @@ namespace Microsoft.Z3
///
public ArrayExpr MkSetDifference(ArrayExpr arg1, ArrayExpr arg2)
{
- Contract.Requires(arg1 != null);
- Contract.Requires(arg2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(arg1 != null);
+ Debug.Assert(arg2 != null);
CheckContextMatch(arg1);
CheckContextMatch(arg2);
@@ -2422,8 +2264,7 @@ namespace Microsoft.Z3
///
public ArrayExpr MkSetComplement(ArrayExpr arg)
{
- Contract.Requires(arg != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(arg != null);
CheckContextMatch(arg);
return (ArrayExpr)Expr.Create(this, Native.Z3_mk_set_complement(nCtx, arg.NativeObject));
@@ -2434,9 +2275,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkSetMembership(Expr elem, ArrayExpr set)
{
- Contract.Requires(elem != null);
- Contract.Requires(set != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(elem != null);
+ Debug.Assert(set != null);
CheckContextMatch(elem);
CheckContextMatch(set);
@@ -2448,9 +2288,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkSetSubset(ArrayExpr arg1, ArrayExpr arg2)
{
- Contract.Requires(arg1 != null);
- Contract.Requires(arg2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(arg1 != null);
+ Debug.Assert(arg2 != null);
CheckContextMatch(arg1);
CheckContextMatch(arg2);
@@ -2459,15 +2298,14 @@ namespace Microsoft.Z3
#endregion
- #region Sequence, string and regular expresions
+ #region Sequence, string and regular expressions
///
/// Create the empty sequence.
///
public SeqExpr MkEmptySeq(Sort s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
return new SeqExpr(this, Native.Z3_mk_seq_empty(nCtx, s.NativeObject));
}
@@ -2476,8 +2314,7 @@ namespace Microsoft.Z3
///
public SeqExpr MkUnit(Expr elem)
{
- Contract.Requires(elem != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(elem != null);
return new SeqExpr(this, Native.Z3_mk_seq_unit(nCtx, elem.NativeObject));
}
@@ -2486,8 +2323,7 @@ namespace Microsoft.Z3
///
public SeqExpr MkString(string s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
return new SeqExpr(this, Native.Z3_mk_string(nCtx, s));
}
@@ -2496,9 +2332,8 @@ namespace Microsoft.Z3
///
public SeqExpr IntToString(Expr e)
{
- Contract.Requires(e != null);
- Contract.Requires(e is ArithExpr);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(e != null);
+ Debug.Assert(e is ArithExpr);
return new SeqExpr(this, Native.Z3_mk_int_to_str(nCtx, e.NativeObject));
}
@@ -2507,9 +2342,8 @@ namespace Microsoft.Z3
///
public IntExpr StringToInt(Expr e)
{
- Contract.Requires(e != null);
- Contract.Requires(e is SeqExpr);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(e != null);
+ Debug.Assert(e is SeqExpr);
return new IntExpr(this, Native.Z3_mk_str_to_int(nCtx, e.NativeObject));
}
@@ -2519,9 +2353,8 @@ namespace Microsoft.Z3
///
public SeqExpr MkConcat(params SeqExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return new SeqExpr(this, Native.Z3_mk_seq_concat(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -2533,8 +2366,7 @@ namespace Microsoft.Z3
///
public IntExpr MkLength(SeqExpr s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
return (IntExpr) Expr.Create(this, Native.Z3_mk_seq_length(nCtx, s.NativeObject));
}
@@ -2543,9 +2375,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkPrefixOf(SeqExpr s1, SeqExpr s2)
{
- Contract.Requires(s1 != null);
- Contract.Requires(s2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s1 != null);
+ Debug.Assert(s2 != null);
CheckContextMatch(s1, s2);
return new BoolExpr(this, Native.Z3_mk_seq_prefix(nCtx, s1.NativeObject, s2.NativeObject));
}
@@ -2555,9 +2386,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkSuffixOf(SeqExpr s1, SeqExpr s2)
{
- Contract.Requires(s1 != null);
- Contract.Requires(s2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s1 != null);
+ Debug.Assert(s2 != null);
CheckContextMatch(s1, s2);
return new BoolExpr(this, Native.Z3_mk_seq_suffix(nCtx, s1.NativeObject, s2.NativeObject));
}
@@ -2567,9 +2397,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkContains(SeqExpr s1, SeqExpr s2)
{
- Contract.Requires(s1 != null);
- Contract.Requires(s2 != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s1 != null);
+ Debug.Assert(s2 != null);
CheckContextMatch(s1, s2);
return new BoolExpr(this, Native.Z3_mk_seq_contains(nCtx, s1.NativeObject, s2.NativeObject));
}
@@ -2579,9 +2408,8 @@ namespace Microsoft.Z3
///
public SeqExpr MkAt(SeqExpr s, IntExpr index)
{
- Contract.Requires(s != null);
- Contract.Requires(index != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
+ Debug.Assert(index != null);
CheckContextMatch(s, index);
return new SeqExpr(this, Native.Z3_mk_seq_at(nCtx, s.NativeObject, index.NativeObject));
}
@@ -2591,10 +2419,9 @@ namespace Microsoft.Z3
///
public SeqExpr MkExtract(SeqExpr s, IntExpr offset, IntExpr length)
{
- Contract.Requires(s != null);
- Contract.Requires(offset != null);
- Contract.Requires(length != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
+ Debug.Assert(offset != null);
+ Debug.Assert(length != null);
CheckContextMatch(s, offset, length);
return new SeqExpr(this, Native.Z3_mk_seq_extract(nCtx, s.NativeObject, offset.NativeObject, length.NativeObject));
}
@@ -2604,10 +2431,9 @@ namespace Microsoft.Z3
///
public IntExpr MkIndexOf(SeqExpr s, SeqExpr substr, ArithExpr offset)
{
- Contract.Requires(s != null);
- Contract.Requires(offset != null);
- Contract.Requires(substr != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
+ Debug.Assert(offset != null);
+ Debug.Assert(substr != null);
CheckContextMatch(s, substr, offset);
return new IntExpr(this, Native.Z3_mk_seq_index(nCtx, s.NativeObject, substr.NativeObject, offset.NativeObject));
}
@@ -2617,10 +2443,9 @@ namespace Microsoft.Z3
///
public SeqExpr MkReplace(SeqExpr s, SeqExpr src, SeqExpr dst)
{
- Contract.Requires(s != null);
- Contract.Requires(src != null);
- Contract.Requires(dst != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
+ Debug.Assert(src != null);
+ Debug.Assert(dst != null);
CheckContextMatch(s, src, dst);
return new SeqExpr(this, Native.Z3_mk_seq_replace(nCtx, s.NativeObject, src.NativeObject, dst.NativeObject));
}
@@ -2630,8 +2455,7 @@ namespace Microsoft.Z3
///
public ReExpr MkToRe(SeqExpr s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
return new ReExpr(this, Native.Z3_mk_seq_to_re(nCtx, s.NativeObject));
}
@@ -2641,9 +2465,8 @@ namespace Microsoft.Z3
///
public BoolExpr MkInRe(SeqExpr s, ReExpr re)
{
- Contract.Requires(s != null);
- Contract.Requires(re != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
+ Debug.Assert(re != null);
CheckContextMatch(s, re);
return new BoolExpr(this, Native.Z3_mk_seq_in_re(nCtx, s.NativeObject, re.NativeObject));
}
@@ -2653,8 +2476,7 @@ namespace Microsoft.Z3
///
public ReExpr MkStar(ReExpr re)
{
- Contract.Requires(re != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(re != null);
return new ReExpr(this, Native.Z3_mk_re_star(nCtx, re.NativeObject));
}
@@ -2663,8 +2485,7 @@ namespace Microsoft.Z3
///
public ReExpr MkLoop(ReExpr re, uint lo, uint hi = 0)
{
- Contract.Requires(re != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(re != null);
return new ReExpr(this, Native.Z3_mk_re_loop(nCtx, re.NativeObject, lo, hi));
}
@@ -2673,8 +2494,7 @@ namespace Microsoft.Z3
///
public ReExpr MkPlus(ReExpr re)
{
- Contract.Requires(re != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(re != null);
return new ReExpr(this, Native.Z3_mk_re_plus(nCtx, re.NativeObject));
}
@@ -2683,8 +2503,7 @@ namespace Microsoft.Z3
///
public ReExpr MkOption(ReExpr re)
{
- Contract.Requires(re != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(re != null);
return new ReExpr(this, Native.Z3_mk_re_option(nCtx, re.NativeObject));
}
@@ -2693,8 +2512,7 @@ namespace Microsoft.Z3
///
public ReExpr MkComplement(ReExpr re)
{
- Contract.Requires(re != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(re != null);
return new ReExpr(this, Native.Z3_mk_re_complement(nCtx, re.NativeObject));
}
@@ -2703,9 +2521,8 @@ namespace Microsoft.Z3
///
public ReExpr MkConcat(params ReExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return new ReExpr(this, Native.Z3_mk_re_concat(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -2716,9 +2533,8 @@ namespace Microsoft.Z3
///
public ReExpr MkUnion(params ReExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return new ReExpr(this, Native.Z3_mk_re_union(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -2729,9 +2545,8 @@ namespace Microsoft.Z3
///
public ReExpr MkIntersect(params ReExpr[] t)
{
- Contract.Requires(t != null);
- Contract.Requires(Contract.ForAll(t, a => a != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t != null);
+ Debug.Assert(t.All(a => a != null));
CheckContextMatch(t);
return new ReExpr(this, Native.Z3_mk_re_intersect(nCtx, (uint)t.Length, AST.ArrayToNative(t)));
@@ -2742,8 +2557,7 @@ namespace Microsoft.Z3
///
public ReExpr MkEmptyRe(Sort s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
return new ReExpr(this, Native.Z3_mk_re_empty(nCtx, s.NativeObject));
}
@@ -2752,8 +2566,7 @@ namespace Microsoft.Z3
///
public ReExpr MkFullRe(Sort s)
{
- Contract.Requires(s != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(s != null);
return new ReExpr(this, Native.Z3_mk_re_full(nCtx, s.NativeObject));
}
@@ -2763,9 +2576,8 @@ namespace Microsoft.Z3
///
public ReExpr MkRange(SeqExpr lo, SeqExpr hi)
{
- Contract.Requires(lo != null);
- Contract.Requires(hi != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(lo != null);
+ Debug.Assert(hi != null);
CheckContextMatch(lo, hi);
return new ReExpr(this, Native.Z3_mk_re_range(nCtx, lo.NativeObject, hi.NativeObject));
}
@@ -2779,8 +2591,7 @@ namespace Microsoft.Z3
///
public BoolExpr MkAtMost(IEnumerable args, uint k)
{
- Contract.Requires(args != null);
- Contract.Requires(Contract.Result() != null);
+ Debug.Assert(args != null);
CheckContextMatch(args);
return new BoolExpr(this, Native.Z3_mk_atmost(nCtx, (uint) args.Count(),
AST.EnumToNative(args), k));
@@ -2791,8 +2602,7 @@ namespace Microsoft.Z3
///
public BoolExpr MkAtLeast(IEnumerable args, uint k)
{
- Contract.Requires(args != null);
- Contract.Requires(Contract.Result() != null);
+ Debug.Assert(args != null);
CheckContextMatch(args);
return new BoolExpr(this, Native.Z3_mk_atleast(nCtx, (uint) args.Count(),
AST.EnumToNative(args), k));
@@ -2803,10 +2613,9 @@ namespace Microsoft.Z3
///
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);
+ Debug.Assert(args != null);
+ Debug.Assert(coeffs != null);
+ Debug.Assert(args.Length == coeffs.Length);
CheckContextMatch(args);
return new BoolExpr(this, Native.Z3_mk_pble(nCtx, (uint) args.Length,
AST.ArrayToNative(args),
@@ -2818,10 +2627,9 @@ namespace Microsoft.Z3
///
public BoolExpr MkPBGe(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);
+ Debug.Assert(args != null);
+ Debug.Assert(coeffs != null);
+ Debug.Assert(args.Length == coeffs.Length);
CheckContextMatch(args);
return new BoolExpr(this, Native.Z3_mk_pbge(nCtx, (uint) args.Length,
AST.ArrayToNative(args),
@@ -2832,10 +2640,9 @@ namespace Microsoft.Z3
///
public BoolExpr MkPBEq(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);
+ Debug.Assert(args != null);
+ Debug.Assert(coeffs != null);
+ Debug.Assert(args.Length == coeffs.Length);
CheckContextMatch(args);
return new BoolExpr(this, Native.Z3_mk_pbeq(nCtx, (uint) args.Length,
AST.ArrayToNative(args),
@@ -2854,8 +2661,7 @@ namespace Microsoft.Z3
/// A Term with value and sort
public Expr MkNumeral(string v, Sort ty)
{
- Contract.Requires(ty != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ty != null);
CheckContextMatch(ty);
return Expr.Create(this, Native.Z3_mk_numeral(nCtx, v, ty.NativeObject));
@@ -2870,8 +2676,7 @@ namespace Microsoft.Z3
/// A Term with value and type
public Expr MkNumeral(int v, Sort ty)
{
- Contract.Requires(ty != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ty != null);
CheckContextMatch(ty);
return Expr.Create(this, Native.Z3_mk_int(nCtx, v, ty.NativeObject));
@@ -2886,8 +2691,7 @@ namespace Microsoft.Z3
/// A Term with value and type
public Expr MkNumeral(uint v, Sort ty)
{
- Contract.Requires(ty != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ty != null);
CheckContextMatch(ty);
return Expr.Create(this, Native.Z3_mk_unsigned_int(nCtx, v, ty.NativeObject));
@@ -2902,8 +2706,7 @@ namespace Microsoft.Z3
/// A Term with value and type
public Expr MkNumeral(long v, Sort ty)
{
- Contract.Requires(ty != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ty != null);
CheckContextMatch(ty);
return Expr.Create(this, Native.Z3_mk_int64(nCtx, v, ty.NativeObject));
@@ -2918,8 +2721,7 @@ namespace Microsoft.Z3
/// A Term with value and type
public Expr MkNumeral(ulong v, Sort ty)
{
- Contract.Requires(ty != null);
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(ty != null);
CheckContextMatch(ty);
return Expr.Create(this, Native.Z3_mk_unsigned_int64(nCtx, v, ty.NativeObject));
@@ -2939,9 +2741,6 @@ namespace Microsoft.Z3
if (den == 0)
throw new Z3Exception("Denominator is zero");
- Contract.Ensures(Contract.Result() != null);
- Contract.EndContractBlock();
-
return new RatNum(this, Native.Z3_mk_real(nCtx, num, den));
}
@@ -2952,7 +2751,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Real
public RatNum MkReal(string v)
{
- Contract.Ensures(Contract.Result() != null);
return new RatNum(this, Native.Z3_mk_numeral(nCtx, v, RealSort.NativeObject));
}
@@ -2964,7 +2762,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Real
public RatNum MkReal(int v)
{
- Contract.Ensures(Contract.Result() != null);
return new RatNum(this, Native.Z3_mk_int(nCtx, v, RealSort.NativeObject));
}
@@ -2976,7 +2773,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Real
public RatNum MkReal(uint v)
{
- Contract.Ensures(Contract.Result() != null);
return new RatNum(this, Native.Z3_mk_unsigned_int(nCtx, v, RealSort.NativeObject));
}
@@ -2988,7 +2784,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Real
public RatNum MkReal(long v)
{
- Contract.Ensures(Contract.Result() != null);
return new RatNum(this, Native.Z3_mk_int64(nCtx, v, RealSort.NativeObject));
}
@@ -3000,7 +2795,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Real
public RatNum MkReal(ulong v)
{
- Contract.Ensures(Contract.Result() != null);
return new RatNum(this, Native.Z3_mk_unsigned_int64(nCtx, v, RealSort.NativeObject));
}
@@ -3013,7 +2807,6 @@ namespace Microsoft.Z3
/// A string representing the Term value in decimal notation.
public IntNum MkInt(string v)
{
- Contract.Ensures(Contract.Result() != null);
return new IntNum(this, Native.Z3_mk_numeral(nCtx, v, IntSort.NativeObject));
}
@@ -3025,7 +2818,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Integer
public IntNum MkInt(int v)
{
- Contract.Ensures(Contract.Result() != null);
return new IntNum(this, Native.Z3_mk_int(nCtx, v, IntSort.NativeObject));
}
@@ -3037,7 +2829,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Integer
public IntNum MkInt(uint v)
{
- Contract.Ensures(Contract.Result() != null);
return new IntNum(this, Native.Z3_mk_unsigned_int(nCtx, v, IntSort.NativeObject));
}
@@ -3049,7 +2840,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Integer
public IntNum MkInt(long v)
{
- Contract.Ensures(Contract.Result() != null);
return new IntNum(this, Native.Z3_mk_int64(nCtx, v, IntSort.NativeObject));
}
@@ -3061,7 +2851,6 @@ namespace Microsoft.Z3
/// A Term with value and sort Integer
public IntNum MkInt(ulong v)
{
- Contract.Ensures(Contract.Result() != null);
return new IntNum(this, Native.Z3_mk_unsigned_int64(nCtx, v, IntSort.NativeObject));
}
@@ -3075,7 +2864,6 @@ namespace Microsoft.Z3
/// the size of the bit-vector
public BitVecNum MkBV(string v, uint size)
{
- Contract.Ensures(Contract.Result() != null);
return (BitVecNum)MkNumeral(v, MkBitVecSort(size));
}
@@ -3087,7 +2875,6 @@ namespace Microsoft.Z3
/// the size of the bit-vector
public BitVecNum MkBV(int v, uint size)
{
- Contract.Ensures(Contract.Result() != null);
return (BitVecNum)MkNumeral(v, MkBitVecSort(size));
}
@@ -3099,7 +2886,6 @@ namespace Microsoft.Z3
/// the size of the bit-vector
public BitVecNum MkBV(uint v, uint size)
{
- Contract.Ensures(Contract.Result() != null);
return (BitVecNum)MkNumeral(v, MkBitVecSort(size));
}
@@ -3111,7 +2897,6 @@ namespace Microsoft.Z3
/// the size of the bit-vector
public BitVecNum MkBV(long v, uint size)
{
- Contract.Ensures(Contract.Result() != null);
return (BitVecNum)MkNumeral(v, MkBitVecSort(size));
}
@@ -3123,7 +2908,6 @@ namespace Microsoft.Z3
/// the size of the bit-vector
public BitVecNum MkBV(ulong v, uint size)
{
- Contract.Ensures(Contract.Result() != null);
return (BitVecNum)MkNumeral(v, MkBitVecSort(size));
}
@@ -3131,10 +2915,9 @@ namespace Microsoft.Z3
///
/// Create a bit-vector numeral.
///
- /// An array of bits representing the bit-vector. Least signficant bit is at position 0.
+ /// An array of bits representing the bit-vector. Least significant bit is at position 0.
public BitVecNum MkBV(bool[] bits)
{
- Contract.Ensures(Contract.Result() != null);
byte[] _bits = new byte[bits.Length];
for (int i = 0; i < bits.Length; ++i) _bits[i] = (byte)(bits[i] ? 1 : 0);
return (BitVecNum)Expr.Create(this, Native.Z3_mk_bv_numeral(nCtx, (uint)bits.Length, _bits));
@@ -3172,16 +2955,15 @@ namespace Microsoft.Z3
/// optional symbol to track skolem constants.
public Quantifier MkForall(Sort[] sorts, Symbol[] names, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
{
- Contract.Requires(sorts != null);
- Contract.Requires(names != null);
- Contract.Requires(body != null);
- Contract.Requires(sorts.Length == names.Length);
- Contract.Requires(Contract.ForAll(sorts, s => s != null));
- Contract.Requires(Contract.ForAll(names, n => n != null));
- Contract.Requires(patterns == null || Contract.ForAll(patterns, p => p != null));
- Contract.Requires(noPatterns == null || Contract.ForAll(noPatterns, np => np != null));
+ Debug.Assert(sorts != null);
+ Debug.Assert(names != null);
+ Debug.Assert(body != null);
+ Debug.Assert(sorts.Length == names.Length);
+ Debug.Assert(sorts.All(s => s != null));
+ Debug.Assert(names.All(n => n != null));
+ Debug.Assert(patterns == null || patterns.All(p => p != null));
+ Debug.Assert(noPatterns == null || noPatterns.All(np => np != null));
- Contract.Ensures(Contract.Result() != null);
return new Quantifier(this, true, sorts, names, body, weight, patterns, noPatterns, quantifierID, skolemID);
}
@@ -3197,12 +2979,11 @@ namespace Microsoft.Z3
///
public Quantifier MkForall(Expr[] boundConstants, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
{
- Contract.Requires(body != null);
- Contract.Requires(boundConstants == null || Contract.ForAll(boundConstants, b => b != null));
- Contract.Requires(patterns == null || Contract.ForAll(patterns, p => p != null));
- Contract.Requires(noPatterns == null || Contract.ForAll(noPatterns, np => np != null));
+ Debug.Assert(body != null);
+ Debug.Assert(boundConstants == null || boundConstants.All(b => b != null));
+ Debug.Assert(patterns == null || patterns.All(p => p != null));
+ Debug.Assert(noPatterns == null || noPatterns.All(np => np != null));
- Contract.Ensures(Contract.Result() != null);
return new Quantifier(this, true, boundConstants, body, weight, patterns, noPatterns, quantifierID, skolemID);
}
@@ -3216,15 +2997,14 @@ namespace Microsoft.Z3
///
public Quantifier MkExists(Sort[] sorts, Symbol[] names, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
{
- Contract.Requires(sorts != null);
- Contract.Requires(names != null);
- Contract.Requires(body != null);
- Contract.Requires(sorts.Length == names.Length);
- Contract.Requires(Contract.ForAll(sorts, s => s != null));
- Contract.Requires(Contract.ForAll(names, n => n != null));
- Contract.Requires(patterns == null || Contract.ForAll(patterns, p => p != null));
- Contract.Requires(noPatterns == null || Contract.ForAll(noPatterns, np => np != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(sorts != null);
+ Debug.Assert(names != null);
+ Debug.Assert(body != null);
+ Debug.Assert(sorts.Length == names.Length);
+ Debug.Assert(sorts.All(s => s != null));
+ Debug.Assert(names.All(n => n != null));
+ Debug.Assert(patterns == null || patterns.All(p => p != null));
+ Debug.Assert(noPatterns == null || noPatterns.All(np => np != null));
return new Quantifier(this, false, sorts, names, body, weight, patterns, noPatterns, quantifierID, skolemID);
}
@@ -3239,11 +3019,10 @@ namespace Microsoft.Z3
///
public Quantifier MkExists(Expr[] boundConstants, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
{
- Contract.Requires(body != null);
- Contract.Requires(boundConstants == null || Contract.ForAll(boundConstants, n => n != null));
- Contract.Requires(patterns == null || Contract.ForAll(patterns, p => p != null));
- Contract.Requires(noPatterns == null || Contract.ForAll(noPatterns, np => np != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(body != null);
+ Debug.Assert(boundConstants == null || boundConstants.All(n => n != null));
+ Debug.Assert(patterns == null || patterns.All(p => p != null));
+ Debug.Assert(noPatterns == null || noPatterns.All(np => np != null));
return new Quantifier(this, false, boundConstants, body, weight, patterns, noPatterns, quantifierID, skolemID);
}
@@ -3255,16 +3034,15 @@ namespace Microsoft.Z3
///
public Quantifier MkQuantifier(bool universal, Sort[] sorts, Symbol[] names, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
{
- Contract.Requires(body != null);
- Contract.Requires(names != null);
- Contract.Requires(sorts != null);
- Contract.Requires(sorts.Length == names.Length);
- Contract.Requires(Contract.ForAll(sorts, s => s != null));
- Contract.Requires(Contract.ForAll(names, n => n != null));
- Contract.Requires(patterns == null || Contract.ForAll(patterns, p => p != null));
- Contract.Requires(noPatterns == null || Contract.ForAll(noPatterns, np => np != null));
+ Debug.Assert(body != null);
+ Debug.Assert(names != null);
+ Debug.Assert(sorts != null);
+ Debug.Assert(sorts.Length == names.Length);
+ Debug.Assert(sorts.All(s => s != null));
+ Debug.Assert(names.All(n => n != null));
+ Debug.Assert(patterns == null || patterns.All(p => p != null));
+ Debug.Assert(noPatterns == null || noPatterns.All(np => np != null));
- Contract.Ensures(Contract.Result() != null);
if (universal)
return MkForall(sorts, names, body, weight, patterns, noPatterns, quantifierID, skolemID);
@@ -3279,12 +3057,11 @@ namespace Microsoft.Z3
///
public Quantifier MkQuantifier(bool universal, Expr[] boundConstants, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
{
- Contract.Requires(body != null);
- Contract.Requires(boundConstants == null || Contract.ForAll(boundConstants, n => n != null));
- Contract.Requires(patterns == null || Contract.ForAll(patterns, p => p != null));
- Contract.Requires(noPatterns == null || Contract.ForAll(noPatterns, np => np != null));
+ Debug.Assert(body != null);
+ Debug.Assert(boundConstants == null || boundConstants.All(n => n != null));
+ Debug.Assert(patterns == null || patterns.All(p => p != null));
+ Debug.Assert(noPatterns == null || noPatterns.All(np => np != null));
- Contract.Ensures(Contract.Result() != null);
if (universal)
return MkForall(boundConstants, body, weight, patterns, noPatterns, quantifierID, skolemID);
@@ -3312,13 +3089,12 @@ namespace Microsoft.Z3
/// the body of the quantifier.
public Lambda MkLambda(Sort[] sorts, Symbol[] names, Expr body)
{
- Contract.Requires(sorts != null);
- Contract.Requires(names != null);
- Contract.Requires(body != null);
- Contract.Requires(sorts.Length == names.Length);
- Contract.Requires(Contract.ForAll(sorts, s => s != null));
- Contract.Requires(Contract.ForAll(names, n => n != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(sorts != null);
+ Debug.Assert(names != null);
+ Debug.Assert(body != null);
+ Debug.Assert(sorts.Length == names.Length);
+ Debug.Assert(sorts.All(s => s != null));
+ Debug.Assert(names.All(n => n != null));
return new Lambda(this, sorts, names, body);
}
@@ -3332,9 +3108,8 @@ namespace Microsoft.Z3
///
public Lambda MkLambda(Expr[] boundConstants, Expr body)
{
- Contract.Requires(body != null);
- Contract.Requires(boundConstants != null && Contract.ForAll(boundConstants, b => b != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(body != null);
+ Debug.Assert(boundConstants != null && boundConstants.All(b => b != null));
return new Lambda(this, boundConstants, body);
}
@@ -3374,7 +3149,6 @@ namespace Microsoft.Z3
/// A conjunction of assertions in the scope (up to push/pop) at the end of the string.
public BoolExpr[] ParseSMTLIB2String(string str, Symbol[] sortNames = null, Sort[] sorts = null, Symbol[] declNames = null, FuncDecl[] decls = null)
{
- Contract.Ensures(Contract.Result() != null);
uint csn = Symbol.ArrayLength(sortNames);
uint cs = Sort.ArrayLength(sorts);
@@ -3394,7 +3168,6 @@ namespace Microsoft.Z3
///
public BoolExpr[] ParseSMTLIB2File(string fileName, Symbol[] sortNames = null, Sort[] sorts = null, Symbol[] declNames = null, FuncDecl[] decls = null)
{
- Contract.Ensures(Contract.Result() != null);
uint csn = Symbol.ArrayLength(sortNames);
uint cs = Sort.ArrayLength(sorts);
@@ -3422,7 +3195,6 @@ namespace Microsoft.Z3
/// Indicates whether proof generation should be enabled.
public Goal MkGoal(bool models = true, bool unsatCores = false, bool proofs = false)
{
- Contract.Ensures(Contract.Result() != null);
return new Goal(this, models, unsatCores, proofs);
}
@@ -3434,7 +3206,6 @@ namespace Microsoft.Z3
///
public Params MkParams()
{
- Contract.Ensures(Contract.Result() != null);
return new Params(this);
}
@@ -3456,7 +3227,6 @@ namespace Microsoft.Z3
{
get
{
- Contract.Ensures(Contract.Result() != null);
uint n = NumTactics;
string[] res = new string[n];
@@ -3471,7 +3241,6 @@ namespace Microsoft.Z3
///
public string TacticDescription(string name)
{
- Contract.Ensures(Contract.Result() != null);
return Native.Z3_tactic_get_descr(nCtx, name);
}
@@ -3481,7 +3250,6 @@ namespace Microsoft.Z3
///
public Tactic MkTactic(string name)
{
- Contract.Ensures(Contract.Result() != null);
return new Tactic(this, name);
}
@@ -3492,10 +3260,9 @@ namespace Microsoft.Z3
///
public Tactic AndThen(Tactic t1, Tactic t2, params Tactic[] ts)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Requires(ts == null || Contract.ForAll(0, ts.Length, j => ts[j] != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
+ // Debug.Assert(ts == null || Contract.ForAll(0, ts.Length, j => ts[j] != null));
CheckContextMatch(t1);
@@ -3527,10 +3294,9 @@ namespace Microsoft.Z3
///
public Tactic Then(Tactic t1, Tactic t2, params Tactic[] ts)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Requires(ts == null || Contract.ForAll(0, ts.Length, j => ts[j] != null));
- Contract.Ensures(Contract.Result() != null);
+ Debug.Assert(t1 != null);
+ Debug.Assert(t2 != null);
+ // Debug.Assert(ts == null || Contract.ForAll(0, ts.Length, j => ts[j] != null));
return AndThen(t1, t2, ts);
}
@@ -3541,9 +3307,8 @@ namespace Microsoft.Z3
///
public Tactic OrElse(Tactic t1, Tactic t2)
{
- Contract.Requires(t1 != null);
- Contract.Requires(t2 != null);
- Contract.Ensures(Contract.Result