mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 03:32:28 +00:00 
			
		
		
		
	merge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
		
						commit
						f525f43e43
					
				
					 155 changed files with 3188 additions and 1043 deletions
				
			
		|  | @ -33,8 +33,8 @@ endif() | |||
| # Project version | ||||
| ################################################################################ | ||||
| set(Z3_VERSION_MAJOR 4) | ||||
| set(Z3_VERSION_MINOR 6) | ||||
| set(Z3_VERSION_PATCH 2) | ||||
| set(Z3_VERSION_MINOR 7) | ||||
| set(Z3_VERSION_PATCH 0) | ||||
| 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 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ See the [release notes](RELEASE_NOTES) for notes on various stable releases of Z | |||
| 
 | ||||
| | Windows x64 | Windows x86 | Windows x64 | Ubuntu x64 | Debian x64 | OSX | TravisCI | | ||||
| | ----------- | ----------- | ----------- | ---------- | ---------- | --- | -------- | | ||||
| [](https://z3build.visualstudio.com/Z3Build/_build/index?definitionId=4) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=4) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=7) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=3) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=5) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=2) | [](https://travis-ci.org/Z3Prover/z3) | ||||
| [](https://z3build.visualstudio.com/Z3Build/_build/index?definitionId=4) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=4) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=7) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=3) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=5) | [](https://cz3.visualstudio.com/Z3/_build/index?definitionId=2) | [](https://travis-ci.org/Z3Prover/z3) | ||||
| 
 | ||||
| [1]: #building-z3-on-windows-using-visual-studio-command-prompt | ||||
| [2]: #building-z3-using-make-and-gccclang | ||||
|  | @ -189,3 +189,6 @@ python -c 'import z3; print(z3.get_version_string())' | |||
| 
 | ||||
| See [``examples/python``](examples/python) for examples. | ||||
| 
 | ||||
| ### ``Web Assembly`` | ||||
| 
 | ||||
| [WebAssembly](https://github.com/cpitclaudel/z3.wasm) bindings are provided by Clément Pit-Claudel. | ||||
|  |  | |||
|  | @ -920,6 +920,19 @@ void enum_sort_example() { | |||
|     std::cout << "2: " << result_goal.as_expr() << std::endl; | ||||
| } | ||||
| 
 | ||||
| void tuple_example() { | ||||
|     std::cout << "tuple example\n"; | ||||
|     context ctx; | ||||
|     const char * names[] = { "first", "second" }; | ||||
|     sort sorts[2] = { ctx.int_sort(), ctx.bool_sort() }; | ||||
|     func_decl_vector projs(ctx); | ||||
|     func_decl pair = ctx.tuple_sort("pair", 2, names, sorts, projs); | ||||
|     sorts[1] = pair.range(); | ||||
|     func_decl pair2 = ctx.tuple_sort("pair2", 2, names, sorts, projs); | ||||
|      | ||||
|     std::cout << pair2 << "\n"; | ||||
| } | ||||
| 
 | ||||
| void expr_vector_example() { | ||||
|     std::cout << "expr_vector example\n"; | ||||
|     context c; | ||||
|  | @ -1179,6 +1192,7 @@ int main() { | |||
|         incremental_example2(); std::cout << "\n"; | ||||
|         incremental_example3(); std::cout << "\n"; | ||||
|         enum_sort_example(); std::cout << "\n"; | ||||
|         tuple_example(); std::cout << "\n"; | ||||
|         expr_vector_example(); std::cout << "\n"; | ||||
|         exists_expr_vector_example(); std::cout << "\n"; | ||||
|         substitute_example(); std::cout << "\n"; | ||||
|  |  | |||
|  | @ -2452,7 +2452,6 @@ Z3_lbool ext_check(Z3_ext_context ctx) { | |||
|         } | ||||
|         printf("\n"); | ||||
|     } | ||||
| 
 | ||||
|     return result; | ||||
| } | ||||
| 
 | ||||
|  | @ -2464,7 +2463,7 @@ void incremental_example1() { | |||
|     Z3_context     ctx     = ext_ctx->m_context; | ||||
|     Z3_ast x, y, z, two, one; | ||||
|     unsigned c1, c2, c3, c4; | ||||
|     Z3_bool result; | ||||
|     Z3_lbool result; | ||||
| 
 | ||||
|     printf("\nincremental_example1\n"); | ||||
|     LOG_MSG("incremental_example1"); | ||||
|  | @ -2485,7 +2484,7 @@ void incremental_example1() { | |||
|     c4 = assert_retractable_cnstr(ext_ctx, Z3_mk_lt(ctx, y, one)); | ||||
| 
 | ||||
|     result = ext_check(ext_ctx); | ||||
|     if (result != Z3_L_FALSE) | ||||
|     if (result != Z3_L_FALSE)  | ||||
|         exitf("bug in Z3"); | ||||
|     printf("unsat\n"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ from mk_util import * | |||
| 
 | ||||
| # Z3 Project definition | ||||
| def init_project_def(): | ||||
|     set_version(4, 6, 2, 0) | ||||
|     set_version(4, 7, 0, 0) | ||||
|     add_lib('util', []) | ||||
|     add_lib('polynomial', ['util'], 'math/polynomial') | ||||
|     add_lib('sat', ['util']) | ||||
|  |  | |||
|  | @ -60,7 +60,7 @@ FIRST_OBJ_ID = 100 | |||
| def is_obj(ty): | ||||
|     return ty >= FIRST_OBJ_ID | ||||
| 
 | ||||
| Type2Str = { VOID : 'void', VOID_PTR : 'void*', INT : 'int', UINT : 'unsigned', INT64 : '__int64', UINT64 : '__uint64', DOUBLE : 'double', | ||||
| Type2Str = { VOID : 'void', VOID_PTR : 'void*', INT : 'int', UINT : 'unsigned', INT64 : 'int64_t', UINT64 : 'uint64_t', DOUBLE : 'double', | ||||
|              FLOAT : 'float', STRING : 'Z3_string', STRING_PTR : 'Z3_string_ptr', BOOL : 'Z3_bool', SYMBOL : 'Z3_symbol', | ||||
|              PRINT_MODE : 'Z3_ast_print_mode', ERROR_CODE : 'Z3_error_code' | ||||
|              } | ||||
|  | @ -577,9 +577,6 @@ def mk_java(java_dir, package_name): | |||
|     java_wrapper = open(java_wrapperf, 'w') | ||||
|     pkg_str = package_name.replace('.', '_') | ||||
|     java_wrapper.write('// Automatically generated file\n') | ||||
|     java_wrapper.write('#ifdef _CYGWIN\n') | ||||
|     java_wrapper.write('typedef long long __int64;\n') | ||||
|     java_wrapper.write('#endif\n') | ||||
|     java_wrapper.write('#include<jni.h>\n') | ||||
|     java_wrapper.write('#include<stdlib.h>\n') | ||||
|     java_wrapper.write('#include"z3.h"\n') | ||||
|  | @ -957,11 +954,16 @@ def def_API(name, result, params): | |||
|                 log_c.write(" }\n") | ||||
|                 log_c.write("  Au(a%s);\n" % sz) | ||||
|                 exe_c.write("in.get_uint_array(%s)" % i) | ||||
|             elif ty == INT or ty == BOOL: | ||||
|             elif ty == INT: | ||||
|                 log_c.write("U(a%s[i]);" % i) | ||||
|                 log_c.write(" }\n") | ||||
|                 log_c.write("  Au(a%s);\n" % sz) | ||||
|                 exe_c.write("in.get_int_array(%s)" % i) | ||||
|             elif ty == BOOL: | ||||
|                 log_c.write("U(a%s[i]);" % i) | ||||
|                 log_c.write(" }\n") | ||||
|                 log_c.write("  Au(a%s);\n" % sz) | ||||
|                 exe_c.write("in.get_bool_array(%s)" % i) | ||||
|             else: | ||||
|                 error ("unsupported parameter for %s, %s, %s" % (ty, name, p)) | ||||
|         elif kind == OUT_ARRAY: | ||||
|  | @ -1655,7 +1657,7 @@ else: | |||
|   if hasattr(builtins, "Z3_LIB_DIRS"): | ||||
|     _all_dirs = builtins.Z3_LIB_DIRS | ||||
| 
 | ||||
| for v in ('Z3_LIBRARY_PATH', 'PATH'): | ||||
| for v in ('Z3_LIBRARY_PATH', 'PATH', 'PYTHONPATH'): | ||||
|   if v in os.environ: | ||||
|     lp = os.environ[v]; | ||||
|     lds = lp.split(';') if sys.platform in ('win32') else lp.split(':') | ||||
|  |  | |||
|  | @ -78,7 +78,6 @@ namespace api { | |||
|         m_bv_util(m()), | ||||
|         m_datalog_util(m()), | ||||
|         m_fpa_util(m()), | ||||
|         m_dtutil(m()), | ||||
|         m_sutil(m()), | ||||
|         m_last_result(m()), | ||||
|         m_ast_trail(m()), | ||||
|  | @ -184,7 +183,7 @@ namespace api { | |||
|             e = m_bv_util.mk_numeral(n, s); | ||||
|         } | ||||
|         else if (fid == get_datalog_fid() && n.is_uint64()) { | ||||
|             uint64 sz; | ||||
|             uint64_t sz; | ||||
|             if (m_datalog_util.try_get_size(s, sz) &&  | ||||
|                 sz <= n.get_uint64()) { | ||||
|                 invoke_error_handler(Z3_INVALID_ARG); | ||||
|  |  | |||
|  | @ -61,7 +61,6 @@ namespace api { | |||
|         bv_util                    m_bv_util; | ||||
|         datalog::dl_decl_util      m_datalog_util; | ||||
|         fpa_util                   m_fpa_util; | ||||
|         datatype_util              m_dtutil; | ||||
|         seq_util                   m_sutil; | ||||
| 
 | ||||
|         // Support for old solver API
 | ||||
|  | @ -121,13 +120,13 @@ namespace api { | |||
|         bool produce_models() const { return m_params.m_model; } | ||||
|         bool produce_unsat_cores() const { return m_params.m_unsat_core; } | ||||
|         bool use_auto_config() const { return m_params.m_auto_config; } | ||||
|         unsigned get_timeout() { return params().m_timeout; } | ||||
|         unsigned get_rlimit() { return params().m_rlimit; } | ||||
|         unsigned get_timeout() const { return m_params.m_timeout; } | ||||
|         unsigned get_rlimit() const { return m_params.rlimit(); } | ||||
|         arith_util & autil() { return m_arith_util; } | ||||
|         bv_util & bvutil() { return m_bv_util; } | ||||
|         datalog::dl_decl_util & datalog_util() { return m_datalog_util; } | ||||
|         fpa_util & fpautil() { return m_fpa_util; } | ||||
|         datatype_util& dtutil() { return m_dtutil; } | ||||
|         datatype_util& dtutil() { return m_dt_plugin->u(); } | ||||
|         seq_util& sutil() { return m_sutil; } | ||||
|         family_id get_basic_fid() const { return m_basic_fid; } | ||||
|         family_id get_array_fid() const { return m_array_fid; } | ||||
|  |  | |||
|  | @ -189,7 +189,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(nullptr); | ||||
|     } | ||||
| 
 | ||||
|     Z3_sort Z3_API Z3_mk_finite_domain_sort(Z3_context c, Z3_symbol name, __uint64 size) { | ||||
|     Z3_sort Z3_API Z3_mk_finite_domain_sort(Z3_context c, Z3_symbol name, uint64_t size) { | ||||
|         Z3_TRY; | ||||
|         LOG_Z3_mk_finite_domain_sort(c, name, size); | ||||
|         RESET_ERROR_CODE(); | ||||
|  | @ -199,7 +199,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(nullptr); | ||||
|     } | ||||
| 
 | ||||
|     Z3_bool Z3_API Z3_get_finite_domain_sort_size(Z3_context c, Z3_sort s, __uint64 * out) { | ||||
|     Z3_bool Z3_API Z3_get_finite_domain_sort_size(Z3_context c, Z3_sort s, uint64_t * out) { | ||||
|         Z3_TRY; | ||||
|         if (out) { | ||||
|             *out = 0; | ||||
|  | @ -215,7 +215,6 @@ extern "C" { | |||
|         RESET_ERROR_CODE();   | ||||
|         VERIFY(mk_c(c)->datalog_util().try_get_size(to_sort(s), *out)); | ||||
|         return Z3_TRUE; | ||||
| 
 | ||||
|         Z3_CATCH_RETURN(Z3_FALSE); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -358,7 +358,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(nullptr); | ||||
|     } | ||||
| 
 | ||||
|     Z3_ast Z3_API Z3_mk_fpa_numeral_int64_uint64(Z3_context c, Z3_bool sgn, __int64 exp, __uint64 sig, Z3_sort ty) { | ||||
|     Z3_ast Z3_API Z3_mk_fpa_numeral_int64_uint64(Z3_context c, Z3_bool sgn, int64_t exp, uint64_t sig, Z3_sort ty) { | ||||
|         Z3_TRY; | ||||
|         LOG_Z3_mk_fpa_numeral_int64_uint64(c, sgn, exp, sig, ty); | ||||
|         RESET_ERROR_CODE(); | ||||
|  | @ -1035,7 +1035,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(""); | ||||
|     } | ||||
| 
 | ||||
|     Z3_bool Z3_API Z3_fpa_get_numeral_significand_uint64(Z3_context c, Z3_ast t, __uint64 * n) { | ||||
|     Z3_bool Z3_API Z3_fpa_get_numeral_significand_uint64(Z3_context c, Z3_ast t, uint64_t * n) { | ||||
|         Z3_TRY; | ||||
|         LOG_Z3_fpa_get_numeral_significand_uint64(c, t, n); | ||||
|         RESET_ERROR_CODE(); | ||||
|  | @ -1113,7 +1113,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(""); | ||||
|     } | ||||
| 
 | ||||
|     Z3_bool Z3_API Z3_fpa_get_numeral_exponent_int64(Z3_context c, Z3_ast t, __int64 * n, Z3_bool biased) { | ||||
|     Z3_bool Z3_API Z3_fpa_get_numeral_exponent_int64(Z3_context c, Z3_ast t, int64_t * n, Z3_bool biased) { | ||||
|         Z3_TRY; | ||||
|         LOG_Z3_fpa_get_numeral_exponent_int64(c, t, n, biased); | ||||
|         RESET_ERROR_CODE(); | ||||
|  |  | |||
|  | @ -116,7 +116,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(nullptr); | ||||
|     } | ||||
| 
 | ||||
|     Z3_ast Z3_API Z3_mk_int64(Z3_context c, long long value, Z3_sort ty) { | ||||
|     Z3_ast Z3_API Z3_mk_int64(Z3_context c, int64_t value, Z3_sort ty) { | ||||
|         Z3_TRY; | ||||
|         LOG_Z3_mk_int64(c, value, ty); | ||||
|         RESET_ERROR_CODE(); | ||||
|  | @ -129,7 +129,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(nullptr); | ||||
|     } | ||||
| 
 | ||||
|     Z3_ast Z3_API Z3_mk_unsigned_int64(Z3_context c, unsigned long long value, Z3_sort ty) { | ||||
|     Z3_ast Z3_API Z3_mk_unsigned_int64(Z3_context c, uint64_t value, Z3_sort ty) { | ||||
|         Z3_TRY; | ||||
|         LOG_Z3_mk_unsigned_int64(c, value, ty); | ||||
|         RESET_ERROR_CODE(); | ||||
|  | @ -172,7 +172,7 @@ extern "C" { | |||
|         if (mk_c(c)->bvutil().is_numeral(e, r, bv_size)) { | ||||
|             return Z3_TRUE; | ||||
|         } | ||||
|         uint64 v; | ||||
|         uint64_t v; | ||||
|         if (mk_c(c)->datalog_util().is_numeral(e, v)) { | ||||
|             r = rational(v, rational::ui64()); | ||||
|             return Z3_TRUE; | ||||
|  | @ -262,7 +262,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(""); | ||||
|     } | ||||
| 
 | ||||
|     Z3_bool Z3_API Z3_get_numeral_small(Z3_context c, Z3_ast a, long long* num, long long* den) { | ||||
|     Z3_bool Z3_API Z3_get_numeral_small(Z3_context c, Z3_ast a, int64_t* num, int64_t* den) { | ||||
|         Z3_TRY; | ||||
|         // This function invokes Z3_get_numeral_rational, but it is still ok to add LOG command here because it does not return a Z3 object.
 | ||||
|         LOG_Z3_get_numeral_small(c, a, num, den); | ||||
|  | @ -296,7 +296,7 @@ extern "C" { | |||
|             SET_ERROR_CODE(Z3_INVALID_ARG); | ||||
|             return Z3_FALSE; | ||||
|         } | ||||
|         long long l; | ||||
|         int64_t l; | ||||
|         if (Z3_get_numeral_int64(c, v, &l) && l >= INT_MIN && l <= INT_MAX) { | ||||
|             *i = static_cast<int>(l); | ||||
|             return Z3_TRUE; | ||||
|  | @ -314,7 +314,7 @@ extern "C" { | |||
|             SET_ERROR_CODE(Z3_INVALID_ARG); | ||||
|             return Z3_FALSE; | ||||
|         } | ||||
|         unsigned long long l; | ||||
|         uint64_t l; | ||||
|         if (Z3_get_numeral_uint64(c, v, &l) && (l <= 0xFFFFFFFF)) { | ||||
|             *u = static_cast<unsigned>(l); | ||||
|             return Z3_TRUE; | ||||
|  | @ -323,7 +323,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(Z3_FALSE); | ||||
|     } | ||||
| 
 | ||||
|     Z3_bool Z3_API Z3_get_numeral_uint64(Z3_context c, Z3_ast v, unsigned long long* u) { | ||||
|     Z3_bool Z3_API Z3_get_numeral_uint64(Z3_context c, Z3_ast v, uint64_t* u) { | ||||
|         Z3_TRY; | ||||
|         // This function invokes Z3_get_numeral_rational, but it is still ok to add LOG command here because it does not return a Z3 object.
 | ||||
|         LOG_Z3_get_numeral_uint64(c, v, u); | ||||
|  | @ -343,7 +343,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(Z3_FALSE); | ||||
|     } | ||||
| 
 | ||||
|     Z3_bool Z3_API Z3_get_numeral_int64(Z3_context c, Z3_ast v, long long* i) { | ||||
|     Z3_bool Z3_API Z3_get_numeral_int64(Z3_context c, Z3_ast v, int64_t* i) { | ||||
|         Z3_TRY; | ||||
|         // This function invokes Z3_get_numeral_rational, but it is still ok to add LOG command here because it does not return a Z3 object.
 | ||||
|         LOG_Z3_get_numeral_int64(c, v, i); | ||||
|  | @ -362,7 +362,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(Z3_FALSE); | ||||
|     } | ||||
| 
 | ||||
|     Z3_bool Z3_API Z3_get_numeral_rational_int64(Z3_context c, Z3_ast v, long long* num, long long* den) { | ||||
|     Z3_bool Z3_API Z3_get_numeral_rational_int64(Z3_context c, Z3_ast v, int64_t* num, int64_t* den) { | ||||
|         Z3_TRY; | ||||
|         // This function invokes Z3_get_numeral_rational, but it is still ok to add LOG command here because it does not return a Z3 object.
 | ||||
|         LOG_Z3_get_numeral_rational_int64(c, v, num, den); | ||||
|  |  | |||
|  | @ -130,7 +130,7 @@ extern "C" { | |||
|         Z3_CATCH_RETURN(0.0); | ||||
|     } | ||||
| 
 | ||||
|     __uint64 Z3_API Z3_get_estimated_alloc_size(void) { | ||||
|     uint64_t Z3_API Z3_get_estimated_alloc_size(void) { | ||||
|         return memory::get_allocation_size(); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -267,6 +267,15 @@ namespace z3 { | |||
|            and in \c ts the predicates for testing if terms of the enumeration sort correspond to an enumeration. | ||||
|         */ | ||||
|         sort enumeration_sort(char const * name, unsigned n, char const * const * enum_names, func_decl_vector & cs, func_decl_vector & ts); | ||||
| 
 | ||||
|         /**
 | ||||
|            \brief Return a tuple constructor. | ||||
|            \c name is the name of the returned constructor, | ||||
|            \c n are the number of arguments, \c names and \c sorts are their projected sorts. | ||||
|            \c projs is an output paramter. It contains the set of projection functions. | ||||
|         */ | ||||
|         func_decl tuple_sort(char const * name, unsigned n, char const * const * names, sort const* sorts, func_decl_vector & projs); | ||||
| 
 | ||||
|         /**
 | ||||
|            \brief create an uninterpreted sort with the name given by the string or symbol. | ||||
|          */ | ||||
|  | @ -294,21 +303,21 @@ namespace z3 { | |||
| 
 | ||||
|         expr int_val(int n); | ||||
|         expr int_val(unsigned n); | ||||
|         expr int_val(__int64 n); | ||||
|         expr int_val(__uint64 n); | ||||
|         expr int_val(int64_t n); | ||||
|         expr int_val(uint64_t n); | ||||
|         expr int_val(char const * n); | ||||
| 
 | ||||
|         expr real_val(int n, int d); | ||||
|         expr real_val(int n); | ||||
|         expr real_val(unsigned n); | ||||
|         expr real_val(__int64 n); | ||||
|         expr real_val(__uint64 n); | ||||
|         expr real_val(int64_t n); | ||||
|         expr real_val(uint64_t n); | ||||
|         expr real_val(char const * n); | ||||
| 
 | ||||
|         expr bv_val(int n, unsigned sz); | ||||
|         expr bv_val(unsigned n, unsigned sz); | ||||
|         expr bv_val(__int64 n, unsigned sz); | ||||
|         expr bv_val(__uint64 n, unsigned sz); | ||||
|         expr bv_val(int64_t n, unsigned sz); | ||||
|         expr bv_val(uint64_t n, unsigned sz); | ||||
|         expr bv_val(char const * n, unsigned sz); | ||||
|         expr bv_val(unsigned n, bool const* bits); | ||||
| 
 | ||||
|  | @ -661,8 +670,8 @@ namespace z3 { | |||
|            small integers, 64 bit integers or rational or decimal strings. | ||||
|         */ | ||||
|         bool is_numeral() const { return kind() == Z3_NUMERAL_AST; } | ||||
|         bool is_numeral_i64(__int64& i) const { bool r = 0 != Z3_get_numeral_int64(ctx(), m_ast, &i); check_error(); return r;} | ||||
|         bool is_numeral_u64(__uint64& i) const { bool r = 0 != Z3_get_numeral_uint64(ctx(), m_ast, &i); check_error(); return r;} | ||||
|         bool is_numeral_i64(int64_t& i) const { bool r = 0 != Z3_get_numeral_int64(ctx(), m_ast, &i); check_error(); return r;} | ||||
|         bool is_numeral_u64(uint64_t& i) const { bool r = 0 != Z3_get_numeral_uint64(ctx(), m_ast, &i); check_error(); return r;} | ||||
|         bool is_numeral_i(int& i) const { bool r = 0 != Z3_get_numeral_int(ctx(), m_ast, &i); check_error(); return r;} | ||||
|         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; } | ||||
|  | @ -745,35 +754,35 @@ namespace z3 { | |||
|         } | ||||
|          | ||||
|         /**
 | ||||
|            \brief Return __int64 value of numeral, throw if result cannot fit in | ||||
|            __int64 | ||||
|            \brief Return \c int64_t value of numeral, throw if result cannot fit in | ||||
|            \c int64_t. | ||||
|             | ||||
|            \pre is_numeral() | ||||
|         */ | ||||
|         __int64 get_numeral_int64() const { | ||||
|         int64_t get_numeral_int64() const { | ||||
|             assert(is_numeral()); | ||||
|             __int64 result = 0; | ||||
|             int64_t result = 0; | ||||
|             if (!is_numeral_i64(result)) { | ||||
|                 assert(ctx().enable_exceptions()); | ||||
|                 if (!ctx().enable_exceptions()) return 0; | ||||
|                 Z3_THROW(exception("numeral does not fit in machine __int64")); | ||||
|                 Z3_THROW(exception("numeral does not fit in machine int64_t")); | ||||
|             } | ||||
|             return result; | ||||
|         } | ||||
|          | ||||
|         /**
 | ||||
|            \brief Return __uint64 value of numeral, throw if result cannot fit in | ||||
|            __uint64 | ||||
|            \brief Return \c uint64_t value of numeral, throw if result cannot fit in | ||||
|            \c uint64_t. | ||||
|             | ||||
|            \pre is_numeral() | ||||
|         */ | ||||
|         __uint64 get_numeral_uint64() const { | ||||
|         uint64_t get_numeral_uint64() const { | ||||
|             assert(is_numeral()); | ||||
|             __uint64 result = 0; | ||||
|             uint64_t result = 0; | ||||
|             if (!is_numeral_u64(result)) { | ||||
|                 assert(ctx().enable_exceptions()); | ||||
|                 if (!ctx().enable_exceptions()) return 0; | ||||
|                 Z3_THROW(exception("numeral does not fit in machine __uint64")); | ||||
|                 Z3_THROW(exception("numeral does not fit in machine uint64_t")); | ||||
|             } | ||||
|             return result; | ||||
|         } | ||||
|  | @ -2563,6 +2572,19 @@ namespace z3 { | |||
|         for (unsigned i = 0; i < n; i++) { cs.push_back(func_decl(*this, _cs[i])); ts.push_back(func_decl(*this, _ts[i])); } | ||||
|         return s; | ||||
|     } | ||||
|     inline func_decl context::tuple_sort(char const * name, unsigned n, char const * const * names, sort const* sorts, func_decl_vector & projs) { | ||||
|         array<Z3_symbol> _names(n); | ||||
|         array<Z3_sort> _sorts(n); | ||||
|         for (unsigned i = 0; i < n; i++) { _names[i] = Z3_mk_string_symbol(*this, names[i]); _sorts[i] = sorts[i]; } | ||||
|         array<Z3_func_decl> _projs(n); | ||||
|         Z3_symbol _name = Z3_mk_string_symbol(*this, name); | ||||
|         Z3_func_decl tuple; | ||||
|         sort _ignore_s = to_sort(*this, Z3_mk_tuple_sort(*this, _name, n, _names.ptr(), _sorts.ptr(), &tuple, _projs.ptr())); | ||||
|         check_error(); | ||||
|         for (unsigned i = 0; i < n; i++) { projs.push_back(func_decl(*this, _projs[i])); } | ||||
|         return func_decl(*this, tuple); | ||||
|     } | ||||
| 
 | ||||
|     inline sort context::uninterpreted_sort(char const* name) { | ||||
|         Z3_symbol _name = Z3_mk_string_symbol(*this, name); | ||||
|         return to_sort(*this, Z3_mk_uninterpreted_sort(*this, _name)); | ||||
|  | @ -2657,21 +2679,21 @@ namespace z3 { | |||
| 
 | ||||
|     inline expr context::int_val(int n) { Z3_ast r = Z3_mk_int(m_ctx, n, int_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::int_val(unsigned n) { Z3_ast r = Z3_mk_unsigned_int(m_ctx, n, int_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::int_val(__int64 n) { Z3_ast r = Z3_mk_int64(m_ctx, n, int_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::int_val(__uint64 n) { Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, int_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::int_val(int64_t n) { Z3_ast r = Z3_mk_int64(m_ctx, n, int_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::int_val(uint64_t n) { Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, int_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::int_val(char const * n) { Z3_ast r = Z3_mk_numeral(m_ctx, n, int_sort()); check_error(); return expr(*this, r); } | ||||
| 
 | ||||
|     inline expr context::real_val(int n, int d) { Z3_ast r = Z3_mk_real(m_ctx, n, d); check_error(); return expr(*this, r); } | ||||
|     inline expr context::real_val(int n) { Z3_ast r = Z3_mk_int(m_ctx, n, real_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::real_val(unsigned n) { Z3_ast r = Z3_mk_unsigned_int(m_ctx, n, real_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::real_val(__int64 n) { Z3_ast r = Z3_mk_int64(m_ctx, n, real_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::real_val(__uint64 n) { Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, real_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::real_val(int64_t n) { Z3_ast r = Z3_mk_int64(m_ctx, n, real_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::real_val(uint64_t n) { Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, real_sort()); check_error(); return expr(*this, r); } | ||||
|     inline expr context::real_val(char const * n) { Z3_ast r = Z3_mk_numeral(m_ctx, n, real_sort()); check_error(); return expr(*this, r); } | ||||
| 
 | ||||
|     inline expr context::bv_val(int n, unsigned sz) { sort s = bv_sort(sz); Z3_ast r = Z3_mk_int(m_ctx, n, s); check_error(); return expr(*this, r); } | ||||
|     inline expr context::bv_val(unsigned n, unsigned sz) { sort s = bv_sort(sz); Z3_ast r = Z3_mk_unsigned_int(m_ctx, n, s); check_error(); return expr(*this, r); } | ||||
|     inline expr context::bv_val(__int64 n, unsigned sz) { sort s = bv_sort(sz); Z3_ast r = Z3_mk_int64(m_ctx, n, s); check_error(); return expr(*this, r); } | ||||
|     inline expr context::bv_val(__uint64 n, unsigned sz) { sort s = bv_sort(sz); Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, s); check_error(); return expr(*this, r); } | ||||
|     inline expr context::bv_val(int64_t n, unsigned sz) { sort s = bv_sort(sz); Z3_ast r = Z3_mk_int64(m_ctx, n, s); check_error(); return expr(*this, r); } | ||||
|     inline expr context::bv_val(uint64_t n, unsigned sz) { sort s = bv_sort(sz); Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, s); check_error(); return expr(*this, r); } | ||||
|     inline expr context::bv_val(char const * n, unsigned sz) { sort s = bv_sort(sz); Z3_ast r = Z3_mk_numeral(m_ctx, n, s); check_error(); return expr(*this, r); } | ||||
|     inline expr context::bv_val(unsigned n, bool const* bits) {  | ||||
|         array<Z3_bool> _bits(n); | ||||
|  | @ -2789,6 +2811,12 @@ namespace z3 { | |||
|     inline func_decl function(char const * name, sort const & d1, sort const & d2, sort const & d3, sort const & d4, sort const & d5, sort const & range) { | ||||
|         return range.ctx().function(name, d1, d2, d3, d4, d5, range); | ||||
|     } | ||||
|     inline func_decl function(char const* name, sort_vector const& domain, sort const& range) { | ||||
|         return range.ctx().function(name, domain, range); | ||||
|     } | ||||
|     inline func_decl function(std::string const& name, sort_vector const& domain, sort const& range) { | ||||
|         return range.ctx().function(name.c_str(), domain, range); | ||||
|     } | ||||
| 
 | ||||
|     inline expr select(expr const & a, expr const & i) { | ||||
|         check_context(a, i); | ||||
|  |  | |||
|  | @ -3,11 +3,11 @@ Copyright (c) 2012 Microsoft Corporation | |||
| 
 | ||||
| Module Name: | ||||
| 
 | ||||
|     IntNum.cs | ||||
|     AlgebraicNum.cs | ||||
| 
 | ||||
| Abstract: | ||||
| 
 | ||||
|     Z3 Managed API: Int Numerals | ||||
|     Z3 Managed API: Algebraic Numerals | ||||
| 
 | ||||
| Author: | ||||
| 
 | ||||
|  |  | |||
|  | @ -3,11 +3,11 @@ Copyright (c) 2012 Microsoft Corporation | |||
| 
 | ||||
| Module Name: | ||||
| 
 | ||||
|     IntNum.cs | ||||
|     BitVecNum.cs | ||||
| 
 | ||||
| Abstract: | ||||
| 
 | ||||
|     Z3 Managed API: Int Numerals | ||||
|     Z3 Managed API: BitVec Numerals | ||||
| 
 | ||||
| Author: | ||||
| 
 | ||||
|  |  | |||
|  | @ -22,6 +22,8 @@ Notes: | |||
| #define Z3_H_ | ||||
| 
 | ||||
| #include <stdio.h> | ||||
| #include <stdbool.h> | ||||
| #include <stdint.h> | ||||
| #include "z3_macros.h" | ||||
| #include "z3_api.h" | ||||
| #include "z3_ast_containers.h" | ||||
|  |  | |||
|  | @ -36,14 +36,6 @@ DEFINE_TYPE(Z3_fixedpoint); | |||
| DEFINE_TYPE(Z3_optimize); | ||||
| DEFINE_TYPE(Z3_rcf_num); | ||||
| 
 | ||||
| #ifndef __int64 | ||||
| #define __int64 long long | ||||
| #endif | ||||
| 
 | ||||
| #ifndef __uint64 | ||||
| #define __uint64 unsigned long long | ||||
| #endif | ||||
| 
 | ||||
| /** \defgroup capi C API */ | ||||
| /*@{*/ | ||||
| 
 | ||||
|  | @ -80,9 +72,9 @@ DEFINE_TYPE(Z3_rcf_num); | |||
| */ | ||||
| 
 | ||||
| /**
 | ||||
|    \brief Z3 Boolean type. It is just an alias for \c int. | ||||
|    \brief Z3 Boolean type. It is just an alias for \c bool. | ||||
| */ | ||||
| typedef int Z3_bool; | ||||
| typedef bool Z3_bool; | ||||
| 
 | ||||
| /**
 | ||||
|    \brief Z3 string type. It is just an alias for \ccode{const char *}. | ||||
|  | @ -1843,7 +1835,7 @@ extern "C" { | |||
| 
 | ||||
|        def_API('Z3_mk_finite_domain_sort', SORT, (_in(CONTEXT), _in(SYMBOL), _in(UINT64))) | ||||
|     */ | ||||
|     Z3_sort Z3_API Z3_mk_finite_domain_sort(Z3_context c, Z3_symbol name, __uint64 size); | ||||
|     Z3_sort Z3_API Z3_mk_finite_domain_sort(Z3_context c, Z3_symbol name, uint64_t size); | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Create an array type. | ||||
|  | @ -3200,26 +3192,26 @@ extern "C" { | |||
|     /**
 | ||||
|        \brief Create a numeral of a int, bit-vector, or finite-domain sort. | ||||
| 
 | ||||
|        This function can be used to create numerals that fit in a machine __int64 integer. | ||||
|        This function can be used to create numerals that fit in a machine \c int64_t integer. | ||||
|        It is slightly faster than #Z3_mk_numeral since it is not necessary to parse a string. | ||||
| 
 | ||||
|        \sa Z3_mk_numeral | ||||
| 
 | ||||
|        def_API('Z3_mk_int64', AST, (_in(CONTEXT), _in(INT64), _in(SORT))) | ||||
|     */ | ||||
|     Z3_ast Z3_API Z3_mk_int64(Z3_context c, __int64 v, Z3_sort ty); | ||||
|     Z3_ast Z3_API Z3_mk_int64(Z3_context c, int64_t v, Z3_sort ty); | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Create a numeral of a int, bit-vector, or finite-domain sort. | ||||
| 
 | ||||
|        This function can be used to create numerals that fit in a machine __uint64 integer. | ||||
|        This function can be used to create numerals that fit in a machine \c uint64_t integer. | ||||
|        It is slightly faster than #Z3_mk_numeral since it is not necessary to parse a string. | ||||
| 
 | ||||
|        \sa Z3_mk_numeral | ||||
| 
 | ||||
|        def_API('Z3_mk_unsigned_int64', AST, (_in(CONTEXT), _in(UINT64), _in(SORT))) | ||||
|     */ | ||||
|     Z3_ast Z3_API Z3_mk_unsigned_int64(Z3_context c, __uint64 v, Z3_sort ty); | ||||
|     Z3_ast Z3_API Z3_mk_unsigned_int64(Z3_context c, uint64_t v, Z3_sort ty); | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief create a bit-vector numeral from a vector of Booleans. | ||||
|  | @ -3868,7 +3860,7 @@ extern "C" { | |||
| 
 | ||||
|         def_API('Z3_get_finite_domain_sort_size', BOOL, (_in(CONTEXT), _in(SORT), _out(UINT64))) | ||||
|     */ | ||||
|     Z3_bool_opt Z3_API Z3_get_finite_domain_sort_size(Z3_context c, Z3_sort s, __uint64* r); | ||||
|     Z3_bool_opt Z3_API Z3_get_finite_domain_sort_size(Z3_context c, Z3_sort s, uint64_t* r); | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Return the domain of the given array sort. | ||||
|  | @ -4425,7 +4417,7 @@ extern "C" { | |||
| 
 | ||||
|        def_API('Z3_get_numeral_small', BOOL, (_in(CONTEXT), _in(AST), _out(INT64), _out(INT64))) | ||||
|     */ | ||||
|     Z3_bool Z3_API Z3_get_numeral_small(Z3_context c, Z3_ast a, __int64* num, __int64* den); | ||||
|     Z3_bool Z3_API Z3_get_numeral_small(Z3_context c, Z3_ast a, int64_t* num, int64_t* den); | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Similar to #Z3_get_numeral_string, but only succeeds if | ||||
|  | @ -4453,7 +4445,7 @@ extern "C" { | |||
| 
 | ||||
|     /**
 | ||||
|        \brief Similar to #Z3_get_numeral_string, but only succeeds if | ||||
|        the value can fit in a machine __uint64 int. Return Z3_TRUE if the call succeeded. | ||||
|        the value can fit in a machine \c uint64_t int. Return Z3_TRUE if the call succeeded. | ||||
| 
 | ||||
|        \pre Z3_get_ast_kind(c, v) == Z3_NUMERAL_AST | ||||
| 
 | ||||
|  | @ -4461,11 +4453,11 @@ extern "C" { | |||
| 
 | ||||
|        def_API('Z3_get_numeral_uint64', BOOL, (_in(CONTEXT), _in(AST), _out(UINT64))) | ||||
|     */ | ||||
|     Z3_bool Z3_API Z3_get_numeral_uint64(Z3_context c, Z3_ast v, __uint64* u); | ||||
|     Z3_bool Z3_API Z3_get_numeral_uint64(Z3_context c, Z3_ast v, uint64_t* u); | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Similar to #Z3_get_numeral_string, but only succeeds if | ||||
|        the value can fit in a machine __int64 int. Return Z3_TRUE if the call succeeded. | ||||
|        the value can fit in a machine \c int64_t int. Return Z3_TRUE if the call succeeded. | ||||
| 
 | ||||
|        \pre Z3_get_ast_kind(c, v) == Z3_NUMERAL_AST | ||||
| 
 | ||||
|  | @ -4473,11 +4465,11 @@ extern "C" { | |||
| 
 | ||||
|        def_API('Z3_get_numeral_int64', BOOL, (_in(CONTEXT), _in(AST), _out(INT64))) | ||||
|     */ | ||||
|     Z3_bool Z3_API Z3_get_numeral_int64(Z3_context c, Z3_ast v, __int64* i); | ||||
|     Z3_bool Z3_API Z3_get_numeral_int64(Z3_context c, Z3_ast v, int64_t* i); | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Similar to #Z3_get_numeral_string, but only succeeds if | ||||
|        the value can fit as a rational number as machine __int64 int. Return Z3_TRUE if the call succeeded. | ||||
|        the value can fit as a rational number as machine \c int64_t int. Return Z3_TRUE if the call succeeded. | ||||
| 
 | ||||
|        \pre Z3_get_ast_kind(c, v) == Z3_NUMERAL_AST | ||||
| 
 | ||||
|  | @ -4485,7 +4477,7 @@ extern "C" { | |||
| 
 | ||||
|        def_API('Z3_get_numeral_rational_int64', BOOL, (_in(CONTEXT), _in(AST), _out(INT64), _out(INT64))) | ||||
|     */ | ||||
|     Z3_bool Z3_API Z3_get_numeral_rational_int64(Z3_context c, Z3_ast v, __int64* num, __int64* den); | ||||
|     Z3_bool Z3_API Z3_get_numeral_rational_int64(Z3_context c, Z3_ast v, int64_t* num, int64_t* den); | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Return a lower bound for the given real algebraic number. | ||||
|  | @ -6292,7 +6284,7 @@ extern "C" { | |||
| 
 | ||||
|     def_API('Z3_get_estimated_alloc_size', UINT64, ()) | ||||
|     */ | ||||
|     __uint64 Z3_API Z3_get_estimated_alloc_size(void); | ||||
|     uint64_t Z3_API Z3_get_estimated_alloc_size(void); | ||||
| 
 | ||||
|     /*@}*/ | ||||
| 
 | ||||
|  |  | |||
|  | @ -349,7 +349,7 @@ extern "C" { | |||
| 
 | ||||
|         def_API('Z3_mk_fpa_numeral_int64_uint64', AST, (_in(CONTEXT), _in(BOOL), _in(INT64), _in(UINT64), _in(SORT))) | ||||
|     */ | ||||
|     Z3_ast Z3_API Z3_mk_fpa_numeral_int64_uint64(Z3_context c, Z3_bool sgn, __int64 exp, __uint64 sig, Z3_sort ty); | ||||
|     Z3_ast Z3_API Z3_mk_fpa_numeral_int64_uint64(Z3_context c, Z3_bool sgn, int64_t exp, uint64_t sig, Z3_sort ty); | ||||
| 
 | ||||
|     /**
 | ||||
|         \brief Floating-point absolute value | ||||
|  | @ -956,7 +956,7 @@ extern "C" { | |||
| 
 | ||||
|         def_API('Z3_fpa_get_numeral_significand_uint64', BOOL, (_in(CONTEXT), _in(AST), _out(UINT64))) | ||||
|     */ | ||||
|     Z3_bool Z3_API Z3_fpa_get_numeral_significand_uint64(Z3_context c, Z3_ast t, __uint64 * n); | ||||
|     Z3_bool Z3_API Z3_fpa_get_numeral_significand_uint64(Z3_context c, Z3_ast t, uint64_t * n); | ||||
| 
 | ||||
|     /**
 | ||||
|         \brief Return the exponent value of a floating-point numeral as a string. | ||||
|  | @ -985,7 +985,7 @@ extern "C" { | |||
| 
 | ||||
|         def_API('Z3_fpa_get_numeral_exponent_int64', BOOL, (_in(CONTEXT), _in(AST), _out(INT64), _in(BOOL))) | ||||
|     */ | ||||
|     Z3_bool Z3_API Z3_fpa_get_numeral_exponent_int64(Z3_context c, Z3_ast t, __int64 * n, Z3_bool biased); | ||||
|     Z3_bool Z3_API Z3_fpa_get_numeral_exponent_int64(Z3_context c, Z3_ast t, int64_t * n, Z3_bool biased); | ||||
| 
 | ||||
|     /**
 | ||||
|         \brief Retrieves the exponent of a floating-point literal as a bit-vector expression. | ||||
|  |  | |||
|  | @ -23,8 +23,8 @@ static std::ostream & operator<<(std::ostream & out, ll_escaped const & d); | |||
| 
 | ||||
| static void __declspec(noinline) R()  { *g_z3_log << "R\n"; g_z3_log->flush(); } | ||||
| static void __declspec(noinline) P(void * obj)  { *g_z3_log << "P " << obj << "\n"; g_z3_log->flush(); } | ||||
| static void __declspec(noinline) I(__int64 i)   { *g_z3_log << "I " << i << "\n"; g_z3_log->flush(); } | ||||
| static void __declspec(noinline) U(__uint64 u)   { *g_z3_log << "U " << u << "\n"; g_z3_log->flush(); } | ||||
| static void __declspec(noinline) I(int64_t i)   { *g_z3_log << "I " << i << "\n"; g_z3_log->flush(); } | ||||
| static void __declspec(noinline) U(uint64_t u)   { *g_z3_log << "U " << u << "\n"; g_z3_log->flush(); } | ||||
| static void __declspec(noinline) D(double d)   { *g_z3_log << "D " << d << "\n"; g_z3_log->flush(); } | ||||
| static void __declspec(noinline) S(Z3_string str) { *g_z3_log << "S \"" << ll_escaped(str) << "\"\n"; g_z3_log->flush(); } | ||||
| static void __declspec(noinline) Sy(Z3_symbol sym) {  | ||||
|  |  | |||
|  | @ -40,8 +40,8 @@ struct z3_replayer::imp { | |||
|     int                      m_line;  // line
 | ||||
|     svector<char>            m_string; | ||||
|     symbol                   m_id; | ||||
|     __int64                  m_int64; | ||||
|     __uint64                 m_uint64; | ||||
|     int64_t                  m_int64; | ||||
|     uint64_t                 m_uint64; | ||||
|     double                   m_double; | ||||
|     float                    m_float; | ||||
|     size_t                   m_ptr; | ||||
|  | @ -85,8 +85,8 @@ struct z3_replayer::imp { | |||
|     struct value { | ||||
|         value_kind m_kind; | ||||
|         union { | ||||
|             __int64      m_int; | ||||
|             __uint64     m_uint; | ||||
|             int64_t      m_int; | ||||
|             uint64_t     m_uint; | ||||
|             double       m_double; | ||||
|             char const * m_str; | ||||
|             void *       m_obj; | ||||
|  | @ -95,8 +95,8 @@ struct z3_replayer::imp { | |||
|         value():m_kind(OBJECT), m_int(0) {} | ||||
|         value(void * obj):m_kind(OBJECT), m_obj(obj) {} | ||||
|         value(value_kind k, char const * str):m_kind(k), m_str(str) {} | ||||
|         value(value_kind k, __uint64 u):m_kind(k), m_uint(u) {} | ||||
|         value(value_kind k, __int64 i):m_kind(k), m_int(i) {} | ||||
|         value(value_kind k, uint64_t u):m_kind(k), m_uint(u) {} | ||||
|         value(value_kind k, int64_t i):m_kind(k), m_int(i) {} | ||||
|         value(value_kind k, double d):m_kind(k), m_double(d) {} | ||||
|         value(value_kind k, float f):m_kind(k), m_float(f) {} | ||||
|     }; | ||||
|  | @ -342,7 +342,7 @@ struct z3_replayer::imp { | |||
|         unsigned   asz = m_args.size(); | ||||
|         if (sz > asz) | ||||
|             throw z3_replayer_exception("invalid array size"); | ||||
|         __uint64   aidx; | ||||
|         uint64_t   aidx; | ||||
|         value_kind nk; | ||||
|         for (unsigned i = asz - sz; i < asz; i++) { | ||||
|             if (m_args[i].m_kind != k) | ||||
|  | @ -400,7 +400,7 @@ struct z3_replayer::imp { | |||
| #define TICK_FREQUENCY 100000 | ||||
| 
 | ||||
|     void parse() { | ||||
|         unsigned long long counter = 0; | ||||
|         uint64_t counter = 0; | ||||
|         unsigned tick = 0; | ||||
|         while (true) { | ||||
|             IF_VERBOSE(1, { | ||||
|  | @ -577,7 +577,7 @@ struct z3_replayer::imp { | |||
|         return static_cast<int>(m_args[pos].m_int); | ||||
|     } | ||||
| 
 | ||||
|     __int64 get_int64(unsigned pos) const { | ||||
|     int64_t get_int64(unsigned pos) const { | ||||
|         check_arg(pos, INT64); | ||||
|         return m_args[pos].m_int; | ||||
|     } | ||||
|  | @ -587,7 +587,7 @@ struct z3_replayer::imp { | |||
|         return static_cast<unsigned>(m_args[pos].m_uint); | ||||
|     } | ||||
| 
 | ||||
|     __uint64 get_uint64(unsigned pos) const { | ||||
|     uint64_t get_uint64(unsigned pos) const { | ||||
|         check_arg(pos, UINT64); | ||||
|         return m_args[pos].m_uint; | ||||
|     } | ||||
|  | @ -630,6 +630,12 @@ struct z3_replayer::imp { | |||
|         return m_int_arrays[idx].c_ptr(); | ||||
|     } | ||||
| 
 | ||||
|     bool * get_bool_array(unsigned pos) const { | ||||
|         check_arg(pos, UINT_ARRAY); | ||||
|         unsigned idx = static_cast<unsigned>(m_args[pos].m_uint); | ||||
|         return reinterpret_cast<bool*>(m_unsigned_arrays[idx].c_ptr()); | ||||
|     } | ||||
| 
 | ||||
|     Z3_symbol * get_symbol_array(unsigned pos) const { | ||||
|         check_arg(pos, SYMBOL_ARRAY); | ||||
|         unsigned idx = static_cast<unsigned>(m_args[pos].m_uint); | ||||
|  | @ -650,7 +656,7 @@ struct z3_replayer::imp { | |||
|         return reinterpret_cast<int*>(&(m_args[pos].m_int)); | ||||
|     } | ||||
| 
 | ||||
|     __int64 * get_int64_addr(unsigned pos) { | ||||
|     int64_t * get_int64_addr(unsigned pos) { | ||||
|         check_arg(pos, INT64); | ||||
|         return &(m_args[pos].m_int); | ||||
|     } | ||||
|  | @ -660,7 +666,7 @@ struct z3_replayer::imp { | |||
|         return reinterpret_cast<unsigned*>(&(m_args[pos].m_uint)); | ||||
|     } | ||||
| 
 | ||||
|     __uint64 * get_uint64_addr(unsigned pos) { | ||||
|     uint64_t * get_uint64_addr(unsigned pos) { | ||||
|         check_arg(pos, UINT64); | ||||
|         return &(m_args[pos].m_uint); | ||||
|     } | ||||
|  | @ -725,11 +731,11 @@ unsigned z3_replayer::get_uint(unsigned pos) const { | |||
|     return m_imp->get_uint(pos); | ||||
| } | ||||
| 
 | ||||
| __int64 z3_replayer::get_int64(unsigned pos) const { | ||||
| int64_t z3_replayer::get_int64(unsigned pos) const { | ||||
|     return m_imp->get_int64(pos); | ||||
| } | ||||
| 
 | ||||
| __uint64 z3_replayer::get_uint64(unsigned pos) const { | ||||
| uint64_t z3_replayer::get_uint64(unsigned pos) const { | ||||
|     return m_imp->get_uint64(pos); | ||||
| } | ||||
| 
 | ||||
|  | @ -761,6 +767,10 @@ int * z3_replayer::get_int_array(unsigned pos) const { | |||
|     return m_imp->get_int_array(pos); | ||||
| } | ||||
| 
 | ||||
| bool * z3_replayer::get_bool_array(unsigned pos) const { | ||||
|     return m_imp->get_bool_array(pos); | ||||
| } | ||||
| 
 | ||||
| Z3_symbol * z3_replayer::get_symbol_array(unsigned pos) const { | ||||
|     return m_imp->get_symbol_array(pos); | ||||
| } | ||||
|  | @ -773,7 +783,7 @@ int * z3_replayer::get_int_addr(unsigned pos) { | |||
|     return m_imp->get_int_addr(pos); | ||||
| } | ||||
| 
 | ||||
| __int64 * z3_replayer::get_int64_addr(unsigned pos) { | ||||
| int64_t * z3_replayer::get_int64_addr(unsigned pos) { | ||||
|     return m_imp->get_int64_addr(pos); | ||||
| } | ||||
| 
 | ||||
|  | @ -781,7 +791,7 @@ unsigned * z3_replayer::get_uint_addr(unsigned pos) { | |||
|     return m_imp->get_uint_addr(pos); | ||||
| } | ||||
| 
 | ||||
| __uint64 * z3_replayer::get_uint64_addr(unsigned pos) { | ||||
| uint64_t * z3_replayer::get_uint64_addr(unsigned pos) { | ||||
|     return m_imp->get_uint64_addr(pos); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -40,8 +40,8 @@ public: | |||
| 
 | ||||
|     int get_int(unsigned pos) const; | ||||
|     unsigned get_uint(unsigned pos) const; | ||||
|     __int64 get_int64(unsigned pos) const; | ||||
|     __uint64 get_uint64(unsigned pos) const; | ||||
|     int64_t get_int64(unsigned pos) const; | ||||
|     uint64_t get_uint64(unsigned pos) const; | ||||
|     float get_float(unsigned pos) const; | ||||
|     double get_double(unsigned pos) const; | ||||
|     bool get_bool(unsigned pos) const; | ||||
|  | @ -51,13 +51,14 @@ public: | |||
| 
 | ||||
|     unsigned * get_uint_array(unsigned pos) const; | ||||
|     int * get_int_array(unsigned pos) const; | ||||
|     bool * get_bool_array(unsigned pos) const; | ||||
|     Z3_symbol * get_symbol_array(unsigned pos) const; | ||||
|     void ** get_obj_array(unsigned pos) const; | ||||
| 
 | ||||
|     int * get_int_addr(unsigned pos); | ||||
|     __int64 * get_int64_addr(unsigned pos); | ||||
|     int64_t * get_int64_addr(unsigned pos); | ||||
|     unsigned * get_uint_addr(unsigned pos); | ||||
|     __uint64 * get_uint64_addr(unsigned pos); | ||||
|     uint64_t * get_uint64_addr(unsigned pos); | ||||
|     Z3_string * get_str_addr(unsigned pos); | ||||
|     void ** get_obj_addr(unsigned pos); | ||||
| 
 | ||||
|  |  | |||
|  | @ -2259,7 +2259,12 @@ var * ast_manager::mk_var(unsigned idx, sort * s) { | |||
|     unsigned sz     = var::get_obj_size(); | ||||
|     void * mem      = allocate_node(sz); | ||||
|     var * new_node  = new (mem) var(idx, s); | ||||
|     return register_node(new_node); | ||||
|     var * r         = register_node(new_node); | ||||
| 
 | ||||
|     if (m_trace_stream && r == new_node) { | ||||
|         *m_trace_stream << "[mk-var] #" << r->get_id() << "\n"; | ||||
|     } | ||||
|     return r; | ||||
| } | ||||
| 
 | ||||
| app * ast_manager::mk_label(bool pos, unsigned num_names, symbol const * names, expr * n) { | ||||
|  |  | |||
|  | @ -298,11 +298,11 @@ class sort_size { | |||
|         SS_FINITE_VERY_BIG, | ||||
|         SS_INFINITE | ||||
|     } m_kind; | ||||
|     uint64 m_size; // It is only meaningful if m_kind == SS_FINITE
 | ||||
|     sort_size(kind_t k, uint64 r):m_kind(k), m_size(r) {} | ||||
|     uint64_t m_size; // It is only meaningful if m_kind == SS_FINITE
 | ||||
|     sort_size(kind_t k, uint64_t r):m_kind(k), m_size(r) {} | ||||
| public: | ||||
|     sort_size():m_kind(SS_INFINITE) {} | ||||
|     sort_size(uint64 const & sz):m_kind(SS_FINITE), m_size(sz) {} | ||||
|     sort_size(uint64_t const & sz):m_kind(SS_FINITE), m_size(sz) {} | ||||
|     sort_size(sort_size const& other): m_kind(other.m_kind), m_size(other.m_size) {} | ||||
|     explicit sort_size(rational const& r) { | ||||
|         if (r.is_uint64()) { | ||||
|  | @ -316,7 +316,7 @@ public: | |||
|     } | ||||
|     static sort_size mk_infinite() { return sort_size(SS_INFINITE, 0); } | ||||
|     static sort_size mk_very_big() { return sort_size(SS_FINITE_VERY_BIG, 0); } | ||||
|     static sort_size mk_finite(uint64 r) { return sort_size(SS_FINITE, r); } | ||||
|     static sort_size mk_finite(uint64_t r) { return sort_size(SS_FINITE, r); } | ||||
| 
 | ||||
|     bool is_infinite() const { return m_kind == SS_INFINITE; } | ||||
|     bool is_very_big() const { return m_kind == SS_FINITE_VERY_BIG; } | ||||
|  | @ -324,7 +324,7 @@ public: | |||
| 
 | ||||
|     static bool is_very_big_base2(unsigned power) { return power >= 64; } | ||||
| 
 | ||||
|     uint64 size() const { SASSERT(is_finite()); return m_size; } | ||||
|     uint64_t size() const { SASSERT(is_finite()); return m_size; } | ||||
| }; | ||||
| 
 | ||||
| std::ostream& operator<<(std::ostream& out, sort_size const & ss); | ||||
|  | @ -346,7 +346,7 @@ public: | |||
|         decl_info(family_id, k, num_parameters, parameters, private_parameters) { | ||||
|     } | ||||
| 
 | ||||
|     sort_info(family_id family_id, decl_kind k, uint64 num_elements, | ||||
|     sort_info(family_id family_id, decl_kind k, uint64_t num_elements, | ||||
|               unsigned num_parameters = 0, parameter const * parameters = nullptr, bool private_parameters = false): | ||||
|         decl_info(family_id, k, num_parameters, parameters, private_parameters), m_num_elements(num_elements) { | ||||
|     } | ||||
|  |  | |||
|  | @ -395,7 +395,7 @@ format * smt2_pp_environment::pp_string_literal(app * t) { | |||
| } | ||||
| 
 | ||||
| format * smt2_pp_environment::pp_datalog_literal(app * t) { | ||||
|     uint64 v; | ||||
|     uint64_t v; | ||||
|     VERIFY (get_dlutil().is_numeral(t, v)); | ||||
|     std::ostringstream buffer; | ||||
|     buffer << v; | ||||
|  |  | |||
|  | @ -384,7 +384,7 @@ public: | |||
| 
 | ||||
|     app * mk_numeral(rational const & val, sort* s) const; | ||||
|     app * mk_numeral(rational const & val, unsigned bv_size) const; | ||||
|     app * mk_numeral(uint64 u, unsigned bv_size) const { return mk_numeral(rational(u, rational::ui64()), bv_size); } | ||||
|     app * mk_numeral(uint64_t u, unsigned bv_size) const { return mk_numeral(rational(u, rational::ui64()), bv_size); } | ||||
|     sort * mk_sort(unsigned bv_size); | ||||
| 
 | ||||
|     unsigned get_bv_size(sort const * s) const { | ||||
|  |  | |||
|  | @ -390,6 +390,7 @@ namespace datatype { | |||
|                 TRACE("datatype", tout << "declaring " << datatypes[i]->name() << "\n";); | ||||
|                 if (m_defs.find(datatypes[i]->name(), d)) { | ||||
|                     TRACE("datatype", tout << "delete previous version for " << datatypes[i]->name() << "\n";); | ||||
|                     u().reset(); | ||||
|                     dealloc(d); | ||||
|                 } | ||||
|                 m_defs.insert(datatypes[i]->name(), datatypes[i]); | ||||
|  |  | |||
|  | @ -239,7 +239,6 @@ namespace datatype { | |||
|             map<symbol, def*, symbol_hash_proc, symbol_eq_proc> m_defs;  | ||||
|             svector<symbol>          m_def_block; | ||||
|             unsigned                 m_class_id; | ||||
|             util & u() const; | ||||
| 
 | ||||
|             void inherit(decl_plugin* other_p, ast_translation& tr) override; | ||||
| 
 | ||||
|  | @ -279,6 +278,8 @@ namespace datatype { | |||
|             def const& get_def(sort* s) const { return *(m_defs[datatype_name(s)]); } | ||||
|             def& get_def(symbol const& s) { return *(m_defs[s]); } | ||||
|             bool is_declared(sort* s) const { return m_defs.contains(datatype_name(s)); } | ||||
|             util & u() const; | ||||
| 
 | ||||
|         private: | ||||
|             bool is_value_visit(expr * arg, ptr_buffer<app> & todo) const; | ||||
|          | ||||
|  |  | |||
|  | @ -652,9 +652,9 @@ namespace datalog { | |||
| 
 | ||||
|     // create a constant belonging to a given finite domain.
 | ||||
| 
 | ||||
|     app* dl_decl_util::mk_numeral(uint64 value, sort* s) { | ||||
|     app* dl_decl_util::mk_numeral(uint64_t value, sort* s) { | ||||
|         if (is_finite_sort(s)) { | ||||
|             uint64 sz = 0; | ||||
|             uint64_t sz = 0; | ||||
|             if (try_get_size(s, sz) && sz <= value) { | ||||
|                 m.raise_exception("value is out of bounds"); | ||||
|             } | ||||
|  | @ -680,7 +680,7 @@ namespace datalog { | |||
|         return nullptr; | ||||
|     } | ||||
| 
 | ||||
|     bool dl_decl_util::is_numeral(const expr* e, uint64& v) const { | ||||
|     bool dl_decl_util::is_numeral(const expr* e, uint64_t& v) const { | ||||
|         if (is_numeral(e)) { | ||||
|             const app* c = to_app(e); | ||||
|             SASSERT(c->get_decl()->get_num_parameters() == 2); | ||||
|  | @ -693,7 +693,7 @@ namespace datalog { | |||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     bool dl_decl_util::is_numeral_ext(expr* e, uint64& v) const { | ||||
|     bool dl_decl_util::is_numeral_ext(expr* e, uint64_t& v) const { | ||||
|         if (is_numeral(e, v)) { | ||||
|             return true; | ||||
|         } | ||||
|  | @ -724,7 +724,7 @@ namespace datalog { | |||
|         return m.is_true(c) || m.is_false(c); | ||||
|     } | ||||
| 
 | ||||
|     sort* dl_decl_util::mk_sort(const symbol& name, uint64  domain_size) { | ||||
|     sort* dl_decl_util::mk_sort(const symbol& name, uint64_t  domain_size) { | ||||
|         if (domain_size == 0) { | ||||
|             std::stringstream sstm; | ||||
|             sstm << "Domain size of sort '" << name << "' may not be 0"; | ||||
|  | @ -734,7 +734,7 @@ namespace datalog { | |||
|         return m.mk_sort(m_fid, DL_FINITE_SORT, 2, params); | ||||
|     } | ||||
| 
 | ||||
|     bool dl_decl_util::try_get_size(const sort * s, uint64& size) const { | ||||
|     bool dl_decl_util::try_get_size(const sort * s, uint64_t& size) const { | ||||
|         sort_size sz = s->get_info()->get_num_elements(); | ||||
|         if (sz.is_finite()) { | ||||
|             size = sz.size(); | ||||
|  |  | |||
|  | @ -122,7 +122,7 @@ namespace datalog { | |||
|         // Contract for func_decl:
 | ||||
|         //   parameters[0]     - array sort
 | ||||
|         // Contract for OP_DL_CONSTANT:
 | ||||
|         //   parameters[0]     - rational containing uint64 with constant value
 | ||||
|         //   parameters[0]     - rational containing uint64_t with constant value
 | ||||
|         //   parameters[1]     - a DL_FINITE_SORT sort of the constant
 | ||||
|         // Contract for others:
 | ||||
|         //   no parameters
 | ||||
|  | @ -166,7 +166,7 @@ namespace datalog { | |||
|         dl_decl_util(ast_manager& m); | ||||
|         // create a constant belonging to a given finite domain.
 | ||||
|         // the options include the DL_FINITE_SORT, BV_SORT, and BOOL_SORT
 | ||||
|         app* mk_numeral(uint64 value, sort* s); | ||||
|         app* mk_numeral(uint64_t value, sort* s); | ||||
| 
 | ||||
|         app* mk_lt(expr* a, expr* b); | ||||
| 
 | ||||
|  | @ -176,19 +176,19 @@ namespace datalog { | |||
| 
 | ||||
|         bool is_numeral(const expr* c) const { return is_app_of(c, m_fid, OP_DL_CONSTANT); } | ||||
| 
 | ||||
|         bool is_numeral(const expr* e, uint64& v) const; | ||||
|         bool is_numeral(const expr* e, uint64_t& v) const; | ||||
| 
 | ||||
|         //
 | ||||
|         // Utilities for extracting constants 
 | ||||
|         // from bit-vectors and finite domains.
 | ||||
|         // 
 | ||||
|         bool is_numeral_ext(expr* c, uint64& v) const; | ||||
|         bool is_numeral_ext(expr* c, uint64_t& v) const; | ||||
| 
 | ||||
|         bool is_numeral_ext(expr* c) const;         | ||||
| 
 | ||||
|         sort* mk_sort(const symbol& name, uint64  domain_size); | ||||
|         sort* mk_sort(const symbol& name, uint64_t  domain_size); | ||||
| 
 | ||||
|         bool try_get_size(const sort *, uint64& size) const; | ||||
|         bool try_get_size(const sort *, uint64_t& size) const; | ||||
| 
 | ||||
|         bool is_finite_sort(sort* s) const {  | ||||
|             return is_sort_of(s, m_fid, DL_FINITE_SORT);  | ||||
|  |  | |||
|  | @ -262,11 +262,11 @@ func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl * | |||
| 
 | ||||
|     unsigned arity = bv_f->get_arity(); | ||||
|     func_interp * bv_fi = mc->get_func_interp(bv_f); | ||||
|     result = alloc(func_interp, m, arity); | ||||
| 
 | ||||
|     if (bv_fi) { | ||||
|         fpa_rewriter rw(m); | ||||
|         expr_ref ai(m); | ||||
|         result = alloc(func_interp, m, arity); | ||||
| 
 | ||||
|         for (unsigned i = 0; i < bv_fi->num_entries(); i++) { | ||||
|             func_entry const * bv_fe = bv_fi->get_entry(i); | ||||
|  | @ -465,26 +465,7 @@ void bv2fpa_converter::convert_uf2bvuf(model_core * mc, model_core * target_mode | |||
|         else { | ||||
|             if (it->get_key().get_family_id() == m_fpa_util.get_fid()) { | ||||
|                 // it->m_value contains the model for the unspecified cases of it->m_key.
 | ||||
| 
 | ||||
|                 func_interp * fmv = convert_func_interp(mc, f, it->m_value); | ||||
|                 if (fmv) { | ||||
| #if 0 | ||||
|                     // Upon request, add this 'recursive' definition?
 | ||||
|                     unsigned n = fmv->get_arity(); | ||||
|                     expr_ref_vector args(m); | ||||
|                     for (unsigned i = 0; i < n; i++) | ||||
|                         args.push_back(m.mk_var(i, f->get_domain()[i])); | ||||
|                     fmv->set_else(m.mk_app(it->m_key, n, args.c_ptr())); | ||||
| #else | ||||
| 
 | ||||
|                     fmv->set_else(nullptr); | ||||
| #endif | ||||
|                     target_model->register_decl(f, fmv); | ||||
|                 } | ||||
|             } | ||||
|             else { | ||||
|                 func_interp * fmv = convert_func_interp(mc, f, it->m_value); | ||||
|                 if (fmv) target_model->register_decl(f, fmv); | ||||
|                 target_model->register_decl(f, convert_func_interp(mc, f, it->m_value)); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -1071,7 +1071,7 @@ void fpa2bv_converter::mk_rem(sort * s, expr_ref & x, expr_ref & y, expr_ref & r | |||
|     SASSERT(m_mpz_manager.is_int64(max_exp_diff)); | ||||
|     SASSERT(m_mpz_manager.get_uint64(max_exp_diff) <= UINT_MAX); | ||||
| 
 | ||||
|     uint64 max_exp_diff_ui64 = m_mpz_manager.get_uint64(max_exp_diff); | ||||
|     uint64_t max_exp_diff_ui64 = m_mpz_manager.get_uint64(max_exp_diff); | ||||
|     SASSERT(max_exp_diff_ui64 <= UINT_MAX); | ||||
|     unsigned max_exp_diff_ui = (unsigned)max_exp_diff_ui64; | ||||
|     m_mpz_manager.del(max_exp_diff); | ||||
|  | @ -1919,7 +1919,7 @@ void fpa2bv_converter::mk_round_to_integral(sort * s, expr_ref & rm, expr_ref & | |||
| 
 | ||||
|     expr_ref pow_2_sbitsm1(m), m1(m); | ||||
|     pow_2_sbitsm1 = m_bv_util.mk_numeral(fu().fm().m_powers2(sbits - 1), sbits); | ||||
|     m1 = m_bv_util.mk_numeral(-1, ebits); | ||||
|     m1 = m_bv_util.mk_bv_neg(m_bv_util.mk_numeral(1, ebits)); | ||||
|     m_simp.mk_eq(a_sig, pow_2_sbitsm1, t1); | ||||
|     m_simp.mk_eq(a_exp, m1, t2); | ||||
|     m_simp.mk_and(t1, t2, tie); | ||||
|  | @ -1927,7 +1927,7 @@ void fpa2bv_converter::mk_round_to_integral(sort * s, expr_ref & rm, expr_ref & | |||
| 
 | ||||
|     m_simp.mk_and(tie, rm_is_rte, c421); | ||||
|     m_simp.mk_and(tie, rm_is_rta, c422); | ||||
|     c423 = m_bv_util.mk_sle(a_exp, m_bv_util.mk_numeral(-2, ebits)); | ||||
|     c423 = m_bv_util.mk_sle(a_exp, m_bv_util.mk_bv_neg(m_bv_util.mk_numeral(2, ebits))); | ||||
| 
 | ||||
|     dbg_decouple("fpa2bv_r2i_c421", c421); | ||||
|     dbg_decouple("fpa2bv_r2i_c422", c422); | ||||
|  | @ -2452,7 +2452,7 @@ void fpa2bv_converter::mk_to_fp_float(sort * to_srt, expr * rm, expr * x, expr_r | |||
|             const mpz & ovft = m_mpf_manager.m_powers2.m1(to_ebits+1, false); | ||||
|             first_ovf_exp = m_bv_util.mk_numeral(ovft, from_ebits+2); | ||||
|             first_udf_exp = m_bv_util.mk_concat( | ||||
|                 m_bv_util.mk_numeral(-1, ebits_diff + 3), | ||||
|                 m_bv_util.mk_bv_neg(m_bv_util.mk_numeral(1, ebits_diff + 3)), | ||||
|                 m_bv_util.mk_numeral(1, to_ebits + 1)); | ||||
|             dbg_decouple("fpa2bv_to_float_first_ovf_exp", first_ovf_exp); | ||||
|             dbg_decouple("fpa2bv_to_float_first_udf_exp", first_udf_exp); | ||||
|  | @ -2845,7 +2845,7 @@ void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const | |||
|     expr_ref is_neg(m), x_abs(m), neg_x(m); | ||||
|     is_neg_bit = m_bv_util.mk_extract(bv_sz - 1, bv_sz - 1, x); | ||||
|     is_neg = m.mk_eq(is_neg_bit, bv1_1); | ||||
|     neg_x = m_bv_util.mk_bv_neg(x); | ||||
|     neg_x = m_bv_util.mk_bv_neg(x); // overflow problem?
 | ||||
|     x_abs = m.mk_ite(is_neg, neg_x, x); | ||||
|     dbg_decouple("fpa2bv_to_fp_signed_is_neg", is_neg); | ||||
|     // x_abs has an extra bit in the front.
 | ||||
|  | @ -2882,11 +2882,13 @@ void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const | |||
|         SASSERT(is_well_sorted(m, lz)); | ||||
|     } | ||||
|     SASSERT(m_bv_util.get_bv_size(sig_4) == sig_sz); | ||||
|     dbg_decouple("fpa2bv_to_fp_signed_sig_4", sig_4); | ||||
| 
 | ||||
|     expr_ref s_exp(m), exp_rest(m); | ||||
|     s_exp = m_bv_util.mk_bv_sub(m_bv_util.mk_numeral(bv_sz - 2, bv_sz), lz); | ||||
|     // s_exp = (bv_sz-2) + (-lz) signed
 | ||||
|     SASSERT(m_bv_util.get_bv_size(s_exp) == bv_sz); | ||||
|     dbg_decouple("fpa2bv_to_fp_signed_s_exp", s_exp); | ||||
| 
 | ||||
|     unsigned exp_sz = ebits + 2; // (+2 for rounder)
 | ||||
|     exp_2 = m_bv_util.mk_extract(exp_sz - 1, 0, s_exp); | ||||
|  | @ -2907,10 +2909,9 @@ void fpa2bv_converter::mk_to_fp_signed(func_decl * f, unsigned num, expr * const | |||
|         mk_max_exp(exp_sz, max_exp); | ||||
|         max_exp_bvsz = m_bv_util.mk_zero_extend(bv_sz - exp_sz, max_exp); | ||||
| 
 | ||||
|         exp_too_large = m_bv_util.mk_ule(m_bv_util.mk_bv_add( | ||||
|             max_exp_bvsz, | ||||
|             m_bv_util.mk_numeral(1, bv_sz)), | ||||
|             s_exp); | ||||
|         exp_too_large = m_bv_util.mk_sle( | ||||
|                             m_bv_util.mk_bv_add(max_exp_bvsz, m_bv_util.mk_numeral(1, bv_sz)), | ||||
|                             s_exp); | ||||
|         zero_sig_sz = m_bv_util.mk_numeral(0, sig_sz); | ||||
|         sig_4 = m.mk_ite(exp_too_large, zero_sig_sz, sig_4); | ||||
|         exp_2 = m.mk_ite(exp_too_large, max_exp, exp_2); | ||||
|  | @ -3040,7 +3041,7 @@ void fpa2bv_converter::mk_to_fp_unsigned(func_decl * f, unsigned num, expr * con | |||
|         mk_max_exp(exp_sz, max_exp); | ||||
|         max_exp_bvsz = m_bv_util.mk_zero_extend(bv_sz - exp_sz, max_exp); | ||||
| 
 | ||||
|         exp_too_large = m_bv_util.mk_ule(m_bv_util.mk_bv_add( | ||||
|         exp_too_large = m_bv_util.mk_sle(m_bv_util.mk_bv_add( | ||||
|             max_exp_bvsz, | ||||
|             m_bv_util.mk_numeral(1, bv_sz)), | ||||
|             s_exp); | ||||
|  | @ -3106,7 +3107,7 @@ void fpa2bv_converter::mk_to_ieee_bv_unspecified(func_decl * f, unsigned num, ex | |||
| 
 | ||||
|         expr_ref exp_bv(m), exp_all_ones(m); | ||||
|         exp_bv = m_bv_util.mk_extract(ebits+sbits-2, sbits-1, result); | ||||
|         exp_all_ones = m.mk_eq(exp_bv, m_bv_util.mk_numeral(-1, ebits)); | ||||
|         exp_all_ones = m.mk_eq(exp_bv, m_bv_util.mk_bv_neg(m_bv_util.mk_numeral(1, ebits))); | ||||
|         m_extra_assertions.push_back(exp_all_ones); | ||||
| 
 | ||||
|         expr_ref sig_bv(m), sig_is_non_zero(m); | ||||
|  | @ -3241,18 +3242,34 @@ void fpa2bv_converter::mk_to_bv(func_decl * f, unsigned num, expr * const * args | |||
|     dbg_decouple("fpa2bv_to_bv_inc", inc); | ||||
|     dbg_decouple("fpa2bv_to_bv_pre_rounded", pre_rounded); | ||||
| 
 | ||||
|     pre_rounded = m.mk_ite(x_is_neg, m_bv_util.mk_bv_neg(pre_rounded), pre_rounded); | ||||
|     expr_ref incd(m), pr_is_zero(m), ovfl(m); | ||||
|     incd = m.mk_eq(rounding_decision, bv1); | ||||
|     pr_is_zero = m.mk_eq(pre_rounded, m_bv_util.mk_numeral(0, bv_sz + 3)); | ||||
|     ovfl = m.mk_and(incd, pr_is_zero); | ||||
|     dbg_decouple("fpa2bv_to_bv_incd", incd); | ||||
|     dbg_decouple("fpa2bv_to_bv_ovfl", ovfl); | ||||
| 
 | ||||
|     expr_ref ll(m), ul(m), in_range(m); | ||||
|     expr_ref ul(m), in_range(m); | ||||
|     if (!is_signed) { | ||||
|         ll = m_bv_util.mk_numeral(0, bv_sz+3); | ||||
|         ul = m_bv_util.mk_zero_extend(3, m_bv_util.mk_numeral(-1, bv_sz)); | ||||
|         ul = m_bv_util.mk_zero_extend(3, m_bv_util.mk_bv_neg(m_bv_util.mk_numeral(1, bv_sz))); | ||||
|         in_range = m.mk_and(m.mk_or(m.mk_not(x_is_neg), | ||||
|                                     m.mk_eq(pre_rounded, m_bv_util.mk_numeral(0, bv_sz+3))), | ||||
|                             m.mk_not(ovfl), | ||||
|                             m_bv_util.mk_ule(pre_rounded, ul)); | ||||
|     } | ||||
|     else { | ||||
|         expr_ref ll(m); | ||||
|         ll = m_bv_util.mk_sign_extend(3, m_bv_util.mk_concat(bv1, m_bv_util.mk_numeral(0, bv_sz-1))); | ||||
|         ul = m_bv_util.mk_zero_extend(4, m_bv_util.mk_numeral(-1, bv_sz-1)); | ||||
|         ul = m_bv_util.mk_zero_extend(4, m_bv_util.mk_bv_neg(m_bv_util.mk_numeral(1, bv_sz-1))); | ||||
|         ovfl = m.mk_or(ovfl, m_bv_util.mk_sle(pre_rounded, m_bv_util.mk_bv_neg(m_bv_util.mk_numeral(1, bv_sz + 3)))); | ||||
|         in_range = m.mk_and(m.mk_not(ovfl), | ||||
|                             m_bv_util.mk_sle(ll, pre_rounded), | ||||
|                             m_bv_util.mk_sle(pre_rounded, ul)); | ||||
|         dbg_decouple("fpa2bv_to_bv_in_range_ll", ll); | ||||
|         pre_rounded = m.mk_ite(x_is_neg, m_bv_util.mk_bv_neg(pre_rounded), pre_rounded); | ||||
|     } | ||||
|     in_range = m.mk_and(m_bv_util.mk_sle(ll, pre_rounded), m_bv_util.mk_sle(pre_rounded, ul)); | ||||
|     dbg_decouple("fpa2bv_to_bv_in_range_ovfl", ovfl); | ||||
|     dbg_decouple("fpa2bv_to_bv_in_range_ul", ul); | ||||
|     dbg_decouple("fpa2bv_to_bv_in_range", in_range); | ||||
| 
 | ||||
|     expr_ref rounded(m); | ||||
|  |  | |||
|  | @ -387,7 +387,7 @@ expr_pattern_match::initialize(char const * spec_string) { | |||
|     m_instrs.push_back(instr(BACKTRACK)); | ||||
| 
 | ||||
|     std::istringstream is(spec_string); | ||||
|     cmd_context      ctx(true, &m_manager); | ||||
|     cmd_context      ctx(true, &m_manager);	 | ||||
|     bool ps = ctx.print_success_enabled(); | ||||
|     ctx.set_print_success(false); | ||||
|     VERIFY(parse_smt2_commands(ctx, is)); | ||||
|  |  | |||
|  | @ -680,8 +680,8 @@ br_status bv_rewriter::mk_extract(unsigned high, unsigned low, expr * arg, expr_ | |||
|         if (v.is_neg()) | ||||
|             mod(v, rational::power_of_two(sz), v); | ||||
|         if (v.is_uint64()) { | ||||
|             uint64 u  = v.get_uint64(); | ||||
|             uint64 e  = shift_right(u, low) & (shift_left(1ull, sz) - 1ull); | ||||
|             uint64_t u  = v.get_uint64(); | ||||
|             uint64_t e  = shift_right(u, low) & (shift_left(1ull, sz) - 1ull); | ||||
|             result    = mk_numeral(numeral(e, numeral::ui64()), sz); | ||||
|             return BR_DONE; | ||||
|         } | ||||
|  | @ -811,7 +811,7 @@ br_status bv_rewriter::mk_bv_shl(expr * arg1, expr * arg2, expr_ref & result) { | |||
|                 SASSERT(r1.is_uint64() && r2.is_uint64()); | ||||
|                 SASSERT(r2.get_uint64() < bv_size); | ||||
| 
 | ||||
|                 uint64 r = shift_left(r1.get_uint64(), r2.get_uint64()); | ||||
|                 uint64_t r = shift_left(r1.get_uint64(), r2.get_uint64()); | ||||
|                 numeral rn(r, numeral::ui64()); | ||||
|                 rn = m_util.norm(rn, bv_size); | ||||
|                 result   = mk_numeral(rn, bv_size); | ||||
|  | @ -860,7 +860,7 @@ br_status bv_rewriter::mk_bv_lshr(expr * arg1, expr * arg2, expr_ref & result) { | |||
|             if (bv_size <= 64) { | ||||
|                 SASSERT(r1.is_uint64()); | ||||
|                 SASSERT(r2.is_uint64()); | ||||
|                 uint64 r = shift_right(r1.get_uint64(), r2.get_uint64()); | ||||
|                 uint64_t r = shift_right(r1.get_uint64(), r2.get_uint64()); | ||||
|                 numeral rn(r, numeral::ui64()); | ||||
|                 rn = m_util.norm(rn, bv_size); | ||||
|                 result = mk_numeral(rn, bv_size); | ||||
|  | @ -902,11 +902,11 @@ br_status bv_rewriter::mk_bv_ashr(expr * arg1, expr * arg2, expr_ref & result) { | |||
|     bool is_num1 = is_numeral(arg1, r1, bv_size); | ||||
| 
 | ||||
|     if (bv_size <= 64 && is_num1 && is_num2) { | ||||
|         uint64 n1      = r1.get_uint64(); | ||||
|         uint64 n2_orig = r2.get_uint64(); | ||||
|         uint64 n2      = n2_orig % bv_size; | ||||
|         uint64_t n1      = r1.get_uint64(); | ||||
|         uint64_t n2_orig = r2.get_uint64(); | ||||
|         uint64_t n2      = n2_orig % bv_size; | ||||
|         SASSERT(n2 < bv_size); | ||||
|         uint64 r       = shift_right(n1, n2); | ||||
|         uint64_t r       = shift_right(n1, n2); | ||||
|         bool   sign    = (n1 & shift_left(1ull, bv_size - 1ull)) != 0; | ||||
|         if (n2_orig > n2) { | ||||
|             if (sign) { | ||||
|  | @ -917,9 +917,9 @@ br_status bv_rewriter::mk_bv_ashr(expr * arg1, expr * arg2, expr_ref & result) { | |||
|             } | ||||
|         } | ||||
|         else if (sign) { | ||||
|             uint64 allone  = shift_left(1ull, bv_size) - 1ull; | ||||
|             uint64 mask    = ~(shift_left(1ull, bv_size - n2) - 1ull); | ||||
|             mask          &= allone; | ||||
|             uint64_t allone = shift_left(1ull, bv_size) - 1ull; | ||||
|             uint64_t mask   = ~(shift_left(1ull, bv_size - n2) - 1ull); | ||||
|             mask &= allone; | ||||
|             r |= mask; | ||||
|         } | ||||
|         result = mk_numeral(numeral(r, numeral::ui64()), bv_size); | ||||
|  | @ -2021,7 +2021,7 @@ br_status bv_rewriter::mk_bv_ext_rotate_left(expr * arg1, expr * arg2, expr_ref | |||
|     numeral r2; | ||||
|     unsigned bv_size; | ||||
|     if (is_numeral(arg2, r2, bv_size)) { | ||||
|         unsigned shift = static_cast<unsigned>((r2 % numeral(bv_size)).get_uint64() % static_cast<uint64>(bv_size)); | ||||
|         unsigned shift = static_cast<unsigned>((r2 % numeral(bv_size)).get_uint64() % static_cast<uint64_t>(bv_size)); | ||||
|         return mk_bv_rotate_left(shift, arg1, result); | ||||
|     } | ||||
|     return BR_FAILED; | ||||
|  | @ -2031,7 +2031,7 @@ br_status bv_rewriter::mk_bv_ext_rotate_right(expr * arg1, expr * arg2, expr_ref | |||
|     numeral r2; | ||||
|     unsigned bv_size; | ||||
|     if (is_numeral(arg2, r2, bv_size)) { | ||||
|         unsigned shift = static_cast<unsigned>((r2 % numeral(bv_size)).get_uint64() % static_cast<uint64>(bv_size)); | ||||
|         unsigned shift = static_cast<unsigned>((r2 % numeral(bv_size)).get_uint64() % static_cast<uint64_t>(bv_size)); | ||||
|         return mk_bv_rotate_right(shift, arg1, result); | ||||
|     } | ||||
|     return BR_FAILED; | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ Revision History: | |||
|     br_status dl_rewriter::mk_app_core( | ||||
|         func_decl * f, unsigned num_args, expr* const* args, expr_ref& result) { | ||||
|         ast_manager& m = result.get_manager(); | ||||
|         uint64 v1, v2; | ||||
|         uint64_t v1, v2; | ||||
|         switch(f->get_decl_kind()) { | ||||
|             case datalog::OP_DL_LT: | ||||
|                 if (m_util.is_numeral_ext(args[0], v1) && | ||||
|  |  | |||
|  | @ -773,7 +773,7 @@ br_status fpa_rewriter::mk_to_ieee_bv(func_decl * f, expr * arg, expr_ref & resu | |||
|         if (m_fm.is_nan(v)) { | ||||
|             if (m_hi_fp_unspecified) { | ||||
|                 expr * args[4] = { bu.mk_numeral(0, 1), | ||||
|                                    bu.mk_numeral(-1, x.get_ebits()), | ||||
|                                    bu.mk_bv_neg(bu.mk_numeral(1, x.get_ebits())), | ||||
|                                    bu.mk_numeral(0, x.get_sbits() - 2), | ||||
|                                    bu.mk_numeral(1, 1) }; | ||||
|                 result = bu.mk_concat(4, args); | ||||
|  |  | |||
|  | @ -200,6 +200,9 @@ void re2automaton::set_solver(expr_solver* solver) { | |||
|     m_sa = alloc(symbolic_automata_t, sm, *m_ba.get()); | ||||
| } | ||||
| 
 | ||||
| eautomaton* re2automaton::mk_product(eautomaton* a1, eautomaton* a2) { | ||||
|     return m_sa->mk_product(*a1, *a2); | ||||
| } | ||||
| 
 | ||||
| eautomaton* re2automaton::operator()(expr* e) {  | ||||
|     eautomaton* r = re2aut(e);  | ||||
|  | @ -364,6 +367,9 @@ br_status seq_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * con | |||
|         SASSERT(num_args == 2); | ||||
|         return mk_re_concat(args[0], args[1], result); | ||||
|     case OP_RE_UNION: | ||||
|         if (num_args == 1) { | ||||
|             result = args[0]; return BR_DONE; | ||||
|         } | ||||
|         SASSERT(num_args == 2); | ||||
|         return mk_re_union(args[0], args[1], result); | ||||
|     case OP_RE_RANGE: | ||||
|  | @ -850,7 +856,7 @@ br_status seq_rewriter::mk_seq_replace(expr* a, expr* b, expr* c, expr_ref& resu | |||
|         return BR_DONE; | ||||
|     } | ||||
|     if (m_util.str.is_string(b, s2) && s2.length() == 0) { | ||||
|         result = m_util.str.mk_concat(a, c); | ||||
|         result = m_util.str.mk_concat(c, a); | ||||
|         return BR_REWRITE1; | ||||
|     } | ||||
|     if (m_util.str.is_string(a, s1) && s1.length() == 0) { | ||||
|  |  | |||
|  | @ -53,7 +53,9 @@ public: | |||
|     bool is_range() const { return m_ty == t_range; } | ||||
|     sort* get_sort() const { return m_sort; } | ||||
|     expr* get_char() const { SASSERT(is_char()); return m_t; } | ||||
| 
 | ||||
|     expr* get_pred() const { SASSERT(is_pred()); return m_t; } | ||||
|     expr* get_lo() const { SASSERT(is_range()); return m_t; } | ||||
|     expr* get_hi() const { SASSERT(is_range()); return m_s; } | ||||
| }; | ||||
| 
 | ||||
| class sym_expr_manager { | ||||
|  | @ -87,6 +89,7 @@ public: | |||
|     ~re2automaton(); | ||||
|     eautomaton* operator()(expr* e); | ||||
|     void set_solver(expr_solver* solver); | ||||
|     eautomaton* mk_product(eautomaton *a1, eautomaton *a2); | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  |  | |||
|  | @ -177,7 +177,7 @@ zstring zstring::replace(zstring const& src, zstring const& dst) const { | |||
|         return zstring(*this); | ||||
|     } | ||||
|     if (src.length() == 0) { | ||||
|         return zstring(*this); | ||||
|         return dst + zstring(*this); | ||||
|     } | ||||
|     bool found = false; | ||||
|     for (unsigned i = 0; i < length(); ++i) { | ||||
|  | @ -213,6 +213,9 @@ std::string zstring::encode() const { | |||
|         else if (ch == '\\') { | ||||
|             strm << "\\\\"; | ||||
|         } | ||||
|         else if (ch >= 128) { | ||||
|             strm << "\\x" << std::hex << (unsigned)ch << std::dec;  | ||||
|         } | ||||
|         else { | ||||
|             strm << (char)(ch); | ||||
|         } | ||||
|  |  | |||
|  | @ -502,7 +502,7 @@ public: | |||
|             ctx.set_random_seed(to_unsigned(val)); | ||||
|         } | ||||
|         else if (m_option == m_reproducible_resource_limit) { | ||||
|             ctx.params().m_rlimit = to_unsigned(val); | ||||
|             ctx.params().set_rlimit(to_unsigned(val)); | ||||
|         } | ||||
|         else if (m_option == m_verbosity) { | ||||
|             set_verbosity_level(to_unsigned(val)); | ||||
|  |  | |||
|  | @ -720,8 +720,8 @@ void cmd_context::init_manager_core(bool new_manager) { | |||
|     } | ||||
|     m_dt_eh = alloc(dt_eh, *this); | ||||
|     m_pmanager->set_new_datatype_eh(m_dt_eh.get()); | ||||
|     if (!has_logic()) { | ||||
|         TRACE("cmd_context", tout << "init manager\n";); | ||||
|     if (!has_logic() && new_manager) { | ||||
|         TRACE("cmd_context", tout << "init manager " << m_logic << "\n";); | ||||
|         // add list type only if the logic is not specified.
 | ||||
|         // it prevents clashes with builtin types.
 | ||||
|         insert(pm().mk_plist_decl()); | ||||
|  | @ -759,6 +759,7 @@ void cmd_context::init_external_manager() { | |||
| } | ||||
| 
 | ||||
| bool cmd_context::set_logic(symbol const & s) { | ||||
|     TRACE("cmd_context", tout << s << "\n";); | ||||
|     if (has_logic()) | ||||
|         throw cmd_exception("the logic has already been set"); | ||||
|     if (has_manager() && m_main_ctx) | ||||
|  | @ -1259,7 +1260,7 @@ void cmd_context::insert_aux_pdecl(pdecl * p) { | |||
|     m_aux_pdecls.push_back(p); | ||||
| } | ||||
| 
 | ||||
| void cmd_context::reset(bool finalize) { | ||||
| void cmd_context::reset(bool finalize) {     | ||||
|     m_processing_pareto = false; | ||||
|     m_logic = symbol::null; | ||||
|     m_check_sat_result = nullptr; | ||||
|  | @ -1346,7 +1347,8 @@ void cmd_context::push() { | |||
|     s.m_macros_stack_lim       = m_macros_stack.size(); | ||||
|     s.m_aux_pdecls_lim         = m_aux_pdecls.size(); | ||||
|     s.m_assertions_lim         = m_assertions.size(); | ||||
|     if (m_solver) | ||||
|     m().limit().push(m_params.rlimit()); | ||||
|     if (m_solver)  | ||||
|         m_solver->push(); | ||||
|     if (m_opt) | ||||
|         m_opt->push(); | ||||
|  | @ -1369,9 +1371,10 @@ void cmd_context::restore_func_decls(unsigned old_sz) { | |||
| } | ||||
| 
 | ||||
| void cmd_context::restore_psort_inst(unsigned old_sz) { | ||||
|     for (unsigned i = old_sz; i < m_psort_inst_stack.size(); ++i) { | ||||
|     for (unsigned i = m_psort_inst_stack.size(); i-- > old_sz; ) { | ||||
|         pdecl * s = m_psort_inst_stack[i]; | ||||
|         s->reset_cache(*m_pmanager); | ||||
|         s->reset_cache(pm()); | ||||
|         pm().dec_ref(s); | ||||
|     } | ||||
|     m_psort_inst_stack.resize(old_sz); | ||||
| } | ||||
|  | @ -1461,6 +1464,9 @@ void cmd_context::pop(unsigned n) { | |||
|     restore_assertions(s.m_assertions_lim); | ||||
|     restore_psort_inst(s.m_psort_inst_stack_lim); | ||||
|     m_scopes.shrink(new_lvl); | ||||
|     while (n--) { | ||||
|         m().limit().pop(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  | @ -1471,7 +1477,7 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions | |||
|     TRACE("before_check_sat", dump_assertions(tout);); | ||||
|     init_manager(); | ||||
|     unsigned timeout = m_params.m_timeout; | ||||
|     unsigned rlimit  = m_params.m_rlimit; | ||||
|     unsigned rlimit  = m_params.rlimit(); | ||||
|     scoped_watch sw(*this); | ||||
|     lbool r; | ||||
|     bool was_opt = false; | ||||
|  | @ -1546,7 +1552,7 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions | |||
| 
 | ||||
| void cmd_context::get_consequences(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector & conseq) { | ||||
|     unsigned timeout = m_params.m_timeout; | ||||
|     unsigned rlimit  = m_params.m_rlimit; | ||||
|     unsigned rlimit  = m_params.rlimit(); | ||||
|     lbool r; | ||||
|     m_check_sat_result = m_solver.get(); // solver itself stores the result.
 | ||||
|     m_solver->set_progress_callback(this); | ||||
|  | @ -2039,8 +2045,8 @@ void cmd_context::dt_eh::operator()(sort * dt, pdecl* pd) { | |||
|         } | ||||
|     } | ||||
|     if (m_owner.m_scopes.size() > 0) { | ||||
|         m_owner.pm().inc_ref(pd); | ||||
|         m_owner.m_psort_inst_stack.push_back(pd); | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -135,7 +135,7 @@ void context_params::set(char const * param, char const * value) { | |||
| } | ||||
| 
 | ||||
| void context_params::updt_params() { | ||||
|     updt_params(gparams::get()); | ||||
|     updt_params(gparams::get_ref()); | ||||
| } | ||||
| 
 | ||||
| void context_params::updt_params(params_ref const & p) { | ||||
|  |  | |||
|  | @ -27,6 +27,8 @@ class context_params { | |||
|     void set_bool(bool & opt, char const * param, char const * value); | ||||
|     void set_uint(unsigned & opt, char const * param, char const * value); | ||||
| 
 | ||||
|     unsigned    m_rlimit; | ||||
| 
 | ||||
| public: | ||||
|     bool        m_auto_config; | ||||
|     bool        m_proof; | ||||
|  | @ -42,10 +44,11 @@ public: | |||
|     bool        m_unsat_core; | ||||
|     bool        m_smtlib2_compliant; // it must be here because it enable/disable the use of coercions in the ast_manager.
 | ||||
|     unsigned    m_timeout; | ||||
|     unsigned    m_rlimit; | ||||
| 
 | ||||
|     unsigned rlimit() const { return m_rlimit; } | ||||
|     context_params(); | ||||
|     void set(char const * param, char const * value); | ||||
|     void set_rlimit(unsigned lim) { m_rlimit = lim; } | ||||
|     void updt_params(); | ||||
|     void updt_params(params_ref const & p); | ||||
|     static void collect_param_descrs(param_descrs & d); | ||||
|  |  | |||
|  | @ -271,7 +271,7 @@ UNARY_CMD(elim_unused_vars_cmd, "dbg-elim-unused-vars", "<expr>", "eliminate unu | |||
|         return; | ||||
|     } | ||||
|     expr_ref r(ctx.m()); | ||||
|     elim_unused_vars(ctx.m(), to_quantifier(arg), gparams::get(), r); | ||||
|     elim_unused_vars(ctx.m(), to_quantifier(arg), gparams::get_ref(), r); | ||||
|     SASSERT(!is_quantifier(r) || !to_quantifier(r)->may_have_unused_vars()); | ||||
|     ctx.display(ctx.regular_stream(), r); | ||||
|     ctx.regular_stream() << std::endl; | ||||
|  |  | |||
|  | @ -207,7 +207,7 @@ public: | |||
|         tref->set_logic(ctx.get_logic()); | ||||
|         ast_manager & m = ctx.m(); | ||||
|         unsigned timeout   = p.get_uint("timeout", ctx.params().m_timeout); | ||||
|         unsigned rlimit  =   p.get_uint("rlimit", ctx.params().m_rlimit); | ||||
|         unsigned rlimit  =   p.get_uint("rlimit", ctx.params().rlimit()); | ||||
|         labels_vec labels; | ||||
|         goal_ref g = alloc(goal, m, ctx.produce_proofs(), ctx.produce_models(), ctx.produce_unsat_cores()); | ||||
|         assert_exprs_from(ctx, *g); | ||||
|  | @ -323,7 +323,7 @@ public: | |||
|             assert_exprs_from(ctx, *g); | ||||
| 
 | ||||
|             unsigned timeout   = p.get_uint("timeout", ctx.params().m_timeout); | ||||
|             unsigned rlimit  =   p.get_uint("rlimit", ctx.params().m_rlimit); | ||||
|             unsigned rlimit  =   p.get_uint("rlimit", ctx.params().rlimit()); | ||||
| 
 | ||||
|             goal_ref_buffer     result_goals; | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ Revision History: | |||
| 
 | ||||
|     Hilbert basis can be templatized  | ||||
|     based on traits that define numeral: | ||||
|     as rational, mpz, checked_int64  | ||||
|     as rational, mpz, checked_int64 | ||||
|     (checked or unchecked). | ||||
| 
 | ||||
| --*/ | ||||
|  |  | |||
|  | @ -5479,7 +5479,7 @@ namespace polynomial { | |||
|             } | ||||
|             p_prime = derivative(p, x); | ||||
|             resultant(p, p_prime, x, r); | ||||
|             bool sign = (static_cast<uint64>(m) * static_cast<uint64>(m-1))%4 != 0; | ||||
|             bool sign = (static_cast<uint64_t>(m) * static_cast<uint64_t>(m-1))%4 != 0; | ||||
|             TRACE("resultant", tout << "discriminant sign: " << sign << "\n";); | ||||
|             scoped_numeral lc(m_manager); | ||||
|             if (const_coeff(p, x, m, lc)) { | ||||
|  | @ -6963,7 +6963,7 @@ namespace polynomial { | |||
|         return m_imp->m().set_zp(p); | ||||
|     } | ||||
| 
 | ||||
|     void manager::set_zp(uint64 p) { | ||||
|     void manager::set_zp(uint64_t p) { | ||||
|         return m_imp->m().set_zp(p); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -218,7 +218,7 @@ namespace polynomial { | |||
|            \brief Set manager as Z_p[X1, ..., Xn] | ||||
|         */ | ||||
|         void set_zp(numeral const & p); | ||||
|         void set_zp(uint64 p); | ||||
|         void set_zp(uint64_t p); | ||||
| 
 | ||||
|         /**
 | ||||
|            \brief Abstract event handler. | ||||
|  | @ -1043,7 +1043,7 @@ namespace polynomial { | |||
|         scoped_numeral m_p; | ||||
|     public: | ||||
|         scoped_set_zp(manager & _m, numeral const & p):m(_m), m_modular(m.modular()), m_p(m.m()) {  m_p = m.p(); m.set_zp(p); } | ||||
|         scoped_set_zp(manager & _m, uint64 p):m(_m), m_modular(m.modular()), m_p(m.m()) {  m_p = m.p(); m.set_zp(p); } | ||||
|         scoped_set_zp(manager & _m, uint64_t p):m(_m), m_modular(m.modular()), m_p(m.m()) {  m_p = m.p(); m.set_zp(p); } | ||||
|         ~scoped_set_zp() {  if (m_modular) m.set_zp(m_p); else m.set_z(); } | ||||
|     }; | ||||
| }; | ||||
|  |  | |||
|  | @ -153,7 +153,7 @@ namespace upolynomial { | |||
|            \brief Set manager as Z_p[X] | ||||
|         */ | ||||
|         void set_zp(numeral const & p) { m().set_zp(p); } | ||||
|         void set_zp(uint64 p) { m().set_zp(p); } | ||||
|         void set_zp(uint64_t p) { m().set_zp(p); } | ||||
| 
 | ||||
|         void checkpoint(); | ||||
| 
 | ||||
|  | @ -486,7 +486,7 @@ namespace upolynomial { | |||
|         core_manager::scoped_numeral m_p; | ||||
|     public: | ||||
|         scoped_set_zp(core_manager & _m, numeral const & p):m(_m), m_modular(m.modular()), m_p(m.m()) {  m_p = m.p(); m.set_zp(p); } | ||||
|         scoped_set_zp(core_manager & _m, uint64 p):m(_m), m_modular(m.modular()), m_p(m.m()) {  m_p = m.p(); m.set_zp(p); } | ||||
|         scoped_set_zp(core_manager & _m, uint64_t p):m(_m), m_modular(m.modular()), m_p(m.m()) {  m_p = m.p(); m.set_zp(p); } | ||||
|         ~scoped_set_zp() {  if (m_modular) m.set_zp(m_p); else m.set_z(); } | ||||
|     }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -38,9 +38,9 @@ unsigned get_p_from_manager(zp_numeral_manager const & zp_nm) { | |||
|     if (!nm.is_uint64(p)) { | ||||
|         throw upolynomial_exception("The prime number attempted in factorization is too big!"); | ||||
|     } | ||||
|     uint64 p_uint64 = nm.get_uint64(p); | ||||
|     uint64_t p_uint64 = nm.get_uint64(p); | ||||
|     unsigned p_uint = static_cast<unsigned>(p_uint64); | ||||
|     if (((uint64)p_uint) != p_uint64) { | ||||
|     if (((uint64_t)p_uint) != p_uint64) { | ||||
|         throw upolynomial_exception("The prime number attempted in factorization is too big!"); | ||||
|     } | ||||
|     return p_uint; | ||||
|  | @ -1075,7 +1075,7 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, | |||
|     while (trials < params.m_p_trials) { | ||||
|         upm.checkpoint(); | ||||
|         // construct prime to check 
 | ||||
|         uint64 next_prime = prime_it.next(); | ||||
|         uint64_t next_prime = prime_it.next(); | ||||
|         if (next_prime > params.m_max_p) { | ||||
|             fs.push_back(f_pp, k); | ||||
|             return false; | ||||
|  |  | |||
|  | @ -150,12 +150,12 @@ namespace subpaving { | |||
|         void int2hwf(mpz const & a, hwf & o) { | ||||
|             if (!m_qm.is_int64(a)) | ||||
|                 throw subpaving::exception(); | ||||
|             int64 val   = m_qm.get_int64(a); | ||||
|             int64_t val   = m_qm.get_int64(a); | ||||
|             double dval = static_cast<double>(val); | ||||
|             m_ctx.nm().set(o, dval); | ||||
|             double _dval = m_ctx.nm().m().to_double(o); | ||||
|             // TODO check the following test
 | ||||
|             if (static_cast<int64>(_dval) != val) | ||||
|             if (static_cast<int64_t>(_dval) != val) | ||||
|                 throw subpaving::exception(); | ||||
|         } | ||||
|          | ||||
|  |  | |||
|  | @ -73,17 +73,17 @@ public: | |||
|             // TODO: add SIN, COS, TAN, ...
 | ||||
|         }; | ||||
|     protected: | ||||
|         kind   m_kind; | ||||
|         uint64 m_timestamp; | ||||
|         kind     m_kind; | ||||
|         uint64_t m_timestamp; | ||||
|     public: | ||||
|         constraint(kind k):m_kind(k), m_timestamp(0) {} | ||||
|          | ||||
|         kind get_kind() const { return m_kind; } | ||||
|          | ||||
|         // Return the timestamp of the last propagation visit
 | ||||
|         uint64 timestamp() const { return m_timestamp; } | ||||
|         uint64_t timestamp() const { return m_timestamp; } | ||||
|         // Reset propagation visit time
 | ||||
|         void set_visited(uint64 ts) { m_timestamp = ts; } | ||||
|         void set_visited(uint64_t ts) { m_timestamp = ts; } | ||||
|     }; | ||||
| 
 | ||||
|     /**
 | ||||
|  | @ -149,17 +149,17 @@ public: | |||
|         unsigned      m_lower:1; | ||||
|         unsigned      m_open:1; | ||||
|         unsigned      m_mark:1; | ||||
|         uint64        m_timestamp; | ||||
|         uint64_t      m_timestamp; | ||||
|         bound *       m_prev; | ||||
|         justification m_jst; | ||||
|         void set_timestamp(uint64 ts) { m_timestamp = ts; } | ||||
|         void set_timestamp(uint64_t ts) { m_timestamp = ts; } | ||||
|     public: | ||||
|         var x() const { return static_cast<var>(m_x); } | ||||
|         numeral const & value() const { return m_val; } | ||||
|         numeral & value() { return m_val; } | ||||
|         bool is_lower() const { return m_lower; } | ||||
|         bool is_open() const { return m_open; } | ||||
|         uint64 timestamp() const { return m_timestamp; } | ||||
|         uint64_t timestamp() const { return m_timestamp; } | ||||
|         bound * prev() const { return m_prev; } | ||||
|         justification jst() const { return m_jst; } | ||||
|         void display(std::ostream & out, numeral_manager & nm, display_var_proc const & proc = display_var_proc()); | ||||
|  | @ -486,7 +486,7 @@ private: | |||
|      | ||||
|     id_gen                    m_node_id_gen; | ||||
| 
 | ||||
|     uint64                    m_timestamp; | ||||
|     uint64_t                  m_timestamp; | ||||
|     node *                    m_root; | ||||
|     // m_leaf_head is the head of a doubly linked list of leaf nodes to be processed.
 | ||||
|     node *                    m_leaf_head;  | ||||
|  |  | |||
|  | @ -454,6 +454,7 @@ struct evaluator_cfg : public default_rewriter_cfg { | |||
| 
 | ||||
|         func_decl* f = m_ar.get_as_array_func_decl(to_app(a)); | ||||
|         func_interp* g = m_model.get_func_interp(f); | ||||
| 		if (!g) return false; | ||||
|         unsigned sz = g->num_entries(); | ||||
|         unsigned arity = f->get_arity(); | ||||
|         unsigned base_sz = stores.size(); | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ namespace datalog { | |||
|     protected: | ||||
|         sort_ref m_sort; | ||||
|         bool m_limited_size; | ||||
|         uint64 m_size; | ||||
|         uint64_t m_size; | ||||
| 
 | ||||
|         sort_domain(sort_kind k, context & ctx, sort * s) | ||||
|             : m_kind(k), m_sort(s, ctx.get_manager()) { | ||||
|  | @ -103,15 +103,15 @@ namespace datalog { | |||
|     }; | ||||
| 
 | ||||
|     class context::uint64_sort_domain : public sort_domain { | ||||
|         typedef map<uint64,       finite_element,   uint64_hash, default_eq<uint64> > el2num; | ||||
|         typedef svector<uint64> num2el; | ||||
|         typedef map<uint64_t,     finite_element,   uint64_hash, default_eq<uint64_t> > el2num; | ||||
|         typedef svector<uint64_t> num2el; | ||||
| 
 | ||||
|         el2num m_el_numbers; | ||||
|         num2el m_el_names; | ||||
|     public: | ||||
|         uint64_sort_domain(context & ctx, sort * s) : sort_domain(SK_UINT64, ctx, s) {} | ||||
| 
 | ||||
|         finite_element get_number(uint64 el) { | ||||
|         finite_element get_number(uint64_t el) { | ||||
|             //we number symbols starting from zero, so table->size() is equal to the
 | ||||
|             //index of the symbol to be added next
 | ||||
| 
 | ||||
|  | @ -368,14 +368,14 @@ namespace datalog { | |||
|         return dom.get_number(sym); | ||||
|     } | ||||
| 
 | ||||
|     context::finite_element context::get_constant_number(relation_sort srt, uint64 el) { | ||||
|     context::finite_element context::get_constant_number(relation_sort srt, uint64_t el) { | ||||
|         sort_domain & dom0 = get_sort_domain(srt); | ||||
|         SASSERT(dom0.get_kind()==SK_UINT64); | ||||
|         uint64_sort_domain & dom = static_cast<uint64_sort_domain &>(dom0); | ||||
|         return dom.get_number(el); | ||||
|     } | ||||
| 
 | ||||
|     void context::print_constant_name(relation_sort srt, uint64 num, std::ostream & out) | ||||
|     void context::print_constant_name(relation_sort srt, uint64_t num, std::ostream & out) | ||||
|     { | ||||
|         if (has_sort_domain(srt)) { | ||||
|             SASSERT(num<=UINT_MAX); | ||||
|  | @ -386,7 +386,7 @@ namespace datalog { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     bool context::try_get_sort_constant_count(relation_sort srt, uint64 & constant_count) { | ||||
|     bool context::try_get_sort_constant_count(relation_sort srt, uint64_t & constant_count) { | ||||
|         if (!has_sort_domain(srt)) { | ||||
|             return false; | ||||
|         } | ||||
|  | @ -394,18 +394,18 @@ namespace datalog { | |||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     uint64 context::get_sort_size_estimate(relation_sort srt) { | ||||
|     uint64_t context::get_sort_size_estimate(relation_sort srt) { | ||||
|         if (get_decl_util().is_rule_sort(srt)) { | ||||
|             return 1; | ||||
|         } | ||||
|         uint64 res; | ||||
|         uint64_t res; | ||||
|         if (!try_get_sort_constant_count(srt, res)) { | ||||
|             const sort_size & sz = srt->get_num_elements(); | ||||
|             if (sz.is_finite()) { | ||||
|                 res = sz.size(); | ||||
|             } | ||||
|             else { | ||||
|                 res = std::numeric_limits<uint64>::max(); | ||||
|                 res = std::numeric_limits<uint64_t>::max(); | ||||
|             } | ||||
|         } | ||||
|         return res; | ||||
|  |  | |||
|  | @ -61,7 +61,7 @@ namespace datalog { | |||
|     class relation_manager; | ||||
| 
 | ||||
|     typedef sort * relation_sort; | ||||
|     typedef uint64 table_element; | ||||
|     typedef uint64_t table_element; | ||||
|     typedef svector<table_element> table_fact; | ||||
| 
 | ||||
|     typedef app * relation_element; | ||||
|  | @ -351,16 +351,16 @@ namespace datalog { | |||
|         /**
 | ||||
|            \brief Return number of a symbol in a DK_UINT64 kind sort (\see register_sort() ) | ||||
|          */ | ||||
|         finite_element get_constant_number(relation_sort srt, uint64 el); | ||||
|         finite_element get_constant_number(relation_sort srt, uint64_t el); | ||||
| 
 | ||||
|         /**
 | ||||
|            \brief Output name of constant with number \c num in sort \c sort. | ||||
|         */ | ||||
|         void print_constant_name(relation_sort sort, uint64 num, std::ostream & out); | ||||
|         void print_constant_name(relation_sort sort, uint64_t num, std::ostream & out); | ||||
| 
 | ||||
|         bool try_get_sort_constant_count(relation_sort srt, uint64 & constant_count); | ||||
|         bool try_get_sort_constant_count(relation_sort srt, uint64_t & constant_count); | ||||
| 
 | ||||
|         uint64 get_sort_size_estimate(relation_sort srt); | ||||
|         uint64_t get_sort_size_estimate(relation_sort srt); | ||||
| 
 | ||||
|         /**
 | ||||
|            \brief Assign names of variables used in the declaration of a predicate. | ||||
|  |  | |||
|  | @ -141,7 +141,7 @@ namespace datalog { | |||
|     } | ||||
| 
 | ||||
|     void cost_recorder::start(accounted_object * obj) { | ||||
|         uint64 curr_time = static_cast<uint64>(m_stopwatch->get_current_seconds()*1000); | ||||
|         uint64_t curr_time = static_cast<uint64_t>(m_stopwatch->get_current_seconds()*1000); | ||||
|         if(m_obj) { | ||||
|             costs::time_type time_delta = static_cast<costs::time_type>(curr_time-m_last_time); | ||||
|             costs & c = m_obj->get_current_costs(); | ||||
|  |  | |||
|  | @ -95,7 +95,7 @@ namespace datalog { | |||
|         stopwatch * m_stopwatch; | ||||
| 
 | ||||
|         bool m_running; | ||||
|         uint64 m_last_time; | ||||
|         uint64_t m_last_time; | ||||
|     public: | ||||
|         cost_recorder(); | ||||
|         ~cost_recorder(); | ||||
|  |  | |||
|  | @ -31,6 +31,10 @@ Revision History: | |||
| #include "muz/base/dl_rule.h" | ||||
| #include "muz/base/dl_util.h" | ||||
| #include "util/stopwatch.h" | ||||
| #ifndef __STDC_FORMAT_MACROS | ||||
| #define __STDC_FORMAT_MACROS | ||||
| #endif | ||||
| #include <inttypes.h> | ||||
| 
 | ||||
| namespace datalog { | ||||
| 
 | ||||
|  | @ -165,7 +169,7 @@ namespace datalog { | |||
|             } | ||||
| 
 | ||||
|             expr * arg = f->get_arg(i); | ||||
|             uint64 sym_num; | ||||
|             uint64_t sym_num; | ||||
|             SASSERT(is_app(arg)); | ||||
|             VERIFY( ctx.get_decl_util().is_numeral_ext(to_app(arg), sym_num) ); | ||||
|             relation_sort sort = pred_decl->get_domain(i);             | ||||
|  | @ -626,11 +630,11 @@ namespace datalog { | |||
|         return name.substr(ofs, count); | ||||
|     } | ||||
| 
 | ||||
|     bool string_to_uint64(const char * s, uint64 & res) { | ||||
|     bool string_to_uint64(const char * s, uint64_t & res) { | ||||
| #if _WINDOWS | ||||
|         int converted = sscanf_s(s, "%I64u", &res); | ||||
|         int converted = sscanf_s(s, "%" SCNu64, &res); | ||||
| #else | ||||
|         int converted = sscanf(s, "%llu", &res); | ||||
|         int converted = sscanf(s, "%" SCNu64, &res); | ||||
| #endif | ||||
|         if(converted==0) { | ||||
|             return false; | ||||
|  | @ -639,9 +643,9 @@ namespace datalog { | |||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     bool read_uint64(const char * & s, uint64 & res) { | ||||
|         static const uint64 max_but_one_digit = ULLONG_MAX/10; | ||||
|         static const uint64 max_but_one_digit_safe = (ULLONG_MAX-9)/10; | ||||
|     bool read_uint64(const char * & s, uint64_t & res) { | ||||
|         static const uint64_t max_but_one_digit = ULLONG_MAX/10; | ||||
|         static const uint64_t max_but_one_digit_safe = (ULLONG_MAX-9)/10; | ||||
| 
 | ||||
|         if(*s<'0' || *s>'9') { | ||||
|             return false; | ||||
|  | @ -669,7 +673,7 @@ namespace datalog { | |||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     std::string to_string(uint64 num) { | ||||
|     std::string to_string(uint64_t num) { | ||||
|         std::stringstream stm; | ||||
|         stm<<num; | ||||
|         return stm.str(); | ||||
|  |  | |||
|  | @ -602,8 +602,8 @@ namespace datalog { | |||
|        \brief If it is possible to convert the beginning of \c s to uint64, | ||||
|        store the result of conversion and return true; otherwise return false. | ||||
|      */ | ||||
|     bool string_to_uint64(const char * s, uint64 & res); | ||||
|     std::string to_string(uint64 num); | ||||
|     bool string_to_uint64(const char * s, uint64_t & res); | ||||
|     std::string to_string(uint64_t num); | ||||
|     /**
 | ||||
|        \brief Read the sequence of decimal digits starting at \c s and interpret it as | ||||
|        uint64. If successful, \c res will contain the read number and \c s will point  | ||||
|  | @ -612,7 +612,7 @@ namespace datalog { | |||
|        overflows, \c points to the character which caused the overflow and false is  | ||||
|        returned. | ||||
|      */ | ||||
|     bool read_uint64(const char * & s, uint64 & res); | ||||
|     bool read_uint64(const char * & s, uint64_t & res); | ||||
| }; | ||||
| 
 | ||||
| #endif /* DL_UTIL_H_ */ | ||||
|  |  | |||
|  | @ -206,7 +206,7 @@ namespace datalog { | |||
|             return find(t); | ||||
|         } | ||||
| 
 | ||||
|         tbv* allocate(uint64 v, unsigned hi, unsigned lo) { | ||||
|         tbv* allocate(uint64_t v, unsigned hi, unsigned lo) { | ||||
|             return m_tbv.allocate(v, hi, lo); | ||||
|         } | ||||
| 
 | ||||
|  | @ -437,7 +437,7 @@ namespace datalog { | |||
|             } | ||||
|         } | ||||
|          | ||||
|         tbv* allocate(unsigned num_bits, uint64 v, unsigned hi, unsigned lo) { | ||||
|         tbv* allocate(unsigned num_bits, uint64_t v, unsigned hi, unsigned lo) { | ||||
|             return get(num_bits).allocate(v, hi, lo); | ||||
|         } | ||||
|         void insert(unsigned num_bits, tbv const& t) { | ||||
|  |  | |||
|  | @ -979,7 +979,7 @@ protected: | |||
|             if(!num.is_uint64()) { | ||||
|                 return unexpected(tok, "integer expected"); | ||||
|             } | ||||
|             uint64 int_num = num.get_uint64(); | ||||
|             uint64_t int_num = num.get_uint64(); | ||||
|              | ||||
|             app * numeral = mk_symbol_const(int_num, s); | ||||
|             args.push_back(numeral); | ||||
|  | @ -1072,7 +1072,7 @@ protected: | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     sort * register_finite_sort(symbol name, uint64 domain_size, context::sort_kind k) { | ||||
|     sort * register_finite_sort(symbol name, uint64_t domain_size, context::sort_kind k) { | ||||
|         if(m_sort_dict.contains(name.bare_str())) { | ||||
|             throw default_exception(default_exception::fmt(), "sort %s already declared", name.bare_str()); | ||||
|         } | ||||
|  | @ -1102,7 +1102,7 @@ protected: | |||
|     app* mk_const(symbol const& name, sort* s) { | ||||
|         app * res; | ||||
|         if(m_arith.is_int(s)) { | ||||
|             uint64 val; | ||||
|             uint64_t val; | ||||
|             if(!string_to_uint64(name.bare_str(), val)) { | ||||
|                 throw default_exception(default_exception::fmt(), "Invalid integer: \"%s\"", name.bare_str()); | ||||
|             } | ||||
|  | @ -1117,7 +1117,7 @@ protected: | |||
|     /**
 | ||||
|        \brief Make a constant for DK_SYMBOL sort out of an integer | ||||
|      */ | ||||
|     app* mk_symbol_const(uint64 el, sort* s) { | ||||
|     app* mk_symbol_const(uint64_t el, sort* s) { | ||||
|         app * res; | ||||
|         if(m_arith.is_int(s)) { | ||||
|             res = m_arith.mk_numeral(rational(el, rational::ui64()), s); | ||||
|  | @ -1128,7 +1128,7 @@ protected: | |||
|         } | ||||
|         return res; | ||||
|     } | ||||
|     app* mk_const(uint64 el, sort* s) { | ||||
|     app* mk_const(uint64_t el, sort* s) { | ||||
|         unsigned idx = m_context.get_constant_number(s, el); | ||||
|         app * res = m_decl_util.mk_numeral(idx, s); | ||||
|         return res; | ||||
|  | @ -1137,7 +1137,7 @@ protected: | |||
|     table_element mk_table_const(symbol const& name, sort* s) { | ||||
|         return m_context.get_constant_number(s, name); | ||||
|     } | ||||
|     table_element mk_table_const(uint64 el, sort* s) { | ||||
|     table_element mk_table_const(uint64_t el, sort* s) { | ||||
|         return m_context.get_constant_number(s, el); | ||||
|     } | ||||
| }; | ||||
|  | @ -1169,9 +1169,9 @@ protected: | |||
| // -----------------------------------
 | ||||
| 
 | ||||
| class wpa_parser_impl : public wpa_parser, dparser { | ||||
|     typedef svector<uint64> uint64_vector; | ||||
|     typedef hashtable<uint64, uint64_hash, default_eq<uint64> > uint64_set; | ||||
|     typedef map<uint64, symbol, uint64_hash, default_eq<uint64> > num2sym; | ||||
|     typedef svector<uint64_t> uint64_vector; | ||||
|     typedef hashtable<uint64_t, uint64_hash, default_eq<uint64_t> > uint64_set; | ||||
|     typedef map<uint64_t, symbol, uint64_hash, default_eq<uint64_t> > num2sym; | ||||
|     typedef map<symbol, uint64_set*, symbol_hash_proc, symbol_eq_proc> sym2nums; | ||||
| 
 | ||||
|     num2sym m_number_names; | ||||
|  | @ -1261,7 +1261,7 @@ private: | |||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     bool inp_num_to_element(sort * s, uint64 num, table_element & res) { | ||||
|     bool inp_num_to_element(sort * s, uint64_t num, table_element & res) { | ||||
|         if(s==m_bool_sort.get() || s==m_short_sort.get()) { | ||||
|             res = mk_table_const(num, s); | ||||
|             return true; | ||||
|  | @ -1332,7 +1332,7 @@ private: | |||
|             if(*ptr==0) { | ||||
|                 break; | ||||
|             } | ||||
|             uint64 num; | ||||
|             uint64_t num; | ||||
|             if(!read_uint64(ptr, num)) { | ||||
|                 throw default_exception(default_exception::fmt(), "number expected on line %d in file %s",  | ||||
|                     m_current_line, m_current_file.c_str()); | ||||
|  | @ -1389,7 +1389,7 @@ private: | |||
|             bool fact_fail = false; | ||||
|             fact.reset(); | ||||
|             for(unsigned i=0;i<pred_arity; i++) { | ||||
|                 uint64 const_num = args[i]; | ||||
|                 uint64_t const_num = args[i]; | ||||
|                 table_element c; | ||||
|                 if(!inp_num_to_element(arg_sorts[i], const_num, c)) { | ||||
|                     fact_fail = true; | ||||
|  | @ -1415,7 +1415,7 @@ private: | |||
|             symbol sort_name = sit->m_key; | ||||
|             uint64_set & sort_content = *sit->m_value; | ||||
|             //the +1 is for a zero element which happens to appear in the problem files
 | ||||
|             uint64 domain_size = sort_content.size()+1; | ||||
|             uint64_t domain_size = sort_content.size()+1; | ||||
|             // sort * s;
 | ||||
|             if(!m_use_map_names) { | ||||
|                 /* s = */ register_finite_sort(sort_name, domain_size, context::SK_UINT64); | ||||
|  | @ -1428,7 +1428,7 @@ private: | |||
|             uint64_set::iterator cit = sort_content.begin(); | ||||
|             uint64_set::iterator cend = sort_content.end(); | ||||
|             for(; cit!=cend; ++cit) { | ||||
|                 uint64 const_num = *cit; | ||||
|                 uint64_t const_num = *cit; | ||||
|                 inp_num_to_element(s, const_num); | ||||
|             } | ||||
|             */ | ||||
|  | @ -1443,7 +1443,7 @@ private: | |||
|         *ptr=0; | ||||
|     } | ||||
| 
 | ||||
|     bool parse_map_line(char * full_line, uint64 & num, symbol & name) { | ||||
|     bool parse_map_line(char * full_line, uint64_t & num, symbol & name) { | ||||
|         cut_off_comment(full_line); | ||||
|         if(full_line[0]==0) { | ||||
|             return false; | ||||
|  | @ -1515,7 +1515,7 @@ private: | |||
|             m_current_line++; | ||||
|             char * full_line = rdr.get_line(); | ||||
| 
 | ||||
|             uint64 num; | ||||
|             uint64_t num; | ||||
|             symbol el_name; | ||||
| 
 | ||||
|             if(!parse_map_line(full_line, num, el_name)) { | ||||
|  |  | |||
|  | @ -384,7 +384,7 @@ namespace datalog { | |||
| 
 | ||||
|         VERIFY(sig.first_functional() == 1); | ||||
| 
 | ||||
|         uint64 upper_bound = get_signature()[0]; | ||||
|         uint64_t upper_bound = get_signature()[0]; | ||||
|         bool empty_table = empty(); | ||||
| 
 | ||||
|         if (upper_bound > (1 << 18)) { | ||||
|  |  | |||
|  | @ -832,7 +832,7 @@ namespace datalog { | |||
|     class table_plugin; | ||||
|     class table_base; | ||||
| 
 | ||||
|     typedef uint64 table_sort; | ||||
|     typedef uint64_t table_sort; | ||||
|     typedef svector<table_sort> table_signature_base0; | ||||
|     typedef uint64_hash table_sort_hash; | ||||
| 
 | ||||
|  |  | |||
|  | @ -448,7 +448,7 @@ namespace datalog { | |||
|     } | ||||
| 
 | ||||
|     std::string relation_manager::to_nice_string(const relation_element & el) const { | ||||
|         uint64 val; | ||||
|         uint64_t val; | ||||
|         std::stringstream stm; | ||||
|         if(get_context().get_decl_util().is_numeral_ext(el, val)) { | ||||
|             stm << val; | ||||
|  | @ -461,7 +461,7 @@ namespace datalog { | |||
| 
 | ||||
|     std::string relation_manager::to_nice_string(const relation_sort & s, const relation_element & el) const { | ||||
|         std::stringstream stm; | ||||
|         uint64 val; | ||||
|         uint64_t val; | ||||
|         if(get_context().get_decl_util().is_numeral_ext(el, val)) { | ||||
|             get_context().print_constant_name(s, val, stm); | ||||
|         } | ||||
|  | @ -1339,9 +1339,9 @@ namespace datalog { | |||
|     class relation_manager::default_table_filter_not_equal_fn  | ||||
|             : public table_mutator_fn, auxiliary_table_filter_fn { | ||||
|         unsigned      m_column; | ||||
|         uint64        m_value; | ||||
|         uint64_t      m_value; | ||||
|     public: | ||||
|         default_table_filter_not_equal_fn(context & ctx, unsigned column, uint64 value) | ||||
|         default_table_filter_not_equal_fn(context & ctx, unsigned column, uint64_t value) | ||||
|             : m_column(column),  | ||||
|               m_value(value) { | ||||
|         } | ||||
|  | @ -1372,7 +1372,7 @@ namespace datalog { | |||
|                 return nullptr; | ||||
|             } | ||||
|             dl_decl_util decl_util(m); | ||||
|             uint64 value = 0; | ||||
|             uint64_t value = 0; | ||||
|             if (!decl_util.is_numeral_ext(y, value)) { | ||||
|                 return nullptr; | ||||
|             } | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ namespace datalog { | |||
|     //
 | ||||
|     // -----------------------------------
 | ||||
| 
 | ||||
|     unsigned get_domain_length(uint64 dom_size) { | ||||
|     unsigned get_domain_length(uint64_t dom_size) { | ||||
|         SASSERT(dom_size>0); | ||||
| 
 | ||||
|         unsigned length = 0; | ||||
|  | @ -128,7 +128,7 @@ namespace datalog { | |||
|         unsigned sig_sz = sig.size(); | ||||
|         unsigned first_functional = sig_sz-m_functional_col_cnt; | ||||
|         for (unsigned i=0; i<sig_sz; i++) { | ||||
|             uint64 dom_size = sig[i]; | ||||
|             uint64_t dom_size = sig[i]; | ||||
|             unsigned length = get_domain_length(dom_size); | ||||
|             SASSERT(length>0); | ||||
|             SASSERT(length<=64); | ||||
|  |  | |||
|  | @ -153,7 +153,7 @@ namespace datalog { | |||
|            variable. Otherwise \c m_reserve==NO_RESERVE. | ||||
| 
 | ||||
|            The size of m_data is actually 8 bytes larger than stated in m_data_size, so that we may  | ||||
|            deref an uint64 pointer at the end of the array. | ||||
|            deref an uint64_t pointer at the end of the array. | ||||
|         */ | ||||
|         storage m_data; | ||||
|         storage_indexer m_data_indexer; | ||||
|  | @ -290,10 +290,10 @@ namespace datalog { | |||
|         //the following two operations allow breaking of the object invariant!
 | ||||
|         void resize_data(size_t sz) { | ||||
|             m_data_size = sz; | ||||
|             if (sz + sizeof(uint64) < sz) { | ||||
|             if (sz + sizeof(uint64_t) < sz) { | ||||
|                 throw default_exception("overflow resizing data section for sparse table"); | ||||
|             } | ||||
|             m_data.resize(sz + sizeof(uint64)); | ||||
|             m_data.resize(sz + sizeof(uint64_t)); | ||||
|         } | ||||
| 
 | ||||
|         bool insert_offset(store_offset ofs) { | ||||
|  | @ -321,8 +321,8 @@ namespace datalog { | |||
|         class column_info { | ||||
|             unsigned m_big_offset; | ||||
|             unsigned m_small_offset; | ||||
|             uint64 m_mask; | ||||
|             uint64 m_write_mask; | ||||
|             uint64_t m_mask; | ||||
|             uint64_t m_write_mask; | ||||
|         public: | ||||
|             unsigned m_offset; //!< in bits
 | ||||
|             unsigned m_length; //!< in bits
 | ||||
|  | @ -330,7 +330,7 @@ namespace datalog { | |||
|             column_info(unsigned offset, unsigned length) \ | ||||
|                     : m_big_offset(offset/8),  | ||||
|                     m_small_offset(offset%8), | ||||
|                     m_mask( length==64 ? ULLONG_MAX : (static_cast<uint64>(1)<<length)-1 ), | ||||
|                     m_mask( length==64 ? ULLONG_MAX : (static_cast<uint64_t>(1)<<length)-1 ), | ||||
|                     m_write_mask( ~(m_mask<<m_small_offset) ), | ||||
|                     m_offset(offset),  | ||||
|                     m_length(length) { | ||||
|  | @ -338,15 +338,15 @@ namespace datalog { | |||
|                 SASSERT(length+m_small_offset<=64); | ||||
|             } | ||||
|             table_element get(const char * rec) const { | ||||
|                 const uint64 * ptr = reinterpret_cast<const uint64*>(rec+m_big_offset); | ||||
|                 uint64 res = *ptr; | ||||
|                 const uint64_t * ptr = reinterpret_cast<const uint64_t*>(rec+m_big_offset); | ||||
|                 uint64_t res = *ptr; | ||||
|                 res>>=m_small_offset; | ||||
|                 res&=m_mask; | ||||
|                 return res; | ||||
|             } | ||||
|             void set(char * rec, table_element val) const { | ||||
|                 SASSERT( (val&~m_mask)==0 ); //the value fits into the column
 | ||||
|                 uint64 * ptr = reinterpret_cast<uint64*>(rec+m_big_offset); | ||||
|                 uint64_t * ptr = reinterpret_cast<uint64_t*>(rec+m_big_offset); | ||||
|                 *ptr&=m_write_mask; | ||||
|                 *ptr|=val<<m_small_offset; | ||||
|             } | ||||
|  |  | |||
|  | @ -62,13 +62,13 @@ doc* doc_manager::allocate(tbv* t) { | |||
| doc* doc_manager::allocate(tbv const& src) { | ||||
|     return allocate(m.allocate(src)); | ||||
| } | ||||
| doc* doc_manager::allocate(uint64 n) { | ||||
| doc* doc_manager::allocate(uint64_t n) { | ||||
|     return allocate(m.allocate(n)); | ||||
| } | ||||
| doc* doc_manager::allocate(rational const& r) { | ||||
|     return allocate(m.allocate(r)); | ||||
| } | ||||
| doc* doc_manager::allocate(uint64 n, unsigned hi, unsigned lo) { | ||||
| doc* doc_manager::allocate(uint64_t n, unsigned hi, unsigned lo) { | ||||
|     return allocate(m.allocate(n, hi, lo)); | ||||
| } | ||||
| doc* doc_manager::allocate(doc const& src, unsigned const* permutation) { | ||||
|  |  | |||
|  | @ -61,9 +61,9 @@ public: | |||
|     doc* allocate(doc const& src); | ||||
|     doc* allocate(tbv const& src); | ||||
|     doc* allocate(tbv * src); | ||||
|     doc* allocate(uint64 n); | ||||
|     doc* allocate(uint64_t n); | ||||
|     doc* allocate(rational const& r); | ||||
|     doc* allocate(uint64 n, unsigned hi, unsigned lo); | ||||
|     doc* allocate(uint64_t n, unsigned hi, unsigned lo); | ||||
|     doc* allocate(doc const& src, unsigned const* permutation); | ||||
|     void deallocate(doc* src);         | ||||
|     void copy(doc& dst, doc const& src); | ||||
|  |  | |||
|  | @ -215,7 +215,7 @@ namespace datalog { | |||
|                 SASSERT(remaining_time_limit>restart_time); | ||||
|                 remaining_time_limit -= restart_time; | ||||
|             } | ||||
|             uint64 new_restart_time = static_cast<uint64>(restart_time)*m_context.initial_restart_timeout(); | ||||
|             uint64_t new_restart_time = static_cast<uint64_t>(restart_time)*m_context.initial_restart_timeout(); | ||||
|             if (new_restart_time > UINT_MAX) { | ||||
|                 restart_time = UINT_MAX; | ||||
|             } | ||||
|  |  | |||
|  | @ -72,7 +72,7 @@ tbv* tbv_manager::allocate(tbv const& bv) { | |||
|     copy(*r, bv); | ||||
|     return r; | ||||
| } | ||||
| tbv* tbv_manager::allocate(uint64 val) { | ||||
| tbv* tbv_manager::allocate(uint64_t val) { | ||||
|     tbv* v = allocate0(); | ||||
|     for (unsigned bit = std::min(64u, num_tbits()); bit-- > 0;) { | ||||
|         if (val & (1ULL << bit)) {                         | ||||
|  | @ -84,7 +84,7 @@ tbv* tbv_manager::allocate(uint64 val) { | |||
|     return v; | ||||
| } | ||||
| 
 | ||||
| tbv* tbv_manager::allocate(uint64 val, unsigned hi, unsigned lo) { | ||||
| tbv* tbv_manager::allocate(uint64_t val, unsigned hi, unsigned lo) { | ||||
|     tbv* v = allocateX(); | ||||
|     SASSERT(64 >= num_tbits() && num_tbits() > hi && hi >= lo); | ||||
|     set(*v, val, hi, lo); | ||||
|  | @ -134,7 +134,7 @@ void tbv_manager::set(tbv& dst, unsigned index, tbit value) { | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| void tbv_manager::set(tbv& dst, uint64 val, unsigned hi, unsigned lo) { | ||||
| void tbv_manager::set(tbv& dst, uint64_t val, unsigned hi, unsigned lo) { | ||||
|     SASSERT(lo <= hi && hi < num_tbits()); | ||||
|     for (unsigned i = 0; i < hi - lo + 1; ++i) { | ||||
|         set(dst, lo + i, (val & (1ULL << i))?BIT_1:BIT_0); | ||||
|  |  | |||
|  | @ -51,9 +51,9 @@ public: | |||
|     tbv* allocate0(); | ||||
|     tbv* allocateX(); | ||||
|     tbv* allocate(tbv const& bv); | ||||
|     tbv* allocate(uint64 n); | ||||
|     tbv* allocate(uint64_t n); | ||||
|     tbv* allocate(rational const& r); | ||||
|     tbv* allocate(uint64 n, unsigned hi, unsigned lo); | ||||
|     tbv* allocate(uint64_t n, unsigned hi, unsigned lo); | ||||
|     tbv* allocate(tbv const& bv, unsigned const* permutation); | ||||
|     tbv* allocate(char const* bv); | ||||
| 
 | ||||
|  | @ -80,7 +80,7 @@ public: | |||
|     std::ostream& display(std::ostream& out, tbv const& b, unsigned hi, unsigned lo) const; | ||||
|     tbv* project(bit_vector const& to_delete, tbv const& src); | ||||
|     bool is_well_formed(tbv const& b) const; // - does not contain BIT_z;
 | ||||
|     void set(tbv& dst, uint64 n, unsigned hi, unsigned lo); | ||||
|     void set(tbv& dst, uint64_t n, unsigned hi, unsigned lo); | ||||
|     void set(tbv& dst, rational const& r, unsigned hi, unsigned lo); | ||||
|     void set(tbv& dst, tbv const& other, unsigned hi, unsigned lo); | ||||
|     void set(tbv& dst, unsigned index, tbit value); | ||||
|  |  | |||
|  | @ -261,7 +261,7 @@ namespace datalog { | |||
|             num_bits = 1; | ||||
|             return true; | ||||
|         } | ||||
|         uint64 n, sz; | ||||
|         uint64_t n, sz; | ||||
|         ast_manager& m = get_ast_manager(); | ||||
|         if (dl.is_numeral(e, n) && dl.try_get_size(m.get_sort(e), sz)) { | ||||
|             num_bits = 0; | ||||
|  | @ -277,7 +277,7 @@ namespace datalog { | |||
|             return bv.get_bv_size(s); | ||||
|         if (m.is_bool(s))  | ||||
|             return 1; | ||||
|         uint64 sz; | ||||
|         uint64_t sz; | ||||
|         if (dl.try_get_size(s, sz)) { | ||||
|             while (sz > 0) ++num_bits, sz /= 2; | ||||
|             return num_bits; | ||||
|  |  | |||
|  | @ -265,6 +265,9 @@ namespace opt { | |||
|         normalize(); | ||||
|         internalize(); | ||||
|         update_solver(); | ||||
|         if (contains_quantifiers()) { | ||||
|             warning_msg("optimization with quantified constraints is not supported"); | ||||
|         } | ||||
| #if 0 | ||||
|         if (is_qsat_opt()) { | ||||
|             return run_qsat_opt(); | ||||
|  | @ -372,7 +375,6 @@ namespace opt { | |||
|         if (result == l_true && committed) m_optsmt.commit_assignment(index); | ||||
|         if (result == l_true && m_optsmt.is_unbounded(index, is_max) && contains_quantifiers()) { | ||||
|             throw default_exception("unbounded objectives on quantified constraints is not supported"); | ||||
|             result = l_undef; | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
|  | @ -1525,7 +1527,7 @@ namespace opt { | |||
|     } | ||||
| 
 | ||||
|     void context::validate_model() { | ||||
|         if (!gparams::get().get_bool("model_validate", false)) return; | ||||
|         if (!gparams::get_ref().get_bool("model_validate", false)) return; | ||||
|         expr_ref_vector fmls(m); | ||||
|         get_hard_constraints(fmls); | ||||
|         expr_ref tmp(m); | ||||
|  |  | |||
|  | @ -316,13 +316,13 @@ namespace opt { | |||
|         struct is_propositional_fn; | ||||
|         bool is_propositional(expr* e); | ||||
| 
 | ||||
|         void    init_solver(); | ||||
|         void    update_solver(); | ||||
|         void    setup_arith_solver(); | ||||
|         void    add_maxsmt(symbol const& id, unsigned index); | ||||
|         void    set_simplify(tactic *simplify); | ||||
|         void    set_pareto(pareto_base* p);   | ||||
|         void    clear_state(); | ||||
|         void init_solver(); | ||||
|         void update_solver(); | ||||
|         void setup_arith_solver(); | ||||
|         void add_maxsmt(symbol const& id, unsigned index); | ||||
|         void set_simplify(tactic *simplify); | ||||
|         void set_pareto(pareto_base* p);         | ||||
|         void clear_state(); | ||||
| 
 | ||||
|         bool is_numeral(expr* e, rational& n) const; | ||||
| 
 | ||||
|  |  | |||
|  | @ -84,6 +84,9 @@ namespace opt { | |||
|                 if (m.canceled()) { | ||||
|                     is_sat = l_undef; | ||||
|                 } | ||||
|                 if (is_sat == l_undef) { | ||||
|                     break; | ||||
|                 } | ||||
|                 if (is_sat == l_false) { | ||||
|                     TRACE("opt", tout << "Unsat\n";); | ||||
|                     break; | ||||
|  | @ -97,9 +100,6 @@ namespace opt { | |||
|                     //DEBUG_CODE(verify_cores(cores););
 | ||||
|                     s().assert_expr(fml); | ||||
|                 } | ||||
|                 else { | ||||
|                     //DEBUG_CODE(verify_cores(cores););
 | ||||
|                 } | ||||
|                 update_cores(wth(), cores); | ||||
|                 wth().init_min_cost(m_upper - m_lower); | ||||
|                 trace_bounds("wmax"); | ||||
|  |  | |||
|  | @ -951,8 +951,9 @@ namespace smt2 { | |||
|             check_duplicate(d, line, pos); | ||||
| 
 | ||||
|             d->commit(pm()); | ||||
|             check_rparen_next("invalid end of datatype declaration, ')' expected"); | ||||
|             check_rparen("invalid end of datatype declaration, ')' expected"); | ||||
|             m_ctx.print_success(); | ||||
|             next(); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ struct pattern_validation_functor { | |||
| 
 | ||||
|     bool is_forbidden(func_decl const * decl) { | ||||
|         family_id fid = decl->get_family_id(); | ||||
|         if (fid == m_bfid && decl->get_decl_kind() != OP_TRUE && decl->get_decl_kind() != OP_FALSE) | ||||
|         if (fid == m_bfid && decl->get_decl_kind() != OP_EQ && decl->get_decl_kind() != OP_TRUE && decl->get_decl_kind() != OP_FALSE) | ||||
|             return true; | ||||
|         if (fid == m_lfid) | ||||
|             return true; | ||||
|  |  | |||
|  | @ -70,7 +70,7 @@ namespace qe { | |||
|                 return false; | ||||
|             } | ||||
|             eq_atoms& eqs = get_eqs(x.x(), fml); | ||||
|             uint64 domain_size; | ||||
|             uint64_t domain_size; | ||||
|             if (is_small_domain(x, eqs, domain_size)) { | ||||
|                 num_branches = rational(domain_size, rational::ui64()); | ||||
|             } | ||||
|  | @ -84,7 +84,7 @@ namespace qe { | |||
|             SASSERT(v.is_unsigned()); | ||||
|             eq_atoms& eqs = get_eqs(x.x(), fml);             | ||||
|             unsigned uv = v.get_unsigned(); | ||||
|             uint64 domain_size; | ||||
|             uint64_t domain_size; | ||||
|             if (is_small_domain(x, eqs, domain_size)) { | ||||
|                 SASSERT(v < rational(domain_size, rational::ui64())); | ||||
|                 assign_small_domain(x, eqs, uv); | ||||
|  | @ -98,7 +98,7 @@ namespace qe { | |||
|             SASSERT(v.is_unsigned()); | ||||
|             eq_atoms& eqs = get_eqs(x.x(), fml);            | ||||
|             unsigned uv = v.get_unsigned(); | ||||
|             uint64 domain_size; | ||||
|             uint64_t domain_size; | ||||
|             if (is_small_domain(x, eqs, domain_size)) { | ||||
|                 SASSERT(uv < domain_size); | ||||
|                 subst_small_domain(x, eqs, uv, fml); | ||||
|  | @ -115,7 +115,7 @@ namespace qe { | |||
| 
 | ||||
|     private: | ||||
| 
 | ||||
|         bool is_small_domain(contains_app& x, eq_atoms& eqs, uint64& domain_size) { | ||||
|         bool is_small_domain(contains_app& x, eq_atoms& eqs, uint64_t& domain_size) { | ||||
|             VERIFY(m_util.try_get_size(m.get_sort(x.x()), domain_size)); | ||||
|             return domain_size < eqs.num_eqs() + eqs.num_neqs(); | ||||
|         } | ||||
|  |  | |||
|  | @ -1020,14 +1020,14 @@ namespace sat { | |||
|         SASSERT(v != null_bool_var); | ||||
|         m_coeffs.reserve(v + 1, 0); | ||||
| 
 | ||||
|         int64 coeff0 = m_coeffs[v]; | ||||
|         int64_t coeff0 = m_coeffs[v]; | ||||
|         if (coeff0 == 0) { | ||||
|             m_active_vars.push_back(v); | ||||
|         } | ||||
|          | ||||
|         int64 loffset = static_cast<int64>(offset); | ||||
|         int64 inc = l.sign() ? -loffset : loffset; | ||||
|         int64 coeff1 = inc + coeff0; | ||||
|         int64_t loffset = static_cast<int64_t>(offset); | ||||
|         int64_t inc = l.sign() ? -loffset : loffset; | ||||
|         int64_t coeff1 = inc + coeff0; | ||||
|         m_coeffs[v] = coeff1; | ||||
|         if (coeff1 > INT_MAX || coeff1 < INT_MIN) { | ||||
|             m_overflow = true; | ||||
|  | @ -1040,7 +1040,7 @@ namespace sat { | |||
|         else if (coeff0 < 0 && inc > 0) { | ||||
|             inc_bound(coeff0 - std::min(0LL, coeff1)); | ||||
|         } | ||||
|         int64 lbound = static_cast<int64>(m_bound); | ||||
|         int64_t lbound = static_cast<int64_t>(m_bound); | ||||
| 
 | ||||
|         // reduce coefficient to be no larger than bound.
 | ||||
|         if (coeff1 > lbound) { | ||||
|  | @ -1051,12 +1051,12 @@ namespace sat { | |||
|         }         | ||||
|     } | ||||
| 
 | ||||
|     int64 ba_solver::get_coeff(bool_var v) const { | ||||
|     int64_t ba_solver::get_coeff(bool_var v) const { | ||||
|         return m_coeffs.get(v, 0); | ||||
|     } | ||||
| 
 | ||||
|     unsigned ba_solver::get_abs_coeff(bool_var v) const { | ||||
|         int64 c = get_coeff(v); | ||||
|         int64_t c = get_coeff(v); | ||||
|         if (c < INT_MIN+1 || c > UINT_MAX) { | ||||
|             m_overflow = true; | ||||
|             return UINT_MAX; | ||||
|  | @ -1065,7 +1065,7 @@ namespace sat { | |||
|     } | ||||
| 
 | ||||
|     int ba_solver::get_int_coeff(bool_var v) const { | ||||
|         int64 c = m_coeffs.get(v, 0); | ||||
|         int64_t c = m_coeffs.get(v, 0); | ||||
|         if (c < INT_MIN || c > INT_MAX) { | ||||
|             m_overflow = true; | ||||
|             return 0; | ||||
|  | @ -1073,12 +1073,12 @@ namespace sat { | |||
|         return static_cast<int>(c); | ||||
|     } | ||||
| 
 | ||||
|     void ba_solver::inc_bound(int64 i) { | ||||
|     void ba_solver::inc_bound(int64_t i) { | ||||
|         if (i < INT_MIN || i > INT_MAX) { | ||||
|             m_overflow = true; | ||||
|             return; | ||||
|         } | ||||
|         int64 new_bound = m_bound; | ||||
|         int64_t new_bound = m_bound; | ||||
|         new_bound += i; | ||||
|         if (new_bound < 0) { | ||||
|             m_overflow = true; | ||||
|  | @ -1196,7 +1196,7 @@ namespace sat { | |||
|                 switch (cnstr.tag()) { | ||||
|                 case card_t: { | ||||
|                     card& c = cnstr.to_card(); | ||||
|                     inc_bound(static_cast<int64>(offset) * c.k()); | ||||
|                     inc_bound(static_cast<int64_t>(offset) * c.k()); | ||||
|                     process_card(c, offset); | ||||
|                     break; | ||||
|                 } | ||||
|  | @ -1269,7 +1269,7 @@ namespace sat { | |||
|             js = s().m_justification[v]; | ||||
|             offset = get_abs_coeff(v); | ||||
|             if (offset > m_bound) { | ||||
|                 int64 bound64 = static_cast<int64>(m_bound); | ||||
|                 int64_t bound64 = static_cast<int64_t>(m_bound); | ||||
|                 m_coeffs[v] = (get_coeff(v) < 0) ? -bound64 : bound64; | ||||
|                 offset = m_bound; | ||||
|                 DEBUG_CODE(active2pb(m_A);); | ||||
|  | @ -1323,8 +1323,8 @@ namespace sat { | |||
|                 } | ||||
|                 IF_VERBOSE(0,  | ||||
|                            active2pb(m_A); | ||||
|                            uint64 c = 0; | ||||
|                            for (uint64 c1 : m_A.m_coeffs) c += c1; | ||||
|                            uint64_t c = 0; | ||||
|                            for (uint64_t c1 : m_A.m_coeffs) c += c1; | ||||
|                            verbose_stream() << "sum of coefficients: " << c << "\n"; | ||||
|                            display(verbose_stream(), m_A, true); | ||||
|                            verbose_stream() << "conflicting literal: " << s().m_not_l << "\n";); | ||||
|  | @ -1347,18 +1347,18 @@ namespace sat { | |||
|         bool adjusted = false; | ||||
| 
 | ||||
|     adjust_conflict_level: | ||||
|         int64 bound64 = m_bound; | ||||
|         int64 slack = -bound64; | ||||
|         int64_t bound64 = m_bound; | ||||
|         int64_t slack = -bound64; | ||||
|         for (bool_var v : m_active_vars) { | ||||
|             slack += get_abs_coeff(v); | ||||
|         } | ||||
|         m_lemma.reset();         | ||||
|         m_lemma.push_back(null_literal); | ||||
|         unsigned num_skipped = 0; | ||||
|         int64 asserting_coeff = 0; | ||||
|         int64_t asserting_coeff = 0; | ||||
|         for (unsigned i = 0; 0 <= slack && i < m_active_vars.size(); ++i) {  | ||||
|             bool_var v = m_active_vars[i]; | ||||
|             int64 coeff = get_coeff(v); | ||||
|             int64_t coeff = get_coeff(v); | ||||
|             lbool val = value(v); | ||||
|             bool is_true = val == l_true; | ||||
|             bool append = coeff != 0 && val != l_undef && (coeff < 0 == is_true); | ||||
|  | @ -1434,7 +1434,7 @@ namespace sat { | |||
|                 continue; | ||||
|             } | ||||
|             if (m_bound < coeff) { | ||||
|                 int64 bound64 = m_bound; | ||||
|                 int64_t bound64 = m_bound; | ||||
|                 if (get_coeff(v) > 0) { | ||||
|                     m_coeffs[v] = bound64; | ||||
|                 } | ||||
|  | @ -1474,7 +1474,7 @@ namespace sat { | |||
|             inc_coeff(c[i], offset);                         | ||||
|         } | ||||
|         if (lit != null_literal) { | ||||
|             uint64 offset1 = static_cast<uint64>(offset) * c.k(); | ||||
|             uint64_t offset1 = static_cast<uint64_t>(offset) * c.k(); | ||||
|             if (offset1 > UINT_MAX) { | ||||
|                 m_overflow = true; | ||||
|             } | ||||
|  | @ -3753,12 +3753,12 @@ namespace sat { | |||
|     } | ||||
| 
 | ||||
|     bool ba_solver::validate_lemma() {  | ||||
|         int64 bound64 = m_bound; | ||||
|         int64 val = -bound64; | ||||
|         int64_t bound64 = m_bound; | ||||
|         int64_t val = -bound64; | ||||
|         reset_active_var_set(); | ||||
|         for (bool_var v : m_active_vars) { | ||||
|             if (m_active_var_set.contains(v)) continue;             | ||||
|             int64 coeff = get_coeff(v); | ||||
|             int64_t coeff = get_coeff(v); | ||||
|             if (coeff == 0) continue; | ||||
|             m_active_var_set.insert(v); | ||||
|             literal lit(v, false); | ||||
|  | @ -3782,7 +3782,7 @@ namespace sat { | |||
|         p.reset(m_bound); | ||||
|         for (bool_var v : m_active_vars) { | ||||
|             if (m_active_var_set.contains(v)) continue;             | ||||
|             int64 coeff = get_coeff(v); | ||||
|             int64_t coeff = get_coeff(v); | ||||
|             if (coeff == 0) continue; | ||||
|             m_active_var_set.insert(v); | ||||
|             literal lit(v, coeff < 0); | ||||
|  | @ -3794,7 +3794,7 @@ namespace sat { | |||
|     ba_solver::constraint* ba_solver::active2constraint() { | ||||
|         reset_active_var_set(); | ||||
|         m_wlits.reset(); | ||||
|         uint64 sum = 0; | ||||
|         uint64_t sum = 0; | ||||
|         if (m_bound == 1) return 0; | ||||
|         if (m_overflow) return 0; | ||||
|          | ||||
|  | @ -3855,7 +3855,7 @@ namespace sat { | |||
|         } | ||||
|         std::sort(m_wlits.begin(), m_wlits.end(), compare_wlit()); | ||||
|         unsigned k = 0; | ||||
|         uint64 sum = 0, sum0 = 0; | ||||
|         uint64_t sum = 0, sum0 = 0; | ||||
|         for (wliteral wl : m_wlits) { | ||||
|             if (sum >= m_bound) break; | ||||
|             sum0 = sum; | ||||
|  | @ -3986,15 +3986,15 @@ namespace sat { | |||
| 
 | ||||
|     bool ba_solver::validate_resolvent() { | ||||
|         return true; | ||||
|         u_map<uint64> coeffs; | ||||
|         uint64 k = m_A.m_k + m_B.m_k; | ||||
|         u_map<uint64_t> coeffs; | ||||
|         uint64_t k = m_A.m_k + m_B.m_k; | ||||
|         for (unsigned i = 0; i < m_A.m_lits.size(); ++i) { | ||||
|             uint64 coeff = m_A.m_coeffs[i]; | ||||
|             uint64_t coeff = m_A.m_coeffs[i]; | ||||
|             SASSERT(!coeffs.contains(m_A.m_lits[i].index())); | ||||
|             coeffs.insert(m_A.m_lits[i].index(), coeff); | ||||
|         } | ||||
|         for (unsigned i = 0; i < m_B.m_lits.size(); ++i) { | ||||
|             uint64 coeff1 = m_B.m_coeffs[i], coeff2; | ||||
|             uint64_t coeff1 = m_B.m_coeffs[i], coeff2; | ||||
|             literal lit = m_B.m_lits[i]; | ||||
|             if (coeffs.find((~lit).index(), coeff2)) { | ||||
|                 if (coeff1 == coeff2) { | ||||
|  | @ -4022,7 +4022,7 @@ namespace sat { | |||
|         // C is above the sum of A and B
 | ||||
|         for (unsigned i = 0; i < m_C.m_lits.size(); ++i) { | ||||
|             literal lit = m_C.m_lits[i]; | ||||
|             uint64 coeff; | ||||
|             uint64_t coeff; | ||||
|             if (coeffs.find(lit.index(), coeff)) { | ||||
|                 if (coeff > m_C.m_coeffs[i] && m_C.m_coeffs[i] < m_C.m_k) { | ||||
|                     goto violated; | ||||
|  | @ -4103,7 +4103,7 @@ namespace sat { | |||
|       \brief encode the case where Sum(a) >= k-1 & Sum(b) >= 1 \/ ... \/ Sum(a) >= 1 & Sum(b) >= k-1 | ||||
|      */ | ||||
|     literal ba_solver::translate_to_sat(solver& s, u_map<bool_var>& translation, ineq& a, ineq& b) { | ||||
|         uint64 k0 = a.m_k; | ||||
|         uint64_t k0 = a.m_k; | ||||
|         literal_vector lits; | ||||
|         for (unsigned k = 1; k < a.m_k - 1; ++k) { | ||||
|             a.m_k = k; b.m_k = k0 - k; | ||||
|  | @ -4143,7 +4143,7 @@ namespace sat { | |||
| 
 | ||||
|     ba_solver::ineq ba_solver::negate(ineq const& a) const { | ||||
|         ineq result; | ||||
|         uint64 sum = 0; | ||||
|         uint64_t sum = 0; | ||||
|         for (unsigned i = 0; i < a.m_lits.size(); ++i) {  | ||||
|             result.push(~a.m_lits[i], a.m_coeffs[i]); | ||||
|             sum += a.m_coeffs[i]; | ||||
|  | @ -4170,9 +4170,9 @@ namespace sat { | |||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         uint64 value = 0;         | ||||
|         uint64_t value = 0;         | ||||
|         for (unsigned i = 0; i < p.m_lits.size(); ++i) { | ||||
|             uint64 coeff = p.m_coeffs[i]; | ||||
|             uint64_t coeff = p.m_coeffs[i]; | ||||
|             if (!lits.contains(p.m_lits[i])) { | ||||
|                 value += coeff; | ||||
|             } | ||||
|  |  | |||
|  | @ -204,12 +204,12 @@ namespace sat { | |||
|     protected: | ||||
| 
 | ||||
|         struct ineq { | ||||
|             literal_vector  m_lits; | ||||
|             svector<uint64> m_coeffs; | ||||
|             uint64        m_k; | ||||
|             literal_vector    m_lits; | ||||
|             svector<uint64_t> m_coeffs; | ||||
|             uint64_t          m_k; | ||||
|             ineq(): m_k(0) {} | ||||
|             void reset(uint64 k) { m_lits.reset(); m_coeffs.reset(); m_k = k; } | ||||
|             void push(literal l, uint64 c) { m_lits.push_back(l); m_coeffs.push_back(c); } | ||||
|             void reset(uint64_t k) { m_lits.reset(); m_coeffs.reset(); m_k = k; } | ||||
|             void push(literal l, uint64_t c) { m_lits.push_back(l); m_coeffs.push_back(c); } | ||||
|         }; | ||||
| 
 | ||||
|         solver*                m_solver; | ||||
|  | @ -229,7 +229,7 @@ namespace sat { | |||
|         // conflict resolution
 | ||||
|         unsigned          m_num_marks; | ||||
|         unsigned          m_conflict_lvl; | ||||
|         svector<int64>    m_coeffs; | ||||
|         svector<int64_t>  m_coeffs; | ||||
|         svector<bool_var> m_active_vars; | ||||
|         unsigned          m_bound; | ||||
|         tracked_uint_set  m_active_var_set; | ||||
|  | @ -426,11 +426,11 @@ namespace sat { | |||
|         void reset_active_var_set(); | ||||
|         void normalize_active_coeffs(); | ||||
|         void inc_coeff(literal l, unsigned offset); | ||||
|         int64 get_coeff(bool_var v) const; | ||||
|         int64_t get_coeff(bool_var v) const; | ||||
|         unsigned get_abs_coeff(bool_var v) const;        | ||||
|         int   get_int_coeff(bool_var v) const; | ||||
|         unsigned get_bound() const; | ||||
|         void inc_bound(int64 i); | ||||
|         void inc_bound(int64_t i); | ||||
| 
 | ||||
|         literal get_asserting_literal(literal conseq); | ||||
|         void process_antecedent(literal l, unsigned offset); | ||||
|  |  | |||
|  | @ -105,7 +105,7 @@ namespace sat { | |||
| 
 | ||||
| 
 | ||||
|     void asymm_branch::process(big* big, clause_vector& clauses) { | ||||
|         int64 limit = -m_asymm_branch_limit; | ||||
|         int64_t limit = -m_asymm_branch_limit; | ||||
|         std::stable_sort(clauses.begin(), clauses.end(), clause_size_lt()); | ||||
|         m_counter -= clauses.size(); | ||||
|         clause_vector::iterator it  = clauses.begin(); | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ namespace sat { | |||
|          | ||||
|         solver &   s; | ||||
|         params_ref m_params; | ||||
|         int64      m_counter; | ||||
|         int64_t    m_counter; | ||||
|         random_gen m_rand; | ||||
|         unsigned   m_calls; | ||||
|          | ||||
|  | @ -43,7 +43,7 @@ namespace sat { | |||
|         unsigned   m_asymm_branch_delay; | ||||
|         bool       m_asymm_branch_sampled; | ||||
|         bool       m_asymm_branch_all; | ||||
|         int64      m_asymm_branch_limit; | ||||
|         int64_t    m_asymm_branch_limit; | ||||
| 
 | ||||
|         // stats
 | ||||
|         unsigned   m_elim_literals; | ||||
|  |  | |||
|  | @ -47,7 +47,7 @@ namespace sat { | |||
| 
 | ||||
|     void lookahead::flip_prefix() { | ||||
|         if (m_trail_lim.size() < 64) { | ||||
|             uint64 mask = (1ull << m_trail_lim.size()); | ||||
|             uint64_t mask = (1ull << m_trail_lim.size()); | ||||
|             m_prefix = mask | (m_prefix & (mask - 1)); | ||||
|         } | ||||
|     } | ||||
|  | @ -909,7 +909,7 @@ namespace sat { | |||
| 
 | ||||
|     void lookahead::display_search_string() { | ||||
|         printf("\r");  | ||||
|         uint64 q = m_prefix; | ||||
|         uint64_t q = m_prefix; | ||||
|         unsigned depth = m_trail_lim.size(); | ||||
|         unsigned d = std::min(63u, depth); | ||||
|         unsigned new_prefix_length = d; | ||||
|  |  | |||
|  | @ -27,13 +27,13 @@ Notes: | |||
| namespace sat { | ||||
| 
 | ||||
|     struct pp_prefix { | ||||
|         uint64 m_prefix; | ||||
|         uint64_t m_prefix; | ||||
|         unsigned m_depth; | ||||
|         pp_prefix(uint64 p, unsigned d) : m_prefix(p), m_depth(d) {} | ||||
|         pp_prefix(uint64_t p, unsigned d) : m_prefix(p), m_depth(d) {} | ||||
|     }; | ||||
|      | ||||
|     inline std::ostream& operator<<(std::ostream& out, pp_prefix const& p) { | ||||
|         uint64 q = p.m_prefix; | ||||
|         uint64_t q = p.m_prefix; | ||||
|         unsigned d = std::min(63u, p.m_depth); | ||||
|         for (unsigned i = 0; i <= d; ++i) { | ||||
|             if (0 != (p.m_prefix & (1ull << i))) out << "1"; else out << "0"; | ||||
|  | @ -238,7 +238,7 @@ namespace sat { | |||
|         double                 m_lookahead_reward; // metric associated with current lookahead1 literal.
 | ||||
|         literal_vector         m_wstack;        // windofall stack that is populated in lookahead1 mode
 | ||||
|         unsigned               m_last_prefix_length; | ||||
|         uint64                 m_prefix;        // where we are in search tree
 | ||||
|         uint64_t                 m_prefix;        // where we are in search tree
 | ||||
|         svector<prefix>        m_vprefix;       // var:     prefix where variable participates in propagation
 | ||||
|         unsigned               m_rating_throttle; // throttle to recompute rating
 | ||||
|         indexed_uint_set       m_freevars; | ||||
|  | @ -523,7 +523,7 @@ namespace sat { | |||
|         void update_lookahead_reward(literal l, unsigned level); | ||||
|         bool dl_enabled(literal l) const { return m_lits[l.index()].m_double_lookahead != m_istamp_id; } | ||||
|         void dl_disable(literal l) { m_lits[l.index()].m_double_lookahead = m_istamp_id; } | ||||
|         bool dl_no_overflow(unsigned base) const { return base + 2 * m_lookahead.size() * static_cast<uint64>(m_config.m_dl_max_iterations + 1) < c_fixed_truth; } | ||||
|         bool dl_no_overflow(unsigned base) const { return base + 2 * m_lookahead.size() * static_cast<uint64_t>(m_config.m_dl_max_iterations + 1) < c_fixed_truth; } | ||||
| 
 | ||||
|         unsigned do_double(literal l, unsigned& base); | ||||
|         unsigned double_look(literal l, unsigned& base); | ||||
|  |  | |||
|  | @ -782,7 +782,7 @@ namespace sat { | |||
|         } | ||||
| 
 | ||||
|         if (m_config.m_anti_exploration) { | ||||
|             uint64 age = m_stats.m_conflict - m_canceled[v]; | ||||
|             uint64_t age = m_stats.m_conflict - m_canceled[v]; | ||||
|             if (age > 0) { | ||||
|                 double decay = pow(0.95, age); | ||||
|                 m_activity[v] = static_cast<unsigned>(m_activity[v] * decay); | ||||
|  | @ -1032,7 +1032,7 @@ namespace sat { | |||
|             return check_par(num_lits, lits); | ||||
|         } | ||||
|         flet<bool> _searching(m_searching, true); | ||||
|         if (m_mc.empty() && gparams::get().get_bool("model_validate", false)) { | ||||
|         if (m_mc.empty() && gparams::get_ref().get_bool("model_validate", false)) { | ||||
|             m_clone = alloc(solver, m_params, m_rlimit); | ||||
|             m_clone->copy(*this); | ||||
|         } | ||||
|  | @ -3101,7 +3101,7 @@ namespace sat { | |||
|             SASSERT(value(v) == l_undef); | ||||
|             m_case_split_queue.unassign_var_eh(v); | ||||
|             if (m_config.m_branching_heuristic == BH_LRB) { | ||||
|                 uint64 interval = m_stats.m_conflict - m_last_propagation[v]; | ||||
|                 uint64_t interval = m_stats.m_conflict - m_last_propagation[v]; | ||||
|                 if (interval > 0) { | ||||
|                     auto activity = m_activity[v]; | ||||
|                     auto reward = (m_config.m_reward_offset * (m_participated[v] + m_reasoned[v])) / interval; | ||||
|  |  | |||
|  | @ -120,11 +120,11 @@ namespace sat { | |||
|         // branch variable selection:
 | ||||
|         svector<unsigned>       m_activity; | ||||
|         unsigned                m_activity_inc; | ||||
|         svector<uint64>         m_last_conflict; | ||||
|         svector<uint64>         m_last_propagation; | ||||
|         svector<uint64>         m_participated; | ||||
|         svector<uint64>         m_canceled; | ||||
|         svector<uint64>         m_reasoned; | ||||
|         svector<uint64_t>       m_last_conflict; | ||||
|         svector<uint64_t>       m_last_propagation; | ||||
|         svector<uint64_t>       m_participated; | ||||
|         svector<uint64_t>       m_canceled; | ||||
|         svector<uint64_t>       m_reasoned; | ||||
|         int                     m_action; | ||||
|         double                  m_step_size; | ||||
|         // phase
 | ||||
|  |  | |||
|  | @ -816,7 +816,7 @@ private: | |||
|         TRACE("sat", model_smt2_pp(tout, m, *mdl, 0);); | ||||
|          | ||||
| 
 | ||||
|         if (!gparams::get().get_bool("model_validate", false)) return; | ||||
|         if (!gparams::get_ref().get_bool("model_validate", false)) return; | ||||
|         IF_VERBOSE(0, verbose_stream() << "Verifying solution\n";); | ||||
|         model_evaluator eval(*mdl); | ||||
|         eval.set_model_completion(false); | ||||
|  |  | |||
|  | @ -212,7 +212,7 @@ unsigned read_datalog(char const * file) { | |||
|             if (early_termination) { | ||||
|                 IF_VERBOSE(1, verbose_stream() << "restarting saturation\n";); | ||||
|                  | ||||
|                 uint64 new_timeout = static_cast<uint64>(timeout)*ctx.initial_restart_timeout();  | ||||
|                 uint64_t new_timeout = static_cast<uint64_t>(timeout)*ctx.initial_restart_timeout(); | ||||
|                 if(new_timeout>UINT_MAX) { | ||||
|                     timeout=UINT_MAX; | ||||
|                 } | ||||
|  |  | |||
|  | @ -55,8 +55,8 @@ struct front_end_resource_limit : public lp::lp_resource_limit { | |||
| void run_solver(lp_params & params, char const * mps_file_name) { | ||||
| 
 | ||||
|     reslimit rlim; | ||||
|     unsigned timeout = gparams::get().get_uint("timeout", 0); | ||||
|     unsigned rlimit  = gparams::get().get_uint("rlimit", 0); | ||||
|     unsigned timeout = gparams::get_ref().get_uint("timeout", 0); | ||||
|     unsigned rlimit  = gparams::get_ref().get_uint("rlimit", 0); | ||||
|     front_end_resource_limit lp_limit(rlim); | ||||
| 
 | ||||
|     scoped_rlimit _rlimit(rlim, rlimit); | ||||
|  |  | |||
|  | @ -115,7 +115,7 @@ static unsigned parse_opt(std::istream& in, opt_format f) { | |||
|         case l_undef: std::cout << "unknown\n"; break; | ||||
|         } | ||||
|          | ||||
|         if (r != l_false && gparams::get().get_bool("model_validate", false)) { | ||||
|         if (r != l_false && gparams::get_ref().get_bool("model_validate", false)) { | ||||
|             model_ref mdl; | ||||
|             opt.get_model(mdl); | ||||
|             expr_ref_vector hard(m); | ||||
|  |  | |||
|  | @ -80,6 +80,12 @@ def_module_params(module_name='smt', | |||
|                           ('theory_aware_branching', BOOL, False, 'Allow the context to use extra information from theory solvers regarding literal branching prioritization.'), | ||||
|                           ('str.finite_overlap_models', BOOL, False, 'attempt a finite model search for overlapping variables instead of completely giving up on the arrangement'), | ||||
|                           ('str.overlap_priority', DOUBLE, -0.1, 'theory-aware priority for overlapping variable cases; use smt.theory_aware_branching=true'), | ||||
|                           ('str.regex_automata', BOOL, True, 'use automata-based reasoning for regular expressions (Z3str3 only)'), | ||||
|                           ('str.regex_automata_difficulty_threshold', UINT, 1000, 'difficulty threshold for regex automata heuristics'), | ||||
|                           ('str.regex_automata_intersection_difficulty_threshold', UINT, 1000, 'difficulty threshold for regex intersection heuristics'), | ||||
|                           ('str.regex_automata_failed_automaton_threshold', UINT, 10, 'number of failed automaton construction attempts after which a full automaton is automatically built'), | ||||
|                           ('str.regex_automata_failed_intersection_threshold', UINT, 10, 'number of failed automaton intersection attempts after which intersection is always computed'), | ||||
|                           ('str.regex_automata_length_attempt_threshold', UINT, 10, 'number of length/path constraint attempts before checking unsatisfiability of regex terms'), | ||||
|                           ('core.minimize', BOOL, False, 'minimize unsat core produced by SMT context'), | ||||
|                           ('core.extend_patterns', BOOL, False, 'extend unsat core with literals that trigger (potential) quantifier instances'), | ||||
|                           ('core.extend_patterns.max_distance', UINT, UINT_MAX, 'limits the distance of a pattern-extended unsat core'), | ||||
|  |  | |||
|  | @ -31,4 +31,10 @@ void theory_str_params::updt_params(params_ref const & _p) { | |||
|     m_UseBinarySearch = p.str_use_binary_search(); | ||||
|     m_BinarySearchInitialUpperBound = p.str_binary_search_start(); | ||||
|     m_OverlapTheoryAwarePriority = p.str_overlap_priority(); | ||||
|     m_RegexAutomata = p.str_regex_automata(); | ||||
|     m_RegexAutomata_DifficultyThreshold = p.str_regex_automata_difficulty_threshold(); | ||||
|     m_RegexAutomata_IntersectionDifficultyThreshold = p.str_regex_automata_intersection_difficulty_threshold(); | ||||
|     m_RegexAutomata_FailedAutomatonThreshold = p.str_regex_automata_failed_automaton_threshold(); | ||||
|     m_RegexAutomata_FailedIntersectionThreshold = p.str_regex_automata_failed_intersection_threshold(); | ||||
|     m_RegexAutomata_LengthAttemptThreshold = p.str_regex_automata_length_attempt_threshold(); | ||||
| } | ||||
|  |  | |||
|  | @ -80,6 +80,43 @@ struct theory_str_params { | |||
| 
 | ||||
|     double m_OverlapTheoryAwarePriority; | ||||
| 
 | ||||
|     /*
 | ||||
|      * If RegexAutomata is set to true, | ||||
|      * Z3str3 will use automata-based methods to reason about | ||||
|      * regular expression constraints. | ||||
|      */ | ||||
|     bool m_RegexAutomata; | ||||
| 
 | ||||
|     /*
 | ||||
|      * RegexAutomata_DifficultyThreshold is the lowest difficulty above which Z3str3 | ||||
|      * will not eagerly construct an automaton for a regular expression term. | ||||
|      */ | ||||
|     unsigned m_RegexAutomata_DifficultyThreshold; | ||||
| 
 | ||||
|     /*
 | ||||
|      * RegexAutomata_IntersectionDifficultyThreshold is the lowest difficulty above which Z3str3 | ||||
|      * will not eagerly intersect automata to check unsatisfiability. | ||||
|      */ | ||||
|     unsigned m_RegexAutomata_IntersectionDifficultyThreshold; | ||||
| 
 | ||||
|     /*
 | ||||
|      * RegexAutomata_FailedAutomatonThreshold is the number of failed attempts to build an automaton | ||||
|      * after which a full automaton (i.e. with no length information) will be built regardless of difficulty. | ||||
|      */ | ||||
|     unsigned m_RegexAutomata_FailedAutomatonThreshold; | ||||
| 
 | ||||
|     /*
 | ||||
|      * RegexAutomaton_FailedIntersectionThreshold is the number of failed attempts to perform automaton | ||||
|      * intersection after which intersection will always be performed regardless of difficulty. | ||||
|      */ | ||||
|     unsigned m_RegexAutomata_FailedIntersectionThreshold; | ||||
| 
 | ||||
|     /*
 | ||||
|      * RegexAutomaton_LengthAttemptThreshold is the number of attempts to satisfy length/path constraints | ||||
|      * before which we begin checking unsatisfiability of a regex term. | ||||
|      */ | ||||
|     unsigned m_RegexAutomata_LengthAttemptThreshold; | ||||
| 
 | ||||
|     theory_str_params(params_ref const & p = params_ref()): | ||||
|         m_StrongArrangements(true), | ||||
|         m_AggressiveLengthTesting(false), | ||||
|  | @ -91,7 +128,13 @@ struct theory_str_params { | |||
|         m_FiniteOverlapModels(false), | ||||
|         m_UseBinarySearch(false), | ||||
|         m_BinarySearchInitialUpperBound(64), | ||||
|         m_OverlapTheoryAwarePriority(-0.1) | ||||
|         m_OverlapTheoryAwarePriority(-0.1), | ||||
|         m_RegexAutomata(true), | ||||
|         m_RegexAutomata_DifficultyThreshold(1000), | ||||
|         m_RegexAutomata_IntersectionDifficultyThreshold(1000), | ||||
|         m_RegexAutomata_FailedAutomatonThreshold(10), | ||||
|         m_RegexAutomata_FailedIntersectionThreshold(10), | ||||
|         m_RegexAutomata_LengthAttemptThreshold(10) | ||||
|     { | ||||
|         updt_params(p); | ||||
|     } | ||||
|  |  | |||
|  | @ -3980,7 +3980,7 @@ namespace smt { | |||
| #if 0 | ||||
|             { | ||||
|                 static unsigned counter = 0; | ||||
|                 static uint64 total = 0; | ||||
|                 static uint64_t total = 0; | ||||
|                 static unsigned max = 0; | ||||
|                 counter++; | ||||
|                 total += num_lits; | ||||
|  |  | |||
|  | @ -216,6 +216,15 @@ namespace smt { | |||
|             return m_args; | ||||
|         } | ||||
| 
 | ||||
|         class args { | ||||
|             enode const& n; | ||||
|         public: | ||||
|             args(enode const& n):n(n) {} | ||||
|             args(enode const* n):n(*n) {} | ||||
|             enode_vector::const_iterator begin() const { return n.get_args(); } | ||||
|             enode_vector::const_iterator end() const { return n.get_args() + n.get_num_args(); } | ||||
|         }; | ||||
| 
 | ||||
|         // unsigned get_id() const { 
 | ||||
|         //    return m_id; 
 | ||||
|         // }
 | ||||
|  | @ -285,6 +294,16 @@ namespace smt { | |||
|             return m_commutative; | ||||
|         } | ||||
| 
 | ||||
|         class parents { | ||||
|             enode const& n; | ||||
|         public: | ||||
|             parents(enode const& _n):n(_n) {} | ||||
|             parents(enode const* _n):n(*_n) {} | ||||
|             enode_vector::const_iterator begin() const { return n.begin_parents(); } | ||||
|             enode_vector::const_iterator end() const { return n.end_parents(); } | ||||
|         }; | ||||
| 
 | ||||
| 
 | ||||
|         unsigned get_num_parents() const { | ||||
|             return m_parents.size(); | ||||
|         } | ||||
|  |  | |||
|  | @ -21,6 +21,7 @@ Revision History: | |||
| 
 | ||||
| #include "util/list.h" | ||||
| #include "util/vector.h" | ||||
| #include "util/hashtable.h" | ||||
| #include "util/lbool.h" | ||||
| 
 | ||||
| class model; | ||||
|  |  | |||
|  | @ -36,6 +36,41 @@ namespace smt { | |||
|         theory_id get_from_theory() const override { return null_theory_id; } | ||||
|     }; | ||||
| 
 | ||||
|     theory_datatype::final_check_st::final_check_st(theory_datatype * th) : th(th) { | ||||
|         SASSERT(th->m_to_unmark.empty()); | ||||
|         SASSERT(th->m_to_unmark2.empty()); | ||||
|         th->m_used_eqs.reset(); | ||||
|         th->m_stack.reset(); | ||||
|         th->m_parent.reset(); | ||||
|     } | ||||
| 
 | ||||
|     theory_datatype::final_check_st::~final_check_st() { | ||||
|         unmark_enodes(th->m_to_unmark.size(), th->m_to_unmark.c_ptr()); | ||||
|         unmark_enodes2(th->m_to_unmark2.size(), th->m_to_unmark2.c_ptr()); | ||||
|         th->m_to_unmark.reset(); | ||||
|         th->m_to_unmark2.reset(); | ||||
|         th->m_used_eqs.reset(); | ||||
|         th->m_stack.reset(); | ||||
|         th->m_parent.reset(); | ||||
|     }    | ||||
|      | ||||
|     void theory_datatype::oc_mark_on_stack(enode * n) { | ||||
|         n = n->get_root(); | ||||
|         n->set_mark(); | ||||
|         m_to_unmark.push_back(n);  | ||||
|     } | ||||
| 
 | ||||
|     void theory_datatype::oc_mark_cycle_free(enode * n) { | ||||
|         n = n->get_root(); | ||||
|         n->set_mark2(); | ||||
|         m_to_unmark2.push_back(n);  | ||||
|     } | ||||
| 
 | ||||
|     void theory_datatype::oc_push_stack(enode * n) { | ||||
|         m_stack.push_back(std::make_pair(EXIT, n)); | ||||
|         m_stack.push_back(std::make_pair(ENTER, n)); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     theory* theory_datatype::mk_fresh(context* new_ctx) {  | ||||
|         return alloc(theory_datatype, new_ctx->get_manager(), m_params);  | ||||
|  | @ -389,10 +424,11 @@ namespace smt { | |||
|     final_check_status theory_datatype::final_check_eh() { | ||||
|         int num_vars = get_num_vars(); | ||||
|         final_check_status r = FC_DONE; | ||||
|         final_check_st _guard(this); // RAII for managing state
 | ||||
|         for (int v = 0; v < num_vars; v++) { | ||||
|             if (v == static_cast<int>(m_find.find(v))) { | ||||
|                 enode * node = get_enode(v); | ||||
|                 if (occurs_check(node)) { | ||||
|                 if (!oc_cycle_free(node) && occurs_check(node)) { | ||||
|                     // conflict was detected... 
 | ||||
|                     // return...
 | ||||
|                     return FC_CONTINUE; | ||||
|  | @ -410,6 +446,73 @@ namespace smt { | |||
|         return r; | ||||
|     } | ||||
| 
 | ||||
|     // Assuming `app` is equal to a constructor term, return the constructor enode
 | ||||
|     inline enode * theory_datatype::oc_get_cstor(enode * app) { | ||||
|         theory_var v = app->get_root()->get_th_var(get_id()); | ||||
|         SASSERT(v != null_theory_var); | ||||
|         v = m_find.find(v); | ||||
|         var_data * d = m_var_data[v]; | ||||
|         SASSERT(d->m_constructor); | ||||
|         return d->m_constructor; | ||||
|     } | ||||
| 
 | ||||
|     // explain the cycle root -> ... -> app -> root
 | ||||
|     void theory_datatype::occurs_check_explain(enode * app, enode * root) { | ||||
|         TRACE("datatype", tout << "occurs_check_explain " << mk_bounded_pp(app->get_owner(), get_manager()) << " <-> " << mk_bounded_pp(root->get_owner(), get_manager()) << "\n";); | ||||
|         enode* app_parent = nullptr; | ||||
| 
 | ||||
|         // first: explain that root=v, given that app=cstor(...,v,...)
 | ||||
|         for (enode * arg : enode::args(oc_get_cstor(app))) { | ||||
|             // found an argument which is equal to root
 | ||||
|             if (arg->get_root() == root->get_root()) { | ||||
|                 if (arg != root) | ||||
|                     m_used_eqs.push_back(enode_pair(arg, root)); | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         // now explain app=cstor(..,v,..) where v=root, and recurse with parent of app
 | ||||
|         while (app->get_root() != root->get_root()) { | ||||
|             enode * app_cstor = oc_get_cstor(app); | ||||
|             if (app != app_cstor) | ||||
|                 m_used_eqs.push_back(enode_pair(app, app_cstor)); | ||||
|             app_parent = m_parent[app->get_root()]; | ||||
|             app = app_parent; | ||||
|         } | ||||
|          | ||||
|         SASSERT(app->get_root() == root->get_root()); | ||||
|         if (app != root) | ||||
|             m_used_eqs.push_back(enode_pair(app, root)); | ||||
|     } | ||||
| 
 | ||||
|     // start exploring subgraph below `app`
 | ||||
|     bool theory_datatype::occurs_check_enter(enode * app) { | ||||
|         oc_mark_on_stack(app); | ||||
|         theory_var v = app->get_root()->get_th_var(get_id()); | ||||
|         if (v != null_theory_var) { | ||||
|             v = m_find.find(v); | ||||
|             var_data * d = m_var_data[v]; | ||||
|             if (d->m_constructor) { | ||||
|                 for (enode * arg : enode::args(d->m_constructor)) { | ||||
|                     if (oc_cycle_free(arg)) { | ||||
|                         continue; | ||||
|                     } | ||||
|                     if (oc_on_stack(arg)) { | ||||
|                         // arg was explored before app, and is still on the stack: cycle
 | ||||
|                         occurs_check_explain(app, arg); | ||||
|                         return true; | ||||
|                     } | ||||
|                     // explore `arg` (with parent `app`)
 | ||||
|                     if (m_util.is_datatype(get_manager().get_sort(arg->get_owner()))) { | ||||
|                         m_parent.insert(arg->get_root(), app); | ||||
|                         oc_push_stack(arg); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Check if n can be reached starting from n and following equalities and constructors. | ||||
|        For example, occur_check(a1) returns true in the following set of equalities: | ||||
|  | @ -418,17 +521,39 @@ namespace smt { | |||
|        a3 = cons(v3, a1) | ||||
|     */ | ||||
|     bool theory_datatype::occurs_check(enode * n) { | ||||
|         TRACE("datatype", tout << "occurs check: #" << n->get_owner_id() << "\n";); | ||||
|         m_to_unmark.reset(); | ||||
|         m_used_eqs.reset(); | ||||
|         m_main   = n; | ||||
|         bool res = occurs_check_core(m_main); | ||||
|         unmark_enodes(m_to_unmark.size(), m_to_unmark.c_ptr()); | ||||
|         TRACE("datatype", tout << "occurs check: #" << n->get_owner_id() << " " << mk_bounded_pp(n->get_owner(), get_manager()) << "\n";); | ||||
|         m_stats.m_occurs_check++; | ||||
| 
 | ||||
|         bool res = false; | ||||
|         oc_push_stack(n); | ||||
| 
 | ||||
|         // DFS traversal from `n`. Look at top element and explore it.
 | ||||
|         while (!res && !m_stack.empty()) { | ||||
|             stack_op op = m_stack.back().first; | ||||
|             enode * app = m_stack.back().second; | ||||
|             m_stack.pop_back(); | ||||
| 
 | ||||
|             if (oc_cycle_free(app)) continue; | ||||
| 
 | ||||
|             TRACE("datatype", tout << "occurs check loop: #" << app->get_owner_id() << " " << mk_bounded_pp(app->get_owner(), get_manager()) << (op==ENTER?" enter":" exit")<< "\n";); | ||||
| 
 | ||||
|             switch (op) { | ||||
|             case ENTER: | ||||
|               res = occurs_check_enter(app); | ||||
|               break; | ||||
| 
 | ||||
|             case EXIT: | ||||
|               oc_mark_cycle_free(app); | ||||
|               break; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (res) { | ||||
|             // m_used_eqs should contain conflict
 | ||||
|             context & ctx = get_context(); | ||||
|             region & r    = ctx.get_region(); | ||||
|             ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), r, 0, nullptr, m_used_eqs.size(), m_used_eqs.c_ptr()))); | ||||
|             TRACE("occurs_check", | ||||
|             TRACE("datatype", | ||||
|                   tout << "occurs_check: true\n"; | ||||
|                   for (enode_pair const& p : m_used_eqs) { | ||||
|                       tout << "eq: #" << p.first->get_owner_id() << " #" << p.second->get_owner_id() << "\n"; | ||||
|  | @ -437,48 +562,6 @@ namespace smt { | |||
|         } | ||||
|         return res; | ||||
|     } | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief Auxiliary method for occurs_check. | ||||
|        TODO: improve performance. | ||||
|     */ | ||||
|     bool theory_datatype::occurs_check_core(enode * app) { | ||||
|         if (app->is_marked()) | ||||
|             return false; | ||||
|          | ||||
|         m_stats.m_occurs_check++; | ||||
|         app->set_mark(); | ||||
|         m_to_unmark.push_back(app); | ||||
|          | ||||
|         TRACE("datatype", tout << "occurs check_core: #" << app->get_owner_id() << " #" << m_main->get_owner_id() << "\n";); | ||||
| 
 | ||||
|         theory_var v = app->get_root()->get_th_var(get_id()); | ||||
|         if (v != null_theory_var) { | ||||
|             v = m_find.find(v); | ||||
|             var_data * d = m_var_data[v]; | ||||
|             if (d->m_constructor) { | ||||
|                 if (app != d->m_constructor) | ||||
|                     m_used_eqs.push_back(enode_pair(app, d->m_constructor)); | ||||
|                 unsigned num_args = d->m_constructor->get_num_args(); | ||||
|                 for (unsigned i = 0; i < num_args; i++) { | ||||
|                     enode * arg = d->m_constructor->get_arg(i); | ||||
|                     if (arg->get_root() == m_main->get_root()) { | ||||
|                         if (arg != m_main) | ||||
|                             m_used_eqs.push_back(enode_pair(arg, m_main)); | ||||
|                         return true; | ||||
|                     } | ||||
|                     if (m_util.is_datatype(get_manager().get_sort(arg->get_owner())) && occurs_check_core(arg)) | ||||
|                         return true; | ||||
|                 } | ||||
|                 if (app != d->m_constructor) { | ||||
|                     SASSERT(m_used_eqs.back().first  == app); | ||||
|                     SASSERT(m_used_eqs.back().second == d->m_constructor); | ||||
|                     m_used_eqs.pop_back(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|          | ||||
|     void theory_datatype::reset_eh() { | ||||
|         m_trail_stack.reset(); | ||||
|  |  | |||
|  | @ -26,7 +26,6 @@ Revision History: | |||
| #include "smt/proto_model/datatype_factory.h" | ||||
| 
 | ||||
| namespace smt { | ||||
|      | ||||
|     class theory_datatype : public theory { | ||||
|         typedef trail_stack<theory_datatype> th_trail_stack; | ||||
|         typedef union_find<theory_datatype>  th_union_find; | ||||
|  | @ -73,11 +72,36 @@ namespace smt { | |||
|         void propagate_recognizer(theory_var v, enode * r); | ||||
|         void sign_recognizer_conflict(enode * c, enode * r); | ||||
| 
 | ||||
|         ptr_vector<enode>    m_to_unmark; | ||||
|         enode_pair_vector    m_used_eqs; | ||||
|         enode *              m_main; | ||||
|         typedef enum { ENTER, EXIT } stack_op; | ||||
|         typedef map<enode*, enode*, obj_ptr_hash<enode>, ptr_eq<enode> > parent_tbl; | ||||
|         typedef std::pair<stack_op, enode*> stack_entry; | ||||
| 
 | ||||
|         ptr_vector<enode>     m_to_unmark; | ||||
|         ptr_vector<enode>     m_to_unmark2; | ||||
|         enode_pair_vector     m_used_eqs; // conflict, if any
 | ||||
|         parent_tbl            m_parent; // parent explanation for occurs_check
 | ||||
|         svector<stack_entry>  m_stack; // stack for DFS for occurs_check
 | ||||
| 
 | ||||
|         void oc_mark_on_stack(enode * n); | ||||
|         bool oc_on_stack(enode * n) const { return n->get_root()->is_marked(); } | ||||
| 
 | ||||
|         void oc_mark_cycle_free(enode * n); | ||||
|         bool oc_cycle_free(enode * n) const { return n->get_root()->is_marked2(); } | ||||
| 
 | ||||
|         void oc_push_stack(enode * n); | ||||
| 
 | ||||
|         // class for managing state of final_check
 | ||||
|         class final_check_st { | ||||
|             theory_datatype * th; | ||||
|         public: | ||||
|             final_check_st(theory_datatype * th); | ||||
|             ~final_check_st(); | ||||
|         }; | ||||
| 
 | ||||
|         enode * oc_get_cstor(enode * n); | ||||
|         bool occurs_check(enode * n); | ||||
|         bool occurs_check_core(enode * n); | ||||
|         bool occurs_check_enter(enode * n); | ||||
|         void occurs_check_explain(enode * top, enode * root); | ||||
| 
 | ||||
|         void mk_split(theory_var v); | ||||
| 
 | ||||
|  |  | |||
|  | @ -182,7 +182,7 @@ namespace smt { | |||
|                  | ||||
|                 if (n->get_decl() != v) { | ||||
|                     expr* rep = m().mk_app(r, n); | ||||
|                     uint64 vl; | ||||
|                     uint64_t vl; | ||||
|                     if (u().is_numeral_ext(n, vl)) { | ||||
|                         assert_cnstr(m().mk_eq(rep, mk_bv_constant(vl, s))); | ||||
|                     } | ||||
|  | @ -237,12 +237,12 @@ namespace smt { | |||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         app* mk_bv_constant(uint64 val, sort* s) { | ||||
|         app* mk_bv_constant(uint64_t val, sort* s) { | ||||
|             return b().mk_numeral(rational(val, rational::ui64()), 64); | ||||
|         } | ||||
| 
 | ||||
|         app* max_value(sort* s) { | ||||
|             uint64 sz; | ||||
|             uint64_t sz; | ||||
|             VERIFY(u().try_get_size(s, sz)); | ||||
|             SASSERT(sz > 0); | ||||
|             return mk_bv_constant(sz-1, s); | ||||
|  |  | |||
|  | @ -500,7 +500,16 @@ namespace smt { | |||
|             expr* arg = atom->get_arg(i); | ||||
|             literal l = compile_arg(arg); | ||||
|             numeral c = pb.get_coeff(atom, i); | ||||
|             args.push_back(std::make_pair(l, c)); | ||||
|             switch (ctx.get_assignment(l)) { | ||||
|             case l_true:  | ||||
|                 k -= c; | ||||
|                 break; | ||||
|             case l_false: | ||||
|                 break; | ||||
|             default: | ||||
|                 args.push_back(std::make_pair(l, c)); | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         if (pb.is_at_most_k(atom) || pb.is_le(atom)) { | ||||
|             // turn W <= k into -W >= -k
 | ||||
|  | @ -512,7 +521,7 @@ namespace smt { | |||
|         else { | ||||
|             SASSERT(pb.is_at_least_k(atom) || pb.is_ge(atom) || pb.is_eq(atom)); | ||||
|         } | ||||
|         TRACE("pb", display(tout, *c););         | ||||
|         TRACE("pb", display(tout, *c, true););         | ||||
|         //app_ref fml1(m), fml2(m);
 | ||||
|         //fml1 = c->to_expr(ctx, m);
 | ||||
|         c->unique(); | ||||
|  |  | |||
|  | @ -134,8 +134,7 @@ void theory_seq::solution_map::pop_scope(unsigned num_scopes) { | |||
|     if (num_scopes == 0) return; | ||||
|     m_cache.reset(); | ||||
|     unsigned start = m_limit[m_limit.size() - num_scopes]; | ||||
|     for (unsigned i = m_updates.size(); i > start; ) { | ||||
|         --i; | ||||
|     for (unsigned i = m_updates.size(); i-- > start; ) { | ||||
|         if (m_updates[i] == INS) { | ||||
|             m_map.remove(m_lhs[i].get()); | ||||
|         } | ||||
|  | @ -436,8 +435,8 @@ bool theory_seq::is_unit_eq(expr_ref_vector const& ls, expr_ref_vector const& rs | |||
|     if (ls.empty() || !is_var(ls[0])) { | ||||
|         return false; | ||||
|     } | ||||
|     for (unsigned i = 0; i < rs.size(); ++i) { | ||||
|         if (!m_util.str.is_unit(rs[i])) { | ||||
|     for (expr* r : rs) { | ||||
|         if (!m_util.str.is_unit(r)) { | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|  | @ -482,8 +481,7 @@ void theory_seq::branch_unit_variable(dependency* dep, expr* X, expr_ref_vector | |||
| 
 | ||||
| bool theory_seq::branch_variable_mb() { | ||||
|     bool change = false; | ||||
|     for (unsigned i = 0; i < m_eqs.size(); ++i) { | ||||
|         eq const& e = m_eqs[i]; | ||||
|     for (eq const& e : m_eqs) { | ||||
|         vector<rational> len1, len2; | ||||
|         if (!is_complex(e)) { | ||||
|             continue; | ||||
|  | @ -1473,7 +1471,7 @@ bool theory_seq::add_solution(expr* l, expr* r, dependency* deps)  { | |||
|     if (l == r) { | ||||
|         return false; | ||||
|     } | ||||
|     TRACE("seq", tout << mk_pp(l, m) << " ==> " << mk_pp(r, m) << "\n";); | ||||
|     TRACE("seq", tout << mk_pp(l, m) << " ==> " << mk_pp(r, m) << "\n"; display_deps(tout, deps);); | ||||
|     m_new_solution = true; | ||||
|     m_rep.update(l, r, deps); | ||||
|     enode* n1 = ensure_enode(l); | ||||
|  | @ -1513,7 +1511,9 @@ bool theory_seq::solve_eq(expr_ref_vector const& l, expr_ref_vector const& r, de | |||
|     change = canonize(r, rs, dep2) || change; | ||||
|     deps = m_dm.mk_join(dep2, deps); | ||||
|     TRACE("seq", tout << l << " = " << r << " ==> "; | ||||
|           tout << ls << " = " << rs << "\n";); | ||||
|           tout << ls << " = " << rs << "\n"; | ||||
|           display_deps(tout, deps); | ||||
|           ); | ||||
|     if (!ctx.inconsistent() && simplify_eq(ls, rs, deps)) { | ||||
|         return true; | ||||
|     } | ||||
|  | @ -2224,63 +2224,7 @@ void theory_seq::internalize_eq_eh(app * atom, bool_var v) { | |||
| } | ||||
| 
 | ||||
| bool theory_seq::internalize_atom(app* a, bool) { | ||||
| #if 1 | ||||
|     return internalize_term(a); | ||||
| #else | ||||
|     if (is_skolem(m_eq, a)) { | ||||
|         return internalize_term(a); | ||||
|     } | ||||
|     context & ctx   = get_context(); | ||||
|     bool_var bv = ctx.mk_bool_var(a); | ||||
|     ctx.set_var_theory(bv, get_id()); | ||||
|     ctx.mark_as_relevant(bv); | ||||
| 
 | ||||
|     expr* e1, *e2; | ||||
|     if (m_util.str.is_in_re(a, e1, e2)) {         | ||||
|         return internalize_term(to_app(e1)) && internalize_re(e2); | ||||
|     } | ||||
|     if (m_util.str.is_contains(a, e1, e2) || | ||||
|         m_util.str.is_prefix(a, e1, e2) || | ||||
|         m_util.str.is_suffix(a, e1, e2)) { | ||||
|         return internalize_term(to_app(e1)) && internalize_term(to_app(e2));         | ||||
|     } | ||||
|     if (is_accept(a) || is_reject(a) || is_step(a) || is_skolem(symbol("seq.is_digit"), a)) { | ||||
|         return true; | ||||
|     } | ||||
|     UNREACHABLE(); | ||||
|     return internalize_term(a); | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| bool theory_seq::internalize_re(expr* e) { | ||||
|     expr* e1, *e2; | ||||
|     unsigned lc, uc; | ||||
|     if (m_util.re.is_to_re(e, e1)) { | ||||
|         return internalize_term(to_app(e1)); | ||||
|     } | ||||
|     if (m_util.re.is_star(e, e1) || | ||||
|         m_util.re.is_plus(e, e1) || | ||||
|         m_util.re.is_opt(e, e1) || | ||||
|         m_util.re.is_loop(e, e1, lc) || | ||||
|         m_util.re.is_loop(e, e1, lc, uc) || | ||||
|         m_util.re.is_complement(e, e1)) { | ||||
|         return internalize_re(e1); | ||||
|     } | ||||
|     if (m_util.re.is_union(e, e1, e2) || | ||||
|         m_util.re.is_intersection(e, e1, e2) || | ||||
|         m_util.re.is_concat(e, e1, e2)) { | ||||
|         return internalize_re(e1) && internalize_re(e2); | ||||
|     } | ||||
|     if (m_util.re.is_full_seq(e) || | ||||
|         m_util.re.is_full_char(e) || | ||||
|         m_util.re.is_empty(e)) { | ||||
|         return true; | ||||
|     } | ||||
|     if (m_util.re.is_range(e, e1, e2)) { | ||||
|         return internalize_term(to_app(e1)) && internalize_term(to_app(e2)); | ||||
|     } | ||||
|     UNREACHABLE(); | ||||
|     return internalize_term(to_app(e)); | ||||
| } | ||||
| 
 | ||||
| bool theory_seq::internalize_term(app* term) { | ||||
|  | @ -2344,8 +2288,8 @@ void theory_seq::add_int_string(expr* e) { | |||
| 
 | ||||
| bool theory_seq::check_int_string() { | ||||
|     bool change = false; | ||||
|     for (unsigned i = 0; i < m_int_string.size(); ++i) { | ||||
|         expr* e = m_int_string[i].get(), *n; | ||||
|     for (expr * e : m_int_string) { | ||||
|         expr* n = nullptr; | ||||
|         if (m_util.str.is_itos(e) && add_itos_val_axiom(e)) { | ||||
|             change = true; | ||||
|         } | ||||
|  | @ -2358,9 +2302,21 @@ bool theory_seq::check_int_string() { | |||
| 
 | ||||
| void theory_seq::add_stoi_axiom(expr* e) { | ||||
|     TRACE("seq", tout << mk_pp(e, m) << "\n";); | ||||
|     SASSERT(m_util.str.is_stoi(e)); | ||||
|     literal l = mk_simplified_literal(m_autil.mk_ge(e, arith_util(m).mk_int(-1))); | ||||
|     expr* s = nullptr; | ||||
|     VERIFY (m_util.str.is_stoi(e, s)); | ||||
| 
 | ||||
|     // stoi(s) >= -1
 | ||||
|     literal l = mk_simplified_literal(m_autil.mk_ge(e, m_autil.mk_int(-1))); | ||||
|     add_axiom(l);     | ||||
|      | ||||
|     // stoi(s) >= 0 <=> s in (0-9)+
 | ||||
|     expr_ref num_re(m); | ||||
|     num_re = m_util.re.mk_range(m_util.str.mk_string(symbol("0")), m_util.str.mk_string(symbol("9"))); | ||||
|     num_re = m_util.re.mk_plus(num_re); | ||||
|     app_ref in_re(m_util.re.mk_in_re(s, num_re), m); | ||||
|     literal ge0 = mk_simplified_literal(m_autil.mk_ge(e, m_autil.mk_int(0))); | ||||
|     add_axiom(~ge0, mk_literal(in_re)); | ||||
|     add_axiom(ge0, ~mk_literal(in_re)); | ||||
| } | ||||
| 
 | ||||
| bool theory_seq::add_stoi_val_axiom(expr* e) { | ||||
|  | @ -2404,8 +2360,9 @@ bool theory_seq::add_stoi_val_axiom(expr* e) { | |||
|             lits.push_back(~is_digit(ith_char)); | ||||
|             nums.push_back(digit2int(ith_char)); | ||||
|         }         | ||||
|         for (unsigned i = sz, c = 1; i-- > 0; c *= 10) { | ||||
|             coeff = m_autil.mk_int(c); | ||||
|         rational c(1); | ||||
|         for (unsigned i = sz; i-- > 0; c *= rational(10)) { | ||||
|             coeff = m_autil.mk_numeral(c, true); | ||||
|             nums[i] = m_autil.mk_mul(coeff, nums[i].get()); | ||||
|         } | ||||
|         num = m_autil.mk_add(nums.size(), nums.c_ptr()); | ||||
|  | @ -2674,7 +2631,12 @@ void theory_seq::init_model(expr_ref_vector const& es) { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void theory_seq::finalize_model(model_generator& mg) { | ||||
|     m_rep.pop_scope(1); | ||||
| } | ||||
| 
 | ||||
| void theory_seq::init_model(model_generator & mg) { | ||||
|     m_rep.push_scope(); | ||||
|     m_factory = alloc(seq_factory, get_manager(), get_family_id(), mg.get_model()); | ||||
|     mg.register_factory(m_factory); | ||||
|     for (ne const& n : m_nqs) { | ||||
|  | @ -3428,8 +3390,8 @@ void theory_seq::add_itos_length_axiom(expr* len) { | |||
| 
 | ||||
| void theory_seq::propagate_in_re(expr* n, bool is_true) { | ||||
|     TRACE("seq", tout << mk_pp(n, m) << " <- " << (is_true?"true":"false") << "\n";); | ||||
|     expr* e1 = nullptr, *e2 = nullptr; | ||||
|     VERIFY(m_util.str.is_in_re(n, e1, e2)); | ||||
|     expr* s = nullptr, *re = nullptr; | ||||
|     VERIFY(m_util.str.is_in_re(n, s, re)); | ||||
| 
 | ||||
|     expr_ref tmp(n, m); | ||||
|     m_rewrite(tmp); | ||||
|  | @ -3450,21 +3412,21 @@ void theory_seq::propagate_in_re(expr* n, bool is_true) { | |||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     expr_ref e3(e2, m); | ||||
|     expr_ref e3(re, m); | ||||
|     context& ctx = get_context(); | ||||
|     literal lit = ctx.get_literal(n); | ||||
|     if (!is_true) { | ||||
|         e3 = m_util.re.mk_complement(e2); | ||||
|         e3 = m_util.re.mk_complement(re); | ||||
|         lit.neg(); | ||||
|     } | ||||
|     eautomaton* a = get_automaton(e3); | ||||
|     if (!a) return; | ||||
| 
 | ||||
| 
 | ||||
|     expr_ref len(m_util.str.mk_length(e1), m); | ||||
|     expr_ref len(m_util.str.mk_length(s), m); | ||||
|     for (unsigned i = 0; i < a->num_states(); ++i) { | ||||
|         literal acc = mk_accept(e1, len, e3, i); | ||||
|         literal rej = mk_reject(e1, len, e3, i); | ||||
|         literal acc = mk_accept(s, len, e3, i); | ||||
|         literal rej = mk_reject(s, len, e3, i); | ||||
|         add_axiom(a->is_final_state(i)?acc:~acc); | ||||
|         add_axiom(a->is_final_state(i)?~rej:rej); | ||||
|     } | ||||
|  | @ -3475,8 +3437,8 @@ void theory_seq::propagate_in_re(expr* n, bool is_true) { | |||
|     literal_vector lits; | ||||
|     lits.push_back(~lit); | ||||
|      | ||||
|     for (unsigned i = 0; i < states.size(); ++i) { | ||||
|         lits.push_back(mk_accept(e1, zero, e3, states[i])); | ||||
|     for (unsigned st : states) { | ||||
|         lits.push_back(mk_accept(s, zero, e3, st)); | ||||
|     } | ||||
|     if (lits.size() == 2) { | ||||
|         propagate_lit(nullptr, 1, &lit, lits[1]); | ||||
|  | @ -3527,8 +3489,8 @@ static bool get_arith_value(context& ctx, theory_id afid, expr* e, expr_ref& v) | |||
| bool theory_seq::get_num_value(expr* e, rational& val) const { | ||||
|     context& ctx = get_context(); | ||||
|     expr_ref _val(m); | ||||
| 	if (!ctx.e_internalized(e)) | ||||
| 		return false; | ||||
|     if (!ctx.e_internalized(e)) | ||||
|         return false; | ||||
|     enode* next = ctx.get_enode(e), *n = next; | ||||
|     do {  | ||||
|         if (get_arith_value(ctx, m_autil.get_family_id(), next->get_owner(), _val) && m_autil.is_numeral(_val, val) && val.is_int()) { | ||||
|  | @ -3925,8 +3887,8 @@ theory_seq::dependency* theory_seq::mk_join(dependency* deps, literal lit) { | |||
| } | ||||
| 
 | ||||
| theory_seq::dependency* theory_seq::mk_join(dependency* deps, literal_vector const& lits) { | ||||
|     for (unsigned i = 0; i < lits.size(); ++i) { | ||||
|         deps = mk_join(deps, lits[i]); | ||||
|     for (literal l : lits) { | ||||
|         deps = mk_join(deps, l); | ||||
|     }  | ||||
|     return deps; | ||||
| } | ||||
|  | @ -4131,53 +4093,15 @@ void theory_seq::new_diseq_eh(theory_var v1, theory_var v2) { | |||
|     TRACE("seq", tout << "new disequality " << get_context().get_scope_level() << ": " << eq << "\n";); | ||||
|     m_rewrite(eq); | ||||
|     if (!m.is_false(eq)) { | ||||
| 
 | ||||
|         literal lit = mk_eq(e1, e2, false); | ||||
| 
 | ||||
| 
 | ||||
|         if (m_util.str.is_empty(e2)) { | ||||
|             std::swap(e1, e2); | ||||
|         } | ||||
| 
 | ||||
|         if (false && m_util.str.is_empty(e1)) { | ||||
|             expr_ref head(m), tail(m), conc(m); | ||||
|             mk_decompose(e2, head, tail); | ||||
|             conc = mk_concat(head, tail); | ||||
|             propagate_eq(~lit, e2, conc, true); | ||||
|         } | ||||
| #if 0 | ||||
| 
 | ||||
|         // (e1 = "" & e2 = xdz) or (e2 = "" & e1 = xcy) or (e1 = xcy & e2 = xdz & c != d) or (e1 = x & e2 = xdz) or (e2 = x & e1 = xcy)
 | ||||
|         // e1 = "" or e1 = xcy or e1 = x
 | ||||
|         // e2 = "" or e2 = xdz or e2 = x
 | ||||
|         // e1 = xcy or e2 = xdz
 | ||||
|         // c != d
 | ||||
| 
 | ||||
|         sort* char_sort = 0; | ||||
|         expr_ref emp(m); | ||||
|         VERIFY(m_util.is_seq(m.get_sort(e1), char_sort)); | ||||
|         emp = m_util.str.mk_empty(m.get_sort(e1)); | ||||
| 
 | ||||
|         expr_ref x = mk_skolem(symbol("seq.ne.x"), e1, e2); | ||||
|         expr_ref y = mk_skolem(symbol("seq.ne.y"), e1, e2); | ||||
|         expr_ref z = mk_skolem(symbol("seq.ne.z"), e1, e2); | ||||
|         expr_ref c = mk_skolem(symbol("seq.ne.c"), e1, e2, 0, char_sort); | ||||
|         expr_ref d = mk_skolem(symbol("seq.ne.d"), e1, e2, 0, char_sort); | ||||
|         literal e1_is_emp = mk_seq_eq(e1, emp); | ||||
|         literal e2_is_emp = mk_seq_eq(e2, emp); | ||||
|         literal e1_is_xcy = mk_seq_eq(e1, mk_concat(x, m_util.str.mk_unit(c), y)); | ||||
|         literal e2_is_xdz = mk_seq_eq(e2, mk_concat(x, m_util.str.mk_unit(d), z)); | ||||
|         add_axiom(lit, e1_is_emp, e1_is_xcy, mk_seq_eq(e1, x)); | ||||
|         add_axiom(lit, e2_is_emp, e2_is_xdz, mk_seq_eq(e2, x)); | ||||
|         add_axiom(lit, e1_is_xcy, e2_is_xdz); | ||||
|         add_axiom(lit, ~mk_eq(c, d, false)); | ||||
| #else | ||||
|         else { | ||||
|             dependency* dep = m_dm.mk_leaf(assumption(~lit)); | ||||
|             m_nqs.push_back(ne(e1, e2, dep)); | ||||
|             solve_nqs(m_nqs.size() - 1); | ||||
|         } | ||||
| #endif | ||||
|         dependency* dep = m_dm.mk_leaf(assumption(~lit)); | ||||
|         m_nqs.push_back(ne(e1, e2, dep)); | ||||
|         solve_nqs(m_nqs.size() - 1);         | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -4508,8 +4432,7 @@ bool theory_seq::add_reject2reject(expr* rej, bool& change) { | |||
|     ensure_nth(~len_le_idx, s, idx); | ||||
|     literal_vector eqs; | ||||
|     bool has_undef = false; | ||||
|     for (unsigned i = 0; i < mvs.size(); ++i) { | ||||
|         eautomaton::move const& mv = mvs[i]; | ||||
|     for (eautomaton::move const& mv : mvs) { | ||||
|         literal eq = mk_literal(mv.t()->accept(nth)); | ||||
|         switch (ctx.get_assignment(eq)) { | ||||
|         case l_false: | ||||
|  |  | |||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue