3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-16 13:58:45 +00:00
This commit is contained in:
nilsbecker 2018-04-08 18:27:21 +02:00
commit b3aed5987c
195 changed files with 2123 additions and 2105 deletions

View file

@ -33,8 +33,8 @@ endif()
# Project version
################################################################################
set(Z3_VERSION_MAJOR 4)
set(Z3_VERSION_MINOR 6)
set(Z3_VERSION_PATCH 1)
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
@ -240,6 +240,9 @@ elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
message(STATUS "Platform: FreeBSD")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_FREEBSD_")
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "NetBSD")
message(STATUS "Platform: NetBSD")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_NetBSD_")
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
message(STATUS "Platform: OpenBSD")
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_OPENBSD_")
@ -409,6 +412,20 @@ list(APPEND Z3_DEPENDENT_LIBS ${CMAKE_THREAD_LIBS_INIT})
################################################################################
include(${CMAKE_SOURCE_DIR}/cmake/compiler_warnings.cmake)
################################################################################
# If using Ninja, force color output for Clang (and gcc, disabled to check build).
################################################################################
if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
endif()
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color")
# endif()
endif()
################################################################################
# Option to control what type of library we build
################################################################################
@ -434,7 +451,7 @@ else()
endif()
################################################################################
# Postion independent code
# Position independent code
################################################################################
# This is required because code built in the components will end up in a shared
# library. If not building a shared library ``-fPIC`` isn't needed and would add

View file

@ -12,9 +12,9 @@ See the [release notes](RELEASE_NOTES) for notes on various stable releases of Z
## Build status
| Windows x86 | Windows x64 | Ubuntu x64 | Debian x64 | OSX | TravisCI |
| ----------- | ----------- | ---------- | ---------- | --- | -------- |
[![win32-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/4/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=4) | [![win64-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/7/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=7) | [![ubuntu-x64-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/3/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=3) | [![debian-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/5/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=5) | [![osx-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/2/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=2) | [![Build Status](https://travis-ci.org/Z3Prover/z3.svg?branch=master)](https://travis-ci.org/Z3Prover/z3)
| Windows x64 | Windows x86 | Windows x64 | Ubuntu x64 | Debian x64 | OSX | TravisCI |
| ----------- | ----------- | ----------- | ---------- | ---------- | --- | -------- |
[![win64-badge](https://z3build.visualstudio.com/_apis/public/build/definitions/2e0aa542-a22c-4b1a-8dcd-3ebae8e12db4/4/badge)](https://z3build.visualstudio.com/Z3Build/_build/index?definitionId=4) | [![win32-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/4/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=4) | [![win64-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/7/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=7) | [![ubuntu-x64-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/3/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=3) | [![debian-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/5/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=5) | [![osx-badge](https://cz3.visualstudio.com/_apis/public/build/definitions/bf14bcc7-ebd4-4240-812c-5972fa59e0ad/2/badge)](https://cz3.visualstudio.com/Z3/_build/index?definitionId=2) | [![Build Status](https://travis-ci.org/Z3Prover/z3.svg?branch=master)](https://travis-ci.org/Z3Prover/z3)
[1]: #building-z3-on-windows-using-visual-studio-command-prompt
[2]: #building-z3-using-make-and-gccclang

2
configure vendored
View file

@ -14,4 +14,4 @@ if ! $PYTHON -c "print('testing')" > /dev/null ; then
exit 1
fi
$PYTHON scripts/mk_make.py $*
$PYTHON scripts/mk_make.py "$@"

View file

@ -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";

View file

@ -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");

View file

@ -1609,7 +1609,6 @@ public:
display_inference(out, "rewrite", "thm", p);
break;
case Z3_OP_PR_PULL_QUANT:
case Z3_OP_PR_PULL_QUANT_STAR:
display_inference(out, "pull_quant", "thm", p);
break;
case Z3_OP_PR_PUSH_QUANT:
@ -1669,12 +1668,6 @@ public:
case Z3_OP_PR_NNF_NEG:
display_inference(out, "nnf_neg", "sab", p);
break;
case Z3_OP_PR_NNF_STAR:
display_inference(out, "nnf", "sab", p);
break;
case Z3_OP_PR_CNF_STAR:
display_inference(out, "cnf", "sab", p);
break;
case Z3_OP_PR_SKOLEMIZE:
display_inference(out, "skolemize", "sab", p);
break;
@ -1706,10 +1699,6 @@ public:
return display_hyp_inference(out, "modus_ponens", "thm", conclusion, hyp, hyp2);
}
case Z3_OP_PR_NNF_POS:
case Z3_OP_PR_NNF_STAR:
return display_hyp_inference(out, "nnf", "sab", conclusion, hyp);
case Z3_OP_PR_CNF_STAR:
return display_hyp_inference(out, "cnf", "sab", conclusion, hyp);
case Z3_OP_PR_SKOLEMIZE:
return display_hyp_inference(out, "skolemize", "sab", conclusion, hyp);
case Z3_OP_PR_TRANSITIVITY:

View file

@ -72,7 +72,7 @@ def main(args):
if count == 0:
logging.info('No files generated. You need to specific an output directory'
' for the relevant langauge bindings')
' for the relevant language bindings')
# TODO: Add support for other bindings
return 0

View file

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

View file

@ -69,6 +69,7 @@ IS_WINDOWS=False
IS_LINUX=False
IS_OSX=False
IS_FREEBSD=False
IS_NETBSD=False
IS_OPENBSD=False
IS_CYGWIN=False
IS_CYGWIN_MINGW=False
@ -141,6 +142,9 @@ def is_linux():
def is_freebsd():
return IS_FREEBSD
def is_netbsd():
return IS_NETBSD
def is_openbsd():
return IS_OPENBSD
@ -604,6 +608,8 @@ elif os.name == 'posix':
IS_LINUX=True
elif os.uname()[0] == 'FreeBSD':
IS_FREEBSD=True
elif os.uname()[0] == 'NetBSD':
IS_NETBSD=True
elif os.uname()[0] == 'OpenBSD':
IS_OPENBSD=True
elif os.uname()[0][:6] == 'CYGWIN':
@ -889,8 +895,13 @@ def is_CXX_gpp():
return is_compiler(CXX, 'g++')
def is_clang_in_gpp_form(cc):
version_string = check_output([cc, '--version']).encode('utf-8').decode('utf-8')
return version_string.find('clang') != -1
str = check_output([cc, '--version'])
try:
version_string = str.encode('utf-8')
except:
version_string = str
clang = 'clang'.encode('utf-8')
return version_string.find(clang) != -1
def is_CXX_clangpp():
if is_compiler(CXX, 'g++'):
@ -1240,7 +1251,7 @@ def get_so_ext():
sysname = os.uname()[0]
if sysname == 'Darwin':
return 'dylib'
elif sysname == 'Linux' or sysname == 'FreeBSD' or sysname == 'OpenBSD':
elif sysname == 'Linux' or sysname == 'FreeBSD' or sysname == 'NetBSD' or sysname == 'OpenBSD':
return 'so'
elif sysname == 'CYGWIN' or sysname.startswith('MSYS_NT') or sysname.startswith('MINGW'):
return 'dll'
@ -1790,6 +1801,8 @@ class JavaDLLComponent(Component):
t = t.replace('PLATFORM', 'linux')
elif IS_FREEBSD:
t = t.replace('PLATFORM', 'freebsd')
elif IS_NETBSD:
t = t.replace('PLATFORM', 'netbsd')
elif IS_OPENBSD:
t = t.replace('PLATFORM', 'openbsd')
elif IS_CYGWIN:
@ -2499,6 +2512,13 @@ def mk_config():
LDFLAGS = '%s -lrt' % LDFLAGS
SLIBFLAGS = '-shared'
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
elif sysname == 'NetBSD':
CXXFLAGS = '%s -D_NETBSD_' % CXXFLAGS
OS_DEFINES = '-D_NETBSD_'
SO_EXT = '.so'
LDFLAGS = '%s -lrt' % LDFLAGS
SLIBFLAGS = '-shared'
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
elif sysname == 'OpenBSD':
CXXFLAGS = '%s -D_OPENBSD_' % CXXFLAGS
OS_DEFINES = '-D_OPENBSD_'

View file

@ -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:

19
scripts/vsts-mac.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
cd ..
mkdir build
CSC=/usr/bin/csc GACUTIL=/usr/bin/gacutil CXX=clang++ CC=clang python scripts/mk_make.py --java --python
cd build
make
make test-z3
make cpp_example
make c_example
# make java_example
# make python_example
./cpp_example
./test_capi
git clone https://github.com/z3prover/z3test.git z3test
ls
python z3test/scripts/test_benchmarks.py ./z3 ./z3test/regressions/smt2

49
scripts/vsts-vs2013.cmd Normal file
View file

@ -0,0 +1,49 @@
set
echo "Build"
md build
cd build
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
cmake -DBUILD_DOTNET_BINDINGS=True -DBUILD_JAVA_BINDINGS=True -DBUILD_PYTHON_BINDINGS=True -G "NMake Makefiles" ../
nmake
if ERRORLEVEL 1 exit 1
rem echo "Test python bindings"
rem pushd python
rem python z3test.py z3
rem if ERRORLEVEL 1 exit 1
rem python z3test.py z3num
rem if ERRORLEVEL 1 exit 1
rem popd
echo "Build and run examples"
nmake cpp_example
examples\cpp_example_build_dir\cpp_example.exe
if ERRORLEVEL 1 exit 1
nmake c_example
examples\c_example_build_dir\c_example.exe
if ERRORLEVEL 1 exit 1
rem nmake java_example
rem java_example.exe
if ERRORLEVEL 1 exit 1
rem nmake dotnet_example
rem dotnet_example.exe
if ERRORLEVEL 1 exit 1
echo "Build and run unit tests"
nmake test-z3
rem TBD: test error level
rem test-z3.exe -a
cd ..
echo "Run regression tests"
git clone https://github.com/z3prover/z3test z3test
echo "test-benchmarks"
python z3test\scripts\test_benchmarks.py build\z3.exe z3test\regressions\smt2
if ERRORLEVEL 1 exit 1
echo "benchmarks tested"

51
scripts/vsts-vs2017.cmd Normal file
View file

@ -0,0 +1,51 @@
rem Supply argument x64 or x86
echo "Build"
md build
cd build
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %1
cmake -DBUILD_DOTNET_BINDINGS=True -DBUILD_JAVA_BINDINGS=True -DBUILD_PYTHON_BINDINGS=True -G "NMake Makefiles" ../
nmake
if ERRORLEVEL 1 exit 1
if %1 == "x86" goto :BUILD_EXAMPLES
echo "Test python bindings"
pushd python
python z3test.py z3
if ERRORLEVEL 1 exit 1
python z3test.py z3num
if ERRORLEVEL 1 exit 1
popd
:BUILD_EXAMPLES
echo "Build and run examples"
nmake cpp_example
examples\cpp_example_build_dir\cpp_example.exe
if ERRORLEVEL 1 exit 1
nmake c_example
examples\c_example_build_dir\c_example.exe
if ERRORLEVEL 1 exit 1
rem nmake java_example
rem java_example.exe
if ERRORLEVEL 1 exit 1
rem nmake dotnet_example
rem dotnet_example.exe
if ERRORLEVEL 1 exit 1
echo "Build and run unit tests"
nmake test-z3
rem TBD: test error level
rem test-z3.exe -a
cd ..
echo "Run regression tests"
git clone https://github.com/z3prover/z3test z3test
echo "test-benchmarks"
python z3test\scripts\test_benchmarks.py build\z3.exe z3test\regressions\smt2
if ERRORLEVEL 1 exit 1
echo "benchmarks tested"

View file

@ -919,7 +919,6 @@ extern "C" {
case PR_REWRITE: return Z3_OP_PR_REWRITE;
case PR_REWRITE_STAR: return Z3_OP_PR_REWRITE_STAR;
case PR_PULL_QUANT: return Z3_OP_PR_PULL_QUANT;
case PR_PULL_QUANT_STAR: return Z3_OP_PR_PULL_QUANT_STAR;
case PR_PUSH_QUANT: return Z3_OP_PR_PUSH_QUANT;
case PR_ELIM_UNUSED_VARS: return Z3_OP_PR_ELIM_UNUSED_VARS;
case PR_DER: return Z3_OP_PR_DER;
@ -936,9 +935,7 @@ extern "C" {
case PR_IFF_OEQ: return Z3_OP_PR_IFF_OEQ;
case PR_NNF_POS: return Z3_OP_PR_NNF_POS;
case PR_NNF_NEG: return Z3_OP_PR_NNF_NEG;
case PR_NNF_STAR: return Z3_OP_PR_NNF_STAR;
case PR_SKOLEMIZE: return Z3_OP_PR_SKOLEMIZE;
case PR_CNF_STAR: return Z3_OP_PR_CNF_STAR;
case PR_MODUS_PONENS_OEQ: return Z3_OP_PR_MODUS_PONENS_OEQ;
case PR_TH_LEMMA: return Z3_OP_PR_TH_LEMMA;
case PR_HYPER_RESOLVE: return Z3_OP_PR_HYPER_RESOLVE;
@ -1059,6 +1056,7 @@ extern "C" {
switch(_d->get_decl_kind()) {
case OP_DT_CONSTRUCTOR: return Z3_OP_DT_CONSTRUCTOR;
case OP_DT_RECOGNISER: return Z3_OP_DT_RECOGNISER;
case OP_DT_IS: return Z3_OP_DT_IS;
case OP_DT_ACCESSOR: return Z3_OP_DT_ACCESSOR;
case OP_DT_UPDATE_FIELD: return Z3_OP_DT_UPDATE_FIELD;
default:

View file

@ -184,7 +184,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);

View file

@ -34,6 +34,7 @@ Revision History:
#include "util/event_handler.h"
#include "cmd_context/tactic_manager.h"
#include "cmd_context/context_params.h"
#include "cmd_context/cmd_context.h"
#include "api/api_polynomial.h"
#include "util/hashtable.h"
@ -53,6 +54,7 @@ namespace api {
context_params m_params;
bool m_user_ref_count; //!< if true, the user is responsible for managing reference counters.
scoped_ptr<ast_manager> m_manager;
scoped_ptr<cmd_context> m_cmd;
add_plugins m_plugins;
arith_util m_arith_util;
@ -114,6 +116,7 @@ namespace api {
ast_manager & m() const { return *(m_manager.get()); }
context_params & params() { return m_params; }
scoped_ptr<cmd_context>& cmd() { return m_cmd; }
bool produce_proofs() const { return m().proofs_enabled(); }
bool produce_models() const { return m_params.m_model; }
bool produce_unsat_cores() const { return m_params.m_unsat_core; }

View file

@ -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);
}

View file

@ -137,7 +137,7 @@ extern "C" {
func_decl* decl = (decls)[i];
mk_c(c)->save_multiple_ast_trail(decl);
enum_consts[i] = of_func_decl(decl);
decl = dt_util.get_constructor_recognizer(decl);
decl = dt_util.get_constructor_is(decl);
mk_c(c)->save_multiple_ast_trail(decl);
enum_testers[i] = of_func_decl(decl);
}
@ -196,7 +196,7 @@ extern "C" {
*nil_decl = of_func_decl(f);
}
if (is_nil_decl) {
f = data_util.get_constructor_recognizer(cnstrs[0]);
f = data_util.get_constructor_is(cnstrs[0]);
mk_c(c)->save_multiple_ast_trail(f);
*is_nil_decl = of_func_decl(f);
}
@ -206,7 +206,7 @@ extern "C" {
*cons_decl = of_func_decl(f);
}
if (is_cons_decl) {
f = data_util.get_constructor_recognizer(cnstrs[1]);
f = data_util.get_constructor_is(cnstrs[1]);
mk_c(c)->save_multiple_ast_trail(f);
*is_cons_decl = of_func_decl(f);
}
@ -290,7 +290,7 @@ extern "C" {
*constructor_decl = of_func_decl(f);
}
if (tester) {
func_decl* f2 = data_util.get_constructor_recognizer(f);
func_decl* f2 = data_util.get_constructor_is(f);
mk_c(c)->save_multiple_ast_trail(f2);
*tester = of_func_decl(f2);
}
@ -497,7 +497,7 @@ extern "C" {
RETURN_Z3(nullptr);
}
func_decl* decl = (decls)[idx];
decl = dt_util.get_constructor_recognizer(decl);
decl = dt_util.get_constructor_is(decl);
mk_c(c)->save_ast_trail(decl);
RETURN_Z3(of_func_decl(decl));
Z3_CATCH_RETURN(nullptr);

View file

@ -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();

View file

@ -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);

View file

@ -21,8 +21,11 @@ Revision History:
#include "api/api_context.h"
#include "api/api_util.h"
#include "cmd_context/cmd_context.h"
#include "smt/smt_solver.h"
#include "parsers/smt2/smt2parser.h"
#include "solver/solver_na2as.h"
#include "tactic/portfolio/smt_strategic_solver.h"
extern "C" {
@ -117,4 +120,34 @@ extern "C" {
RETURN_Z3(r);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_eval_smtlib2_string(Z3_context c, Z3_string str) {
std::stringstream ous;
Z3_TRY;
LOG_Z3_eval_smtlib2_string(c, str);
if (!mk_c(c)->cmd()) {
mk_c(c)->cmd() = alloc(cmd_context, false, &(mk_c(c)->m()));
mk_c(c)->cmd()->set_solver_factory(mk_smt_strategic_solver_factory());
}
scoped_ptr<cmd_context>& ctx = mk_c(c)->cmd();
std::string s(str);
std::istringstream is(s);
ctx->set_regular_stream(ous);
ctx->set_diagnostic_stream(ous);
try {
if (!parse_smt2_commands(*ctx.get(), is)) {
mk_c(c)->m_parser_error_buffer = ous.str();
SET_ERROR_CODE(Z3_PARSER_ERROR);
RETURN_Z3(mk_c(c)->mk_external_string(ous.str()));
}
}
catch (z3_exception& e) {
if (ous.str().empty()) ous << e.msg();
mk_c(c)->m_parser_error_buffer = ous.str();
SET_ERROR_CODE(Z3_PARSER_ERROR);
RETURN_Z3(mk_c(c)->mk_external_string(ous.str()));
}
RETURN_Z3(mk_c(c)->mk_external_string(ous.str()));
Z3_CATCH_RETURN(mk_c(c)->mk_external_string(ous.str()));
}
};

View file

@ -17,6 +17,11 @@ Revision History:
--*/
#include<iostream>
#include "util/scoped_ctrl_c.h"
#include "util/cancel_eh.h"
#include "util/file_path.h"
#include "util/scoped_timer.h"
#include "ast/ast_pp.h"
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
@ -26,14 +31,10 @@ Revision History:
#include "api/api_stats.h"
#include "api/api_ast_vector.h"
#include "solver/tactic2solver.h"
#include "util/scoped_ctrl_c.h"
#include "util/cancel_eh.h"
#include "util/file_path.h"
#include "util/scoped_timer.h"
#include "solver/smt_logics.h"
#include "tactic/portfolio/smt_strategic_solver.h"
#include "smt/smt_solver.h"
#include "smt/smt_implied_equalities.h"
#include "solver/smt_logics.h"
#include "cmd_context/cmd_context.h"
#include "parsers/smt2/smt2parser.h"
#include "sat/dimacs.h"

View file

@ -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();
}

View file

@ -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);
@ -660,8 +669,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; }
@ -744,35 +753,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;
}
@ -989,7 +998,7 @@ namespace z3 {
/**
\brief sequence and regular expression operations.
+ is overloaeded as sequence concatenation and regular expression union.
+ is overloaded as sequence concatenation and regular expression union.
concat is overloaded to handle sequences and regular expressions
*/
expr extract(expr const& offset, expr const& length) const {
@ -2432,6 +2441,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));
@ -2526,21 +2548,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);

View file

@ -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:

View file

@ -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:

View file

@ -2515,7 +2515,7 @@ namespace Microsoft.Z3
/// <summary>
/// Concatentate sequences.
/// Concatenate sequences.
/// </summary>
public SeqExpr MkConcat(params SeqExpr[] t)
{
@ -3597,7 +3597,7 @@ namespace Microsoft.Z3
}
/// <summary>
/// Create a tactic that fails if the goal is not triviall satisfiable (i.e., empty)
/// Create a tactic that fails if the goal is not trivially satisfiable (i.e., empty)
/// or trivially unsatisfiable (i.e., contains `false').
/// </summary>
public Tactic FailIfNotDecided()
@ -4656,7 +4656,7 @@ namespace Microsoft.Z3
/// Conversion of a floating-point term into a bit-vector.
/// </summary>
/// <remarks>
/// Produces a term that represents the conversion of the floating-poiunt term t into a
/// Produces a term that represents the conversion of the floating-point term t into a
/// bit-vector term of size sz in 2's complement format (signed when signed==true). If necessary,
/// the result will be rounded according to rounding mode rm.
/// </remarks>
@ -4677,7 +4677,7 @@ namespace Microsoft.Z3
/// Conversion of a floating-point term into a real-numbered term.
/// </summary>
/// <remarks>
/// Produces a term that represents the conversion of the floating-poiunt term t into a
/// Produces a term that represents the conversion of the floating-point term t into a
/// real number. Note that this type of conversion will often result in non-linear
/// constraints over real terms.
/// </remarks>
@ -4696,7 +4696,7 @@ namespace Microsoft.Z3
/// <remarks>
/// The size of the resulting bit-vector is automatically determined. Note that
/// IEEE 754-2008 allows multiple different representations of NaN. This conversion
/// knows only one NaN and it will always produce the same bit-vector represenatation of
/// knows only one NaN and it will always produce the same bit-vector representation of
/// that NaN.
/// </remarks>
/// <param name="t">FloatingPoint term.</param>

View file

@ -932,7 +932,7 @@ namespace Microsoft.Z3
/// Indicates whether the term is a proof by condensed transitivity of a relation
/// </summary>
/// <remarks>
/// Condensed transitivity proof. This proof object is only used if the parameter PROOF_MODE is 1.
/// Condensed transitivity proof.
/// It combines several symmetry and transitivity proofs.
/// Example:
/// T1: (R a b)
@ -1035,14 +1035,11 @@ namespace Microsoft.Z3
/// </summary>
/// <remarks>
/// A proof for rewriting an expression t into an expression s.
/// This proof object is used if the parameter PROOF_MODE is 1.
/// This proof object can have n antecedents.
/// The antecedents are proofs for equalities used as substitution rules.
/// The object is also used in a few cases if the parameter PROOF_MODE is 2.
/// The cases are:
/// The object is used in a few cases:
/// - When applying contextual simplification (CONTEXT_SIMPLIFIER=true)
/// - When converting bit-vectors to Booleans (BIT2BOOL=true)
/// - When pulling ite expression up (PULL_CHEAP_ITE_TREES=true)
/// </remarks>
public bool IsProofRewriteStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REWRITE_STAR; } }
@ -1054,15 +1051,6 @@ namespace Microsoft.Z3
/// </remarks>
public bool IsProofPullQuant { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_PULL_QUANT; } }
/// <summary>
/// Indicates whether the term is a proof for pulling quantifiers out.
/// </summary>
/// <remarks>
/// A proof for (iff P Q) where Q is in prenex normal form.
/// This proof object is only used if the parameter PROOF_MODE is 1.
/// This proof object has no antecedents
/// </remarks>
public bool IsProofPullQuantStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_PULL_QUANT_STAR; } }
/// <summary>
/// Indicates whether the term is a proof for pushing quantifiers in.
@ -1304,28 +1292,6 @@ namespace Microsoft.Z3
/// </remarks>
public bool IsProofNNFNeg { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NNF_NEG; } }
/// <summary>
/// Indicates whether the term is a proof for (~ P Q) here Q is in negation normal form.
/// </summary>
/// <remarks>
/// A proof for (~ P Q) where Q is in negation normal form.
///
/// This proof object is only used if the parameter PROOF_MODE is 1.
///
/// This proof object may have n antecedents. Each antecedent is a PR_DEF_INTRO.
/// </remarks>
public bool IsProofNNFStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NNF_STAR; } }
/// <summary>
/// Indicates whether the term is a proof for (~ P Q) where Q is in conjunctive normal form.
/// </summary>
/// <remarks>
/// A proof for (~ P Q) where Q is in conjunctive normal form.
/// This proof object is only used if the parameter PROOF_MODE is 1.
/// This proof object may have n antecedents. Each antecedent is a PR_DEF_INTRO.
/// </remarks>
public bool IsProofCNFStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_CNF_STAR; } }
/// <summary>
/// Indicates whether the term is a proof for a Skolemization step
/// </summary>

