3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 03:45:51 +00:00

Merge remote-tracking branch 'upstream/master' into develop

This commit is contained in:
Murphy Berzish 2018-01-03 13:56:18 -05:00
commit 83230f944a
70 changed files with 1145 additions and 479 deletions

View file

@ -34,7 +34,7 @@ endif()
################################################################################
set(Z3_VERSION_MAJOR 4)
set(Z3_VERSION_MINOR 6)
set(Z3_VERSION_PATCH 0)
set(Z3_VERSION_PATCH 1)
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
@ -257,6 +257,46 @@ list(APPEND Z3_COMPONENT_EXTRA_INCLUDE_DIRS
"${CMAKE_BINARY_DIR}/src"
"${CMAKE_SOURCE_DIR}/src"
)
################################################################################
# Linux specific configuration
################################################################################
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# Try to detect if it is necessary to link against librt.
# Note that glibc < 2.17 required librt to be linked to use clock_gettime()
# and friends.
set(CLOCK_GETTIME_REQUIRES_LIBRT_TEST_CODE
"
#include <time.h>
int main() {
timespec res;
int result = clock_gettime(CLOCK_REALTIME, &res);
return result == 0;
}
"
)
check_cxx_source_compiles(
"${CLOCK_GETTIME_REQUIRES_LIBRT_TEST_CODE}"
CLOCK_GETTIME_NO_REQUIRE_LIBRT
)
if (NOT CLOCK_GETTIME_NO_REQUIRE_LIBRT)
# Try again with librt
message(STATUS "Failed to link against clock_gettime(), trying with librt")
set(CMAKE_REQUIRED_LIBRARIES_OLD "${CMAKE_REQUIRED_LIBRARIES}")
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} rt")
check_cxx_source_compiles(
"${CLOCK_GETTIME_REQUIRES_LIBRT_TEST_CODE}"
CLOCK_GETTIME_REQUIRES_LIBRT
)
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES_OLD}")
if (CLOCK_GETTIME_REQUIRES_LIBRT)
list(APPEND Z3_DEPENDENT_LIBS "rt")
else()
message(FATAL_ERROR "Failed to link against clock_gettime()")
endif()
endif()
endif()
################################################################################
# GNU multiple precision library support
################################################################################

View file

@ -5,7 +5,7 @@ of the project written in the ``CMakeLists.txt`` files and emits a build
system for that project of your choice using one of CMake's "generators".
This allows CMake to support many different platforms and build tools.
You can run ``cmake --help`` to see the list of supported "generators"
on your platform. Example generators include "UNIX Makfiles" and "Visual Studio
on your platform. Example generators include "UNIX Makefiles" and "Visual Studio
12 2013".
## Getting started
@ -44,7 +44,7 @@ cmake -G "Unix Makefiles" ../
make -j4 # Replace 4 with an appropriate number
```
Note that on some platforms "Unix Makesfiles" is the default generator so on those
Note that on some platforms "Unix Makefiles" is the default generator so on those
platforms you don't need to pass ``-G "Unix Makefiles"`` command line option to
``cmake``.

View file

@ -2,6 +2,7 @@ RELEASE NOTES
Version 4.6.0
=============
- New requirements:
- C++11 capable compiler to build Z3.
- C++ API now requires C++11 or newer.
@ -14,6 +15,10 @@ Version 4.6.0
issuing the command (get-objectives). Pareto front objectives are accessed by
issuing multiple (check-sat) calls until it returns unsat.
- Removed features:
- Removed support for SMT-LIB 1.x
Version 4.5.0
=============
@ -49,11 +54,10 @@ Version 4.5.0
over compound formulas, introduce a fresh predicate whose
arguments are the relevant free variables in the formula and add a rule
that uses the fresh predicate in the head and formula in the body.
- minimization of unsat cores is avaialble as an option for the SAT and SMT cores.
- Minimization of unsat cores is available as an option for the SAT and SMT cores.
By setting smt.core.minimize=true resp. sat.core.minimize=true
cores produced by these modules are minimized.
- A multitude of bugs has been fixed.
@ -708,7 +712,7 @@ The following bugs are fixed in this release:
bvshl when using a shift amount that evaluates to the length
of the bit-vector. Thanks to Trevor Hansen and Robert Brummayer.
- Incorrect NNF conversion in linear quantifier elimniation routines.
- Incorrect NNF conversion in linear quantifier elimination routines.
Thanks to Josh Berdine.
- Missing constant folding of extraction for large bit-vectors.

View file

@ -2,7 +2,7 @@
# @AUTO_GEN_MSG@
#
# This file is intended to be consumed by clients who wish to use Z3 from CMake.
# It can be use by doing `find_package(Z3 config)` from within a
# It can be used by doing `find_package(Z3 config)` from within a
# `CMakeLists.txt` file. If CMake doesn't find this package automatically you
# can give it a hint by passing `-DZ3_DIR=<path>` to the CMake invocation where
# `<path>` is the path to the directory containing this file.

View file

@ -1,4 +1,4 @@
# Sanitizer supression files
# Sanitizer suppression files
This directory contains files used to suppress
ASan/LSan/UBSan warnings/errors.

View file

@ -226,12 +226,14 @@ try:
website_dox_substitutions = {}
bullet_point_prefix='\n - '
if Z3PY_ENABLED:
print("Python documentation enabled")
website_dox_substitutions['PYTHON_API'] = (
'{prefix}<a class="el" href="namespacez3py.html">Python API</a> '
'(also available in <a class="el" href="z3.html">pydoc format</a>)'
).format(
prefix=bullet_point_prefix)
else:
print("Python documentation disabled")
website_dox_substitutions['PYTHON_API'] = ''
if DOTNET_ENABLED:
website_dox_substitutions['DOTNET_API'] = (
@ -250,7 +252,7 @@ try:
website_dox_substitutions['JAVA_API'] = ''
if ML_ENABLED:
website_dox_substitutions['OCAML_API'] = (
'<a class="el" href="ml/index.html">ML/OCaml API</a>'
'{prefix}<a class="el" href="ml/index.html">ML/OCaml API</a>'
).format(
prefix=bullet_point_prefix)
else:
@ -316,7 +318,7 @@ try:
if ML_ENABLED:
ml_output_dir = os.path.join(OUTPUT_DIRECTORY, 'html', 'ml')
mk_dir(ml_output_dir)
if subprocess.call(['ocamldoc', '-html', '-d', ml_output_dir, '-sort', '-hide', 'Z3', '-I', '%s/api/ml' % BUILD_DIR, doc_path('../src/api/ml/z3enums.mli'), doc_path('../src/api/ml/z3.mli')]) != 0:
if subprocess.call(['ocamldoc', '-html', '-d', ml_output_dir, '-sort', '-hide', 'Z3', '-I', '%s/api/ml' % BUILD_DIR, '%s/api/ml/z3enums.mli' % BUILD_DIR, '%s/api/ml/z3.mli' % BUILD_DIR]) != 0:
print("ERROR: ocamldoc failed.")
exit(1)
print("Generated ML/OCaml documentation.")
@ -326,3 +328,4 @@ except Exception:
exctype, value = sys.exc_info()[:2]
print("ERROR: failed to generate documentation: %s" % value)
exit(1)

View file

@ -1546,7 +1546,7 @@ void two_contexts_example1()
}
/**
\brief Demonstrates how error codes can be read insted of registering an error handler.
\brief Demonstrates how error codes can be read instead of registering an error handler.
*/
void error_code_example1()
{
@ -2533,7 +2533,7 @@ void reference_counter_example() {
cfg = Z3_mk_config();
Z3_set_param_value(cfg, "model", "true");
// Create a Z3 context where the user is reponsible for managing
// Create a Z3 context where the user is responsible for managing
// Z3_ast reference counters.
ctx = Z3_mk_context_rc(cfg);
Z3_del_config(cfg);

View file

@ -622,7 +622,7 @@ namespace test_mapi
Console.WriteLine("{0}", q1);
}
// Quantifier with de-Brujin indices.
// Quantifier with de-Bruijn indices.
{
Expr x = ctx.MkBound(1, ctx.IntSort);
Expr y = ctx.MkBound(0, ctx.IntSort);

View file

@ -660,7 +660,7 @@ class JavaExample
System.out.println(q1);
}
// Quantifier with de-Brujin indices.
// Quantifier with de-Bruijn indices.
{
Expr x = ctx.mkBound(1, ctx.getIntSort());
Expr y = ctx.mkBound(0, ctx.getIntSort());

View file

@ -9,4 +9,4 @@ On OSX and Linux, you must install z3 first using
sudo make install
OR update LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (OSX) with the build directory. You need that to be able to find the Z3 shared library.
This directory contains a test file (ex.smt) that can be use as input for the maxsat test application.
This directory contains a test file (ex.smt) that can be used as input for the maxsat test application.

View file

@ -9,7 +9,7 @@ from mk_util import *
# Z3 Project definition
def init_project_def():
set_version(4, 6, 0, 0)
set_version(4, 6, 1, 0)
add_lib('util', [])
add_lib('lp', ['util'], 'util/lp')
add_lib('polynomial', ['util'], 'math/polynomial')

View file

@ -1990,7 +1990,7 @@ class MLComponent(Component):
out.write('%s.cmxa: %s %s %s %s.cma\n' % (z3mls, cmxs, stubso, z3dllso, z3mls))
out.write('\t%s -o %s -I %s %s %s %s\n' % (OCAMLMKLIB, z3mls, self.sub_dir, stubso, cmxs, LIBZ3))
out.write('%s.cmxs: %s.cmxa\n' % (z3mls, z3mls))
out.write('\t%s -shared -o %s.cmxs -I %s %s.cmxa\n' % (OCAMLOPTF, z3mls, self.sub_dir, z3mls))
out.write('\t%s -linkall -shared -o %s.cmxs -I %s %s.cmxa\n' % (OCAMLOPTF, z3mls, self.sub_dir, z3mls))
out.write('\n')
out.write('ml: %s.cma %s.cmxa %s.cmxs\n' % (z3mls, z3mls, z3mls))

View file

@ -213,6 +213,18 @@ extern "C" {
Z3_CATCH_RETURN(0);
}
Z3_model Z3_API Z3_model_translate(Z3_context c, Z3_model m, Z3_context target) {
Z3_TRY;
LOG_Z3_model_translate(c, m, target);
RESET_ERROR_CODE();
Z3_model_ref* dst = alloc(Z3_model_ref, *mk_c(target));
ast_translation tr(mk_c(c)->m(), mk_c(target)->m());
dst->m_model = to_model_ref(m)->translate(tr);
mk_c(target)->save_object(dst);
RETURN_Z3(of_model(dst));
Z3_CATCH_RETURN(0);
}
Z3_bool Z3_API Z3_is_as_array(Z3_context c, Z3_ast a) {
Z3_TRY;
LOG_Z3_is_as_array(c, a);

View file

@ -1809,9 +1809,11 @@ namespace z3 {
Z3_model_inc_ref(ctx(), m);
}
public:
struct translate {};
model(context & c):object(c) { init(Z3_mk_model(c)); }
model(context & c, Z3_model m):object(c) { init(m); }
model(model const & s):object(s) { init(s.m_model); }
model(model& src, context& dst, translate) : object(dst) { init(Z3_model_translate(src.ctx(), src, dst)); }
~model() { Z3_model_dec_ref(ctx(), m_model); }
operator Z3_model() const { return m_model; }
model & operator=(model const & s) {

View file

@ -2262,7 +2262,7 @@ namespace Microsoft.Z3
/// Maps f on the argument arrays.
/// </summary>
/// <remarks>
/// Eeach element of <c>args</c> must be of an array sort <c>[domain_i -> range_i]</c>.
/// Each element of <c>args</c> must be of an array sort <c>[domain_i -> range_i]</c>.
/// The function declaration <c>f</c> must have type <c> range_1 .. range_n -> range</c>.
/// <c>v</c> must have sort range. The sort of the result is <c>[domain_i -> range]</c>.
/// <seealso cref="MkArraySort(Sort, Sort)"/>
@ -2862,7 +2862,7 @@ namespace Microsoft.Z3
}
/// <summary>
/// Create a Term of a given sort. This function can be use to create numerals that fit in a machine integer.
/// Create a Term of a given sort. This function can be used to create numerals that fit in a machine integer.
/// It is slightly faster than <c>MakeNumeral</c> since it is not necessary to parse a string.
/// </summary>
/// <param name="v">Value of the numeral</param>
@ -2878,7 +2878,7 @@ namespace Microsoft.Z3
}
/// <summary>
/// Create a Term of a given sort. This function can be use to create numerals that fit in a machine integer.
/// Create a Term of a given sort. This function can be used to create numerals that fit in a machine integer.
/// It is slightly faster than <c>MakeNumeral</c> since it is not necessary to parse a string.
/// </summary>
/// <param name="v">Value of the numeral</param>
@ -2894,7 +2894,7 @@ namespace Microsoft.Z3
}
/// <summary>
/// Create a Term of a given sort. This function can be use to create numerals that fit in a machine integer.
/// Create a Term of a given sort. This function can be used to create numerals that fit in a machine integer.
/// It is slightly faster than <c>MakeNumeral</c> since it is not necessary to parse a string.
/// </summary>
/// <param name="v">Value of the numeral</param>
@ -2910,7 +2910,7 @@ namespace Microsoft.Z3
}
/// <summary>
/// Create a Term of a given sort. This function can be use to create numerals that fit in a machine integer.
/// Create a Term of a given sort. This function can be used to create numerals that fit in a machine integer.
/// It is slightly faster than <c>MakeNumeral</c> since it is not necessary to parse a string.
/// </summary>
/// <param name="v">Value of the numeral</param>
@ -3211,7 +3211,7 @@ namespace Microsoft.Z3
/// Create an existential Quantifier.
/// </summary>
/// <remarks>
/// Creates an existential quantifier using de-Brujin indexed variables.
/// Creates an existential quantifier using de-Bruijn indexed variables.
/// (<see cref="MkForall(Sort[], Symbol[], Expr, uint, Pattern[], Expr[], Symbol, Symbol)"/>).
/// </remarks>
public Quantifier MkExists(Sort[] sorts, Symbol[] names, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)

View file

@ -959,7 +959,7 @@ namespace Microsoft.Z3
/// Tn: (R t_n s_n)
/// [monotonicity T1 ... Tn]: (R (f t_1 ... t_n) (f s_1 ... s_n))
/// Remark: if t_i == s_i, then the antecedent Ti is suppressed.
/// That is, reflexivity proofs are supressed to save space.
/// That is, reflexivity proofs are suppressed to save space.
/// </remarks>
public bool IsProofMonotonicity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MONOTONICITY; } }
@ -1002,7 +1002,7 @@ namespace Microsoft.Z3
public bool IsProofAndElimination { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_AND_ELIM; } }
/// <summary>
/// Indicates whether the term is a proof by eliminiation of not-or
/// Indicates whether the term is a proof by elimination of not-or
/// </summary>
/// <remarks>
/// Given a proof for (not (or l_1 ... l_n)), produces a proof for (not l_i).
@ -1112,7 +1112,7 @@ namespace Microsoft.Z3
public bool IsProofQuantInst { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_QUANT_INST; } }
/// <summary>
/// Indicates whether the term is a hypthesis marker.
/// Indicates whether the term is a hypothesis marker.
/// </summary>
/// <remarks>Mark a hypothesis in a natural deduction style proof.</remarks>
public bool IsProofHypothesis { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_HYPOTHESIS; } }
@ -1433,7 +1433,7 @@ namespace Microsoft.Z3
/// <remarks>
/// Filter (restrict) a relation with respect to a predicate.
/// The first argument is a relation.
/// The second argument is a predicate with free de-Brujin indices
/// The second argument is a predicate with free de-Bruijn indices
/// corresponding to the columns of the relation.
/// So the first column in the relation has index 0.
/// </remarks>
@ -1649,7 +1649,7 @@ namespace Microsoft.Z3
public bool IsFPMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MUL; } }
/// <summary>
/// Indicates whether the term is a floating-point divison term
/// Indicates whether the term is a floating-point division term
/// </summary>
public bool IsFPDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_DIV; } }
@ -1709,7 +1709,7 @@ namespace Microsoft.Z3
public bool IsFPLe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LE; } }
/// <summary>
/// Indicates whether the term is a floating-point greater-than or erqual term
/// Indicates whether the term is a floating-point greater-than or equal term
/// </summary>
public bool IsFPGe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GE; } }
@ -1789,7 +1789,7 @@ namespace Microsoft.Z3
#region Bound Variables
/// <summary>
/// The de-Burijn index of a bound variable.
/// The de-Bruijn index of a bound variable.
/// </summary>
/// <remarks>
/// Bound variables are indexed by de-Bruijn indices. It is perhaps easiest to explain

View file

@ -253,7 +253,7 @@ namespace Microsoft.Z3
/// The uninterpreted sorts that the model has an interpretation for.
/// </summary>
/// <remarks>
/// Z3 also provides an intepretation for uninterpreted sorts used in a formula.
/// Z3 also provides an interpretation for uninterpreted sorts used in a formula.
/// The interpretation for a sort is a finite set of distinct values. We say this finite set is
/// the "universe" of the sort.
/// </remarks>

View file

@ -2234,7 +2234,7 @@ public class Context implements AutoCloseable {
}
/**
* Create a Term of a given sort. This function can be use to create
* Create a Term of a given sort. This function can be used to create
* numerals that fit in a machine integer. It is slightly faster than
* {@code MakeNumeral} since it is not necessary to parse a string.
*
@ -2250,7 +2250,7 @@ public class Context implements AutoCloseable {
}
/**
* Create a Term of a given sort. This function can be use to create
* Create a Term of a given sort. This function can be used to create
* numerals that fit in a machine integer. It is slightly faster than
* {@code MakeNumeral} since it is not necessary to parse a string.
*
@ -2438,7 +2438,7 @@ public class Context implements AutoCloseable {
}
/**
* Creates an existential quantifier using de-Brujin indexed variables.
* Creates an existential quantifier using de-Bruijn indexed variables.
* @see #mkForall(Sort[],Symbol[],Expr,int,Pattern[],Expr[],Symbol,Symbol)
**/
public Quantifier mkExists(Sort[] sorts, Symbol[] names, Expr body,

View file

@ -1421,7 +1421,7 @@ public class Expr extends AST
* Remarks: T1:
* (R t_1 s_1) ... Tn: (R t_n s_n) [monotonicity T1 ... Tn]: (R (f t_1 ...
* t_n) (f s_1 ... s_n)) Remark: if t_i == s_i, then the antecedent Ti is
* suppressed. That is, reflexivity proofs are supressed to save space.
* suppressed. That is, reflexivity proofs are suppressed to save space.
*
* @throws Z3Exception on error
* @return a boolean
@ -1473,7 +1473,7 @@ public class Expr extends AST
}
/**
* Indicates whether the term is a proof by eliminiation of not-or
* Indicates whether the term is a proof by elimination of not-or
* Remarks: * Given a proof for (not (or l_1 ... l_n)), produces a proof for (not l_i). * T1: (not (or l_1 ... l_n)) [not-or-elim T1]: (not l_i)
* @throws Z3Exception on error
* @return a boolean
@ -1605,7 +1605,7 @@ public class Expr extends AST
}
/**
* Indicates whether the term is a hypthesis marker.
* Indicates whether the term is a hypothesis marker.
* Remarks: Mark a
* hypothesis in a natural deduction style proof.
* @throws Z3Exception on error
@ -1987,7 +1987,7 @@ public class Expr extends AST
* Indicates whether the term is a relation filter
* Remarks: Filter
* (restrict) a relation with respect to a predicate. The first argument is
* a relation. The second argument is a predicate with free de-Brujin
* a relation. The second argument is a predicate with free de-Bruijn
* indices corresponding to the columns of the relation. So the first column
* in the relation has index 0.
* @throws Z3Exception on error
@ -2094,7 +2094,7 @@ public class Expr extends AST
}
/**
* The de-Burijn index of a bound variable.
* The de-Bruijn index of a bound variable.
* Remarks: Bound variables are
* indexed by de-Bruijn indices. It is perhaps easiest to explain the
* meaning of de-Bruijn indices by indicating the compilation process from

View file

@ -239,7 +239,7 @@ public class Model extends Z3Object {
/**
* The uninterpreted sorts that the model has an interpretation for.
* Remarks: Z3 also provides an intepretation for uninterpreted sorts used
* Remarks: Z3 also provides an interpretation for uninterpreted sorts used
* in a formula. The interpretation for a sort is a finite set of distinct
* values. We say this finite set is the "universe" of the sort.
*

View file

@ -1994,7 +1994,7 @@ struct
if csn <> cs || cdn <> cd then
raise (Error "Argument size mismatch")
else
Z3native.parse_smtlib2_string ctx file_name
Z3native.parse_smtlib2_file ctx file_name
cs sort_names sorts cd decl_names decls
end

View file

@ -536,7 +536,7 @@ sig
@return A Term with the given value and sort *)
val mk_numeral_string : context -> string -> Sort.sort -> expr
(** Create a numeral of a given sort. This function can be use to create numerals that fit in a machine integer.
(** Create a numeral of a given sort. This function can be used to create numerals that fit in a machine integer.
It is slightly faster than [MakeNumeral] since it is not necessary to parse a string.
@return A Term with the given value and sort *)
val mk_numeral_int : context -> int -> Sort.sort -> expr
@ -667,7 +667,7 @@ sig
end
(** The de-Burijn index of a bound variable.
(** The de-Bruijn index of a bound variable.
Bound variables are indexed by de-Bruijn indices. It is perhaps easiest to explain
the meaning of de-Bruijn indices by indicating the compilation process from
@ -830,7 +830,7 @@ sig
(** Maps f on the argument arrays.
Eeach element of [args] must be of an array sort [[domain_i -> range_i]].
Each element of [args] must be of an array sort [[domain_i -> range_i]].
The function declaration [f] must have type [ range_1 .. range_n -> range].
[v] must have sort range. The sort of the result is [[domain_i -> range]].
{!Z3Array.mk_sort}
@ -962,7 +962,7 @@ sig
Filter (restrict) a relation with respect to a predicate.
The first argument is a relation.
The second argument is a predicate with free de-Brujin indices
The second argument is a predicate with free de-Bruijn indices
corresponding to the columns of the relation.
So the first column in the relation has index 0. *)
val is_filter : Expr.expr -> bool
@ -2233,7 +2233,7 @@ sig
(** Conversion of a 2's complement unsigned bit-vector term into a term of FloatingPoint sort. *)
val mk_to_fp_unsigned : context -> Expr.expr -> Expr.expr -> Sort.sort -> Expr.expr
(** C1onversion of a floating-point term into an unsigned bit-vector. *)
(** Conversion of a floating-point term into an unsigned bit-vector. *)
val mk_to_ubv : context -> Expr.expr -> Expr.expr -> int -> Expr.expr
(** Conversion of a floating-point term into a signed bit-vector. *)
@ -2385,7 +2385,7 @@ sig
Tn: (R t_n s_n)
[monotonicity T1 ... Tn]: (R (f t_1 ... t_n) (f s_1 ... s_n))
Remark: if t_i == s_i, then the antecedent Ti is suppressed.
That is, reflexivity proofs are supressed to save space. *)
That is, reflexivity proofs are suppressed to save space. *)
val is_monotonicity : Expr.expr -> bool
(** Indicates whether the term is a quant-intro proof
@ -2417,7 +2417,7 @@ sig
[and-elim T1]: l_i *)
val is_and_elimination : Expr.expr -> bool
(** Indicates whether the term is a proof by eliminiation of not-or
(** Indicates whether the term is a proof by elimination of not-or
Given a proof for (not (or l_1 ... l_n)), produces a proof for (not l_i).
T1: (not (or l_1 ... l_n))
@ -2500,7 +2500,7 @@ sig
A proof of (or (not (forall (x) (P x))) (P a)) *)
val is_quant_inst : Expr.expr -> bool
(** Indicates whether the term is a hypthesis marker.
(** Indicates whether the term is a hypothesis marker.
Mark a hypothesis in a natural deduction style proof. *)
val is_hypothesis : Expr.expr -> bool
@ -2882,7 +2882,7 @@ sig
(** The uninterpreted sorts that the model has an interpretation for.
Z3 also provides an intepretation for uninterpreted sorts used in a formula.
Z3 also provides an interpretation for uninterpreted sorts used in a formula.
The interpretation for a sort is a finite set of distinct values. We say this finite set is
the "universe" of the sort.
{!get_num_sorts}
@ -3056,7 +3056,7 @@ sig
(** Create a tactic that fails if the probe evaluates to false. *)
val fail_if : context -> Probe.probe -> tactic
(** Create a tactic that fails if the goal is not triviall satisfiable (i.e., empty)
(** Create a tactic that fails if the goal is not trivially satisfiable (i.e., empty)
or trivially unsatisfiable (i.e., contains `false'). *)
val fail_if_not_decided : context -> tactic
@ -3105,7 +3105,7 @@ sig
(** True if the entry is float-valued. *)
val is_float : statistics_entry -> bool
(** The string representation of the the entry's value. *)
(** The string representation of the entry's value. *)
val to_string_value : statistics_entry -> string
(** The string representation of the entry (key and value) *)
@ -3370,7 +3370,7 @@ sig
(** Assert a constraints into the optimize solver. *)
val add : optimize -> Expr.expr list -> unit
(** Asssert a soft constraint.
(** Assert a soft constraint.
Supply integer weight and string that identifies a group
of soft constraints. *)
val add_soft : optimize -> Expr.expr -> string -> Symbol.symbol -> handle
@ -3443,12 +3443,10 @@ sig
(** Parse the given string using the SMT-LIB2 parser.
{!parse_smtlib_string}
@return A conjunction of assertions in the scope (up to push/pop) at the end of the string. *)
val parse_smtlib2_string : context -> string -> Symbol.symbol list -> Sort.sort list -> Symbol.symbol list -> FuncDecl.func_decl list -> Expr.expr
(** Parse the given file using the SMT-LIB2 parser.
{!parse_smtlib2_string} *)
(** Parse the given file using the SMT-LIB2 parser. *)
val parse_smtlib2_file : context -> string -> Symbol.symbol list -> Sort.sort list -> Symbol.symbol list -> FuncDecl.func_decl list -> Expr.expr
end

View file

@ -182,7 +182,7 @@ class Context:
"""Interrupt a solver performing a satisfiability test, a tactic processing a goal, or simplify functions.
This method can be invoked from a thread different from the one executing the
interruptable procedure.
interruptible procedure.
"""
Z3_interrupt(self.ref())
@ -365,6 +365,12 @@ class AstRef(Z3PPObject):
_z3_assert(isinstance(target, Context), "argument must be a Z3 context")
return _to_ast_ref(Z3_translate(self.ctx.ref(), self.as_ast(), target.ref()), target)
def __copy__(self):
return self.translate(self.ctx)
def __deepcopy__(self):
return self.translate(self.ctx)
def hash(self):
"""Return a hashcode for the `self`.
@ -596,7 +602,7 @@ def _sort(ctx, a):
return _to_sort_ref(Z3_get_sort(ctx.ref(), a), ctx)
def DeclareSort(name, ctx=None):
"""Create a new uninterpred sort named `name`.
"""Create a new uninterpreted sort named `name`.
If `ctx=None`, then the new sort is declared in the global Z3Py context.
@ -718,7 +724,7 @@ class FuncDeclRef(AstRef):
The arguments must be Z3 expressions. This method assumes that
the sorts of the elements in `args` match the sorts of the
domain. Limited coersion is supported. For example, if
domain. Limited coercion is supported. For example, if
args[0] is a Python integer, and the function expects a Z3
integer, then the argument is automatically converted into a
Z3 integer.
@ -3568,6 +3574,14 @@ def BV2Int(a, is_signed=False):
## investigate problem with bv2int
return ArithRef(Z3_mk_bv2int(ctx.ref(), a.as_ast(), is_signed), ctx)
def Int2BV(a, num_bits):
"""Return the z3 expression Int2BV(a, num_bits).
It is a bit-vector of width num_bits and represents the
modulo of a by 2^num_bits
"""
ctx = a.ctx
return BitVecRef(Z3_mk_int2bv(ctx.ref(), num_bits, a.as_ast()), ctx)
def BitVecSort(sz, ctx=None):
"""Return a Z3 bit-vector sort of the given size. If `ctx=None`, then the global context is used.
@ -5040,6 +5054,12 @@ class Goal(Z3PPObject):
_z3_assert(isinstance(target, Context), "target must be a context")
return Goal(goal=Z3_goal_translate(self.ctx.ref(), self.goal, target.ref()), ctx=target)
def __copy__(self):
return self.translate(self.ctx)
def __deepcopy__(self):
return self.translate(self.ctx)
def simplify(self, *arguments, **keywords):
"""Return a new simplified goal.
@ -5132,10 +5152,19 @@ class AstVector(Z3PPObject):
>>> A[1]
y
"""
if isinstance(i, int):
if i < 0:
i += self.__len__()
if i >= self.__len__():
raise IndexError
return _to_ast_ref(Z3_ast_vector_get(self.ctx.ref(), self.vector, i), self.ctx)
elif isinstance(i, slice):
return [_to_ast_ref(Z3_ast_vector_get(self.ctx.ref(), self.vector, ii), self.ctx) for ii in range(*i.indices(self.__len__()))]
def __setitem__(self, i, v):
"""Update AST at position `i`.
@ -5213,6 +5242,12 @@ class AstVector(Z3PPObject):
"""
return AstVector(Z3_ast_vector_translate(self.ctx.ref(), self.vector, other_ctx.ref()), other_ctx)
def __copy__(self):
return self.translate(self.ctx)
def __deepcopy__(self):
return self.translate(self.ctx)
def __repr__(self):
return obj_to_string(self)
@ -5550,6 +5585,17 @@ class FuncInterp(Z3PPObject):
raise IndexError
return FuncEntry(Z3_func_interp_get_entry(self.ctx.ref(), self.f, idx), self.ctx)
def translate(self, other_ctx):
"""Copy model 'self' to context 'other_ctx'.
"""
return ModelRef(Z3_model_translate(self.ctx.ref(), self.model, other_ctx.ref()), other_ctx)
def __copy__(self):
return self.translate(self.ctx)
def __deepcopy__(self):
return self.translate(self.ctx)
def as_list(self):
"""Return the function interpretation as a Python list.
>>> f = Function('f', IntSort(), IntSort())
@ -5579,9 +5625,6 @@ class ModelRef(Z3PPObject):
self.ctx = ctx
Z3_model_inc_ref(self.ctx.ref(), self.model)
def __deepcopy__(self, memo={}):
return ModelRef(self.m, self.ctx)
def __del__(self):
if self.ctx.ref() is not None:
Z3_model_dec_ref(self.ctx.ref(), self.model)
@ -5835,6 +5878,20 @@ class ModelRef(Z3PPObject):
r.append(FuncDeclRef(Z3_model_get_func_decl(self.ctx.ref(), self.model, i), self.ctx))
return r
def translate(self, target):
"""Translate `self` to the context `target`. That is, return a copy of `self` in the context `target`.
"""
if __debug__:
_z3_assert(isinstance(target, Context), "argument must be a Z3 context")
model = Z3_model_translate(self.ctx.ref(), self.model, target.ref())
return Model(model, target)
def __copy__(self):
return self.translate(self.ctx)
def __deepcopy__(self):
return self.translate(self.ctx)
def is_as_array(n):
"""Return true if n is a Z3 expression of the form (_ as-array f)."""
return isinstance(n, ExprRef) and Z3_is_as_array(n.ctx.ref(), n.as_ast())
@ -6037,9 +6094,6 @@ class Solver(Z3PPObject):
self.solver = solver
Z3_solver_inc_ref(self.ctx.ref(), self.solver)
def __deepcopy__(self, memo={}):
return Solver(self.solver, self.ctx)
def __del__(self):
if self.solver is not None and self.ctx.ref() is not None:
Z3_solver_dec_ref(self.ctx.ref(), self.solver)
@ -6413,6 +6467,12 @@ class Solver(Z3PPObject):
solver = Z3_solver_translate(self.ctx.ref(), self.solver, target.ref())
return Solver(solver, target)
def __copy__(self):
return self.translate(self.ctx)
def __deepcopy__(self):
return self.translate(self.ctx)
def sexpr(self):
"""Return a formatted string (in Lisp-like format) with all added constraints. We say the string is in s-expression format.
@ -9183,7 +9243,7 @@ def fpMul(rm, a, b, ctx=None):
return _mk_fp_bin(Z3_mk_fpa_mul, rm, a, b, ctx)
def fpDiv(rm, a, b, ctx=None):
"""Create a Z3 floating-point divison expression.
"""Create a Z3 floating-point division expression.
>>> s = FPSort(8, 24)
>>> rm = RNE()
@ -9210,7 +9270,7 @@ def fpRem(a, b, ctx=None):
return _mk_fp_bin_norm(Z3_mk_fpa_rem, a, b, ctx)
def fpMin(a, b, ctx=None):
"""Create a Z3 floating-point minimium expression.
"""Create a Z3 floating-point minimum expression.
>>> s = FPSort(8, 24)
>>> rm = RNE()

View file

@ -270,7 +270,7 @@ typedef enum
- Z3_OP_ARRAY_MAP Array map operator.
It satisfies map[f](a1,..,a_n)[i] = f(a1[i],...,a_n[i]) for every i.
- Z3_OP_SET_UNION Set union between two Booelan arrays (two arrays whose range type is Boolean). The function is binary.
- Z3_OP_SET_UNION Set union between two Boolean arrays (two arrays whose range type is Boolean). The function is binary.
- Z3_OP_SET_INTERSECT Set intersection between two Boolean arrays. The function is binary.
@ -406,7 +406,7 @@ typedef enum
- Z3_OP_BSMUL_NO_UDFL: check that bit-wise signed multiplication does not underflow.
Signed multiplication underflows if the operands have opposite signs and the result of multiplication
does not fit within the avaialble bits. Z3_mk_bvmul_no_underflow.
does not fit within the available bits. Z3_mk_bvmul_no_underflow.
- Z3_OP_BSDIV_I: Binary signed division.
It has the same semantics as Z3_OP_BSDIV, but created in a context where the second operand can be assumed to be non-zero.
@ -485,7 +485,7 @@ typedef enum
[monotonicity T1 ... Tn]: (R (f t_1 ... t_n) (f s_1 ... s_n))
}
Remark: if t_i == s_i, then the antecedent Ti is suppressed.
That is, reflexivity proofs are supressed to save space.
That is, reflexivity proofs are suppressed to save space.
- Z3_OP_PR_QUANT_INTRO: Given a proof for (~ p q), produces a proof for (~ (forall (x) p) (forall (x) q)).
@ -832,7 +832,7 @@ typedef enum
- Z3_OP_RA_FILTER: Filter (restrict) a relation with respect to a predicate.
The first argument is a relation.
The second argument is a predicate with free de-Brujin indices
The second argument is a predicate with free de-Bruijn indices
corresponding to the columns of the relation.
So the first column in the relation has index 0.
@ -969,7 +969,7 @@ typedef enum
- Z3_OP_FPA_TO_FP: Floating-point conversion (various)
- Z3_OP_FPA_TO_FP_UNSIGNED: Floating-point conversion from unsigend bit-vector
- Z3_OP_FPA_TO_FP_UNSIGNED: Floating-point conversion from unsigned bit-vector
- Z3_OP_FPA_TO_UBV: Floating-point conversion to unsigned bit-vector
@ -984,7 +984,7 @@ typedef enum
of non-relevant terms in theory_fpa)
- Z3_OP_FPA_BV2RM: Conversion of a 3-bit bit-vector term to a
floating-point rouding-mode term
floating-point rounding-mode term
The conversion uses the following values:
0 = 000 = Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN,
@ -1331,7 +1331,7 @@ typedef enum {
- Z3_IOB: Index out of bounds.
- Z3_INVALID_ARG: Invalid argument was provided.
- Z3_PARSER_ERROR: An error occurred when parsing a string or file.
- Z3_NO_PARSER: Parser output is not available, that is, user didn't invoke #Z3_parse_smtlib_string or #Z3_parse_smtlib_file.
- Z3_NO_PARSER: Parser output is not available, that is, user didn't invoke #Z3_parse_smtlib2_string or #Z3_parse_smtlib2_file.
- Z3_INVALID_PATTERN: Invalid pattern was used to build a quantifier.
- Z3_MEMOUT_FAIL: A memory allocation failure was encountered.
- Z3_FILE_ACCESS_ERRROR: A file could not be accessed.
@ -1922,7 +1922,7 @@ extern "C" {
\param c logical context
\param name name of the enumeration sort.
\param n number of elemenets in enumeration sort.
\param n number of elements in enumeration sort.
\param enum_names names of the enumerated elements.
\param enum_consts constants corresponding to the enumerated elements.
\param enum_testers predicates testing if terms of the enumeration sort correspond to an enumeration.
@ -3186,7 +3186,7 @@ extern "C" {
\param c logical context.
\param num numerator of rational.
\param den denomerator of rational.
\param den denominator of rational.
\pre den != 0
@ -3201,7 +3201,7 @@ extern "C" {
/**
\brief Create a numeral of an int, bit-vector, or finite-domain sort.
This function can be use to create numerals that fit in a machine integer.
This function can be used to create numerals that fit in a machine integer.
It is slightly faster than #Z3_mk_numeral since it is not necessary to parse a string.
\sa Z3_mk_numeral
@ -3213,7 +3213,7 @@ extern "C" {
/**
\brief Create a numeral of a int, bit-vector, or finite-domain sort.
This function can be use to create numerals that fit in a machine unsinged integer.
This function can be used to create numerals that fit in a machine unsigned integer.
It is slightly faster than #Z3_mk_numeral since it is not necessary to parse a string.
\sa Z3_mk_numeral
@ -3225,7 +3225,7 @@ extern "C" {
/**
\brief Create a numeral of a int, bit-vector, or finite-domain sort.
This function can be use to create numerals that fit in a machine __int64 integer.
This function can be used to create numerals that fit in a machine __int64 integer.
It is slightly faster than #Z3_mk_numeral since it is not necessary to parse a string.
\sa Z3_mk_numeral
@ -3237,7 +3237,7 @@ extern "C" {
/**
\brief Create a numeral of a int, bit-vector, or finite-domain sort.
This function can be use to create numerals that fit in a machine __uint64 integer.
This function can be used to create numerals that fit in a machine __uint64 integer.
It is slightly faster than #Z3_mk_numeral since it is not necessary to parse a string.
\sa Z3_mk_numeral
@ -3493,8 +3493,8 @@ extern "C" {
Z3_ast Z3_API Z3_mk_re_range(Z3_context c, Z3_ast lo, Z3_ast hi);
/**
\brief Create a regular expression loop. The supplied regular expression \c r is repated
between \c lo and \c hi times. The \c lo should be below \c hi with one exection: when
\brief Create a regular expression loop. The supplied regular expression \c r is repeated
between \c lo and \c hi times. The \c lo should be below \c hi with one exception: when
supplying the value \c hi as 0, the meaning is to repeat the argument \c r at least
\c lo number of times, and with an unbounded upper bound.
@ -4248,7 +4248,7 @@ extern "C" {
Z3_sort Z3_API Z3_get_decl_sort_parameter(Z3_context c, Z3_func_decl d, unsigned idx);
/**
\brief Return the expresson value associated with an expression parameter.
\brief Return the expression value associated with an expression parameter.
\pre Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_AST
@ -4257,7 +4257,7 @@ extern "C" {
Z3_ast Z3_API Z3_get_decl_ast_parameter(Z3_context c, Z3_func_decl d, unsigned idx);
/**
\brief Return the expresson value associated with an expression parameter.
\brief Return the expression value associated with an expression parameter.
\pre Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_FUNC_DECL
@ -4327,7 +4327,7 @@ extern "C" {
/**
\brief Return a hash code for the given AST.
The hash code is structural. You can use Z3_get_ast_id interchangably with
The hash code is structural. You can use Z3_get_ast_id interchangeably with
this function.
def_API('Z3_get_ast_hash', UINT, (_in(CONTEXT), _in(AST)))
@ -4556,7 +4556,7 @@ extern "C" {
Z3_ast Z3_API Z3_get_pattern(Z3_context c, Z3_pattern p, unsigned idx);
/**
\brief Return index of de-Brujin bound variable.
\brief Return index of de-Bruijn bound variable.
\pre Z3_get_ast_kind(a) == Z3_VAR_AST
@ -4659,7 +4659,7 @@ extern "C" {
Provides an interface to the AST simplifier used by Z3.
It returns an AST object which is equal to the argument.
The returned AST is simplified using algebraic simplificaiton rules,
The returned AST is simplified using algebraic simplification rules,
such as constant propagation (propagating true/false over logical connectives).
def_API('Z3_simplify', AST, (_in(CONTEXT), _in(AST)))
@ -4861,9 +4861,9 @@ extern "C" {
Z3_func_decl Z3_API Z3_model_get_func_decl(Z3_context c, Z3_model m, unsigned i);
/**
\brief Return the number of uninterpreted sorts that \c m assigs an interpretation to.
\brief Return the number of uninterpreted sorts that \c m assigns an interpretation to.
Z3 also provides an intepretation for uninterpreted sorts used in a formua.
Z3 also provides an interpretation for uninterpreted sorts used in a formula.
The interpretation for a sort \c s is a finite set of distinct values. We say this finite set is
the "universe" of \c s.
@ -4896,6 +4896,13 @@ extern "C" {
*/
Z3_ast_vector Z3_API Z3_model_get_sort_universe(Z3_context c, Z3_model m, Z3_sort s);
/**
\brief translate model from context c to context \c dst.
def_API('Z3_model_translate', MODEL, (_in(CONTEXT), _in(MODEL), _in(CONTEXT)))
*/
Z3_model Z3_API Z3_model_translate(Z3_context c, Z3_model m, Z3_context dst);
/**
\brief The \ccode{(_ as-array f)} AST node is a construct for assigning interpretations for arrays in Z3.
It is the array such that forall indices \c i we have that \ccode{(select (_ as-array f) i)} is equal to \ccode{(f i)}.
@ -4964,7 +4971,7 @@ extern "C" {
unsigned Z3_API Z3_func_interp_get_num_entries(Z3_context c, Z3_func_interp f);
/**
\brief Return a "point" of the given function intepretation. It represents the
\brief Return a "point" of the given function interpretation. It represents the
value of \c f in a particular point.
\pre i < Z3_func_interp_get_num_entries(c, f)
@ -5006,7 +5013,7 @@ extern "C" {
\brief add a function entry to a function interpretation.
\param c logical context
\param fi a function interpregation to be updated.
\param fi a function interpretation to be updated.
\param args list of arguments. They should be constant values (such as integers) and be of the same types as the domain of the function.
\param value value of the function when the parameters match args.
@ -5459,7 +5466,7 @@ extern "C" {
Z3_bool Z3_API Z3_goal_is_decided_unsat(Z3_context c, Z3_goal g);
/**
\brief Copy a goal \c g from the context \c source to a the context \c target.
\brief Copy a goal \c g from the context \c source to the context \c target.
def_API('Z3_goal_translate', GOAL, (_in(CONTEXT), _in(GOAL), _in(CONTEXT)))
*/
@ -5925,7 +5932,7 @@ extern "C" {
Z3_solver Z3_API Z3_mk_solver_from_tactic(Z3_context c, Z3_tactic t);
/**
\brief Copy a solver \c s from the context \c source to a the context \c target.
\brief Copy a solver \c s from the context \c source to the context \c target.
def_API('Z3_solver_translate', SOLVER, (_in(CONTEXT), _in(SOLVER), _in(CONTEXT)))
*/

View file

@ -370,7 +370,7 @@ public:
app * mk_lt(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_LT, arg1, arg2); }
app * mk_gt(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_GT, arg1, arg2); }
app * mk_add(unsigned num_args, expr * const * args) const { return m_manager.mk_app(m_afid, OP_ADD, num_args, args); }
app * mk_add(unsigned num_args, expr * const * args) const { return num_args == 1 && is_app(args[0]) ? to_app(args[0]) : m_manager.mk_app(m_afid, OP_ADD, num_args, args); }
app * mk_add(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_ADD, arg1, arg2); }
app * mk_add(expr * arg1, expr * arg2, expr* arg3) const { return m_manager.mk_app(m_afid, OP_ADD, arg1, arg2, arg3); }
@ -378,7 +378,7 @@ public:
app * mk_sub(unsigned num_args, expr * const * args) const { return m_manager.mk_app(m_afid, OP_SUB, num_args, args); }
app * mk_mul(expr * arg1, expr * arg2) const { return m_manager.mk_app(m_afid, OP_MUL, arg1, arg2); }
app * mk_mul(expr * arg1, expr * arg2, expr* arg3) const { return m_manager.mk_app(m_afid, OP_MUL, arg1, arg2, arg3); }
app * mk_mul(unsigned num_args, expr * const * args) const { return m_manager.mk_app(m_afid, OP_MUL, num_args, args); }
app * mk_mul(unsigned num_args, expr * const * args) const { return num_args == 1 && is_app(args[0]) ? to_app(args[0]) : m_manager.mk_app(m_afid, OP_MUL, num_args, args); }
app * mk_uminus(expr * arg) const { return m_manager.mk_app(m_afid, OP_UMINUS, arg); }
app * mk_div(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_DIV, arg1, arg2); }
app * mk_idiv(expr * arg1, expr * arg2) { return m_manager.mk_app(m_afid, OP_IDIV, arg1, arg2); }

View file

@ -1492,11 +1492,8 @@ void ast_manager::compact_memory() {
unsigned capacity = m_ast_table.capacity();
if (capacity > 4*m_ast_table.size()) {
ast_table new_ast_table;
ast_table::iterator it = m_ast_table.begin();
ast_table::iterator end = m_ast_table.end();
for (; it != end; ++it) {
new_ast_table.insert(*it);
}
for (ast* curr : m_ast_table)
new_ast_table.insert(curr);
m_ast_table.swap(new_ast_table);
IF_VERBOSE(10, verbose_stream() << "(ast-table :prev-capacity " << capacity
<< " :capacity " << m_ast_table.capacity() << " :size " << m_ast_table.size() << ")\n";);
@ -1510,10 +1507,7 @@ void ast_manager::compress_ids() {
ptr_vector<ast> asts;
m_expr_id_gen.cleanup();
m_decl_id_gen.cleanup(c_first_decl_id);
ast_table::iterator it = m_ast_table.begin();
ast_table::iterator end = m_ast_table.end();
for (; it != end; ++it) {
ast * n = *it;
for (ast * n : m_ast_table) {
if (is_decl(n))
n->m_id = m_decl_id_gen.mk();
else
@ -1521,10 +1515,8 @@ void ast_manager::compress_ids() {
asts.push_back(n);
}
m_ast_table.finalize();
ptr_vector<ast>::iterator it2 = asts.begin();
ptr_vector<ast>::iterator end2 = asts.end();
for (; it2 != end2; ++it2)
m_ast_table.insert(*it2);
for (ast* a : asts)
m_ast_table.insert(a);
}
void ast_manager::raise_exception(char const * msg) {
@ -1570,19 +1562,14 @@ void ast_manager::copy_families_plugins(ast_manager const & from) {
}
void ast_manager::set_next_expr_id(unsigned id) {
while (true) {
try_again:
id = m_expr_id_gen.set_next_id(id);
ast_table::iterator it = m_ast_table.begin();
ast_table::iterator end = m_ast_table.end();
for (; it != end; ++it) {
ast * curr = *it;
if (curr->get_id() == id)
break;
}
if (it == end)
return;
for (ast * curr : m_ast_table) {
if (curr->get_id() == id) {
// id is in use, move to the next one.
id++;
++id;
goto try_again;
}
}
}

View file

@ -53,6 +53,12 @@ Revision History:
#pragma warning(disable : 4355)
#endif
#ifdef _MSC_VER
# define Z3_NORETURN __declspec(noreturn)
#else
# define Z3_NORETURN [[noreturn]]
#endif
class ast;
class ast_manager;
@ -330,7 +336,7 @@ std::ostream& operator<<(std::ostream& out, sort_size const & ss);
// -----------------------------------
/**
\brief Extra information that may be attached to intepreted sorts.
\brief Extra information that may be attached to interpreted sorts.
*/
class sort_info : public decl_info {
sort_size m_num_elements;
@ -932,7 +938,7 @@ struct builtin_name {
};
/**
\brief Each family of intepreted function declarations and sorts must provide a plugin
\brief Each family of interpreted function declarations and sorts must provide a plugin
to build sorts and decls of the family.
*/
class decl_plugin {
@ -1059,7 +1065,7 @@ protected:
ptr_vector<func_decl> m_eq_decls; // cached eqs
ptr_vector<func_decl> m_ite_decls; // cached ites
ptr_vector<func_decl> m_oeq_decls; // cached obsevational eqs
ptr_vector<func_decl> m_oeq_decls; // cached observational eqs
sort * m_proof_sort;
func_decl * m_undef_decl;
func_decl * m_true_pr_decl;
@ -1161,7 +1167,7 @@ public:
virtual expr * get_some_value(sort * s);
};
typedef app proof; /* a proof is just an applicaton */
typedef app proof; /* a proof is just an application */
// -----------------------------------
//
@ -1220,7 +1226,7 @@ enum pattern_op_kind {
/**
\brief Patterns are used to group expressions. These expressions are using during E-matching for
heurisitic quantifier instantiation.
heuristic quantifier instantiation.
*/
class pattern_decl_plugin : public decl_plugin {
public:
@ -1245,13 +1251,13 @@ enum model_value_op_kind {
/**
\brief Values are used during model construction. All values are
assumed to be different. Users should not use them, since they may
introduce unsoundess if the sort of a value is finite.
introduce unsoundness if the sort of a value is finite.
Moreover, values should never be internalized in a logical context.
However, values can be used during evaluation (i.e., simplification).
\remark Model values can be viewed as the partion ids in Z3 1.x.
\remark Model values can be viewed as the partition ids in Z3 1.x.
*/
class model_value_decl_plugin : public decl_plugin {
public:
@ -1515,7 +1521,7 @@ public:
void compress_ids();
// Equivalent to throw ast_exception(msg)
void raise_exception(char const * msg);
Z3_NORETURN void raise_exception(char const * msg);
bool is_format_manager() const { return m_format_manager == 0; }

View file

@ -502,7 +502,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
return false;
}
case PR_HYPOTHESIS: {
// TBD all branches with hyptheses must be closed by a later lemma.
// TBD all branches with hypotheses must be closed by a later lemma.
if (match_proof(p) &&
match_fact(p, fml)) {
return true;

View file

@ -1193,7 +1193,6 @@ bool bit_blaster_tpl<Cfg>::mk_const_case_multiplier(unsigned sz, expr * const *
return false;
}
SASSERT(out_bits.empty());
ptr_buffer<expr, 128> na_bits;
na_bits.append(sz, a_bits);
ptr_buffer<expr, 128> nb_bits;

View file

@ -55,7 +55,7 @@ class iz3proof_itp_impl : public iz3proof_itp {
/* The summation rule. The term sum(p,c,i) takes a proof p of an
inequality i', an integer coefficient c and an inequality i, and
yieds a proof of i' + ci. */
yields a proof of i' + ci. */
symb sum;
/* Proof rotation. The proof term rotate(q,p) takes a
@ -75,7 +75,7 @@ class iz3proof_itp_impl : public iz3proof_itp {
symb leq2eq;
/* Equality to inequality. eq2leq(p, q) takes a proof p of x=y, and
a proof q ~(x <= y) and and yields a proof of false. */
a proof q ~(x <= y) and yields a proof of false. */
symb eq2leq;
/* Proof term cong(p,q) takes a proof p of x=y and a proof
@ -97,7 +97,7 @@ class iz3proof_itp_impl : public iz3proof_itp {
/* This oprerator represents a concatenation of rewrites. The term
a=b;c=d represents an A rewrite from a to b, followed by a B
rewrite fron b to c, followed by an A rewrite from c to d.
rewrite from b to c, followed by an A rewrite from c to d.
*/
symb concat;
@ -1542,7 +1542,7 @@ class iz3proof_itp_impl : public iz3proof_itp {
return my_implies(arg(rew,1),arg(rew,2));
}
// make rewrite rew conditon on rewrite cond
// make rewrite rew condition on rewrite cond
ast rewrite_conditional(const ast &cond, const ast &rew){
ast cf = rewrite_to_formula(cond);
return make(sym(rew),arg(rew,0),my_and(arg(rew,1),cf),arg(rew,2));

View file

@ -9,7 +9,7 @@
Translate a Z3 proof into the interpolating proof calculus.
Translation is direct, without transformations on the target proof
representaiton.
representation.
Author:

View file

@ -150,7 +150,6 @@ namespace polynomial {
return r;
}
/**
\brief Monomials (power products)
*/
@ -257,9 +256,7 @@ namespace polynomial {
if (m_size < SMALL_MONOMIAL) {
// use linear search for small monomials
// search backwards since we usually ask for the degree of "big" variables
unsigned i = last;
while (i > 0) {
--i;
for (unsigned i = last; i-- > 0; ) {
if (get_var(i) == x)
return i;
}
@ -798,9 +795,8 @@ namespace polynomial {
dec_ref(m_unit);
CTRACE("polynomial", !m_monomials.empty(),
tout << "monomials leaked\n";
monomial_table::iterator it = m_monomials.begin(); monomial_table::iterator end = m_monomials.end();
for (; it != end; ++it) {
(*it)->display(tout); tout << "\n";
for (auto * m : m_monomials) {
m->display(tout); tout << "\n";
});
SASSERT(m_monomials.empty());
if (m_own_allocator)
@ -1510,6 +1506,8 @@ namespace polynomial {
unsigned id() const { return m_id; }
unsigned size() const { return m_size; }
monomial * m(unsigned idx) const { SASSERT(idx < size()); return m_ms[idx]; }
monomial *const* begin() const { return m_ms; }
monomial *const* end() const { return m_ms + size(); }
numeral const & a(unsigned idx) const { SASSERT(idx < size()); return m_as[idx]; }
numeral & a(unsigned idx) { SASSERT(idx < size()); return m_as[idx]; }
numeral const * as() const { return m_as; }
@ -1773,11 +1771,9 @@ namespace polynomial {
}
bool manager::is_linear(polynomial const * p) {
unsigned sz = p->size();
for (unsigned i = 0; i < sz; i++) {
if (!is_linear(p->m(0)))
for (monomial* m : *p)
if (!is_linear(m))
return false;
}
return true;
}
@ -2396,6 +2392,7 @@ namespace polynomial {
return mm().is_valid(x);
}
void add_del_eh(del_eh * eh) {
eh->m_next = m_del_eh;
m_del_eh = eh;
@ -6101,6 +6098,33 @@ namespace polynomial {
});
}
lbool sign(monomial* m, numeral const& c, svector<lbool> const& sign_of_vars) {
unsigned sz = size(m);
lbool sign1 = m_manager.is_pos(c) ? l_true : l_false;
for (unsigned i = 0; i < sz; ++i) {
var v = get_var(m, i);
unsigned d = degree(m, i);
lbool sign2 = sign_of_vars.get(v, l_undef);
if (sign2 == l_undef)
return l_undef;
else if (1 == (d % 2) && sign2 == l_false) {
sign1 = sign1 == l_true ? l_false : l_true;
}
}
return sign1;
}
lbool sign(polynomial const * p, svector<lbool> const& sign_of_vars) {
unsigned sz = size(p);
if (sz == 0) return l_undef;
lbool sign1 = sign(p->m(0), p->a(0), sign_of_vars);
for (unsigned i = 1; sign1 != l_undef && i < sz; ++i) {
if (sign(p->m(i), p->a(i), sign_of_vars) != sign1)
return l_undef;
}
return sign1;
}
bool is_pos(polynomial const * p) {
bool found_unit = false;
unsigned sz = p->size();
@ -6374,6 +6398,31 @@ namespace polynomial {
return R.mk();
}
void substitute(polynomial const* r, var x, polynomial const* p, polynomial const* q, polynomial_ref& result) {
unsigned md = degree(r, x);
if (md == 0) {
result = const_cast<polynomial*>(r);
return;
}
result = 0;
polynomial_ref p1(pm()), q1(pm());
polynomial_ref_buffer ps(pm());
unsigned sz = r->size();
for (unsigned i = 0; i < sz; i++) {
monomial * m0 = r->m(i);
unsigned dm = m0->degree_of(x);
SASSERT(md >= dm);
monomial_ref m1(div_x(m0, x), pm());
pw(p, dm, p1);
pw(q, md - dm, q1);
p1 = mul(r->a(i), m1, p1 * q1);
if (result)
result = add(result, p1);
else
result = p1;
}
}
/**
Auxiliary method used to implement t_eval.
@ -6918,6 +6967,18 @@ namespace polynomial {
return m_imp->m().set_zp(p);
}
bool manager::is_var(polynomial const* p, var& v) {
return p->size() == 1 && is_var(p->m(0), v) && m_imp->m().is_one(p->a(0));
}
bool manager::is_var(monomial const* m, var& v) {
return m->size() == 1 && m->degree(0) == 1 && (v = m->get_var(0), true);
}
bool manager::is_var_num(polynomial const* p, var& v, scoped_numeral& n) {
return p->size() == 2 && m_imp->m().is_one(p->a(0)) && is_var(p->m(0), v) && is_unit(p->m(1)) && (n = p->a(1), true);
}
small_object_allocator & manager::allocator() const {
return m_imp->mm().allocator();
}
@ -7272,6 +7333,10 @@ namespace polynomial {
m_imp->psc_chain(p, q, x, S);
}
lbool manager::sign(polynomial const * p, svector<lbool> const& sign_of_vars) {
return m_imp->sign(p, sign_of_vars);
}
bool manager::is_pos(polynomial const * p) {
return m_imp->is_pos(p);
}
@ -7308,6 +7373,10 @@ namespace polynomial {
return m_imp->substitute(p, xs_sz, xs, vs);
}
void manager::substitute(polynomial const* r, var x, polynomial const* p, polynomial const* q, polynomial_ref& result) {
m_imp->substitute(r, x, p, q, result);
}
void manager::factor(polynomial const * p, factors & r, factor_params const & params) {
m_imp->factor(p, r, params);
}

View file

@ -29,6 +29,7 @@ Notes:
#include "util/params.h"
#include "util/mpbqi.h"
#include "util/rlimit.h"
#include "util/lbool.h"
class small_object_allocator;
@ -98,7 +99,7 @@ namespace polynomial {
};
struct display_var_proc {
virtual void operator()(std::ostream & out, var x) const { out << "x" << x; }
virtual std::ostream& operator()(std::ostream & out, var x) const { return out << "x" << x; }
};
class polynomial;
@ -312,6 +313,21 @@ namespace polynomial {
*/
static bool is_linear(polynomial const * p);
/**
\brief Return true if the monomial is a variable.
*/
static bool is_var(monomial const* p, var& v);
/**
\brief Return true if the polynomial is a variable.
*/
bool is_var(polynomial const* p, var& v);
/**
\brief Return true if the polynomial is of the form x + k
*/
bool is_var_num(polynomial const* p, var& v, scoped_numeral& n);
/**
\brief Return the degree of variable x in p.
*/
@ -861,6 +877,12 @@ namespace polynomial {
*/
bool sqrt(polynomial const * p, polynomial_ref & r);
/**
\brief obtain the sign of the polynomial given sign of variables.
*/
lbool sign(polynomial const* p, svector<lbool> const& sign_of_vars);
/**
\brief Return true if p is always positive for any assignment of its variables.
@ -936,6 +958,13 @@ namespace polynomial {
return substitute(p, 1, &x, &v);
}
/**
\brief Apply substiution [x -> p/q] in r.
That is, given r \in Z[x, y_1, .., y_m] return
polynomial q^k * r(p/q, y_1, .., y_m), where k is the maximal degree of x in r.
*/
void substitute(polynomial const* r, var x, polynomial const* p, polynomial const* q, polynomial_ref& result);
/**
\brief Factorize the given polynomial p and store its factors in r.
*/

View file

@ -634,7 +634,7 @@ namespace simplex {
//
// max { c*x | A*x = 0 and l <= x <= u }
//
// start with feasible assigment
// start with feasible assignment
// A*x0 = 0 and l <= x0 <= u
//
// Identify pivot: i, j: such that x_i is base,

View file

@ -60,7 +60,7 @@ namespace datalog {
ACK_UNBOUND_VAR(var_index) - encodes that the column contains a variable that
is unbound (by the corresponding rule body),
var_index is the de-Brujin index (var->get_idx())
var_index is the de-Bruijn index (var->get_idx())
of the variable associated with the column.
ACK_CONSTANT(constant) - encodes that the column contains the constant.

View file

@ -609,7 +609,7 @@ namespace datalog {
std::string to_nice_string(const relation_element & el) const;
/**
This one may give a nicer representation of \c el than the
\c to_nice_string(const relation_element & el) function, by unsing the information about the sort
\c to_nice_string(const relation_element & el) function, by using the information about the sort
of the element.
*/
std::string to_nice_string(const relation_sort & s, const relation_element & el) const;

View file

@ -44,6 +44,8 @@ namespace nlsat {
bool is_learned() const { return m_learned; }
literal * begin() { return m_lits; }
literal * end() { return m_lits + m_size; }
literal const * begin() const { return m_lits; }
literal const * end() const { return m_lits + m_size; }
literal const * c_ptr() const { return m_lits; }
void inc_activity() { m_activity++; }
void set_activity(unsigned v) { m_activity = v; }

View file

@ -672,14 +672,14 @@ namespace nlsat {
return new_set;
}
void interval_set_manager::peek_in_complement(interval_set const * s, anum & w, bool randomize) {
void interval_set_manager::peek_in_complement(interval_set const * s, bool is_int, anum & w, bool randomize) {
SASSERT(!is_full(s));
if (s == 0) {
if (randomize) {
int num = m_rand() % 2 == 0 ? 1 : -1;
#define MAX_RANDOM_DEN_K 4
int den_k = (m_rand() % MAX_RANDOM_DEN_K);
int den = 1 << den_k;
int den = is_int ? 1 : (1 << den_k);
scoped_mpq _w(m_am.qm());
m_am.qm().set(_w, num, den);
m_am.set(w, _w);

View file

@ -108,7 +108,7 @@ namespace nlsat {
\pre !is_full(s)
*/
void peek_in_complement(interval_set const * s, anum & w, bool randomize);
void peek_in_complement(interval_set const * s, bool is_int, anum & w, bool randomize);
};
typedef obj_ref<interval_set, interval_set_manager> interval_set_ref;

View file

@ -10,6 +10,7 @@ def_module_params('nlsat',
('randomize', BOOL, True, "randomize selection of a witness in nlsat."),
('max_conflicts', UINT, UINT_MAX, "maximum number of conflicts."),
('shuffle_vars', BOOL, False, "use a random variable order."),
('inline_vars', BOOL, False, "inline variables that can be isolated from equations"),
('seed', UINT, 0, "random seed."),
('factor', BOOL, True, "factor polynomials produced during conflict resolution.")
))

File diff suppressed because it is too large Load diff

View file

@ -35,7 +35,7 @@ namespace nlsat {
struct imp;
imp * m_imp;
public:
solver(reslimit& rlim, params_ref const & p);
solver(reslimit& rlim, params_ref const & p, bool incremental);
~solver();
/**

View file

@ -47,6 +47,8 @@ namespace nlsat {
typedef polynomial::var_vector var_vector;
typedef polynomial::manager pmanager;
typedef polynomial::polynomial poly;
typedef polynomial::monomial monomial;
typedef polynomial::numeral numeral;
const var null_var = polynomial::null_var;
const var true_bool_var = 0;
@ -148,10 +150,7 @@ namespace nlsat {
typedef algebraic_numbers::anum anum;
typedef algebraic_numbers::manager anum_manager;
class solver_exception : public default_exception {
public:
solver_exception(char const * msg):default_exception(msg) {}
};
typedef default_exception solver_exception;
class assignment;

View file

@ -32,11 +32,11 @@ class nlsat_tactic : public tactic {
ast_manager & m;
expr_ref_vector m_var2expr;
expr_display_var_proc(ast_manager & _m):m(_m), m_var2expr(_m) {}
virtual void operator()(std::ostream & out, nlsat::var x) const {
virtual std::ostream& operator()(std::ostream & out, nlsat::var x) const {
if (x < m_var2expr.size())
out << mk_ismt2_pp(m_var2expr.get(x), m);
return out << mk_ismt2_pp(m_var2expr.get(x), m);
else
out << "x!" << x;
return out << "x!" << x;
}
};
@ -51,7 +51,7 @@ class nlsat_tactic : public tactic {
m(_m),
m_params(p),
m_display_var(_m),
m_solver(m.limit(), p) {
m_solver(m.limit(), p, false) {
}
void updt_params(params_ref const & p) {

View file

@ -48,11 +48,15 @@ tactic * mk_qfnra_nlsat_tactic(ast_manager & m, params_ref const & p) {
purify_p),
mk_propagate_values_tactic(m, p),
mk_solve_eqs_tactic(m, p),
using_params(mk_purify_arith_tactic(m, p),
purify_p),
mk_elim_uncnstr_tactic(m, p),
mk_elim_term_ite_tactic(m, p)),
and_then(/* mk_degree_shift_tactic(m, p), */ // may affect full dimensionality detection
factor,
mk_solve_eqs_tactic(m, p),
using_params(mk_purify_arith_tactic(m, p),
purify_p),
using_params(mk_simplify_tactic(m, p),
main_p),
mk_tseitin_cnf_core_tactic(m, p),

View file

@ -1235,6 +1235,9 @@ namespace opt {
}
void context::display_assignment(std::ostream& out) {
if (m_scoped_state.m_objectives.size() != m_objectives.size()) {
throw default_exception("check-sat has not been called with latest objectives");
}
out << "(objectives\n";
for (unsigned i = 0; i < m_scoped_state.m_objectives.size(); ++i) {
objective const& obj = m_scoped_state.m_objectives[i];

View file

@ -782,7 +782,7 @@ namespace qe {
m(m),
m_mode(mode),
m_params(p),
m_solver(m.limit(), p),
m_solver(m.limit(), p, true),
m_nftactic(0),
m_rmodel(m_solver.am()),
m_rmodel0(m_solver.am()),

View file

@ -974,7 +974,7 @@ namespace ar {
// ------------------------------------------------------------
// fm_tactic adapted to eliminate designated de-Brujin indices.
// fm_tactic adapted to eliminate designated de-Bruijn indices.
namespace fm {
typedef ptr_vector<app> clauses;

View file

@ -131,6 +131,7 @@ void asserted_formulas::set_eliminate_and(bool flag) {
p.set_bool("gcd_rounding", true);
p.set_bool("expand_select_store", true);
p.set_bool("bv_sort_ac", true);
p.set_bool("som", true);
m_rewriter.updt_params(p);
flush_cache();
}

View file

@ -188,7 +188,7 @@ namespace smt {
1) Variables: (f ... X ...)
2) Ground terms: (f ... t ...)
3) depth 2 joint: (f ... (g ... X ...) ...)
Joint2 stores the declartion g, and the position of variable X, and its idx.
Joint2 stores the declaration g, and the position of variable X, and its idx.
\remark Z3 has no support for depth 3 joints (f ... (g ... (h ... X ...) ...) ....)
*/
@ -211,7 +211,7 @@ namespace smt {
approx_set m_lbl_set; // singleton set containing m_label
/*
The following field is an array of tagged pointers.
Each positon contains:
Each position contains:
1- null (no joint), NULL_TAG
2- a boxed integer (i.e., register that contains the variable bind) VAR_TAG
3- an enode pointer (ground term) GROUND_TERM_TAG

View file

@ -3202,10 +3202,8 @@ namespace smt {
});
validate_unsat_core();
// theory validation of unsat core
ptr_vector<theory>::iterator th_it = m_theory_set.begin();
ptr_vector<theory>::iterator th_end = m_theory_set.end();
for (; th_it != th_end; ++th_it) {
lbool theory_result = (*th_it)->validate_unsat_core(m_unsat_core);
for (theory* th : m_theory_set) {
lbool theory_result = th->validate_unsat_core(m_unsat_core);
if (theory_result == l_undef) {
return l_undef;
}
@ -3296,10 +3294,8 @@ namespace smt {
#ifndef _EXTERNAL_RELEASE
if (m_fparams.m_display_installed_theories) {
std::cout << "(theories";
ptr_vector<theory>::iterator it = m_theory_set.begin();
ptr_vector<theory>::iterator end = m_theory_set.end();
for (; it != end; ++it) {
std::cout << " " << (*it)->get_name();
for (theory* th : m_theory_set) {
std::cout << " " << th->get_name();
}
std::cout << ")" << std::endl;
}
@ -3316,17 +3312,13 @@ namespace smt {
m_fparams.m_relevancy_lemma = false;
// setup all the theories
ptr_vector<theory>::iterator it = m_theory_set.begin();
ptr_vector<theory>::iterator end = m_theory_set.end();
for (; it != end; ++it)
(*it)->setup();
for (theory* th : m_theory_set)
th->setup();
}
void context::add_theory_assumptions(expr_ref_vector & theory_assumptions) {
ptr_vector<theory>::iterator it = m_theory_set.begin();
ptr_vector<theory>::iterator end = m_theory_set.end();
for (; it != end; ++it) {
(*it)->add_theory_assumptions(theory_assumptions);
for (theory* th : m_theory_set) {
th->add_theory_assumptions(theory_assumptions);
}
}
@ -3342,6 +3334,16 @@ namespace smt {
if (!check_preamble(reset_cancel))
return l_undef;
TRACE("check_bug", tout << "inconsistent: " << inconsistent() << ", m_unsat_core.empty(): " << m_unsat_core.empty() << "\n";);
pop_to_base_lvl();
TRACE("before_search", display(tout););
SASSERT(at_base_level());
lbool r = l_undef;
if (inconsistent()) {
r = l_false;
}
else {
setup_context(false);
expr_ref_vector all_assumptions(m_manager, ext_num_assumptions, ext_assumptions);
if (!already_did_theory_assumptions) {
add_theory_assumptions(all_assumptions);
@ -3352,17 +3354,8 @@ namespace smt {
if (!validate_assumptions(num_assumptions, assumptions))
return l_undef;
TRACE("check_bug", tout << "inconsistent: " << inconsistent() << ", m_unsat_core.empty(): " << m_unsat_core.empty() << "\n";);
TRACE("unsat_core_bug", for (unsigned i = 0; i < num_assumptions; i++) { tout << mk_pp(assumptions[i], m_manager) << "\n";});
pop_to_base_lvl();
TRACE("before_search", display(tout););
SASSERT(at_base_level());
lbool r = l_undef;
if (inconsistent()) {
r = l_false;
}
else {
setup_context(false);
TRACE("unsat_core_bug", tout << all_assumptions << "\n";);
internalize_assertions();
TRACE("after_internalize_assertions", display(tout););
if (m_asserted_formulas.inconsistent()) {
@ -3551,10 +3544,9 @@ namespace smt {
pop_scope(m_scope_lvl - curr_lvl);
SASSERT(at_search_level());
}
ptr_vector<theory>::iterator it = m_theory_set.begin();
ptr_vector<theory>::iterator end = m_theory_set.end();
for (; it != end && !inconsistent(); ++it)
(*it)->restart_eh();
for (theory* th : m_theory_set) {
if (!inconsistent()) th->restart_eh();
}
TRACE("mbqi_bug_detail", tout << "before instantiating quantifiers...\n";);
if (!inconsistent()) {
m_qmanager->restart_eh();
@ -4070,10 +4062,7 @@ namespace smt {
bool include = false;
if (at_lbls) {
// include if there is a label with the '@' sign.
buffer<symbol>::const_iterator it = lbls.begin();
buffer<symbol>::const_iterator end = lbls.end();
for (; it != end; ++it) {
symbol const & s = *it;
for (symbol const& s : lbls) {
if (s.contains('@')) {
include = true;
break;

View file

@ -369,7 +369,7 @@ namespace smt {
else {
TRACE("internalize_bug", tout << "creating enode for #" << n->get_id() << "\n";);
mk_enode(to_app(n),
true, /* supress arguments, we not not use CC for this kind of enode */
true, /* suppress arguments, we not not use CC for this kind of enode */
true, /* bool enode must be merged with true/false, since it is not in the context of a gate */
false /* CC is not enabled */ );
set_enode_flag(v, false);
@ -453,7 +453,7 @@ namespace smt {
// must be associated with an enode.
if (!e_internalized(n)) {
mk_enode(to_app(n),
true, /* supress arguments, we not not use CC for this kind of enode */
true, /* suppress arguments, we not not use CC for this kind of enode */
true /* bool enode must be merged with true/false, since it is not in the context of a gate */,
false /* CC is not enabled */);
}
@ -739,7 +739,7 @@ namespace smt {
app_ref eq1(mk_eq_atom(n, t), m_manager);
app_ref eq2(mk_eq_atom(n, e), m_manager);
mk_enode(n,
true /* supress arguments, I don't want to apply CC on ite terms */,
true /* suppress arguments, I don't want to apply CC on ite terms */,
false /* it is a term, so it should not be merged with true/false */,
false /* CC is not enabled */);
internalize(c, true);
@ -797,7 +797,7 @@ namespace smt {
}
enode * e = mk_enode(n,
false, /* do not supress args */
false, /* do not suppress args */
false, /* it is a term, so it should not be merged with true/false */
true);
apply_sort_cnstr(n, e);
@ -1506,7 +1506,7 @@ namespace smt {
relevancy_eh * eh = m_relevancy_propagator->mk_and_relevancy_eh(n);
unsigned num = n->get_num_args();
for (unsigned i = 0; i < num; i++) {
// if one child is assigned to false, the the and-parent must be notified
// if one child is assigned to false, the and-parent must be notified
literal l = get_literal(n->get_arg(i));
add_rel_watch(~l, eh);
}
@ -1518,7 +1518,7 @@ namespace smt {
relevancy_eh * eh = m_relevancy_propagator->mk_or_relevancy_eh(n);
unsigned num = n->get_num_args();
for (unsigned i = 0; i < num; i++) {
// if one child is assigned to true, the the or-parent must be notified
// if one child is assigned to true, the or-parent must be notified
literal l = get_literal(n->get_arg(i));
add_rel_watch(l, eh);
}

View file

@ -537,7 +537,7 @@ namespace smt {
}
}
// For each instantiation_set, reemove entries that do not evaluate to values.
// For each instantiation_set, remove entries that do not evaluate to values.
void cleanup_instantiation_sets() {
ptr_vector<expr> to_delete;
for (node * curr : m_nodes) {
@ -735,7 +735,7 @@ namespace smt {
}
}
// TBD: add support for the else of bitvectors.
// Idea: get the term t with the minimal interpreation and use t - 1.
// Idea: get the term t with the minimal interpretation and use t - 1.
}
n->set_else((*(elems.begin())).m_key);
}
@ -955,7 +955,7 @@ namespace smt {
if (elems.empty()) {
// The method get_some_value cannot be used if n->get_sort() is an uninterpreted sort or is a sort built using uninterpreted sorts
// (e.g., (Array S S) where S is uninterpreted). The problem is that these sorts do not have a fixed interpretation.
// Moreover, a model assigns an arbitrary intepretation to these sorts using "model_values" a model value.
// Moreover, a model assigns an arbitrary interpretation to these sorts using "model_values" a model value.
// If these module values "leak" inside the logical context, they may affect satisfiability.
//
sort * ns = n->get_sort();
@ -1007,7 +1007,7 @@ namespace smt {
This may happen because the evaluator uses model_completion.
In the beginning of fix_model() we collected all f with
partial interpretations. During the process of computing the
projections we used the evalutator with model_completion,
projections we used the evaluator with model_completion,
and it may have fixed the "else" case of some partial interpretations.
This is ok, because in the "limit" the "else" of the interpretation
is irrelevant after the projections are applied.
@ -1570,7 +1570,7 @@ namespace smt {
ast_manager & m = ctx->get_manager();
sort * s = q->get_decl_sort(num_vars - m_var_i - 1);
if (m.is_uninterp(s)) {
// For uninterpreted sorst, we add all terms in the context.
// For uninterpreted sorts, we add all terms in the context.
// See Section 4.1 in the paper "Complete Quantifier Instantiation"
node * S_q_i = slv.get_uvar(q, m_var_i);
ptr_vector<enode>::const_iterator it = ctx->begin_enodes();
@ -1741,7 +1741,7 @@ namespace smt {
if (has_quantifiers(q->get_expr())) {
static bool displayed_flat_msg = false;
if (!displayed_flat_msg) {
// [Leo]: This warning message is not usefult.
// [Leo]: This warning message is not useful.
// warning_msg("For problems containing quantifiers, the model finding capabilities of Z3 work better when the formula does not contain nested quantifiers. You can use PULL_NESTED_QUANTIFIERS=true to eliminate nested quantifiers.");
displayed_flat_msg = true;
}
@ -2104,7 +2104,7 @@ namespace smt {
}
/**
\brief Process unintrepreted applications.
\brief Process uninterpreted applications.
*/
void process_u_app(app * t) {
unsigned num_args = t->get_num_args();
@ -2130,7 +2130,7 @@ namespace smt {
/**
\brief A term \c t is said to be a auf_select if
it is of ther form
it is of the form
(select a i) Where:
@ -2151,7 +2151,7 @@ namespace smt {
}
/**
\brief Process intrepreted applications.
\brief Process interpreted applications.
*/
void process_i_app(app * t) {
if (is_auf_select(t)) {
@ -2272,10 +2272,9 @@ namespace smt {
process_literal(atom, pol == NEG);
}
void process_or(app * n, polarity p) {
unsigned num_args = n->get_num_args();
for (unsigned i = 0; i < num_args; i++)
visit_formula(n->get_arg(i), p);
void process_and_or(app * n, polarity p) {
for (expr* arg : *n)
visit_formula(arg, p);
}
void process_ite(app * n, polarity p) {
@ -2306,13 +2305,13 @@ namespace smt {
if (is_app(curr)) {
if (to_app(curr)->get_family_id() == m_manager.get_basic_family_id() && m_manager.is_bool(curr)) {
switch (static_cast<basic_op_kind>(to_app(curr)->get_decl_kind())) {
case OP_AND:
case OP_IMPLIES:
case OP_XOR:
UNREACHABLE(); // simplifier eliminated ANDs, IMPLIEs, and XORs
break;
case OP_OR:
process_or(to_app(curr), pol);
case OP_AND:
process_and_or(to_app(curr), pol);
break;
case OP_NOT:
visit_formula(to_app(curr)->get_arg(0), neg(pol));
@ -2513,7 +2512,7 @@ namespace smt {
SASSERT(f_else != 0);
// Remark: I can ignore the conditions of m because
// I know the (partial) interpretation of f satisfied the ground part.
// MBQI will force extra instantiations if the the (partial) interpretation of f
// MBQI will force extra instantiations if the (partial) interpretation of f
// does not satisfy the quantifier.
// In all other cases the "else" of f will satisfy the quantifier.
set_else_interp(f, f_else);
@ -2938,7 +2937,7 @@ namespace smt {
}
/**
\brief Use m_fs to set the interpreation of the function symbols that were used to satisfy the
\brief Use m_fs to set the interpretation of the function symbols that were used to satisfy the
quantifiers in m_satisfied.
*/
void set_interp() {

View file

@ -152,7 +152,7 @@ namespace smt {
virtual bool mbqi_enabled(quantifier *q) const {return true;}
/**
\brief Give a change to the plugin to adjust the interpretation of unintepreted functions.
\brief Give a change to the plugin to adjust the interpretation of uninterpreted functions.
It can basically change the "else" of each uninterpreted function.
*/
virtual void adjust_model(proto_model * m) = 0;

View file

@ -660,7 +660,7 @@ namespace smt {
satisfy their respective constraints. However, when they
do that the may create inconsistencies in the other
modules. I use m_liberal_final_check to avoid infinite
loops where the modules keep changing the assigment and no
loops where the modules keep changing the assignment and no
progress is made. If m_liberal_final_check is set to false,
these modules will avoid mutating the assignment to satisfy
constraints.

View file

@ -711,6 +711,7 @@ namespace smt {
if (ctx.is_relevant(get_enode(*it)) && !check_monomial_assignment(*it, computed_epsilon)) {
TRACE("non_linear_failed", tout << "check_monomial_assignment failed for:\n" << mk_ismt2_pp(var2expr(*it), get_manager()) << "\n";
display_var(tout, *it););
return false;
}
}

View file

@ -1916,7 +1916,7 @@ namespace smt {
lp::var_index vi = m_theory_var2var_index[v];
SASSERT(m_solver->is_term(vi));
lp::lar_term const& term = m_solver->get_term(vi);
for (auto const coeff : term.m_coeffs) {
for (auto const& coeff : term.m_coeffs) {
lp::var_index wi = coeff.first;
lp::constraint_index ci;
rational value;

View file

@ -3218,9 +3218,10 @@ void theory_seq::add_indexof_axiom(expr* i) {
literal t_eq_empty = mk_eq_empty(t);
// |t| = 0 => |s| = 0 or indexof(t,s,offset) = -1
// ~contains(t,s) => indexof(t,s,offset) = -1
// ~contains(t,s) <=> indexof(t,s,offset) = -1
add_axiom(cnt, i_eq_m1);
// add_axiom(~cnt, ~i_eq_m1);
add_axiom(~t_eq_empty, s_eq_empty, i_eq_m1);
if (!offset || (m_autil.is_numeral(offset, r) && r.is_zero())) {
@ -3233,6 +3234,7 @@ void theory_seq::add_indexof_axiom(expr* i) {
add_axiom(~s_eq_empty, i_eq_0);
add_axiom(~cnt, s_eq_empty, mk_seq_eq(t, xsy));
add_axiom(~cnt, s_eq_empty, mk_eq(i, lenx, false));
add_axiom(~cnt, mk_literal(m_autil.mk_ge(i, zero)));
tightest_prefix(s, x);
}
else {

View file

@ -16,7 +16,7 @@ Abstract:
Remarks:
- The semantics of division by zero is not specified. Thus,
uninterpreted functions are used. An ExRCF procedure may
treat the unintepreted function applications as fresh
treat the uninterpreted function applications as fresh
constants. Then, in any model produced by this procedure,
the interpretation for division by zero must be checked.

View file

@ -44,6 +44,7 @@ class solve_eqs_tactic : public tactic {
expr_sparse_mark m_candidate_set;
ptr_vector<expr> m_candidates;
ptr_vector<app> m_vars;
expr_sparse_mark m_nonzero;
ptr_vector<app> m_ordered_vars;
bool m_produce_proofs;
bool m_produce_unsat_cores;
@ -55,8 +56,7 @@ class solve_eqs_tactic : public tactic {
m_r_owner(r == 0 || owner),
m_a_util(m),
m_num_steps(0),
m_num_eliminated_vars(0)
{
m_num_eliminated_vars(0) {
updt_params(p);
if (m_r == 0)
m_r = mk_default_expr_replacer(m);
@ -106,7 +106,8 @@ class solve_eqs_tactic : public tactic {
}
}
bool trivial_solve(expr * lhs, expr * rhs, app_ref & var, expr_ref & def, proof_ref & pr) {
if (trivial_solve1(lhs, rhs, var, def, pr)) return true;
if (trivial_solve1(lhs, rhs, var, def, pr))
return true;
if (trivial_solve1(rhs, lhs, var, def, pr)) {
if (m_produce_proofs) {
pr = m().mk_commutativity(m().mk_eq(lhs, rhs));
@ -188,6 +189,77 @@ class solve_eqs_tactic : public tactic {
return false;
}
void add_pos(expr* f) {
expr* lhs = nullptr, *rhs = nullptr;
rational val;
if (m_a_util.is_le(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && val.is_neg()) {
m_nonzero.mark(lhs);
}
else if (m_a_util.is_ge(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && val.is_pos()) {
m_nonzero.mark(lhs);
}
else if (m().is_not(f, f)) {
if (m_a_util.is_le(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && !val.is_neg()) {
m_nonzero.mark(lhs);
}
else if (m_a_util.is_ge(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && !val.is_pos()) {
m_nonzero.mark(lhs);
}
else if (m().is_eq(f, lhs, rhs) && m_a_util.is_numeral(rhs, val) && val.is_zero()) {
m_nonzero.mark(lhs);
}
}
}
bool is_nonzero(expr* e) {
return m_nonzero.is_marked(e);
}
bool isolate_var(app* arg, app_ref& var, expr_ref& div, unsigned i, app* lhs, expr* rhs) {
if (!m_a_util.is_mul(arg)) return false;
unsigned n = arg->get_num_args();
for (unsigned j = 0; j < n; ++j) {
expr* e = arg->get_arg(j);
bool ok = is_uninterp_const(e) && check_occs(e) && !occurs(e, rhs) && !occurs_except(e, lhs, i);
if (!ok) continue;
var = to_app(e);
for (unsigned k = 0; ok && k < n; ++k) {
expr* arg_k = arg->get_arg(k);
ok = k == j || (!occurs(var, arg_k) && is_nonzero(arg_k));
}
if (!ok) continue;
ptr_vector<expr> args;
for (unsigned k = 0; k < n; ++k) {
if (k != j) args.push_back(arg->get_arg(k));
}
div = m_a_util.mk_mul(args.size(), args.c_ptr());
return true;
}
return false;
}
bool solve_nl(app * lhs, expr * rhs, expr* eq, app_ref& var, expr_ref & def, proof_ref & pr) {
SASSERT(m_a_util.is_add(lhs));
if (m_a_util.is_int(lhs)) return false;
unsigned num = lhs->get_num_args();
expr_ref div(m());
for (unsigned i = 0; i < num; i++) {
expr * arg = lhs->get_arg(i);
if (is_app(arg) && isolate_var(to_app(arg), var, div, i, lhs, rhs)) {
ptr_vector<expr> args;
for (unsigned k = 0; k < num; ++k) {
if (k != i) args.push_back(lhs->get_arg(k));
}
def = m_a_util.mk_sub(rhs, m_a_util.mk_add(args.size(), args.c_ptr()));
def = m_a_util.mk_div(def, div);
if (m_produce_proofs)
pr = m().mk_rewrite(eq, m().mk_eq(var, def));
return true;
}
}
return false;
}
bool solve_arith_core(app * lhs, expr * rhs, expr * eq, app_ref & var, expr_ref & def, proof_ref & pr) {
SASSERT(m_a_util.is_add(lhs));
bool is_int = m_a_util.is_int(lhs);
@ -204,7 +276,8 @@ class solve_eqs_tactic : public tactic {
break;
}
else if (m_a_util.is_mul(arg, a, v) &&
is_uninterp_const(v) && !m_candidate_vars.is_marked(v) &&
is_uninterp_const(v) &&
!m_candidate_vars.is_marked(v) &&
m_a_util.is_numeral(a, a_val) &&
!a_val.is_zero() &&
(!is_int || a_val.is_minus_one()) &&
@ -252,16 +325,20 @@ class solve_eqs_tactic : public tactic {
return
(m_a_util.is_add(lhs) && solve_arith_core(to_app(lhs), rhs, eq, var, def, pr)) ||
(m_a_util.is_add(rhs) && solve_arith_core(to_app(rhs), lhs, eq, var, def, pr));
#if 0
// better done inside of nlsat
(m_a_util.is_add(lhs) && solve_nl(to_app(lhs), rhs, eq, var, def, pr)) ||
(m_a_util.is_add(rhs) && solve_nl(to_app(rhs), lhs, eq, var, def, pr));
#endif
}
bool solve(expr * f, app_ref & var, expr_ref & def, proof_ref & pr) {
if (m().is_eq(f)) {
if (trivial_solve(to_app(f)->get_arg(0), to_app(f)->get_arg(1), var, def, pr))
expr* arg1 = 0, *arg2 = 0;
if (m().is_eq(f, arg1, arg2)) {
if (trivial_solve(arg1, arg2, var, def, pr))
return true;
if (m_theory_solver) {
expr * lhs = to_app(f)->get_arg(0);
expr * rhs = to_app(f)->get_arg(1);
if (solve_arith(lhs, rhs, f, var, def, pr))
if (solve_arith(arg1, arg2, f, var, def, pr))
return true;
}
return false;
@ -321,11 +398,14 @@ class solve_eqs_tactic : public tactic {
m_candidate_set.reset();
m_candidates.reset();
m_vars.reset();
m_nonzero.reset();
app_ref var(m());
expr_ref def(m());
proof_ref pr(m());
unsigned size = g.size();
for (unsigned idx = 0; idx < size; idx++) {
add_pos(g.form(idx));
}
for (unsigned idx = 0; idx < size; idx++) {
checkpoint();
expr * f = g.form(idx);
@ -347,10 +427,8 @@ class solve_eqs_tactic : public tactic {
TRACE("solve_eqs",
tout << "candidate vars:\n";
ptr_vector<app>::iterator it = m_vars.begin();
ptr_vector<app>::iterator end = m_vars.end();
for (; it != end; ++it) {
tout << mk_ismt2_pp(*it, m()) << " ";
for (app* v : m_vars) {
tout << mk_ismt2_pp(v, m()) << " ";
}
tout << "\n";);
}
@ -374,12 +452,9 @@ class solve_eqs_tactic : public tactic {
typedef std::pair<expr *, unsigned> frame;
svector<frame> todo;
ptr_vector<app>::const_iterator it = m_vars.begin();
ptr_vector<app>::const_iterator end = m_vars.end();
unsigned num;
for (; it != end; ++it) {
unsigned num = 0;
for (app* v : m_vars) {
checkpoint();
app * v = *it;
if (!m_candidate_vars.is_marked(v))
continue;
todo.push_back(frame(v, 0));
@ -483,20 +558,19 @@ class solve_eqs_tactic : public tactic {
}
// cleanup
it = m_vars.begin();
for (unsigned idx = 0; it != end; ++it, ++idx) {
if (!m_candidate_vars.is_marked(*it)) {
unsigned idx = 0;
for (expr* v : m_vars) {
if (!m_candidate_vars.is_marked(v)) {
m_candidate_set.mark(m_candidates[idx], false);
}
++idx;
}
TRACE("solve_eqs",
tout << "ordered vars:\n";
ptr_vector<app>::iterator it = m_ordered_vars.begin();
ptr_vector<app>::iterator end = m_ordered_vars.end();
for (; it != end; ++it) {
SASSERT(m_candidate_vars.is_marked(*it));
tout << mk_ismt2_pp(*it, m()) << " ";
for (app* v : m_ordered_vars) {
SASSERT(m_candidate_vars.is_marked(v));
tout << mk_ismt2_pp(v, m()) << " ";
}
tout << "\n";);
m_candidate_vars.reset();
@ -609,10 +683,7 @@ class solve_eqs_tactic : public tactic {
if (m_produce_models) {
if (mc.get() == 0)
mc = alloc(gmc, m());
ptr_vector<app>::iterator it = m_ordered_vars.begin();
ptr_vector<app>::iterator end = m_ordered_vars.end();
for (; it != end; ++it) {
app * v = *it;
for (app* v : m_ordered_vars) {
expr * def = 0;
proof * pr;
expr_dependency * dep;

View file

@ -41,8 +41,8 @@ tactic * mk_default_tactic(ast_manager & m, params_ref const & p) {
cond(mk_is_qflra_probe(), mk_qflra_tactic(m),
cond(mk_is_qfnra_probe(), mk_qfnra_tactic(m),
cond(mk_is_qfnia_probe(), mk_qfnia_tactic(m),
cond(mk_is_nra_probe(), mk_nra_tactic(m),
cond(mk_is_lira_probe(), mk_lira_tactic(m, p),
cond(mk_is_nra_probe(), mk_nra_tactic(m),
cond(mk_is_qffp_probe(), mk_qffp_tactic(m, p),
//cond(mk_is_qfufnra_probe(), mk_qfufnra_tactic(m, p),
mk_smt_tactic()))))))))))),

View file

@ -24,7 +24,6 @@ Notes:
#include "tactic/core/solve_eqs_tactic.h"
#include "tactic/core/elim_uncnstr_tactic.h"
#include "smt/tactic/smt_tactic.h"
// include"mip_tactic.h"
#include "tactic/arith/add_bounds_tactic.h"
#include "tactic/arith/pb2bv_tactic.h"
#include "tactic/arith/lia2pb_tactic.h"

View file

@ -26,8 +26,10 @@ Notes:
#include "tactic/bv/max_bv_sharing_tactic.h"
#include "sat/tactic/sat_tactic.h"
#include "tactic/arith/nla2bv_tactic.h"
#include "tactic/arith/elim01_tactic.h"
#include "tactic/core/ctx_simplify_tactic.h"
#include "tactic/core/cofactor_term_ite_tactic.h"
#include "nlsat/tactic/qfnra_nlsat_tactic.h"
static tactic * mk_qfnia_bv_solver(ast_manager & m, params_ref const & p_ref) {
params_ref p = p_ref;
@ -61,8 +63,6 @@ static tactic * mk_qfnia_premable(ast_manager & m, params_ref const & p_ref) {
ctx_simp_p.set_uint("max_depth", 30);
ctx_simp_p.set_uint("max_steps", 5000000);
params_ref simp_p = p_ref;
simp_p.set_bool("hoist_mul", true);
params_ref elim_p = p_ref;
elim_p.set_uint("max_memory",20);
@ -73,21 +73,46 @@ static tactic * mk_qfnia_premable(ast_manager & m, params_ref const & p_ref) {
using_params(mk_ctx_simplify_tactic(m), ctx_simp_p),
using_params(mk_simplify_tactic(m), pull_ite_p),
mk_elim_uncnstr_tactic(m),
skip_if_failed(using_params(mk_cofactor_term_ite_tactic(m), elim_p)),
using_params(mk_simplify_tactic(m), simp_p));
mk_elim01_tactic(m),
skip_if_failed(using_params(mk_cofactor_term_ite_tactic(m), elim_p)));
}
static tactic * mk_qfnia_sat_solver(ast_manager & m, params_ref const & p) {
params_ref nia2sat_p = p;
nia2sat_p.set_uint("nla2bv_max_bv_size", 64);
params_ref simp_p = p;
simp_p.set_bool("hoist_mul", true); // hoist multipliers to create smaller circuits.
return and_then(mk_nla2bv_tactic(m, nia2sat_p),
return and_then(using_params(mk_simplify_tactic(m), simp_p),
mk_nla2bv_tactic(m, nia2sat_p),
mk_qfnia_bv_solver(m, p),
mk_fail_if_undecided_tactic());
}
static tactic * mk_qfnia_nlsat_solver(ast_manager & m, params_ref const & p) {
params_ref nia2sat_p = p;
nia2sat_p.set_uint("nla2bv_max_bv_size", 64);
params_ref simp_p = p;
simp_p.set_bool("som", true); // expand into sums of monomials
simp_p.set_bool("factor", false);
return and_then(using_params(mk_simplify_tactic(m), simp_p),
try_for(mk_qfnra_nlsat_tactic(m, simp_p), 3000),
mk_fail_if_undecided_tactic());
}
static tactic * mk_qfnia_smt_solver(ast_manager& m, params_ref const& p) {
params_ref simp_p = p;
simp_p.set_bool("som", true); // expand into sums of monomials
return and_then(using_params(mk_simplify_tactic(m), simp_p), mk_smt_tactic());
}
tactic * mk_qfnia_tactic(ast_manager & m, params_ref const & p) {
return and_then(mk_qfnia_premable(m, p),
or_else(mk_qfnia_sat_solver(m, p),
mk_smt_tactic()));
try_for(mk_qfnia_smt_solver(m, p), 2000),
mk_qfnia_nlsat_solver(m, p),
mk_qfnia_smt_solver(m, p)));
}

View file

@ -33,6 +33,8 @@ static tactic * mk_qfnra_sat_solver(ast_manager& m, params_ref const& p, unsigne
}
tactic * mk_qfnra_tactic(ast_manager & m, params_ref const& p) {
params_ref p0 = p;
p0.set_bool("inline_vars", true);
params_ref p1 = p;
p1.set_uint("seed", 11);
p1.set_bool("factor", false);
@ -42,7 +44,7 @@ tactic * mk_qfnra_tactic(ast_manager & m, params_ref const& p) {
return and_then(mk_simplify_tactic(m, p),
mk_propagate_values_tactic(m, p),
or_else(try_for(mk_qfnra_nlsat_tactic(m, p), 5000),
or_else(try_for(mk_qfnra_nlsat_tactic(m, p0), 5000),
try_for(mk_qfnra_nlsat_tactic(m, p1), 10000),
mk_qfnra_sat_solver(m, p, 4),
and_then(try_for(mk_smt_tactic(), 5000), mk_fail_if_undecided_tactic()),

View file

@ -24,7 +24,6 @@ Revision History:
#include "qe/qe_tactic.h"
#include "qe/qe_lite.h"
#include "qe/qsat.h"
#include "qe/nlqsat.h"
#include "tactic/core/ctx_simplify_tactic.h"
#include "smt/tactic/smt_tactic.h"
#include "tactic/core/elim_term_ite_tactic.h"

View file

@ -74,7 +74,7 @@ each offset is a different "variable bank". A pair (expr, offset) is essentially
where every variable in expr is assumed to be from the "bank" offset.
The class substitution (in substitution.h) manages offsets for us.
The class matcher (in matcher.h) can be use to test whether an expression is an instance of another one.
The class matcher (in matcher.h) can be used to test whether an expression is an instance of another one.
Finally, there is the problem when we have N demodulators (where N is big), and a big formula, and we want
to traverse the formula only once looking for opportunities for applying these N demodulators.

View file

@ -272,7 +272,7 @@ static void tst4() {
static void tst5() {
params_ref ps;
reslimit rlim;
nlsat::solver s(rlim, ps);
nlsat::solver s(rlim, ps, false);
anum_manager & am = s.am();
nlsat::pmanager & pm = s.pm();
nlsat::assignment as(am);
@ -330,7 +330,7 @@ static nlsat::literal mk_eq(nlsat::solver& s, nlsat::poly* p) {
static void tst6() {
params_ref ps;
reslimit rlim;
nlsat::solver s(rlim, ps);
nlsat::solver s(rlim, ps, false);
anum_manager & am = s.am();
nlsat::pmanager & pm = s.pm();
nlsat::assignment as(am);
@ -390,7 +390,7 @@ static void tst6() {
static void tst7() {
params_ref ps;
reslimit rlim;
nlsat::solver s(rlim, ps);
nlsat::solver s(rlim, ps, false);
nlsat::pmanager & pm = s.pm();
nlsat::var x0, x1, x2, a, b, c, d;
a = s.mk_var(false);
@ -443,7 +443,7 @@ static void tst7() {
static void tst8() {
params_ref ps;
reslimit rlim;
nlsat::solver s(rlim, ps);
nlsat::solver s(rlim, ps, false);
anum_manager & am = s.am();
nlsat::pmanager & pm = s.pm();
nlsat::assignment as(am);
@ -492,7 +492,7 @@ static void tst8() {
static void tst9() {
params_ref ps;
reslimit rlim;
nlsat::solver s(rlim, ps);
nlsat::solver s(rlim, ps, false);
anum_manager & am = s.am();
nlsat::pmanager & pm = s.pm();
nlsat::assignment as(am);
@ -624,7 +624,7 @@ static bool satisfies_root(nlsat::solver& s, nlsat::atom::kind k, nlsat::poly* p
static void tst10() {
params_ref ps;
reslimit rlim;
nlsat::solver s(rlim, ps);
nlsat::solver s(rlim, ps, false);
anum_manager & am = s.am();
nlsat::pmanager & pm = s.pm();
nlsat::assignment as(am);

View file

@ -38,10 +38,10 @@ template <typename T> class numeric_traits {};
template <> class numeric_traits<unsigned> {
public:
static bool precise() { return true; }
static unsigned const zero() { return 0; }
static unsigned const one() { return 1; }
static unsigned zero() { return 0; }
static unsigned one() { return 1; }
static bool is_zero(unsigned v) { return v == 0; }
static double const get_double(unsigned const & d) { return d; }
static double get_double(unsigned const & d) { return d; }
};
template <> class numeric_traits<double> {
@ -66,7 +66,7 @@ template <> class numeric_traits<double> {
static rational const & zero() { return rational::zero(); }
static rational const & one() { return rational::one(); }
static bool is_zero(const rational & v) { return v.is_zero(); }
static double const get_double(const rational & d) { return d.get_double();}
static double get_double(const rational & d) { return d.get_double();}
static rational log(rational const& r) { UNREACHABLE(); return r; }
static rational from_string(std::string const & str) { return rational(str.c_str()); }
static bool is_pos(const rational & d) {return d.is_pos();}

View file

@ -29,7 +29,7 @@ inline void print_stat(std::ostream& out, char const* msg, unsigned num) {
}
inline void print_stat_f(std::ostream& out, char const* msg, float num) {
if (num > 0.0) {
if (num > 0.0f) {
out << msg << num << "\n";
}
}