View file

@ -1978,7 +1978,7 @@ public class Context implements AutoCloseable {
}
/**
* Concatentate sequences.
* Concatenate sequences.
*/
public SeqExpr mkConcat(SeqExpr... t)
{
@ -2543,14 +2543,15 @@ public class Context implements AutoCloseable {
/**
* Parse the given string using the SMT-LIB2 parser.
*
* @return A conjunction of assertions in the scope (up to push/pop) at the
* end of the string.
* @return A conjunction of assertions.
*
* If the string contains push/pop commands, the
* set of assertions returned are the ones in the
* last scope level.
**/
public BoolExpr parseSMTLIB2String(String str, Symbol[] sortNames,
Sort[] sorts, Symbol[] declNames, FuncDecl[] decls)
Sort[] sorts, Symbol[] declNames, FuncDecl[] decls)
{
int csn = Symbol.arrayLength(sortNames);
int cs = Sort.arrayLength(sorts);
int cdn = Symbol.arrayLength(declNames);
@ -2781,7 +2782,7 @@ public class Context implements AutoCloseable {
}
/**
* Create a tactic that fails if the goal is not triviall satisfiable (i.e.,
* Create a tactic that fails if the goal is not trivially satisfiable (i.e.,
* empty) or trivially unsatisfiable (i.e., contains `false').
**/
public Tactic failIfNotDecided()
@ -3769,7 +3770,7 @@ public class Context implements AutoCloseable {
* @param sz Size of the resulting bit-vector.
* @param signed Indicates whether the result is a signed or unsigned bit-vector.
* Remarks:
* Produces a term that represents the conversion of the floating-poiunt term t into a
* Produces a term that represents the conversion of the floating-point term t into a
* bit-vector term of size sz in 2's complement format (signed when signed==true). If necessary,
* the result will be rounded according to rounding mode rm.
* @throws Z3Exception
@ -3786,7 +3787,7 @@ public class Context implements AutoCloseable {
* Conversion of a floating-point term into a real-numbered term.
* @param t FloatingPoint term
* Remarks:
* Produces a term that represents the conversion of the floating-poiunt term t into a
* Produces a term that represents the conversion of the floating-point term t into a
* real number. Note that this type of conversion will often result in non-linear
* constraints over real terms.
* @throws Z3Exception
@ -3802,7 +3803,7 @@ public class Context implements AutoCloseable {
* Remarks:
* The size of the resulting bit-vector is automatically determined. Note that
* IEEE 754-2008 allows multiple different representations of NaN. This conversion
* knows only one NaN and it will always produce the same bit-vector represenatation of
* knows only one NaN and it will always produce the same bit-vector representation of
* that NaN.
* @throws Z3Exception
**/

View file

@ -1398,8 +1398,7 @@ public class Expr extends AST
/**
* Indicates whether the term is a proof by condensed transitivity of a
* relation
* Remarks: Condensed transitivity proof. This proof object is
* only used if the parameter PROOF_MODE is 1. It combines several symmetry
* Remarks: Condensed transitivity proof. It combines several symmetry
* and transitivity proofs. Example: T1: (R a b) T2: (R c b) T3: (R c d)
* [trans* T1 T2 T3]: (R a d) R must be a symmetric and transitive relation.
*
@ -1506,14 +1505,11 @@ public class Expr extends AST
/**
* Indicates whether the term is a proof by rewriting
* Remarks: A proof for
* rewriting an expression t into an expression s. This proof object is used
* if the parameter PROOF_MODE is 1. This proof object can have n
* rewriting an expression t into an expression s. This proof object can have n
* antecedents. The antecedents are proofs for equalities used as
* substitution rules. The object is also used in a few cases if the
* parameter PROOF_MODE is 2. The cases are: - When applying contextual
* substitution rules. The object is used in a few cases . The cases are: - When applying contextual
* simplification (CONTEXT_SIMPLIFIER=true) - When converting bit-vectors to
* Booleans (BIT2BOOL=true) - When pulling ite expression up
* (PULL_CHEAP_ITE_TREES=true)
* Booleans (BIT2BOOL=true)
* @throws Z3Exception on error
* @return a boolean
**/
@ -1534,17 +1530,6 @@ public class Expr extends AST
return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_PULL_QUANT;
}
/**
* Indicates whether the term is a proof for pulling quantifiers out.
*
* Remarks: A proof for (iff P Q) where Q is in prenex normal form. This * proof object is only used if the parameter PROOF_MODE is 1. This proof * object has no antecedents
* @throws Z3Exception on error
* @return a boolean
**/
public boolean isProofPullQuantStar()
{
return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_PULL_QUANT_STAR;
}
/**
* Indicates whether the term is a proof for pushing quantifiers in.
@ -1804,38 +1789,6 @@ public class Expr extends AST
return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_NNF_NEG;
}
/**
* Indicates whether the term is a proof for (~ P Q) here Q is in negation
* normal form.
* Remarks: A proof for (~ P Q) where Q is in negation normal
* form.
*
* This proof object is only used if the parameter PROOF_MODE is 1.
*
* This proof object may have n antecedents. Each antecedent is a
* PR_DEF_INTRO.
* @throws Z3Exception on error
* @return a boolean
**/
public boolean isProofNNFStar()
{
return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_NNF_STAR;
}
/**
* Indicates whether the term is a proof for (~ P Q) where Q is in
* conjunctive normal form.
* Remarks: A proof for (~ P Q) where Q is in
* conjunctive normal form. This proof object is only used if the parameter
* PROOF_MODE is 1. This proof object may have n antecedents. Each
* antecedent is a PR_DEF_INTRO.
* @throws Z3Exception on error
* @return a boolean
**/
public boolean isProofCNFStar()
{
return isApp() && getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_CNF_STAR;
}
/**
* Indicates whether the term is a proof for a Skolemization step

View file

@ -1402,7 +1402,6 @@ struct
let is_rewrite (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_REWRITE)
let is_rewrite_star (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_REWRITE_STAR)
let is_pull_quant (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_PULL_QUANT)
let is_pull_quant_star (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_PULL_QUANT_STAR)
let is_push_quant (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_PUSH_QUANT)
let is_elim_unused_vars (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_ELIM_UNUSED_VARS)
let is_der (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_DER)
@ -1419,8 +1418,6 @@ struct
let is_iff_oeq (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_IFF_OEQ)
let is_nnf_pos (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_NNF_POS)
let is_nnf_neg (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_NNF_NEG)
let is_nnf_star (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_NNF_STAR)
let is_cnf_star (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_CNF_STAR)
let is_skolemize (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_SKOLEMIZE)
let is_modus_ponens_oeq (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_MODUS_PONENS_OEQ)
let is_theory_lemma (x:expr) = (AST.is_app x) && (FuncDecl.get_decl_kind (Expr.get_func_decl x) = OP_PR_TH_LEMMA)

View file

@ -2458,13 +2458,6 @@ sig
A proof for (iff (f (forall (x) q(x)) r) (forall (x) (f (q x) r))). This proof object has no antecedents. *)
val is_pull_quant : Expr.expr -> bool
(** Indicates whether the term is a proof for pulling quantifiers out.
A proof for (iff P Q) where Q is in prenex normal form.
This proof object is only used if the parameter PROOF_MODE is 1.
This proof object has no antecedents *)
val is_pull_quant_star : Expr.expr -> bool
(** Indicates whether the term is a proof for pushing quantifiers in.
A proof for:
@ -2658,22 +2651,6 @@ sig
(and (or r_1 r_2) (or r_1' r_2'))) *)
val is_nnf_neg : Expr.expr -> bool
(** Indicates whether the term is a proof for (~ P Q) here Q is in negation normal form.
A proof for (~ P Q) where Q is in negation normal form.
This proof object is only used if the parameter PROOF_MODE is 1.
This proof object may have n antecedents. Each antecedent is a PR_DEF_INTRO. *)
val is_nnf_star : Expr.expr -> bool
(** Indicates whether the term is a proof for (~ P Q) where Q is in conjunctive normal form.
A proof for (~ P Q) where Q is in conjunctive normal form.
This proof object is only used if the parameter PROOF_MODE is 1.
This proof object may have n antecedents. Each antecedent is a PR_DEF_INTRO. *)
val is_cnf_star : Expr.expr -> bool
(** Indicates whether the term is a proof for a Skolemization step
Proof for:

View file

@ -114,15 +114,26 @@ def _symbol2py(ctx, s):
# Hack for having nary functions that can receive one argument that is the
# list of arguments.
# Use this when function takes a single list of arguments
def _get_args(args):
try:
if len(args) == 1 and (isinstance(args[0], tuple) or isinstance(args[0], list)):
try:
if len(args) == 1 and (isinstance(args[0], tuple) or isinstance(args[0], list)):
return args[0]
elif len(args) == 1 and (isinstance(args[0], set) or isinstance(args[0], AstVector)):
elif len(args) == 1 and (isinstance(args[0], set) or isinstance(args[0], AstVector)):
return [arg for arg in args[0]]
else:
return args
except: # len is not necessarily defined when args is not a sequence (use reflection?)
return args
# Use this when function takes multiple arguments
def _get_args_ast_list(args):
try:
if isinstance(args, set) or isinstance(args, AstVector) or isinstance(args, tuple):
return [arg for arg in args]
else:
return args
except: # len is not necessarily defined when args is not a sequence (use reflection?)
except:
return args
def _to_param_value(val):
@ -368,9 +379,6 @@ class AstRef(Z3PPObject):
def __copy__(self):
return self.translate(self.ctx)
def __deepcopy__(self):
return self.translate(self.ctx)
def hash(self):
"""Return a hashcode for the `self`.
@ -2428,7 +2436,7 @@ def is_rational_value(a):
return is_arith(a) and a.is_real() and _is_numeral(a.ctx, a.as_ast())
def is_algebraic_value(a):
"""Return `True` if `a` is an algerbraic value of sort Real.
"""Return `True` if `a` is an algebraic value of sort Real.
>>> is_algebraic_value(RealVal("3/5"))
False
@ -4437,7 +4445,7 @@ class Datatype:
"""Declare constructor named `name` with the given accessors `args`.
Each accessor is a pair `(name, sort)`, where `name` is a string and `sort` a Z3 sort or a reference to the datatypes being declared.
In the followin example `List.declare('cons', ('car', IntSort()), ('cdr', List))`
In the following example `List.declare('cons', ('car', IntSort()), ('cdr', List))`
declares the constructor named `cons` that builds a new List using an integer and a List.
It also declares the accessors `car` and `cdr`. The accessor `car` extracts the integer of a `cons` cell,
and `cdr` the list of a `cons` cell. After all constructors were declared, we use the method create() to create
@ -4451,13 +4459,13 @@ class Datatype:
if __debug__:
_z3_assert(isinstance(name, str), "String expected")
_z3_assert(name != "", "Constructor name cannot be empty")
return self.declare_core(name, "is_" + name, *args)
return self.declare_core(name, "is-" + name, *args)
def __repr__(self):
return "Datatype(%s, %s)" % (self.name, self.constructors)
def create(self):
"""Create a Z3 datatype based on the constructors declared using the mehtod `declare()`.
"""Create a Z3 datatype based on the constructors declared using the method `declare()`.
The function `CreateDatatypes()` must be used to define mutually recursive datatypes.
@ -4575,7 +4583,7 @@ def CreateDatatypes(*ds):
cref = cref()
setattr(dref, cref_name, cref)
rref = dref.recognizer(j)
setattr(dref, rref.name(), rref)
setattr(dref, "is_" + cref_name, rref)
for k in range(cref_arity):
aref = dref.accessor(j, k)
setattr(dref, aref.name(), aref)
@ -4629,16 +4637,16 @@ class DatatypeSortRef(SortRef):
>>> List.num_constructors()
2
>>> List.recognizer(0)
is_cons
is(cons)
>>> List.recognizer(1)
is_nil
is(nil)
>>> simplify(List.is_nil(List.cons(10, List.nil)))
False
>>> simplify(List.is_cons(List.cons(10, List.nil)))
True
>>> l = Const('l', List)
>>> simplify(List.is_cons(l))
is_cons(l)
is(cons, l)
"""
if __debug__:
_z3_assert(idx < self.num_constructors(), "Invalid recognizer index")
@ -6818,8 +6826,8 @@ class FiniteDomainSortRef(SortRef):
def size(self):
"""Return the size of the finite domain sort"""
r = (ctype.c_ulonglong * 1)()
if Z3_get_finite_domain_sort_size(self.ctx_ref(), self.ast(), r):
r = (ctypes.c_ulonglong * 1)()
if Z3_get_finite_domain_sort_size(self.ctx_ref(), self.ast, r):
return r[0]
else:
raise Z3Exception("Failed to retrieve finite domain sort size")
@ -7946,8 +7954,10 @@ def AtLeast(*args):
return BoolRef(Z3_mk_atleast(ctx.ref(), sz, _args, k), ctx)
def _pb_args_coeffs(args):
args = _get_args(args)
def _pb_args_coeffs(args, default_ctx = None):
args = _get_args_ast_list(args)
if len(args) == 0:
return _get_ctx(default_ctx), 0, (Ast * 0)(), (ctypes.c_int * 0)()
args, coeffs = zip(*args)
if __debug__:
_z3_assert(len(args) > 0, "Non empty list of arguments expected")
@ -7979,7 +7989,7 @@ def PbGe(args, k):
ctx, sz, _args, _coeffs = _pb_args_coeffs(args)
return BoolRef(Z3_mk_pbge(ctx.ref(), sz, _args, _coeffs, k), ctx)
def PbEq(args, k):
def PbEq(args, k, ctx = None):
"""Create a Pseudo-Boolean inequality k constraint.
>>> a, b, c = Bools('a b c')
@ -8266,7 +8276,7 @@ def tree_interpolant(pat,p=None,ctx=None):
solver that determines satisfiability.
>>> x = Int('x')
>>> y = Int('y')
>>> y = Int('y')
>>> print(tree_interpolant(And(Interpolant(x < 0), Interpolant(y > 2), x == y)))
[Not(x >= 0), Not(y <= 2)]
@ -8874,7 +8884,7 @@ class FPNumRef(FPRef):
def isSubnormal(self):
return Z3_fpa_is_numeral_subnormal(self.ctx.ref(), self.as_ast())
"""Indicates whether the numeral is postitive."""
"""Indicates whether the numeral is positive."""
def isPositive(self):
return Z3_fpa_is_numeral_positive(self.ctx.ref(), self.as_ast())
@ -9670,7 +9680,7 @@ def fpToIEEEBV(x, ctx=None):
The size of the resulting bit-vector is automatically determined.
Note that IEEE 754-2008 allows multiple different representations of NaN. This conversion
knows only one NaN and it will always produce the same bit-vector represenatation of
knows only one NaN and it will always produce the same bit-vector representation of
that NaN.
>>> x = FP('x', FPSort(8, 24))
@ -9845,7 +9855,7 @@ def Empty(s):
raise Z3Exception("Non-sequence, non-regular expression sort passed to Empty")
def Full(s):
"""Create the regular expression that accepts the universal langauge
"""Create the regular expression that accepts the universal language
>>> e = Full(ReSort(SeqSort(IntSort())))
>>> print(e)
re.all

View file

@ -36,7 +36,7 @@ _z3_op_to_str = {
Z3_OP_CONCAT : 'Concat', Z3_OP_EXTRACT : 'Extract', Z3_OP_BV2INT : 'BV2Int',
Z3_OP_ARRAY_MAP : 'Map', Z3_OP_SELECT : 'Select', Z3_OP_STORE : 'Store',
Z3_OP_CONST_ARRAY : 'K', Z3_OP_ARRAY_EXT : 'Ext',
Z3_OP_PB_AT_MOST : 'AtMost', Z3_OP_PB_LE : 'PbLe', Z3_OP_PB_GE : 'PbGe'
Z3_OP_PB_AT_MOST : 'AtMost', Z3_OP_PB_LE : 'PbLe', Z3_OP_PB_GE : 'PbGe', Z3_OP_PB_EQ : 'PbEq'
}
# List of infix operators
@ -485,7 +485,9 @@ class PP:
raise StopPPException()
def pp(self, f, indent):
if f.is_string():
if isinstance(f, str):
sef.pp_string(f, indent)
elif f.is_string():
self.pp_string(f, indent)
elif f.is_indent():
self.pp(f.child, min(indent + f.indent, self.max_indent))
@ -846,10 +848,17 @@ class Formatter:
else:
return seq1('MultiPattern', [ self.pp_expr(arg, d+1, xs) for arg in a.children() ])
def pp_is(self, a, d, xs):
f = a.params()[0]
return self.pp_fdecl(f, a, d, xs)
def pp_map(self, a, d, xs):
f = z3.get_map_func(a)
return self.pp_fdecl(f, a, d, xs)
def pp_fdecl(self, f, a, d, xs):
r = []
sz = 0
f = z3.get_map_func(a)
r.append(to_format(f.name()))
for child in a.children():
r.append(self.pp_expr(child, d+1, xs))
@ -909,6 +918,8 @@ class Formatter:
return self.pp_unary_param(a, d, xs)
elif k == Z3_OP_EXTRACT:
return self.pp_extract(a, d, xs)
elif k == Z3_OP_DT_IS:
return self.pp_is(a, d, xs)
elif k == Z3_OP_ARRAY_MAP:
return self.pp_map(a, d, xs)
elif k == Z3_OP_CONST_ARRAY:
@ -919,6 +930,8 @@ class Formatter:
return self.pp_pbcmp(a, d, f, xs)
elif k == Z3_OP_PB_GE:
return self.pp_pbcmp(a, d, f, xs)
elif k == Z3_OP_PB_EQ:
return self.pp_pbcmp(a, d, f, xs)
elif z3.is_pattern(a):
return self.pp_pattern(a, d, xs)
elif self.is_infix(k):
@ -963,6 +976,14 @@ class Formatter:
else:
return to_format(self.pp_unknown())
def pp_decl(self, f):
k = f.kind()
if k == Z3_OP_DT_IS or k == Z3_OP_ARRAY_MAP:
g = f.params()[0]
r = [ to_format(g.name()) ]
return seq1(self.pp_name(f), r)
return self.pp_name(f)
def pp_seq_core(self, f, a, d, xs):
self.visited = self.visited + 1
if d > self.max_depth or self.visited > self.max_visited:
@ -1054,7 +1075,7 @@ class Formatter:
elif z3.is_sort(a):
return self.pp_sort(a)
elif z3.is_func_decl(a):
return self.pp_name(a)
return self.pp_decl(a)
elif isinstance(a, z3.Goal) or isinstance(a, z3.AstVector):
return self.pp_seq(a, 0, [])
elif isinstance(a, z3.Solver):

View file

@ -21,7 +21,9 @@ Notes:
#ifndef Z3_H_
#define Z3_H_
#include<stdio.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include "z3_macros.h"
#include "z3_api.h"
#include "z3_ast_containers.h"

View file

@ -31,7 +31,7 @@ extern "C" {
/** @name Algebraic Numbers */
/*@{*/
/**
\brief Return Z3_TRUE if \c can be used as value in the Z3 real algebraic
\brief Return Z3_TRUE if \c a can be used as value in the Z3 real algebraic
number package.
def_API('Z3_algebraic_is_value', BOOL, (_in(CONTEXT), _in(AST)))

View file

@ -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 *}.
@ -459,7 +451,7 @@ typedef enum
[trans T1 T2]: (R t u)
}
- Z3_OP_PR_TRANSITIVITY_STAR: Condensed transitivity proof. This proof object is only used if the parameter PROOF_MODE is 1.
- Z3_OP_PR_TRANSITIVITY_STAR: Condensed transitivity proof.
It combines several symmetry and transitivity proofs.
Example:
@ -539,21 +531,14 @@ typedef enum
}
- Z3_OP_PR_REWRITE_STAR: A proof for rewriting an expression t into an expression s.
This proof object is used if the parameter PROOF_MODE is 1.
This proof object can have n antecedents.
The antecedents are proofs for equalities used as substitution rules.
The object is also used in a few cases if the parameter PROOF_MODE is 2.
The cases are:
The proof rule is used in a few cases. The cases are:
- When applying contextual simplification (CONTEXT_SIMPLIFIER=true)
- When converting bit-vectors to Booleans (BIT2BOOL=true)
- When pulling ite expression up (PULL_CHEAP_ITE_TREES=true)
- Z3_OP_PR_PULL_QUANT: A proof for (iff (f (forall (x) q(x)) r) (forall (x) (f (q x) r))). This proof object has no antecedents.
- Z3_OP_PR_PULL_QUANT_STAR: A proof for (iff P Q) where Q is in prenex normal form.
This proof object is only used if the parameter PROOF_MODE is 1.
This proof object has no antecedents.
- Z3_OP_PR_PUSH_QUANT: A proof for:
\nicebox{
@ -726,15 +711,6 @@ typedef enum
[nnf-neg T1 T2 T3 T4]: (~ (not (iff s_1 s_2))
(and (or r_1 r_2) (or r_1' r_2')))
}
- Z3_OP_PR_NNF_STAR: A proof for (~ P Q) where Q is in negation normal form.
This proof object is only used if the parameter PROOF_MODE is 1.
This proof object may have n antecedents. Each antecedent is a PR_DEF_INTRO.
- Z3_OP_PR_CNF_STAR: A proof for (~ P Q) where Q is in conjunctive normal form.
This proof object is only used if the parameter PROOF_MODE is 1.
This proof object may have n antecedents. Each antecedent is a PR_DEF_INTRO.
- Z3_OP_PR_SKOLEMIZE: Proof for:
@ -876,6 +852,8 @@ typedef enum
- Z3_OP_DT_RECOGNISER: datatype recognizer.
- Z3_OP_DT_IS: datatype recognizer.
- Z3_OP_DT_ACCESSOR: datatype accessor.
- Z3_OP_DT_UPDATE_FIELD: datatype field update.
@ -1140,7 +1118,6 @@ typedef enum {
Z3_OP_PR_REWRITE,
Z3_OP_PR_REWRITE_STAR,
Z3_OP_PR_PULL_QUANT,
Z3_OP_PR_PULL_QUANT_STAR,
Z3_OP_PR_PUSH_QUANT,
Z3_OP_PR_ELIM_UNUSED_VARS,
Z3_OP_PR_DER,
@ -1157,8 +1134,6 @@ typedef enum {
Z3_OP_PR_IFF_OEQ,
Z3_OP_PR_NNF_POS,
Z3_OP_PR_NNF_NEG,
Z3_OP_PR_NNF_STAR,
Z3_OP_PR_CNF_STAR,
Z3_OP_PR_SKOLEMIZE,
Z3_OP_PR_MODUS_PONENS_OEQ,
Z3_OP_PR_TH_LEMMA,
@ -1220,6 +1195,7 @@ typedef enum {
// Datatypes
Z3_OP_DT_CONSTRUCTOR=0x800,
Z3_OP_DT_RECOGNISER,
Z3_OP_DT_IS,
Z3_OP_DT_ACCESSOR,
Z3_OP_DT_UPDATE_FIELD,
@ -1474,7 +1450,6 @@ extern "C" {
/*@{*/
/**
\deprecated
\brief Create a configuration object for the Z3 context object.
Configurations are created in order to assign parameters prior to creating
@ -1507,7 +1482,6 @@ extern "C" {
Z3_config Z3_API Z3_mk_config(void);
/**
\deprecated
\brief Delete the given configuration object.
\sa Z3_mk_config
@ -1517,7 +1491,6 @@ extern "C" {
void Z3_API Z3_del_config(Z3_config c);
/**
\deprecated
\brief Set a configuration parameter.
The following parameters can be set for
@ -1534,7 +1507,6 @@ extern "C" {
/*@{*/
/**
\deprecated
\brief Create a context using the given configuration.
After a context is created, the configuration cannot be changed,
@ -1614,7 +1586,6 @@ extern "C" {
void Z3_API Z3_dec_ref(Z3_context c, Z3_ast a);
/**
\deprecated
\brief Set a value of a context parameter.
\sa Z3_global_param_set
@ -1864,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.
@ -3221,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.
@ -3889,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.
@ -4371,7 +4342,7 @@ extern "C" {
Z3_bool Z3_API Z3_is_numeral_ast(Z3_context c, Z3_ast a);
/**
\brief Return true if the give AST is a real algebraic number.
\brief Return true if the given AST is a real algebraic number.
def_API('Z3_is_algebraic_number', BOOL, (_in(CONTEXT), _in(AST)))
*/
@ -4446,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
@ -4474,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
@ -4482,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
@ -4494,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
@ -4506,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.
@ -5230,6 +5201,17 @@ extern "C" {
Z3_func_decl const decls[]);
/**
\brief Parse and evaluate and SMT-LIB2 command sequence. The state from a previous call is saved so the next
evaluation builds on top of the previous call.
\returns output generated from processing commands.
def_API('Z3_eval_smtlib2_string', STRING, (_in(CONTEXT), _in(STRING),))
*/
Z3_string Z3_API Z3_eval_smtlib2_string(Z3_context, Z3_string str);
/**
\brief Retrieve that last error message information generated from parsing.
@ -6258,7 +6240,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);
/*@}*/

View file

@ -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
@ -756,7 +756,7 @@ extern "C" {
/**
\brief Conversion of a floating-point term into an unsigned bit-vector.
Produces a term that represents the conversion of the floating-poiunt term t into a
Produces a term that represents the conversion of the floating-point term t into a
bit-vector term of size sz in unsigned 2's complement format. If necessary, the result
will be rounded according to rounding mode rm.
@ -772,7 +772,7 @@ extern "C" {
/**
\brief Conversion of a floating-point term into a signed bit-vector.
Produces a term that represents the conversion of the floating-poiunt term t into a
Produces a term that represents the conversion of the floating-point term t into a
bit-vector term of size sz in signed 2's complement format. If necessary, the result
will be rounded according to rounding mode rm.
@ -788,7 +788,7 @@ extern "C" {
/**
\brief Conversion of a floating-point term into a real-numbered term.
Produces a term that represents the conversion of the floating-poiunt term t into a
Produces a term that represents the conversion of the floating-point term t into a
real number. Note that this type of conversion will often result in non-linear
constraints over real terms.
@ -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.
@ -1011,7 +1011,7 @@ extern "C" {
determined.
Note that IEEE 754-2008 allows multiple different representations of NaN. This conversion
knows only one NaN and it will always produce the same bit-vector represenatation of
knows only one NaN and it will always produce the same bit-vector representation of
that NaN.
def_API('Z3_mk_fpa_to_ieee_bv', AST, (_in(CONTEXT),_in(AST)))

View file

@ -98,7 +98,7 @@ extern "C" {
Interpolant may not necessarily be computable from all
proofs. To be sure an interpolant can be computed, the proof
must be generated by an SMT solver for which interpoaltion is
must be generated by an SMT solver for which interpolation is
supported, and the premises must be expressed using only
theories and operators for which interpolation is supported.
@ -199,7 +199,7 @@ extern "C" {
(implies (and c1 ... cn f) v)
where c1 .. cn are the children of v (which must precede v in the file)
and f is the formula assiciated to node v. The last formula in the
and f is the formula associated to node v. The last formula in the
file is the root vertex, and is represented by the predicate "false".
A solution to a tree interpolation problem can be thought of as a

View file

@ -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) {

View file

@ -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);
}

View file

@ -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);

View file

@ -663,7 +663,6 @@ basic_decl_plugin::basic_decl_plugin():
m_not_or_elim_decl(nullptr),
m_rewrite_decl(nullptr),
m_pull_quant_decl(nullptr),
m_pull_quant_star_decl(nullptr),
m_push_quant_decl(nullptr),
m_elim_unused_vars_decl(nullptr),
m_der_decl(nullptr),
@ -827,7 +826,6 @@ func_decl * basic_decl_plugin::mk_proof_decl(basic_op_kind k, unsigned num_paren
case PR_REWRITE: return mk_proof_decl("rewrite", k, 0, m_rewrite_decl);
case PR_REWRITE_STAR: return mk_proof_decl("rewrite*", k, num_parents, m_rewrite_star_decls);
case PR_PULL_QUANT: return mk_proof_decl("pull-quant", k, 0, m_pull_quant_decl);
case PR_PULL_QUANT_STAR: return mk_proof_decl("pull-quant*", k, 0, m_pull_quant_star_decl);
case PR_PUSH_QUANT: return mk_proof_decl("push-quant", k, 0, m_push_quant_decl);
case PR_ELIM_UNUSED_VARS: return mk_proof_decl("elim-unused", k, 0, m_elim_unused_vars_decl);
case PR_DER: return mk_proof_decl("der", k, 0, m_der_decl);
@ -844,8 +842,6 @@ func_decl * basic_decl_plugin::mk_proof_decl(basic_op_kind k, unsigned num_paren
case PR_IFF_OEQ: return mk_proof_decl("iff~", k, 1, m_iff_oeq_decl);
case PR_NNF_POS: return mk_proof_decl("nnf-pos", k, num_parents, m_nnf_pos_decls);
case PR_NNF_NEG: return mk_proof_decl("nnf-neg", k, num_parents, m_nnf_neg_decls);
case PR_NNF_STAR: return mk_proof_decl("nnf*", k, num_parents, m_nnf_star_decls);
case PR_CNF_STAR: return mk_proof_decl("cnf*", k, num_parents, m_cnf_star_decls);
case PR_SKOLEMIZE: return mk_proof_decl("sk", k, 0, m_skolemize_decl);
case PR_MODUS_PONENS_OEQ: return mk_proof_decl("mp~", k, 2, m_mp_oeq_decl);
case PR_TH_LEMMA: return mk_proof_decl("th-lemma", k, num_parents, m_th_lemma_decls);
@ -949,7 +945,6 @@ void basic_decl_plugin::finalize() {
DEC_REF(m_not_or_elim_decl);
DEC_REF(m_rewrite_decl);
DEC_REF(m_pull_quant_decl);
DEC_REF(m_pull_quant_star_decl);
DEC_REF(m_push_quant_decl);
DEC_REF(m_elim_unused_vars_decl);
DEC_REF(m_der_decl);
@ -975,8 +970,6 @@ void basic_decl_plugin::finalize() {
DEC_ARRAY_REF(m_apply_def_decls);
DEC_ARRAY_REF(m_nnf_pos_decls);
DEC_ARRAY_REF(m_nnf_neg_decls);
DEC_ARRAY_REF(m_nnf_star_decls);
DEC_ARRAY_REF(m_cnf_star_decls);
DEC_ARRAY_REF(m_th_lemma_decls);
DEC_REF(m_hyper_res_decl0);
@ -1532,32 +1525,39 @@ void ast_manager::copy_families_plugins(ast_manager const & from) {
tout << "fid: " << fid << " fidname: " << get_family_name(fid) << "\n";
});
ast_translation trans(const_cast<ast_manager&>(from), *this, false);
// Inheriting plugins can create new family ids. Since new family ids are
// assigned in the order that they are created, this can result in differing
// family ids. To avoid this, we first assign all family ids and only then inherit plugins.
for (family_id fid = 0; from.m_family_manager.has_family(fid); fid++) {
SASSERT(from.is_builtin_family_id(fid) == is_builtin_family_id(fid));
SASSERT(!from.is_builtin_family_id(fid) || m_family_manager.has_family(fid));
symbol fid_name = from.get_family_name(fid);
TRACE("copy_families_plugins", tout << "copying: " << fid_name << ", src fid: " << fid
<< ", target has_family: " << m_family_manager.has_family(fid) << "\n";
if (m_family_manager.has_family(fid)) tout << get_family_id(fid_name) << "\n";);
if (!m_family_manager.has_family(fid)) {
family_id new_fid = mk_family_id(fid_name);
(void)new_fid;
TRACE("copy_families_plugins", tout << "new target fid created: " << new_fid << " fid_name: " << fid_name << "\n";);
}
TRACE("copy_families_plugins", tout << "target fid: " << get_family_id(fid_name) << "\n";);
SASSERT(fid == get_family_id(fid_name));
if (from.has_plugin(fid) && !has_plugin(fid)) {
decl_plugin * new_p = from.get_plugin(fid)->mk_fresh();
register_plugin(fid, new_p);
SASSERT(new_p->get_family_id() == fid);
SASSERT(has_plugin(fid));
}
if (from.has_plugin(fid)) {
get_plugin(fid)->inherit(from.get_plugin(fid), trans);
}
SASSERT(from.m_family_manager.has_family(fid) == m_family_manager.has_family(fid));
SASSERT(from.get_family_id(fid_name) == get_family_id(fid_name));
SASSERT(!from.has_plugin(fid) || has_plugin(fid));
symbol fid_name = from.get_family_name(fid);
if (!m_family_manager.has_family(fid)) {
family_id new_fid = mk_family_id(fid_name);
(void)new_fid;
TRACE("copy_families_plugins", tout << "new target fid created: " << new_fid << " fid_name: " << fid_name << "\n";);
}
}
for (family_id fid = 0; from.m_family_manager.has_family(fid); fid++) {
SASSERT(from.is_builtin_family_id(fid) == is_builtin_family_id(fid));
SASSERT(!from.is_builtin_family_id(fid) || m_family_manager.has_family(fid));
symbol fid_name = from.get_family_name(fid);
(void)fid_name;
TRACE("copy_families_plugins", tout << "copying: " << fid_name << ", src fid: " << fid
<< ", target has_family: " << m_family_manager.has_family(fid) << "\n";
if (m_family_manager.has_family(fid)) tout << get_family_id(fid_name) << "\n";);
TRACE("copy_families_plugins", tout << "target fid: " << get_family_id(fid_name) << "\n";);
SASSERT(fid == get_family_id(fid_name));
if (from.has_plugin(fid) && !has_plugin(fid)) {
decl_plugin * new_p = from.get_plugin(fid)->mk_fresh();
register_plugin(fid, new_p);
SASSERT(new_p->get_family_id() == fid);
SASSERT(has_plugin(fid));
}
if (from.has_plugin(fid)) {
get_plugin(fid)->inherit(from.get_plugin(fid), trans);
}
SASSERT(from.m_family_manager.has_family(fid) == m_family_manager.has_family(fid));
SASSERT(from.get_family_id(fid_name) == get_family_id(fid_name));
SASSERT(!from.has_plugin(fid) || has_plugin(fid));
}
}
@ -2837,12 +2837,6 @@ proof * ast_manager::mk_pull_quant(expr * e, quantifier * q) {
return mk_app(m_basic_family_id, PR_PULL_QUANT, mk_iff(e, q));
}
proof * ast_manager::mk_pull_quant_star(expr * e, quantifier * q) {
if (proofs_disabled())
return nullptr;
return mk_app(m_basic_family_id, PR_PULL_QUANT_STAR, mk_iff(e, q));
}
proof * ast_manager::mk_push_quant(quantifier * q, expr * e) {
if (proofs_disabled())
return nullptr;
@ -3087,15 +3081,6 @@ proof * ast_manager::mk_nnf_neg(expr * s, expr * t, unsigned num_proofs, proof *
return mk_app(m_basic_family_id, PR_NNF_NEG, args.size(), args.c_ptr());
}
proof * ast_manager::mk_nnf_star(expr * s, expr * t, unsigned num_proofs, proof * const * proofs) {
if (proofs_disabled())
return nullptr;
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_oeq(s, t));
return mk_app(m_basic_family_id, PR_NNF_STAR, args.size(), args.c_ptr());
}
proof * ast_manager::mk_skolemization(expr * q, expr * e) {
if (proofs_disabled())
return nullptr;
@ -3104,15 +3089,6 @@ proof * ast_manager::mk_skolemization(expr * q, expr * e) {
return mk_app(m_basic_family_id, PR_SKOLEMIZE, mk_oeq(q, e));
}
proof * ast_manager::mk_cnf_star(expr * s, expr * t, unsigned num_proofs, proof * const * proofs) {
if (proofs_disabled())
return nullptr;
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_oeq(s, t));
return mk_app(m_basic_family_id, PR_CNF_STAR, args.size(), args.c_ptr());
}
proof * ast_manager::mk_and_elim(proof * p, unsigned i) {
if (proofs_disabled())
return nullptr;

View file

@ -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) {
}
@ -1042,11 +1042,11 @@ enum basic_op_kind {
PR_UNDEF, PR_TRUE, PR_ASSERTED, PR_GOAL, PR_MODUS_PONENS, PR_REFLEXIVITY, PR_SYMMETRY, PR_TRANSITIVITY, PR_TRANSITIVITY_STAR, PR_MONOTONICITY, PR_QUANT_INTRO,
PR_DISTRIBUTIVITY, PR_AND_ELIM, PR_NOT_OR_ELIM, PR_REWRITE, PR_REWRITE_STAR, PR_PULL_QUANT,
PR_PULL_QUANT_STAR, PR_PUSH_QUANT, PR_ELIM_UNUSED_VARS, PR_DER, PR_QUANT_INST,
PR_PUSH_QUANT, PR_ELIM_UNUSED_VARS, PR_DER, PR_QUANT_INST,
PR_HYPOTHESIS, PR_LEMMA, PR_UNIT_RESOLUTION, PR_IFF_TRUE, PR_IFF_FALSE, PR_COMMUTATIVITY, PR_DEF_AXIOM,
PR_DEF_INTRO, PR_APPLY_DEF, PR_IFF_OEQ, PR_NNF_POS, PR_NNF_NEG, PR_NNF_STAR, PR_SKOLEMIZE, PR_CNF_STAR,
PR_DEF_INTRO, PR_APPLY_DEF, PR_IFF_OEQ, PR_NNF_POS, PR_NNF_NEG, PR_SKOLEMIZE,
PR_MODUS_PONENS_OEQ, PR_TH_LEMMA, PR_HYPER_RESOLVE, LAST_BASIC_PR
};
@ -1080,7 +1080,6 @@ protected:
func_decl * m_not_or_elim_decl;
func_decl * m_rewrite_decl;
func_decl * m_pull_quant_decl;
func_decl * m_pull_quant_star_decl;
func_decl * m_push_quant_decl;
func_decl * m_elim_unused_vars_decl;
func_decl * m_der_decl;
@ -1106,8 +1105,6 @@ protected:
ptr_vector<func_decl> m_apply_def_decls;
ptr_vector<func_decl> m_nnf_pos_decls;
ptr_vector<func_decl> m_nnf_neg_decls;
ptr_vector<func_decl> m_nnf_star_decls;
ptr_vector<func_decl> m_cnf_star_decls;
ptr_vector<func_decl> m_th_lemma_decls;
func_decl * m_hyper_res_decl0;
@ -2182,7 +2179,6 @@ public:
proof * mk_oeq_rewrite(expr * s, expr * t);
proof * mk_rewrite_star(expr * s, expr * t, unsigned num_proofs, proof * const * proofs);
proof * mk_pull_quant(expr * e, quantifier * q);
proof * mk_pull_quant_star(expr * e, quantifier * q);
proof * mk_push_quant(quantifier * q, expr * e);
proof * mk_elim_unused_vars(quantifier * q, expr * r);
proof * mk_der(quantifier * q, expr * r);
@ -2201,9 +2197,8 @@ public:
proof * mk_nnf_pos(expr * s, expr * t, unsigned num_proofs, proof * const * proofs);
proof * mk_nnf_neg(expr * s, expr * t, unsigned num_proofs, proof * const * proofs);
proof * mk_nnf_star(expr * s, expr * t, unsigned num_proofs, proof * const * proofs);
proof * mk_skolemization(expr * q, expr * e);
proof * mk_cnf_star(expr * s, expr * t, unsigned num_proofs, proof * const * proofs);
proof * mk_and_elim(proof * p, unsigned i);
proof * mk_not_or_elim(proof * p, unsigned i);

View file

@ -46,13 +46,18 @@ void ast_pp_util::display_decls(std::ostream& out) {
n = coll.get_num_decls();
for (unsigned i = 0; i < n; ++i) {
func_decl* f = coll.get_func_decls()[i];
if (f->get_family_id() == null_family_id) {
if (f->get_family_id() == null_family_id && !m_removed.contains(f)) {
ast_smt2_pp(out, f, env);
out << "\n";
}
}
}
void ast_pp_util::remove_decl(func_decl* f) {
m_removed.insert(f);
}
void ast_pp_util::display_asserts(std::ostream& out, expr_ref_vector const& fmls, bool neat) {
if (neat) {
smt2_pp_environment_dbg env(m);

View file

@ -20,9 +20,11 @@ Revision History:
#define AST_PP_UTIL_H_
#include "ast/decl_collector.h"
#include "util/obj_hashtable.h"
class ast_pp_util {
ast_manager& m;
obj_hashtable<func_decl> m_removed;
public:
decl_collector coll;
@ -35,6 +37,8 @@ class ast_pp_util {
void collect(expr_ref_vector const& es);
void remove_decl(func_decl* f);
void display_decls(std::ostream& out);
void display_asserts(std::ostream& out, expr_ref_vector const& fmls, bool neat = true);

View file

@ -387,7 +387,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;

View file

@ -952,6 +952,10 @@ void ast_smt_pp::display_smt2(std::ostream& strm, expr* n) {
strm << "; " << m_attributes.c_str();
}
#if 0
decls.display_decls(strm);
#else
decls.order_deps();
ast_mark sort_mark;
for (unsigned i = 0; i < decls.get_num_sorts(); ++i) {
sort* s = decls.get_sorts()[i];
@ -978,18 +982,19 @@ void ast_smt_pp::display_smt2(std::ostream& strm, expr* n) {
strm << "\n";
}
}
#endif
for (unsigned i = 0; i < m_assumptions.size(); ++i) {
for (expr* a : m_assumptions) {
smt_printer p(strm, m, ql, rn, m_logic, false, true, m_simplify_implies, 1);
strm << "(assert\n ";
p(m_assumptions[i].get());
p(a);
strm << ")\n";
}
for (unsigned i = 0; i < m_assumptions_star.size(); ++i) {
for (expr* a : m_assumptions_star) {
smt_printer p(strm, m, ql, rn, m_logic, false, true, m_simplify_implies, 1);
strm << "(assert\n ";
p(m_assumptions_star[i].get());
p(a);
strm << ")\n";
}

View file

@ -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 {

View file

@ -791,6 +791,14 @@ namespace datatype {
return res;
}
func_decl * util::get_constructor_is(func_decl * con) {
SASSERT(is_constructor(con));
sort * datatype = con->get_range();
parameter ps[1] = { parameter(con)};
return m.mk_func_decl(m_family_id, OP_DT_IS, 1, ps, 1, &datatype);
}
func_decl * util::get_constructor_recognizer(func_decl * con) {
SASSERT(is_constructor(con));
func_decl * d = nullptr;
@ -813,6 +821,10 @@ namespace datatype {
return d;
}
app* util::mk_is(func_decl * c, expr *f) {
return m.mk_app(get_constructor_is(c), 1, &f);
}
func_decl * util::get_recognizer_constructor(func_decl * recognizer) const {
SASSERT(is_recognizer(recognizer));
return to_func_decl(recognizer->get_parameter(0).get_ast());
@ -1040,15 +1052,11 @@ namespace datatype {
sort* s = todo.back();
todo.pop_back();
out << s->get_name() << " =\n";
ptr_vector<func_decl> const& cnstrs = *get_datatype_constructors(s);
for (unsigned i = 0; i < cnstrs.size(); ++i) {
func_decl* cns = cnstrs[i];
func_decl* rec = get_constructor_recognizer(cns);
out << " " << cns->get_name() << " :: " << rec->get_name() << " :: ";
for (func_decl * cns : cnstrs) {
out << " " << cns->get_name() << " :: ";
ptr_vector<func_decl> const & accs = *get_constructor_accessors(cns);
for (unsigned j = 0; j < accs.size(); ++j) {
func_decl* acc = accs[j];
for (func_decl* acc : accs) {
sort* s1 = acc->get_range();
out << "(" << acc->get_name() << ": " << s1->get_name() << ") ";
if (is_datatype(s1) && are_siblings(s1, s0) && !mark.is_marked(s1)) {

View file

@ -362,12 +362,14 @@ namespace datatype {
bool is_recognizer(app * f) const { return is_recognizer0(f) || is_is(f); }
bool is_accessor(app * f) const { return is_app_of(f, m_family_id, OP_DT_ACCESSOR); }
bool is_update_field(app * f) const { return is_app_of(f, m_family_id, OP_DT_UPDATE_FIELD); }
app* mk_is(func_decl * c, expr *f);
ptr_vector<func_decl> const * get_datatype_constructors(sort * ty);
unsigned get_datatype_num_constructors(sort * ty);
unsigned get_datatype_num_parameter_sorts(sort * ty);
sort* get_datatype_parameter_sort(sort * ty, unsigned idx);
func_decl * get_non_rec_constructor(sort * ty);
func_decl * get_constructor_recognizer(func_decl * constructor);
func_decl * get_constructor_is(func_decl * constructor);
ptr_vector<func_decl> const * get_constructor_accessors(func_decl * constructor);
func_decl * get_accessor_constructor(func_decl * accessor);
func_decl * get_recognizer_constructor(func_decl * recognizer) const;

View file

@ -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();

View file

@ -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);

View file

@ -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));
}
}
}

View file

@ -25,7 +25,7 @@ Notes:
#include "ast/fpa/fpa2bv_converter.h"
#include "ast/rewriter/fpa_rewriter.h"
#define BVULT(X,Y,R) { expr_ref bvult_eq(m), bvult_not(m); m_simp.mk_eq(X, Y, bvult_eq); m_simp.mk_not(bvult_eq, bvult_not); expr_ref t(m); t = m_bv_util.mk_ule(X,Y); m_simp.mk_and(t, bvult_not, R); }
#define BVULT(X,Y,R) { expr_ref t(m); t = m_bv_util.mk_ule(Y,X); m_simp.mk_not(t, R); }
fpa2bv_converter::fpa2bv_converter(ast_manager & m) :
m(m),
@ -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);
@ -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);
@ -3241,18 +3242,30 @@ 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);
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));
in_range = m.mk_and(m.mk_not(x_is_neg), 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));
ovfl = m.mk_or(ovfl, m_bv_util.mk_sle(pre_rounded, 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);

View file

@ -440,16 +440,6 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
IF_VERBOSE(0, verbose_stream() << "Expected proof of equivalence with a quantifier:\n" << mk_bounded_pp(p, m););
return false;
}
case PR_PULL_QUANT_STAR: {
if (match_proof(p) &&
match_fact(p, fact) &&
match_iff(fact.get(), t1, t2)) {
// TBD: check the enchilada.
return true;
}
IF_VERBOSE(0, verbose_stream() << "Expected proof of equivalence:\n" << mk_bounded_pp(p, m););
return false;
}
case PR_PUSH_QUANT: {
if (match_proof(p) &&
match_fact(p, fact) &&
@ -730,10 +720,6 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
// TBD:
return true;
}
case PR_NNF_STAR: {
// TBD:
return true;
}
case PR_SKOLEMIZE: {
// (exists ?x (p ?x y)) -> (p (sk y) y)
// (not (forall ?x (p ?x y))) -> (not (p (sk y) y))
@ -755,19 +741,6 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) {
UNREACHABLE();
return false;
}
case PR_CNF_STAR: {
for (unsigned i = 0; i < proofs.size(); ++i) {
if (match_op(proofs[i].get(), PR_DEF_INTRO, terms)) {
// ok
}
else {
UNREACHABLE();
return false;
}
}
// coarse grain CNF conversion.
return true;
}
case PR_MODUS_PONENS_OEQ: {
if (match_fact(p, fact) &&
match_proof(p, p0, p1) &&
@ -922,7 +895,7 @@ void proof_checker::set_false(expr_ref& e, unsigned position, expr_ref& lit) {
}
}
bool proof_checker::match_fact(proof* p, expr_ref& fact) {
bool proof_checker::match_fact(proof const* p, expr_ref& fact) const {
if (m.is_proof(p) &&
m.has_fact(p)) {
fact = m.get_fact(p);
@ -938,13 +911,13 @@ void proof_checker::add_premise(proof* p) {
}
}
bool proof_checker::match_proof(proof* p) {
bool proof_checker::match_proof(proof const* p) const {
return
m.is_proof(p) &&
m.get_num_parents(p) == 0;
}
bool proof_checker::match_proof(proof* p, proof_ref& p0) {
bool proof_checker::match_proof(proof const* p, proof_ref& p0) const {
if (m.is_proof(p) &&
m.get_num_parents(p) == 1) {
p0 = m.get_parent(p, 0);
@ -953,7 +926,7 @@ bool proof_checker::match_proof(proof* p, proof_ref& p0) {
return false;
}
bool proof_checker::match_proof(proof* p, proof_ref& p0, proof_ref& p1) {
bool proof_checker::match_proof(proof const* p, proof_ref& p0, proof_ref& p1) const {
if (m.is_proof(p) &&
m.get_num_parents(p) == 2) {
p0 = m.get_parent(p, 0);
@ -963,7 +936,7 @@ bool proof_checker::match_proof(proof* p, proof_ref& p0, proof_ref& p1) {
return false;
}
bool proof_checker::match_proof(proof* p, proof_ref_vector& parents) {
bool proof_checker::match_proof(proof const* p, proof_ref_vector& parents) const {
if (m.is_proof(p)) {
for (unsigned i = 0; i < m.get_num_parents(p); ++i) {
parents.push_back(m.get_parent(p, i));
@ -974,7 +947,7 @@ bool proof_checker::match_proof(proof* p, proof_ref_vector& parents) {
}
bool proof_checker::match_binary(expr* e, func_decl_ref& d, expr_ref& t1, expr_ref& t2) {
bool proof_checker::match_binary(expr const* e, func_decl_ref& d, expr_ref& t1, expr_ref& t2) const {
if (e->get_kind() == AST_APP &&
to_app(e)->get_num_args() == 2) {
d = to_app(e)->get_decl();
@ -986,7 +959,7 @@ bool proof_checker::match_binary(expr* e, func_decl_ref& d, expr_ref& t1, expr_r
}
bool proof_checker::match_app(expr* e, func_decl_ref& d, expr_ref_vector& terms) {
bool proof_checker::match_app(expr const* e, func_decl_ref& d, expr_ref_vector& terms) const {
if (e->get_kind() == AST_APP) {
d = to_app(e)->get_decl();
for (unsigned i = 0; i < to_app(e)->get_num_args(); ++i) {
@ -997,9 +970,9 @@ bool proof_checker::match_app(expr* e, func_decl_ref& d, expr_ref_vector& terms)
return false;
}
bool proof_checker::match_quantifier(expr* e, bool& is_univ, sort_ref_vector& sorts, expr_ref& body) {
bool proof_checker::match_quantifier(expr const* e, bool& is_univ, sort_ref_vector& sorts, expr_ref& body) const {
if (is_quantifier(e)) {
quantifier* q = to_quantifier(e);
quantifier const* q = to_quantifier(e);
is_univ = q->is_forall();
body = q->get_expr();
for (unsigned i = 0; i < q->get_num_decls(); ++i) {
@ -1010,7 +983,7 @@ bool proof_checker::match_quantifier(expr* e, bool& is_univ, sort_ref_vector& so
return false;
}
bool proof_checker::match_op(expr* e, decl_kind k, expr_ref& t1, expr_ref& t2) {
bool proof_checker::match_op(expr const* e, decl_kind k, expr_ref& t1, expr_ref& t2) const {
if (e->get_kind() == AST_APP &&
to_app(e)->get_family_id() == m.get_basic_family_id() &&
to_app(e)->get_decl_kind() == k &&
@ -1022,7 +995,7 @@ bool proof_checker::match_op(expr* e, decl_kind k, expr_ref& t1, expr_ref& t2) {
return false;
}
bool proof_checker::match_op(expr* e, decl_kind k, expr_ref_vector& terms) {
bool proof_checker::match_op(expr const* e, decl_kind k, expr_ref_vector& terms) const {
if (e->get_kind() == AST_APP &&
to_app(e)->get_family_id() == m.get_basic_family_id() &&
to_app(e)->get_decl_kind() == k) {
@ -1035,7 +1008,7 @@ bool proof_checker::match_op(expr* e, decl_kind k, expr_ref_vector& terms) {
}
bool proof_checker::match_op(expr* e, decl_kind k, expr_ref& t) {
bool proof_checker::match_op(expr const* e, decl_kind k, expr_ref& t) const {
if (e->get_kind() == AST_APP &&
to_app(e)->get_family_id() == m.get_basic_family_id() &&
to_app(e)->get_decl_kind() == k &&
@ -1046,39 +1019,39 @@ bool proof_checker::match_op(expr* e, decl_kind k, expr_ref& t) {
return false;
}
bool proof_checker::match_not(expr* e, expr_ref& t) {
bool proof_checker::match_not(expr const* e, expr_ref& t) const {
return match_op(e, OP_NOT, t);
}
bool proof_checker::match_or(expr* e, expr_ref_vector& terms) {
bool proof_checker::match_or(expr const* e, expr_ref_vector& terms) const {
return match_op(e, OP_OR, terms);
}
bool proof_checker::match_and(expr* e, expr_ref_vector& terms) {
bool proof_checker::match_and(expr const* e, expr_ref_vector& terms) const {
return match_op(e, OP_AND, terms);
}
bool proof_checker::match_iff(expr* e, expr_ref& t1, expr_ref& t2) {
bool proof_checker::match_iff(expr const* e, expr_ref& t1, expr_ref& t2) const {
return match_op(e, OP_IFF, t1, t2);
}
bool proof_checker::match_equiv(expr* e, expr_ref& t1, expr_ref& t2) {
bool proof_checker::match_equiv(expr const* e, expr_ref& t1, expr_ref& t2) const {
return match_oeq(e, t1, t2) || match_eq(e, t1, t2);
}
bool proof_checker::match_implies(expr* e, expr_ref& t1, expr_ref& t2) {
bool proof_checker::match_implies(expr const* e, expr_ref& t1, expr_ref& t2) const {
return match_op(e, OP_IMPLIES, t1, t2);
}
bool proof_checker::match_eq(expr* e, expr_ref& t1, expr_ref& t2) {
bool proof_checker::match_eq(expr const* e, expr_ref& t1, expr_ref& t2) const {
return match_op(e, OP_EQ, t1, t2) || match_iff(e, t1, t2);
}
bool proof_checker::match_oeq(expr* e, expr_ref& t1, expr_ref& t2) {
bool proof_checker::match_oeq(expr const* e, expr_ref& t1, expr_ref& t2) const {
return match_op(e, OP_OEQ, t1, t2);
}
bool proof_checker::match_negated(expr* a, expr* b) {
bool proof_checker::match_negated(expr const* a, expr* b) const {
expr_ref t(m);
return
(match_not(a, t) && t.get() == b) ||
@ -1186,14 +1159,14 @@ void proof_checker::get_hypotheses(proof* p, expr_ref_vector& ante) {
}
bool proof_checker::match_nil(expr* e) const {
bool proof_checker::match_nil(expr const* e) const {
return
is_app(e) &&
to_app(e)->get_family_id() == m_hyp_fid &&
to_app(e)->get_decl_kind() == OP_NIL;
}
bool proof_checker::match_cons(expr* e, expr_ref& a, expr_ref& b) const {
bool proof_checker::match_cons(expr const* e, expr_ref& a, expr_ref& b) const {
if (is_app(e) &&
to_app(e)->get_family_id() == m_hyp_fid &&
to_app(e)->get_decl_kind() == OP_CONS) {
@ -1205,7 +1178,7 @@ bool proof_checker::match_cons(expr* e, expr_ref& a, expr_ref& b) const {
}
bool proof_checker::match_atom(expr* e, expr_ref& a) const {
bool proof_checker::match_atom(expr const* e, expr_ref& a) const {
if (is_app(e) &&
to_app(e)->get_family_id() == m_hyp_fid &&
to_app(e)->get_decl_kind() == OP_ATOM) {
@ -1227,7 +1200,7 @@ expr* proof_checker::mk_nil() {
return m_nil.get();
}
bool proof_checker::is_hypothesis(proof* p) const {
bool proof_checker::is_hypothesis(proof const* p) const {
return
m.is_proof(p) &&
p->get_decl_kind() == PR_HYPOTHESIS;
@ -1253,7 +1226,7 @@ expr* proof_checker::mk_hyp(unsigned num_hyps, expr * const * hyps) {
}
}
void proof_checker::dump_proof(proof * pr) {
void proof_checker::dump_proof(proof const* pr) {
if (!m_dump_lemmas)
return;
SASSERT(m.has_fact(pr));

View file

@ -77,39 +77,39 @@ private:
bool check1_spc(proof* p, expr_ref_vector& side_conditions);
bool check_arith_proof(proof* p);
bool check_arith_literal(bool is_pos, app* lit, rational const& coeff, expr_ref& sum, bool& is_strict);
bool match_fact(proof* p, expr_ref& fact);
bool match_fact(proof const* p, expr_ref& fact) const;
void add_premise(proof* p);
bool match_proof(proof* p);
bool match_proof(proof* p, proof_ref& p0);
bool match_proof(proof* p, proof_ref& p0, proof_ref& p1);
bool match_proof(proof* p, proof_ref_vector& parents);
bool match_binary(expr* e, func_decl_ref& d, expr_ref& t1, expr_ref& t2);
bool match_op(expr* e, decl_kind k, expr_ref& t1, expr_ref& t2);
bool match_op(expr* e, decl_kind k, expr_ref& t);
bool match_op(expr* e, decl_kind k, expr_ref_vector& terms);
bool match_iff(expr* e, expr_ref& t1, expr_ref& t2);
bool match_implies(expr* e, expr_ref& t1, expr_ref& t2);
bool match_eq(expr* e, expr_ref& t1, expr_ref& t2);
bool match_oeq(expr* e, expr_ref& t1, expr_ref& t2);
bool match_not(expr* e, expr_ref& t);
bool match_or(expr* e, expr_ref_vector& terms);
bool match_and(expr* e, expr_ref_vector& terms);
bool match_app(expr* e, func_decl_ref& d, expr_ref_vector& terms);
bool match_quantifier(expr*, bool& is_univ, sort_ref_vector&, expr_ref& body);
bool match_negated(expr* a, expr* b);
bool match_equiv(expr* a, expr_ref& t1, expr_ref& t2);
bool match_proof(proof const* p) const;
bool match_proof(proof const* p, proof_ref& p0) const;
bool match_proof(proof const* p, proof_ref& p0, proof_ref& p1) const;
bool match_proof(proof const* p, proof_ref_vector& parents) const;
bool match_binary(expr const* e, func_decl_ref& d, expr_ref& t1, expr_ref& t2) const;
bool match_op(expr const* e, decl_kind k, expr_ref& t1, expr_ref& t2) const;
bool match_op(expr const* e, decl_kind k, expr_ref& t) const;
bool match_op(expr const* e, decl_kind k, expr_ref_vector& terms) const;
bool match_iff(expr const* e, expr_ref& t1, expr_ref& t2) const;
bool match_implies(expr const* e, expr_ref& t1, expr_ref& t2) const;
bool match_eq(expr const* e, expr_ref& t1, expr_ref& t2) const;
bool match_oeq(expr const* e, expr_ref& t1, expr_ref& t2) const;
bool match_not(expr const* e, expr_ref& t) const;
bool match_or(expr const* e, expr_ref_vector& terms) const;
bool match_and(expr const* e, expr_ref_vector& terms) const;
bool match_app(expr const* e, func_decl_ref& d, expr_ref_vector& terms) const;
bool match_quantifier(expr const*, bool& is_univ, sort_ref_vector&, expr_ref& body) const;
bool match_negated(expr const* a, expr* b) const;
bool match_equiv(expr const* a, expr_ref& t1, expr_ref& t2) const;
void get_ors(expr* e, expr_ref_vector& ors);
void get_hypotheses(proof* p, expr_ref_vector& ante);
bool match_nil(expr* e) const;
bool match_cons(expr* e, expr_ref& a, expr_ref& b) const;
bool match_atom(expr* e, expr_ref& a) const;
bool match_nil(expr const* e) const;
bool match_cons(expr const* e, expr_ref& a, expr_ref& b) const;
bool match_atom(expr const* e, expr_ref& a) const;
expr* mk_nil();
expr* mk_cons(expr* a, expr* b);
expr* mk_atom(expr* e);
bool is_hypothesis(proof* p) const;
bool is_hypothesis(proof const* p) const;
expr* mk_hyp(unsigned num_hyps, expr * const * hyps);
void dump_proof(proof * pr);
void dump_proof(proof const* pr);
void dump_proof(unsigned num_antecedents, expr * const * antecedents, expr * consequent);
void set_false(expr_ref& e, unsigned idx, expr_ref& lit);

View file

@ -25,7 +25,6 @@ z3_add_component(rewriter
pb_rewriter.cpp
pb2bv_rewriter.cpp
push_app_ite.cpp
pull_ite_tree.cpp
quant_hoist.cpp
rewriter.cpp
seq_rewriter.cpp

View file

@ -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;

View file

@ -23,6 +23,9 @@ br_status datatype_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr
switch(f->get_decl_kind()) {
case OP_DT_CONSTRUCTOR: return BR_FAILED;
case OP_DT_RECOGNISER:
SASSERT(num_args == 1);
result = m_util.mk_is(m_util.get_recognizer_constructor(f), args[0]);
return BR_REWRITE1;
case OP_DT_IS:
//
// simplify is_cons(cons(x,y)) -> true

View file

@ -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) &&

View file

@ -1,221 +0,0 @@
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
pull_ite_tree.cpp
Abstract:
<abstract>
Author:
Leonardo de Moura (leonardo) 2008-06-22.
Revision History:
--*/
#include "ast/rewriter/pull_ite_tree.h"
#include "ast/recurse_expr_def.h"
#include "ast/for_each_expr.h"
#include "ast/ast_pp.h"
pull_ite_tree::pull_ite_tree(ast_manager & m):
m_manager(m),
m_rewriter(m),
m_cache(m) {
}
void pull_ite_tree::cache_result(expr * n, expr * r, proof * pr) {
m_cache.insert(n, r, pr);
}
void pull_ite_tree::visit(expr * n, bool & visited) {
if (!is_cached(n)) {
m_todo.push_back(n);
visited = false;
}
}
bool pull_ite_tree::visit_children(expr * n) {
if (m_manager.is_ite(n)) {
bool visited = true;
visit(to_app(n)->get_arg(1), visited);
visit(to_app(n)->get_arg(2), visited);
return visited;
}
else {
return true;
}
}
void pull_ite_tree::reduce(expr * n) {
// Remark: invoking the simplifier to build the new expression saves a lot of memory.
if (m_manager.is_ite(n)) {
expr * c = to_app(n)->get_arg(0);
expr * t_old = to_app(n)->get_arg(1);
expr * e_old = to_app(n)->get_arg(2);
expr * t = nullptr;
proof * t_pr = nullptr;
expr * e = nullptr;
proof * e_pr = nullptr;
get_cached(t_old, t, t_pr);
get_cached(e_old, e, e_pr);
expr_ref r(m_manager);
expr * args[3] = {c, t, e};
r = m_rewriter.mk_app(to_app(n)->get_decl(), 3, args);
if (!m_manager.proofs_enabled()) {
// expr * r = m_manager.mk_ite(c, t, e);
cache_result(n, r, nullptr);
}
else {
// t_pr is a proof for (m_p ... t_old ...) == t
// e_pr is a proof for (m_p ... e_old ...) == e
expr_ref old(m_manager);
expr_ref p_t_old(m_manager);
expr_ref p_e_old(m_manager);
old = mk_p_arg(n); // (m_p ... n ...) where n is (ite c t_old e_old)
p_t_old = mk_p_arg(t_old); // (m_p ... t_old ...)
p_e_old = mk_p_arg(e_old); // (m_p ... e_old ...)
expr_ref tmp1(m_manager);
tmp1 = m_manager.mk_ite(c, p_t_old, p_e_old); // (ite c (m_p ... t_old ...) (m_p ... e_old ...))
proof * pr1 = m_manager.mk_rewrite(old, tmp1); // proof for (m_p ... (ite c t_old e_old) ...) = (ite c (m_p ... t_old ...) (m_p ... e_old ...))
expr_ref tmp2(m_manager);
tmp2 = m_manager.mk_ite(c, t, e); // (ite c t e)
proof * pr2 = nullptr; // it will contain a proof for (ite c (m_p ... t_old ...) (m_p ... e_old ...)) = (ite c t e)
proof * pr3 = nullptr; // it will contain a proof for (m_p ... (ite c t_old e_old) ...) = (ite c t e)
proof * proofs[2];
unsigned num_proofs = 0;
if (t_pr != nullptr) {
proofs[num_proofs] = t_pr;
num_proofs++;
}
if (e_pr != nullptr) {
proofs[num_proofs] = e_pr;
num_proofs++;
}
if (num_proofs > 0) {
pr2 = m_manager.mk_congruence(to_app(tmp1), to_app(tmp2), num_proofs, proofs);
pr3 = m_manager.mk_transitivity(pr1, pr2);
}
else {
pr3 = pr1;
}
proof * pr4 = nullptr; // it will contain a proof for (ite c t e) = r
proof * pr5 = nullptr; // it will contain a proof for (m_p ... (ite c t_old e_old) ...) = r
if (tmp2 != r) {
pr4 = m_manager.mk_rewrite(tmp2, r);
pr5 = m_manager.mk_transitivity(pr3, pr4);
}
else {
pr5 = pr3;
}
cache_result(n, r, pr5);
}
}
else {
expr_ref r(m_manager);
m_args[m_arg_idx] = n;
r = m_rewriter.mk_app(m_p, m_args.size(), m_args.c_ptr());
if (!m_manager.proofs_enabled()) {
// expr * r = m_manager.mk_app(m_p, m_args.size(), m_args.c_ptr());
cache_result(n, r, nullptr);
}
else {
expr_ref old(m_manager);
proof * p;
old = mk_p_arg(n);
if (old == r)
p = nullptr;
else
p = m_manager.mk_rewrite(old, r);
cache_result(n, r, p);
}
}
}
void pull_ite_tree::operator()(app * n, app_ref & r, proof_ref & pr) {
unsigned num_args = n->get_num_args();
m_args.resize(num_args);
m_p = n->get_decl();
expr * ite = nullptr;
for (unsigned i = 0; i < num_args; i++) {
expr * arg = n->get_arg(i);
if (ite) {
m_args[i] = arg;
}
else if (m_manager.is_ite(arg)) {
m_arg_idx = i;
m_args[i] = 0;
ite = arg;
}
else {
m_args[i] = arg;
}
}
if (!ite) {
r = n;
pr = nullptr;
return;
}
m_todo.push_back(ite);
while (!m_todo.empty()) {
expr * n = m_todo.back();
if (is_cached(n))
m_todo.pop_back();
else if (visit_children(n)) {
m_todo.pop_back();
reduce(n);
}
}
SASSERT(is_cached(ite));
expr * _r = nullptr;
proof * _pr = nullptr;
get_cached(ite, _r, _pr);
r = to_app(_r);
pr = _pr;
m_cache.reset();
m_todo.reset();
}
pull_ite_tree_cfg::pull_ite_tree_cfg(ast_manager & m):
m(m),
m_trail(m),
m_proc(m) {
}
bool pull_ite_tree_cfg::get_subst(expr * n, expr* & r, proof* & p) {
if (is_app(n) && is_target(to_app(n))) {
app_ref tmp(m);
proof_ref pr(m);
m_proc(to_app(n), tmp, pr);
if (tmp != n) {
r = tmp;
p = pr;
m_trail.push_back(r);
m_trail.push_back(p);
return true;
}
}
return false;
}
bool pull_cheap_ite_tree_cfg::is_target(app * n) const {
bool r =
n->get_num_args() == 2 &&
n->get_family_id() != null_family_id &&
m.is_bool(n) &&
(m.is_value(n->get_arg(0)) || m.is_value(n->get_arg(1))) &&
(m.is_term_ite(n->get_arg(0)) || m.is_term_ite(n->get_arg(1)));
TRACE("pull_ite_target", tout << mk_pp(n, m) << "\nresult: " << r << "\n";);
return r;
}

View file

@ -1,113 +0,0 @@
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
pull_ite_tree.h
Abstract:
<abstract>
Author:
Leonardo de Moura (leonardo) 2008-06-22.
Revision History:
--*/
#ifndef PULL_ITE_TREE_H_
#define PULL_ITE_TREE_H_
#include "ast/ast.h"
#include "ast/rewriter/rewriter.h"
#include "ast/rewriter/th_rewriter.h"
#include "ast/expr_map.h"
#include "ast/recurse_expr.h"
#include "util/obj_hashtable.h"
/**
\brief Functor for applying the following transformation
F[(p (ite c t1 t2) args)] = F'[(ite c t1 t2), p, args]
F'[(ite c t1 t2), p, args] = (ite c F'[t1, p, args] F'[t2, p, args])
F'[t, p, args] = (p t args)
*/
class pull_ite_tree {
ast_manager & m_manager;
th_rewriter m_rewriter;
func_decl * m_p;
ptr_vector<expr> m_args;
unsigned m_arg_idx; //!< position of the ite argument
expr_map m_cache;
ptr_vector<expr> m_todo;
bool is_cached(expr * n) const { return m_cache.contains(n); }
void get_cached(expr * n, expr * & r, proof * & p) const { m_cache.get(n, r, p); }
void cache_result(expr * n, expr * r, proof * pr);
void visit(expr * n, bool & visited);
bool visit_children(expr * n);
void reduce(expr * n);
/**
\brief Creante an application (m_p ... n ...) where n is the argument m_arg_idx and the other arguments
are in m_args.
*/
expr * mk_p_arg(expr * n) {
m_args[m_arg_idx] = n;
return m_manager.mk_app(m_p, m_args.size(), m_args.c_ptr());
}
public:
pull_ite_tree(ast_manager & m);
/**
\brief Apply the transformation above if n contains an ite-expression.
Store the result in r. If n does not contain an ite-expression, then
store n in r.
When proof generation is enabled, pr is a proof for n = r.
*/
void operator()(app * n, app_ref & r, proof_ref & pr);
};
/**
\brief Functor for applying the pull_ite_tree on subexpressions n that
satisfy the is_target virtual predicate.
*/
class pull_ite_tree_cfg : public default_rewriter_cfg {
protected:
ast_manager& m;
expr_ref_vector m_trail;
pull_ite_tree m_proc;
public:
pull_ite_tree_cfg(ast_manager & m);
virtual ~pull_ite_tree_cfg() {}
virtual bool is_target(app * n) const = 0;
bool get_subst(expr * n, expr* & r, proof* & p);
};
/**
\brief Apply pull_ite_tree on predicates of the form
(p ite v) and (p v ite)
where:
- p is an interpreted predicate
- ite is an ite-term expression
- v is a value
*/
class pull_cheap_ite_tree_cfg : public pull_ite_tree_cfg {
public:
pull_cheap_ite_tree_cfg(ast_manager & m):pull_ite_tree_cfg(m) {}
~pull_cheap_ite_tree_cfg() override {}
bool is_target(app * n) const override;
};
class pull_cheap_ite_tree_rw : public rewriter_tpl<pull_cheap_ite_tree_cfg> {
pull_cheap_ite_tree_cfg m_cfg;
public:
pull_cheap_ite_tree_rw(ast_manager& m):
rewriter_tpl<pull_cheap_ite_tree_cfg>(m, m.proofs_enabled(), m_cfg),
m_cfg(m)
{}
};
#endif /* PULL_ITE_TREE_H_ */

View file

@ -194,12 +194,14 @@ bool rewriter_tpl<Config>::constant_fold(app * t, frame & fr) {
result_stack().shrink(fr.m_spos);
result_stack().push_back(arg);
fr.m_state = REWRITE_BUILTIN;
TRACE("rewriter_step", tout << "step\n" << mk_ismt2_pp(t, m()) << "\n";);
if (visit<false>(arg, fr.m_max_depth)) {
m_r = result_stack().back();
result_stack().pop_back();
result_stack().pop_back();
result_stack().push_back(m_r);
cache_result<false>(t, m_r, m_pr, fr.m_cache_result);
TRACE("rewriter_step", tout << "step 1\n" << mk_ismt2_pp(m_r, m()) << "\n";);
frame_stack().pop_back();
set_new_child_flag(t);
}
@ -358,7 +360,7 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
if (ProofGen) {
NOT_IMPLEMENTED_YET();
// We do not support the use of bindings in proof generation mode.
// Thus we have to apply the subsitution here, and
// Thus we have to apply the substitution here, and
// beta_reducer subst(m());
// subst.set_bindings(new_num_args, new_args);
// expr_ref r2(m());

View file

@ -719,6 +719,7 @@ 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";);
// add list type only if the logic is not specified.
// it prevents clashes with builtin types.
insert(pm().mk_plist_decl());
@ -1408,7 +1409,8 @@ void cmd_context::restore_assertions(unsigned old_sz) {
SASSERT(m_assertions.empty());
return;
}
SASSERT(old_sz <= m_assertions.size());
if (old_sz == m_assertions.size()) return;
SASSERT(old_sz < m_assertions.size());
SASSERT(!m_interactive_mode || m_assertions.size() == m_assertion_strings.size());
restore(m(), m_assertions, old_sz);
if (produce_unsat_cores())
@ -2015,7 +2017,7 @@ void cmd_context::dt_eh::operator()(sort * dt, pdecl* pd) {
m_owner.insert(c);
func_decl * r = m_dt_util.get_constructor_recognizer(c);
m_owner.insert(r);
TRACE("new_dt_eh", tout << "new recognizer: " << r->get_name() << "\n";);
// TRACE("new_dt_eh", tout << "new recognizer: " << r->get_name() << "\n";);
for (func_decl * a : *m_dt_util.get_constructor_accessors(c)) {
TRACE("new_dt_eh", tout << "new accessor: " << a->get_name() << "\n";);
m_owner.insert(a);

View file

@ -406,6 +406,7 @@ public:
void reset_user_tactics();
void set_regular_stream(char const * name) { m_regular.set(name); }
void set_regular_stream(std::ostream& out) { m_regular.set(out); }
void set_diagnostic_stream(std::ostream& out) { m_diagnostic.set(out); }
void set_diagnostic_stream(char const * name);
std::ostream & regular_stream() override { return *m_regular; }
std::ostream & diagnostic_stream() override { return *m_diagnostic; }

View file

@ -852,7 +852,7 @@ pdecl_manager::pdecl_manager(ast_manager & m):
pdecl_manager::~pdecl_manager() {
dec_ref(m_list);
reset_sort_info();
SASSERT(m_sort2psort.empty());
SASSERT(m_sort2psort.empty());
SASSERT(m_table.empty());
}
@ -946,6 +946,7 @@ void pdecl_manager::del_decl_core(pdecl * p) {
}
void pdecl_manager::del_decl(pdecl * p) {
TRACE("pdecl_manager", p->display(tout); tout << "\n";);
if (p->is_psort()) {
psort * _p = static_cast<psort*>(p);
if (_p->is_sort_wrapper())

View file

@ -43,7 +43,7 @@ struct iz3checker : iz3base {
/* HACK: for tree interpolants, we assume that uninterpreted functions
are global. This is because in the current state of the tree interpolation
code, symbols that appear in sibling sub-trees have to be global, and
we have no way to eliminate such function symbols. When tree interpoaltion is
we have no way to eliminate such function symbols. When tree interpolation is
fixed, we can tree function symbols the same as constant symbols. */
bool is_tree;

View file

@ -255,12 +255,12 @@ public:
catch (const char *msg) {
throw interpolation_failure(msg);
}
catch (const iz3translation::unsupported &) {
TRACE("iz3", tout << "unsupported\n";);
catch (const iz3translation::unsupported & ex) {
TRACE("iz3", tout << "unsupported " << "\n";);
throw interpolation_error();
}
catch (const iz3proof::proof_error &) {
TRACE("iz3", tout << "proof error\n";);
catch (const iz3proof::proof_error & ex) {
TRACE("iz3", tout << "proof error " << "\n";);
throw interpolation_error();
}
profiling::timer_stop("Proof translation");
@ -306,8 +306,8 @@ public:
catch (const char *msg) {
throw interpolation_failure(msg);
}
catch (const iz3translation::unsupported &) {
TRACE("iz3", tout << "unsupported\n";);
catch (const iz3translation::unsupported & ex) {
TRACE("iz3", tout << "unsupported " << "\n";);
throw interpolation_error();
}
catch (const iz3proof::proof_error &) {

View file

@ -2029,8 +2029,8 @@ public:
case PR_IFF_FALSE: { // turns ~p into p <-> false, noop for us
if(is_local(con))
res = args[0];
else
throw_unsupported(con);
else
throw_unsupported(proof);
break;
}
case PR_COMMUTATIVITY: {

View file

@ -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).
--*/

View file

@ -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);
}

View file

@ -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(); }
};
};

View file

@ -781,17 +781,15 @@ namespace upolynomial {
set(q.size(), q.c_ptr(), C);
m().set(bound, p);
}
else if (q.size() < C.size() || m().m().is_even(p) || m().m().is_even(bound)) {
// discard accumulated image, it was affected by unlucky primes
TRACE("mgcd", tout << "discarding image\n";);
set(q.size(), q.c_ptr(), C);
m().set(bound, p);
}
else {
if (q.size() < C.size()) {
// discard accumulated image, it was affected by unlucky primes
TRACE("mgcd", tout << "discarding image\n";);
set(q.size(), q.c_ptr(), C);
m().set(bound, p);
}
else {
CRA_combine_images(q, p, C, bound);
TRACE("mgcd", tout << "new combined:\n"; display_star(tout, C); tout << "\n";);
}
CRA_combine_images(q, p, C, bound);
TRACE("mgcd", tout << "new combined:\n"; display_star(tout, C); tout << "\n";);
}
numeral_vector & candidate = q;
get_primitive(C, candidate);

View file

@ -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(); }
};

View file

@ -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;

View file

@ -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();
}

View file

@ -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;

View file

@ -112,7 +112,8 @@ bool func_interp::is_fi_entry_expr(expr * e, ptr_vector<expr> & args) {
return false;
}
if ((m_arity == 0) ||
if (!is_ground(t) ||
(m_arity == 0) ||
(m_arity == 1 && !m().is_eq(c, a0, a1)) ||
(m_arity > 1 && (!m().is_and(c) || to_app(c)->get_num_args() != m_arity)))
return false;

View file

@ -187,14 +187,14 @@ struct evaluator_cfg : public default_rewriter_cfg {
TRACE("model_evaluator", tout << "reduce_app " << f->get_name() << "\n";
for (unsigned i = 0; i < num; i++) tout << mk_ismt2_pp(args[i], m) << "\n";
tout << "---->\n" << mk_ismt2_pp(result, m) << "\n";);
return BR_DONE;
return BR_REWRITE1;
}
if (st == BR_FAILED && !m.is_builtin_family_id(fid))
st = evaluate_partial_theory_func(f, num, args, result, result_pr);
if (st == BR_DONE && is_app(result)) {
app* a = to_app(result);
if (evaluate(a->get_decl(), a->get_num_args(), a->get_args(), result)) {
return BR_DONE;
return BR_REWRITE1;
}
}
CTRACE("model_evaluator", st != BR_FAILED, tout << result << "\n";);
@ -399,12 +399,11 @@ struct evaluator_cfg : public default_rewriter_cfg {
}
}
}
args_table::iterator it = table1.begin(), end = table1.end();
for (; it != end; ++it) {
switch (compare((*it)[arity], else2)) {
for (auto const& t : table1) {
switch (compare((t)[arity], else2)) {
case l_true: break;
case l_false: result = m.mk_false(); return BR_DONE;
default: conj.push_back(m.mk_eq((*it)[arity], else2)); break;
default: conj.push_back(m.mk_eq((t)[arity], else2)); break;
}
}
result = mk_and(conj);

View file

@ -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;
@ -1106,6 +1106,16 @@ namespace datalog {
names.push_back(m_rule_names[i]);
}
}
static std::ostream& display_symbol(std::ostream& out, symbol const& nm) {
if (is_smt2_quoted_symbol(nm)) {
out << mk_smt2_quoted_symbol(nm);
}
else {
out << nm;
}
return out;
}
void context::display_smt2(unsigned num_queries, expr* const* qs, std::ostream& out) {
ast_manager& m = get_manager();
@ -1148,13 +1158,13 @@ namespace datalog {
if (!use_fixedpoint_extensions) {
out << "(set-logic HORN)\n";
}
for (func_decl * f : rels)
visitor.remove_decl(f);
visitor.display_decls(out);
func_decl_set::iterator it = rels.begin(), end = rels.end();
for (; it != end; ++it) {
func_decl* f = *it;
for (func_decl * f : rels)
display_rel_decl(out, f);
}
if (use_fixedpoint_extensions && do_declare_vars) {
declare_vars(rules, fresh_names, out);
@ -1185,13 +1195,7 @@ namespace datalog {
nm = symbol(s.str().c_str());
}
fresh_names.add(nm);
if (is_smt2_quoted_symbol(nm)) {
out << mk_smt2_quoted_symbol(nm);
}
else {
out << nm;
}
out << ")";
display_symbol(out, nm) << ")";
}
out << ")\n";
}
@ -1219,7 +1223,8 @@ namespace datalog {
PP(qfn);
out << ")\n";
}
out << "(query " << fn->get_name() << ")\n";
out << "(query ";
display_symbol(out, fn->get_name()) << ")\n";
}
}
else {
@ -1238,7 +1243,8 @@ namespace datalog {
void context::display_rel_decl(std::ostream& out, func_decl* f) {
smt2_pp_environment_dbg env(m);
out << "(declare-rel " << f->get_name() << " (";
out << "(declare-rel ";
display_symbol(out, f->get_name()) << " (";
for (unsigned i = 0; i < f->get_arity(); ++i) {
ast_smt2_pp(out, f->get_domain(i), env);
if (i + 1 < f->get_arity()) {

View file

@ -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.

View file

@ -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();

View file

@ -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();

View file

@ -165,7 +165,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);
@ -621,7 +621,7 @@ 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);
#else
@ -634,9 +634,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;
@ -664,7 +664,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();

View file

@ -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_ */

View file

@ -33,7 +33,7 @@ def_module_params('fixedpoint',
"updated relation was modified or not"),
('datalog.compile_with_widening', BOOL, False,
"widening will be used to compile recursive rules"),
('datalog.default_table_checked', BOOL, False, "if true, the detault " +
('datalog.default_table_checked', BOOL, False, "if true, the default " +
'table will be default_table inside a wrapper that checks that its results ' +
'are the same as of default_table_checker table'),
('datalog.default_table_checker', SYMBOL, 'null', "see default_table_checked"),
@ -59,7 +59,7 @@ def_module_params('fixedpoint',
('duality.full_expand', BOOL, False, 'Fully expand derivation trees'),
('duality.no_conj', BOOL, False, 'No forced covering (conjectures)'),
('duality.feasible_edges', BOOL, True,
'Don\'t expand definitley infeasible edges'),
'Don\'t expand definitely infeasible edges'),
('duality.use_underapprox', BOOL, False, 'Use underapproximations'),
('duality.stratified_inlining', BOOL, False, 'Use stratified inlining'),
('duality.recursion_bound', UINT, UINT_MAX,
@ -130,7 +130,7 @@ def_module_params('fixedpoint',
('xform.magic', BOOL, False,
"perform symbolic magic set transformation"),
('xform.scale', BOOL, False,
"add scaling variable to linear real arithemtic clauses"),
"add scaling variable to linear real arithmetic clauses"),
('xform.inline_linear', BOOL, True, "try linear inlining method"),
('xform.inline_eager', BOOL, True, "try eager inlining of rules"),
('xform.inline_linear_branch', BOOL, False,
@ -176,7 +176,7 @@ def_module_params('fixedpoint',
('spacer.elim_aux', BOOL, True, "Eliminate auxiliary variables in reachability facts"),
('spacer.reach_as_init', BOOL, True, "Extend initial rules with computed reachability facts"),
('spacer.blast_term_ite', BOOL, True, "Expand non-Boolean ite-terms"),
('spacer.nondet_tie_break', BOOL, False, "Break ties in obligation queue non-deterministicly"),
('spacer.nondet_tie_break', BOOL, False, "Break ties in obligation queue non-deterministically"),
('spacer.reach_dnf', BOOL, True, "Restrict reachability facts to DNF"),
('bmc.linear_unrolling_depth', UINT, UINT_MAX, "Maximal level to explore"),
('spacer.split_farkas_literals', BOOL, False, "Split Farkas literals"),

View file

@ -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) {

View file

@ -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)) {

View file

@ -133,7 +133,7 @@ namespace pdr {
else if ((m.is_eq(e, c, val) && is_app(val) && dt.is_constructor(to_app(val))) ||
(m.is_eq(e, val, c) && is_app(val) && dt.is_constructor(to_app(val)))){
func_decl* f = to_app(val)->get_decl();
func_decl* r = dt.get_constructor_recognizer(f);
func_decl* r = dt.get_constructor_is(f);
conjs[i] = m.mk_app(r, c);
ptr_vector<func_decl> const& acc = *dt.get_constructor_accessors(f);
for (unsigned j = 0; j < acc.size(); ++j) {

View file

@ -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)) {

View file

@ -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;

View file

@ -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;
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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) {

View file

@ -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);

View file

@ -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;
}

View file

@ -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);

View file

@ -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);

Some files were not shown because too many files have changed in this diff Show more