From: Mathias Preiner Date: Wed, 21 Apr 2021 17:21:34 +0000 (-0700) Subject: Goodbye CVC4, hello cvc5! (#6371) X-Git-Tag: cvc5-1.0.0~1866 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae5ee4b07dc3d3c792e7fe7f382ff490dd28aca4;p=cvc5.git Goodbye CVC4, hello cvc5! (#6371) This commits changes the build system to cvc5 and removes the remaining occurrences of CVC4. It further cleans up outdated/unused scripts in contrib/. --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eeb9db572..d216d07fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -196,14 +196,14 @@ jobs: run: | make -j2 install echo -e "#include \nint main() { cvc5::api::Solver s; return 0; }" > /tmp/test.cpp - g++ -std=c++11 /tmp/test.cpp -I install/include -L install/lib -lcvc4 + g++ -std=c++11 /tmp/test.cpp -I install/include -L install/lib -lcvc5 working-directory: build - name: Python Install Check if: matrix.python-bindings run: | - export PYTHONPATH="$PYTHONPATH:$(dirname $(find build/install/ -name "pycvc4" -type d))" - python3 -c "import pycvc4" + export PYTHONPATH="$PYTHONPATH:$(dirname $(find build/install/ -name "pycvc5" -type d))" + python3 -c "import pycvc5" # Examples are built for non-symfpu builds - name: Check Examples diff --git a/AUTHORS b/AUTHORS index 894f779f4..2b3e244c5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,10 +1,10 @@ -The authors, designers, and main contributors to CVC4 are listed below. -CVC4's copyright is held by these individuals and the affiliated +The authors, designers, and main contributors to cvc5 are listed below. +cvc5's copyright is held by these individuals and the affiliated institutions at the time of their contributions (note that some authors have had more than one affiliated institution). See the file COPYING for details on -the copyright and licensing of CVC4. +the copyright and licensing of cvc5. -The developers and authors of CVC4 are: +The developers and authors of cvc5 are: Current: Haniel Barbosa, The University of Iowa, Universidade Federal de Minas Gerais @@ -36,13 +36,14 @@ Alumni: Tianyi Liang, The University of Iowa Paul Meng, The University of Iowa -Other contributors to the CVC4 codebase are listed in the THANKS file. +Other contributors to the cvc5 codebase are listed in the THANKS file. -CVC4 is the fourth in the CVC series of tools (CVC, CVC Lite, CVC3) but does -not directly incorporate code from any previous version. Information about -authors of previous CVC tools is included with their distributions. +cvc5 is the fifth in the CVC series of tools (CVC, CVC Lite, CVC3) but does +not directly incorporate code from any previous version prior to CVC4. +Information about authors of previous CVC tools is included with their +distributions. -CVC4 contains MiniSAT code by Niklas Een and Niklas Sorensson. +cvc5 contains MiniSAT code by Niklas Een and Niklas Sorensson. -The CVC4 parser incorporates some code from ANTLR3, by Jim Idle, Temporal +The cvc5 parser incorporates some code from ANTLR3, by Jim Idle, Temporal Wave LLC. diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b5af6dc4..69e028d17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,21 +18,21 @@ cmake_minimum_required(VERSION 3.9) #-----------------------------------------------------------------------------# # Project configuration -project(cvc4) +project(cvc5) include(GNUInstallDirs) -set(CVC5_MAJOR 1) # Major component of the version of CVC4. -set(CVC5_MINOR 9) # Minor component of the version of CVC4. -set(CVC5_RELEASE 0) # Release component of the version of CVC4. +set(CVC5_MAJOR 1) # Major component of the version of cvc5. +set(CVC5_MINOR 0) # Minor component of the version of cvc5. +set(CVC5_RELEASE 0) # Release component of the version of cvc5. -# Extraversion component of the version of CVC4. +# Extraversion component of the version of cvc5. set(CVC5_EXTRAVERSION "-prerelease") -# Shared library versioning. Increment SOVERSION for every new CVC4 release. -set(CVC5_SOVERSION 7) +# Shared library versioning. Increment SOVERSION for every new cvc5 release. +set(CVC5_SOVERSION 1) -# Full release string for CVC4. +# Full release string for cvc5. if(CVC5_RELEASE) set(CVC5_RELEASE_STRING "${CVC5_MAJOR}.${CVC5_MINOR}.${CVC5_RELEASE}${CVC5_EXTRAVERSION}") @@ -88,23 +88,23 @@ option(ENABLE_GPL "Enable GPL dependencies") # >> 3-valued: IGNORE ON OFF # > allows to detect if set by user (default: IGNORE) # > only necessary for options set for build types -cvc4_option(ENABLE_ASAN "Enable ASAN build") -cvc4_option(ENABLE_UBSAN "Enable UBSan build") -cvc4_option(ENABLE_TSAN "Enable TSan build") -cvc4_option(ENABLE_ASSERTIONS "Enable assertions") -cvc4_option(ENABLE_COMP_INC_TRACK +cvc5_option(ENABLE_ASAN "Enable ASAN build") +cvc5_option(ENABLE_UBSAN "Enable UBSan build") +cvc5_option(ENABLE_TSAN "Enable TSan build") +cvc5_option(ENABLE_ASSERTIONS "Enable assertions") +cvc5_option(ENABLE_COMP_INC_TRACK "Enable optimizations for incremental SMT-COMP tracks") -cvc4_option(ENABLE_DEBUG_SYMBOLS "Enable debug symbols") -cvc4_option(ENABLE_DUMPING "Enable dumping") -cvc4_option(ENABLE_MUZZLE "Suppress ALL non-result output") -cvc4_option(ENABLE_STATISTICS "Enable statistics") -cvc4_option(ENABLE_TRACING "Enable tracing") -cvc4_option(ENABLE_UNIT_TESTING "Enable unit testing") -cvc4_option(ENABLE_VALGRIND "Enable valgrind instrumentation") -cvc4_option(ENABLE_SHARED "Build as shared library") -cvc4_option(ENABLE_STATIC_BINARY +cvc5_option(ENABLE_DEBUG_SYMBOLS "Enable debug symbols") +cvc5_option(ENABLE_DUMPING "Enable dumping") +cvc5_option(ENABLE_MUZZLE "Suppress ALL non-result output") +cvc5_option(ENABLE_STATISTICS "Enable statistics") +cvc5_option(ENABLE_TRACING "Enable tracing") +cvc5_option(ENABLE_UNIT_TESTING "Enable unit testing") +cvc5_option(ENABLE_VALGRIND "Enable valgrind instrumentation") +cvc5_option(ENABLE_SHARED "Build as shared library") +cvc5_option(ENABLE_STATIC_BINARY "Build static binaries with statically linked system libraries") -cvc4_option(ENABLE_AUTO_DOWNLOAD "Enable automatic download of dependencies") +cvc5_option(ENABLE_AUTO_DOWNLOAD "Enable automatic download of dependencies") # >> 2-valued: ON OFF # > for options where we don't need to detect if set by user (default: OFF) option(ENABLE_BEST "Enable dependencies known to give best performance") @@ -117,13 +117,13 @@ option(ENABLE_PROFILING "Enable support for gprof profiling") # >> 3-valued: IGNORE ON OFF # > allows to detect if set by user (default: IGNORE) # > only necessary for options set for ENABLE_BEST -cvc4_option(USE_ABC "Use ABC for AIG bit-blasting") -cvc4_option(USE_CADICAL "Use CaDiCaL SAT solver") -cvc4_option(USE_CLN "Use CLN instead of GMP") -cvc4_option(USE_CRYPTOMINISAT "Use CryptoMiniSat SAT solver") -cvc4_option(USE_GLPK "Use GLPK simplex solver") -cvc4_option(USE_KISSAT "Use Kissat SAT solver") -cvc4_option(USE_EDITLINE "Use Editline for better interactive support") +cvc5_option(USE_ABC "Use ABC for AIG bit-blasting") +cvc5_option(USE_CADICAL "Use CaDiCaL SAT solver") +cvc5_option(USE_CLN "Use CLN instead of GMP") +cvc5_option(USE_CRYPTOMINISAT "Use CryptoMiniSat SAT solver") +cvc5_option(USE_GLPK "Use GLPK simplex solver") +cvc5_option(USE_KISSAT "Use Kissat SAT solver") +cvc5_option(USE_EDITLINE "Use Editline for better interactive support") # >> 2-valued: ON OFF # > for options where we don't need to detect if set by user (default: OFF) option(USE_POLY "Use LibPoly for polynomial arithmetic") @@ -149,7 +149,7 @@ option(BUILD_BINDINGS_JAVA "Build Java bindings based on new C++ API ") option(BUILD_LIB_ONLY "Only build the library") # Api documentation -cvc4_option(BUILD_DOCS "Build Api documentation") +cvc5_option(BUILD_DOCS "Build Api documentation") #-----------------------------------------------------------------------------# # Internal cmake variables @@ -231,15 +231,15 @@ if ("${LD_VERSION}" MATCHES "GNU gold") endif () #-----------------------------------------------------------------------------# -# Option defaults (three-valued options (cvc4_option(...))) +# Option defaults (three-valued options (cvc5_option(...))) # # These options are only set if their value is IGNORE. Otherwise, the user # already set the option, which we don't want to overwrite. if(ENABLE_STATIC_BINARY) - cvc4_set_option(ENABLE_SHARED OFF) + cvc5_set_option(ENABLE_SHARED OFF) else() - cvc4_set_option(ENABLE_SHARED ON) + cvc5_set_option(ENABLE_SHARED ON) endif() #-----------------------------------------------------------------------------# @@ -271,11 +271,11 @@ if(ENABLE_SHARED) endif() # Embed the installation prefix as an RPATH in the executable such that the - # linker can find our libraries (such as libcvc4parser) when executing the - # cvc4 binary. This is for example useful when installing CVC4 with a custom + # linker can find our libraries (such as libcvc5parser) when executing the + # cvc5 binary. This is for example useful when installing cvc5 with a custom # prefix on macOS (e.g. when using homebrew in a non-standard directory). If # we do not set this option, then the linker will not be able to find the - # required libraries when trying to run CVC4. + # required libraries when trying to run cvc5. # # Also embed the installation prefix of the installed contrib libraries as an # RPATH. This allows to install a dynamically linked binary that depends on @@ -295,7 +295,7 @@ else() set(CMAKE_FIND_LIBRARY_SUFFIXES .a) endif() set(BUILD_SHARED_LIBS OFF) - cvc4_set_option(ENABLE_STATIC_BINARY ON) + cvc5_set_option(ENABLE_STATIC_BINARY ON) # Never build unit tests as static binaries, otherwise we'll end up with # ~300MB per unit test. @@ -493,15 +493,11 @@ endif() include(IWYU) #-----------------------------------------------------------------------------# -# Generate CVC4's cvc4autoconfig.h header -include(ConfigureCVC4) +include(ConfigureCvc5) if(NOT ENABLE_SHARED) set(CVC5_STATIC_BUILD ON) endif() -configure_file(cvc4autoconfig.h.in cvc4autoconfig.h) -unset(CVC5_STATIC_BUILD) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) #-----------------------------------------------------------------------------# # Add subdirectories @@ -527,7 +523,7 @@ endif() #-----------------------------------------------------------------------------# # Package configuration # -# Export CVC4 targets to support find_package(CVC4) in other cmake projects. +# Export cvc5 targets to support find_package(cvc5) in other cmake projects. include(CMakePackageConfigHelpers) @@ -539,8 +535,8 @@ include(CMakePackageConfigHelpers) # also that custom installation prefixes are not used for longer periods of # time anyway). Also, we print a big warning with further instructions. if(NOT ENABLE_STATIC_BINARY) - # Get the libraries that cvc4 links against - get_target_property(libs cvc4 INTERFACE_LINK_LIBRARIES) + # Get the libraries that cvc5 links against + get_target_property(libs cvc5 INTERFACE_LINK_LIBRARIES) set(LIBS_SHARED_FROM_DEPS "") foreach(lib ${libs}) # Filter out those that are linked dynamically and come from deps/install @@ -553,16 +549,16 @@ if(NOT ENABLE_STATIC_BINARY) if(list_len GREATER 0) # Print a generic warning install(CODE "message(WARNING \"You are installing a dynamically linked \ - binary of CVC4 which may be a problem if you are using any dynamically \ + binary of cvc5 which may be a problem if you are using any dynamically \ linked third-party library that you obtained through one of the \ contrib/get-xxx scripts. The binary uses the rpath mechanism to find these \ locally, hence executing such a contrib script removing the \ \\\"deps/install\\\" folder most probably breaks the installed binary! \ Consider installing the dynamically linked dependencies on your system \ - manually or link cvc4 statically.\")") + manually or link cvc5 statically.\")") # Print the libraries in question foreach(lib ${LIBS_SHARED_FROM_DEPS}) - install(CODE "message(WARNING \"The following library is used by the cvc4 binary: ${lib}\")") + install(CODE "message(WARNING \"The following library is used by the cvc5 binary: ${lib}\")") endforeach() # Check if we use a custom installation prefix if(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local") @@ -577,28 +573,28 @@ if(NOT ENABLE_STATIC_BINARY) endif() endif() -install(EXPORT cvc4-targets - FILE CVC4Targets.cmake - NAMESPACE CVC4:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CVC4) +install(EXPORT cvc5-targets + FILE cvc5Targets.cmake + NAMESPACE cvc5:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cvc5) configure_package_config_file( - ${CMAKE_SOURCE_DIR}/cmake/CVC4Config.cmake.in - ${CMAKE_BINARY_DIR}/cmake/CVC4Config.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CVC4 + ${CMAKE_SOURCE_DIR}/cmake/cvc5Config.cmake.in + ${CMAKE_BINARY_DIR}/cmake/cvc5Config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cvc5 PATH_VARS CMAKE_INSTALL_LIBDIR ) write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/CVC4ConfigVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/cvc5ConfigVersion.cmake VERSION ${CVC5_RELEASE_STRING} COMPATIBILITY ExactVersion ) install(FILES - ${CMAKE_BINARY_DIR}/cmake/CVC4Config.cmake - ${CMAKE_BINARY_DIR}/CVC4ConfigVersion.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CVC4 + ${CMAKE_BINARY_DIR}/cmake/cvc5Config.cmake + ${CMAKE_BINARY_DIR}/cvc5ConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cvc5 ) @@ -621,7 +617,7 @@ get_directory_property(CVC5_DEFINITIONS COMPILE_DEFINITIONS) string(REPLACE ";" " " CVC5_DEFINITIONS "${CVC5_DEFINITIONS}") message("") -print_info("CVC4 ${CVC5_RELEASE_STRING}") +print_info("cvc5 ${CVC5_RELEASE_STRING}") message("") if(ENABLE_COMP_INC_TRACK) print_config("Build profile " "${CVC5_BUILD_PROFILE_STRING} (incremental)") @@ -662,7 +658,7 @@ print_config("GLPK " ${USE_GLPK}) print_config("Kissat " ${USE_KISSAT}) print_config("LibPoly " ${USE_POLY}) message("") -print_config("Build libcvc4 only " ${BUILD_LIB_ONLY}) +print_config("Build libcvc5 only " ${BUILD_LIB_ONLY}) if(CVC5_USE_CLN_IMP) print_config("MP library " "cln") @@ -691,34 +687,34 @@ message("") if(GPL_LIBS) message( - "${Blue}CVC4 license: " + "${Blue}cvc5 license: " "${Yellow}GPLv3 (due to optional libraries; see below)${ResetColor}" "\n" "\n" - "Please note that CVC4 will be built against the following GPLed libraries:" + "Please note that cvc5 will be built against the following GPLed libraries:" "\n" "${GPL_LIBS}" "\n" - "As these libraries are covered under the GPLv3, so is this build of CVC4." + "As these libraries are covered under the GPLv3, so is this build of cvc5." "\n" - "CVC4 is also available to you under the terms of the (modified) BSD license." + "cvc5 is also available to you under the terms of the (modified) BSD license." "\n" - "If you prefer to license CVC4 under those terms, please configure CVC4 to" + "If you prefer to license cvc5 under those terms, please configure cvc5 to" "\n" "disable all optional GPLed library dependencies (-DENABLE_BSD_ONLY=ON)." ) else() message( - "${Blue}CVC4 license:${ResetColor} modified BSD" + "${Blue}cvc5 license:${ResetColor} modified BSD" "\n" "\n" "Note that this configuration is NOT built against any GPL'ed libraries, so" "\n" "it is covered by the (modified) BSD license. This is, however, not the best" "\n" - "performing configuration of CVC4. To build against GPL'ed libraries which" + "performing configuration of cvc5. To build against GPL'ed libraries which" "\n" - "improve CVC4's performance, re-configure with '-DENABLE_GPL -DENABLE_BEST'." + "improve cvc5's performance, re-configure with '-DENABLE_GPL -DENABLE_BEST'." ) endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c54589e83..245a8a8a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,12 @@ # Contributing -External contributions to CVC4 may be proposed using git's standard pull request +External contributions to cvc5 may be proposed using git's standard pull request mechanism. The following terms apply to all such contributions: - We require all pull requests to be squashed into a single commit before being submitted and to be signed using `git commit -s`. -- CVC4 is distributed under the terms of the modified BSD license (see +- cvc5 is distributed under the terms of the modified BSD license (see [COPYING](https://github.com/CVC4/CVC4/blob/master/COPYING) file). By submitting a signed contribution, you automatically agree to accept the conditions described in [COPYING](https://github.com/CVC4/CVC4/blob/master/COPYING). @@ -55,7 +55,7 @@ By making a contribution to this project, I certify that: this project or the open source license(s) involved. ``` -If you are interested in becoming a long-term contributor to the CVC4 project, +If you are interested in becoming a long-term contributor to the cvc5 project, please contact one of the -[project leaders](https://cvc4.github.io/people.html#project-leaders). +[project leaders](https://cvc4.github.io/people.html#project-leaders). We'd be happy to point you to some internal documentation to help you out. diff --git a/COPYING b/COPYING index 122fbd6a2..318c717ad 100644 --- a/COPYING +++ b/COPYING @@ -1,14 +1,14 @@ -CVC4 is copyright (C) 2009-2021 by its authors and contributors (see the file +cvc5 is copyright (C) 2009-2021 by its authors and contributors (see the file AUTHORS) and their institutional affiliations. All rights reserved. -The source code of CVC4 is open and available to students, researchers, +The source code of cvc5 is open and available to students, researchers, software companies, and everyone else to study, to modify, and to redistribute original or modified versions; distribution is under the terms of the modified -BSD license (reproduced below). Please note that CVC4 can be configured +BSD license (reproduced below). Please note that cvc5 can be configured (however, by default it is not) to link against some GPLed libraries, and therefore the use of these builds may be restricted in non-GPL-compatible projects. See below for a discussion of CLN and GLPK (the two GPLed optional -library dependences for CVC4), and how to ensure you have a build that doesn't +library dependences for cvc5), and how to ensure you have a build that doesn't link against GPLed libraries. Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Third-Party Software ------------------------------------------------------------------------------- -The CVC4 source code includes third-party software which has its own copyright +The cvc5 source code includes third-party software which has its own copyright and licensing terms, as described below. The following file contains third-party software. @@ -52,27 +52,27 @@ The following file contains third-party software. The copyright and licensing information of this file is in its header. -CVC4 incorporates MiniSat code (see src/prop/minisat and src/prop/bvminisat), +cvc5 incorporates MiniSat code (see src/prop/minisat and src/prop/bvminisat), excluded from the above copyright. See src/prop/minisat/LICENSE and src/prop/bvminisat/LICENSE for copyright and licensing information. -CVC4 incorporates code from ANTLR3 (http://www.antlr3.org/), the files +cvc5 incorporates code from ANTLR3 (http://www.antlr3.org/), the files src/parser/bounded_token_buffer.h, src/parser/bounded_token_buffer.cpp, and src/parser/antlr_input_imports.cpp are excluded from the above copyright. See licenses/antlr3-LICENSE for copyright and licensing information. -CVC4 by default links against The GNU Multiple Precision (GMP) Arithmetic +cvc5 by default links against The GNU Multiple Precision (GMP) Arithmetic Library, which is licensed under GNU LGPL v3. See the file licenses/lgpl-3.0.txt for a copy of that license. Note that according to the -terms of the LGPL, both CVC4's source, and the combined work (CVC4 linked with +terms of the LGPL, both cvc5's source, and the combined work (cvc5 linked with GMP) may (and do) remain under the more permissive modified BSD license. -The implementation of the floating point solver in CVC4 depends on symfpu +The implementation of the floating point solver in cvc5 depends on symfpu (https://github.com/martin-cs/symfpu) written by Martin Brain. -See https://raw.githubusercontent.com/martin-cs/symfpu/CVC4/LICENSE for +See https://raw.githubusercontent.com/martin-cs/symfpu/cvc5/LICENSE for copyright and licensing information. -CVC4 optionally links against the following libraries: +cvc5 optionally links against the following libraries: ABC (https://bitbucket.org/alanmi/abc) CaDiCaL (https://github.com/arminbiere/cadical) @@ -80,8 +80,8 @@ CVC4 optionally links against the following libraries: LibPoly (https://github.com/SRI-CSL/libpoly) libedit (https://thrysoee.dk/editline) -Linking CVC4 against these libraries does not affect the license terms of the -CVC4 code. See the respective projects for copyright and licensing +Linking cvc5 against these libraries does not affect the license terms of the +cvc5 code. See the respective projects for copyright and licensing information. @@ -90,19 +90,19 @@ information. ------------------------------------------------------------------------------- Please be advised that the following libraries are covered under the GPLv3 -license. If you choose to link CVC4 against one of these libraries, the +license. If you choose to link cvc5 against one of these libraries, the resulting combined work is also covered under the GPLv3. If you want to make -sure you build a version of CVC4 that uses no GPLed libraries, configure CVC4 -with the "--no-gpl" option before building (which is the default). CVC4 can -then be used in contexts where you want to use CVC4 under the terms of the +sure you build a version of cvc5 that uses no GPLed libraries, configure cvc5 +with the "--no-gpl" option before building (which is the default). cvc5 can +then be used in contexts where you want to use cvc5 under the terms of the (modified) BSD license. See licenses/gpl-3.0.txt for more information. -CVC4 can be optionally configured to link against CLN, the Class Library for +cvc5 can be optionally configured to link against CLN, the Class Library for Numbers, available here: http://www.ginac.de/CLN/ -CVC4 can be optionally configured to link against glpk-cut-log, a modified +cvc5 can be optionally configured to link against glpk-cut-log, a modified version of GLPK, the GNU Linear Programming Kit, available here: https://github.com/timothy-king/glpk-cut-log diff --git a/INSTALL.md b/INSTALL.md index 14290afca..8d7bf44c7 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,7 +1,7 @@ CVC4 prerelease version 1.9 =========================== -## Building CVC4 +## Building cvc5 ./contrib/get-antlr-3.4 # download and build ANTLR ./configure.sh # use --prefix to specify a prefix (default: /usr/local) @@ -11,12 +11,12 @@ CVC4 prerelease version 1.9 make check # to run default set of tests make install # to install into the prefix specified above -All binaries are built into `/bin`, the CVC4 library is built into +All binaries are built into `/bin`, the cvc5 library is built into `/lib`. ## Supported Operating Systems -CVC4 can be built on Linux and macOS. For Windows, CVC4 can be cross-compiled +cvc5 can be built on Linux and macOS. For Windows, cvc5 can be cross-compiled using Mingw-w64. We recommend a 64-bit operating system. On macOS, we recommend using Homebrew (https://brew.sh/) to install the @@ -27,7 +27,7 @@ To build a static binary for macOS, use: ### Cross-compiling for Windows -Cross-compiling CVC4 with Mingw-w64 can be done as follows: +Cross-compiling cvc5 with Mingw-w64 can be done as follows: ``` ./configure.sh --win64 --static @@ -36,12 +36,12 @@ Cross-compiling CVC4 with Mingw-w64 can be done as follows: make # use -jN for parallel build with N threads ``` -The built binary `cvc4.exe` is located in `/bin` and the CVC4 library +The built binary `cvc5.exe` is located in `/bin` and the cvc5 library can be found in `/lib`. ## Build dependencies -The following tools and libraries are required to build and run CVC4. +The following tools and libraries are required to build and run cvc5. Versions given are minimum versions; more recent versions should be compatible. @@ -64,14 +64,14 @@ For libantlr3c, you can use the script `contrib/get-antlr-3.4`. This will download, patch, and install libantlr3c. If you're on a 32-bit machine, or if you have difficulty building -libantlr3c (or difficulty getting CVC4 to link against it), you +libantlr3c (or difficulty getting cvc5 to link against it), you may need to remove the configure option `--enable-64bit` in the script. ### Warning: GCC 4.5.1 GCC version 4.5.1 seems to have a bug in the optimizer that may result in incorrect behavior (and wrong results) in many builds. This is a known problem -for MiniSat, and since MiniSat is at the core of CVC4, a problem for CVC4. +for MiniSat, and since MiniSat is at the core of cvc5, a problem for cvc5. We recommend using a GCC version > 4.5.1. ### Warning: Installing GMP via `contrib/get-gmp-dev` @@ -82,7 +82,7 @@ your distribution `contrib/get-gmp-dev` is used in `configure.sh` when cross-compiling GMP for Windows. * does not ship with static GMP libraries (e.g., Arch Linux) - and you want to build CVC4 statically. + and you want to build cvc5 statically. In most of the cases the GMP version installed on your system is the one you want and should use. @@ -96,7 +96,7 @@ is an implementation of SMT-LIB/IEEE-754 floating-point operations in terms of bit-vector operations. It is required for supporting the theory of floating-point numbers and can be installed using the `contrib/get-symfpu` script. -Configure CVC4 with `configure.sh --symfpu` to build with this dependency. +Configure cvc5 with `configure.sh --symfpu` to build with this dependency. ### CaDiCaL (Optional SAT solver) @@ -104,7 +104,7 @@ Configure CVC4 with `configure.sh --symfpu` to build with this dependency. is a SAT solver that can be used for solving non-incremental bit-vector problems with eager bit-blasting. This dependency may improve performance. It can be installed using the `contrib/get-cadical script`. -Configure CVC4 with `configure.sh --cadical` to build with this dependency. +Configure cvc5 with `configure.sh --cadical` to build with this dependency. ### CryptoMiniSat (Optional SAT solver) @@ -112,7 +112,7 @@ Configure CVC4 with `configure.sh --cadical` to build with this dependency. is a SAT solver that can be used for solving bit-vector problems with eager bit-blasting. This dependency may improve performance. It can be installed using the `contrib/get-cryptominisat` script. -Configure CVC4 with `configure.sh --cryptominisat` to build with this +Configure cvc5 with `configure.sh --cryptominisat` to build with this dependency. ### Kissat (Optional SAT solver) @@ -121,44 +121,44 @@ dependency. is a SAT solver that can be used for solving bit-vector problems with eager bit-blasting. This dependency may improve performance. It can be installed using the `contrib/get-kissat` script. -Configure CVC4 with `configure.sh --kissat` to build with this +Configure cvc5 with `configure.sh --kissat` to build with this dependency. ### LibPoly (Optional polynomial library) [LibPoly](https://github.com/SRI-CSL/libpoly) is required for CAD-based nonlinear reasoning. It can be installed using the `contrib/get-poly` script. -Configure CVC4 with `configure.sh --poly` to build with this dependency. +Configure cvc5 with `configure.sh --poly` to build with this dependency. ### CLN >= v1.3 (Class Library for Numbers) [CLN](http://www.ginac.de/CLN) is an alternative multiprecision arithmetic package that may offer better performance and memory footprint than GMP. -Configure CVC4 with `configure.sh --cln` to build with this dependency. +Configure cvc5 with `configure.sh --cln` to build with this dependency. Note that CLN is covered by the [GNU General Public License, version 3](https://www.gnu.org/licenses/gpl-3.0.en.html). -If you choose to use CVC4 with CLN support, you are licensing CVC4 under that +If you choose to use cvc5 with CLN support, you are licensing cvc5 under that same license. -(Usually CVC4's license is more permissive than GPL, see the file `COPYING` in -the CVC4 source distribution for details.) +(Usually cvc5's license is more permissive than GPL, see the file `COPYING` in +the cvc5 source distribution for details.) ### glpk-cut-log (A fork of the GNU Linear Programming Kit) [glpk-cut-log](https://github.com/timothy-king/glpk-cut-log/) is a fork of [GLPK](http://www.gnu.org/software/glpk/) (the GNU Linear Programming Kit). This can be used to speed up certain classes of problems for the arithmetic -implementation in CVC4. (This is not recommended for most users.) +implementation in cvc5. (This is not recommended for most users.) glpk-cut-log can be installed using the `contrib/get-glpk-cut-log` script. Note that the only installation option is manual installation via this script. -CVC4 is no longer compatible with the main GLPK library. -Configure CVC4 with `configure.sh --glpk` to build with this dependency. +cvc5 is no longer compatible with the main GLPK library. +Configure cvc5 with `configure.sh --glpk` to build with this dependency. Note that GLPK and glpk-cut-log are covered by the [GNU General Public License, version 3](https://www.gnu.org/licenses/gpl-3.0.en.html). -If you choose to use CVC4 with GLPK support, you are licensing CVC4 under that +If you choose to use cvc5 with GLPK support, you are licensing cvc5 under that same license. -(Usually CVC4's license is more permissive; see above discussion.) +(Usually cvc5's license is more permissive; see above discussion.) ### ABC library (Improved Bit-Vector Support) @@ -169,33 +169,33 @@ bit-vector solver. When enabled, the bit-blasted formula is encoded into and-inverter-graphs (AIG) and ABC is used to simplify these AIGs. ABC can be installed using the `contrib/get-abc` script. -Configure CVC4 with `configure.sh --abc` to build with this dependency. +Configure cvc5 with `configure.sh --abc` to build with this dependency. ### Editline library (Improved Interactive Experience) The [Editline Library](https://thrysoee.dk/editline/) library is optionally used to provide command editing, tab completion, and history functionality at -the CVC4 prompt (when running in interactive mode). Check your distribution +the cvc5 prompt (when running in interactive mode). Check your distribution for a package named "libedit-dev" or "libedit-devel" or similar. ### Boost C++ base libraries (Examples) The [Boost](http://www.boost.org) C++ base library is needed for some examples -provided with CVC4. +provided with cvc5. ### Google Test Unit Testing Framework (Unit Tests) [Google Test](https://github.com/google/googletest) is required to optionally -run CVC4's unit tests (included with the distribution). -See [Testing CVC4](#Testing-CVC4) below for more details. +run cvc5's unit tests (included with the distribution). +See [Testing cvc5](#Testing-cvc5) below for more details. ## Language bindings -CVC4 provides a complete and flexible C++ API (see `examples/api` for +cvc5 provides a complete and flexible C++ API (see `examples/api` for examples). It further provides Java (see `examples/SimpleVC.java` and `examples/api/java`) and Python (see `examples/api/python`) API bindings. -Configure CVC4 with `configure.sh ---bindings` to build with language +Configure cvc5 with `configure.sh ---bindings` to build with language bindings for ``. If you're interested in helping to develop, maintain, and test a language @@ -204,13 +204,13 @@ binding, please contact one of the project leaders. ## Building the API Documentation -Building the API documentation of CVC4 requires the following dependencies: +Building the API documentation of cvc5 requires the following dependencies: * [Doxygen](https://www.doxygen.nl) * [Sphinx](https://www.sphinx-doc.org) * [Breathe](https://breathe.readthedocs.io) -To build the documentation, configure CVC4 with `./configure.sh --docs`. -Building CVC4 will then include building the API documentation. +To build the documentation, configure cvc5 with `./configure.sh --docs`. +Building cvc5 will then include building the API documentation. The API documentation can then be found at `/docs/sphinx/index.html`. @@ -226,7 +226,7 @@ can then be copied over to GitHub pages. See `examples/README.md` for instructions on how to build and run the examples. -## Testing CVC4 +## Testing cvc5 We use `ctest` as test infrastructure, for all command-line options of ctest, see `ctest -h`. Some useful options are: @@ -273,7 +273,7 @@ as test target name. The unit tests are not built by default. -Note that CVC4 can only be configured with unit tests in non-static builds with +Note that cvc5 can only be configured with unit tests in non-static builds with assertions enabled. make units # build and run all unit tests @@ -311,7 +311,7 @@ in level `N` in `test/regress/regressN/`) as test target name. All custom test targets build and run a preconfigured set of tests. - `make check [-jN] [ARGS=-jN]` - The default build-and-test target for CVC4, builds and runs all examples, + The default build-and-test target for cvc5, builds and runs all examples, all system and unit tests, and regression tests from levels 0 to 2. - `make systemtests [-jN] [ARGS=-jN]` @@ -337,18 +337,18 @@ available on the system. Override with `ARGS=-jN`. Use `-jN` for parallel **building** with `N` threads. -## Recompiling a specific CVC4 version with different LGPL library versions +## Recompiling a specific cvc5 version with different LGPL library versions -To recompile a specific static binary of CVC4 with different versions of the +To recompile a specific static binary of cvc5 with different versions of the linked LGPL libraries perform the following steps: 1. Make sure that you have installed the desired LGPL library versions. - You can check the versions found by CVC4's build system during the configure + You can check the versions found by cvc5's build system during the configure phase. -2. Determine the commit sha and configuration of the CVC4 binary +2. Determine the commit sha and configuration of the cvc5 binary ``` -cvc4 --show-config +cvc5 --show-config ``` 3. Download the specific source code version: ``` @@ -362,9 +362,9 @@ tar xf .tar.gz ``` cd CVC4- ``` -6. Configure CVC4 with options listed by `cvc4 --show-config` +6. Configure cvc5 with options listed by `cvc5 --show-config` ``` ./configure.sh --static ``` -7. Follow remaining steps from [build instructions](#building-cvc4) +7. Follow remaining steps from [build instructions](#building-cvc5) diff --git a/README.md b/README.md index e2318ec55..816e3854e 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,20 @@ https://img.shields.io/endpoint?url=https://cvc4.cs.stanford.edu/downloads/builds/coverage/nightly-coverage.json)]( https://cvc4.cs.stanford.edu/downloads/builds/coverage) -CVC4 +cvc5 =============================================================================== -CVC4 is a tool for determining the satisfiability of a first order formula +cvc5 is a tool for determining the satisfiability of a first order formula modulo a first order theory (or a combination of such theories). It is the fourth in the Cooperating Validity Checker family of tools (CVC, CVC Lite, CVC3) but does not directly incorporate code from any previous version. -If you are using CVC4 in your work, or incorporating it into software of your +If you are using cvc5 in your work, or incorporating it into software of your own, we invite you to send us a description and link to your project/software, so that we can link it on our [Third Party Applications](https://cvc4.github.io/third-party-applications.html) page. -CVC4 is intended to be an open and extensible SMT engine. It can be used as a +cvc5 is intended to be an open and extensible SMT engine. It can be used as a stand-alone tool or as a library. It has been designed to increase the performance and reduce the memory overhead of its predecessors. It is written entirely in C++ and is released under an open-source software license (see file @@ -53,7 +53,7 @@ found [here](http://cvc4.cs.stanford.edu/downloads). Build and Dependencies ------------------------------------------------------------------------------- -CVC4 can be built on Linux and macOS. For Windows, CVC4 can be cross-compiled +cvc5 can be built on Linux and macOS. For Windows, cvc5 can be cross-compiled using Mingw-w64. For detailed build and installation instructions on these platforms, @@ -63,9 +63,9 @@ see file [INSTALL.md](https://github.com/CVC4/CVC4/blob/master/INSTALL.md). Bug Reports ------------------------------------------------------------------------------- -If you need to report a bug with CVC4, or make a feature request, please visit +If you need to report a bug with cvc5, or make a feature request, please visit our bugtracker at our [GitHub issues](https://github.com/CVC4/CVC4/issues) -page. We are very grateful for bug reports, as they help us improve CVC4. +page. We are very grateful for bug reports, as they help us improve cvc5. Contributing diff --git a/cmake/CVC4Config.cmake.in b/cmake/CVC4Config.cmake.in deleted file mode 100644 index c85973a6a..000000000 --- a/cmake/CVC4Config.cmake.in +++ /dev/null @@ -1,29 +0,0 @@ -############################################################################### -# Top contributors (to current version): -# Mudathir Mohamed, Mathias Preiner, Andres Noetzli -# -# This file is part of the cvc5 project. -# -# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS -# in the top-level source directory and their institutional affiliations. -# All rights reserved. See the file COPYING in the top-level source -# directory for licensing information. -# ############################################################################# -## - -@PACKAGE_INIT@ - -set(CVC5_BINDINGS_JAVA @BUILD_BINDINGS_JAVA@) -set(CVC5_BINDINGS_PYTHON @BUILD_BINDINGS_PYTHON@) -set(CVC5_BINDINGS_PYTHON_VERSION @BUILD_BINDINGS_PYTHON_VERSION@) - -if(NOT TARGET CVC4::cvc4) - include(${CMAKE_CURRENT_LIST_DIR}/CVC4Targets.cmake) -endif() - -# TODO(project wishue #83): enable these lines -# if(CVC5_BINDINGS_JAVA AND NOT TARGET CVC4::cvc4jar) -# set_and_check(CVC5_JNI_PATH "@PACKAGE_LIBRARY_INSTALL_DIR@") -# include(${CMAKE_CURRENT_LIST_DIR}/CVC4JavaTargets.cmake) -# endif() - diff --git a/cmake/ConfigCompetition.cmake b/cmake/ConfigCompetition.cmake index 615371915..785f792d4 100644 --- a/cmake/ConfigCompetition.cmake +++ b/cmake/ConfigCompetition.cmake @@ -18,30 +18,30 @@ add_check_c_cxx_flag("-fno-enforce-eh-specs") # OPTLEVEL=9 set(OPTIMIZATION_LEVEL 9) # enable_debug_symbols=no -cvc4_set_option(ENABLE_DEBUG_SYMBOLS OFF) +cvc5_set_option(ENABLE_DEBUG_SYMBOLS OFF) # enable_statistics=no -cvc4_set_option(ENABLE_STATISTICS OFF) +cvc5_set_option(ENABLE_STATISTICS OFF) # enable_assertions=no -cvc4_set_option(ENABLE_ASSERTIONS OFF) +cvc5_set_option(ENABLE_ASSERTIONS OFF) # enable_proof=no -cvc4_set_option(ENABLE_PROOFS OFF) +cvc5_set_option(ENABLE_PROOFS OFF) # enable_tracing=no -cvc4_set_option(ENABLE_TRACING OFF) +cvc5_set_option(ENABLE_TRACING OFF) # enable_dumping=no -cvc4_set_option(ENABLE_DUMPING OFF) +cvc5_set_option(ENABLE_DUMPING OFF) # enable_muzzle=yes -cvc4_set_option(ENABLE_MUZZLE ON) +cvc5_set_option(ENABLE_MUZZLE ON) # enable_valgrind=no # enable_shared=no -cvc4_set_option(ENABLE_SHARED OFF) -cvc4_set_option(ENABLE_UNIT_TESTING OFF) +cvc5_set_option(ENABLE_SHARED OFF) +cvc5_set_option(ENABLE_UNIT_TESTING OFF) # By default, we include all dependencies in our competition build that are # required to achieve the best performance set(ENABLE_GPL ON) -cvc4_set_option(USE_CADICAL ON) -cvc4_set_option(USE_CLN ON) -cvc4_set_option(USE_CRYPTOMINISAT ON) -cvc4_set_option(USE_EDITLINE OFF) -cvc4_set_option(USE_GLPK ON) -cvc4_set_option(USE_SYMFPU ON) +cvc5_set_option(USE_CADICAL ON) +cvc5_set_option(USE_CLN ON) +cvc5_set_option(USE_CRYPTOMINISAT ON) +cvc5_set_option(USE_EDITLINE OFF) +cvc5_set_option(USE_GLPK ON) +cvc5_set_option(USE_SYMFPU ON) diff --git a/cmake/ConfigDebug.cmake b/cmake/ConfigDebug.cmake index d89104bb4..bab629607 100644 --- a/cmake/ConfigDebug.cmake +++ b/cmake/ConfigDebug.cmake @@ -15,21 +15,21 @@ add_definitions(-DCVC5_DEBUG) add_check_c_cxx_flag("-fno-inline") set(OPTIMIZATION_LEVEL "g") # enable_debug_symbols=yes -cvc4_set_option(ENABLE_DEBUG_SYMBOLS ON) +cvc5_set_option(ENABLE_DEBUG_SYMBOLS ON) # enable_statistics=yes -cvc4_set_option(ENABLE_STATISTICS ON) +cvc5_set_option(ENABLE_STATISTICS ON) # enable_assertions=yes -cvc4_set_option(ENABLE_ASSERTIONS ON) +cvc5_set_option(ENABLE_ASSERTIONS ON) # enable_proof=yes -cvc4_set_option(ENABLE_PROOFS ON) +cvc5_set_option(ENABLE_PROOFS ON) # enable_tracing=yes -cvc4_set_option(ENABLE_TRACING ON) +cvc5_set_option(ENABLE_TRACING ON) # enable_dumping=yes -cvc4_set_option(ENABLE_DUMPING ON) +cvc5_set_option(ENABLE_DUMPING ON) # enable_muzzle=no -cvc4_set_option(ENABLE_MUZZLE OFF) +cvc5_set_option(ENABLE_MUZZLE OFF) # enable_valgrind=optional -cvc4_set_option(ENABLE_UNIT_TESTING ON) +cvc5_set_option(ENABLE_UNIT_TESTING ON) # Reset visibility for debug builds (https://github.com/CVC4/CVC4/issues/324) set(CMAKE_CXX_VISIBILITY_PRESET default) diff --git a/cmake/ConfigProduction.cmake b/cmake/ConfigProduction.cmake index b33d42a01..5d94f038e 100644 --- a/cmake/ConfigProduction.cmake +++ b/cmake/ConfigProduction.cmake @@ -14,18 +14,18 @@ # OPTLEVEL=3 set(OPTIMIZATION_LEVEL 3) # enable_debug_symbols=no -cvc4_set_option(ENABLE_DEBUG_SYMBOLS OFF) +cvc5_set_option(ENABLE_DEBUG_SYMBOLS OFF) # enable_statistics=yes -cvc4_set_option(ENABLE_STATISTICS ON) +cvc5_set_option(ENABLE_STATISTICS ON) # enable_assertions=no -cvc4_set_option(ENABLE_ASSERTIONS OFF) +cvc5_set_option(ENABLE_ASSERTIONS OFF) # enable_proof=yes -cvc4_set_option(ENABLE_PROOFS ON) +cvc5_set_option(ENABLE_PROOFS ON) # enable_tracing=no -cvc4_set_option(ENABLE_TRACING OFF) +cvc5_set_option(ENABLE_TRACING OFF) # enable_dumping=yes -cvc4_set_option(ENABLE_DUMPING ON) +cvc5_set_option(ENABLE_DUMPING ON) # enable_muzzle=no -cvc4_set_option(ENABLE_MUZZLE OFF) +cvc5_set_option(ENABLE_MUZZLE OFF) # enable_valgrind=no -cvc4_set_option(ENABLE_UNIT_TESTING OFF) +cvc5_set_option(ENABLE_UNIT_TESTING OFF) diff --git a/cmake/ConfigTesting.cmake b/cmake/ConfigTesting.cmake index 56086e6a0..e1e1ef6f6 100644 --- a/cmake/ConfigTesting.cmake +++ b/cmake/ConfigTesting.cmake @@ -14,18 +14,18 @@ # OPTLEVEL=2 set(OPTIMIZATION_LEVEL 2) # enable_debug_symbols=yes -cvc4_set_option(ENABLE_DEBUG_SYMBOLS ON) +cvc5_set_option(ENABLE_DEBUG_SYMBOLS ON) # enable_statistics=yes -cvc4_set_option(ENABLE_STATISTICS ON) +cvc5_set_option(ENABLE_STATISTICS ON) # enable_assertions=yes -cvc4_set_option(ENABLE_ASSERTIONS ON) +cvc5_set_option(ENABLE_ASSERTIONS ON) # enable_proof=yes -cvc4_set_option(ENABLE_PROOFS ON) +cvc5_set_option(ENABLE_PROOFS ON) # enable_tracing=yes -cvc4_set_option(ENABLE_TRACING ON) +cvc5_set_option(ENABLE_TRACING ON) # enable_dumping=yes -cvc4_set_option(ENABLE_DUMPING ON) +cvc5_set_option(ENABLE_DUMPING ON) # enable_muzzle=no -cvc4_set_option(ENABLE_MUZZLE OFF) +cvc5_set_option(ENABLE_MUZZLE OFF) # enable_valgrind=no -cvc4_set_option(ENABLE_UNIT_TESTING ON) +cvc5_set_option(ENABLE_UNIT_TESTING ON) diff --git a/cmake/ConfigureCVC4.cmake b/cmake/ConfigureCVC4.cmake deleted file mode 100644 index 009e9969b..000000000 --- a/cmake/ConfigureCVC4.cmake +++ /dev/null @@ -1,111 +0,0 @@ -############################################################################### -# Top contributors (to current version): -# Mathias Preiner, Gereon Kremer, Makai Mann -# -# This file is part of the cvc5 project. -# -# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS -# in the top-level source directory and their institutional affiliations. -# All rights reserved. See the file COPYING in the top-level source -# directory for licensing information. -# ############################################################################# -## - -include(CheckCXXSourceCompiles) -include(CheckIncludeFile) -include(CheckIncludeFileCXX) -include(CheckSymbolExists) -include(CheckLibraryExists) - -# Check whether "long" and "int64_t" are distinct types w.r.t. overloading. -# Even if they have the same size, they can be distinct, and some platforms -# can have problems with ambiguous function calls when auto-converting -# int64_t to long, and others will complain if you overload a function -# that takes an int64_t with one that takes a long (giving a redefinition -# error). So we have to keep both happy. Probably the same underlying -# issue as the hash specialization below, but let's check separately -# for flexibility. -check_cxx_source_compiles( - " - #include - void foo(long) {} - void foo(int64_t) {} - int main() { return 0; } - " - CVC5_NEED_INT64_T_OVERLOADS -) -if(NOT CVC5_NEED_INT64_T_OVERLOADS) - set(CVC5_NEED_INT64_T_OVERLOADS 0) -endif() - -# Check to see if this version/architecture of GNU C++ explicitly -# instantiates std::hash or not. Some do, some don't. -# See src/util/hash.h. -check_cxx_source_compiles( - " - #include - #include - namespace std { template<> struct hash {}; } - int main() { return 0; } - " - CVC5_NEED_HASH_UINT64_T_OVERLOAD -) -if(CVC5_NEED_HASH_UINT64_T_OVERLOAD) - add_definitions(-DCVC5_NEED_HASH_UINT64_T) -endif() - -check_include_file(unistd.h HAVE_UNISTD_H) -check_include_file_cxx(ext/stdio_filebuf.h HAVE_EXT_STDIO_FILEBUF_H) - -# For Windows builds check if clock_gettime is available via -lpthread -# (pthread_time.h). -if(CVC5_WINDOWS_BUILD) - set(CMAKE_REQUIRED_FLAGS -pthread) - check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) - unset(CMAKE_REQUIRED_FLAGS) - if(HAVE_CLOCK_GETTIME) - add_c_cxx_flag(-pthread) - endif() -else() - check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) - if(NOT HAVE_CLOCK_GETTIME) - unset(HAVE_CLOCK_GETTIME CACHE) - check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) - find_library(RT_LIBRARIES NAMES rt) - endif() -endif() -check_symbol_exists(ffs "strings.h" HAVE_FFS) -check_symbol_exists(optreset "getopt.h" HAVE_DECL_OPTRESET) -check_symbol_exists(sigaltstack "signal.h" HAVE_SIGALTSTACK) -check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R) -check_symbol_exists(strtok_r "string.h" HAVE_STRTOK_R) -check_symbol_exists(setitimer "sys/time.h" HAVE_SETITIMER) - -# on non-POSIX systems, time limit is implemented with threads -if(NOT HAVE_SETITIMER) - find_package(Threads REQUIRED) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}") -endif() - -# Determine if we have the POSIX (int) or GNU (char *) variant of strerror_r. -check_c_source_compiles( - " - #include - int main(void) - { - char buf[1]; - char c = *strerror_r(0, buf, 0); - return 0; - } - " - STRERROR_R_CHAR_P -) - -# Defined if using the CLN multi-precision arithmetic library. -set(CVC5_CLN_IMP ${CVC5_USE_CLN_IMP}) -# Defined if using the GMP multi-precision arithmetic library. -set(CVC5_GMP_IMP ${CVC5_USE_GMP_IMP}) -# Defined if using the libpoly polynomial library. -set(CVC5_POLY_IMP ${CVC5_USE_POLY_IMP}) -# Define the full name of this package. -set(CVC5_PACKAGE_NAME "${PROJECT_NAME}") diff --git a/cmake/ConfigureCvc5.cmake b/cmake/ConfigureCvc5.cmake new file mode 100644 index 000000000..009e9969b --- /dev/null +++ b/cmake/ConfigureCvc5.cmake @@ -0,0 +1,111 @@ +############################################################################### +# Top contributors (to current version): +# Mathias Preiner, Gereon Kremer, Makai Mann +# +# This file is part of the cvc5 project. +# +# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS +# in the top-level source directory and their institutional affiliations. +# All rights reserved. See the file COPYING in the top-level source +# directory for licensing information. +# ############################################################################# +## + +include(CheckCXXSourceCompiles) +include(CheckIncludeFile) +include(CheckIncludeFileCXX) +include(CheckSymbolExists) +include(CheckLibraryExists) + +# Check whether "long" and "int64_t" are distinct types w.r.t. overloading. +# Even if they have the same size, they can be distinct, and some platforms +# can have problems with ambiguous function calls when auto-converting +# int64_t to long, and others will complain if you overload a function +# that takes an int64_t with one that takes a long (giving a redefinition +# error). So we have to keep both happy. Probably the same underlying +# issue as the hash specialization below, but let's check separately +# for flexibility. +check_cxx_source_compiles( + " + #include + void foo(long) {} + void foo(int64_t) {} + int main() { return 0; } + " + CVC5_NEED_INT64_T_OVERLOADS +) +if(NOT CVC5_NEED_INT64_T_OVERLOADS) + set(CVC5_NEED_INT64_T_OVERLOADS 0) +endif() + +# Check to see if this version/architecture of GNU C++ explicitly +# instantiates std::hash or not. Some do, some don't. +# See src/util/hash.h. +check_cxx_source_compiles( + " + #include + #include + namespace std { template<> struct hash {}; } + int main() { return 0; } + " + CVC5_NEED_HASH_UINT64_T_OVERLOAD +) +if(CVC5_NEED_HASH_UINT64_T_OVERLOAD) + add_definitions(-DCVC5_NEED_HASH_UINT64_T) +endif() + +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file_cxx(ext/stdio_filebuf.h HAVE_EXT_STDIO_FILEBUF_H) + +# For Windows builds check if clock_gettime is available via -lpthread +# (pthread_time.h). +if(CVC5_WINDOWS_BUILD) + set(CMAKE_REQUIRED_FLAGS -pthread) + check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) + unset(CMAKE_REQUIRED_FLAGS) + if(HAVE_CLOCK_GETTIME) + add_c_cxx_flag(-pthread) + endif() +else() + check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) + if(NOT HAVE_CLOCK_GETTIME) + unset(HAVE_CLOCK_GETTIME CACHE) + check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) + find_library(RT_LIBRARIES NAMES rt) + endif() +endif() +check_symbol_exists(ffs "strings.h" HAVE_FFS) +check_symbol_exists(optreset "getopt.h" HAVE_DECL_OPTRESET) +check_symbol_exists(sigaltstack "signal.h" HAVE_SIGALTSTACK) +check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R) +check_symbol_exists(strtok_r "string.h" HAVE_STRTOK_R) +check_symbol_exists(setitimer "sys/time.h" HAVE_SETITIMER) + +# on non-POSIX systems, time limit is implemented with threads +if(NOT HAVE_SETITIMER) + find_package(Threads REQUIRED) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}") +endif() + +# Determine if we have the POSIX (int) or GNU (char *) variant of strerror_r. +check_c_source_compiles( + " + #include + int main(void) + { + char buf[1]; + char c = *strerror_r(0, buf, 0); + return 0; + } + " + STRERROR_R_CHAR_P +) + +# Defined if using the CLN multi-precision arithmetic library. +set(CVC5_CLN_IMP ${CVC5_USE_CLN_IMP}) +# Defined if using the GMP multi-precision arithmetic library. +set(CVC5_GMP_IMP ${CVC5_USE_GMP_IMP}) +# Defined if using the libpoly polynomial library. +set(CVC5_POLY_IMP ${CVC5_USE_POLY_IMP}) +# Define the full name of this package. +set(CVC5_PACKAGE_NAME "${PROJECT_NAME}") diff --git a/cmake/Helpers.cmake b/cmake/Helpers.cmake index bb102e482..10bcf96de 100644 --- a/cmake/Helpers.cmake +++ b/cmake/Helpers.cmake @@ -99,20 +99,20 @@ macro(add_required_c_cxx_flag flag) add_required_cxx_flag(${flag}) endmacro() -# CVC4 Boolean options are three-valued to detect if an option was set by the +# cvc5 Boolean options are three-valued to detect if an option was set by the # user. The available values are: IGNORE (default), ON, OFF # Default options do not override options that were set by the user, i.e., -# cvc4_set_option only sets an option if it's value is still IGNORE. +# cvc5_set_option only sets an option if it's value is still IGNORE. # This e.g., allows the user to disable proofs for debug builds (where proofs # are enabled by default). -macro(cvc4_option var description) +macro(cvc5_option var description) set(${var} IGNORE CACHE STRING "${description}") # Provide drop down menu options in cmake-gui set_property(CACHE ${var} PROPERTY STRINGS IGNORE ON OFF) endmacro() # Only set option if the user did not set an option. -macro(cvc4_set_option var value) +macro(cvc5_set_option var value) if(${var} STREQUAL "IGNORE") set(${var} ${value}) endif() @@ -145,12 +145,12 @@ function(print_config str var) endfunction() -# Collect all source files that are required to build libcvc4 in LIBCVC4_SRCS -# or LIBCVC4_GEN_SRCS. If GENERATED is the first argument the sources are -# added to LIBCVC4_GEN_SRCS. All sources are prepended with the absolute +# Collect all source files that are required to build libcvc5 in LIBCVC5_SRCS +# or LIBCVC5_GEN_SRCS. If GENERATED is the first argument the sources are +# added to LIBCVC5_GEN_SRCS. All sources are prepended with the absolute # current path path. CMAKE_CURRENT_BINARY_DIR is prepended # to generated source files. -macro(libcvc4_add_sources) +macro(libcvc5_add_sources) set(_sources ${ARGV}) # Check if the first argument is GENERATED. @@ -158,10 +158,10 @@ macro(libcvc4_add_sources) if(${_generated} STREQUAL "GENERATED") list(REMOVE_AT _sources 0) set(_cur_path ${CMAKE_CURRENT_BINARY_DIR}) - set(_append_to LIBCVC4_GEN_SRCS) + set(_append_to LIBCVC5_GEN_SRCS) else() set(_cur_path ${CMAKE_CURRENT_SOURCE_DIR}) - set(_append_to LIBCVC4_SRCS) + set(_append_to LIBCVC5_SRCS) endif() # Prepend source files with current path. diff --git a/cmake/cvc5Config.cmake.in b/cmake/cvc5Config.cmake.in new file mode 100644 index 000000000..6b238fb38 --- /dev/null +++ b/cmake/cvc5Config.cmake.in @@ -0,0 +1,29 @@ +############################################################################### +# Top contributors (to current version): +# Mudathir Mohamed, Mathias Preiner, Andres Noetzli +# +# This file is part of the cvc5 project. +# +# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS +# in the top-level source directory and their institutional affiliations. +# All rights reserved. See the file COPYING in the top-level source +# directory for licensing information. +# ############################################################################# +## + +@PACKAGE_INIT@ + +set(CVC5_BINDINGS_JAVA @BUILD_BINDINGS_JAVA@) +set(CVC5_BINDINGS_PYTHON @BUILD_BINDINGS_PYTHON@) +set(CVC5_BINDINGS_PYTHON_VERSION @BUILD_BINDINGS_PYTHON_VERSION@) + +if(NOT TARGET cvc5::cvc5) + include(${CMAKE_CURRENT_LIST_DIR}/cvc5Targets.cmake) +endif() + +# TODO(project wishue #83): enable these lines +# if(CVC5_BINDINGS_JAVA AND NOT TARGET cvc5::cvc5jar) +# set_and_check(CVC5_JNI_PATH "@PACKAGE_LIBRARY_INSTALL_DIR@") +# include(${CMAKE_CURRENT_LIST_DIR}/cvc5JavaTargets.cmake) +# endif() + diff --git a/contrib/README b/contrib/README index 47d4941bd..9b3ef11a0 100644 --- a/contrib/README +++ b/contrib/README @@ -1,4 +1,4 @@ -This directory is for contributions to CVC4 that aren't directly +This directory is for contributions to cvc5 that aren't directly part of the main project. -- Morgan Deters Mon, 09 Nov 2009 15:14:41 -0500 diff --git a/contrib/alttheoryskel/README.WHATS-NEXT b/contrib/alttheoryskel/README.WHATS-NEXT deleted file mode 100644 index c0237c300..000000000 --- a/contrib/alttheoryskel/README.WHATS-NEXT +++ /dev/null @@ -1,25 +0,0 @@ -Congratulations, you now have a new theory of $dir ! - -Your next steps will likely be: - -* to implement a decision procedure for your theory by implementing - Theory$camel::check() in theory_$dir.cpp. Before writing the actual - code, you will need : - - * to determine which data structures are context dependent and use for - them context-dependent data structures (context/cd*.h) - * to choose which work will be done at QUICK_CHECK, STANDARD or at - FULL_EFFORT. - -You'll probably find the Developer's wiki useful: - - http://cvc4.cs.stanford.edu/wiki/ - -...and the Developer's Guide: - - https://github.com/CVC4/CVC4/wiki/Developer-Guide - -which contains coding guidelines for the CVC4 project. - -Good luck, and please contact cvc4-devel@cs.stanford.edu for assistance -should you need it! diff --git a/contrib/alttheoryskel/kinds b/contrib/alttheoryskel/kinds deleted file mode 100644 index 44efe1698..000000000 --- a/contrib/alttheoryskel/kinds +++ /dev/null @@ -1,8 +0,0 @@ -# kinds -*- sh -*- -# -# For documentation on this file format, please refer to -# src/theory/builtin/kinds. -# - -alternate THEORY_$alt_id "$dir" ::CVC4::theory::$dir::Theory$camel "theory/$dir/theory_$dir.h" - diff --git a/contrib/alttheoryskel/options b/contrib/alttheoryskel/options deleted file mode 100644 index f627dc4a0..000000000 --- a/contrib/alttheoryskel/options +++ /dev/null @@ -1,8 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module $id "theory/$dir/options.h" $camel - -endmodule diff --git a/contrib/alttheoryskel/options_handlers.h b/contrib/alttheoryskel/options_handlers.h deleted file mode 100644 index d384e84d9..000000000 --- a/contrib/alttheoryskel/options_handlers.h +++ /dev/null @@ -1,14 +0,0 @@ -#include "cvc4_private.h" - -#ifndef __CVC4__THEORY__$id__OPTIONS_HANDLERS_H -#define __CVC4__THEORY__$id__OPTIONS_HANDLERS_H - -namespace CVC4 { -namespace theory { -namespace $dir { - -}/* CVC4::theory::$dir namespace */ -}/* CVC4::theory namespace */ -}/* CVC4 namespace */ - -#endif /* __CVC4__THEORY__$id__OPTIONS_HANDLERS_H */ diff --git a/contrib/alttheoryskel/theory_DIR.cpp b/contrib/alttheoryskel/theory_DIR.cpp deleted file mode 100644 index b1cd27c89..000000000 --- a/contrib/alttheoryskel/theory_DIR.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "theory/$dir/theory_$dir.h" - -using namespace std; - -namespace CVC4 { -namespace theory { -namespace $dir { - -/** Constructs a new instance of Theory$camel w.r.t. the provided contexts. */ -Theory$camel::Theory$camel(context::Context* c, - context::UserContext* u, - OutputChannel& out, - Valuation valuation, - const LogicInfo& logicInfo) : - Theory(THEORY_$alt_id, c, u, out, valuation, logicInfo) { -}/* Theory$camel::Theory$camel() */ - -void Theory$camel::check(Effort level) { - if (done() && !fullEffort(level)) { - return; - } - - TimerStat::CodeTimer checkTimer(d_checkTime); - - while(!done()) { - // Get all the assertions - Assertion assertion = get(); - TNode fact = assertion.assertion; - - Debug("$dir") << "Theory$camel::check(): processing " << fact << std::endl; - - // Do the work - switch(fact.getKind()) { - - /* cases for all the theory's kinds go here... */ - - default: - Unhandled(fact.getKind()); - } - } - -}/* Theory$camel::check() */ - -}/* CVC4::theory::$dir namespace */ -}/* CVC4::theory namespace */ -}/* CVC4 namespace */ diff --git a/contrib/alttheoryskel/theory_DIR.h b/contrib/alttheoryskel/theory_DIR.h deleted file mode 100644 index d8e652b7c..000000000 --- a/contrib/alttheoryskel/theory_DIR.h +++ /dev/null @@ -1,34 +0,0 @@ -#include "cvc4_private.h" - -#ifndef __CVC4__THEORY__$id__THEORY_$id_H -#define __CVC4__THEORY__$id__THEORY_$id_H - -#include "theory/theory.h" - -namespace CVC4 { -namespace theory { -namespace $dir { - -class Theory$camel : public Theory { -public: - - /** Constructs a new instance of Theory$camel w.r.t. the provided contexts. */ - Theory$camel(context::Context* c, - context::UserContext* u, - OutputChannel& out, - Valuation valuation, - const LogicInfo& logicInfo); - - void check(Effort); - - std::string identify() const { - return "THEORY_$id"; - } - -};/* class Theory$camel */ - -}/* CVC4::theory::$dir namespace */ -}/* CVC4::theory namespace */ -}/* CVC4 namespace */ - -#endif /* __CVC4__THEORY__$id__THEORY_$id_H */ diff --git a/contrib/competitions/smt-comp/run-script-smtcomp-current b/contrib/competitions/smt-comp/run-script-smtcomp-current index 3ca8bd32b..715f3fc6c 100755 --- a/contrib/competitions/smt-comp/run-script-smtcomp-current +++ b/contrib/competitions/smt-comp/run-script-smtcomp-current @@ -1,6 +1,6 @@ #!/bin/bash -cvc4=./cvc4 +cvc5=./cvc5 bench="$1" # Output other than "sat"/"unsat" is either written to stderr or to "err.log" @@ -26,7 +26,7 @@ logic=$(expr "$(grep -m1 '^[^;]*set-logic' "$bench")" : ' *(set-logic *\([A-Z_] # returns normally and prints the output of the solver to $out_file. function trywith { limit=$1; shift; - result="$({ ulimit -S -t "$limit"; $cvc4 -L smt2.6 --no-incremental --no-type-checking --no-interactive "$@" $bench; } 2>&1)" + result="$({ ulimit -S -t "$limit"; $cvc5 -L smt2.6 --no-incremental --no-type-checking --no-interactive "$@" $bench; } 2>&1)" case "$result" in sat|unsat) echo "$result"; exit 0;; *) echo "$result" &> "$out_file";; @@ -34,10 +34,10 @@ function trywith { } # use: finishwith [params..] -# to run cvc4. Only "sat" or "unsat" are output. Other outputs are written to +# to run cvc5. Only "sat" or "unsat" are output. Other outputs are written to # $out_file. function finishwith { - result="$({ $cvc4 -L smt2.6 --no-incremental --no-type-checking --no-interactive "$@" $bench; } 2>&1)" + result="$({ $cvc5 -L smt2.6 --no-incremental --no-type-checking --no-interactive "$@" $bench; } 2>&1)" case "$result" in sat|unsat) echo "$result"; exit 0;; *) echo "$result" &> "$out_file";; diff --git a/contrib/competitions/smt-comp/run-script-smtcomp-current-incremental b/contrib/competitions/smt-comp/run-script-smtcomp-current-incremental index 7861a4c85..e0b51bc46 100755 --- a/contrib/competitions/smt-comp/run-script-smtcomp-current-incremental +++ b/contrib/competitions/smt-comp/run-script-smtcomp-current-incremental @@ -1,6 +1,6 @@ #!/bin/bash -cvc4=./cvc4 +cvc5=./cvc5 line="" while [[ -z "$line" ]]; do @@ -22,54 +22,54 @@ if [ -z "$logic" ]; then fi echo success -function runcvc4 { +function runcvc5 { # we run in this way for line-buffered input, otherwise memory's a # concern (plus it mimics what we'll end up getting from an # application-track trace runner?) - $cvc4 --force-logic="$logic" -L smt2.6 --print-success --no-type-checking --no-interactive "$@" <&0- + $cvc5 --force-logic="$logic" -L smt2.6 --print-success --no-type-checking --no-interactive "$@" <&0- } case "$logic" in ALIA|ANIA|AUFNIRA|LIA|LRA|QF_ALIA|QF_ANIA|QF_AUFBVLIA|QF_AUFBVNIA|QF_LIA|QF_LRA|QF_NIA|QF_UFBVLIA|QF_UFLIA|QF_UFLRA|QF_UFNIA|UFLRA) - runcvc4 --tear-down-incremental=1 + runcvc5 --tear-down-incremental=1 ;; QF_AUFLIA) - runcvc4 --tear-down-incremental=1 --no-arrays-eager-index --arrays-eager-lemmas + runcvc5 --tear-down-incremental=1 --no-arrays-eager-index --arrays-eager-lemmas ;; QF_BV) - runcvc4 --incremental --bitblast=eager --bv-sat-solver=cadical + runcvc5 --incremental --bitblast=eager --bv-sat-solver=cadical ;; QF_UFBV) - runcvc4 --incremental + runcvc5 --incremental ;; QF_UF) - runcvc4 --incremental + runcvc5 --incremental ;; QF_AUFBV) - runcvc4 --incremental + runcvc5 --incremental ;; QF_ABV) - runcvc4 --incremental + runcvc5 --incremental ;; ABVFP) - runcvc4 --incremental + runcvc5 --incremental ;; BVFP) - runcvc4 --incremental + runcvc5 --incremental ;; QF_ABVFP) - runcvc4 --incremental + runcvc5 --incremental ;; QF_BVFP) - runcvc4 --incremental + runcvc5 --incremental ;; QF_FP) - runcvc4 --incremental + runcvc5 --incremental ;; *) # just run the default - runcvc4 --incremental + runcvc5 --incremental ;; esac diff --git a/contrib/competitions/smt-comp/run-script-smtcomp-current-model-validation b/contrib/competitions/smt-comp/run-script-smtcomp-current-model-validation index 9982a9e29..338215a52 100755 --- a/contrib/competitions/smt-comp/run-script-smtcomp-current-model-validation +++ b/contrib/competitions/smt-comp/run-script-smtcomp-current-model-validation @@ -1,14 +1,14 @@ #!/bin/bash -cvc4=./cvc4 +cvc5=./cvc5 bench="$1" logic=$(expr "$(grep -m1 '^[^;]*set-logic' "$bench")" : ' *(set-logic *\([A-Z_]*\) *) *$') # use: finishwith [params..] -# to run cvc4 and let it output whatever it will to stdout. +# to run cvc5 and let it output whatever it will to stdout. function finishwith { - $cvc4 -L smt2.6 --no-incremental --no-type-checking --no-interactive "$@" $bench + $cvc5 -L smt2.6 --no-incremental --no-type-checking --no-interactive "$@" $bench } case "$logic" in diff --git a/contrib/competitions/smt-comp/run-script-smtcomp-current-unsat-cores b/contrib/competitions/smt-comp/run-script-smtcomp-current-unsat-cores index 5cb2ab610..ab6e2a6fc 100755 --- a/contrib/competitions/smt-comp/run-script-smtcomp-current-unsat-cores +++ b/contrib/competitions/smt-comp/run-script-smtcomp-current-unsat-cores @@ -1,14 +1,14 @@ #!/bin/bash -cvc4=./cvc4 +cvc5=./cvc5 bench="$1" logic=$(expr "$(grep -m1 '^[^;]*set-logic' "$bench")" : ' *(set-logic *\([A-Z_]*\) *) *$') # use: finishwith [params..] -# to run cvc4 and let it output whatever it will to stdout. +# to run cvc5 and let it output whatever it will to stdout. function finishwith { - $cvc4 -L smt2.6 --no-incremental --no-type-checking --no-interactive "$@" $bench + $cvc5 -L smt2.6 --no-incremental --no-type-checking --no-interactive "$@" $bench } case "$logic" in diff --git a/contrib/cut-release b/contrib/cut-release deleted file mode 100755 index f13d22298..000000000 --- a/contrib/cut-release +++ /dev/null @@ -1,345 +0,0 @@ -#!/bin/bash -# -# usage: cut-release [-n] version-designation [make-args...] -# - - -dryrun=false -getantlr="./contrib/get-antlr-3.4" -dogetantlr=false -configantlr="" -version="" -cutrelease=`basename "$0"` - -function isthatright { - if $dryrun; then - echo -n "[DRY RUN] " - fi - if [ -z "$1" ]; then - echo -n "Does that look right? [y/n] " - else - echo -n "$1? [y/n] " - fi - while read yn; do - if [ "$yn" = y -o "$yn" = Y -o "$yn" = yes -o "$yn" = YES -o "$yn" = Yes ]; then - break - elif [ "$yn" = n -o "$yn" = N -o "$yn" = no -o "$yn" = NO -o "$yn" = No ]; then - echo "Aborting as per user request." >&2 - exit 1 - else - echo -n "[y/n] " - fi - done -} - -function printusage { - echo "Usage: $cutrelease version-designation [make-args...]" >&2 - echo - echo "Options:" - echo - echo " -h, --help print this message and exit" - echo - echo " -n do a dry run (do sanity checks and build " - echo " but don not touch the repository)" - echo - echo " -a get local antlr to use for compilation" -} - -function error { - echo "$cutrelease: ERROR: $1" >&2 -} - -function die { - error "$1" - exit 1 -} - -function internalerror { - echo "$cutrelease: INTERNAL ERROR: $1" >&2 - exit 1 -} - -if ! [ -e src/expr/node.h -a -e .git ]; then - die "You should run this from the top-level of a CVC4 git working directory" -fi - -while [[ $# -gt 0 ]] -do - arg="$1" - case $arg in - -h | --help) - printusage - exit 0 - ;; - -n) - dryrun=true - shift - ;; - -a) - dogetantlr=true - shift - ;; - -*) - error "invalid option $arg" - echo - printusage - exit 1 - ;; - *) - if [ "x$version" = "x" ] - then - version="$arg" - shift - if echo "$version" | grep '[^a-zA-Z0-9_.+(){}^%#-]' &>/dev/null - then - die "Version designation \`$version' contains illegal characters" - fi - break - fi - esac -done -makeargs="$@" - -if [ "x$version" = "x" ] -then - error "missing version-designation" - echo - printusage - exit 1 -fi - -if $dryrun -then - echo - echo '************************* DRY RUN *************************' -fi - -eval "declare -a vs=($(echo "$version" | sed 's,^\([0-9]*\)\.\([0-9]*\)\(\.\([0-9]*\)\)\?\(.*\),[0]=\1 [1]=\2 [2]=\4 [3]=\5,'))" -major=${vs[0]} -minor=${vs[1]}; if [ -z "$minor" ]; then minor=0; fi -release=${vs[2]}; if [ -z "$release" ]; then release=0; fi -extra=${vs[3]} -echo -echo "Major : $major" -echo "Minor : $minor" -echo "Release: $release" -echo "Extra : $extra" -echo -version="$major.$minor" -if [ "$release" != 0 ]; then - version="$version.$release" -fi -version="$version$extra" -echo "Version: $version" -echo -isthatright - -echo "Checking whether release \`$version' already exists..." -if [ -n "`git tag -l "$version"`" ]; then - error "Git repo already contains a release \`$version'" - $dryrun || exit 1 -fi - -echo "Checking working directory for local modifications..." -if $dryrun; then - if [ -n "$(git status -s configure.ac)" ]; then - die "In dry-run mode, cannot operate properly with local modifications to \"configure.ac\", sorry" - fi -elif [ -n "$(git status -s | grep -v '^ *M *\(NEWS\|README\|AUTHORS\|RELEASE-NOTES\|INSTALL\|THANKS\|library_versions\|contrib/cut-release\)$')" ]; then - die "\"git status\" indicates there are local modifications; please commit first" -fi - -echo "Checking repo for unmerged updates..." -git fetch &>/dev/null -if git status -sb | grep -q '^## .* \[.*behind '; then - error "This working directory isn't up to date" - $dryrun || exit 1 -fi - -echo "Checking sources for broken public headers..." -suspect_files="\ -$(grep -r --exclude-dir=.git '^[ \t]*#[ \t]*include[ \t]*"[^/]*"' src | - grep -v '"cvc4parser_public\.h"' | - grep -v '"cvc4_public\.h"' | - grep -v '"cvc4_private\.h"' | - grep -v '"cvc4autoconfig\.h"' | - grep -v '"cvc4parser_private\.h"' | - cut -f1 -d: | - sort -u | - xargs grep -l '^[ \t]*#[ \t]*include[ \t]*"cvc4.*public\.h"' | - xargs echo)" -if [ -n "$suspect_files" ]; then - error "The following publicly-installed headers appear" - error " to have relative #includes and may be broken" - error " after install: $suspect_files" - $dryrun || exit 1 -fi - -for updatefile in NEWS README AUTHORS RELEASE-NOTES INSTALL THANKS; do - echo "Checking $updatefile file for recent updates..." - if [ -n "$(git status -s $updatefile)" ]; then - echo "+ It's locally modified." - else - git log -n 1 --date=local --pretty=format:'+ Last changed on %ad (%ar)' $updatefile - echo - case $updatefile in - NEWS) - echo "You should make sure to put some notes in the NEWS file for" - echo "release $version, indicating the most important changes since the" - echo "last release." - ;; - AUTHORS) - echo "You should make sure there are no new authors to list for $version." - ;; - *) - echo "You should ensure that $updatefile is appropriately updated" - echo "for $version before continuing. (Maybe it even lists the previous" - echo "version number!)" - ;; - esac - echo - isthatright "Continue without updating $updatefile" - fi -done - -echo "Adjusting version info lines in configure.ac..." -if ! grep '^m4_define(_CVC4_MAJOR, *[0-9][0-9]* *)' configure.ac &>/dev/null || - ! grep '^m4_define(_CVC4_MINOR, *[0-9][0-9]* *)' configure.ac &>/dev/null || - ! grep '^m4_define(_CVC4_RELEASE, *[0-9][0-9]* *)' configure.ac &>/dev/null || - ! grep '^m4_define(_CVC4_EXTRAVERSION, *\[.*\] *)' configure.ac &>/dev/null; then - error "Cannot locate the version info lines of configure.ac" - $dryrun || exit 1 -fi -perl -pi -e 's/^m4_define\(_CVC4_MAJOR, ( *)[0-9]+( *)\)/m4_define(_CVC4_MAJOR, ${1}'"$major"'$2)/; - s/^m4_define\(_CVC4_MINOR, ( *)[0-9]+( *)\)/m4_define(_CVC4_MINOR, ${1}'"$minor"'$2)/; - s/^m4_define\(_CVC4_RELEASE, ( *)[0-9]+( *)\)/m4_define(_CVC4_RELEASE, ${1}'"$release"'$2)/; - s/^m4_define\(_CVC4_EXTRAVERSION, ( *)\[.*\]( *)\)/m4_define(_CVC4_EXTRAVERSION, $1\['"$extra"'\]$2)/' configure.ac - -trap 'echo; echo; echo "Aborting in error."; git checkout -- configure.ac; echo' EXIT - -echo -echo 'Made the following change to configure.ac:' -echo -git diff configure.ac -echo -isthatright - -if ! grep '^m4_define(_CVC4_MAJOR, *'"$major"' *)' configure.ac &>/dev/null || - ! grep '^m4_define(_CVC4_MINOR, *'"$minor"' *)' configure.ac &>/dev/null || - ! grep '^m4_define(_CVC4_RELEASE, *'"$release"' *)' configure.ac &>/dev/null || - ! grep '^m4_define(_CVC4_EXTRAVERSION, *\['"$extra"'\] *)' configure.ac &>/dev/null; then - internalerror "Cannot find the modified version info lines in configure.ac, bailing..." -fi -if [ -z "$(git status -s configure.ac)" ]; then - internalerror "\"git status\" indicates there are no local modifications to configure.ac; I expected the ones I just made!" -fi - -echo "Building and checking distribution \`cvc4-$version'..." - -if $dogetantlr -then - echo "Fetching and compiling antlr..." - $getantlr > /dev/null 2>&1 - configantlr="--with-antlr-dir=$(pwd)/antlr-3.4 ANTLR=$(pwd)/antlr-3.4/bin/antlr3" -fi - -if ! $SHELL -c '\ - version="'$version'"; \ - set -ex; \ - ./autogen.sh || echo "autoconf failed; does library_versions have something to match $version?"; \ - mkdir "release-$version"; \ - cd "release-$version"; \ - ../configure production-staticbinary --disable-shared --enable-unit-testing --with-portfolio --no-gpl '"$configantlr"'; \ - make dist '"$makeargs"'; \ - tar xf "cvc4-$version.tar.gz"; \ - cd "cvc4-$version"; \ - ./configure production-staticbinary --disable-shared --enable-unit-testing --with-portfolio --no-gpl '"$configantlr"'; \ - make check '"$makeargs"'; \ - make distcheck '"$makeargs"'; \ -'; then - exit 1 -fi - -if ! [ -e release-$version/cvc4-$version.tar.gz ]; then - internalerror "Cannot find the distribution tarball I just built" -fi -if ! [ -e release-$version/cvc4-$version/builds/src/main/cvc4 ]; then - internalerror "Cannot find the binary I just built" -fi - -echo -echo 'This release of CVC4 will identify itself as:' -echo -release-$version/cvc4-$version/builds/src/main/cvc4 --version -echo -isthatright - -echo -echo 'This binary release of CVC4 will identify itself as being configured like this:' -echo -release-$version/cvc4-$version/builds/src/main/cvc4 --show-config -echo -isthatright - -#echo -#echo "Signing tarball..." -#cp -p "release-$version/cvc4-$version.tar.gz" . -#gpg -b --armor "cvc4-$version.tar.gz" - -#echo -#echo "Signing cvc4 binary..." -#cp -p "release-$version/cvc4-$version/builds/src/main/cvc4" "cvc4-$version" -#gpg -b --armor "cvc4-$version" - -#echo -#echo "Signing pcvc4 binary..." -#cp -p "release-$version/src/main/pcvc4" "pcvc4-$version" -#gpg -b --armor "pcvc4-$version" - -if $dryrun; then - echo - echo '************************* DRY RUN *************************' -fi - -echo -echo "About to run: git commit -am \"Cutting release $version.\"" -isthatright -$dryrun || git commit -am "Cutting release $version." - -echo -echo "About to run: git tag \"$version\"" -isthatright -$dryrun || git tag "$version" - -echo -andbranch= -if git status -bs | grep -q '^## master\($\| *\|\.\.\.\)'; then - if [ "$release" = 0 ]; then - echo "About to run: git branch \"$version.x\"" - isthatright - $dryrun || git branch "$version.x" - andbranch=", the $version.x branch," - else - echo "Not branching, because this is a minor release (i.e., not a \"dot-oh\"" - echo "release), so I'm guessing you have a devel branch outside of master" - echo "somewhere? You can still make a branch manually, of course." - fi -else - echo "Not branching, because it appears there already is a branch" - echo "to work with for version $version ..? (You're not on master.)" - echo "You can still make a branch manually, of course." -fi - -echo -echo "Done. Next steps are to:" -echo -echo "1. push to GitHub (don't forget to push master$andbranch and the $version tag)" -echo "2. upload source and binaries" -echo "3. advertise these packages" -echo "4. add a $version release and next-milestone to Bugzilla." -echo "5. change $version to pre-release in master$andbranch" -echo " (in configure.ac) and update library_versions and NEWS." -echo - -trap '' EXIT - diff --git a/contrib/cvc4_strict_smtlib b/contrib/cvc4_strict_smtlib deleted file mode 100644 index 45c7cbe1a..000000000 --- a/contrib/cvc4_strict_smtlib +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -cvc4="${CVC4_HOME}/cvc4" - -# This is the set of command line arguments that is required to be strictly -# complaint with the input and output requirements of the current SMT-LIB -# standard. -"$cvc4" --lang=smt2 --output-lang=smt2 --strict-parsing --expr-depth=-1 --print-success --incremental --abstract-values $@ diff --git a/contrib/cvc5_strict_smtlib b/contrib/cvc5_strict_smtlib new file mode 100644 index 000000000..e746f7504 --- /dev/null +++ b/contrib/cvc5_strict_smtlib @@ -0,0 +1,8 @@ +#!/bin/bash + +cvc5="${CVC5_HOME}/cvc5" + +# This is the set of command line arguments that is required to be strictly +# complaint with the input and output requirements of the current SMT-LIB +# standard. +"$cvc5" --lang=smt2 --output-lang=smt2 --strict-parsing --expr-depth=-1 --print-success --incremental --abstract-values $@ diff --git a/contrib/debug-keys b/contrib/debug-keys deleted file mode 100755 index 6d2804974..000000000 --- a/contrib/debug-keys +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Lists the Trace() and Debug() keys used in sources. -# -# e.g. if Debug("uf") occurs in the sources, then "uf" is printed by this script. - -if [ "$1" = "-h" -o "$1" = "-help" -o "$1" = "-?" -o "$1" = "--help" ]; then - echo "usage: `basename $0` [dirs...]" >&2 - echo "This utility will print all Debug("foo") and Trace("foo") keys." - echo "With optional dirs..., use dirs instead of top-level \"src\"." >&2 - exit 1 -fi - -if [ $# -eq 0 ]; then - cd `dirname "$0"`/.. - - if ! [ -d src ]; then - echo "`basename $0`: not in CVC4 directory tree?!" >&2 - exit 1 - fi - - set src -fi - -echo "Trace and debug flags used in $*:" - -while [ $# -gt 0 ]; do - dir="$1" - shift - - test -r "$dir" && grep -r --exclude-dir=.svn '\(Debug\|Trace\)\(\.isOn\)\?("[^"]\+")' "$dir" | sed 's,.*\(Debug\|Trace\)\(\.isOn\)\?("\([^"]\+\)").*,\3,' | sort -u -done | sort -u - diff --git a/contrib/depgraph b/contrib/depgraph deleted file mode 100755 index b0e650f40..000000000 --- a/contrib/depgraph +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/sh -# -# depgraph -# Morgan Deters, 27 October 2010 -# -# Builds a graphviz graph of dependences between source and header files in CVC4. -# - -progname=`basename "$0"` - -postproc='sort -u' -mode=packages -target= - -if [ $# -gt 0 ]; then - if [ "$1" = "-a" ]; then - postproc=cat - mode=headers - shift - fi - if [ $# -gt 0 -a "$1" != "-h" ]; then - target="$1" - shift - fi - if [ $# -gt 0 ]; then - echo "usage: $progname [-a] [target]" - echo " -a ("all") produces _all_ headers in the source, with clusters for packages." - echo " the default behavior produces just package dependence information." - echo " with target, focus on dependences of that particular package (e.g. \"expr\")" - exit 1 - fi -fi - -cd "`dirname \"$0\"`/.." - -if ! [ -d src -a -d test/unit ]; then - echo "$progname: source directory malformed; is this CVC4 ?!" >&2 - exit 1 -fi - -echo "digraph G {" - -paths=`find src -name '*.c' \ - -o -name '*.cc' \ - -o -name '*.cpp' \ - -o -name '*.C' \ - -o -name '*.h' \ - -o -name '*.hh' \ - -o -name '*.hpp' \ - -o -name '*.H' \ - -o -name '*.y' \ - -o -name '*.yy' \ - -o -name '*.ypp' \ - -o -name '*.Y' \ - -o -name '*.l' \ - -o -name '*.ll' \ - -o -name '*.lpp' \ - -o -name '*.L' \ - -o -name '*.g'` -if [ "$mode" = headers ]; then - oldpackage= - for path in $paths; do - dir=`echo "$path" | sed 's,^\([^/]*\).*,\1,'` - file=`echo "$path" | sed 's,^[^/]*/,,'` - package=`echo "$file" | sed 's,^\(.*\)/.*,\1,'` - file=`echo "$file" | sed 's,^.*/,,'` - if [ -n "$target" -a "$target" != "$package" ]; then continue; fi - if [ -n "$oldpackage" -a "$package" != "$oldpackage" ]; then - echo ' }' - fi - if [ "$package" != "$oldpackage" ]; then - echo " subgraph \"cluster$package\" {" - echo " label=\"$package\";" - oldpackage="$package" - fi - echo " \"$package/$file\"[label=\"$file\"];" - done - if [ -n "$oldpackage" ]; then - echo ' }' - fi -fi -for path in $paths; do - dir=`echo "$path" | sed 's,^\([^/]*\).*,\1,'` - file=`echo "$path" | sed 's,^[^/]*/,,'` - package=`echo "$file" | sed 's,^\(.*\)/.*,\1,'` - file=`echo "$file" | sed 's,^.*/,,'` - incs=`grep '^# *include *".*"' "$path" | sed 's,^# *include *"\(.*\)".*,\1,'` - if [ -n "$target" -a "$target" != "$package" ]; then continue; fi - for inc in $incs; do - case "$inc" in - expr/expr.h) inc=expr/expr_template.h ;; - expr/expr_manager.h) inc=expr/expr_manager_template.h ;; - expr/kind.h) inc=expr/kind_template.h ;; - expr/metakind.h) inc=expr/metakind_template.h ;; - theory/theoryof_table.h) inc=theory/theoryof_table_template.h ;; - util/integer.h) inc=util/integer.h.in ;; - util/rational.h) inc=util/rational.h.in ;; - cvc4autoconfig.h) inc=cvc4autoconfig.h.in ;; - esac - incpath= - dirpackageparent="$dir/`dirname "$package"`" - for incdir in "$dir" "$dir/include" "$dir/$package" . "$dirpackageparent"; do - if [ -e "$incdir/$inc" ]; then incpath="$incdir/$inc"; break; fi - done - if [ -z "$incpath" ]; then - echo "$progname: error: can't find include file '$inc' from source '$path'" >&2 - exit 1 - fi - incpath=`echo "$incpath" | sed 's,^\./,,'` - incpath=`echo "$incpath" | sed "s,^$dir/,,"` - incdir=`echo "$incpath" | sed 's,^\([^/]*\).*,\1,'` - incpackage=`echo "$incpath" | sed 's,^\(.*\)/.*,\1,'` - incfile=`echo "$incpath" | sed 's,^.*/,,'` - if [ "$mode" = packages ]; then - if [ "$package" != "$incpackage" ]; then - if [ -n "$target" ]; then - echo " \"$package\" -> \"$incpackage\"[label=\"$incfile\"];" - else - echo " \"$package\" -> \"$incpackage\";" - fi - fi - else - if [ -n "$target" ]; then - [ "$package" != "$incpackage" ] && echo " \"$package/$file\" -> \"$incpackage\"[label=\"$incfile\"];" - else - echo " \"$package/$file\" -> \"$incpath\";" - fi - fi - done - done | $postproc - -echo "}" diff --git a/contrib/dimacs_to_smt.pl b/contrib/dimacs_to_smt.pl deleted file mode 100755 index 701768119..000000000 --- a/contrib/dimacs_to_smt.pl +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/perl -w -# DIMACS to SMT -# Morgan Deters -# Copyright (c) 2009, 2010, 2011 The CVC4 Project - -use strict; - -my ($nvars, $nclauses); -while(<>) { - next if /^c/; - - if(/^p cnf (\d+) (\d+)/) { - ($nvars, $nclauses) = ($1, $2); - print "(benchmark b\n"; - print ":status unknown\n"; - print ":logic QF_UF\n"; - for(my $i = 1; $i <= $nvars; ++$i) { - print ":extrapreds ((x$i))\n"; - } - print ":formula (and\n"; - next; - } - - print "(or"; - chomp; - @_ = split(/ /); - for(my $i = 0; $i < $#_; ++$i) { - if($_[$i] < 0) { - print " (not x" . -$_[$i] . ")"; - } else { - print " x" . $_[$i]; - } - } - print ")\n"; -} - -print "))\n"; diff --git a/contrib/get-abc b/contrib/get-abc index 9f37a69e3..6f5987586 100755 --- a/contrib/get-abc +++ b/contrib/get-abc @@ -38,5 +38,5 @@ else fi echo -echo ===================== Now configure CVC4 with ===================== +echo ===================== Now configure cvc5 with ===================== echo ./configure.sh --abc diff --git a/contrib/get-authors b/contrib/get-authors index 6457569a5..3bec55130 100755 --- a/contrib/get-authors +++ b/contrib/get-authors @@ -1,7 +1,7 @@ #!/bin/sh # # get-authors -# Copyright (c) 2009-2020 The CVC4 Project +# Copyright (c) 2009-2021 The cvc5 Project # # usage: get-authors [ files... ] # diff --git a/contrib/get-drat2er b/contrib/get-drat2er index 318de1b83..803add62f 100755 --- a/contrib/get-drat2er +++ b/contrib/get-drat2er @@ -16,5 +16,5 @@ cmake .. -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" make install -j$(nproc) echo -echo ===================== Now configure CVC4 with ===================== +echo ===================== Now configure cvc5 with ===================== echo ./configure.sh --drat2er diff --git a/contrib/get-glpk-cut-log b/contrib/get-glpk-cut-log index cf523dc5a..0a5747589 100755 --- a/contrib/get-glpk-cut-log +++ b/contrib/get-glpk-cut-log @@ -40,5 +40,5 @@ rename_installed_lib "libglpk.a" "libglpk-static.a" make install -j$(nproc) echo -echo ===================== Now configure CVC4 with ===================== +echo ===================== Now configure cvc5 with ===================== echo ./configure.sh --gpl --glpk diff --git a/contrib/get-lfsc-checker b/contrib/get-lfsc-checker index 45ae432f6..9a7292fc7 100755 --- a/contrib/get-lfsc-checker +++ b/contrib/get-lfsc-checker @@ -49,25 +49,25 @@ mkdir -p $BASE_DIR/share/lfsc cp -r $SIG_DIR/lfsc/new/signatures $BASE_DIR/share/lfsc # based on https://github.com/CVC4/signatures/blob/master/lfsc/new/scripts/cvc4_gen_and_check.sh -cat << EOF > $BASE_DIR/bin/cvc4-lfsc-check.sh +cat << EOF > $BASE_DIR/bin/cvc5-lfsc-check.sh #!/bin/bash echo "=== Generate proof: \$@" -$BASE_DIR/bin/cvc4-proof.sh \$@ > proof.plf +$BASE_DIR/bin/cvc5-proof.sh \$@ > proof.plf echo "=== Check proof with LFSC" $BASE_DIR/bin/lfsc-check.sh proof.plf EOF -chmod +x $BASE_DIR/bin/cvc4-lfsc-check.sh +chmod +x $BASE_DIR/bin/cvc5-lfsc-check.sh # based on https://github.com/CVC4/signatures/blob/master/lfsc/new/scripts/cvc4_gen.sh -cat << EOF > $BASE_DIR/bin/cvc4-proof.sh +cat << EOF > $BASE_DIR/bin/cvc5-proof.sh #!/bin/bash -# call cvc4 and remove the first line of the output (should be "unsat") +# call cvc5 and remove the first line of the output (should be "unsat") \$@ --dump-proofs --proof-format=lfsc | tail -n +2 EOF -chmod +x $BASE_DIR/bin/cvc4-proof.sh +chmod +x $BASE_DIR/bin/cvc5-proof.sh # based on https://github.com/CVC4/signatures/blob/master/lfsc/new/scripts/lfsc_check.sh cat << EOF > $BASE_DIR/bin/lfsc-check.sh @@ -107,9 +107,9 @@ popd echo "" echo "========== How to use LFSC ==========" -echo "Generate a LFSC proof with CVC4:" -echo " $CVC_DIR/deps/bin/cvc4-proof.sh cvc4 " +echo "Generate a LFSC proof with cvc5:" +echo " $CVC_DIR/deps/bin/cvc5-proof.sh cvc5 " echo "Check a generated proof:" echo " $CVC_DIR/deps/bin/lfsc-check.sh " -echo "Run CVC4 and check the generated proof:" -echo " $CVC_DIR/deps/bin/cvc4-lfsc-check.sh cvc4 " +echo "Run cvc5 and check the generated proof:" +echo " $CVC_DIR/deps/bin/cvc5-lfsc-check.sh cvc5 " diff --git a/contrib/get-script-header.sh b/contrib/get-script-header.sh index 394669c68..5deaa00da 100644 --- a/contrib/get-script-header.sh +++ b/contrib/get-script-header.sh @@ -13,12 +13,12 @@ INSTALL_BIN_DIR="$INSTALL_DIR/bin" mkdir -p "$DEPS_DIR" if ! [ -e src/parser/cvc/Cvc.g ]; then - echo "$(basename $0): I expect to be in the contrib/ of a CVC4 source tree," >&2 + echo "$(basename $0): I expect to be in the contrib/ of a cvc5 source tree," >&2 echo "but apparently:" >&2 echo >&2 echo " $(pwd)" >&2 echo >&2 - echo "is not a CVC4 source tree ?!" >&2 + echo "is not a cvc5 source tree ?!" >&2 exit 1 fi diff --git a/contrib/learn_resource_weights.py b/contrib/learn_resource_weights.py index 8f5213ec2..76a7a043d 100755 --- a/contrib/learn_resource_weights.py +++ b/contrib/learn_resource_weights.py @@ -14,7 +14,7 @@ def parse_commandline(): """Parse commandline arguments""" epilog = """ This script can be used to compute good resource weights based on benchmark -results. The resource weights are used by cvc4 to approximate the running time +results. The resource weights are used by cvc5 to approximate the running time by the spent resources, multiplied with their weights. In the first stage ("parse") this script reads the output files of a benchmark diff --git a/contrib/luby.c b/contrib/luby.c deleted file mode 100644 index 71b07b665..000000000 --- a/contrib/luby.c +++ /dev/null @@ -1,69 +0,0 @@ -// luby.c - Luby sequence generator -// Morgan Deters for the CVC4 project, 5 May 2011 -// -// This program enumerates the Luby-based MiniSat 2 restart sequence. -// MiniSat restarts after a number of conflicts determined by: -// -// restart_base * luby(restart_inc, curr_restarts) -// -// By default, MiniSat has restart_base = 25, restart_inc = 3.0, and -// curr_restarts is the number of restarts that have been done (so it -// starts at 0). -// -// For the Luby paper, see: -// http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.47.5558 -// -// Compile luby.c with gcc -o luby luby.c -lm -// - -#include -#include -#include -#include -#include - -// luby() function copied from MiniSat 2 -// Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson -// Copyright (c) 2007-2010, Niklas Sorensson -double luby(double y, int x){ - - // Find the finite subsequence that contains index 'x', and the - // size of that subsequence: - int size, seq; - for (size = 1, seq = 0; size < x+1; seq++, size = 2*size+1); - - while (size-1 != x){ - size = (size-1)>>1; - seq--; - x = x % size; - } - - return pow(y, seq); -} - -int main(int argc, char *argv[]) { - int N; - int base; - double inc; - int i; - - if(argc != 4) { - fprintf(stderr, "usage: %s base inc N\n" - "In MiniSat 2, base==25 and inc==3 by default.\n" - "base is simply a multiplier after the sequence is computed.\n" - "N is the number to produce (-1 means run until CTRL-C)\n", - argv[0]); - exit(1); - } - - base = atoi(argv[1]); - inc = strtod(argv[2], NULL); - N = atoi(argv[3]); - - assert(base >= 1); - assert(inc >= 1.0); - - for(i = 0; N < 0 || i < N; ++i) { - printf("%d %f\n", i, luby(inc, i) * base); - } -} diff --git a/contrib/mk_starexec b/contrib/mk_starexec deleted file mode 100755 index aafe1f0c2..000000000 --- a/contrib/mk_starexec +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# Run : mk_starexec [TEXT] -# Run from directory containing cvc4 binary and subdirectory starexec/ containing the starexec space, i.e. subdirectory bin/ with configuration files. -# Generates file cvc4-[TEXT].tgz that can be uploaded to starexec. -strip cvc4 -cp cvc4 ./starexec/bin/cvc4 -cd starexec -tar -czf ../cvc4-$1.tgz . -rm bin/cvc4 \ No newline at end of file diff --git a/contrib/new-theory b/contrib/new-theory deleted file mode 100755 index 9e4e92a71..000000000 --- a/contrib/new-theory +++ /dev/null @@ -1,206 +0,0 @@ -#!/bin/bash -# -# usage: new-theory [--alternate existing-theory] new-theory-dir-name -# - -cd "`dirname "$0"`/.." - -if ! perl -v &>/dev/null; then - echo "ERROR: perl is required to run this script." >&2 - exit 1 -fi - -if [ ! -e src/theory/theory_engine.h ]; then - echo "ERROR: This script doesn't appear to be the contrib/ subdirectory" >&2 - echo "ERROR: of the CVC4 source tree." >&2 - exit 1 -fi - -# Trailing whitespaces in src/Makefile.am mess with the regexps (and are -# generally undesirable, so we throw an error instead of ignoring them). -if grep -q '[[:blank:]]$' src/Makefile.am; then - echo "ERROR: trailing whitespaces in src/Makefile.am" >&2 - exit 1 -fi - -if [ $# -ge 1 -a "$1" = --alternate ]; then - shift - alternate=true - alttheory="$1" - shift -else - alternate=false -fi - -if [ $# -ne 1 ]; then - echo "usage: new-theory [--alternate existing-theory] new-theory-dir-name" >&2 - echo "e.g.: new-theory arrays" >&2 - echo "e.g.: new-theory sets" >&2 - echo "e.g.: new-theory rewrite_rules" >&2 - echo "e.g.: new-theory --alternate arith difference-logic" >&2 - echo >&2 - echo "This tool will create a new src/theory/" >&2 - echo "directory and fill in some infrastructural files in that directory." >&2 - echo "It also will incorporate that directory into the build process." >&2 - echo "Please refer to the file README.WHATS-NEXT file created in that" >&2 - echo "directory for tips on what to do next." >&2 - echo >&2 - echo "Theories with multiple words (e.g. \"rewrite_rules\") should have" >&2 - echo "directories and namespaces separated by an underscore (_). The" >&2 - echo "resulting class names created by this script will be in CamelCase" >&2 - echo "(e.g. RewriteRules) if that convention is followed." >&2 - echo >&2 - echo "With --alternate, create a new theory directory that is declared as" >&2 - echo "an alternate implementation of an existing host theory. Such" >&2 - echo "\"alternates\" share preprocessing, typechecking, rewriting (i.e.," >&2 - echo "normal form), and expression kinds with their host theories, but" >&2 - echo "differ in decision procedure implementation. They are selectable" >&2 - echo "at runtime with --use-theory." >&2 - exit 1 -fi - -dir="$1" - -if [ -e "src/theory/$dir" ]; then - echo "ERROR: Theory \"$dir\" already exists." >&2 - echo "ERROR: Please choose a new directory name (or move that one aside)." >&2 - echo "ERROR: Or, if you'd like to create an alternate implementation of" >&2 - echo "ERROR: $dir, use this program this way:" >&2 - echo "ERROR: new-theory --alternate $dir new-implementation-name" >&2 - exit 1 -fi - -if ! expr "$dir" : '[a-zA-Z][a-zA-Z0-9_]*$' &>/dev/null || - expr "$dir" : '_$' &>/dev/null; then - echo "ERROR: \"$dir\" is not a valid theory name." >&2 - echo "ERROR:" >&2 - echo "ERROR: Theory names must start with a letter and be composed of" >&2 - echo "ERROR: letters, numbers, and the underscore (_) character; an" >&2 - echo "ERROR: underscore cannot be the final character." >&2 - exit 1 -fi - -if $alternate; then - if ! [ -d "src/theory/$alttheory" -a -f "src/theory/$alttheory/kinds" ]; then - echo "ERROR: Theory \"$alttheory\" doesn't exist, or cannot read its kinds file." >&2 - exit 1 - fi - alt_id="$( - function theory() { echo $1 | sed 's,^THEORY_,,'; exit; } - source "src/theory/$alttheory/kinds" - )" -fi - -id="`echo "$dir" | tr a-z A-Z`" -# convoluted, but should be relatively portable and give a CamelCase -# representation for a string. (e.g. "foo_bar" becomes "FooBar") -camel="`echo "$dir" | awk 'BEGIN { RS="_";ORS="";OFS="" } // {print toupper(substr($1,1,1)),substr($1,2,length($1))} END {print "\n"}'`" - -if ! mkdir "src/theory/$dir"; then - echo "ERROR: encountered an error creating directory src/theory/$dir" >&2 - exit 1 -fi - -echo "Theory of $dir" -echo "Theory directory: src/theory/$dir" -echo "Theory id: THEORY_$id" -$alternate && echo "Alternate for theory id: THEORY_$alt_id" -echo "Theory class: CVC4::theory::$dir::Theory$camel" -echo - -function copyskel { - src="$1" - dest="`echo "$src" | sed "s/DIR/$dir/g"`" - echo "Creating src/theory/$dir/$dest..." - sed "s/\$dir/$dir/g;s/\$camel/$camel/g;s/\$id/$id/g" \ - contrib/theoryskel/$src \ - > "src/theory/$dir/$dest" -} - -function copyaltskel { - src="$1" - dest="`echo "$src" | sed "s/DIR/$dir/g"`" - echo "Creating src/theory/$dir/$dest..." - sed "s/\$dir/$dir/g;s/\$camel/$camel/g;s/\$id/$id/g;s/\$alt_id/$alt_id/g" \ - contrib/alttheoryskel/$src \ - > "src/theory/$dir/$dest" -} - -function copyoptions { - src="$1" - dest="`echo "$src" | sed "s/DIR/$dir/g"`" - echo "Creating src/options/$dest..." - sed "s/\$dir/$dir/g;s/\$camel/$camel/g;s/\$id/$id/g;s/\$alt_id/$alt_id/g" \ - contrib/optionsskel/$src \ - > "src/options/$dest" -} - -# copy files from the skeleton, with proper replacements -if $alternate; then - alternate01=1 - for file in `ls contrib/alttheoryskel`; do - copyaltskel "$file" - done -else - alternate01=0 - for file in `ls contrib/theoryskel`; do - copyskel "$file" - done -fi -# Copy the options file independently -for file in `ls contrib/optionsskel`; do - copyoptions "$file" -done - - -echo -echo "Adding $dir to THEORIES to src/Makefile.theories..." -if grep -q '^THEORIES = .*[^a-zA-Z0-9_]'"$dir"'\([^a-zA-Z0-9_]\|$\)' src/Makefile.theories &>/dev/null; then - echo "NOTE: src/Makefile.theories already lists theory $dir" -else - awk '/^THEORIES = / {print $0,"'"$dir"'"} !/^THEORIES = / {print$0}' src/Makefile.theories > src/Makefile.theories.new-theory - if ! cp -f src/Makefile.theories src/Makefile.theories~; then - echo "ERROR: cannot copy src/Makefile.theories !" >&2 - exit 1 - fi - if ! mv -f src/Makefile.theories.new-theory src/Makefile.theories; then - echo "ERROR: cannot replace src/Makefile.theories !" >&2 - exit 1 - fi -fi - -echo "Adding sources to src/Makefile.am..." - -perl -e ' - while(<>) { print; last if /^libcvc4_la_SOURCES = /; } - if('$alternate01') { - while(<>) { if(!/\\$/) { chomp; print "$_ \\\n\ttheory/'"$dir"'/theory_'"$dir"'.h \\\n\ttheory/'"$dir"'/theory_'"$dir"'.cpp\n"; last; } else { print; } } - } else { - while(<>) { if(!/\\$/) { chomp; print "$_ \\\n\ttheory/'"$dir"'/theory_'"$dir"'.h \\\n\ttheory/'"$dir"'/theory_'"$dir"'.cpp \\\n\ttheory/'"$dir"'/theory_'"$dir"'_rewriter.h \\\n\ttheory/'"$dir"'/theory_'"$dir"'_type_rules.h\n"; last; } else { print; } } - } - while(<>) { print; last if /^EXTRA_DIST = /; } - while(<>) { if(!/\\$/) { chomp; print "$_ \\\n\ttheory/'"$dir"'/kinds\n"; last; } else { print; } } - while(<>) { print; }' src/Makefile.am > src/Makefile.am.new-theory -if ! mv -f src/Makefile.am.new-theory src/Makefile.am; then - echo "ERROR: cannot replace src/Makefile.am !" >&2 - exit 1 -fi - -echo "Adding ${dir}_options.toml to src/options/Makefile.am..." -if grep -q '^ ${dir}_options.toml' src/options/Makefile.am &>/dev/null; then - echo "NOTE: src/options/Makefile.am already seems to link to $dir option files" -else - awk -v name="$dir" -f contrib/new-theory.awk src/options/Makefile.am > src/options/Makefile.am.new-theory - if ! cp -f src/options/Makefile.am src/options/Makefile.am~; then - echo "ERROR: cannot copy src/options/Makefile.am !" >&2 - exit 1 - fi - if ! mv -f src/options/Makefile.am.new-theory src/options/Makefile.am; then - echo "ERROR: cannot replace src/options/Makefile.am !" >&2 - exit 1 - fi -fi - -echo -echo "Rerunning autogen.sh..." -./autogen.sh diff --git a/contrib/new-theory.awk b/contrib/new-theory.awk deleted file mode 100755 index 1adbb2f24..000000000 --- a/contrib/new-theory.awk +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/awk -v name=theory_new -f -# - -# Keep non-matching lines unchanged -!/^OPTIONS_CONFIG_FILES = \\/ {print$0} -# Add *_options.toml to OPTIONS_CONFIG_FILES -/^OPTIONS_CONFIG_FILES = \\/{print $0; printf "\t%s_options.toml \\\n", name;} diff --git a/contrib/optionsskel/DIR_options.toml b/contrib/optionsskel/DIR_options.toml deleted file mode 100644 index 09f44fde7..000000000 --- a/contrib/optionsskel/DIR_options.toml +++ /dev/null @@ -1,8 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/README for a description of this file format -# - -id = "$id" -name = "$camel" -header = "options/$dir_options.h" diff --git a/contrib/spellcheck b/contrib/spellcheck deleted file mode 100755 index 20cbd82d9..000000000 --- a/contrib/spellcheck +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -dir="$(dirname "$0")" - -find src \( -name '*.cpp' -o -name '*.h' \) \! -path 'src/prop/minisat/*' \! -path 'src/prop/bvminisat/*' \! -path 'src/parser/*/generated/*' | - while read f; do - misspelled_words=` - $dir/extract-strings-and-comments $f | - ispell -a -W 3 2>/dev/null | - tail -n +2 | - while read s; do - case "$s" in - \**|\+*|-*) ;; - \&*|\#*|\?*) echo "$s" | awk '{print$2}';; -# *) test -n "$s" && echo "UNKNOWN : $s";; - esac - done | sort -fu | sed 's,^, ,'` - if [ -n "$misspelled_words" ]; then - echo "$f" - echo "$misspelled_words" - fi - done diff --git a/contrib/sygus-v1-to-v2.sh b/contrib/sygus-v1-to-v2.sh deleted file mode 100755 index 0d1ac17e4..000000000 --- a/contrib/sygus-v1-to-v2.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# This is a simple script for converting v1 sygus files to v2. - -# Show how to use the script -if [[ "$#" < 3 || ! -f "$1" || ! -f "$2" ]]; then - echo "Usage: $0 [] [] [] [*]" - exit 1 -fi - -output=$("$1" "$2" --lang=sygus1 --dump-to="$3" --output-lang=sygus2 --dump=raw-benchmark --preprocess-only "${@:4}" 2>&1) - -exitCode=$? - -if [[ "$exitCode" == 0 ]]; then - # Remove incremental and produce-models options - sed -i '/(set-option :incremental false)/d' "$3" - sed -i '/(set-option :produce-models "true")/d' "$3" -else - echo "$1 failed with exit code $exitCode:" - echo "$output" -fi diff --git a/contrib/test_install_headers.sh b/contrib/test_install_headers.sh deleted file mode 100755 index 6f6855e31..000000000 --- a/contrib/test_install_headers.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# contrib/test_install_headers.sh -# Tim King for the CVC4 project, 24 December 2015 -# -# ./contrib/test_install_headers.sh -# -# This files tests the completeness of the public headers for CVC4. -# Any header marked by #include "cvc4_public.h" in either the builds/ -# or src/ directory is installed into the path INSTALL/include/cvc4 where -# INSTALL is set using the --prefix=INSTALL flag at configure time. -# This test uses find to attempt to include all of the headers in -# INSTALL/include/cvc4 and compiles a simple cpp file. - -INSTALLATION=$1 -CXX=g++ -LDFLAGS=-lcln -CXXFILE=test_cvc4_header_install.cpp -OUTFILE=test_cvc4_header_install - -echo $INSTALLATION - -echo "Generating $CXXFILE" -find $INSTALLATION/include/cvc4/ -name *.h -printf '%P\n' | \ - awk '{ print "#include "}' > $CXXFILE -echo "int main() { return 0; }" >> $CXXFILE - -echo "Compiling $CXXFILE into $OUTFILE" -echo "$CXX -I$INSTALLATION/include -L$INSTALLATION/lib $LDFLAGS -o $OUTFILE $CXXFILE" -$CXX -I$INSTALLATION/include -L$INSTALLATION/lib $LDFLAGS -o $OUTFILE $CXXFILE - -read -p "Do you want to delete $CXXFILE and $OUTFILE? [y/n]" yn -case $yn in - [Nn]* ) exit;; - [Yy]* ) rm "$OUTFILE" "$CXXFILE";; - * ) echo "Did not get a yes or no answer. Exiting."; exit;; -esac diff --git a/contrib/theoryskel/README.WHATS-NEXT b/contrib/theoryskel/README.WHATS-NEXT deleted file mode 100644 index 213004d5b..000000000 --- a/contrib/theoryskel/README.WHATS-NEXT +++ /dev/null @@ -1,46 +0,0 @@ -Congratulations, you now have a new theory of $dir ! - -Your next steps will likely be: - -* to specify theory constants, types, and operators in your \`kinds' file -* to add typing rules to theory_$dir_type_rules.h for your operators - and constants -* to write code in theory_$dir_rewriter.h to implement a normal form - for your theory's terms; in particular, you should ensure that you - rewrite (= X X) to "true" for terms X of your theory's sorts, and - evaluate any constant terms -* for any new types that you have introduced, add "mk*Type()" functions to - the NodeManager and ExprManager in src/expr/node_manager.{h,cpp} and - src/expr/expr_manager_template.{h,cpp}. You may also want "is*()" testers - in src/expr/type_node.h and a corresponding Type derived class in - src/expr/type.h. -* to write parser rules in src/parser/cvc/Cvc.g to support the CVC input - language, src/parser/smt/Smt.g to support the (deprecated) SMT-LIBv1 - language, and src/parser/smt2/Smt2.g to support SMT-LIBv2 -* to write printer code in -src/printer/*/*_printer* to support printing - your theory terms and types in various output languages - -and finally: - -* to implement a decision procedure for your theory by implementing - Theory$camel::check() in theory_$dir.cpp. Before writing the actual - code, you will need : - - * to determine which data structures are context dependent and use for - them context-dependent data structures (context/cd*.h) - * to choose which work will be done at QUICK_CHECK, STANDARD or at - FULL_EFFORT. - -You'll probably find the Developer's wiki useful: - - http://cvc4.cs.stanford.edu/wiki/ - -...and the Developer's Guide: - - https://github.com/CVC4/CVC4/wiki/Developer-Guide - -which contains coding guidelines for the CVC4 project. - -Good luck, and please contact cvc4-devel@cs.stanford.edu for assistance -should you need it! diff --git a/contrib/theoryskel/kinds b/contrib/theoryskel/kinds deleted file mode 100644 index 23e90c19a..000000000 --- a/contrib/theoryskel/kinds +++ /dev/null @@ -1,21 +0,0 @@ -# kinds -*- sh -*- -# -# For documentation on this file format, please refer to -# src/theory/builtin/kinds. -# - -theory THEORY_$id ::CVC4::theory::$dir::Theory$camel "theory/$dir/theory_$dir.h" -typechecker "theory/$dir/theory_$dir_type_rules.h" -rewriter ::CVC4::theory::$dir::Theory$camelRewriter "theory/$dir/theory_$dir_rewriter.h" - -properties check - -# Theory content goes here. - -# constants... - -# types... - -# operators... - -endtheory diff --git a/contrib/theoryskel/theory_DIR.cpp b/contrib/theoryskel/theory_DIR.cpp deleted file mode 100644 index 06307f4e7..000000000 --- a/contrib/theoryskel/theory_DIR.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "theory/$dir/theory_$dir.h" - -using namespace std; - -namespace CVC4 { -namespace theory { -namespace $dir { - -/** Constructs a new instance of Theory$camel w.r.t. the provided contexts. */ -Theory$camel::Theory$camel(context::Context* c, - context::UserContext* u, - OutputChannel& out, - Valuation valuation, - const LogicInfo& logicInfo) : - Theory(THEORY_$id, c, u, out, valuation, logicInfo) { -}/* Theory$camel::Theory$camel() */ - -void Theory$camel::check(Effort level) { - if (done() && !fullEffort(level)) { - return; - } - - TimerStat::CodeTimer checkTimer(d_checkTime); - - while(!done()) { - // Get all the assertions - Assertion assertion = get(); - TNode fact = assertion.assertion; - - Debug("$dir") << "Theory$camel::check(): processing " << fact << std::endl; - - // Do the work - switch(fact.getKind()) { - - /* cases for all the theory's kinds go here... */ - - default: - Unhandled(fact.getKind()); - } - } - -}/* Theory$camel::check() */ - -}/* CVC4::theory::$dir namespace */ -}/* CVC4::theory namespace */ -}/* CVC4 namespace */ diff --git a/contrib/theoryskel/theory_DIR.h b/contrib/theoryskel/theory_DIR.h deleted file mode 100644 index d8e652b7c..000000000 --- a/contrib/theoryskel/theory_DIR.h +++ /dev/null @@ -1,34 +0,0 @@ -#include "cvc4_private.h" - -#ifndef __CVC4__THEORY__$id__THEORY_$id_H -#define __CVC4__THEORY__$id__THEORY_$id_H - -#include "theory/theory.h" - -namespace CVC4 { -namespace theory { -namespace $dir { - -class Theory$camel : public Theory { -public: - - /** Constructs a new instance of Theory$camel w.r.t. the provided contexts. */ - Theory$camel(context::Context* c, - context::UserContext* u, - OutputChannel& out, - Valuation valuation, - const LogicInfo& logicInfo); - - void check(Effort); - - std::string identify() const { - return "THEORY_$id"; - } - -};/* class Theory$camel */ - -}/* CVC4::theory::$dir namespace */ -}/* CVC4::theory namespace */ -}/* CVC4 namespace */ - -#endif /* __CVC4__THEORY__$id__THEORY_$id_H */ diff --git a/contrib/theoryskel/theory_DIR_rewriter.h b/contrib/theoryskel/theory_DIR_rewriter.h deleted file mode 100644 index 16859bc23..000000000 --- a/contrib/theoryskel/theory_DIR_rewriter.h +++ /dev/null @@ -1,86 +0,0 @@ -#include "cvc4_private.h" - -#ifndef __CVC4__THEORY__$id__THEORY_$id_REWRITER_H -#define __CVC4__THEORY__$id__THEORY_$id_REWRITER_H - -#include "theory/rewriter.h" - -namespace CVC4 { -namespace theory { -namespace $dir { - -class Theory$camelRewriter { -public: - - /** - * Rewrite a node into the normal form for the theory of $dir. - * Called in post-order (really reverse-topological order) when - * traversing the expression DAG during rewriting. This is the - * main function of the rewriter, and because of the ordering, - * it can assume its children are all rewritten already. - * - * This function can return one of three rewrite response codes - * along with the rewritten node: - * - * REWRITE_DONE indicates that no more rewriting is needed. - * REWRITE_AGAIN means that the top-level expression should be - * rewritten again, but that its children are in final form. - * REWRITE_AGAIN_FULL means that the entire returned expression - * should be rewritten again (top-down with preRewrite(), then - * bottom-up with postRewrite()). - * - * Even if this function returns REWRITE_DONE, if the returned - * expression belongs to a different theory, it will be fully - * rewritten by that theory's rewriter. - */ - static RewriteResponse postRewrite(TNode node) { - - // Implement me! - - // This default implementation - return RewriteResponse(REWRITE_DONE, node); - } - - /** - * Rewrite a node into the normal form for the theory of $dir - * in pre-order (really topological order)---meaning that the - * children may not be in the normal form. This is an optimization - * for theories with cancelling terms (e.g., 0 * (big-nasty-expression) - * in arithmetic rewrites to 0 without the need to look at the big - * nasty expression). Since it's only an optimization, the - * implementation here can do nothing. - */ - static RewriteResponse preRewrite(TNode node) { - // do nothing - return RewriteResponse(REWRITE_DONE, node); - } - - /** - * Rewrite an equality, in case special handling is required. - */ - static Node rewriteEquality(TNode equality) { - // often this will suffice - return postRewrite(equality).node; - } - - /** - * Initialize the rewriter. - */ - static inline void init() { - // nothing to do - } - - /** - * Shut down the rewriter. - */ - static inline void shutdown() { - // nothing to do - } - -};/* class Theory$camelRewriter */ - -}/* CVC4::theory::$dir namespace */ -}/* CVC4::theory namespace */ -}/* CVC4 namespace */ - -#endif /* __CVC4__THEORY__$id__THEORY_$id_REWRITER_H */ diff --git a/contrib/theoryskel/theory_DIR_type_rules.h b/contrib/theoryskel/theory_DIR_type_rules.h deleted file mode 100644 index 29be55686..000000000 --- a/contrib/theoryskel/theory_DIR_type_rules.h +++ /dev/null @@ -1,35 +0,0 @@ -#include "cvc4_private.h" - -#ifndef __CVC4__THEORY__$id__THEORY_$id_TYPE_RULES_H -#define __CVC4__THEORY__$id__THEORY_$id_TYPE_RULES_H - -namespace CVC4 { -namespace theory { -namespace $dir { - -class $camelTypeRule { -public: - - /** - * Compute the type for (and optionally typecheck) a term belonging - * to the theory of $dir. - * - * @param check if true, the node's type should be checked as well - * as computed. - */ - inline static TypeNode computeType(NodeManager* nodeManager, TNode n, - bool check) - throw (TypeCheckingExceptionPrivate) { - - // TODO: implement me! - Unimplemented(); - - } - -};/* class $camelTypeRule */ - -}/* CVC4::theory::$dir namespace */ -}/* CVC4::theory namespace */ -}/* CVC4 namespace */ - -#endif /* __CVC4__THEORY__$id__THEORY_$id_TYPE_RULES_H */ diff --git a/contrib/update-copyright.pl b/contrib/update-copyright.pl index 2ab350d24..a9bf1fe0b 100755 --- a/contrib/update-copyright.pl +++ b/contrib/update-copyright.pl @@ -110,7 +110,7 @@ if($#ARGV >= 0 && $ARGV[0] eq '-m') { my @searchdirs = (); if($#ARGV == -1) { - (chdir($dir."/..") && -f "src/include/cvc4_public.h") || die "can't find top-level source directory for cvc5"; + (chdir($dir."/..") && -f "src/include/cvc5_public.h") || die "can't find top-level source directory for cvc5"; my $pwd = `pwd`; chomp $pwd; print < header file is available. */ -#cmakedefine01 HAVE_EXT_STDIO_FILEBUF_H - -/* Define if `ffs' is supported by the platform. */ -#cmakedefine HAVE_FFS - -/* Define to 1 to use libedit. */ -#cmakedefine01 HAVE_LIBEDITLINE - -/* Define to 1 if `rl_completion_entry_function' returns (char *). */ -#cmakedefine01 EDITLINE_COMPENTRY_FUNC_RETURNS_CHARP - -/* Define if `sigaltstack' is supported by the platform. */ -#cmakedefine HAVE_SIGALTSTACK - -/* Define to 1 if `strerror_r' is supported by the platform. */ -#cmakedefine01 HAVE_STRERROR_R - -/* Define if `strtok_r' is supported by the platform. */ -#cmakedefine HAVE_STRTOK_R - -/* Define if `setitimer` is supported by the platform. */ -#cmakedefine01 HAVE_SETITIMER - -/* Define to 1 if the header file is available. */ -#cmakedefine01 HAVE_UNISTD_H - -/* Define to 1 if `strerror_r' returns (char *). */ -#cmakedefine01 STRERROR_R_CHAR_P - -#cmakedefine01 CVC5_STATIC_BUILD - -#endif /* __CVC5__CVC4AUTOCONFIG_H */ diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 002a94cb7..a58303520 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -17,7 +17,7 @@ # Set variables required for the documentation *.in files string(TIMESTAMP MAN_DATE "%Y-%m-%d") -set(VERSION CVC4_RELEASE_STRING) +set(VERSION CVC5_RELEASE_STRING) #-----------------------------------------------------------------------------# # Generate files @@ -27,20 +27,20 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/SmtEngine.3cvc_template) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/cvc4.1_template.in - ${CMAKE_CURRENT_BINARY_DIR}/cvc4.1_template) + ${CMAKE_CURRENT_SOURCE_DIR}/cvc5.1_template.in + ${CMAKE_CURRENT_BINARY_DIR}/cvc5.1_template) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/cvc4.5.in - ${CMAKE_CURRENT_BINARY_DIR}/cvc4.5) + ${CMAKE_CURRENT_SOURCE_DIR}/cvc5.5.in + ${CMAKE_CURRENT_BINARY_DIR}/cvc5.5) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/libcvc4.3.in - ${CMAKE_CURRENT_BINARY_DIR}/libcvc4.3) + ${CMAKE_CURRENT_SOURCE_DIR}/libcvc5.3.in + ${CMAKE_CURRENT_BINARY_DIR}/libcvc5.3) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/libcvc4parser.3.in - ${CMAKE_CURRENT_BINARY_DIR}/libcvc4parser.3) + ${CMAKE_CURRENT_SOURCE_DIR}/libcvc5parser.3.in + ${CMAKE_CURRENT_BINARY_DIR}/libcvc5parser.3) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/options.3cvc_template.in @@ -49,11 +49,11 @@ configure_file( #-----------------------------------------------------------------------------# # Install man pages -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cvc4.1 DESTINATION share/man/man1) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cvc4.5 DESTINATION share/man/man5) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cvc5.1 DESTINATION share/man/man1) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cvc5.5 DESTINATION share/man/man5) install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/libcvc4.3 - ${CMAKE_CURRENT_BINARY_DIR}/libcvc4parser.3 + ${CMAKE_CURRENT_BINARY_DIR}/libcvc5.3 + ${CMAKE_CURRENT_BINARY_DIR}/libcvc5parser.3 ${CMAKE_CURRENT_BINARY_DIR}/options.3cvc ${CMAKE_CURRENT_BINARY_DIR}/SmtEngine.3cvc DESTINATION share/man/man3) diff --git a/doc/cvc4.1_template.in b/doc/cvc4.1_template.in deleted file mode 100644 index 042d6cfc1..000000000 --- a/doc/cvc4.1_template.in +++ /dev/null @@ -1,131 +0,0 @@ -.\" Process this file with -.\" groff -man -Tascii cvc4.1 -.\" -.TH CVC4 1 "@MAN_DATE@" "CVC4 release @VERSION@" "User Manuals" -.SH NAME -cvc4, pcvc4 \- an automated theorem prover -.SH SYNOPSIS -.B cvc4 [ -.I options -.B ] [ -.I file -.B ] -.P -.B pcvc4 [ -.I options -.B ] [ -.I file -.B ] -.SH DESCRIPTION -.B cvc4 -is an automated theorem prover for first-order formulas with respect -to background theories of interest. -.B pcvc4 -is CVC4's "portfolio" variant, which is capable of running multiple -CVC4 instances in parallel, configured differently. - -With -.I file -, commands are read from -.I file -and executed. CVC4 supports the SMT-LIB (versions 1.2 and 2.0) input -format, as well as its own native \(lqpresentation language\(rq (see -.BR cvc4 (5) -), which is similar in many respects to CVC3's presentation language, -but not identical. - -If -.I file -is unspecified, standard input is read (and the -.B CVC4 -presentation language is assumed). If -.I file -is unspecified and -.B CVC4 -is connected to a terminal, interactive mode is assumed. - -.SH COMMON OPTIONS - -.IP "Each option marked with [*] has a \-\-no\-OPTIONNAME variant, which reverses the sense of the option." - -${man_common}$ - -${man_others}$ - -.IP "Each option marked with [*] has a \-\-no\-OPTIONNAME variant, which reverses the sense of the option." - -.\".SH FILES -.\".SH ENVIRONMENT -.SH DIAGNOSTICS -.B CVC4 -reports all syntactic and semantic errors on standard error. -.SH HISTORY -The -.B CVC4 -effort is the culmination of fifteen years of theorem proving -research, starting with the -.I Stanford Validity Checker (SVC) -in 1996. - -SVC's successor, the -.I Cooperating Validity Checker (CVC), -had a more optimized internal design, produced proofs, used the -.I Chaff -SAT solver, and featured a number of usability -enhancements. Its name comes from the cooperative nature of -decision procedures in Nelson-Oppen theory combination, -which share amongst each other equalities between shared terms. - -CVC Lite, first made available in 2003, was a rewrite of CVC -that attempted to make CVC -more flexible (hence the \(lqlite\(rq) while extending the feature set: -CVCLite supported quantifiers where its predecessors did not. -CVC3 was a major overhaul of portions of CVC Lite: it added -better decision procedure implementations, added support for using -MiniSat in the core, and had generally better performance. - -CVC4 is the new version, the fifth generation of this validity -checker line that is now celebrating fifteen years of heritage. -It represents a complete re-evaluation of -the core architecture to be both performant and to serve as a cutting-edge research vehicle -for the next several years. Rather than taking CVC3 -and redesigning problem parts, we've taken a clean-room approach, -starting from scratch. Before using any designs from CVC3, we have -thoroughly scrutinized, vetted, and updated them. Many parts of CVC4 -bear only a superficial resemblance, if any, to their correspondent in CVC3. - -However, CVC4 is fundamentally similar to CVC3 and many other -modern SMT solvers: it is a DPLL( -.I T -) solver, -with a SAT solver at its core and a delegation path to different decision -procedure implementations, each in charge of solving formulas in some -background theory. - -The re-evaluation and ground-up rewrite was necessitated, we felt, by -the performance characteristics of CVC3. CVC3 has many useful -features, but some core aspects of the design led to high memory use, and -the use of heavyweight computation (where more nimble engineering -approaches could suffice) makes CVC3 a much slower prover than other tools. -As these designs are central to CVC3, a new version was preferable to a -selective re-engineering, which would have ballooned in short order. -.SH VERSION -This manual page refers to -.B CVC4 -version @VERSION@. -.SH BUGS -An issue tracker for the CVC4 project is maintained at -.BR https://github.com/CVC4/CVC4/issues . -.SH AUTHORS -.B CVC4 -is developed by a team of researchers at Stanford University -and the University of Iowa. -See the AUTHORS file in the distribution for a full list of -contributors. -.SH "SEE ALSO" -.BR libcvc4 (3), -.BR libcvc4parser (3) - -Additionally, the CVC4 wiki contains useful information about the -design and internals of CVC4. It is maintained at -.BR http://cvc4.cs.stanford.edu/wiki/ . diff --git a/doc/cvc4.5.in b/doc/cvc4.5.in deleted file mode 100644 index d66110f63..000000000 --- a/doc/cvc4.5.in +++ /dev/null @@ -1,20 +0,0 @@ -.\" Process this file with -.\" groff -man -Tascii cvc4.5 -.\" -.TH CVC4 5 "@MAN_DATE@" "CVC4 release @VERSION@" "Languages documentation" -.SH NAME -cvc4 \- the native input language for CVC4 -.SH DESCRIPTION -.B cvc4 -is an automated theorem prover for first-order formulas with respect -to background theories of interest. - -.SH HISTORY -.SH "SEE ALSO" -.BR cvc4 (1), -.BR libcvc4 (3), -.BR libcvc4parser (3) - -Additionally, the CVC4 wiki contains useful information about the -design and internals of CVC4. It is maintained at -.BR http://cvc4.cs.stanford.edu/wiki/ . diff --git a/doc/cvc5.1_template.in b/doc/cvc5.1_template.in new file mode 100644 index 000000000..042d6cfc1 --- /dev/null +++ b/doc/cvc5.1_template.in @@ -0,0 +1,131 @@ +.\" Process this file with +.\" groff -man -Tascii cvc4.1 +.\" +.TH CVC4 1 "@MAN_DATE@" "CVC4 release @VERSION@" "User Manuals" +.SH NAME +cvc4, pcvc4 \- an automated theorem prover +.SH SYNOPSIS +.B cvc4 [ +.I options +.B ] [ +.I file +.B ] +.P +.B pcvc4 [ +.I options +.B ] [ +.I file +.B ] +.SH DESCRIPTION +.B cvc4 +is an automated theorem prover for first-order formulas with respect +to background theories of interest. +.B pcvc4 +is CVC4's "portfolio" variant, which is capable of running multiple +CVC4 instances in parallel, configured differently. + +With +.I file +, commands are read from +.I file +and executed. CVC4 supports the SMT-LIB (versions 1.2 and 2.0) input +format, as well as its own native \(lqpresentation language\(rq (see +.BR cvc4 (5) +), which is similar in many respects to CVC3's presentation language, +but not identical. + +If +.I file +is unspecified, standard input is read (and the +.B CVC4 +presentation language is assumed). If +.I file +is unspecified and +.B CVC4 +is connected to a terminal, interactive mode is assumed. + +.SH COMMON OPTIONS + +.IP "Each option marked with [*] has a \-\-no\-OPTIONNAME variant, which reverses the sense of the option." + +${man_common}$ + +${man_others}$ + +.IP "Each option marked with [*] has a \-\-no\-OPTIONNAME variant, which reverses the sense of the option." + +.\".SH FILES +.\".SH ENVIRONMENT +.SH DIAGNOSTICS +.B CVC4 +reports all syntactic and semantic errors on standard error. +.SH HISTORY +The +.B CVC4 +effort is the culmination of fifteen years of theorem proving +research, starting with the +.I Stanford Validity Checker (SVC) +in 1996. + +SVC's successor, the +.I Cooperating Validity Checker (CVC), +had a more optimized internal design, produced proofs, used the +.I Chaff +SAT solver, and featured a number of usability +enhancements. Its name comes from the cooperative nature of +decision procedures in Nelson-Oppen theory combination, +which share amongst each other equalities between shared terms. + +CVC Lite, first made available in 2003, was a rewrite of CVC +that attempted to make CVC +more flexible (hence the \(lqlite\(rq) while extending the feature set: +CVCLite supported quantifiers where its predecessors did not. +CVC3 was a major overhaul of portions of CVC Lite: it added +better decision procedure implementations, added support for using +MiniSat in the core, and had generally better performance. + +CVC4 is the new version, the fifth generation of this validity +checker line that is now celebrating fifteen years of heritage. +It represents a complete re-evaluation of +the core architecture to be both performant and to serve as a cutting-edge research vehicle +for the next several years. Rather than taking CVC3 +and redesigning problem parts, we've taken a clean-room approach, +starting from scratch. Before using any designs from CVC3, we have +thoroughly scrutinized, vetted, and updated them. Many parts of CVC4 +bear only a superficial resemblance, if any, to their correspondent in CVC3. + +However, CVC4 is fundamentally similar to CVC3 and many other +modern SMT solvers: it is a DPLL( +.I T +) solver, +with a SAT solver at its core and a delegation path to different decision +procedure implementations, each in charge of solving formulas in some +background theory. + +The re-evaluation and ground-up rewrite was necessitated, we felt, by +the performance characteristics of CVC3. CVC3 has many useful +features, but some core aspects of the design led to high memory use, and +the use of heavyweight computation (where more nimble engineering +approaches could suffice) makes CVC3 a much slower prover than other tools. +As these designs are central to CVC3, a new version was preferable to a +selective re-engineering, which would have ballooned in short order. +.SH VERSION +This manual page refers to +.B CVC4 +version @VERSION@. +.SH BUGS +An issue tracker for the CVC4 project is maintained at +.BR https://github.com/CVC4/CVC4/issues . +.SH AUTHORS +.B CVC4 +is developed by a team of researchers at Stanford University +and the University of Iowa. +See the AUTHORS file in the distribution for a full list of +contributors. +.SH "SEE ALSO" +.BR libcvc4 (3), +.BR libcvc4parser (3) + +Additionally, the CVC4 wiki contains useful information about the +design and internals of CVC4. It is maintained at +.BR http://cvc4.cs.stanford.edu/wiki/ . diff --git a/doc/cvc5.5.in b/doc/cvc5.5.in new file mode 100644 index 000000000..d66110f63 --- /dev/null +++ b/doc/cvc5.5.in @@ -0,0 +1,20 @@ +.\" Process this file with +.\" groff -man -Tascii cvc4.5 +.\" +.TH CVC4 5 "@MAN_DATE@" "CVC4 release @VERSION@" "Languages documentation" +.SH NAME +cvc4 \- the native input language for CVC4 +.SH DESCRIPTION +.B cvc4 +is an automated theorem prover for first-order formulas with respect +to background theories of interest. + +.SH HISTORY +.SH "SEE ALSO" +.BR cvc4 (1), +.BR libcvc4 (3), +.BR libcvc4parser (3) + +Additionally, the CVC4 wiki contains useful information about the +design and internals of CVC4. It is maintained at +.BR http://cvc4.cs.stanford.edu/wiki/ . diff --git a/doc/libcvc4.3.in b/doc/libcvc4.3.in deleted file mode 100644 index 1db5b3c2d..000000000 --- a/doc/libcvc4.3.in +++ /dev/null @@ -1,64 +0,0 @@ -.\" Process this file with -.\" groff -man -Tascii libcvc4.3 -.\" -.TH LIBCVC4 3 "@MAN_DATE@" "CVC4 release @VERSION@" "CVC4 Library Interfaces" -.SH NAME -libcvc4 \- a library interface for the CVC4 theorem prover -.SH SYNOPSIS - -A small program like: - -.RS -.nf -#include -#include "expr/expr_manager.h" -#include "smt/smt_engine.h" - -using namespace CVC4; - -int main() { - ExprManager em; - SmtEngine smt(&em); - Expr onePlusTwo = em.mkExpr(kind::PLUS, - em.mkConst(Rational(1)), - em.mkConst(Rational(2))); - std::cout << language::SetLanguage(language::output::LANG_CVC4) - << smt.getInfo("name") - << " says that 1 + 2 = " - << smt.simplify(onePlusTwo) - << std::endl; - - return 0; -} -.fi -.RE - -gives the output: - -.RS -"cvc4" says that 1 + 2 = 3 -.RE - -.SH DESCRIPTION - -The main classes of interest in CVC4's API are -.I ExprManager, -.I SmtEngine, -and a few related ones like -.I Expr -and -.I Type. - -The -.I ExprManager -is used to build up expressions and types, and the -.I SmtEngine -is used primarily to make assertions, check satisfiability/validity, and extract models and proofs. - -.SH "SEE ALSO" -.BR cvc4 (1), -.BR libcvc4parser (3) - -Additionally, the CVC4 wiki contains useful information about the -design and internals of CVC4. It is maintained at -.BR http://cvc4.cs.stanford.edu/wiki/ . diff --git a/doc/libcvc4parser.3.in b/doc/libcvc4parser.3.in deleted file mode 100644 index f288daf83..000000000 --- a/doc/libcvc4parser.3.in +++ /dev/null @@ -1,14 +0,0 @@ -.\" Process this file with -.\" groff -man -Tascii libcvc4parser.3 -.\" -.TH LIBCVC4PARSER 3 "@MAN_DATE@" "CVC4 release @VERSION@" "CVC4 Library Interfaces" -.SH NAME -libcvc4parser \- a parser library interface for the CVC4 theorem prover -.SH DESCRIPTION -.SH "SEE ALSO" -.BR cvc4 (1), -.BR libcvc4 (3) - -Additionally, the CVC4 wiki contains useful information about the -design and internals of CVC4. It is maintained at -.BR http://cvc4.cs.stanford.edu/wiki/ . diff --git a/doc/libcvc5.3.in b/doc/libcvc5.3.in new file mode 100644 index 000000000..1db5b3c2d --- /dev/null +++ b/doc/libcvc5.3.in @@ -0,0 +1,64 @@ +.\" Process this file with +.\" groff -man -Tascii libcvc4.3 +.\" +.TH LIBCVC4 3 "@MAN_DATE@" "CVC4 release @VERSION@" "CVC4 Library Interfaces" +.SH NAME +libcvc4 \- a library interface for the CVC4 theorem prover +.SH SYNOPSIS + +A small program like: + +.RS +.nf +#include +#include "expr/expr_manager.h" +#include "smt/smt_engine.h" + +using namespace CVC4; + +int main() { + ExprManager em; + SmtEngine smt(&em); + Expr onePlusTwo = em.mkExpr(kind::PLUS, + em.mkConst(Rational(1)), + em.mkConst(Rational(2))); + std::cout << language::SetLanguage(language::output::LANG_CVC4) + << smt.getInfo("name") + << " says that 1 + 2 = " + << smt.simplify(onePlusTwo) + << std::endl; + + return 0; +} +.fi +.RE + +gives the output: + +.RS +"cvc4" says that 1 + 2 = 3 +.RE + +.SH DESCRIPTION + +The main classes of interest in CVC4's API are +.I ExprManager, +.I SmtEngine, +and a few related ones like +.I Expr +and +.I Type. + +The +.I ExprManager +is used to build up expressions and types, and the +.I SmtEngine +is used primarily to make assertions, check satisfiability/validity, and extract models and proofs. + +.SH "SEE ALSO" +.BR cvc4 (1), +.BR libcvc4parser (3) + +Additionally, the CVC4 wiki contains useful information about the +design and internals of CVC4. It is maintained at +.BR http://cvc4.cs.stanford.edu/wiki/ . diff --git a/doc/libcvc5parser.3.in b/doc/libcvc5parser.3.in new file mode 100644 index 000000000..f288daf83 --- /dev/null +++ b/doc/libcvc5parser.3.in @@ -0,0 +1,14 @@ +.\" Process this file with +.\" groff -man -Tascii libcvc4parser.3 +.\" +.TH LIBCVC4PARSER 3 "@MAN_DATE@" "CVC4 release @VERSION@" "CVC4 Library Interfaces" +.SH NAME +libcvc4parser \- a parser library interface for the CVC4 theorem prover +.SH DESCRIPTION +.SH "SEE ALSO" +.BR cvc4 (1), +.BR libcvc4 (3) + +Additionally, the CVC4 wiki contains useful information about the +design and internals of CVC4. It is maintained at +.BR http://cvc4.cs.stanford.edu/wiki/ . diff --git a/doc/mainpage.md b/doc/mainpage.md deleted file mode 100644 index 13005e023..000000000 --- a/doc/mainpage.md +++ /dev/null @@ -1,43 +0,0 @@ -/** -\mainpage Getting started with the CVC4 API - -The main classes of the CVC4 API are: -- CVC4::Expr - an expression (a formula, term, variable, constant, etc.) -- CVC4::Type - a type (every Expr has a Type) -- CVC4::ExprManager - a factory class for Exprs and Types (create one of these for your application) -- CVC4::SmtEngine - the SMT interface, permits making assertions and checking satisfiability (create one of these for your application) - -There are numerous examples of the use of the C++ API in the examples/api directory of the CVC4 source distribution. There is also a discussion on our CVC4 Wiki at -http://cvc4.cs.stanford.edu/wiki/Tutorials#C.2B.2B_API - -Using the CVC4 API from Java - -While these API documentation resources explicitly refer to the C++ interface, the Java interface is generated automatically from the C++ sources by SWIG, and thus the interface is almost line-by-line identical in Java. It is possible, then, to use these C++ resources to help with the Java API. There are three main ways in which the Java API differs from the C++ API. First, the CVC4 API makes moderate use of C++ operator overloading, which is not possible in Java. We have provided standard renamings for the Java methods associated to these C++ overloaded operators---for instance, "plus" replaces operator+, "equals" replaces operator==, etc. - -Secondly, C++ iterators are replaced by Java iterators. Instead of begin() and end() on classes like CVC4::Expr, you'll notice in the Java interface that there is an iterator() method that returns a java.util.Iterator. This allows Java developers to more naturally work with our (ultimately C++) objects through a more Java-like interface. - -Third, I/O streams are wrapped so that some functions requiring C++ input and output streams will accept Java InputStreams and OutputStreams. - -Our intent is to make the C++ API as useful and functional for Java developers as possible, while still retaining the flexibility of our original C++ design. If we can make your life as a Java user of our libraries easier, please let us know by requesting an enhancement or reporting a bug at our bug-tracking service, https://github.com/CVC4/CVC4/issues. - -For examples of Java programs using the CVC4 API, look in the directory examples/api/java in the CVC4 source distribution. - -Thank you for your interest in CVC4! - -The CVC4 Development team - -\page authors AUTHORS -\verbinclude AUTHORS -\page copying COPYING -\verbinclude COPYING -\page install INSTALL -\verbinclude INSTALL -\page news NEWS -\verbinclude NEWS -\page release-notes RELEASE-NOTES -\verbinclude RELEASE-NOTES -\page readme README -\verbinclude README -\page thanks THANKS -\verbinclude THANKS -*/ diff --git a/docs/cpp.rst b/docs/cpp.rst new file mode 100644 index 000000000..eeeae257e --- /dev/null +++ b/docs/cpp.rst @@ -0,0 +1,72 @@ +C++ API Documentation +===================== + +Class Hierarchy +--------------- + +* namespace ``cvc5`` + + * namespace ``api`` + + * class :cpp:class:`cvc5::api::CVC5ApiException` + + * class :cpp:class:`cvc5::api::CVC5ApiRecoverableException` + + * class :doc:`cpp/datatype` + + * class :ref:`Datatype::const_iterator` + + * class :doc:`cpp/datatypeconstructor` + + * class :ref:`DatatypeConstructor::const_iterator` + + * class :doc:`cpp/datatypeconstructordecl` + + * class :doc:`cpp/datatypedecl` + + * class :doc:`cpp/datatypeselector` + + * class :doc:`cpp/grammar` + + * class :doc:`cpp/op` + + * class :doc:`cpp/result` + + * class :doc:`cpp/solver` + + * class :doc:`cpp/term` + + * class :ref:`Term::const_iterator` + + * enum :doc:`cpp/kind` + + * enum :doc:`cpp/roundingmode` + + * struct :ref:`KindHashFunction` + + * struct :ref:`OpHashFunction` + + * struct :ref:`SortHashFunction` + + + +Full API Documentation +---------------------- + +.. toctree:: + :maxdepth: 2 + + cpp/datatype + cpp/datatypeconstructor + cpp/datatypeconstructordecl + cpp/datatypedecl + cpp/datatypeselector + cpp/exceptions + cpp/grammar + cpp/kind + cpp/op + cpp/result + cpp/roundingmode + cpp/solver + cpp/sort + cpp/term diff --git a/docs/cpp/Doxyfile.in b/docs/cpp/Doxyfile.in index 400b3dd0d..75a732ceb 100644 --- a/docs/cpp/Doxyfile.in +++ b/docs/cpp/Doxyfile.in @@ -2216,7 +2216,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = DOXYGEN_SKIP CVC4_EXPORT= +PREDEFINED = DOXYGEN_SKIP CVC5_EXPORT= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/docs/cpp/exceptions.rst b/docs/cpp/exceptions.rst index 414f27a78..5fa65e5e5 100644 --- a/docs/cpp/exceptions.rst +++ b/docs/cpp/exceptions.rst @@ -1,7 +1,7 @@ Exceptions ========== -The CVC5 API communicates certain errors using exceptions. We broadly +The cvc5 API communicates certain errors using exceptions. We broadly distinguish two types of exceptions: :cpp:class:`CVC5ApiException ` and :cpp:class:`CVC5ApiRecoverableException ` (which is derived from diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2552d455c..a7ca31a7a 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,16 +15,16 @@ cmake_minimum_required(VERSION 3.4) -project(cvc4-examples) +project(cvc5-examples) set(CMAKE_CXX_STANDARD 11) enable_testing() -# Find CVC4 package. If CVC4 is not installed into the default system location +# Find cvc5 package. If cvc5 is not installed into the default system location # use `cmake .. -DCMAKE_PREFIX_PATH=path/to/lib/cmake` to specify the location -# of CVC4Config.cmake. -find_package(CVC4) +# of cvc5Config.cmake. +find_package(cvc5) # Some of the examples require boost. Enable these examples if boost is # installed. @@ -41,7 +41,7 @@ set(EXAMPLES_BIN_DIR ${CMAKE_BINARY_DIR}/bin) # empty string) for the examples root directory (this) # > ARGN: Any additional arguments passed to the macro are interpreted as # as arguments to the test executable. -macro(cvc4_add_example name src_files output_dir) +macro(cvc5_add_example name src_files output_dir) # The build target is created without the path prefix (not supported), # e.g., for '/myexample.cpp' # we create build target 'myexample' @@ -54,7 +54,7 @@ macro(cvc4_add_example name src_files output_dir) endif() add_executable(${name} ${src_files_list}) - target_link_libraries(${name} CVC4::cvc4 CVC4::cvc4parser) + target_link_libraries(${name} cvc5::cvc5 cvc5::cvc5parser) # The test target is prefixed with the path, # e.g., for '/myexample.cpp' @@ -71,10 +71,10 @@ macro(cvc4_add_example name src_files output_dir) add_test(${example_test} ${example_bin_dir}/${name} ${ARGN}) endmacro() -cvc4_add_example(simple_vc_cxx "" "") -cvc4_add_example(simple_vc_quant_cxx "" "") +cvc5_add_example(simple_vc_cxx "" "") +cvc5_add_example(simple_vc_quant_cxx "" "") # TODO(project issue $206): Port example to new API -# cvc4_add_example(translator "" "" +# cvc5_add_example(translator "" "" # # argument to binary (for testing) # ${CMAKE_CURRENT_SOURCE_DIR}/translator-example-input.smt2) @@ -83,12 +83,12 @@ add_subdirectory(api) # add_subdirectory(nra-translate) # add_subdirectory(sets-translate) -if(TARGET CVC4::cvc4jar) +if(TARGET cvc5::cvc5jar) find_package(Java REQUIRED) include(UseJava) ## disabled until bindings for the new API are in place (issue #2284) - # get_target_property(CVC5_JAR CVC4::cvc4jar JAR_FILE) + # get_target_property(CVC5_JAR cvc5::cvc5jar JAR_FILE) # # add_jar(SimpleVC SimpleVC.java INCLUDE_JARS "${CVC5_JAR}") # diff --git a/examples/README.md b/examples/README.md index 18834719e..8532a6d3c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,6 +1,6 @@ -# CVC4 API Examples +# cvc5 API Examples -This directory contains usage examples of CVC4's different language +This directory contains usage examples of cvc5's different language bindings, library APIs, and also tutorial examples from the tutorials available at http://cvc4.cs.stanford.edu/wiki/Tutorials @@ -21,9 +21,9 @@ The examples provided in this directory are not built by default. bin/api/bitvectors ``` -**Note:** If you installed CVC4 in a non-standard location you have to +**Note:** If you installed cvc5 in a non-standard location you have to additionally specify `CMAKE_PREFIX_PATH` to point to the location of -`CVC4Config.cmake` (usually `/lib/cmake`) as follows: +`cvc5Config.cmake` (usually `/lib/cmake`) as follows: ``` cmake .. -DCMAKE_PREFIX_PATH=/lib/cmake @@ -33,7 +33,7 @@ The examples binaries are built into `/bin`. ## SimpleVC*, simple_vc* -These are examples of how to use CVC4 with each of its library +These are examples of how to use cvc5 with each of its library interfaces (APIs) and language bindings. They are essentially "hello world" examples, and do not fully demonstrate the interfaces, but function as a starting point to using simple expressions and solving diff --git a/examples/SimpleVC.py b/examples/SimpleVC.py deleted file mode 100644 index 05857e737..000000000 --- a/examples/SimpleVC.py +++ /dev/null @@ -1,61 +0,0 @@ -#! /usr/bin/python -############################################################################### -# Top contributors (to current version): -# Morgan Deters, Aina Niemetz -# -# This file is part of the cvc5 project. -# -# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS -# in the top-level source directory and their institutional affiliations. -# All rights reserved. See the file COPYING in the top-level source -# directory for licensing information. -# ############################################################################# -# -# A simple demonstration of the Python interface -# -# A simple demonstration of the Python interface. Compare to the -# C++ interface in simple_vc_cxx.cpp; they are quite similar. -# -# To run from a build directory, use something like: -# -# PYTHONPATH=src/bindings/python python ../examples/SimpleVC.py -## - -import CVC4 -from CVC4 import ExprManager, SmtEngine, Rational, Expr - -import sys - -def main(): - em = ExprManager() - smt = SmtEngine(em) - - # Prove that for integers x and y: - # x > 0 AND y > 0 => 2x + y >= 3 - - integer = em.integerType() - - x = em.mkVar("x", integer) - y = em.mkVar("y", integer) - zero = em.mkConst(Rational(0)) - - x_positive = em.mkExpr(CVC4.GT, x, zero) - y_positive = em.mkExpr(CVC4.GT, y, zero) - - two = em.mkConst(Rational(2)) - twox = em.mkExpr(CVC4.MULT, two, x) - twox_plus_y = em.mkExpr(CVC4.PLUS, twox, y) - - three = em.mkConst(Rational(3)) - twox_plus_y_geq_3 = em.mkExpr(CVC4.GEQ, twox_plus_y, three) - - formula = Expr(em.mkExpr(CVC4.AND, x_positive, y_positive)).impExpr(Expr(twox_plus_y_geq_3)) - - print("Checking entailment of formula " + formula.toString() + " with CVC4.") - print("CVC4 should report ENTAILED .") - print("Result from CVC4 is: " + smt.checkEntailed(formula).toString()) - - return 0 - -if __name__ == '__main__': - sys.exit(main()) diff --git a/examples/api/CMakeLists.txt b/examples/api/CMakeLists.txt index e05039e43..7b713e6e7 100644 --- a/examples/api/CMakeLists.txt +++ b/examples/api/CMakeLists.txt @@ -30,5 +30,5 @@ set(CVC5_EXAMPLES_API ) foreach(example ${CVC5_EXAMPLES_API}) - cvc4_add_example(${example} "" "api") + cvc5_add_example(${example} "" "api") endforeach() diff --git a/examples/api/java/CMakeLists.txt b/examples/api/java/CMakeLists.txt index 915ce817c..29ca63b93 100644 --- a/examples/api/java/CMakeLists.txt +++ b/examples/api/java/CMakeLists.txt @@ -17,7 +17,7 @@ set(EXAMPLES_API_JAVA ## disabled until bindings for the new API are in place (issue #2284) # BitVectors # BitVectorsAndArrays - # CVC4Streams + # CVC5Streams # Combination # Datatypes # Exceptions diff --git a/examples/api/python/bitvectors.py b/examples/api/python/bitvectors.py index 15973472c..1ddb02d8e 100644 --- a/examples/api/python/bitvectors.py +++ b/examples/api/python/bitvectors.py @@ -16,11 +16,11 @@ # bitvectors-new.cpp. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() slv.setLogic("QF_BV") # Set the logic # The following example has been adapted from the book A Hacker's Delight by # Henry S. Warren. @@ -38,7 +38,7 @@ if __name__ == "__main__": # #(2) x = a + b - x; # - # We will use CVC4 to prove that the three pieces of code above are all + # We will use cvc5 to prove that the three pieces of code above are all # equivalent by encoding the problem in the bit-vector theory. # Creating a bit-vector type of width 32 @@ -69,7 +69,7 @@ if __name__ == "__main__": assignment0 = slv.mkTerm(kinds.Equal, new_x, ite) # Assert the encoding of code (0) - print("Asserting {} to CVC4".format(assignment0)) + print("Asserting {} to cvc5".format(assignment0)) slv.assertFormula(assignment0) print("Pushing a new context.") slv.push() @@ -79,14 +79,14 @@ if __name__ == "__main__": a_xor_b_xor_x = slv.mkTerm(kinds.BVXor, a, b, x) assignment1 = slv.mkTerm(kinds.Equal, new_x_, a_xor_b_xor_x) - # Assert encoding to CVC4 in current context - print("Asserting {} to CVC4".format(assignment1)) + # Assert encoding to cvc5 in current context + print("Asserting {} to cvc5".format(assignment1)) slv.assertFormula(assignment1) new_x_eq_new_x_ = slv.mkTerm(kinds.Equal, new_x, new_x_) print("Checking entailment assuming:", new_x_eq_new_x_) print("Expect ENTAILED.") - print("CVC4:", slv.checkEntailed(new_x_eq_new_x_)) + print("cvc5:", slv.checkEntailed(new_x_eq_new_x_)) print("Popping context.") slv.pop() @@ -96,20 +96,20 @@ if __name__ == "__main__": a_plus_b_minus_x = slv.mkTerm(kinds.BVSub, a_plus_b, x) assignment2 = slv.mkTerm(kinds.Equal, new_x_, a_plus_b_minus_x) - # Assert encoding to CVC4 in current context - print("Asserting {} to CVC4".format(assignment2)) + # Assert encoding to cvc5 in current context + print("Asserting {} to cvc5".format(assignment2)) slv.assertFormula(assignment2) print("Checking entailment assuming:", new_x_eq_new_x_) print("Expect ENTAILED.") - print("CVC4:", slv.checkEntailed(new_x_eq_new_x_)) + print("cvc5:", slv.checkEntailed(new_x_eq_new_x_)) x_neq_x = slv.mkTerm(kinds.Equal, x, x).notTerm() v = [new_x_eq_new_x_, x_neq_x] print("Check entailment assuming: ", v) print("Expect NOT_ENTAILED.") - print("CVC4:", slv.checkEntailed(v)) + print("cvc5:", slv.checkEntailed(v)) # Assert that a is odd extract_op = slv.mkOp(kinds.BVExtract, 0, 0) @@ -120,4 +120,4 @@ if __name__ == "__main__": print("Check satisifiability") slv.assertFormula(a_odd) print("Expect sat") - print("CVC4:", slv.checkSat()) + print("cvc5:", slv.checkSat()) diff --git a/examples/api/python/bitvectors_and_arrays.py b/examples/api/python/bitvectors_and_arrays.py index 8f76ac709..be38077ca 100644 --- a/examples/api/python/bitvectors_and_arrays.py +++ b/examples/api/python/bitvectors_and_arrays.py @@ -16,13 +16,13 @@ # translation of bitvectors_and_arrays-new.cpp. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds import math if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() slv.setOption("produce-models", "true") slv.setOption("output-language", "smtlib") slv.setLogic("QF_AUFBV") @@ -82,10 +82,10 @@ if __name__ == "__main__": query = slv.mkTerm(kinds.Not, slv.mkTerm(kinds.And, assertions)) - print("Asserting {} to CVC4".format(query)) + print("Asserting {} to cvc5".format(query)) slv.assertFormula(query) print("Expect sat.") - print("CVC4:", slv.checkSatAssuming(slv.mkTrue())) + print("cvc5:", slv.checkSatAssuming(slv.mkTrue())) # Getting the model print("The satisfying model is: ") diff --git a/examples/api/python/combination.py b/examples/api/python/combination.py index adeba3a3c..54429feff 100644 --- a/examples/api/python/combination.py +++ b/examples/api/python/combination.py @@ -16,8 +16,8 @@ # combination-new.cpp. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds def prefixPrintGetValue(slv, t, level=0): print("slv.getValue({}): {}".format(t, slv.getValue(t))) @@ -25,7 +25,7 @@ def prefixPrintGetValue(slv, t, level=0): prefixPrintGetValue(slv, c, level + 1) if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() slv.setOption("produce-models", "true") # Produce Models slv.setOption("output-language", "cvc") # Set the output-language to CVC's slv.setOption("dag-thresh", "0") # Disable dagifying the output diff --git a/examples/api/python/datatypes.py b/examples/api/python/datatypes.py index e15fe709c..5b897c1b2 100644 --- a/examples/api/python/datatypes.py +++ b/examples/api/python/datatypes.py @@ -16,8 +16,8 @@ # datatypes-new.cpp. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds def test(slv, consListSort): # Now our old "consListSpec" is useless--the relevant information @@ -88,11 +88,11 @@ def test(slv, consListSort): print("Assert", assertion) slv.assertFormula(assertion) print("Expect sat.") - print("CVC4:", slv.checkSat()) + print("cvc5:", slv.checkSat()) if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() # This example builds a simple "cons list" of integers, with # two constructors, "cons" and "nil." @@ -113,7 +113,7 @@ if __name__ == "__main__": print("spec is {}".format(consListSpec)) # Keep in mind that "DatatypeDecl" is the specification class for - # datatypes---"DatatypeDecl" is not itself a CVC4 Sort. + # datatypes---"DatatypeDecl" is not itself a cvc5 Sort. # Now that our Datatype is fully specified, we can get a Sort for it. # This step resolves the "SelfSort" reference and creates # symbols for all the constructors, etc. diff --git a/examples/api/python/exceptions.py b/examples/api/python/exceptions.py index c779390d9..a4597d12b 100644 --- a/examples/api/python/exceptions.py +++ b/examples/api/python/exceptions.py @@ -16,13 +16,13 @@ # A simple demonstration of catching cvc5 exceptions with the legacy Python API. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds import sys def main(): - slv = pycvc4.Solver() + slv = pycvc5.Solver() slv.setOption("produce-models", "true") diff --git a/examples/api/python/extract.py b/examples/api/python/extract.py index d708a7045..4e7026e97 100644 --- a/examples/api/python/extract.py +++ b/examples/api/python/extract.py @@ -16,8 +16,8 @@ # extract-new.cpp. ## -from pycvc4 import Solver -from pycvc4.kinds import BVExtract, Equal +from pycvc5 import Solver +from pycvc5.kinds import BVExtract, Equal if __name__ == "__main__": slv = Solver() @@ -49,4 +49,4 @@ if __name__ == "__main__": eq2 = slv.mkTerm(Equal, x_31_31, x_0_0) print("Check entailment assuming:", eq2) print("Expect ENTAILED") - print("CVC4:", slv.checkEntailed(eq2)) + print("cvc5:", slv.checkEntailed(eq2)) diff --git a/examples/api/python/floating_point.py b/examples/api/python/floating_point.py index 5444a7df3..44a3d66d2 100644 --- a/examples/api/python/floating_point.py +++ b/examples/api/python/floating_point.py @@ -16,16 +16,16 @@ # Darulova. This requires building cvc5 with symfpu. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() if not slv.supportsFloatingPoint(): - # CVC4 must be built with SymFPU to support the theory of + # cvc5 must be built with SymFPU to support the theory of # floating-point numbers - print("CVC4 was not built with floating-point support.") + print("cvc5 was not built with floating-point support.") exit() slv.setOption("produce-models", "true") @@ -35,7 +35,7 @@ if __name__ == "__main__": fp32 = slv.mkFloatingPointSort(8, 24) # the standard rounding mode - rm = slv.mkRoundingMode(pycvc4.RoundNearestTiesToEven) + rm = slv.mkRoundingMode(pycvc5.RoundNearestTiesToEven) # create a few single-precision variables x = slv.mkConst(fp32, 'x') @@ -49,7 +49,7 @@ if __name__ == "__main__": slv.assertFormula(slv.mkTerm(kinds.Not, commutative)) print("Checking floating-point commutativity") print("Expect SAT (property does not hold for NaN and Infinities).") - print("CVC4:", slv.checkSat()) + print("cvc5:", slv.checkSat()) print("Model for x:", slv.getValue(x)) print("Model for y:", slv.getValue(y)) @@ -61,7 +61,7 @@ if __name__ == "__main__": print("Checking floating-point commutativity assuming x and y are not NaN or Infinity") print("Expect UNSAT.") - print("CVC4:", slv.checkSat()) + print("cvc5:", slv.checkSat()) # check floating-point arithmetic is not associative slv.pop() @@ -84,7 +84,7 @@ if __name__ == "__main__": print("Checking floating-point associativity") print("Expect SAT.") - print("CVC4:", slv.checkSat()) + print("cvc5:", slv.checkSat()) print("Model for x:", slv.getValue(x)) print("Model for y:", slv.getValue(y)) print("Model for z:", slv.getValue(z)) diff --git a/examples/api/python/helloworld.py b/examples/api/python/helloworld.py index 8e585073c..6e6ce32ab 100644 --- a/examples/api/python/helloworld.py +++ b/examples/api/python/helloworld.py @@ -14,10 +14,10 @@ # A very simple example, adapted from helloworld-new.cpp ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() helloworld = slv.mkConst(slv.getBooleanSort(), "Hello World!") print(helloworld, "is", slv.checkEntailed(helloworld)) diff --git a/examples/api/python/linear_arith.py b/examples/api/python/linear_arith.py index bc48b452e..f8dad6a71 100644 --- a/examples/api/python/linear_arith.py +++ b/examples/api/python/linear_arith.py @@ -16,11 +16,11 @@ # linear_arith-new.cpp. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() slv.setLogic("QF_LIRA") # Prove that if given x (Integer) and y (Real) and some constraints @@ -55,9 +55,9 @@ if __name__ == "__main__": slv.push() diff_leq_two_thirds = slv.mkTerm(kinds.Leq, diff, two_thirds) - print("Prove that", diff_leq_two_thirds, "with CVC4") - print("CVC4 should report ENTAILED") - print("Result from CVC4 is:", + print("Prove that", diff_leq_two_thirds, "with cvc5") + print("cvc5 should report ENTAILED") + print("Result from cvc5 is:", slv.checkEntailed(diff_leq_two_thirds)) slv.pop() @@ -66,7 +66,7 @@ if __name__ == "__main__": slv.push() diff_is_two_thirds = slv.mkTerm(kinds.Equal, diff, two_thirds) slv.assertFormula(diff_is_two_thirds) - print("Show that the assertions are consistent with\n", diff_is_two_thirds, "with CVC4") - print("CVC4 should report SAT") - print("Result from CVC4 is:", slv.checkSat()) + print("Show that the assertions are consistent with\n", diff_is_two_thirds, "with cvc5") + print("cvc5 should report SAT") + print("Result from cvc5 is:", slv.checkSat()) slv.pop() diff --git a/examples/api/python/sequences.py b/examples/api/python/sequences.py index fa8c1bc4f..f9fd925fb 100644 --- a/examples/api/python/sequences.py +++ b/examples/api/python/sequences.py @@ -15,11 +15,11 @@ # through the Python API. This is a direct translation of sequences.cpp. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() # Set the logic slv.setLogic("QF_SLIA") # Produce models @@ -54,7 +54,7 @@ if __name__ == "__main__": # Check satisfiability result = slv.checkSatAssuming(q) - print("CVC4 reports:", q, "is", result) + print("cvc5 reports:", q, "is", result) if result: print("x = {}".format(slv.getValue(x))) diff --git a/examples/api/python/sets.py b/examples/api/python/sets.py index 01c14cb87..b41b2ad5a 100644 --- a/examples/api/python/sets.py +++ b/examples/api/python/sets.py @@ -15,11 +15,11 @@ # through the Python API. This is a direct translation of sets-new.cpp. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() # Optionally, set the logic. We need at least UF for equality predicate, # integers (LIA) and sets (FS). @@ -48,7 +48,7 @@ if __name__ == "__main__": theorem = slv.mkTerm(kinds.Equal, lhs, rhs) - print("CVC4 reports: {} is {}".format(theorem, + print("cvc5 reports: {} is {}".format(theorem, slv.checkEntailed(theorem))) # Verify emptset is a subset of any set @@ -58,7 +58,7 @@ if __name__ == "__main__": theorem = slv.mkTerm(kinds.Subset, emptyset, A) - print("CVC4 reports: {} is {}".format(theorem, + print("cvc5 reports: {} is {}".format(theorem, slv.checkEntailed(theorem))) # Find me an element in 1, 2 intersection 2, 3, if there is one. @@ -80,7 +80,7 @@ if __name__ == "__main__": result = slv.checkSatAssuming(e) - print("CVC4 reports: {} is {}".format(e, result)) + print("cvc5 reports: {} is {}".format(e, result)) if result: print("For instance, {} is a member".format(slv.getValue(x))) diff --git a/examples/api/python/strings.py b/examples/api/python/strings.py index aa540f89c..64ce06548 100644 --- a/examples/api/python/strings.py +++ b/examples/api/python/strings.py @@ -15,11 +15,11 @@ # through the Python API. This is a direct translation of strings-new.cpp. ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() # Set the logic slv.setLogic("QF_SLIA") # Produce models @@ -81,7 +81,7 @@ if __name__ == "__main__": # check sat result = slv.checkSatAssuming(q) - print("CVC4 reports:", q, "is", result) + print("cvc5 reports:", q, "is", result) if result: print("x = ", slv.getValue(x)) diff --git a/examples/api/python/sygus-fun.py b/examples/api/python/sygus-fun.py index 8c490f47e..6e1440d66 100644 --- a/examples/api/python/sygus-fun.py +++ b/examples/api/python/sygus-fun.py @@ -16,11 +16,11 @@ ## import copy -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() # required options slv.setOption("lang", "sygus2") diff --git a/examples/api/python/sygus-grammar.py b/examples/api/python/sygus-grammar.py index 0bcc0815d..406646f9f 100644 --- a/examples/api/python/sygus-grammar.py +++ b/examples/api/python/sygus-grammar.py @@ -17,11 +17,11 @@ ## import copy -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() # required options slv.setOption("lang", "sygus2") diff --git a/examples/api/python/sygus-inv.py b/examples/api/python/sygus-inv.py index 08a50ce63..0fa752b1e 100644 --- a/examples/api/python/sygus-inv.py +++ b/examples/api/python/sygus-inv.py @@ -16,11 +16,11 @@ # translation of sygus-inv.cpp . ## -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds if __name__ == "__main__": - slv = pycvc4.Solver() + slv = pycvc5.Solver() # required options slv.setOption("lang", "sygus2") diff --git a/examples/nra-translate/CMakeLists.txt b/examples/nra-translate/CMakeLists.txt index 94af86090..dda47206e 100644 --- a/examples/nra-translate/CMakeLists.txt +++ b/examples/nra-translate/CMakeLists.txt @@ -26,7 +26,7 @@ set(CVC5_EXAMPLES_NRA_TRANSLATE ) foreach(example ${CVC5_EXAMPLES_NRA_TRANSLATE}) - cvc4_add_example(${example} "" "nra-translate" + cvc5_add_example(${example} "" "nra-translate" # arguments to binary (for testing) # input file is required by all tests ${CMAKE_CURRENT_SOURCE_DIR}/nra-translate-example-input.smt2 diff --git a/examples/sets-translate/CMakeLists.txt b/examples/sets-translate/CMakeLists.txt index b5b78d63e..d1a8650ce 100644 --- a/examples/sets-translate/CMakeLists.txt +++ b/examples/sets-translate/CMakeLists.txt @@ -14,12 +14,12 @@ ## if(Boost_FOUND) - cvc4_add_example(sets2arrays + cvc5_add_example(sets2arrays "sets_translate.cpp" "sets-translate" # argument to binary (for testing) ${CMAKE_CURRENT_SOURCE_DIR}/sets-translate-example-input.smt2) - cvc4_add_example(sets2axioms + cvc5_add_example(sets2axioms "sets_translate.cpp" "sets-translate" # argument to binary (for testing) ${CMAKE_CURRENT_SOURCE_DIR}/sets-translate-example-input.smt2) diff --git a/examples/simple_vc_quant_cxx.cpp b/examples/simple_vc_quant_cxx.cpp index 9ef48bf76..1bdadfca2 100644 --- a/examples/simple_vc_quant_cxx.cpp +++ b/examples/simple_vc_quant_cxx.cpp @@ -48,10 +48,10 @@ int main() { slv.assertFormula(formula); - std::cout << "Checking SAT after asserting " << formula << " to CVC4." + std::cout << "Checking SAT after asserting " << formula << " to cvc5." << std::endl; - std::cout << "CVC4 should report unsat." << std::endl; - std::cout << "Result from CVC4 is: " << slv.checkSat() << std::endl; + std::cout << "cvc5 should report unsat." << std::endl; + std::cout << "Result from cvc5 is: " << slv.checkSat() << std::endl; slv.resetAssertions(); @@ -66,10 +66,10 @@ int main() { slv.assertFormula(formula_pattern); - std::cout << "Checking SAT after asserting " << formula_pattern << " to CVC4." + std::cout << "Checking SAT after asserting " << formula_pattern << " to cvc5." << std::endl; - std::cout << "CVC4 should report unsat." << std::endl; - std::cout << "Result from CVC4 is: " << slv.checkSat() << std::endl; + std::cout << "cvc5 should report unsat." << std::endl; + std::cout << "Result from cvc5 is: " << slv.checkSat() << std::endl; return 0; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 554739b98..ebe52a2db 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,8 +13,8 @@ # The build system configuration. ## -# Collect libcvc4 source files -libcvc4_add_sources( +# Collect libcvc5 source files +libcvc5_add_sources( api/cpp/cvc5.cpp api/cpp/cvc5.h api/cpp/cvc5_checks.h @@ -1107,76 +1107,76 @@ add_subdirectory(theory) add_subdirectory(util) #-----------------------------------------------------------------------------# -# All sources for libcvc4 are now collected in LIBCVC4_SRCS and (if generated) -# LIBCVC4_GEN_SRCS (via libcvc4_add_sources). We can now build libcvc4. +# All sources for libcvc5 are now collected in LIBCVC5_SRCS and (if generated) +# LIBCVC5_GEN_SRCS (via libcvc5_add_sources). We can now build libcvc5. -set_source_files_properties(${LIBCVC4_GEN_SRCS} PROPERTIES GENERATED TRUE) -add_library(cvc4 ${LIBCVC4_SRCS} ${LIBCVC4_GEN_SRCS} - $ $) -target_include_directories(cvc4 +set_source_files_properties(${LIBCVC5_GEN_SRCS} PROPERTIES GENERATED TRUE) +add_library(cvc5 ${LIBCVC5_SRCS} ${LIBCVC5_GEN_SRCS} + $ $) +target_include_directories(cvc5 PUBLIC $ $ ) include(GenerateExportHeader) -generate_export_header(cvc4) +generate_export_header(cvc5) -install(TARGETS cvc4 - EXPORT cvc4-targets +install(TARGETS cvc5 + EXPORT cvc5-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -set_target_properties(cvc4 PROPERTIES SOVERSION ${CVC5_SOVERSION}) -target_compile_definitions(cvc4 PRIVATE -D__BUILDING_CVC4LIB) -# Add libcvc4 dependencies for generated sources. -add_dependencies(cvc4 gen-expr gen-gitinfo gen-options gen-tags gen-theory) +set_target_properties(cvc5 PROPERTIES SOVERSION ${CVC5_SOVERSION}) +target_compile_definitions(cvc5 PRIVATE -D__BUILDING_CVC5LIB) +# Add libcvc5 dependencies for generated sources. +add_dependencies(cvc5 gen-expr gen-gitinfo gen-options gen-tags gen-theory) # Add library/include dependencies if(ENABLE_VALGRIND) - target_include_directories(cvc4 PRIVATE ${Valgrind_INCLUDE_DIR}) + target_include_directories(cvc5 PRIVATE ${Valgrind_INCLUDE_DIR}) endif() if(USE_ABC) - target_link_libraries(cvc4 PRIVATE ${ABC_LIBRARIES}) - target_include_directories(cvc4 PRIVATE ${ABC_INCLUDE_DIR}) + target_link_libraries(cvc5 PRIVATE ${ABC_LIBRARIES}) + target_include_directories(cvc5 PRIVATE ${ABC_INCLUDE_DIR}) endif() if(USE_CADICAL) - target_link_libraries(cvc4 PRIVATE CaDiCaL) + target_link_libraries(cvc5 PRIVATE CaDiCaL) endif() if(USE_CLN) - target_link_libraries(cvc4 PRIVATE CLN) + target_link_libraries(cvc5 PRIVATE CLN) endif() if(USE_CRYPTOMINISAT) - target_link_libraries(cvc4 PRIVATE CryptoMiniSat) + target_link_libraries(cvc5 PRIVATE CryptoMiniSat) endif() if(USE_KISSAT) - target_link_libraries(cvc4 PRIVATE Kissat) + target_link_libraries(cvc5 PRIVATE Kissat) endif() if(USE_GLPK) - target_link_libraries(cvc4 PRIVATE ${GLPK_LIBRARIES}) - target_include_directories(cvc4 PRIVATE ${GLPK_INCLUDE_DIR}) + target_link_libraries(cvc5 PRIVATE ${GLPK_LIBRARIES}) + target_include_directories(cvc5 PRIVATE ${GLPK_INCLUDE_DIR}) endif() if(USE_POLY) - target_link_libraries(cvc4 PRIVATE Polyxx) + target_link_libraries(cvc5 PRIVATE Polyxx) endif() if(USE_SYMFPU) - target_link_libraries(cvc4 PRIVATE SymFPU) + target_link_libraries(cvc5 PRIVATE SymFPU) endif() # Note: When linked statically GMP needs to be linked after CLN since CLN # depends on GMP. -target_link_libraries(cvc4 PRIVATE GMP) +target_link_libraries(cvc5 PRIVATE GMP) # Add rt library # Note: For glibc < 2.17 we have to additionally link against rt (man clock_gettime). # RT_LIBRARIES should be empty for glibc >= 2.17 -target_link_libraries(cvc4 PRIVATE ${RT_LIBRARIES}) +target_link_libraries(cvc5 PRIVATE ${RT_LIBRARIES}) #-----------------------------------------------------------------------------# -# Visit main subdirectory after creating target cvc4. For target main, we have +# Visit main subdirectory after creating target cvc5. For target main, we have # to manually add library dependencies since we can't use # target_link_libraries(...) with object libraries for cmake versions <= 3.12. -# Thus, we can only visit main as soon as all dependencies for cvc4 are set up. +# Thus, we can only visit main as soon as all dependencies for cvc5 are set up. if (NOT BUILD_LIB_ONLY) add_subdirectory(main) @@ -1191,7 +1191,7 @@ install(FILES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cvc5/) install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/cvc4_export.h + ${CMAKE_CURRENT_BINARY_DIR}/cvc5_export.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cvc5/) diff --git a/src/api/cpp/cvc5.h b/src/api/cpp/cvc5.h index c8f1b8d4a..96e287f84 100644 --- a/src/api/cpp/cvc5.h +++ b/src/api/cpp/cvc5.h @@ -13,7 +13,7 @@ * The cvc5 C++ API. */ -#include "cvc4_export.h" +#include "cvc5_export.h" #ifndef CVC5__API__CVC5_H #define CVC5__API__CVC5_H @@ -63,7 +63,7 @@ struct APIStatistics; * Base class for all API exceptions. * If thrown, all API objects may be in an unsafe state. */ -class CVC4_EXPORT CVC5ApiException : public std::exception +class CVC5_EXPORT CVC5ApiException : public std::exception { public: /** @@ -96,7 +96,7 @@ class CVC4_EXPORT CVC5ApiException : public std::exception * A recoverable API exception. * If thrown, API objects can still be used. */ -class CVC4_EXPORT CVC5ApiRecoverableException : public CVC5ApiException +class CVC5_EXPORT CVC5ApiRecoverableException : public CVC5ApiException { public: /** @@ -121,7 +121,7 @@ class CVC4_EXPORT CVC5ApiRecoverableException : public CVC5ApiException /** * Encapsulation of a three-valued solver result, with explanations. */ -class CVC4_EXPORT Result +class CVC5_EXPORT Result { friend class Solver; @@ -230,7 +230,7 @@ class CVC4_EXPORT Result * @param r the result to be serialized to the given output stream * @return the output stream */ -std::ostream& operator<<(std::ostream& out, const Result& r) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, const Result& r) CVC5_EXPORT; /** * Serialize an UnknownExplanation to given stream. @@ -239,7 +239,7 @@ std::ostream& operator<<(std::ostream& out, const Result& r) CVC4_EXPORT; * @return the output stream */ std::ostream& operator<<(std::ostream& out, - enum Result::UnknownExplanation e) CVC4_EXPORT; + enum Result::UnknownExplanation e) CVC5_EXPORT; /* -------------------------------------------------------------------------- */ /* Sort */ @@ -250,7 +250,7 @@ class Datatype; /** * The sort of a cvc5 term. */ -class CVC4_EXPORT Sort +class CVC5_EXPORT Sort { friend class cvc5::Command; friend class DatatypeConstructor; @@ -749,12 +749,12 @@ class CVC4_EXPORT Sort * @param s the sort to be serialized to the given output stream * @return the output stream */ -std::ostream& operator<<(std::ostream& out, const Sort& s) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, const Sort& s) CVC5_EXPORT; /** * Hash function for Sorts. */ -struct CVC4_EXPORT SortHashFunction +struct CVC5_EXPORT SortHashFunction { size_t operator()(const Sort& s) const; }; @@ -768,7 +768,7 @@ struct CVC4_EXPORT SortHashFunction * An operator is a term that represents certain operators, instantiated * with its required parameters, e.g., a term of kind BITVECTOR_EXTRACT. */ -class CVC4_EXPORT Op +class CVC5_EXPORT Op { friend class Solver; friend class Term; @@ -896,7 +896,7 @@ class CVC4_EXPORT Op /** * A cvc5 Term. */ -class CVC4_EXPORT Term +class CVC5_EXPORT Term { friend class cvc5::Command; friend class Datatype; @@ -1285,7 +1285,7 @@ class CVC4_EXPORT Term /** * Hash function for Terms. */ -struct CVC4_EXPORT TermHashFunction +struct CVC5_EXPORT TermHashFunction { size_t operator()(const Term& t) const; }; @@ -1296,7 +1296,7 @@ struct CVC4_EXPORT TermHashFunction * @param t the term to be serialized to the given output stream * @return the output stream */ -std::ostream& operator<<(std::ostream& out, const Term& t) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, const Term& t) CVC5_EXPORT; /** * Serialize a vector of terms to given stream. @@ -1305,7 +1305,7 @@ std::ostream& operator<<(std::ostream& out, const Term& t) CVC4_EXPORT; * @return the output stream */ std::ostream& operator<<(std::ostream& out, - const std::vector& vector) CVC4_EXPORT; + const std::vector& vector) CVC5_EXPORT; /** * Serialize a set of terms to the given stream. @@ -1314,7 +1314,7 @@ std::ostream& operator<<(std::ostream& out, * @return the output stream */ std::ostream& operator<<(std::ostream& out, - const std::set& set) CVC4_EXPORT; + const std::set& set) CVC5_EXPORT; /** * Serialize an unordered_set of terms to the given stream. @@ -1325,7 +1325,7 @@ std::ostream& operator<<(std::ostream& out, */ std::ostream& operator<<(std::ostream& out, const std::unordered_set& - unordered_set) CVC4_EXPORT; + unordered_set) CVC5_EXPORT; /** * Serialize a map of terms to the given stream. @@ -1336,7 +1336,7 @@ std::ostream& operator<<(std::ostream& out, */ template std::ostream& operator<<(std::ostream& out, - const std::map& map) CVC4_EXPORT; + const std::map& map) CVC5_EXPORT; /** * Serialize an unordered_map of terms to the given stream. @@ -1348,7 +1348,7 @@ std::ostream& operator<<(std::ostream& out, template std::ostream& operator<<(std::ostream& out, const std::unordered_map& - unordered_map) CVC4_EXPORT; + unordered_map) CVC5_EXPORT; /** * Serialize an operator to given stream. @@ -1356,12 +1356,12 @@ std::ostream& operator<<(std::ostream& out, * @param t the operator to be serialized to the given output stream * @return the output stream */ -std::ostream& operator<<(std::ostream& out, const Op& t) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, const Op& t) CVC5_EXPORT; /** * Hash function for Ops. */ -struct CVC4_EXPORT OpHashFunction +struct CVC5_EXPORT OpHashFunction { size_t operator()(const Op& t) const; }; @@ -1376,7 +1376,7 @@ class DatatypeIterator; /** * A cvc5 datatype constructor declaration. */ -class CVC4_EXPORT DatatypeConstructorDecl +class CVC5_EXPORT DatatypeConstructorDecl { friend class DatatypeDecl; friend class Solver; @@ -1446,7 +1446,7 @@ class Solver; /** * A cvc5 datatype declaration. */ -class CVC4_EXPORT DatatypeDecl +class CVC5_EXPORT DatatypeDecl { friend class DatatypeConstructorArg; friend class Solver; @@ -1550,7 +1550,7 @@ class CVC4_EXPORT DatatypeDecl /** * A cvc5 datatype selector. */ -class CVC4_EXPORT DatatypeSelector +class CVC5_EXPORT DatatypeSelector { friend class DatatypeConstructor; friend class Solver; @@ -1619,7 +1619,7 @@ class CVC4_EXPORT DatatypeSelector /** * A cvc5 datatype constructor. */ -class CVC4_EXPORT DatatypeConstructor +class CVC5_EXPORT DatatypeConstructor { friend class Datatype; friend class Solver; @@ -1846,7 +1846,7 @@ class CVC4_EXPORT DatatypeConstructor /** * A cvc5 datatype. */ -class CVC4_EXPORT Datatype +class CVC5_EXPORT Datatype { friend class Solver; friend class Sort; @@ -2072,7 +2072,7 @@ class CVC4_EXPORT Datatype * @return the output stream */ std::ostream& operator<<(std::ostream& out, - const DatatypeDecl& dtdecl) CVC4_EXPORT; + const DatatypeDecl& dtdecl) CVC5_EXPORT; /** * Serialize a datatype constructor declaration to given stream. @@ -2081,7 +2081,7 @@ std::ostream& operator<<(std::ostream& out, * @return the output stream */ std::ostream& operator<<(std::ostream& out, - const DatatypeConstructorDecl& ctordecl) CVC4_EXPORT; + const DatatypeConstructorDecl& ctordecl) CVC5_EXPORT; /** * Serialize a vector of datatype constructor declarations to given stream. @@ -2092,7 +2092,7 @@ std::ostream& operator<<(std::ostream& out, */ std::ostream& operator<<(std::ostream& out, const std::vector& vector) - CVC4_EXPORT; + CVC5_EXPORT; /** * Serialize a datatype to given stream. @@ -2100,7 +2100,7 @@ std::ostream& operator<<(std::ostream& out, * @param dtype the datatype to be serialized to given stream * @return the output stream */ -std::ostream& operator<<(std::ostream& out, const Datatype& dtype) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, const Datatype& dtype) CVC5_EXPORT; /** * Serialize a datatype constructor to given stream. @@ -2109,7 +2109,7 @@ std::ostream& operator<<(std::ostream& out, const Datatype& dtype) CVC4_EXPORT; * @return the output stream */ std::ostream& operator<<(std::ostream& out, - const DatatypeConstructor& ctor) CVC4_EXPORT; + const DatatypeConstructor& ctor) CVC5_EXPORT; /** * Serialize a datatype selector to given stream. @@ -2118,7 +2118,7 @@ std::ostream& operator<<(std::ostream& out, * @return the output stream */ std::ostream& operator<<(std::ostream& out, - const DatatypeSelector& stor) CVC4_EXPORT; + const DatatypeSelector& stor) CVC5_EXPORT; /* -------------------------------------------------------------------------- */ /* Grammar */ @@ -2127,7 +2127,7 @@ std::ostream& operator<<(std::ostream& out, /** * A Sygus Grammar. */ -class CVC4_EXPORT Grammar +class CVC5_EXPORT Grammar { friend class cvc5::Command; friend class Solver; @@ -2272,7 +2272,7 @@ class CVC4_EXPORT Grammar * @param g the grammar to be serialized to the given output stream * @return the output stream */ -std::ostream& operator<<(std::ostream& out, const Grammar& g) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, const Grammar& g) CVC5_EXPORT; /* -------------------------------------------------------------------------- */ /* Rounding Mode for Floating-Points */ @@ -2292,7 +2292,7 @@ std::ostream& operator<<(std::ostream& out, const Grammar& g) CVC4_EXPORT; * Standard 754. * \endverbatim */ -enum CVC4_EXPORT RoundingMode +enum CVC5_EXPORT RoundingMode { /** * Round to the nearest even number. @@ -2331,7 +2331,7 @@ enum CVC4_EXPORT RoundingMode /** * Hash function for RoundingModes. */ -struct CVC4_EXPORT RoundingModeHashFunction +struct CVC5_EXPORT RoundingModeHashFunction { inline size_t operator()(const RoundingMode& rm) const; }; @@ -2347,7 +2347,7 @@ struct CVC4_EXPORT RoundingModeHashFunction * The value type can be queried (using `isInt`, `isString`, etc.) and * the stored value can be accessed (using `getInt`, `getString`, etc.). */ -class CVC4_EXPORT Stat +class CVC5_EXPORT Stat { struct StatData; @@ -2392,7 +2392,7 @@ class CVC4_EXPORT Stat std::unique_ptr d_data; }; -std::ostream& operator<<(std::ostream& os, const Stat& sv) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& os, const Stat& sv) CVC5_EXPORT; /** * Represents a snapshot of the solver statistics. @@ -2407,7 +2407,7 @@ std::ostream& operator<<(std::ostream& os, const Stat& sv) CVC4_EXPORT; * statistics that are expert, unchanged, or both, can be included as well. * A single statistic value is represented as `Stat`. */ -class CVC4_EXPORT Statistics +class CVC5_EXPORT Statistics { public: friend Solver; @@ -2458,7 +2458,8 @@ class CVC4_EXPORT Statistics /** Internal data */ BaseType d_stats; }; -std::ostream& operator<<(std::ostream& out, const Statistics& stats) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, + const Statistics& stats) CVC5_EXPORT; /* -------------------------------------------------------------------------- */ /* Solver */ @@ -2467,7 +2468,7 @@ std::ostream& operator<<(std::ostream& out, const Statistics& stats) CVC4_EXPORT /** * A cvc5 solver. */ -class CVC4_EXPORT Solver +class CVC5_EXPORT Solver { friend class Datatype; friend class DatatypeDecl; diff --git a/src/api/cpp/cvc5_checks.h b/src/api/cpp/cvc5_checks.h index d332652fd..c30237ecd 100644 --- a/src/api/cpp/cvc5_checks.h +++ b/src/api/cpp/cvc5_checks.h @@ -20,7 +20,7 @@ #ifndef CVC5__API__CHECKS_H #define CVC5__API__CHECKS_H -namespace cvc4 { +namespace cvc5 { namespace api { /* -------------------------------------------------------------------------- */ @@ -653,5 +653,5 @@ namespace api { } \ } while (0) } // namespace api -} // namespace cvc4 +} // namespace cvc5 #endif diff --git a/src/api/cpp/cvc5_kind.h b/src/api/cpp/cvc5_kind.h index 86e6d676d..7d0f7b9b7 100644 --- a/src/api/cpp/cvc5_kind.h +++ b/src/api/cpp/cvc5_kind.h @@ -13,7 +13,7 @@ * The term kinds of the cvc5 C++ API. */ -#include "cvc4_export.h" +#include "cvc5_export.h" #ifndef CVC5__API__CVC5_KIND_H #define CVC5__API__CVC5_KIND_H @@ -35,7 +35,7 @@ namespace api { * checks for validity). The size of this type depends on the size of * cvc5::Kind (NodeValue::NBITS_KIND, currently 10 bits, see expr/node_value.h). */ -enum CVC4_EXPORT Kind : int32_t +enum CVC5_EXPORT Kind : int32_t { /** * Internal kind. @@ -185,9 +185,9 @@ enum CVC4_EXPORT Kind : int32_t * (e.g. for arithmetic terms in non-linear queries). However, it is not * supported by the parser. Moreover, the user of the API should be cautious * when using this operator. In general, all witness terms - * `(witness ((x Int)) F)` should be such that `(exists ((x Int)) F)` is a valid - * formula. If this is not the case, then the semantics in formulas that use - * witness terms may be unintuitive. For example, the following formula is + * `(witness ((x Int)) F)` should be such that `(exists ((x Int)) F)` is a + * valid formula. If this is not the case, then the semantics in formulas that + * use witness terms may be unintuitive. For example, the following formula is * unsatisfiable: * `(or (= (witness ((x Int)) false) 0) (not (= (witness ((x Int)) false) 0))` * whereas notice that `(or (= z 0) (not (= z 0)))` is true for any `z`. @@ -393,7 +393,7 @@ enum CVC4_EXPORT Kind : int32_t * - `Solver::mkOp(Kind kind, uint32_t param) const` * * Apply integer conversion to bit-vector. - + * Parameters: * - 1: Op of kind IAND * - 2: Integer term @@ -2341,11 +2341,12 @@ enum CVC4_EXPORT Kind : int32_t * a predicate P[x1...xn], and a term t[x1...xn]. A comprehension C with the * above form has members given by the following semantics: * @f[ - * \forall y. ( \exists x_1...x_n. P[x_1...x_n] \hat{} t[x_1...x_n] = y ) \Leftrightarrow (member y C) + * \forall y. ( \exists x_1...x_n. P[x_1...x_n] \hat{} t[x_1...x_n] = y ) + * \Leftrightarrow (member y C) * @f] * where y ranges over the element type of the (set) type of the - * comprehension. If @f$ t[x_1..x_n] @f$ is not provided, it is equivalent to y in the - * above formula. + * comprehension. If @f$ t[x_1..x_n] @f$ is not provided, it is equivalent to + * y in the above formula. * * Parameters: * - 1: Term BOUND_VAR_LIST @@ -3430,7 +3431,7 @@ enum CVC4_EXPORT Kind : int32_t * @param k the kind * @return the string representation of kind k */ -std::string kindToString(Kind k) CVC4_EXPORT; +std::string kindToString(Kind k) CVC5_EXPORT; /** * Serialize a kind to given stream. @@ -3438,12 +3439,12 @@ std::string kindToString(Kind k) CVC4_EXPORT; * @param k the kind to be serialized to the given output stream * @return the output stream */ -std::ostream& operator<<(std::ostream& out, Kind k) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, Kind k) CVC5_EXPORT; /** * Hash function for Kinds. */ -struct CVC4_EXPORT KindHashFunction +struct CVC5_EXPORT KindHashFunction { /** * Hashes a Kind to a size_t. diff --git a/src/api/parsekinds.py b/src/api/parsekinds.py index cb1586995..30f182b02 100644 --- a/src/api/parsekinds.py +++ b/src/api/parsekinds.py @@ -34,7 +34,7 @@ US = '_' NL = '\n' # Enum Declarations -ENUM_START = 'enum CVC4_EXPORT Kind' +ENUM_START = 'enum CVC5_EXPORT Kind' ENUM_END = CCB + SC # Comments and Macro Tokens diff --git a/src/api/python/CMakeLists.txt b/src/api/python/CMakeLists.txt index 4eca7e442..02405a0cc 100644 --- a/src/api/python/CMakeLists.txt +++ b/src/api/python/CMakeLists.txt @@ -22,11 +22,11 @@ endif() find_package(PythonExtensions REQUIRED) find_package(Cython 0.29 REQUIRED) -# Generate cvc4kinds.{pxd,pyx} +# Generate cvc5kinds.{pxd,pyx} configure_file(genkinds.py.in genkinds.py) set(GENERATED_FILES - "${CMAKE_CURRENT_BINARY_DIR}/cvc4kinds.pxd" - "${CMAKE_CURRENT_BINARY_DIR}/cvc4kinds.pxi" + "${CMAKE_CURRENT_BINARY_DIR}/cvc5kinds.pxd" + "${CMAKE_CURRENT_BINARY_DIR}/cvc5kinds.pxi" ) add_custom_command( OUTPUT @@ -37,58 +37,58 @@ add_custom_command( "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}/genkinds.py" --kinds-header "${PROJECT_SOURCE_DIR}/src/api/cpp/cvc5_kind.h" - --kinds-file-prefix "${CMAKE_CURRENT_BINARY_DIR}/cvc4kinds" + --kinds-file-prefix "${CMAKE_CURRENT_BINARY_DIR}/cvc5kinds" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/genkinds.py" "${PROJECT_SOURCE_DIR}/src/api/cpp/cvc5_kind.h" ) -add_custom_target(cvc4kinds DEPENDS ${GENERATED_FILES}) +add_custom_target(cvc5kinds DEPENDS ${GENERATED_FILES}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) # for cvc4kinds.pxi -add_cython_target(pycvc4 CXX) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) # for cvc5kinds.pxi +add_cython_target(pycvc5 CXX) -add_library(pycvc4 +add_library(pycvc5 MODULE - ${pycvc4}) -add_dependencies(pycvc4 cvc4kinds) + ${pycvc5}) +add_dependencies(pycvc5 cvc5kinds) -target_include_directories(pycvc4 +target_include_directories(pycvc5 PRIVATE ${PYTHON_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src # for API headers in src/api/cpp - ${CMAKE_BINARY_DIR}/src # for cvc4_export.h + ${CMAKE_BINARY_DIR}/src # for cvc5_export.h ) -target_link_libraries(pycvc4 cvc4 ${PYTHON_LIBRARIES}) +target_link_libraries(pycvc5 cvc5 ${PYTHON_LIBRARIES}) # Disable -Werror and other warnings for code generated by Cython. # Note: Visibility is reset to default here since otherwise the PyInit_... # function will not be exported correctly # (https://github.com/cython/cython/issues/3380). -set_target_properties(pycvc4 +set_target_properties(pycvc5 PROPERTIES COMPILE_FLAGS "-Wno-error -Wno-shadow -Wno-implicit-fallthrough" CXX_VISIBILITY_PRESET default VISIBILITY_INLINES_HIDDEN 0) -python_extension_module(pycvc4) +python_extension_module(pycvc5) # Installation based on https://bloerg.net/2012/11/10/cmake-and-distutils.html # Create a wrapper python directory and generate a distutils setup.py file configure_file(setup.py.in setup.py) -set(PYCVC5_MODULE "${CMAKE_CURRENT_BINARY_DIR}/pycvc4") +set(PYCVC5_MODULE "${CMAKE_CURRENT_BINARY_DIR}/pycvc5") file(MAKE_DIRECTORY "${PYCVC5_MODULE}") file(WRITE ${PYCVC5_MODULE}/__init__.py "import sys -from .pycvc4 import * -# fake a submodule for dotted imports, e.g. from pycvc4.kinds import * +from .pycvc5 import * +# fake a submodule for dotted imports, e.g. from pycvc5.kinds import * sys.modules['%s.%s'%(__name__, kinds.__name__)] = kinds") -set(PYCVC5_LOC "${PYCVC5_MODULE}/$") -add_custom_command(TARGET pycvc4 POST_BUILD - COMMAND ${CMAKE_COMMAND} -E rename $ ${PYCVC5_LOC} +set(PYCVC5_LOC "${PYCVC5_MODULE}/$") +add_custom_command(TARGET pycvc5 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename $ ${PYCVC5_LOC} ) # figure out if we're in a virtualenv diff --git a/src/api/python/cvc4.pxd b/src/api/python/cvc4.pxd deleted file mode 100644 index 336def3dc..000000000 --- a/src/api/python/cvc4.pxd +++ /dev/null @@ -1,370 +0,0 @@ -# import dereference and increment operators -from cython.operator cimport dereference as deref, preincrement as inc -from libc.stdint cimport int32_t, int64_t, uint32_t, uint64_t -from libcpp.set cimport set -from libcpp.string cimport string -from libcpp.vector cimport vector -from libcpp.pair cimport pair -from cvc4kinds cimport Kind - - -cdef extern from "" namespace "std": - cdef cppclass ostream: - pass - ostream cout - - -cdef extern from "api/cpp/cvc5.h" namespace "cvc5": - cdef cppclass Options: - pass - - -cdef extern from "api/cpp/cvc5.h" namespace "cvc5::api": - cdef cppclass Datatype: - Datatype() except + - DatatypeConstructor operator[](size_t idx) except + - DatatypeConstructor operator[](const string& name) except + - DatatypeConstructor getConstructor(const string& name) except + - Term getConstructorTerm(const string& name) except + - size_t getNumConstructors() except + - bint isParametric() except + - bint isCodatatype() except + - bint isTuple() except + - bint isRecord() except + - bint isFinite() except + - bint isWellFounded() except + - bint hasNestedRecursion() except + - string toString() except + - cppclass const_iterator: - const_iterator() except + - bint operator==(const const_iterator& it) except + - bint operator!=(const const_iterator& it) except + - const_iterator& operator++(); - const DatatypeConstructor& operator*() except + - const_iterator begin() except + - const_iterator end() except + - - - cdef cppclass DatatypeConstructor: - DatatypeConstructor() except + - DatatypeSelector operator[](size_t idx) except + - DatatypeSelector operator[](const string& name) except + - string getName() except + - Term getConstructorTerm() except + - Term getTesterTerm() except + - size_t getNumSelectors() except + - DatatypeSelector getSelector(const string& name) except + - Term getSelectorTerm(const string& name) except + - string toString() except + - cppclass const_iterator: - const_iterator() except + - bint operator==(const const_iterator& it) except + - bint operator!=(const const_iterator& it) except + - const_iterator& operator++(); - const DatatypeSelector& operator*() except + - const_iterator begin() except + - const_iterator end() except + - - - cdef cppclass DatatypeConstructorDecl: - void addSelector(const string& name, Sort sort) except + - void addSelectorSelf(const string& name) except + - string toString() except + - - - cdef cppclass DatatypeDecl: - void addConstructor(const DatatypeConstructorDecl& ctor) except + - size_t getNumConstructors() except + - bint isParametric() except + - string toString() except + - - - cdef cppclass DatatypeSelector: - DatatypeSelector() except + - string getName() except + - Term getSelectorTerm() except + - Sort getRangeSort() except + - string toString() except + - - - cdef cppclass Op: - Op() except + - bint operator==(const Op&) except + - bint operator!=(const Op&) except + - Kind getKind() except + - Sort getSort() except + - bint isNull() except + - T getIndices[T]() except + - string toString() except + - - cdef cppclass OpHashFunction: - OpHashFunction() except + - size_t operator()(const Op & o) except + - - - cdef cppclass Result: - Result() except+ - bint isNull() except + - bint isSat() except + - bint isUnsat() except + - bint isSatUnknown() except + - bint isEntailed() except + - bint isNotEntailed() except + - bint isEntailmentUnknown() except + - bint operator==(const Result& r) except + - bint operator!=(const Result& r) except + - string getUnknownExplanation() except + - string toString() except + - - - cdef cppclass RoundingMode: - pass - - - cdef cppclass Solver: - Solver(Options*) except + - bint supportsFloatingPoint() except + - Sort getBooleanSort() except + - Sort getIntegerSort() except + - Sort getRealSort() except + - Sort getRegExpSort() except + - Sort getRoundingModeSort() except + - Sort getStringSort() except + - Sort mkArraySort(Sort indexSort, Sort elemSort) except + - Sort mkBitVectorSort(uint32_t size) except + - Sort mkFloatingPointSort(uint32_t exp, uint32_t sig) except + - Sort mkDatatypeSort(DatatypeDecl dtypedecl) except + - vector[Sort] mkDatatypeSorts(const vector[DatatypeDecl]& dtypedecls, - const set[Sort]& unresolvedSorts) except + - Sort mkFunctionSort(Sort domain, Sort codomain) except + - Sort mkFunctionSort(const vector[Sort]& sorts, Sort codomain) except + - Sort mkParamSort(const string& symbol) except + - Sort mkPredicateSort(const vector[Sort]& sorts) except + - Sort mkRecordSort(const vector[pair[string, Sort]]& fields) except + - Sort mkSetSort(Sort elemSort) except + - Sort mkBagSort(Sort elemSort) except + - Sort mkSequenceSort(Sort elemSort) except + - Sort mkUninterpretedSort(const string& symbol) except + - Sort mkSortConstructorSort(const string& symbol, size_t arity) except + - Sort mkTupleSort(const vector[Sort]& sorts) except + - Term mkTerm(Op op) except + - Term mkTerm(Op op, const vector[Term]& children) except + - Op mkOp(Kind kind) except + - Op mkOp(Kind kind, Kind k) except + - Op mkOp(Kind kind, const string& arg) except + - Op mkOp(Kind kind, uint32_t arg) except + - Op mkOp(Kind kind, uint32_t arg1, uint32_t arg2) except + - # Sygus related functions - Grammar mkSygusGrammar(const vector[Term]& boundVars, const vector[Term]& ntSymbols) except + - Term mkSygusVar(Sort sort, const string& symbol) except + - Term mkSygusVar(Sort sort) except + - void addSygusConstraint(Term term) except + - void addSygusInvConstraint(Term inv_f, Term pre_f, Term trans_f, Term post_f) except + - Term synthFun(const string& symbol, const vector[Term]& bound_vars, Sort sort) except + - Term synthFun(const string& symbol, const vector[Term]& bound_vars, Sort sort, Grammar grammar) except + - Result checkSynth() except + - Term getSynthSolution(Term t) except + - vector[Term] getSynthSolutions(const vector[Term]& terms) except + - Term synthInv(const string& symbol, const vector[Term]& bound_vars) except + - Term synthInv(const string& symbol, const vector[Term]& bound_vars, Grammar grammar) except + - void printSynthSolution(ostream& out) except + - # End of sygus related functions - - Term mkTrue() except + - Term mkFalse() except + - Term mkBoolean(bint val) except + - Term mkPi() except + - Term mkInteger(const string& s) except + - Term mkReal(const string& s) except + - Term mkRegexpEmpty() except + - Term mkRegexpSigma() except + - Term mkEmptySet(Sort s) except + - Term mkSepNil(Sort sort) except + - Term mkString(const string& s) except + - Term mkString(const vector[unsigned]& s) except + - Term mkEmptySequence(Sort sort) except + - Term mkUniverseSet(Sort sort) except + - Term mkBitVector(uint32_t size) except + - Term mkBitVector(uint32_t size, uint64_t val) except + - Term mkBitVector(const string& s) except + - Term mkBitVector(const string& s, uint32_t base) except + - Term mkBitVector(uint32_t size, string& s, uint32_t base) except + - Term mkConstArray(Sort sort, Term val) except + - Term mkPosInf(uint32_t exp, uint32_t sig) except + - Term mkNegInf(uint32_t exp, uint32_t sig) except + - Term mkNaN(uint32_t exp, uint32_t sig) except + - Term mkPosZero(uint32_t exp, uint32_t sig) except + - Term mkNegZero(uint32_t exp, uint32_t sig) except + - Term mkRoundingMode(RoundingMode rm) except + - Term mkUninterpretedConst(Sort sort, int32_t index) except + - Term mkAbstractValue(const string& index) except + - Term mkFloatingPoint(uint32_t exp, uint32_t sig, Term val) except + - Term mkConst(Sort sort, const string& symbol) except + - # default value for symbol defined in cpp/cvc5.h - Term mkConst(Sort sort) except + - Term mkVar(Sort sort, const string& symbol) except + - DatatypeConstructorDecl mkDatatypeConstructorDecl(const string& name) except + - DatatypeDecl mkDatatypeDecl(const string& name) except + - DatatypeDecl mkDatatypeDecl(const string& name, bint isCoDatatype) except + - DatatypeDecl mkDatatypeDecl(const string& name, Sort param) except + - DatatypeDecl mkDatatypeDecl(const string& name, Sort param, bint isCoDatatype) except + - DatatypeDecl mkDatatypeDecl(const string& name, vector[Sort]& params) except + - DatatypeDecl mkDatatypeDecl(const string& name, vector[Sort]& params, bint isCoDatatype) except + - # default value for symbol defined in cpp/cvc5.h - Term mkVar(Sort sort) except + - Term simplify(const Term& t) except + - void assertFormula(Term term) except + - Result checkSat() except + - Result checkSatAssuming(const vector[Term]& assumptions) except + - Result checkEntailed(const vector[Term]& assumptions) except + - Sort declareDatatype(const string& symbol, const vector[DatatypeConstructorDecl]& ctors) - Term declareFun(const string& symbol, Sort sort) except + - Term declareFun(const string& symbol, const vector[Sort]& sorts, Sort sort) except + - Sort declareSort(const string& symbol, uint32_t arity) except + - Term defineFun(const string& symbol, const vector[Term]& bound_vars, - Sort sort, Term term, bint glbl) except + - Term defineFun(Term fun, const vector[Term]& bound_vars, Term term, bint glbl) except + - Term defineFunRec(const string& symbol, const vector[Term]& bound_vars, - Sort sort, Term term, bint glbl) except + - Term defineFunRec(Term fun, const vector[Term]& bound_vars, - Term term, bint glbl) except + - Term defineFunsRec(vector[Term]& funs, vector[vector[Term]]& bound_vars, - vector[Term]& terms, bint glbl) except + - vector[Term] getAssertions() except + - string getInfo(const string& flag) except + - string getOption(string& option) except + - vector[Term] getUnsatAssumptions() except + - vector[Term] getUnsatCore() except + - Term getValue(Term term) except + - vector[Term] getValue(const vector[Term]& terms) except + - void declareSeparationHeap(Sort locSort, Sort dataSort) except + - Term getSeparationHeap() except + - Term getSeparationNilTerm() except + - Term declarePool(const string& name, Sort sort, vector[Term]& initValue) except + - void pop(uint32_t nscopes) except + - void push(uint32_t nscopes) except + - void reset() except + - void resetAssertions() except + - void setInfo(string& keyword, const string& value) except + - void setLogic(const string& logic) except + - void setOption(const string& option, const string& value) except + - - cdef cppclass Grammar: - Grammar() except + - Grammar(Solver* solver, vector[Term] boundVars, vector[Term] ntSymbols) except + - void addRule(Term ntSymbol, Term rule) except + - void addAnyConstant(Term ntSymbol) except + - void addAnyVariable(Term ntSymbol) except + - void addRules(Term ntSymbol, vector[Term] rules) except + - - cdef cppclass Sort: - Sort() except + - bint operator==(const Sort&) except + - bint operator!=(const Sort&) except + - bint operator<(const Sort&) except + - bint operator>(const Sort&) except + - bint operator<=(const Sort&) except + - bint operator>=(const Sort&) except + - bint isBoolean() except + - bint isInteger() except + - bint isReal() except + - bint isString() except + - bint isRegExp() except + - bint isRoundingMode() except + - bint isBitVector() except + - bint isFloatingPoint() except + - bint isDatatype() except + - bint isParametricDatatype() except + - bint isConstructor() except + - bint isSelector() except + - bint isTester() except + - bint isFunction() except + - bint isPredicate() except + - bint isTuple() except + - bint isRecord() except + - bint isArray() except + - bint isSet() except + - bint isBag() except + - bint isSequence() except + - bint isUninterpretedSort() except + - bint isSortConstructor() except + - bint isFirstClass() except + - bint isFunctionLike() except + - bint isSubsortOf(Sort s) except + - bint isComparableTo(Sort s) except + - Datatype getDatatype() except + - Sort instantiate(const vector[Sort]& params) except + - size_t getConstructorArity() except + - vector[Sort] getConstructorDomainSorts() except + - Sort getConstructorCodomainSort() except + - Sort getSelectorDomainSort() except + - Sort getSelectorCodomainSort() except + - Sort getTesterDomainSort() except + - Sort getTesterCodomainSort() except + - size_t getFunctionArity() except + - vector[Sort] getFunctionDomainSorts() except + - Sort getFunctionCodomainSort() except + - Sort getArrayIndexSort() except + - Sort getArrayElementSort() except + - Sort getSetElementSort() except + - Sort getBagElementSort() except + - Sort getSequenceElementSort() except + - string getUninterpretedSortName() except + - bint isUninterpretedSortParameterized() except + - vector[Sort] getUninterpretedSortParamSorts() except + - string getSortConstructorName() except + - size_t getSortConstructorArity() except + - uint32_t getBVSize() except + - uint32_t getFPExponentSize() except + - uint32_t getFPSignificandSize() except + - vector[Sort] getDatatypeParamSorts() except + - size_t getDatatypeArity() except + - size_t getTupleLength() except + - vector[Sort] getTupleSorts() except + - string toString() except + - - cdef cppclass SortHashFunction: - SortHashFunction() except + - size_t operator()(const Sort & s) except + - - cdef cppclass Term: - Term() - bint operator==(const Term&) except + - bint operator!=(const Term&) except + - Term operator[](size_t idx) except + - Kind getKind() except + - Sort getSort() except + - Term substitute(const vector[Term] es, const vector[Term] & reps) except + - bint hasOp() except + - Op getOp() except + - bint isNull() except + - Term getConstArrayBase() except + - vector[Term] getConstSequenceElements() except + - Term notTerm() except + - Term andTerm(const Term& t) except + - Term orTerm(const Term& t) except + - Term xorTerm(const Term& t) except + - Term eqTerm(const Term& t) except + - Term impTerm(const Term& t) except + - Term iteTerm(const Term& then_t, const Term& else_t) except + - string toString() except + - cppclass const_iterator: - const_iterator() except + - bint operator==(const const_iterator& it) except + - bint operator!=(const const_iterator& it) except + - const_iterator& operator++(); - Term operator*() except + - const_iterator begin() except + - const_iterator end() except + - - cdef cppclass TermHashFunction: - TermHashFunction() except + - size_t operator()(const Term & t) except + - - -cdef extern from "api/cpp/cvc5.h" namespace "cvc5::api::RoundingMode": - cdef RoundingMode ROUND_NEAREST_TIES_TO_EVEN, - cdef RoundingMode ROUND_TOWARD_POSITIVE, - cdef RoundingMode ROUND_TOWARD_NEGATIVE, - cdef RoundingMode ROUND_TOWARD_ZERO, - cdef RoundingMode ROUND_NEAREST_TIES_TO_AWAY diff --git a/src/api/python/cvc4.pxi b/src/api/python/cvc4.pxi deleted file mode 100644 index 48921dc87..000000000 --- a/src/api/python/cvc4.pxi +++ /dev/null @@ -1,1674 +0,0 @@ -from collections import defaultdict -from fractions import Fraction -import sys - -from libc.stdint cimport int32_t, int64_t, uint32_t, uint64_t - -from libcpp.pair cimport pair -from libcpp.set cimport set -from libcpp.string cimport string -from libcpp.vector cimport vector - -from cvc4 cimport cout -from cvc4 cimport Datatype as c_Datatype -from cvc4 cimport DatatypeConstructor as c_DatatypeConstructor -from cvc4 cimport DatatypeConstructorDecl as c_DatatypeConstructorDecl -from cvc4 cimport DatatypeDecl as c_DatatypeDecl -from cvc4 cimport DatatypeSelector as c_DatatypeSelector -from cvc4 cimport Result as c_Result -from cvc4 cimport RoundingMode as c_RoundingMode -from cvc4 cimport Op as c_Op -from cvc4 cimport OpHashFunction as c_OpHashFunction -from cvc4 cimport Solver as c_Solver -from cvc4 cimport Grammar as c_Grammar -from cvc4 cimport Sort as c_Sort -from cvc4 cimport SortHashFunction as c_SortHashFunction -from cvc4 cimport ROUND_NEAREST_TIES_TO_EVEN, ROUND_TOWARD_POSITIVE -from cvc4 cimport ROUND_TOWARD_NEGATIVE, ROUND_TOWARD_ZERO -from cvc4 cimport ROUND_NEAREST_TIES_TO_AWAY -from cvc4 cimport Term as c_Term -from cvc4 cimport TermHashFunction as c_TermHashFunction - -from cvc4kinds cimport Kind as c_Kind - -################################## DECORATORS ################################# -def expand_list_arg(num_req_args=0): - ''' - Creates a decorator that looks at index num_req_args of the args, - if it's a list, it expands it before calling the function. - ''' - def decorator(func): - def wrapper(owner, *args): - if len(args) == num_req_args + 1 and \ - isinstance(args[num_req_args], list): - args = list(args[:num_req_args]) + args[num_req_args] - return func(owner, *args) - return wrapper - return decorator -############################################################################### - -# Style Guidelines -### Using PEP-8 spacing recommendations -### Limit linewidth to 79 characters -### Break before binary operators -### surround top level functions and classes with two spaces -### separate methods by one space -### use spaces in functions sparingly to separate logical blocks -### can omit spaces between unrelated oneliners -### always use c++ default arguments -#### only use default args of None at python level - -# References and pointers -# The Solver object holds a pointer to a c_Solver. -# This is because the assignment operator is deleted in the C++ API for solvers. -# Cython has a limitation where you can't stack allocate objects -# that have constructors with arguments: -# https://groups.google.com/forum/#!topic/cython-users/fuKd-nQLpBs. -# To get around that you can either have a nullary constructor and assignment -# or, use a pointer (which is what we chose). -# An additional complication of this is that to free up resources, you must -# know when to delete the object. -# Python will not follow the same scoping rules as in C++, so it must be -# able to reference count. To do this correctly, the solver must be a -# reference in the Python class for any class that keeps a pointer to -# the solver in C++ (to ensure the solver is not deleted before something -# that depends on it). - - -## Objects for hashing -cdef c_OpHashFunction cophash = c_OpHashFunction() -cdef c_SortHashFunction csorthash = c_SortHashFunction() -cdef c_TermHashFunction ctermhash = c_TermHashFunction() - - -cdef class Datatype: - cdef c_Datatype cd - cdef Solver solver - def __cinit__(self, Solver solver): - self.solver = solver - - def __getitem__(self, index): - cdef DatatypeConstructor dc = DatatypeConstructor(self.solver) - if isinstance(index, int) and index >= 0: - dc.cdc = self.cd[( index)] - elif isinstance(index, str): - dc.cdc = self.cd[( index.encode())] - else: - raise ValueError("Expecting a non-negative integer or string") - return dc - - def getConstructor(self, str name): - cdef DatatypeConstructor dc = DatatypeConstructor(self.solver) - dc.cdc = self.cd.getConstructor(name.encode()) - return dc - - def getConstructorTerm(self, str name): - cdef Term term = Term(self.solver) - term.cterm = self.cd.getConstructorTerm(name.encode()) - return term - - def getNumConstructors(self): - return self.cd.getNumConstructors() - - def isParametric(self): - return self.cd.isParametric() - - def isCodatatype(self): - return self.cd.isCodatatype() - - def isTuple(self): - return self.cd.isTuple() - - def isRecord(self): - return self.cd.isRecord() - - def isFinite(self): - return self.cd.isFinite() - - def isWellFounded(self): - return self.cd.isWellFounded() - - def hasNestedRecursion(self): - return self.cd.hasNestedRecursion() - - def __str__(self): - return self.cd.toString().decode() - - def __repr__(self): - return self.cd.toString().decode() - - def __iter__(self): - for ci in self.cd: - dc = DatatypeConstructor(self.solver) - dc.cdc = ci - yield dc - - -cdef class DatatypeConstructor: - cdef c_DatatypeConstructor cdc - cdef Solver solver - def __cinit__(self, Solver solver): - self.cdc = c_DatatypeConstructor() - self.solver = solver - - def __getitem__(self, index): - cdef DatatypeSelector ds = DatatypeSelector(self.solver) - if isinstance(index, int) and index >= 0: - ds.cds = self.cdc[( index)] - elif isinstance(index, str): - ds.cds = self.cdc[( name.encode())] - else: - raise ValueError("Expecting a non-negative integer or string") - return ds - - def getName(self): - return self.cdc.getName().decode() - - def getConstructorTerm(self): - cdef Term term = Term(self.solver) - term.cterm = self.cdc.getConstructorTerm() - return term - - def getTesterTerm(self): - cdef Term term = Term(self.solver) - term.cterm = self.cdc.getTesterTerm() - return term - - def getNumSelectors(self): - return self.cdc.getNumSelectors() - - def getSelector(self, str name): - cdef DatatypeSelector ds = DatatypeSelector(self.solver) - ds.cds = self.cdc.getSelector(name.encode()) - return ds - - def getSelectorTerm(self, str name): - cdef Term term = Term(self.solver) - term.cterm = self.cdc.getSelectorTerm(name.encode()) - return term - - def __str__(self): - return self.cdc.toString().decode() - - def __repr__(self): - return self.cdc.toString().decode() - - def __iter__(self): - for ci in self.cdc: - ds = DatatypeSelector(self.solver) - ds.cds = ci - yield ds - - -cdef class DatatypeConstructorDecl: - cdef c_DatatypeConstructorDecl cddc - cdef Solver solver - - def __cinit__(self, Solver solver): - self.solver = solver - - def addSelector(self, str name, Sort sort): - self.cddc.addSelector(name.encode(), sort.csort) - - def addSelectorSelf(self, str name): - self.cddc.addSelectorSelf(name.encode()) - - def __str__(self): - return self.cddc.toString().decode() - - def __repr__(self): - return self.cddc.toString().decode() - - -cdef class DatatypeDecl: - cdef c_DatatypeDecl cdd - cdef Solver solver - def __cinit__(self, Solver solver): - self.solver = solver - - def addConstructor(self, DatatypeConstructorDecl ctor): - self.cdd.addConstructor(ctor.cddc) - - def getNumConstructors(self): - return self.cdd.getNumConstructors() - - def isParametric(self): - return self.cdd.isParametric() - - def __str__(self): - return self.cdd.toString().decode() - - def __repr__(self): - return self.cdd.toString().decode() - - -cdef class DatatypeSelector: - cdef c_DatatypeSelector cds - cdef Solver solver - def __cinit__(self, Solver solver): - self.cds = c_DatatypeSelector() - self.solver = solver - - def getName(self): - return self.cds.getName().decode() - - def getSelectorTerm(self): - cdef Term term = Term(self.solver) - term.cterm = self.cds.getSelectorTerm() - return term - - def getRangeSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.cds.getRangeSort() - return sort - - def __str__(self): - return self.cds.toString().decode() - - def __repr__(self): - return self.cds.toString().decode() - - -cdef class Op: - cdef c_Op cop - cdef Solver solver - def __cinit__(self, Solver solver): - self.cop = c_Op() - self.solver = solver - - def __eq__(self, Op other): - return self.cop == other.cop - - def __ne__(self, Op other): - return self.cop != other.cop - - def __str__(self): - return self.cop.toString().decode() - - def __repr__(self): - return self.cop.toString().decode() - - def __hash__(self): - return cophash(self.cop) - - def getKind(self): - return kind( self.cop.getKind()) - - def isNull(self): - return self.cop.isNull() - - def getIndices(self): - indices = None - try: - indices = self.cop.getIndices[string]() - except: - pass - - try: - indices = self.cop.getIndices[uint32_t]() - except: - pass - - try: - indices = self.cop.getIndices[pair[uint32_t, uint32_t]]() - except: - pass - - if indices is None: - raise RuntimeError("Unable to retrieve indices from {}".format(self)) - - return indices - -cdef class Grammar: - cdef c_Grammar cgrammar - cdef Solver solver - def __cinit__(self, Solver solver): - self.solver = solver - self.cgrammar = c_Grammar() - - def addRule(self, Term ntSymbol, Term rule): - self.cgrammar.addRule(ntSymbol.cterm, rule.cterm) - - def addAnyConstant(self, Term ntSymbol): - self.cgrammar.addAnyConstant(ntSymbol.cterm) - - def addAnyVariable(self, Term ntSymbol): - self.cgrammar.addAnyVariable(ntSymbol.cterm) - - def addRules(self, Term ntSymbol, rules): - cdef vector[c_Term] crules - for r in rules: - crules.push_back(( r).cterm) - self.cgrammar.addRules(ntSymbol.cterm, crules) - -cdef class Result: - cdef c_Result cr - def __cinit__(self): - # gets populated by solver - self.cr = c_Result() - - def isNull(self): - return self.cr.isNull() - - def isSat(self): - return self.cr.isSat() - - def isUnsat(self): - return self.cr.isUnsat() - - def isSatUnknown(self): - return self.cr.isSatUnknown() - - def isEntailed(self): - return self.cr.isEntailed() - - def isNotEntailed(self): - return self.cr.isNotEntailed() - - def isEntailmentUnknown(self): - return self.cr.isEntailmentUnknown() - - def __eq__(self, Result other): - return self.cr == other.cr - - def __ne__(self, Result other): - return self.cr != other.cr - - def getUnknownExplanation(self): - return self.cr.getUnknownExplanation().decode() - - def __str__(self): - return self.cr.toString().decode() - - def __repr__(self): - return self.cr.toString().decode() - - -cdef class RoundingMode: - cdef c_RoundingMode crm - cdef str name - def __cinit__(self, int rm): - # crm always assigned externally - self.crm = rm - self.name = __rounding_modes[rm] - - def __eq__(self, RoundingMode other): - return ( self.crm) == ( other.crm) - - def __ne__(self, RoundingMode other): - return not self.__eq__(other) - - def __hash__(self): - return hash(( self.crm, self.name)) - - def __str__(self): - return self.name - - def __repr__(self): - return self.name - - -cdef class Solver: - cdef c_Solver* csolver - - def __cinit__(self): - self.csolver = new c_Solver(NULL) - - def __dealloc__(self): - del self.csolver - - def supportsFloatingPoint(self): - return self.csolver.supportsFloatingPoint() - - def getBooleanSort(self): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.getBooleanSort() - return sort - - def getIntegerSort(self): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.getIntegerSort() - return sort - - def getRealSort(self): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.getRealSort() - return sort - - def getRegExpSort(self): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.getRegExpSort() - return sort - - def getRoundingModeSort(self): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.getRoundingModeSort() - return sort - - def getStringSort(self): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.getStringSort() - return sort - - def mkArraySort(self, Sort indexSort, Sort elemSort): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkArraySort(indexSort.csort, elemSort.csort) - return sort - - def mkBitVectorSort(self, uint32_t size): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkBitVectorSort(size) - return sort - - def mkFloatingPointSort(self, uint32_t exp, uint32_t sig): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkFloatingPointSort(exp, sig) - return sort - - def mkDatatypeSort(self, DatatypeDecl dtypedecl): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkDatatypeSort(dtypedecl.cdd) - return sort - - def mkDatatypeSorts(self, list dtypedecls, unresolvedSorts): - sorts = [] - - cdef vector[c_DatatypeDecl] decls - for decl in dtypedecls: - decls.push_back(( decl).cdd) - - cdef set[c_Sort] usorts - for usort in unresolvedSorts: - usorts.insert(( usort).csort) - - csorts = self.csolver.mkDatatypeSorts( - decls, usorts) - for csort in csorts: - sort = Sort(self) - sort.csort = csort - sorts.append(sort) - - return sorts - - def mkFunctionSort(self, sorts, Sort codomain): - - cdef Sort sort = Sort(self) - # populate a vector with dereferenced c_Sorts - cdef vector[c_Sort] v - - if isinstance(sorts, Sort): - sort.csort = self.csolver.mkFunctionSort(( sorts).csort, - codomain.csort) - elif isinstance(sorts, list): - for s in sorts: - v.push_back((s).csort) - - sort.csort = self.csolver.mkFunctionSort( v, - codomain.csort) - return sort - - def mkParamSort(self, symbolname): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkParamSort(symbolname.encode()) - return sort - - @expand_list_arg(num_req_args=0) - def mkPredicateSort(self, *sorts): - ''' - Supports the following arguments: - Sort mkPredicateSort(List[Sort] sorts) - - where sorts can also be comma-separated arguments of - type Sort - ''' - cdef Sort sort = Sort(self) - cdef vector[c_Sort] v - for s in sorts: - v.push_back(( s).csort) - sort.csort = self.csolver.mkPredicateSort( v) - return sort - - @expand_list_arg(num_req_args=0) - def mkRecordSort(self, *fields): - ''' - Supports the following arguments: - Sort mkRecordSort(List[Tuple[str, Sort]] fields) - - where fields can also be comma-separated arguments of - type Tuple[str, Sort] - ''' - cdef Sort sort = Sort(self) - cdef vector[pair[string, c_Sort]] v - cdef pair[string, c_Sort] p - for f in fields: - name, sortarg = f - name = name.encode() - p = pair[string, c_Sort]( name, ( sortarg).csort) - v.push_back(p) - sort.csort = self.csolver.mkRecordSort( - v) - return sort - - def mkSetSort(self, Sort elemSort): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkSetSort(elemSort.csort) - return sort - - def mkBagSort(self, Sort elemSort): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkBagSort(elemSort.csort) - return sort - - def mkSequenceSort(self, Sort elemSort): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkSequenceSort(elemSort.csort) - return sort - - def mkUninterpretedSort(self, str name): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.mkUninterpretedSort(name.encode()) - return sort - - def mkSortConstructorSort(self, str symbol, size_t arity): - cdef Sort sort = Sort(self) - sort.csort =self.csolver.mkSortConstructorSort(symbol.encode(), arity) - return sort - - @expand_list_arg(num_req_args=0) - def mkTupleSort(self, *sorts): - ''' - Supports the following arguments: - Sort mkTupleSort(List[Sort] sorts) - - where sorts can also be comma-separated arguments of - type Sort - ''' - cdef Sort sort = Sort(self) - cdef vector[c_Sort] v - for s in sorts: - v.push_back(( s).csort) - sort.csort = self.csolver.mkTupleSort(v) - return sort - - @expand_list_arg(num_req_args=1) - def mkTerm(self, kind_or_op, *args): - ''' - Supports the following arguments: - Term mkTerm(Kind kind) - Term mkTerm(Kind kind, Op child1, List[Term] children) - Term mkTerm(Kind kind, List[Term] children) - - where List[Term] can also be comma-separated arguments - ''' - cdef Term term = Term(self) - cdef vector[c_Term] v - - op = kind_or_op - if isinstance(kind_or_op, kind): - op = self.mkOp(kind_or_op) - - if len(args) == 0: - term.cterm = self.csolver.mkTerm(( op).cop) - else: - for a in args: - v.push_back(( a).cterm) - term.cterm = self.csolver.mkTerm(( op).cop, v) - return term - - def mkOp(self, kind k, arg0=None, arg1 = None): - ''' - Supports the following uses: - Op mkOp(Kind kind) - Op mkOp(Kind kind, Kind k) - Op mkOp(Kind kind, const string& arg) - Op mkOp(Kind kind, uint32_t arg) - Op mkOp(Kind kind, uint32_t arg0, uint32_t arg1) - ''' - cdef Op op = Op(self) - - if arg0 is None: - op.cop = self.csolver.mkOp(k.k) - elif arg1 is None: - if isinstance(arg0, kind): - op.cop = self.csolver.mkOp(k.k, ( arg0).k) - elif isinstance(arg0, str): - op.cop = self.csolver.mkOp(k.k, - - arg0.encode()) - elif isinstance(arg0, int): - op.cop = self.csolver.mkOp(k.k, arg0) - else: - raise ValueError("Unsupported signature" - " mkOp: {}".format(" X ".join([k, arg0]))) - else: - if isinstance(arg0, int) and isinstance(arg1, int): - op.cop = self.csolver.mkOp(k.k, arg0, - arg1) - else: - raise ValueError("Unsupported signature" - " mkOp: {}".format(" X ".join([k, arg0, arg1]))) - return op - - def mkTrue(self): - cdef Term term = Term(self) - term.cterm = self.csolver.mkTrue() - return term - - def mkFalse(self): - cdef Term term = Term(self) - term.cterm = self.csolver.mkFalse() - return term - - def mkBoolean(self, bint val): - cdef Term term = Term(self) - term.cterm = self.csolver.mkBoolean(val) - return term - - def mkPi(self): - cdef Term term = Term(self) - term.cterm = self.csolver.mkPi() - return term - - def mkInteger(self, val): - cdef Term term = Term(self) - integer = int(val) - term.cterm = self.csolver.mkInteger("{}".format(integer).encode()) - return term - - def mkReal(self, val, den=None): - cdef Term term = Term(self) - if den is None: - term.cterm = self.csolver.mkReal(str(val).encode()) - else: - if not isinstance(val, int) or not isinstance(den, int): - raise ValueError("Expecting integers when" - " constructing a rational" - " but got: {}".format((val, den))) - term.cterm = self.csolver.mkReal("{}/{}".format(val, den).encode()) - return term - - def mkRegexpEmpty(self): - cdef Term term = Term(self) - term.cterm = self.csolver.mkRegexpEmpty() - return term - - def mkRegexpSigma(self): - cdef Term term = Term(self) - term.cterm = self.csolver.mkRegexpSigma() - return term - - def mkEmptySet(self, Sort s): - cdef Term term = Term(self) - term.cterm = self.csolver.mkEmptySet(s.csort) - return term - - - def mkSepNil(self, Sort sort): - cdef Term term = Term(self) - term.cterm = self.csolver.mkSepNil(sort.csort) - return term - - def mkString(self, str_or_vec): - cdef Term term = Term(self) - cdef vector[unsigned] v - if isinstance(str_or_vec, str): - for u in str_or_vec: - v.push_back( ord(u)) - term.cterm = self.csolver.mkString( v) - elif isinstance(str_or_vec, list): - for u in str_or_vec: - if not isinstance(u, int): - raise ValueError("List should contain ints but got: {}" - .format(str_or_vec)) - v.push_back( u) - term.cterm = self.csolver.mkString( v) - else: - raise ValueError("Expected string or vector of ASCII codes" - " but got: {}".format(str_or_vec)) - return term - - def mkEmptySequence(self, Sort sort): - cdef Term term = Term(self) - term.cterm = self.csolver.mkEmptySequence(sort.csort) - return term - - def mkUniverseSet(self, Sort sort): - cdef Term term = Term(self) - term.cterm = self.csolver.mkUniverseSet(sort.csort) - return term - - def mkBitVector(self, size_or_str, val = None): - cdef Term term = Term(self) - if isinstance(size_or_str, int): - if val is None: - term.cterm = self.csolver.mkBitVector( size_or_str) - else: - term.cterm = self.csolver.mkBitVector( size_or_str, - str(val).encode(), - 10) - elif isinstance(size_or_str, str): - # handle default value - if val is None: - term.cterm = self.csolver.mkBitVector( - size_or_str.encode()) - else: - term.cterm = self.csolver.mkBitVector( - size_or_str.encode(), val) - else: - raise ValueError("Unexpected inputs {} to" - " mkBitVector".format((size_or_str, val))) - return term - - def mkConstArray(self, Sort sort, Term val): - cdef Term term = Term(self) - term.cterm = self.csolver.mkConstArray(sort.csort, val.cterm) - return term - - def mkPosInf(self, int exp, int sig): - cdef Term term = Term(self) - term.cterm = self.csolver.mkPosInf(exp, sig) - return term - - def mkNegInf(self, int exp, int sig): - cdef Term term = Term(self) - term.cterm = self.csolver.mkNegInf(exp, sig) - return term - - def mkNaN(self, int exp, int sig): - cdef Term term = Term(self) - term.cterm = self.csolver.mkNaN(exp, sig) - return term - - def mkPosZero(self, int exp, int sig): - cdef Term term = Term(self) - term.cterm = self.csolver.mkPosZero(exp, sig) - return term - - def mkNegZero(self, int exp, int sig): - cdef Term term = Term(self) - term.cterm = self.csolver.mkNegZero(exp, sig) - return term - - def mkRoundingMode(self, RoundingMode rm): - cdef Term term = Term(self) - term.cterm = self.csolver.mkRoundingMode( rm.crm) - return term - - def mkUninterpretedConst(self, Sort sort, int index): - cdef Term term = Term(self) - term.cterm = self.csolver.mkUninterpretedConst(sort.csort, index) - return term - - def mkAbstractValue(self, index): - cdef Term term = Term(self) - try: - term.cterm = self.csolver.mkAbstractValue(str(index).encode()) - except: - raise ValueError("mkAbstractValue expects a str representing a number" - " or an int, but got{}".format(index)) - return term - - def mkFloatingPoint(self, int exp, int sig, Term val): - cdef Term term = Term(self) - term.cterm = self.csolver.mkFloatingPoint(exp, sig, val.cterm) - return term - - def mkConst(self, Sort sort, symbol=None): - cdef Term term = Term(self) - if symbol is None: - term.cterm = self.csolver.mkConst(sort.csort) - else: - term.cterm = self.csolver.mkConst(sort.csort, - ( symbol).encode()) - return term - - def mkVar(self, Sort sort, symbol=None): - cdef Term term = Term(self) - if symbol is None: - term.cterm = self.csolver.mkVar(sort.csort) - else: - term.cterm = self.csolver.mkVar(sort.csort, - ( symbol).encode()) - return term - - def mkDatatypeConstructorDecl(self, str name): - cdef DatatypeConstructorDecl ddc = DatatypeConstructorDecl(self) - ddc.cddc = self.csolver.mkDatatypeConstructorDecl(name.encode()) - return ddc - - def mkDatatypeDecl(self, str name, sorts_or_bool=None, isCoDatatype=None): - cdef DatatypeDecl dd = DatatypeDecl(self) - cdef vector[c_Sort] v - - # argument cases - if sorts_or_bool is None and isCoDatatype is None: - dd.cdd = self.csolver.mkDatatypeDecl(name.encode()) - elif sorts_or_bool is not None and isCoDatatype is None: - if isinstance(sorts_or_bool, bool): - dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), - sorts_or_bool) - elif isinstance(sorts_or_bool, Sort): - dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), - ( sorts_or_bool).csort) - elif isinstance(sorts_or_bool, list): - for s in sorts_or_bool: - v.push_back(( s).csort) - dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), - v) - else: - raise ValueError("Unhandled second argument type {}" - .format(type(sorts_or_bool))) - elif sorts_or_bool is not None and isCoDatatype is not None: - if isinstance(sorts_or_bool, Sort): - dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), - ( sorts_or_bool).csort, - isCoDatatype) - elif isinstance(sorts_or_bool, list): - for s in sorts_or_bool: - v.push_back(( s).csort) - dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), - v, - isCoDatatype) - else: - raise ValueError("Unhandled second argument type {}" - .format(type(sorts_or_bool))) - else: - raise ValueError("Can't create DatatypeDecl with {}".format([type(a) - for a in [name, - sorts_or_bool, - isCoDatatype]])) - - return dd - - def simplify(self, Term t): - cdef Term term = Term(self) - term.cterm = self.csolver.simplify(t.cterm) - return term - - def assertFormula(self, Term term): - self.csolver.assertFormula(term.cterm) - - def checkSat(self): - cdef Result r = Result() - r.cr = self.csolver.checkSat() - return r - - def mkSygusGrammar(self, boundVars, ntSymbols): - cdef Grammar grammar = Grammar(self) - cdef vector[c_Term] bvc - cdef vector[c_Term] ntc - for bv in boundVars: - bvc.push_back(( bv).cterm) - for nt in ntSymbols: - ntc.push_back(( nt).cterm) - grammar.cgrammar = self.csolver.mkSygusGrammar( bvc, ntc) - return grammar - - def mkSygusVar(self, Sort sort, str symbol=""): - cdef Term term = Term(self) - term.cterm = self.csolver.mkSygusVar(sort.csort, symbol.encode()) - return term - - def addSygusConstraint(self, Term t): - self.csolver.addSygusConstraint(t.cterm) - - def addSygusInvConstraint(self, Term inv_f, Term pre_f, Term trans_f, Term post_f): - self.csolver.addSygusInvConstraint(inv_f.cterm, pre_f.cterm, trans_f.cterm, post_f.cterm) - - def synthFun(self, str symbol, bound_vars, Sort sort, Grammar grammar=None): - cdef Term term = Term(self) - cdef vector[c_Term] v - for bv in bound_vars: - v.push_back(( bv).cterm) - if grammar is None: - term.cterm = self.csolver.synthFun(symbol.encode(), v, sort.csort) - else: - term.cterm = self.csolver.synthFun(symbol.encode(), v, sort.csort, grammar.cgrammar) - return term - - def checkSynth(self): - cdef Result r = Result() - r.cr = self.csolver.checkSynth() - return r - - def getSynthSolution(self, Term term): - cdef Term t = Term(self) - t.cterm = self.csolver.getSynthSolution(term.cterm) - return t - - def synthInv(self, symbol, bound_vars, Grammar grammar=None): - cdef Term term = Term(self) - cdef vector[c_Term] v - for bv in bound_vars: - v.push_back(( bv).cterm) - if grammar is None: - term.cterm = self.csolver.synthInv(symbol.encode(), v) - else: - term.cterm = self.csolver.synthInv(symbol.encode(), v, grammar.cgrammar) - return term - - def printSynthSolution(self): - self.csolver.printSynthSolution(cout) - - @expand_list_arg(num_req_args=0) - def checkSatAssuming(self, *assumptions): - ''' - Supports the following arguments: - Result checkSatAssuming(List[Term] assumptions) - - where assumptions can also be comma-separated arguments of - type (boolean) Term - ''' - cdef Result r = Result() - # used if assumptions is a list of terms - cdef vector[c_Term] v - for a in assumptions: - v.push_back(( a).cterm) - r.cr = self.csolver.checkSatAssuming( v) - return r - - @expand_list_arg(num_req_args=0) - def checkEntailed(self, *assumptions): - ''' - Supports the following arguments: - Result checkEntailed(List[Term] assumptions) - - where assumptions can also be comma-separated arguments of - type (boolean) Term - ''' - cdef Result r = Result() - # used if assumptions is a list of terms - cdef vector[c_Term] v - for a in assumptions: - v.push_back(( a).cterm) - r.cr = self.csolver.checkEntailed( v) - return r - - @expand_list_arg(num_req_args=1) - def declareDatatype(self, str symbol, *ctors): - ''' - Supports the following arguments: - Sort declareDatatype(str symbol, List[Term] ctors) - - where ctors can also be comma-separated arguments of - type DatatypeConstructorDecl - ''' - cdef Sort sort = Sort(self) - cdef vector[c_DatatypeConstructorDecl] v - - for c in ctors: - v.push_back(( c).cddc) - sort.csort = self.csolver.declareDatatype(symbol.encode(), v) - return sort - - def declareFun(self, str symbol, list sorts, Sort sort): - cdef Term term = Term(self) - cdef vector[c_Sort] v - for s in sorts: - v.push_back(( s).csort) - term.cterm = self.csolver.declareFun(symbol.encode(), - v, - sort.csort) - return term - - def declareSort(self, str symbol, int arity): - cdef Sort sort = Sort(self) - sort.csort = self.csolver.declareSort(symbol.encode(), arity) - return sort - - def defineFun(self, sym_or_fun, bound_vars, sort_or_term, t=None, glbl=False): - ''' - Supports two uses: - Term defineFun(str symbol, List[Term] bound_vars, - Sort sort, Term term, bool glbl) - Term defineFun(Term fun, List[Term] bound_vars, - Term term, bool glbl) - ''' - cdef Term term = Term(self) - cdef vector[c_Term] v - for bv in bound_vars: - v.push_back(( bv).cterm) - - if t is not None: - term.cterm = self.csolver.defineFun(( sym_or_fun).encode(), - v, - ( sort_or_term).csort, - ( t).cterm, - glbl) - else: - term.cterm = self.csolver.defineFun(( sym_or_fun).cterm, - v, - ( sort_or_term).cterm, - glbl) - - return term - - def defineFunRec(self, sym_or_fun, bound_vars, sort_or_term, t=None, glbl=False): - ''' - Supports two uses: - Term defineFunRec(str symbol, List[Term] bound_vars, - Sort sort, Term term, bool glbl) - Term defineFunRec(Term fun, List[Term] bound_vars, - Term term, bool glbl) - ''' - cdef Term term = Term(self) - cdef vector[c_Term] v - for bv in bound_vars: - v.push_back(( bv).cterm) - - if t is not None: - term.cterm = self.csolver.defineFunRec(( sym_or_fun).encode(), - v, - ( sort_or_term).csort, - ( t).cterm, - glbl) - else: - term.cterm = self.csolver.defineFunRec(( sym_or_fun).cterm, - v, - ( sort_or_term).cterm, - glbl) - - return term - - def defineFunsRec(self, funs, bound_vars, terms): - cdef vector[c_Term] vf - cdef vector[vector[c_Term]] vbv - cdef vector[c_Term] vt - - for f in funs: - vf.push_back(( f).cterm) - - cdef vector[c_Term] temp - for v in bound_vars: - for t in v: - temp.push_back(( t).cterm) - vbv.push_back(temp) - temp.clear() - - for t in terms: - vf.push_back(( t).cterm) - - def getAssertions(self): - assertions = [] - for a in self.csolver.getAssertions(): - term = Term(self) - term.cterm = a - assertions.append(term) - return assertions - - def getInfo(self, str flag): - return self.csolver.getInfo(flag.encode()) - - def getOption(self, str option): - return self.csolver.getOption(option.encode()) - - def getUnsatAssumptions(self): - assumptions = [] - for a in self.csolver.getUnsatAssumptions(): - term = Term(self) - term.cterm = a - assumptions.append(term) - return assumptions - - def getUnsatCore(self): - core = [] - for a in self.csolver.getUnsatCore(): - term = Term(self) - term.cterm = a - core.append(term) - return core - - def getValue(self, Term t): - cdef Term term = Term(self) - term.cterm = self.csolver.getValue(t.cterm) - return term - - def getSeparationHeap(self): - cdef Term term = Term(self) - term.cterm = self.csolver.getSeparationHeap() - return term - - def declareSeparationHeap(self, Sort locType, Sort dataType): - self.csolver.declareSeparationHeap(locType.csort, dataType.csort) - - def getSeparationNilTerm(self): - cdef Term term = Term(self) - term.cterm = self.csolver.getSeparationNilTerm() - return term - - def declarePool(self, str symbol, Sort sort, initValue): - cdef Term term = Term(self) - cdef vector[c_Term] niv - for v in initValue: - niv.push_back(( v).cterm) - term.cterm = self.csolver.declarePool(symbol.encode(), sort.csort, niv) - return term - - def pop(self, nscopes=1): - self.csolver.pop(nscopes) - - def push(self, nscopes=1): - self.csolver.push(nscopes) - - def resetAssertions(self): - self.csolver.resetAssertions() - - def setInfo(self, str keyword, str value): - self.csolver.setInfo(keyword.encode(), value.encode()) - - def setLogic(self, str logic): - self.csolver.setLogic(logic.encode()) - - def setOption(self, str option, str value): - self.csolver.setOption(option.encode(), value.encode()) - - -cdef class Sort: - cdef c_Sort csort - cdef Solver solver - def __cinit__(self, Solver solver): - # csort always set by Solver - self.solver = solver - - def __eq__(self, Sort other): - return self.csort == other.csort - - def __ne__(self, Sort other): - return self.csort != other.csort - - def __lt__(self, Sort other): - return self.csort < other.csort - - def __gt__(self, Sort other): - return self.csort > other.csort - - def __le__(self, Sort other): - return self.csort <= other.csort - - def __ge__(self, Sort other): - return self.csort >= other.csort - - def __str__(self): - return self.csort.toString().decode() - - def __repr__(self): - return self.csort.toString().decode() - - def __hash__(self): - return csorthash(self.csort) - - def isBoolean(self): - return self.csort.isBoolean() - - def isInteger(self): - return self.csort.isInteger() - - def isReal(self): - return self.csort.isReal() - - def isString(self): - return self.csort.isString() - - def isRegExp(self): - return self.csort.isRegExp() - - def isRoundingMode(self): - return self.csort.isRoundingMode() - - def isBitVector(self): - return self.csort.isBitVector() - - def isFloatingPoint(self): - return self.csort.isFloatingPoint() - - def isDatatype(self): - return self.csort.isDatatype() - - def isParametricDatatype(self): - return self.csort.isParametricDatatype() - - def isConstructor(self): - return self.csort.isConstructor() - - def isSelector(self): - return self.csort.isSelector() - - def isTester(self): - return self.csort.isTester() - - def isFunction(self): - return self.csort.isFunction() - - def isPredicate(self): - return self.csort.isPredicate() - - def isTuple(self): - return self.csort.isTuple() - - def isRecord(self): - return self.csort.isRecord() - - def isArray(self): - return self.csort.isArray() - - def isSet(self): - return self.csort.isSet() - - def isBag(self): - return self.csort.isBag() - - def isSequence(self): - return self.csort.isSequence() - - def isUninterpretedSort(self): - return self.csort.isUninterpretedSort() - - def isSortConstructor(self): - return self.csort.isSortConstructor() - - def isFirstClass(self): - return self.csort.isFirstClass() - - def isFunctionLike(self): - return self.csort.isFunctionLike() - - def isSubsortOf(self, Sort sort): - return self.csort.isSubsortOf(sort.csort) - - def isComparableTo(self, Sort sort): - return self.csort.isComparableTo(sort.csort) - - def getDatatype(self): - cdef Datatype d = Datatype(self.solver) - d.cd = self.csort.getDatatype() - return d - - def instantiate(self, params): - cdef Sort sort = Sort(self.solver) - cdef vector[c_Sort] v - for s in params: - v.push_back(( s).csort) - sort.csort = self.csort.instantiate(v) - return sort - - def getConstructorArity(self): - return self.csort.getConstructorArity() - - def getConstructorDomainSorts(self): - domain_sorts = [] - for s in self.csort.getConstructorDomainSorts(): - sort = Sort(self.solver) - sort.csort = s - domain_sorts.append(sort) - return domain_sorts - - def getConstructorCodomainSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getConstructorCodomainSort() - return sort - - def getSelectorDomainSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getSelectorDomainSort() - return sort - - def getSelectorCodomainSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getSelectorCodomainSort() - return sort - - def getTesterDomainSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getTesterDomainSort() - return sort - - def getTesterCodomainSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getTesterCodomainSort() - return sort - - def getFunctionArity(self): - return self.csort.getFunctionArity() - - def getFunctionDomainSorts(self): - domain_sorts = [] - for s in self.csort.getFunctionDomainSorts(): - sort = Sort(self.solver) - sort.csort = s - domain_sorts.append(sort) - return domain_sorts - - def getFunctionCodomainSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getFunctionCodomainSort() - return sort - - def getArrayIndexSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getArrayIndexSort() - return sort - - def getArrayElementSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getArrayElementSort() - return sort - - def getSetElementSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getSetElementSort() - return sort - - def getBagElementSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getBagElementSort() - return sort - - def getSequenceElementSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.csort.getSequenceElementSort() - return sort - - def getUninterpretedSortName(self): - return self.csort.getUninterpretedSortName().decode() - - def isUninterpretedSortParameterized(self): - return self.csort.isUninterpretedSortParameterized() - - def getUninterpretedSortParamSorts(self): - param_sorts = [] - for s in self.csort.getUninterpretedSortParamSorts(): - sort = Sort(self.solver) - sort.csort = s - param_sorts.append(sort) - return param_sorts - - def getSortConstructorName(self): - return self.csort.getSortConstructorName().decode() - - def getSortConstructorArity(self): - return self.csort.getSortConstructorArity() - - def getBVSize(self): - return self.csort.getBVSize() - - def getFPExponentSize(self): - return self.csort.getFPExponentSize() - - def getFPSignificandSize(self): - return self.csort.getFPSignificandSize() - - def getDatatypeParamSorts(self): - param_sorts = [] - for s in self.csort.getDatatypeParamSorts(): - sort = Sort(self.solver) - sort.csort = s - param_sorts.append(sort) - return param_sorts - - def getDatatypeArity(self): - return self.csort.getDatatypeArity() - - def getTupleLength(self): - return self.csort.getTupleLength() - - def getTupleSorts(self): - tuple_sorts = [] - for s in self.csort.getTupleSorts(): - sort = Sort(self.solver) - sort.csort = s - tuple_sorts.append(sort) - return tuple_sorts - - -cdef class Term: - cdef c_Term cterm - cdef Solver solver - def __cinit__(self, Solver solver): - # cterm always set in the Solver object - self.solver = solver - - def __eq__(self, Term other): - return self.cterm == other.cterm - - def __ne__(self, Term other): - return self.cterm != other.cterm - - def __getitem__(self, int index): - cdef Term term = Term(self.solver) - if index >= 0: - term.cterm = self.cterm[index] - else: - raise ValueError("Expecting a non-negative integer or string") - return term - - def __str__(self): - return self.cterm.toString().decode() - - def __repr__(self): - return self.cterm.toString().decode() - - def __iter__(self): - for ci in self.cterm: - term = Term(self.solver) - term.cterm = ci - yield term - - def __hash__(self): - return ctermhash(self.cterm) - - def getKind(self): - return kind( self.cterm.getKind()) - - def getSort(self): - cdef Sort sort = Sort(self.solver) - sort.csort = self.cterm.getSort() - return sort - - def substitute(self, list es, list replacements): - cdef vector[c_Term] ces - cdef vector[c_Term] creplacements - cdef Term term = Term(self.solver) - - if len(es) != len(replacements): - raise RuntimeError("Expecting list inputs to substitute to " - "have the same length but got: " - "{} and {}".format(len(es), len(replacements))) - - for e, r in zip(es, replacements): - ces.push_back(( e).cterm) - creplacements.push_back(( r).cterm) - - term.cterm = self.cterm.substitute(ces, creplacements) - return term - - def hasOp(self): - return self.cterm.hasOp() - - def getOp(self): - cdef Op op = Op(self.solver) - op.cop = self.cterm.getOp() - return op - - def isNull(self): - return self.cterm.isNull() - - def getConstArrayBase(self): - cdef Term term = Term(self.solver) - term.cterm = self.cterm.getConstArrayBase() - return term - - def getConstSequenceElements(self): - elems = [] - for e in self.cterm.getConstSequenceElements(): - term = Term(self.solver) - term.cterm = e - elems.append(term) - return elems - - def notTerm(self): - cdef Term term = Term(self.solver) - term.cterm = self.cterm.notTerm() - return term - - def andTerm(self, Term t): - cdef Term term = Term(self.solver) - term.cterm = self.cterm.andTerm(( t).cterm) - return term - - def orTerm(self, Term t): - cdef Term term = Term(self.solver) - term.cterm = self.cterm.orTerm(t.cterm) - return term - - def xorTerm(self, Term t): - cdef Term term = Term(self.solver) - term.cterm = self.cterm.xorTerm(t.cterm) - return term - - def eqTerm(self, Term t): - cdef Term term = Term(self.solver) - term.cterm = self.cterm.eqTerm(t.cterm) - return term - - def impTerm(self, Term t): - cdef Term term = Term(self.solver) - term.cterm = self.cterm.impTerm(t.cterm) - return term - - def iteTerm(self, Term then_t, Term else_t): - cdef Term term = Term(self.solver) - term.cterm = self.cterm.iteTerm(then_t.cterm, else_t.cterm) - return term - - def toPythonObj(self): - ''' - Converts a constant value Term to a Python object. - - Currently supports: - Boolean -- returns a Python bool - Int -- returns a Python int - Real -- returns a Python Fraction - BV -- returns a Python int (treats BV as unsigned) - Array -- returns a Python dict mapping indices to values - -- the constant base is returned as the default value - String -- returns a Python Unicode string - ''' - - string_repr = self.cterm.toString().decode() - assert string_repr - sort = self.getSort() - res = None - if sort.isBoolean(): - if string_repr == "true": - res = True - else: - assert string_repr == "false" - res = False - elif sort.isInteger(): - updated_string_repr = string_repr.strip('()').replace(' ', '') - try: - res = int(updated_string_repr) - except: - raise ValueError("Failed to convert" - " {} to an int".format(string_repr)) - elif sort.isReal(): - updated_string_repr = string_repr - try: - # expecting format (/ a b) - # note: a or b could be negated: (- a) - splits = [s.strip('()/') - for s in updated_string_repr.strip('()/') \ - .replace('(- ', '(-').split()] - assert len(splits) == 2 - num = int(splits[0]) - den = int(splits[1]) - res = Fraction(num, den) - except: - raise ValueError("Failed to convert " - "{} to a Fraction".format(string_repr)) - - elif sort.isBitVector(): - # expecting format #b - assert string_repr[:2] == "#b" - python_bin_repr = "0" + string_repr[1:] - try: - res = int(python_bin_repr, 2) - except: - raise ValueError("Failed to convert bitvector " - "{} to an int".format(string_repr)) - elif sort.isArray(): - keys = [] - values = [] - base_value = None - to_visit = [self] - # Array models are represented as a series of store operations - # on a constant array - while to_visit: - t = to_visit.pop() - if t.getKind() == kinds.Store: - # save the mappings - keys.append(t[1].toPythonObj()) - values.append(t[2].toPythonObj()) - to_visit.append(t[0]) - else: - assert t.getKind() == kinds.ConstArray - base_value = t.getConstArrayBase().toPythonObj() - - assert len(keys) == len(values) - assert base_value is not None - - # put everything in a dictionary with the constant - # base as the result for any index not included in the stores - res = defaultdict(lambda : base_value) - for k, v in zip(keys, values): - res[k] = v - elif sort.isString(): - # Strip leading and trailing double quotes and replace double - # double quotes by single quotes - string_repr = string_repr[1:-1].replace('""', '"') - - # Convert escape sequences - res = '' - escape_prefix = '\\u{' - i = 0 - while True: - prev_i = i - i = string_repr.find(escape_prefix, i) - if i == -1: - res += string_repr[prev_i:] - break - - res += string_repr[prev_i:i] - val = string_repr[i + len(escape_prefix):string_repr.find('}', i)] - res += chr(int(val, 16)) - i += len(escape_prefix) + len(val) + 1 - else: - raise ValueError("Cannot convert term {}" - " of sort {} to Python object".format(string_repr, - sort)) - - assert res is not None - return res - - -# Generate rounding modes -cdef __rounding_modes = { - ROUND_NEAREST_TIES_TO_EVEN: "RoundNearestTiesToEven", - ROUND_TOWARD_POSITIVE: "RoundTowardPositive", - ROUND_TOWARD_NEGATIVE: "RoundTowardNegative", - ROUND_TOWARD_ZERO: "RoundTowardZero", - ROUND_NEAREST_TIES_TO_AWAY: "RoundNearestTiesToAway" -} - -mod_ref = sys.modules[__name__] -for rm_int, name in __rounding_modes.items(): - r = RoundingMode(rm_int) - - if name in dir(mod_ref): - raise RuntimeError("Redefinition of Python RoundingMode %s."%name) - - setattr(mod_ref, name, r) - -del r -del rm_int -del name diff --git a/src/api/python/cvc5.pxd b/src/api/python/cvc5.pxd new file mode 100644 index 000000000..83d811a1d --- /dev/null +++ b/src/api/python/cvc5.pxd @@ -0,0 +1,370 @@ +# import dereference and increment operators +from cython.operator cimport dereference as deref, preincrement as inc +from libc.stdint cimport int32_t, int64_t, uint32_t, uint64_t +from libcpp.set cimport set +from libcpp.string cimport string +from libcpp.vector cimport vector +from libcpp.pair cimport pair +from cvc5kinds cimport Kind + + +cdef extern from "" namespace "std": + cdef cppclass ostream: + pass + ostream cout + + +cdef extern from "api/cpp/cvc5.h" namespace "cvc5": + cdef cppclass Options: + pass + + +cdef extern from "api/cpp/cvc5.h" namespace "cvc5::api": + cdef cppclass Datatype: + Datatype() except + + DatatypeConstructor operator[](size_t idx) except + + DatatypeConstructor operator[](const string& name) except + + DatatypeConstructor getConstructor(const string& name) except + + Term getConstructorTerm(const string& name) except + + size_t getNumConstructors() except + + bint isParametric() except + + bint isCodatatype() except + + bint isTuple() except + + bint isRecord() except + + bint isFinite() except + + bint isWellFounded() except + + bint hasNestedRecursion() except + + string toString() except + + cppclass const_iterator: + const_iterator() except + + bint operator==(const const_iterator& it) except + + bint operator!=(const const_iterator& it) except + + const_iterator& operator++(); + const DatatypeConstructor& operator*() except + + const_iterator begin() except + + const_iterator end() except + + + + cdef cppclass DatatypeConstructor: + DatatypeConstructor() except + + DatatypeSelector operator[](size_t idx) except + + DatatypeSelector operator[](const string& name) except + + string getName() except + + Term getConstructorTerm() except + + Term getTesterTerm() except + + size_t getNumSelectors() except + + DatatypeSelector getSelector(const string& name) except + + Term getSelectorTerm(const string& name) except + + string toString() except + + cppclass const_iterator: + const_iterator() except + + bint operator==(const const_iterator& it) except + + bint operator!=(const const_iterator& it) except + + const_iterator& operator++(); + const DatatypeSelector& operator*() except + + const_iterator begin() except + + const_iterator end() except + + + + cdef cppclass DatatypeConstructorDecl: + void addSelector(const string& name, Sort sort) except + + void addSelectorSelf(const string& name) except + + string toString() except + + + + cdef cppclass DatatypeDecl: + void addConstructor(const DatatypeConstructorDecl& ctor) except + + size_t getNumConstructors() except + + bint isParametric() except + + string toString() except + + + + cdef cppclass DatatypeSelector: + DatatypeSelector() except + + string getName() except + + Term getSelectorTerm() except + + Sort getRangeSort() except + + string toString() except + + + + cdef cppclass Op: + Op() except + + bint operator==(const Op&) except + + bint operator!=(const Op&) except + + Kind getKind() except + + Sort getSort() except + + bint isNull() except + + T getIndices[T]() except + + string toString() except + + + cdef cppclass OpHashFunction: + OpHashFunction() except + + size_t operator()(const Op & o) except + + + + cdef cppclass Result: + Result() except+ + bint isNull() except + + bint isSat() except + + bint isUnsat() except + + bint isSatUnknown() except + + bint isEntailed() except + + bint isNotEntailed() except + + bint isEntailmentUnknown() except + + bint operator==(const Result& r) except + + bint operator!=(const Result& r) except + + string getUnknownExplanation() except + + string toString() except + + + + cdef cppclass RoundingMode: + pass + + + cdef cppclass Solver: + Solver(Options*) except + + bint supportsFloatingPoint() except + + Sort getBooleanSort() except + + Sort getIntegerSort() except + + Sort getRealSort() except + + Sort getRegExpSort() except + + Sort getRoundingModeSort() except + + Sort getStringSort() except + + Sort mkArraySort(Sort indexSort, Sort elemSort) except + + Sort mkBitVectorSort(uint32_t size) except + + Sort mkFloatingPointSort(uint32_t exp, uint32_t sig) except + + Sort mkDatatypeSort(DatatypeDecl dtypedecl) except + + vector[Sort] mkDatatypeSorts(const vector[DatatypeDecl]& dtypedecls, + const set[Sort]& unresolvedSorts) except + + Sort mkFunctionSort(Sort domain, Sort codomain) except + + Sort mkFunctionSort(const vector[Sort]& sorts, Sort codomain) except + + Sort mkParamSort(const string& symbol) except + + Sort mkPredicateSort(const vector[Sort]& sorts) except + + Sort mkRecordSort(const vector[pair[string, Sort]]& fields) except + + Sort mkSetSort(Sort elemSort) except + + Sort mkBagSort(Sort elemSort) except + + Sort mkSequenceSort(Sort elemSort) except + + Sort mkUninterpretedSort(const string& symbol) except + + Sort mkSortConstructorSort(const string& symbol, size_t arity) except + + Sort mkTupleSort(const vector[Sort]& sorts) except + + Term mkTerm(Op op) except + + Term mkTerm(Op op, const vector[Term]& children) except + + Op mkOp(Kind kind) except + + Op mkOp(Kind kind, Kind k) except + + Op mkOp(Kind kind, const string& arg) except + + Op mkOp(Kind kind, uint32_t arg) except + + Op mkOp(Kind kind, uint32_t arg1, uint32_t arg2) except + + # Sygus related functions + Grammar mkSygusGrammar(const vector[Term]& boundVars, const vector[Term]& ntSymbols) except + + Term mkSygusVar(Sort sort, const string& symbol) except + + Term mkSygusVar(Sort sort) except + + void addSygusConstraint(Term term) except + + void addSygusInvConstraint(Term inv_f, Term pre_f, Term trans_f, Term post_f) except + + Term synthFun(const string& symbol, const vector[Term]& bound_vars, Sort sort) except + + Term synthFun(const string& symbol, const vector[Term]& bound_vars, Sort sort, Grammar grammar) except + + Result checkSynth() except + + Term getSynthSolution(Term t) except + + vector[Term] getSynthSolutions(const vector[Term]& terms) except + + Term synthInv(const string& symbol, const vector[Term]& bound_vars) except + + Term synthInv(const string& symbol, const vector[Term]& bound_vars, Grammar grammar) except + + void printSynthSolution(ostream& out) except + + # End of sygus related functions + + Term mkTrue() except + + Term mkFalse() except + + Term mkBoolean(bint val) except + + Term mkPi() except + + Term mkInteger(const string& s) except + + Term mkReal(const string& s) except + + Term mkRegexpEmpty() except + + Term mkRegexpSigma() except + + Term mkEmptySet(Sort s) except + + Term mkSepNil(Sort sort) except + + Term mkString(const string& s) except + + Term mkString(const vector[unsigned]& s) except + + Term mkEmptySequence(Sort sort) except + + Term mkUniverseSet(Sort sort) except + + Term mkBitVector(uint32_t size) except + + Term mkBitVector(uint32_t size, uint64_t val) except + + Term mkBitVector(const string& s) except + + Term mkBitVector(const string& s, uint32_t base) except + + Term mkBitVector(uint32_t size, string& s, uint32_t base) except + + Term mkConstArray(Sort sort, Term val) except + + Term mkPosInf(uint32_t exp, uint32_t sig) except + + Term mkNegInf(uint32_t exp, uint32_t sig) except + + Term mkNaN(uint32_t exp, uint32_t sig) except + + Term mkPosZero(uint32_t exp, uint32_t sig) except + + Term mkNegZero(uint32_t exp, uint32_t sig) except + + Term mkRoundingMode(RoundingMode rm) except + + Term mkUninterpretedConst(Sort sort, int32_t index) except + + Term mkAbstractValue(const string& index) except + + Term mkFloatingPoint(uint32_t exp, uint32_t sig, Term val) except + + Term mkConst(Sort sort, const string& symbol) except + + # default value for symbol defined in cpp/cvc5.h + Term mkConst(Sort sort) except + + Term mkVar(Sort sort, const string& symbol) except + + DatatypeConstructorDecl mkDatatypeConstructorDecl(const string& name) except + + DatatypeDecl mkDatatypeDecl(const string& name) except + + DatatypeDecl mkDatatypeDecl(const string& name, bint isCoDatatype) except + + DatatypeDecl mkDatatypeDecl(const string& name, Sort param) except + + DatatypeDecl mkDatatypeDecl(const string& name, Sort param, bint isCoDatatype) except + + DatatypeDecl mkDatatypeDecl(const string& name, vector[Sort]& params) except + + DatatypeDecl mkDatatypeDecl(const string& name, vector[Sort]& params, bint isCoDatatype) except + + # default value for symbol defined in cpp/cvc5.h + Term mkVar(Sort sort) except + + Term simplify(const Term& t) except + + void assertFormula(Term term) except + + Result checkSat() except + + Result checkSatAssuming(const vector[Term]& assumptions) except + + Result checkEntailed(const vector[Term]& assumptions) except + + Sort declareDatatype(const string& symbol, const vector[DatatypeConstructorDecl]& ctors) + Term declareFun(const string& symbol, Sort sort) except + + Term declareFun(const string& symbol, const vector[Sort]& sorts, Sort sort) except + + Sort declareSort(const string& symbol, uint32_t arity) except + + Term defineFun(const string& symbol, const vector[Term]& bound_vars, + Sort sort, Term term, bint glbl) except + + Term defineFun(Term fun, const vector[Term]& bound_vars, Term term, bint glbl) except + + Term defineFunRec(const string& symbol, const vector[Term]& bound_vars, + Sort sort, Term term, bint glbl) except + + Term defineFunRec(Term fun, const vector[Term]& bound_vars, + Term term, bint glbl) except + + Term defineFunsRec(vector[Term]& funs, vector[vector[Term]]& bound_vars, + vector[Term]& terms, bint glbl) except + + vector[Term] getAssertions() except + + string getInfo(const string& flag) except + + string getOption(string& option) except + + vector[Term] getUnsatAssumptions() except + + vector[Term] getUnsatCore() except + + Term getValue(Term term) except + + vector[Term] getValue(const vector[Term]& terms) except + + void declareSeparationHeap(Sort locSort, Sort dataSort) except + + Term getSeparationHeap() except + + Term getSeparationNilTerm() except + + Term declarePool(const string& name, Sort sort, vector[Term]& initValue) except + + void pop(uint32_t nscopes) except + + void push(uint32_t nscopes) except + + void reset() except + + void resetAssertions() except + + void setInfo(string& keyword, const string& value) except + + void setLogic(const string& logic) except + + void setOption(const string& option, const string& value) except + + + cdef cppclass Grammar: + Grammar() except + + Grammar(Solver* solver, vector[Term] boundVars, vector[Term] ntSymbols) except + + void addRule(Term ntSymbol, Term rule) except + + void addAnyConstant(Term ntSymbol) except + + void addAnyVariable(Term ntSymbol) except + + void addRules(Term ntSymbol, vector[Term] rules) except + + + cdef cppclass Sort: + Sort() except + + bint operator==(const Sort&) except + + bint operator!=(const Sort&) except + + bint operator<(const Sort&) except + + bint operator>(const Sort&) except + + bint operator<=(const Sort&) except + + bint operator>=(const Sort&) except + + bint isBoolean() except + + bint isInteger() except + + bint isReal() except + + bint isString() except + + bint isRegExp() except + + bint isRoundingMode() except + + bint isBitVector() except + + bint isFloatingPoint() except + + bint isDatatype() except + + bint isParametricDatatype() except + + bint isConstructor() except + + bint isSelector() except + + bint isTester() except + + bint isFunction() except + + bint isPredicate() except + + bint isTuple() except + + bint isRecord() except + + bint isArray() except + + bint isSet() except + + bint isBag() except + + bint isSequence() except + + bint isUninterpretedSort() except + + bint isSortConstructor() except + + bint isFirstClass() except + + bint isFunctionLike() except + + bint isSubsortOf(Sort s) except + + bint isComparableTo(Sort s) except + + Datatype getDatatype() except + + Sort instantiate(const vector[Sort]& params) except + + size_t getConstructorArity() except + + vector[Sort] getConstructorDomainSorts() except + + Sort getConstructorCodomainSort() except + + Sort getSelectorDomainSort() except + + Sort getSelectorCodomainSort() except + + Sort getTesterDomainSort() except + + Sort getTesterCodomainSort() except + + size_t getFunctionArity() except + + vector[Sort] getFunctionDomainSorts() except + + Sort getFunctionCodomainSort() except + + Sort getArrayIndexSort() except + + Sort getArrayElementSort() except + + Sort getSetElementSort() except + + Sort getBagElementSort() except + + Sort getSequenceElementSort() except + + string getUninterpretedSortName() except + + bint isUninterpretedSortParameterized() except + + vector[Sort] getUninterpretedSortParamSorts() except + + string getSortConstructorName() except + + size_t getSortConstructorArity() except + + uint32_t getBVSize() except + + uint32_t getFPExponentSize() except + + uint32_t getFPSignificandSize() except + + vector[Sort] getDatatypeParamSorts() except + + size_t getDatatypeArity() except + + size_t getTupleLength() except + + vector[Sort] getTupleSorts() except + + string toString() except + + + cdef cppclass SortHashFunction: + SortHashFunction() except + + size_t operator()(const Sort & s) except + + + cdef cppclass Term: + Term() + bint operator==(const Term&) except + + bint operator!=(const Term&) except + + Term operator[](size_t idx) except + + Kind getKind() except + + Sort getSort() except + + Term substitute(const vector[Term] es, const vector[Term] & reps) except + + bint hasOp() except + + Op getOp() except + + bint isNull() except + + Term getConstArrayBase() except + + vector[Term] getConstSequenceElements() except + + Term notTerm() except + + Term andTerm(const Term& t) except + + Term orTerm(const Term& t) except + + Term xorTerm(const Term& t) except + + Term eqTerm(const Term& t) except + + Term impTerm(const Term& t) except + + Term iteTerm(const Term& then_t, const Term& else_t) except + + string toString() except + + cppclass const_iterator: + const_iterator() except + + bint operator==(const const_iterator& it) except + + bint operator!=(const const_iterator& it) except + + const_iterator& operator++(); + Term operator*() except + + const_iterator begin() except + + const_iterator end() except + + + cdef cppclass TermHashFunction: + TermHashFunction() except + + size_t operator()(const Term & t) except + + + +cdef extern from "api/cpp/cvc5.h" namespace "cvc5::api::RoundingMode": + cdef RoundingMode ROUND_NEAREST_TIES_TO_EVEN, + cdef RoundingMode ROUND_TOWARD_POSITIVE, + cdef RoundingMode ROUND_TOWARD_NEGATIVE, + cdef RoundingMode ROUND_TOWARD_ZERO, + cdef RoundingMode ROUND_NEAREST_TIES_TO_AWAY diff --git a/src/api/python/cvc5.pxi b/src/api/python/cvc5.pxi new file mode 100644 index 000000000..0ee56cd55 --- /dev/null +++ b/src/api/python/cvc5.pxi @@ -0,0 +1,1674 @@ +from collections import defaultdict +from fractions import Fraction +import sys + +from libc.stdint cimport int32_t, int64_t, uint32_t, uint64_t + +from libcpp.pair cimport pair +from libcpp.set cimport set +from libcpp.string cimport string +from libcpp.vector cimport vector + +from cvc5 cimport cout +from cvc5 cimport Datatype as c_Datatype +from cvc5 cimport DatatypeConstructor as c_DatatypeConstructor +from cvc5 cimport DatatypeConstructorDecl as c_DatatypeConstructorDecl +from cvc5 cimport DatatypeDecl as c_DatatypeDecl +from cvc5 cimport DatatypeSelector as c_DatatypeSelector +from cvc5 cimport Result as c_Result +from cvc5 cimport RoundingMode as c_RoundingMode +from cvc5 cimport Op as c_Op +from cvc5 cimport OpHashFunction as c_OpHashFunction +from cvc5 cimport Solver as c_Solver +from cvc5 cimport Grammar as c_Grammar +from cvc5 cimport Sort as c_Sort +from cvc5 cimport SortHashFunction as c_SortHashFunction +from cvc5 cimport ROUND_NEAREST_TIES_TO_EVEN, ROUND_TOWARD_POSITIVE +from cvc5 cimport ROUND_TOWARD_NEGATIVE, ROUND_TOWARD_ZERO +from cvc5 cimport ROUND_NEAREST_TIES_TO_AWAY +from cvc5 cimport Term as c_Term +from cvc5 cimport TermHashFunction as c_TermHashFunction + +from cvc5kinds cimport Kind as c_Kind + +################################## DECORATORS ################################# +def expand_list_arg(num_req_args=0): + ''' + Creates a decorator that looks at index num_req_args of the args, + if it's a list, it expands it before calling the function. + ''' + def decorator(func): + def wrapper(owner, *args): + if len(args) == num_req_args + 1 and \ + isinstance(args[num_req_args], list): + args = list(args[:num_req_args]) + args[num_req_args] + return func(owner, *args) + return wrapper + return decorator +############################################################################### + +# Style Guidelines +### Using PEP-8 spacing recommendations +### Limit linewidth to 79 characters +### Break before binary operators +### surround top level functions and classes with two spaces +### separate methods by one space +### use spaces in functions sparingly to separate logical blocks +### can omit spaces between unrelated oneliners +### always use c++ default arguments +#### only use default args of None at python level + +# References and pointers +# The Solver object holds a pointer to a c_Solver. +# This is because the assignment operator is deleted in the C++ API for solvers. +# Cython has a limitation where you can't stack allocate objects +# that have constructors with arguments: +# https://groups.google.com/forum/#!topic/cython-users/fuKd-nQLpBs. +# To get around that you can either have a nullary constructor and assignment +# or, use a pointer (which is what we chose). +# An additional complication of this is that to free up resources, you must +# know when to delete the object. +# Python will not follow the same scoping rules as in C++, so it must be +# able to reference count. To do this correctly, the solver must be a +# reference in the Python class for any class that keeps a pointer to +# the solver in C++ (to ensure the solver is not deleted before something +# that depends on it). + + +## Objects for hashing +cdef c_OpHashFunction cophash = c_OpHashFunction() +cdef c_SortHashFunction csorthash = c_SortHashFunction() +cdef c_TermHashFunction ctermhash = c_TermHashFunction() + + +cdef class Datatype: + cdef c_Datatype cd + cdef Solver solver + def __cinit__(self, Solver solver): + self.solver = solver + + def __getitem__(self, index): + cdef DatatypeConstructor dc = DatatypeConstructor(self.solver) + if isinstance(index, int) and index >= 0: + dc.cdc = self.cd[( index)] + elif isinstance(index, str): + dc.cdc = self.cd[( index.encode())] + else: + raise ValueError("Expecting a non-negative integer or string") + return dc + + def getConstructor(self, str name): + cdef DatatypeConstructor dc = DatatypeConstructor(self.solver) + dc.cdc = self.cd.getConstructor(name.encode()) + return dc + + def getConstructorTerm(self, str name): + cdef Term term = Term(self.solver) + term.cterm = self.cd.getConstructorTerm(name.encode()) + return term + + def getNumConstructors(self): + return self.cd.getNumConstructors() + + def isParametric(self): + return self.cd.isParametric() + + def isCodatatype(self): + return self.cd.isCodatatype() + + def isTuple(self): + return self.cd.isTuple() + + def isRecord(self): + return self.cd.isRecord() + + def isFinite(self): + return self.cd.isFinite() + + def isWellFounded(self): + return self.cd.isWellFounded() + + def hasNestedRecursion(self): + return self.cd.hasNestedRecursion() + + def __str__(self): + return self.cd.toString().decode() + + def __repr__(self): + return self.cd.toString().decode() + + def __iter__(self): + for ci in self.cd: + dc = DatatypeConstructor(self.solver) + dc.cdc = ci + yield dc + + +cdef class DatatypeConstructor: + cdef c_DatatypeConstructor cdc + cdef Solver solver + def __cinit__(self, Solver solver): + self.cdc = c_DatatypeConstructor() + self.solver = solver + + def __getitem__(self, index): + cdef DatatypeSelector ds = DatatypeSelector(self.solver) + if isinstance(index, int) and index >= 0: + ds.cds = self.cdc[( index)] + elif isinstance(index, str): + ds.cds = self.cdc[( name.encode())] + else: + raise ValueError("Expecting a non-negative integer or string") + return ds + + def getName(self): + return self.cdc.getName().decode() + + def getConstructorTerm(self): + cdef Term term = Term(self.solver) + term.cterm = self.cdc.getConstructorTerm() + return term + + def getTesterTerm(self): + cdef Term term = Term(self.solver) + term.cterm = self.cdc.getTesterTerm() + return term + + def getNumSelectors(self): + return self.cdc.getNumSelectors() + + def getSelector(self, str name): + cdef DatatypeSelector ds = DatatypeSelector(self.solver) + ds.cds = self.cdc.getSelector(name.encode()) + return ds + + def getSelectorTerm(self, str name): + cdef Term term = Term(self.solver) + term.cterm = self.cdc.getSelectorTerm(name.encode()) + return term + + def __str__(self): + return self.cdc.toString().decode() + + def __repr__(self): + return self.cdc.toString().decode() + + def __iter__(self): + for ci in self.cdc: + ds = DatatypeSelector(self.solver) + ds.cds = ci + yield ds + + +cdef class DatatypeConstructorDecl: + cdef c_DatatypeConstructorDecl cddc + cdef Solver solver + + def __cinit__(self, Solver solver): + self.solver = solver + + def addSelector(self, str name, Sort sort): + self.cddc.addSelector(name.encode(), sort.csort) + + def addSelectorSelf(self, str name): + self.cddc.addSelectorSelf(name.encode()) + + def __str__(self): + return self.cddc.toString().decode() + + def __repr__(self): + return self.cddc.toString().decode() + + +cdef class DatatypeDecl: + cdef c_DatatypeDecl cdd + cdef Solver solver + def __cinit__(self, Solver solver): + self.solver = solver + + def addConstructor(self, DatatypeConstructorDecl ctor): + self.cdd.addConstructor(ctor.cddc) + + def getNumConstructors(self): + return self.cdd.getNumConstructors() + + def isParametric(self): + return self.cdd.isParametric() + + def __str__(self): + return self.cdd.toString().decode() + + def __repr__(self): + return self.cdd.toString().decode() + + +cdef class DatatypeSelector: + cdef c_DatatypeSelector cds + cdef Solver solver + def __cinit__(self, Solver solver): + self.cds = c_DatatypeSelector() + self.solver = solver + + def getName(self): + return self.cds.getName().decode() + + def getSelectorTerm(self): + cdef Term term = Term(self.solver) + term.cterm = self.cds.getSelectorTerm() + return term + + def getRangeSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.cds.getRangeSort() + return sort + + def __str__(self): + return self.cds.toString().decode() + + def __repr__(self): + return self.cds.toString().decode() + + +cdef class Op: + cdef c_Op cop + cdef Solver solver + def __cinit__(self, Solver solver): + self.cop = c_Op() + self.solver = solver + + def __eq__(self, Op other): + return self.cop == other.cop + + def __ne__(self, Op other): + return self.cop != other.cop + + def __str__(self): + return self.cop.toString().decode() + + def __repr__(self): + return self.cop.toString().decode() + + def __hash__(self): + return cophash(self.cop) + + def getKind(self): + return kind( self.cop.getKind()) + + def isNull(self): + return self.cop.isNull() + + def getIndices(self): + indices = None + try: + indices = self.cop.getIndices[string]() + except: + pass + + try: + indices = self.cop.getIndices[uint32_t]() + except: + pass + + try: + indices = self.cop.getIndices[pair[uint32_t, uint32_t]]() + except: + pass + + if indices is None: + raise RuntimeError("Unable to retrieve indices from {}".format(self)) + + return indices + +cdef class Grammar: + cdef c_Grammar cgrammar + cdef Solver solver + def __cinit__(self, Solver solver): + self.solver = solver + self.cgrammar = c_Grammar() + + def addRule(self, Term ntSymbol, Term rule): + self.cgrammar.addRule(ntSymbol.cterm, rule.cterm) + + def addAnyConstant(self, Term ntSymbol): + self.cgrammar.addAnyConstant(ntSymbol.cterm) + + def addAnyVariable(self, Term ntSymbol): + self.cgrammar.addAnyVariable(ntSymbol.cterm) + + def addRules(self, Term ntSymbol, rules): + cdef vector[c_Term] crules + for r in rules: + crules.push_back(( r).cterm) + self.cgrammar.addRules(ntSymbol.cterm, crules) + +cdef class Result: + cdef c_Result cr + def __cinit__(self): + # gets populated by solver + self.cr = c_Result() + + def isNull(self): + return self.cr.isNull() + + def isSat(self): + return self.cr.isSat() + + def isUnsat(self): + return self.cr.isUnsat() + + def isSatUnknown(self): + return self.cr.isSatUnknown() + + def isEntailed(self): + return self.cr.isEntailed() + + def isNotEntailed(self): + return self.cr.isNotEntailed() + + def isEntailmentUnknown(self): + return self.cr.isEntailmentUnknown() + + def __eq__(self, Result other): + return self.cr == other.cr + + def __ne__(self, Result other): + return self.cr != other.cr + + def getUnknownExplanation(self): + return self.cr.getUnknownExplanation().decode() + + def __str__(self): + return self.cr.toString().decode() + + def __repr__(self): + return self.cr.toString().decode() + + +cdef class RoundingMode: + cdef c_RoundingMode crm + cdef str name + def __cinit__(self, int rm): + # crm always assigned externally + self.crm = rm + self.name = __rounding_modes[rm] + + def __eq__(self, RoundingMode other): + return ( self.crm) == ( other.crm) + + def __ne__(self, RoundingMode other): + return not self.__eq__(other) + + def __hash__(self): + return hash(( self.crm, self.name)) + + def __str__(self): + return self.name + + def __repr__(self): + return self.name + + +cdef class Solver: + cdef c_Solver* csolver + + def __cinit__(self): + self.csolver = new c_Solver(NULL) + + def __dealloc__(self): + del self.csolver + + def supportsFloatingPoint(self): + return self.csolver.supportsFloatingPoint() + + def getBooleanSort(self): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.getBooleanSort() + return sort + + def getIntegerSort(self): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.getIntegerSort() + return sort + + def getRealSort(self): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.getRealSort() + return sort + + def getRegExpSort(self): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.getRegExpSort() + return sort + + def getRoundingModeSort(self): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.getRoundingModeSort() + return sort + + def getStringSort(self): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.getStringSort() + return sort + + def mkArraySort(self, Sort indexSort, Sort elemSort): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkArraySort(indexSort.csort, elemSort.csort) + return sort + + def mkBitVectorSort(self, uint32_t size): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkBitVectorSort(size) + return sort + + def mkFloatingPointSort(self, uint32_t exp, uint32_t sig): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkFloatingPointSort(exp, sig) + return sort + + def mkDatatypeSort(self, DatatypeDecl dtypedecl): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkDatatypeSort(dtypedecl.cdd) + return sort + + def mkDatatypeSorts(self, list dtypedecls, unresolvedSorts): + sorts = [] + + cdef vector[c_DatatypeDecl] decls + for decl in dtypedecls: + decls.push_back(( decl).cdd) + + cdef set[c_Sort] usorts + for usort in unresolvedSorts: + usorts.insert(( usort).csort) + + csorts = self.csolver.mkDatatypeSorts( + decls, usorts) + for csort in csorts: + sort = Sort(self) + sort.csort = csort + sorts.append(sort) + + return sorts + + def mkFunctionSort(self, sorts, Sort codomain): + + cdef Sort sort = Sort(self) + # populate a vector with dereferenced c_Sorts + cdef vector[c_Sort] v + + if isinstance(sorts, Sort): + sort.csort = self.csolver.mkFunctionSort(( sorts).csort, + codomain.csort) + elif isinstance(sorts, list): + for s in sorts: + v.push_back((s).csort) + + sort.csort = self.csolver.mkFunctionSort( v, + codomain.csort) + return sort + + def mkParamSort(self, symbolname): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkParamSort(symbolname.encode()) + return sort + + @expand_list_arg(num_req_args=0) + def mkPredicateSort(self, *sorts): + ''' + Supports the following arguments: + Sort mkPredicateSort(List[Sort] sorts) + + where sorts can also be comma-separated arguments of + type Sort + ''' + cdef Sort sort = Sort(self) + cdef vector[c_Sort] v + for s in sorts: + v.push_back(( s).csort) + sort.csort = self.csolver.mkPredicateSort( v) + return sort + + @expand_list_arg(num_req_args=0) + def mkRecordSort(self, *fields): + ''' + Supports the following arguments: + Sort mkRecordSort(List[Tuple[str, Sort]] fields) + + where fields can also be comma-separated arguments of + type Tuple[str, Sort] + ''' + cdef Sort sort = Sort(self) + cdef vector[pair[string, c_Sort]] v + cdef pair[string, c_Sort] p + for f in fields: + name, sortarg = f + name = name.encode() + p = pair[string, c_Sort]( name, ( sortarg).csort) + v.push_back(p) + sort.csort = self.csolver.mkRecordSort( + v) + return sort + + def mkSetSort(self, Sort elemSort): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkSetSort(elemSort.csort) + return sort + + def mkBagSort(self, Sort elemSort): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkBagSort(elemSort.csort) + return sort + + def mkSequenceSort(self, Sort elemSort): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkSequenceSort(elemSort.csort) + return sort + + def mkUninterpretedSort(self, str name): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.mkUninterpretedSort(name.encode()) + return sort + + def mkSortConstructorSort(self, str symbol, size_t arity): + cdef Sort sort = Sort(self) + sort.csort =self.csolver.mkSortConstructorSort(symbol.encode(), arity) + return sort + + @expand_list_arg(num_req_args=0) + def mkTupleSort(self, *sorts): + ''' + Supports the following arguments: + Sort mkTupleSort(List[Sort] sorts) + + where sorts can also be comma-separated arguments of + type Sort + ''' + cdef Sort sort = Sort(self) + cdef vector[c_Sort] v + for s in sorts: + v.push_back(( s).csort) + sort.csort = self.csolver.mkTupleSort(v) + return sort + + @expand_list_arg(num_req_args=1) + def mkTerm(self, kind_or_op, *args): + ''' + Supports the following arguments: + Term mkTerm(Kind kind) + Term mkTerm(Kind kind, Op child1, List[Term] children) + Term mkTerm(Kind kind, List[Term] children) + + where List[Term] can also be comma-separated arguments + ''' + cdef Term term = Term(self) + cdef vector[c_Term] v + + op = kind_or_op + if isinstance(kind_or_op, kind): + op = self.mkOp(kind_or_op) + + if len(args) == 0: + term.cterm = self.csolver.mkTerm(( op).cop) + else: + for a in args: + v.push_back(( a).cterm) + term.cterm = self.csolver.mkTerm(( op).cop, v) + return term + + def mkOp(self, kind k, arg0=None, arg1 = None): + ''' + Supports the following uses: + Op mkOp(Kind kind) + Op mkOp(Kind kind, Kind k) + Op mkOp(Kind kind, const string& arg) + Op mkOp(Kind kind, uint32_t arg) + Op mkOp(Kind kind, uint32_t arg0, uint32_t arg1) + ''' + cdef Op op = Op(self) + + if arg0 is None: + op.cop = self.csolver.mkOp(k.k) + elif arg1 is None: + if isinstance(arg0, kind): + op.cop = self.csolver.mkOp(k.k, ( arg0).k) + elif isinstance(arg0, str): + op.cop = self.csolver.mkOp(k.k, + + arg0.encode()) + elif isinstance(arg0, int): + op.cop = self.csolver.mkOp(k.k, arg0) + else: + raise ValueError("Unsupported signature" + " mkOp: {}".format(" X ".join([k, arg0]))) + else: + if isinstance(arg0, int) and isinstance(arg1, int): + op.cop = self.csolver.mkOp(k.k, arg0, + arg1) + else: + raise ValueError("Unsupported signature" + " mkOp: {}".format(" X ".join([k, arg0, arg1]))) + return op + + def mkTrue(self): + cdef Term term = Term(self) + term.cterm = self.csolver.mkTrue() + return term + + def mkFalse(self): + cdef Term term = Term(self) + term.cterm = self.csolver.mkFalse() + return term + + def mkBoolean(self, bint val): + cdef Term term = Term(self) + term.cterm = self.csolver.mkBoolean(val) + return term + + def mkPi(self): + cdef Term term = Term(self) + term.cterm = self.csolver.mkPi() + return term + + def mkInteger(self, val): + cdef Term term = Term(self) + integer = int(val) + term.cterm = self.csolver.mkInteger("{}".format(integer).encode()) + return term + + def mkReal(self, val, den=None): + cdef Term term = Term(self) + if den is None: + term.cterm = self.csolver.mkReal(str(val).encode()) + else: + if not isinstance(val, int) or not isinstance(den, int): + raise ValueError("Expecting integers when" + " constructing a rational" + " but got: {}".format((val, den))) + term.cterm = self.csolver.mkReal("{}/{}".format(val, den).encode()) + return term + + def mkRegexpEmpty(self): + cdef Term term = Term(self) + term.cterm = self.csolver.mkRegexpEmpty() + return term + + def mkRegexpSigma(self): + cdef Term term = Term(self) + term.cterm = self.csolver.mkRegexpSigma() + return term + + def mkEmptySet(self, Sort s): + cdef Term term = Term(self) + term.cterm = self.csolver.mkEmptySet(s.csort) + return term + + + def mkSepNil(self, Sort sort): + cdef Term term = Term(self) + term.cterm = self.csolver.mkSepNil(sort.csort) + return term + + def mkString(self, str_or_vec): + cdef Term term = Term(self) + cdef vector[unsigned] v + if isinstance(str_or_vec, str): + for u in str_or_vec: + v.push_back( ord(u)) + term.cterm = self.csolver.mkString( v) + elif isinstance(str_or_vec, list): + for u in str_or_vec: + if not isinstance(u, int): + raise ValueError("List should contain ints but got: {}" + .format(str_or_vec)) + v.push_back( u) + term.cterm = self.csolver.mkString( v) + else: + raise ValueError("Expected string or vector of ASCII codes" + " but got: {}".format(str_or_vec)) + return term + + def mkEmptySequence(self, Sort sort): + cdef Term term = Term(self) + term.cterm = self.csolver.mkEmptySequence(sort.csort) + return term + + def mkUniverseSet(self, Sort sort): + cdef Term term = Term(self) + term.cterm = self.csolver.mkUniverseSet(sort.csort) + return term + + def mkBitVector(self, size_or_str, val = None): + cdef Term term = Term(self) + if isinstance(size_or_str, int): + if val is None: + term.cterm = self.csolver.mkBitVector( size_or_str) + else: + term.cterm = self.csolver.mkBitVector( size_or_str, + str(val).encode(), + 10) + elif isinstance(size_or_str, str): + # handle default value + if val is None: + term.cterm = self.csolver.mkBitVector( + size_or_str.encode()) + else: + term.cterm = self.csolver.mkBitVector( + size_or_str.encode(), val) + else: + raise ValueError("Unexpected inputs {} to" + " mkBitVector".format((size_or_str, val))) + return term + + def mkConstArray(self, Sort sort, Term val): + cdef Term term = Term(self) + term.cterm = self.csolver.mkConstArray(sort.csort, val.cterm) + return term + + def mkPosInf(self, int exp, int sig): + cdef Term term = Term(self) + term.cterm = self.csolver.mkPosInf(exp, sig) + return term + + def mkNegInf(self, int exp, int sig): + cdef Term term = Term(self) + term.cterm = self.csolver.mkNegInf(exp, sig) + return term + + def mkNaN(self, int exp, int sig): + cdef Term term = Term(self) + term.cterm = self.csolver.mkNaN(exp, sig) + return term + + def mkPosZero(self, int exp, int sig): + cdef Term term = Term(self) + term.cterm = self.csolver.mkPosZero(exp, sig) + return term + + def mkNegZero(self, int exp, int sig): + cdef Term term = Term(self) + term.cterm = self.csolver.mkNegZero(exp, sig) + return term + + def mkRoundingMode(self, RoundingMode rm): + cdef Term term = Term(self) + term.cterm = self.csolver.mkRoundingMode( rm.crm) + return term + + def mkUninterpretedConst(self, Sort sort, int index): + cdef Term term = Term(self) + term.cterm = self.csolver.mkUninterpretedConst(sort.csort, index) + return term + + def mkAbstractValue(self, index): + cdef Term term = Term(self) + try: + term.cterm = self.csolver.mkAbstractValue(str(index).encode()) + except: + raise ValueError("mkAbstractValue expects a str representing a number" + " or an int, but got{}".format(index)) + return term + + def mkFloatingPoint(self, int exp, int sig, Term val): + cdef Term term = Term(self) + term.cterm = self.csolver.mkFloatingPoint(exp, sig, val.cterm) + return term + + def mkConst(self, Sort sort, symbol=None): + cdef Term term = Term(self) + if symbol is None: + term.cterm = self.csolver.mkConst(sort.csort) + else: + term.cterm = self.csolver.mkConst(sort.csort, + ( symbol).encode()) + return term + + def mkVar(self, Sort sort, symbol=None): + cdef Term term = Term(self) + if symbol is None: + term.cterm = self.csolver.mkVar(sort.csort) + else: + term.cterm = self.csolver.mkVar(sort.csort, + ( symbol).encode()) + return term + + def mkDatatypeConstructorDecl(self, str name): + cdef DatatypeConstructorDecl ddc = DatatypeConstructorDecl(self) + ddc.cddc = self.csolver.mkDatatypeConstructorDecl(name.encode()) + return ddc + + def mkDatatypeDecl(self, str name, sorts_or_bool=None, isCoDatatype=None): + cdef DatatypeDecl dd = DatatypeDecl(self) + cdef vector[c_Sort] v + + # argument cases + if sorts_or_bool is None and isCoDatatype is None: + dd.cdd = self.csolver.mkDatatypeDecl(name.encode()) + elif sorts_or_bool is not None and isCoDatatype is None: + if isinstance(sorts_or_bool, bool): + dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), + sorts_or_bool) + elif isinstance(sorts_or_bool, Sort): + dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), + ( sorts_or_bool).csort) + elif isinstance(sorts_or_bool, list): + for s in sorts_or_bool: + v.push_back(( s).csort) + dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), + v) + else: + raise ValueError("Unhandled second argument type {}" + .format(type(sorts_or_bool))) + elif sorts_or_bool is not None and isCoDatatype is not None: + if isinstance(sorts_or_bool, Sort): + dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), + ( sorts_or_bool).csort, + isCoDatatype) + elif isinstance(sorts_or_bool, list): + for s in sorts_or_bool: + v.push_back(( s).csort) + dd.cdd = self.csolver.mkDatatypeDecl( name.encode(), + v, + isCoDatatype) + else: + raise ValueError("Unhandled second argument type {}" + .format(type(sorts_or_bool))) + else: + raise ValueError("Can't create DatatypeDecl with {}".format([type(a) + for a in [name, + sorts_or_bool, + isCoDatatype]])) + + return dd + + def simplify(self, Term t): + cdef Term term = Term(self) + term.cterm = self.csolver.simplify(t.cterm) + return term + + def assertFormula(self, Term term): + self.csolver.assertFormula(term.cterm) + + def checkSat(self): + cdef Result r = Result() + r.cr = self.csolver.checkSat() + return r + + def mkSygusGrammar(self, boundVars, ntSymbols): + cdef Grammar grammar = Grammar(self) + cdef vector[c_Term] bvc + cdef vector[c_Term] ntc + for bv in boundVars: + bvc.push_back(( bv).cterm) + for nt in ntSymbols: + ntc.push_back(( nt).cterm) + grammar.cgrammar = self.csolver.mkSygusGrammar( bvc, ntc) + return grammar + + def mkSygusVar(self, Sort sort, str symbol=""): + cdef Term term = Term(self) + term.cterm = self.csolver.mkSygusVar(sort.csort, symbol.encode()) + return term + + def addSygusConstraint(self, Term t): + self.csolver.addSygusConstraint(t.cterm) + + def addSygusInvConstraint(self, Term inv_f, Term pre_f, Term trans_f, Term post_f): + self.csolver.addSygusInvConstraint(inv_f.cterm, pre_f.cterm, trans_f.cterm, post_f.cterm) + + def synthFun(self, str symbol, bound_vars, Sort sort, Grammar grammar=None): + cdef Term term = Term(self) + cdef vector[c_Term] v + for bv in bound_vars: + v.push_back(( bv).cterm) + if grammar is None: + term.cterm = self.csolver.synthFun(symbol.encode(), v, sort.csort) + else: + term.cterm = self.csolver.synthFun(symbol.encode(), v, sort.csort, grammar.cgrammar) + return term + + def checkSynth(self): + cdef Result r = Result() + r.cr = self.csolver.checkSynth() + return r + + def getSynthSolution(self, Term term): + cdef Term t = Term(self) + t.cterm = self.csolver.getSynthSolution(term.cterm) + return t + + def synthInv(self, symbol, bound_vars, Grammar grammar=None): + cdef Term term = Term(self) + cdef vector[c_Term] v + for bv in bound_vars: + v.push_back(( bv).cterm) + if grammar is None: + term.cterm = self.csolver.synthInv(symbol.encode(), v) + else: + term.cterm = self.csolver.synthInv(symbol.encode(), v, grammar.cgrammar) + return term + + def printSynthSolution(self): + self.csolver.printSynthSolution(cout) + + @expand_list_arg(num_req_args=0) + def checkSatAssuming(self, *assumptions): + ''' + Supports the following arguments: + Result checkSatAssuming(List[Term] assumptions) + + where assumptions can also be comma-separated arguments of + type (boolean) Term + ''' + cdef Result r = Result() + # used if assumptions is a list of terms + cdef vector[c_Term] v + for a in assumptions: + v.push_back(( a).cterm) + r.cr = self.csolver.checkSatAssuming( v) + return r + + @expand_list_arg(num_req_args=0) + def checkEntailed(self, *assumptions): + ''' + Supports the following arguments: + Result checkEntailed(List[Term] assumptions) + + where assumptions can also be comma-separated arguments of + type (boolean) Term + ''' + cdef Result r = Result() + # used if assumptions is a list of terms + cdef vector[c_Term] v + for a in assumptions: + v.push_back(( a).cterm) + r.cr = self.csolver.checkEntailed( v) + return r + + @expand_list_arg(num_req_args=1) + def declareDatatype(self, str symbol, *ctors): + ''' + Supports the following arguments: + Sort declareDatatype(str symbol, List[Term] ctors) + + where ctors can also be comma-separated arguments of + type DatatypeConstructorDecl + ''' + cdef Sort sort = Sort(self) + cdef vector[c_DatatypeConstructorDecl] v + + for c in ctors: + v.push_back(( c).cddc) + sort.csort = self.csolver.declareDatatype(symbol.encode(), v) + return sort + + def declareFun(self, str symbol, list sorts, Sort sort): + cdef Term term = Term(self) + cdef vector[c_Sort] v + for s in sorts: + v.push_back(( s).csort) + term.cterm = self.csolver.declareFun(symbol.encode(), + v, + sort.csort) + return term + + def declareSort(self, str symbol, int arity): + cdef Sort sort = Sort(self) + sort.csort = self.csolver.declareSort(symbol.encode(), arity) + return sort + + def defineFun(self, sym_or_fun, bound_vars, sort_or_term, t=None, glbl=False): + ''' + Supports two uses: + Term defineFun(str symbol, List[Term] bound_vars, + Sort sort, Term term, bool glbl) + Term defineFun(Term fun, List[Term] bound_vars, + Term term, bool glbl) + ''' + cdef Term term = Term(self) + cdef vector[c_Term] v + for bv in bound_vars: + v.push_back(( bv).cterm) + + if t is not None: + term.cterm = self.csolver.defineFun(( sym_or_fun).encode(), + v, + ( sort_or_term).csort, + ( t).cterm, + glbl) + else: + term.cterm = self.csolver.defineFun(( sym_or_fun).cterm, + v, + ( sort_or_term).cterm, + glbl) + + return term + + def defineFunRec(self, sym_or_fun, bound_vars, sort_or_term, t=None, glbl=False): + ''' + Supports two uses: + Term defineFunRec(str symbol, List[Term] bound_vars, + Sort sort, Term term, bool glbl) + Term defineFunRec(Term fun, List[Term] bound_vars, + Term term, bool glbl) + ''' + cdef Term term = Term(self) + cdef vector[c_Term] v + for bv in bound_vars: + v.push_back(( bv).cterm) + + if t is not None: + term.cterm = self.csolver.defineFunRec(( sym_or_fun).encode(), + v, + ( sort_or_term).csort, + ( t).cterm, + glbl) + else: + term.cterm = self.csolver.defineFunRec(( sym_or_fun).cterm, + v, + ( sort_or_term).cterm, + glbl) + + return term + + def defineFunsRec(self, funs, bound_vars, terms): + cdef vector[c_Term] vf + cdef vector[vector[c_Term]] vbv + cdef vector[c_Term] vt + + for f in funs: + vf.push_back(( f).cterm) + + cdef vector[c_Term] temp + for v in bound_vars: + for t in v: + temp.push_back(( t).cterm) + vbv.push_back(temp) + temp.clear() + + for t in terms: + vf.push_back(( t).cterm) + + def getAssertions(self): + assertions = [] + for a in self.csolver.getAssertions(): + term = Term(self) + term.cterm = a + assertions.append(term) + return assertions + + def getInfo(self, str flag): + return self.csolver.getInfo(flag.encode()) + + def getOption(self, str option): + return self.csolver.getOption(option.encode()) + + def getUnsatAssumptions(self): + assumptions = [] + for a in self.csolver.getUnsatAssumptions(): + term = Term(self) + term.cterm = a + assumptions.append(term) + return assumptions + + def getUnsatCore(self): + core = [] + for a in self.csolver.getUnsatCore(): + term = Term(self) + term.cterm = a + core.append(term) + return core + + def getValue(self, Term t): + cdef Term term = Term(self) + term.cterm = self.csolver.getValue(t.cterm) + return term + + def getSeparationHeap(self): + cdef Term term = Term(self) + term.cterm = self.csolver.getSeparationHeap() + return term + + def declareSeparationHeap(self, Sort locType, Sort dataType): + self.csolver.declareSeparationHeap(locType.csort, dataType.csort) + + def getSeparationNilTerm(self): + cdef Term term = Term(self) + term.cterm = self.csolver.getSeparationNilTerm() + return term + + def declarePool(self, str symbol, Sort sort, initValue): + cdef Term term = Term(self) + cdef vector[c_Term] niv + for v in initValue: + niv.push_back(( v).cterm) + term.cterm = self.csolver.declarePool(symbol.encode(), sort.csort, niv) + return term + + def pop(self, nscopes=1): + self.csolver.pop(nscopes) + + def push(self, nscopes=1): + self.csolver.push(nscopes) + + def resetAssertions(self): + self.csolver.resetAssertions() + + def setInfo(self, str keyword, str value): + self.csolver.setInfo(keyword.encode(), value.encode()) + + def setLogic(self, str logic): + self.csolver.setLogic(logic.encode()) + + def setOption(self, str option, str value): + self.csolver.setOption(option.encode(), value.encode()) + + +cdef class Sort: + cdef c_Sort csort + cdef Solver solver + def __cinit__(self, Solver solver): + # csort always set by Solver + self.solver = solver + + def __eq__(self, Sort other): + return self.csort == other.csort + + def __ne__(self, Sort other): + return self.csort != other.csort + + def __lt__(self, Sort other): + return self.csort < other.csort + + def __gt__(self, Sort other): + return self.csort > other.csort + + def __le__(self, Sort other): + return self.csort <= other.csort + + def __ge__(self, Sort other): + return self.csort >= other.csort + + def __str__(self): + return self.csort.toString().decode() + + def __repr__(self): + return self.csort.toString().decode() + + def __hash__(self): + return csorthash(self.csort) + + def isBoolean(self): + return self.csort.isBoolean() + + def isInteger(self): + return self.csort.isInteger() + + def isReal(self): + return self.csort.isReal() + + def isString(self): + return self.csort.isString() + + def isRegExp(self): + return self.csort.isRegExp() + + def isRoundingMode(self): + return self.csort.isRoundingMode() + + def isBitVector(self): + return self.csort.isBitVector() + + def isFloatingPoint(self): + return self.csort.isFloatingPoint() + + def isDatatype(self): + return self.csort.isDatatype() + + def isParametricDatatype(self): + return self.csort.isParametricDatatype() + + def isConstructor(self): + return self.csort.isConstructor() + + def isSelector(self): + return self.csort.isSelector() + + def isTester(self): + return self.csort.isTester() + + def isFunction(self): + return self.csort.isFunction() + + def isPredicate(self): + return self.csort.isPredicate() + + def isTuple(self): + return self.csort.isTuple() + + def isRecord(self): + return self.csort.isRecord() + + def isArray(self): + return self.csort.isArray() + + def isSet(self): + return self.csort.isSet() + + def isBag(self): + return self.csort.isBag() + + def isSequence(self): + return self.csort.isSequence() + + def isUninterpretedSort(self): + return self.csort.isUninterpretedSort() + + def isSortConstructor(self): + return self.csort.isSortConstructor() + + def isFirstClass(self): + return self.csort.isFirstClass() + + def isFunctionLike(self): + return self.csort.isFunctionLike() + + def isSubsortOf(self, Sort sort): + return self.csort.isSubsortOf(sort.csort) + + def isComparableTo(self, Sort sort): + return self.csort.isComparableTo(sort.csort) + + def getDatatype(self): + cdef Datatype d = Datatype(self.solver) + d.cd = self.csort.getDatatype() + return d + + def instantiate(self, params): + cdef Sort sort = Sort(self.solver) + cdef vector[c_Sort] v + for s in params: + v.push_back(( s).csort) + sort.csort = self.csort.instantiate(v) + return sort + + def getConstructorArity(self): + return self.csort.getConstructorArity() + + def getConstructorDomainSorts(self): + domain_sorts = [] + for s in self.csort.getConstructorDomainSorts(): + sort = Sort(self.solver) + sort.csort = s + domain_sorts.append(sort) + return domain_sorts + + def getConstructorCodomainSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getConstructorCodomainSort() + return sort + + def getSelectorDomainSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getSelectorDomainSort() + return sort + + def getSelectorCodomainSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getSelectorCodomainSort() + return sort + + def getTesterDomainSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getTesterDomainSort() + return sort + + def getTesterCodomainSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getTesterCodomainSort() + return sort + + def getFunctionArity(self): + return self.csort.getFunctionArity() + + def getFunctionDomainSorts(self): + domain_sorts = [] + for s in self.csort.getFunctionDomainSorts(): + sort = Sort(self.solver) + sort.csort = s + domain_sorts.append(sort) + return domain_sorts + + def getFunctionCodomainSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getFunctionCodomainSort() + return sort + + def getArrayIndexSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getArrayIndexSort() + return sort + + def getArrayElementSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getArrayElementSort() + return sort + + def getSetElementSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getSetElementSort() + return sort + + def getBagElementSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getBagElementSort() + return sort + + def getSequenceElementSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.csort.getSequenceElementSort() + return sort + + def getUninterpretedSortName(self): + return self.csort.getUninterpretedSortName().decode() + + def isUninterpretedSortParameterized(self): + return self.csort.isUninterpretedSortParameterized() + + def getUninterpretedSortParamSorts(self): + param_sorts = [] + for s in self.csort.getUninterpretedSortParamSorts(): + sort = Sort(self.solver) + sort.csort = s + param_sorts.append(sort) + return param_sorts + + def getSortConstructorName(self): + return self.csort.getSortConstructorName().decode() + + def getSortConstructorArity(self): + return self.csort.getSortConstructorArity() + + def getBVSize(self): + return self.csort.getBVSize() + + def getFPExponentSize(self): + return self.csort.getFPExponentSize() + + def getFPSignificandSize(self): + return self.csort.getFPSignificandSize() + + def getDatatypeParamSorts(self): + param_sorts = [] + for s in self.csort.getDatatypeParamSorts(): + sort = Sort(self.solver) + sort.csort = s + param_sorts.append(sort) + return param_sorts + + def getDatatypeArity(self): + return self.csort.getDatatypeArity() + + def getTupleLength(self): + return self.csort.getTupleLength() + + def getTupleSorts(self): + tuple_sorts = [] + for s in self.csort.getTupleSorts(): + sort = Sort(self.solver) + sort.csort = s + tuple_sorts.append(sort) + return tuple_sorts + + +cdef class Term: + cdef c_Term cterm + cdef Solver solver + def __cinit__(self, Solver solver): + # cterm always set in the Solver object + self.solver = solver + + def __eq__(self, Term other): + return self.cterm == other.cterm + + def __ne__(self, Term other): + return self.cterm != other.cterm + + def __getitem__(self, int index): + cdef Term term = Term(self.solver) + if index >= 0: + term.cterm = self.cterm[index] + else: + raise ValueError("Expecting a non-negative integer or string") + return term + + def __str__(self): + return self.cterm.toString().decode() + + def __repr__(self): + return self.cterm.toString().decode() + + def __iter__(self): + for ci in self.cterm: + term = Term(self.solver) + term.cterm = ci + yield term + + def __hash__(self): + return ctermhash(self.cterm) + + def getKind(self): + return kind( self.cterm.getKind()) + + def getSort(self): + cdef Sort sort = Sort(self.solver) + sort.csort = self.cterm.getSort() + return sort + + def substitute(self, list es, list replacements): + cdef vector[c_Term] ces + cdef vector[c_Term] creplacements + cdef Term term = Term(self.solver) + + if len(es) != len(replacements): + raise RuntimeError("Expecting list inputs to substitute to " + "have the same length but got: " + "{} and {}".format(len(es), len(replacements))) + + for e, r in zip(es, replacements): + ces.push_back(( e).cterm) + creplacements.push_back(( r).cterm) + + term.cterm = self.cterm.substitute(ces, creplacements) + return term + + def hasOp(self): + return self.cterm.hasOp() + + def getOp(self): + cdef Op op = Op(self.solver) + op.cop = self.cterm.getOp() + return op + + def isNull(self): + return self.cterm.isNull() + + def getConstArrayBase(self): + cdef Term term = Term(self.solver) + term.cterm = self.cterm.getConstArrayBase() + return term + + def getConstSequenceElements(self): + elems = [] + for e in self.cterm.getConstSequenceElements(): + term = Term(self.solver) + term.cterm = e + elems.append(term) + return elems + + def notTerm(self): + cdef Term term = Term(self.solver) + term.cterm = self.cterm.notTerm() + return term + + def andTerm(self, Term t): + cdef Term term = Term(self.solver) + term.cterm = self.cterm.andTerm(( t).cterm) + return term + + def orTerm(self, Term t): + cdef Term term = Term(self.solver) + term.cterm = self.cterm.orTerm(t.cterm) + return term + + def xorTerm(self, Term t): + cdef Term term = Term(self.solver) + term.cterm = self.cterm.xorTerm(t.cterm) + return term + + def eqTerm(self, Term t): + cdef Term term = Term(self.solver) + term.cterm = self.cterm.eqTerm(t.cterm) + return term + + def impTerm(self, Term t): + cdef Term term = Term(self.solver) + term.cterm = self.cterm.impTerm(t.cterm) + return term + + def iteTerm(self, Term then_t, Term else_t): + cdef Term term = Term(self.solver) + term.cterm = self.cterm.iteTerm(then_t.cterm, else_t.cterm) + return term + + def toPythonObj(self): + ''' + Converts a constant value Term to a Python object. + + Currently supports: + Boolean -- returns a Python bool + Int -- returns a Python int + Real -- returns a Python Fraction + BV -- returns a Python int (treats BV as unsigned) + Array -- returns a Python dict mapping indices to values + -- the constant base is returned as the default value + String -- returns a Python Unicode string + ''' + + string_repr = self.cterm.toString().decode() + assert string_repr + sort = self.getSort() + res = None + if sort.isBoolean(): + if string_repr == "true": + res = True + else: + assert string_repr == "false" + res = False + elif sort.isInteger(): + updated_string_repr = string_repr.strip('()').replace(' ', '') + try: + res = int(updated_string_repr) + except: + raise ValueError("Failed to convert" + " {} to an int".format(string_repr)) + elif sort.isReal(): + updated_string_repr = string_repr + try: + # expecting format (/ a b) + # note: a or b could be negated: (- a) + splits = [s.strip('()/') + for s in updated_string_repr.strip('()/') \ + .replace('(- ', '(-').split()] + assert len(splits) == 2 + num = int(splits[0]) + den = int(splits[1]) + res = Fraction(num, den) + except: + raise ValueError("Failed to convert " + "{} to a Fraction".format(string_repr)) + + elif sort.isBitVector(): + # expecting format #b + assert string_repr[:2] == "#b" + python_bin_repr = "0" + string_repr[1:] + try: + res = int(python_bin_repr, 2) + except: + raise ValueError("Failed to convert bitvector " + "{} to an int".format(string_repr)) + elif sort.isArray(): + keys = [] + values = [] + base_value = None + to_visit = [self] + # Array models are represented as a series of store operations + # on a constant array + while to_visit: + t = to_visit.pop() + if t.getKind() == kinds.Store: + # save the mappings + keys.append(t[1].toPythonObj()) + values.append(t[2].toPythonObj()) + to_visit.append(t[0]) + else: + assert t.getKind() == kinds.ConstArray + base_value = t.getConstArrayBase().toPythonObj() + + assert len(keys) == len(values) + assert base_value is not None + + # put everything in a dictionary with the constant + # base as the result for any index not included in the stores + res = defaultdict(lambda : base_value) + for k, v in zip(keys, values): + res[k] = v + elif sort.isString(): + # Strip leading and trailing double quotes and replace double + # double quotes by single quotes + string_repr = string_repr[1:-1].replace('""', '"') + + # Convert escape sequences + res = '' + escape_prefix = '\\u{' + i = 0 + while True: + prev_i = i + i = string_repr.find(escape_prefix, i) + if i == -1: + res += string_repr[prev_i:] + break + + res += string_repr[prev_i:i] + val = string_repr[i + len(escape_prefix):string_repr.find('}', i)] + res += chr(int(val, 16)) + i += len(escape_prefix) + len(val) + 1 + else: + raise ValueError("Cannot convert term {}" + " of sort {} to Python object".format(string_repr, + sort)) + + assert res is not None + return res + + +# Generate rounding modes +cdef __rounding_modes = { + ROUND_NEAREST_TIES_TO_EVEN: "RoundNearestTiesToEven", + ROUND_TOWARD_POSITIVE: "RoundTowardPositive", + ROUND_TOWARD_NEGATIVE: "RoundTowardNegative", + ROUND_TOWARD_ZERO: "RoundTowardZero", + ROUND_NEAREST_TIES_TO_AWAY: "RoundNearestTiesToAway" +} + +mod_ref = sys.modules[__name__] +for rm_int, name in __rounding_modes.items(): + r = RoundingMode(rm_int) + + if name in dir(mod_ref): + raise RuntimeError("Redefinition of Python RoundingMode %s."%name) + + setattr(mod_ref, name, r) + +del r +del rm_int +del name diff --git a/src/api/python/genkinds.py.in b/src/api/python/genkinds.py.in index a78372e71..8c8de35ac 100644 --- a/src/api/python/genkinds.py.in +++ b/src/api/python/genkinds.py.in @@ -56,7 +56,7 @@ KINDS_PXI_TOP = \ r"""# distutils: language = c++ # distutils: extra_compile_args = -std=c++11 -from cvc4kinds cimport * +from cvc5kinds cimport * import sys from types import ModuleType diff --git a/src/api/python/pycvc4.pyx b/src/api/python/pycvc4.pyx deleted file mode 100644 index 40766341a..000000000 --- a/src/api/python/pycvc4.pyx +++ /dev/null @@ -1,2 +0,0 @@ -include "cvc4kinds.pxi" -include "cvc4.pxi" diff --git a/src/api/python/pycvc5.pyx b/src/api/python/pycvc5.pyx new file mode 100644 index 000000000..f09300265 --- /dev/null +++ b/src/api/python/pycvc5.pyx @@ -0,0 +1,2 @@ +include "cvc5kinds.pxi" +include "cvc5.pxi" diff --git a/src/api/python/setup.py.in b/src/api/python/setup.py.in index 8919dd3f1..231f27c2a 100644 --- a/src/api/python/setup.py.in +++ b/src/api/python/setup.py.in @@ -35,9 +35,9 @@ class PyCVC5Install(install): c.finalize_options() c.run() -setup(name='pycvc4', +setup(name='pycvc5', version='${CVC5_MAJOR}.${CVC5_MINOR}.${CVC5_RELEASE}', - packages=['pycvc4'], - package_dir={'pycvc4': '${CMAKE_CURRENT_BINARY_DIR}/pycvc4'}, - package_data={'pycvc4': ['pycvc4.so']}, + packages=['pycvc5'], + package_dir={'pycvc5': '${CMAKE_CURRENT_BINARY_DIR}/pycvc5'}, + package_data={'pycvc5': ['pycvc5.so']}, cmdclass={'install': PyCVC5Install}) diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index 5da1216d0..cb4ba64a8 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -21,6 +21,10 @@ add_custom_target(gen-gitinfo BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/git_versioninfo.cpp COMMAND ${CMAKE_COMMAND} -DGIT_FOUND=${GIT_FOUND} -P GitInfo.cmake) + +# Generate cvc5config.h header +configure_file(cvc5config.h.in cvc5config.h) + #-----------------------------------------------------------------------------# set(LIBBASE_SOURCES @@ -79,8 +83,8 @@ set_source_files_properties( PROPERTIES GENERATED TRUE ) -add_library(cvc4base OBJECT ${LIBBASE_SOURCES}) +add_library(cvc5base OBJECT ${LIBBASE_SOURCES}) if(ENABLE_SHARED) - set_target_properties(cvc4base PROPERTIES POSITION_INDEPENDENT_CODE ON) + set_target_properties(cvc5base PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() -target_compile_definitions(cvc4base PRIVATE -D__BUILDING_CVC4LIB) +target_compile_definitions(cvc5base PRIVATE -D__BUILDING_CVC5LIB) diff --git a/src/base/check.h b/src/base/check.h index 5c7b7c9ed..be9de7d29 100644 --- a/src/base/check.h +++ b/src/base/check.h @@ -37,18 +37,7 @@ #include #include "base/exception.h" -#include "cvc4_export.h" - -// Define CVC5_NO_RETURN macro replacement for [[noreturn]]. -#if defined(SWIG) -#define CVC5_NO_RETURN -// SWIG does not yet support [[noreturn]] so emit nothing instead. -#else -#define CVC5_NO_RETURN [[noreturn]] -// Not checking for whether the compiler supports [[noreturn]] using -// __has_cpp_attribute as GCC 4.8 is too widespread and does not support this. -// We instead assume this is C++11 (or later) and [[noreturn]] is available. -#endif // defined(SWIG) +#include "cvc5_export.h" // Define CVC5_PREDICT_FALSE(x) that helps the compiler predict that x will be // false (if there is compiler support). @@ -91,11 +80,11 @@ namespace cvc5 { // Class that provides an ostream and whose destructor aborts! Direct usage of // this class is discouraged. -class CVC4_EXPORT FatalStream +class CVC5_EXPORT FatalStream { public: FatalStream(const char* function, const char* file, int line); - CVC5_NO_RETURN ~FatalStream(); + [[noreturn]] ~FatalStream(); std::ostream& stream(); diff --git a/src/base/configuration.cpp b/src/base/configuration.cpp index c78edbb9b..80d5bac57 100644 --- a/src/base/configuration.cpp +++ b/src/base/configuration.cpp @@ -21,8 +21,8 @@ #include #include -#include "cvc4autoconfig.h" #include "base/configuration_private.h" +#include "base/cvc5config.h" #if defined(CVC5_DEBUG) && defined(CVC5_TRACING) # include "base/Debug_tags.h" diff --git a/src/base/configuration.h b/src/base/configuration.h index 5a5109ab2..78e86f920 100644 --- a/src/base/configuration.h +++ b/src/base/configuration.h @@ -21,14 +21,14 @@ #include -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { /** * Represents the (static) configuration of cvc5. */ -class CVC4_EXPORT Configuration +class CVC5_EXPORT Configuration { private: /** Private default ctor: Disallow construction of this class */ diff --git a/src/base/cvc5config.h.in b/src/base/cvc5config.h.in new file mode 100644 index 000000000..a824a9c1f --- /dev/null +++ b/src/base/cvc5config.h.in @@ -0,0 +1,75 @@ +#ifndef CVC5__BASE__CVC5CONFIG_H +#define CVC5__BASE__CVC5CONFIG_H + +/* Major component of the version of cvc5. */ +#define CVC5_MAJOR @CVC5_MAJOR@ + +/* Minor component of the version of cvc5. */ +#define CVC5_MINOR @CVC5_MINOR@ + +/* Release component of the version of cvc5. */ +#define CVC5_RELEASE @CVC5_RELEASE@ + +/* Extraversion component of the version of cvc5. */ +#define CVC5_EXTRAVERSION "@CVC5_EXTRAVERSION@" + +/* Full release string for cvc5. */ +#define CVC5_RELEASE_STRING "@CVC5_RELEASE_STRING@" + +/* Full name of this package. */ +#define CVC5_PACKAGE_NAME "@CVC5_PACKAGE_NAME@" + +/* Define to 1 if cvc5 is built with (optional) GPLed library dependencies. */ +#cmakedefine01 CVC5_GPL_DEPS + +/* Define to use the CLN multi-precision arithmetic library. */ +#cmakedefine CVC5_CLN_IMP + +/* Define to use the GMP multi-precision arithmetic library. */ +#cmakedefine CVC5_GMP_IMP + +/* Define to use the libpoly polynomial library. */ +#cmakedefine CVC5_POLY_IMP + +/* Define to 1 if Boost threading library has support for thread attributes. */ +#cmakedefine01 BOOST_HAS_THREAD_ATTR + +/* Define if `clock_gettime' is supported by the platform. */ +#cmakedefine HAVE_CLOCK_GETTIME + +/* Define to 1 if the declaration of `optreset' is available. */ +#cmakedefine01 HAVE_DECL_OPTRESET + +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_EXT_STDIO_FILEBUF_H + +/* Define if `ffs' is supported by the platform. */ +#cmakedefine HAVE_FFS + +/* Define to 1 to use libedit. */ +#cmakedefine01 HAVE_LIBEDITLINE + +/* Define to 1 if `rl_completion_entry_function' returns (char *). */ +#cmakedefine01 EDITLINE_COMPENTRY_FUNC_RETURNS_CHARP + +/* Define if `sigaltstack' is supported by the platform. */ +#cmakedefine HAVE_SIGALTSTACK + +/* Define to 1 if `strerror_r' is supported by the platform. */ +#cmakedefine01 HAVE_STRERROR_R + +/* Define if `strtok_r' is supported by the platform. */ +#cmakedefine HAVE_STRTOK_R + +/* Define if `setitimer` is supported by the platform. */ +#cmakedefine01 HAVE_SETITIMER + +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_UNISTD_H + +/* Define to 1 if `strerror_r' returns (char *). */ +#cmakedefine01 STRERROR_R_CHAR_P + +#cmakedefine01 CVC5_STATIC_BUILD + +#endif /* __CVC5__CVC5AUTOCONFIG_H */ diff --git a/src/base/exception.h b/src/base/exception.h index ac97bdb2d..6b692abd9 100644 --- a/src/base/exception.h +++ b/src/base/exception.h @@ -22,7 +22,7 @@ #include #include -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { @@ -70,7 +70,7 @@ class Exception : public std::exception }; /* class Exception */ -class CVC4_EXPORT IllegalArgumentException : public Exception +class CVC5_EXPORT IllegalArgumentException : public Exception { protected: IllegalArgumentException() : Exception() {} @@ -137,7 +137,7 @@ inline void CheckArgument(bool cond, const T& arg CVC5_UNUSED) } } -class CVC4_EXPORT LastExceptionBuffer +class CVC5_EXPORT LastExceptionBuffer { public: LastExceptionBuffer(); diff --git a/src/base/output.cpp b/src/base/output.cpp index d894add40..a4003efd0 100644 --- a/src/base/output.cpp +++ b/src/base/output.cpp @@ -26,10 +26,10 @@ namespace cvc5 { null_streambuf null_sb; ostream null_os(&null_sb); -NullC nullCvc4Stream; +NullC nullStream; -const std::string CVC5ostream::s_tab = " "; -const int CVC5ostream::s_indentIosIndex = ios_base::xalloc(); +const std::string Cvc5ostream::s_tab = " "; +const int Cvc5ostream::s_indentIosIndex = ios_base::xalloc(); DebugC DebugChannel(&cout); WarningC WarningChannel(&cerr); diff --git a/src/base/output.h b/src/base/output.h index 9d4b4389f..c0dbb3d7c 100644 --- a/src/base/output.h +++ b/src/base/output.h @@ -25,13 +25,13 @@ #include #include -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { template std::ostream& operator<<(std::ostream& out, - const std::pair& p) CVC4_EXPORT; + const std::pair& p) CVC5_EXPORT; template std::ostream& operator<<(std::ostream& out, const std::pair& p) { @@ -58,9 +58,9 @@ class null_streambuf : public std::streambuf /** A null stream-buffer singleton */ extern null_streambuf null_sb; /** A null output stream singleton */ -extern std::ostream null_os CVC4_EXPORT; +extern std::ostream null_os CVC5_EXPORT; -class CVC4_EXPORT CVC5ostream +class CVC5_EXPORT Cvc5ostream { static const std::string s_tab; static const int s_indentIosIndex; @@ -74,11 +74,11 @@ class CVC4_EXPORT CVC5ostream std::ostream& (*const d_endl)(std::ostream&); // do not allow use - CVC5ostream& operator=(const CVC5ostream&); + Cvc5ostream& operator=(const Cvc5ostream&); public: - CVC5ostream() : d_os(NULL), d_firstColumn(false), d_endl(&std::endl) {} - explicit CVC5ostream(std::ostream* os) + Cvc5ostream() : d_os(NULL), d_firstColumn(false), d_endl(&std::endl) {} + explicit Cvc5ostream(std::ostream* os) : d_os(os), d_firstColumn(true), d_endl(&std::endl) { } @@ -97,7 +97,7 @@ class CVC4_EXPORT CVC5ostream } } - CVC5ostream& flush() + Cvc5ostream& flush() { if(d_os != NULL) { d_os->flush(); @@ -111,10 +111,10 @@ class CVC4_EXPORT CVC5ostream std::ostream* getStreamPointer() const { return d_os; } template - CVC5ostream& operator<<(T const& t) CVC4_EXPORT; + Cvc5ostream& operator<<(T const& t) CVC5_EXPORT; // support manipulators, endl, etc.. - CVC5ostream& operator<<(std::ostream& (*pf)(std::ostream&)) + Cvc5ostream& operator<<(std::ostream& (*pf)(std::ostream&)) { if(d_os != NULL) { d_os = &(*d_os << pf); @@ -125,40 +125,40 @@ class CVC4_EXPORT CVC5ostream } return *this; } - CVC5ostream& operator<<(std::ios& (*pf)(std::ios&)) + Cvc5ostream& operator<<(std::ios& (*pf)(std::ios&)) { if(d_os != NULL) { d_os = &(*d_os << pf); } return *this; } - CVC5ostream& operator<<(std::ios_base& (*pf)(std::ios_base&)) + Cvc5ostream& operator<<(std::ios_base& (*pf)(std::ios_base&)) { if(d_os != NULL) { d_os = &(*d_os << pf); } return *this; } - CVC5ostream& operator<<(CVC5ostream& (*pf)(CVC5ostream&)) + Cvc5ostream& operator<<(Cvc5ostream& (*pf)(Cvc5ostream&)) { return pf(*this); } -}; /* class CVC5ostream */ +}; /* class Cvc5ostream */ -inline CVC5ostream& push(CVC5ostream& stream) +inline Cvc5ostream& push(Cvc5ostream& stream) { stream.pushIndent(); return stream; } -inline CVC5ostream& pop(CVC5ostream& stream) +inline Cvc5ostream& pop(Cvc5ostream& stream) { stream.popIndent(); return stream; } template -CVC5ostream& CVC5ostream::operator<<(T const& t) +Cvc5ostream& Cvc5ostream::operator<<(T const& t) { if(d_os != NULL) { if(d_firstColumn) { @@ -182,11 +182,11 @@ class NullC { public: operator bool() const { return false; } - operator CVC5ostream() const { return CVC5ostream(); } + operator Cvc5ostream() const { return Cvc5ostream(); } operator std::ostream&() const { return null_os; } }; /* class NullC */ -extern NullC nullCvc4Stream CVC4_EXPORT; +extern NullC nullStream CVC5_EXPORT; /** The debug output class */ class DebugC @@ -197,12 +197,12 @@ class DebugC public: explicit DebugC(std::ostream* os) : d_os(os) {} - CVC5ostream operator()(const std::string& tag) const + Cvc5ostream operator()(const std::string& tag) const { if(!d_tags.empty() && d_tags.find(tag) != d_tags.end()) { - return CVC5ostream(d_os); + return Cvc5ostream(d_os); } else { - return CVC5ostream(); + return Cvc5ostream(); } } @@ -237,7 +237,7 @@ class WarningC public: explicit WarningC(std::ostream* os) : d_os(os) {} - CVC5ostream operator()() const { return CVC5ostream(d_os); } + Cvc5ostream operator()() const { return Cvc5ostream(d_os); } std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; } std::ostream& getStream() const { return *d_os; } @@ -271,7 +271,7 @@ class MessageC public: explicit MessageC(std::ostream* os) : d_os(os) {} - CVC5ostream operator()() const { return CVC5ostream(d_os); } + Cvc5ostream operator()() const { return Cvc5ostream(d_os); } std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; } std::ostream& getStream() const { return *d_os; } @@ -288,7 +288,7 @@ class NoticeC public: explicit NoticeC(std::ostream* os) : d_os(os) {} - CVC5ostream operator()() const { return CVC5ostream(d_os); } + Cvc5ostream operator()() const { return Cvc5ostream(d_os); } std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; } std::ostream& getStream() const { return *d_os; } @@ -305,7 +305,7 @@ class ChatC public: explicit ChatC(std::ostream* os) : d_os(os) {} - CVC5ostream operator()() const { return CVC5ostream(d_os); } + Cvc5ostream operator()() const { return Cvc5ostream(d_os); } std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; } std::ostream& getStream() const { return *d_os; } @@ -323,12 +323,12 @@ class TraceC public: explicit TraceC(std::ostream* os) : d_os(os) {} - CVC5ostream operator()(std::string tag) const + Cvc5ostream operator()(std::string tag) const { if(!d_tags.empty() && d_tags.find(tag) != d_tags.end()) { - return CVC5ostream(d_os); + return Cvc5ostream(d_os); } else { - return CVC5ostream(); + return Cvc5ostream(); } } @@ -370,12 +370,12 @@ public: explicit DumpOutC(std::ostream* os) : d_os(os) {} - CVC5ostream operator()(std::string tag) + Cvc5ostream operator()(std::string tag) { if(!d_tags.empty() && d_tags.find(tag) != d_tags.end()) { - return CVC5ostream(d_os); + return Cvc5ostream(d_os); } else { - return CVC5ostream(); + return Cvc5ostream(); } } @@ -399,74 +399,66 @@ public: }; /* class DumpOutC */ /** The debug output singleton */ -extern DebugC DebugChannel CVC4_EXPORT; +extern DebugC DebugChannel CVC5_EXPORT; /** The warning output singleton */ -extern WarningC WarningChannel CVC4_EXPORT; +extern WarningC WarningChannel CVC5_EXPORT; /** The message output singleton */ -extern MessageC MessageChannel CVC4_EXPORT; +extern MessageC MessageChannel CVC5_EXPORT; /** The notice output singleton */ -extern NoticeC NoticeChannel CVC4_EXPORT; +extern NoticeC NoticeChannel CVC5_EXPORT; /** The chat output singleton */ -extern ChatC ChatChannel CVC4_EXPORT; +extern ChatC ChatChannel CVC5_EXPORT; /** The trace output singleton */ -extern TraceC TraceChannel CVC4_EXPORT; +extern TraceC TraceChannel CVC5_EXPORT; /** The dump output singleton */ -extern DumpOutC DumpOutChannel CVC4_EXPORT; +extern DumpOutC DumpOutChannel CVC5_EXPORT; #ifdef CVC5_MUZZLE -#define Debug \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::DebugChannel +#define Debug ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::DebugChannel #define Warning \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::WarningChannel + ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::WarningChannel #define WarningOnce \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::WarningChannel + ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::WarningChannel #define CVC5Message \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::MessageChannel + ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::MessageChannel #define Notice \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::NoticeChannel -#define Chat \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::ChatChannel -#define Trace \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::TraceChannel + ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::NoticeChannel +#define Chat ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::ChatChannel +#define Trace ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::TraceChannel #define DumpOut \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::DumpOutChannel + ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::DumpOutChannel #else /* CVC5_MUZZLE */ #if defined(CVC5_DEBUG) && defined(CVC5_TRACING) #define Debug ::cvc5::DebugChannel #else /* CVC5_DEBUG && CVC5_TRACING */ -#define Debug \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::DebugChannel +#define Debug ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::DebugChannel #endif /* CVC5_DEBUG && CVC5_TRACING */ -#define Warning \ - (!::cvc5::WarningChannel.isOn()) ? ::cvc5::nullCvc4Stream \ - : ::cvc5::WarningChannel +#define Warning \ + (!::cvc5::WarningChannel.isOn()) ? ::cvc5::nullStream : ::cvc5::WarningChannel #define WarningOnce \ (!::cvc5::WarningChannel.isOn() \ || !::cvc5::WarningChannel.warnOnce(__FILE__, __LINE__)) \ - ? ::cvc5::nullCvc4Stream \ + ? ::cvc5::nullStream \ : ::cvc5::WarningChannel -#define CVC5Message \ - (!::cvc5::MessageChannel.isOn()) ? ::cvc5::nullCvc4Stream \ - : ::cvc5::MessageChannel -#define Notice \ - (!::cvc5::NoticeChannel.isOn()) ? ::cvc5::nullCvc4Stream \ - : ::cvc5::NoticeChannel +#define CVC5Message \ + (!::cvc5::MessageChannel.isOn()) ? ::cvc5::nullStream : ::cvc5::MessageChannel +#define Notice \ + (!::cvc5::NoticeChannel.isOn()) ? ::cvc5::nullStream : ::cvc5::NoticeChannel #define Chat \ - (!::cvc5::ChatChannel.isOn()) ? ::cvc5::nullCvc4Stream : ::cvc5::ChatChannel + (!::cvc5::ChatChannel.isOn()) ? ::cvc5::nullStream : ::cvc5::ChatChannel #ifdef CVC5_TRACING #define Trace ::cvc5::TraceChannel #else /* CVC5_TRACING */ -#define Trace \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::TraceChannel +#define Trace ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::TraceChannel #endif /* CVC5_TRACING */ #ifdef CVC5_DUMPING #define DumpOut ::cvc5::DumpOutChannel #else /* CVC5_DUMPING */ #define DumpOut \ - ::cvc5::__cvc4_true() ? ::cvc5::nullCvc4Stream : ::cvc5::DumpOutChannel + ::cvc5::__cvc5_true() ? ::cvc5::nullStream : ::cvc5::DumpOutChannel #endif /* CVC5_DUMPING */ #endif /* CVC5_MUZZLE */ @@ -475,7 +467,8 @@ extern DumpOutC DumpOutChannel CVC4_EXPORT; // because the ! will apply before the ? . // If a compiler error has directed you here, // just parenthesize it e.g. !(Debug("foo").isOn()) -class __cvc4_true { +class __cvc5_true +{ void operator!() CVC5_UNUSED; void operator~() CVC5_UNUSED; void operator-() CVC5_UNUSED; @@ -483,7 +476,7 @@ class __cvc4_true { public: inline operator bool() { return true; } -};/* __cvc4_true */ +}; /* __cvc5_true */ #if defined(CVC5_DEBUG) && defined(CVC5_TRACING) @@ -569,21 +562,21 @@ class ScopedTrace */ class IndentedScope { - CVC5ostream d_out; + Cvc5ostream d_out; public: - inline IndentedScope(CVC5ostream out); + inline IndentedScope(Cvc5ostream out); inline ~IndentedScope(); }; /* class IndentedScope */ #if defined(CVC5_DEBUG) && defined(CVC5_TRACING) -inline IndentedScope::IndentedScope(CVC5ostream out) : d_out(out) +inline IndentedScope::IndentedScope(Cvc5ostream out) : d_out(out) { d_out << push; } inline IndentedScope::~IndentedScope() { d_out << pop; } #else /* CVC5_DEBUG && CVC5_TRACING */ -inline IndentedScope::IndentedScope(CVC5ostream out) {} +inline IndentedScope::IndentedScope(Cvc5ostream out) {} inline IndentedScope::~IndentedScope() {} #endif /* CVC5_DEBUG && CVC5_TRACING */ diff --git a/src/context/CMakeLists.txt b/src/context/CMakeLists.txt index fb1d25111..73166462c 100644 --- a/src/context/CMakeLists.txt +++ b/src/context/CMakeLists.txt @@ -34,8 +34,8 @@ set(LIBCONTEXT_SOURCES context_mm.h ) -add_library(cvc4context OBJECT ${LIBCONTEXT_SOURCES}) +add_library(cvc5context OBJECT ${LIBCONTEXT_SOURCES}) if(ENABLE_SHARED) - set_target_properties(cvc4context PROPERTIES POSITION_INDEPENDENT_CODE ON) + set_target_properties(cvc5context PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() -target_compile_definitions(cvc4context PRIVATE -D__BUILDING_CVC4LIB) +target_compile_definitions(cvc5context PRIVATE -D__BUILDING_CVC5LIB) diff --git a/src/expr/CMakeLists.txt b/src/expr/CMakeLists.txt index 17bd49ea7..28cf23f57 100644 --- a/src/expr/CMakeLists.txt +++ b/src/expr/CMakeLists.txt @@ -13,7 +13,7 @@ # The build system configuration. ## -libcvc4_add_sources( +libcvc5_add_sources( array_store_all.cpp array_store_all.h ascription_type.cpp @@ -124,7 +124,7 @@ libcvc4_add_sources( uninterpreted_constant.h ) -libcvc4_add_sources(GENERATED +libcvc5_add_sources(GENERATED kind.cpp kind.h metakind.cpp diff --git a/src/expr/node.h b/src/expr/node.h index 9014016b9..5480b38ae 100644 --- a/src/expr/node.h +++ b/src/expr/node.h @@ -126,7 +126,7 @@ typedef NodeTemplate Node; * * More guidelines on when to use TNodes is available in the cvc5 * Developer's Guide: - * http://cvc4.cs.stanford.edu/wiki/Developer%27s_Guide#Dealing_with_expressions_.28Nodes_and_TNodes.29 + * https://github.com/CVC4/CVC4/wiki/Developer-Guide#dealing-with-expressions-nodes-and-tnodes */ typedef NodeTemplate TNode; @@ -389,20 +389,6 @@ public: return NodeTemplate(d_nv->getChild(i)); } - /* A note on isAtomic() and isAtomicFormula() (in CVC3 parlance).. - * - * It has been decided for now to hold off on implementations of - * these functions, as they may only be needed in CNF conversion, - * where it's pointless to do a lazy isAtomic determination by - * searching through the DAG, and storing it, since the result will - * only be used once. For more details see the 4/27/2010 cvc5 - * developer's meeting notes at: - * - * http://cvc4.cs.stanford.edu/wiki/Meeting_Minutes_-_April_27,_2010#isAtomic.28.29_and_isAtomicFormula.28.29 - */ - // bool containsDecision(); // is "atomic" - // bool properlyContainsDecision(); // maybe not atomic but all children are - /** * Returns true if this node represents a constant * @return true if const diff --git a/src/expr/node_manager.cpp b/src/expr/node_manager.cpp index 42be16742..70f221091 100644 --- a/src/expr/node_manager.cpp +++ b/src/expr/node_manager.cpp @@ -708,7 +708,7 @@ TypeNode NodeManager::TupleTypeCache::getTupleType( NodeManager * nm, std::vecto if( index==types.size() ){ if( d_data.isNull() ){ std::stringstream sst; - sst << "__cvc4_tuple"; + sst << "__cvc5_tuple"; for (unsigned i = 0; i < types.size(); ++ i) { sst << "_" << types[i]; } @@ -738,7 +738,7 @@ TypeNode NodeManager::RecTypeCache::getRecordType( NodeManager * nm, const Recor { if( d_data.isNull() ){ std::stringstream sst; - sst << "__cvc4_record"; + sst << "__cvc5_record"; for (const std::pair& i : rec) { sst << "_" << i.first << "_" << i.second; diff --git a/src/expr/node_manager.h b/src/expr/node_manager.h index 528cdcfc7..6cda50075 100644 --- a/src/expr/node_manager.h +++ b/src/expr/node_manager.h @@ -338,20 +338,6 @@ class NodeManager expr::NodeValue* child[N]; };/* struct NodeManager::NVStorage */ - /* A note on isAtomic() and isAtomicFormula() (in CVC3 parlance).. - * - * It has been decided for now to hold off on implementations of - * these functions, as they may only be needed in CNF conversion, - * where it's pointless to do a lazy isAtomic determination by - * searching through the DAG, and storing it, since the result will - * only be used once. For more details see the 4/27/2010 cvc5 - * developer's meeting notes at: - * - * http://cvc4.cs.stanford.edu/wiki/Meeting_Minutes_-_April_27,_2010#isAtomic.28.29_and_isAtomicFormula.28.29 - */ - // bool containsDecision(TNode); // is "atomic" - // bool properlyContainsDecision(TNode); // all children are atomic - // undefined private copy constructor (disallow copy) NodeManager(const NodeManager&) = delete; @@ -1079,7 +1065,7 @@ class NodeManager /** * This function gives developers a hook into the NodeManager. - * This can be changed in node_manager.cpp without recompiling most of cvc4. + * This can be changed in node_manager.cpp without recompiling most of cvc5. * * debugHook is a debugging only function, and should not be present in * any published code! diff --git a/src/expr/node_value.h b/src/expr/node_value.h index c45fadb5c..5f5ac7d86 100644 --- a/src/expr/node_value.h +++ b/src/expr/node_value.h @@ -330,7 +330,7 @@ class NodeValue /** The ID (0 is reserved for the null value) */ uint64_t d_id : NBITS_ID; - /** The expression's reference count. @see cvc4::Node. */ + /** The expression's reference count. */ uint32_t d_rc : NBITS_REFCOUNT; /** Kind of the expression */ diff --git a/src/expr/symbol_manager.h b/src/expr/symbol_manager.h index 53057d0b1..6cd0a1467 100644 --- a/src/expr/symbol_manager.h +++ b/src/expr/symbol_manager.h @@ -23,7 +23,7 @@ #include #include "api/cpp/cvc5.h" -#include "cvc4_export.h" +#include "cvc5_export.h" #include "expr/symbol_table.h" namespace cvc5 { @@ -36,7 +36,7 @@ namespace cvc5 { * Like SymbolTable, this class currently lives in src/expr/ since it uses * context-dependent data structures. */ -class CVC4_EXPORT SymbolManager +class CVC5_EXPORT SymbolManager { public: SymbolManager(api::Solver* s); diff --git a/src/expr/symbol_table.h b/src/expr/symbol_table.h index cd80c0eba..ddf26f9da 100644 --- a/src/expr/symbol_table.h +++ b/src/expr/symbol_table.h @@ -23,7 +23,7 @@ #include #include "base/exception.h" -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { @@ -33,7 +33,7 @@ class Sort; class Term; } // namespace api -class CVC4_EXPORT ScopeException : public Exception +class CVC5_EXPORT ScopeException : public Exception { }; @@ -42,7 +42,7 @@ class CVC4_EXPORT ScopeException : public Exception * nested scoping rules for declarations, with separate bindings for expressions * and types. */ -class CVC4_EXPORT SymbolTable +class CVC5_EXPORT SymbolTable { public: /** Create a symbol table. */ diff --git a/src/expr/type_node.h b/src/expr/type_node.h index 318d59613..32a1befbd 100644 --- a/src/expr/type_node.h +++ b/src/expr/type_node.h @@ -695,8 +695,6 @@ public: * Returns the leastUpperBound in the extended type lattice of the two types. * If this is \top, i.e. there is no inhabited type that contains both, * a TypeNode such that isNull() is true is returned. - * - * For more information see: http://cvc4.cs.nyu.edu/wiki/Cvc4_Type_Lattice */ static TypeNode leastCommonTypeNode(TypeNode t0, TypeNode t1); static TypeNode mostCommonTypeNode(TypeNode t0, TypeNode t1); diff --git a/src/fix-install-headers.sh b/src/fix-install-headers.sh index 49bade416..083cec852 100755 --- a/src/fix-install-headers.sh +++ b/src/fix-install-headers.sh @@ -8,4 +8,4 @@ find "$dir/include/cvc5/" -type f \ -exec sed -i'' -e 's/include.*"api\/cpp\/\(.*\)"/include /' {} + find "$dir/include/cvc5/" -type f \ - -exec sed -i'' -e 's/"cvc4_export.h"//' {} + + -exec sed -i'' -e 's/"cvc5_export.h"//' {} + diff --git a/src/include/cvc5_private.h b/src/include/cvc5_private.h index 6377997ef..101d7e4f2 100644 --- a/src/include/cvc5_private.h +++ b/src/include/cvc5_private.h @@ -17,11 +17,11 @@ #ifndef CVC5_PRIVATE_H #define CVC5_PRIVATE_H -#if !(defined(__BUILDING_CVC4LIB) || defined(__BUILDING_CVC4LIB_UNIT_TEST)) +#if !(defined(__BUILDING_CVC5LIB) || defined(__BUILDING_CVC5LIB_UNIT_TEST)) # error A private cvc5 header was included when not building the library or private unit test code. #endif -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #include "cvc5_public.h" #endif /* CVC5_PRIVATE_H */ diff --git a/src/include/cvc5_private_library.h b/src/include/cvc5_private_library.h index 36b2bbd04..b57292aa4 100644 --- a/src/include/cvc5_private_library.h +++ b/src/include/cvc5_private_library.h @@ -17,14 +17,14 @@ #ifndef CVC5_PRIVATE_LIBRARY_H #define CVC5_PRIVATE_LIBRARY_H -#if !(defined(__BUILDING_CVC4LIB) || defined(__BUILDING_CVC4LIB_UNIT_TEST) \ - || defined(__BUILDING_CVC4PARSERLIB) \ - || defined(__BUILDING_CVC4PARSERLIB_UNIT_TEST) \ - || defined(__BUILDING_CVC4DRIVER)) +#if !(defined(__BUILDING_CVC5LIB) || defined(__BUILDING_CVC5LIB_UNIT_TEST) \ + || defined(__BUILDING_CVC5PARSERLIB) \ + || defined(__BUILDING_CVC5PARSERLIB_UNIT_TEST) \ + || defined(__BUILDING_CVC5DRIVER)) # error A "private library" cvc5 header was included when not building the library, driver, or private unit test code. #endif -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #include "cvc5_public.h" #endif /* CVC5_PRIVATE_LIBRARY_H */ diff --git a/src/include/cvc5parser_private.h b/src/include/cvc5parser_private.h index 8f6142cbb..fe9508283 100644 --- a/src/include/cvc5parser_private.h +++ b/src/include/cvc5parser_private.h @@ -17,15 +17,15 @@ #ifndef CVC5PARSER_PRIVATE_H #define CVC5PARSER_PRIVATE_H -#if !(defined(__BUILDING_CVC4PARSERLIB) \ - || defined(__BUILDING_CVC4PARSERLIB_UNIT_TEST)) +#if !(defined(__BUILDING_CVC5PARSERLIB) \ + || defined(__BUILDING_CVC5PARSERLIB_UNIT_TEST)) # error A private cvc5 parser header was included when not building the parser library or private unit test code. #endif #include "cvc5parser_public.h" -// It would be nice to #include "cvc4autoconfig.h" here, but there are conflicts -// with antlr3's autoheader stuff, which they export :( +// It would be nice to #include "base/cvc5config.h" here, but there are +// conflicts with antlr3's autoheader stuff, which they export :( // -// #include "cvc4autoconfig.h" +// #include "base/cvc5config.h" #endif /* CVC5PARSER_PRIVATE_H */ diff --git a/src/lib/ffs.h b/src/lib/ffs.h index c9ad5422e..eb66e4172 100644 --- a/src/lib/ffs.h +++ b/src/lib/ffs.h @@ -19,7 +19,7 @@ #define CVC5__LIB__FFS_H //We include this for HAVE_FFS -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #ifdef HAVE_FFS diff --git a/src/lib/replacements.h b/src/lib/replacements.h index ad868d7c6..26749daf6 100644 --- a/src/lib/replacements.h +++ b/src/lib/replacements.h @@ -16,17 +16,19 @@ #ifndef CVC5__LIB__REPLACEMENTS_H #define CVC5__LIB__REPLACEMENTS_H -#if (defined(__BUILDING_CVC4LIB) || defined(__BUILDING_CVC4LIB_UNIT_TEST)) && !defined(__BUILDING_STATISTICS_FOR_EXPORT) +#if (defined(__BUILDING_CVC5LIB) || defined(__BUILDING_CVC5LIB_UNIT_TEST)) \ + && !defined(__BUILDING_STATISTICS_FOR_EXPORT) #include "cvc5_private.h" #else -# if defined(__BUILDING_CVC4PARSERLIB) || defined(__BUILDING_CVC4PARSERLIB_UNIT_TEST) +#if defined(__BUILDING_CVC5PARSERLIB) \ + || defined(__BUILDING_CVC5PARSERLIB_UNIT_TEST) #include "cvc5parser_private.h" # else -#if defined(__BUILDING_CVC4DRIVER) || defined(__BUILDING_CVC5_SYSTEM_TEST) \ +#if defined(__BUILDING_CVC5DRIVER) || defined(__BUILDING_CVC5_SYSTEM_TEST) \ || defined(__BUILDING_STATISTICS_FOR_EXPORT) -# include "cvc4autoconfig.h" +#include "base/cvc5config.h" # else -# error Must be building libcvc4 or libcvc4parser to use replacement functions. This is because replacement function headers should never be publicly-depended upon, as they should not be installed on user machines with 'make install'. +# error Must be building libcvc5 or libcvc5parser to use replacement functions. This is because replacement function headers should never be publicly-depended upon, as they should not be installed on user machines with 'make install'. # endif # endif #endif diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 868b7f97d..029397832 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -26,11 +26,11 @@ set(libmain_src_files ) #-----------------------------------------------------------------------------# -# Build object library since we will use the object files for cvc4-bin and +# Build object library since we will use the object files for cvc5-bin and # main-test library. add_library(main OBJECT ${libmain_src_files}) -target_compile_definitions(main PRIVATE -D__BUILDING_CVC4DRIVER) +target_compile_definitions(main PRIVATE -D__BUILDING_CVC5DRIVER) if(ENABLE_SHARED) set_target_properties(main PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() @@ -39,8 +39,8 @@ endif() # supported for cmake version >= 3.12. Hence, we have to manually add the # library dependencies for main. As a consequence, include directories from # dependencies are not propagated and we need to manually add the include -# directories of libcvc4 to main. -add_dependencies(main cvc4 cvc4parser gen-tokens) +# directories of libcvc5 to main. +add_dependencies(main cvc5 cvc5parser gen-tokens) # Note: This should not be required anymore as soon as we get rid of the # smt_engine.h include in src/main. smt_engine.h has transitive includes @@ -56,35 +56,35 @@ target_include_directories(main PRIVATE ${GMP_INCLUDES}) # that we don't have to include all object files of main into each api/unit # test. Do not link against main-test in any other case. add_library(main-test driver_unified.cpp $) -target_compile_definitions(main-test PRIVATE -D__BUILDING_CVC4DRIVER) -target_link_libraries(main-test PUBLIC cvc4 cvc4parser) +target_compile_definitions(main-test PRIVATE -D__BUILDING_CVC5DRIVER) +target_link_libraries(main-test PUBLIC cvc5 cvc5parser) if(USE_CLN) target_link_libraries(main-test PUBLIC CLN) endif() target_link_libraries(main-test PUBLIC GMP) #-----------------------------------------------------------------------------# -# cvc4 binary configuration +# cvc5 binary configuration -add_executable(cvc4-bin driver_unified.cpp main.cpp $) -target_compile_definitions(cvc4-bin PRIVATE -D__BUILDING_CVC4DRIVER) -set_target_properties(cvc4-bin +add_executable(cvc5-bin driver_unified.cpp main.cpp $) +target_compile_definitions(cvc5-bin PRIVATE -D__BUILDING_CVC5DRIVER) +set_target_properties(cvc5-bin PROPERTIES - OUTPUT_NAME cvc4 + OUTPUT_NAME cvc5 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -target_link_libraries(cvc4-bin PUBLIC cvc4 cvc4parser) +target_link_libraries(cvc5-bin PUBLIC cvc5 cvc5parser) if(USE_CLN) - target_link_libraries(cvc4-bin PUBLIC CLN) + target_link_libraries(cvc5-bin PUBLIC CLN) endif() -target_link_libraries(cvc4-bin PUBLIC GMP) +target_link_libraries(cvc5-bin PUBLIC GMP) if(PROGRAM_PREFIX) install(PROGRAMS - $ + $ DESTINATION ${CMAKE_INSTALL_BINDIR} - RENAME ${PROGRAM_PREFIX}cvc4) + RENAME ${PROGRAM_PREFIX}cvc5) else() - install(TARGETS cvc4-bin + install(TARGETS cvc5-bin DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() @@ -93,13 +93,13 @@ endif() # https://cmake.org/cmake/help/v3.0/prop_tgt/LINK_SEARCH_START_STATIC.html # https://cmake.org/cmake/help/v3.0/prop_tgt/LINK_SEARCH_END_STATIC.html if(ENABLE_STATIC_BINARY) - set_target_properties(cvc4-bin PROPERTIES LINK_FLAGS -static) - set_target_properties(cvc4-bin PROPERTIES LINK_SEARCH_START_STATIC ON) - set_target_properties(cvc4-bin PROPERTIES LINK_SEARCH_END_STATIC ON) + set_target_properties(cvc5-bin PROPERTIES LINK_FLAGS -static) + set_target_properties(cvc5-bin PROPERTIES LINK_SEARCH_START_STATIC ON) + set_target_properties(cvc5-bin PROPERTIES LINK_SEARCH_END_STATIC ON) endif() if(USE_EDITLINE) - target_link_libraries(cvc4-bin PUBLIC ${Editline_LIBRARIES}) + target_link_libraries(cvc5-bin PUBLIC ${Editline_LIBRARIES}) target_link_libraries(main-test PUBLIC ${Editline_LIBRARIES}) target_include_directories(main PUBLIC ${Editline_INCLUDE_DIRS}) endif() diff --git a/src/main/driver_unified.cpp b/src/main/driver_unified.cpp index 2481eda10..9b0ea4759 100644 --- a/src/main/driver_unified.cpp +++ b/src/main/driver_unified.cpp @@ -10,7 +10,7 @@ * directory for licensing information. * **************************************************************************** * - * Driver for cvc5 executable (cvc4). + * Driver for cvc5 executable (cvc5). */ #include @@ -26,8 +26,8 @@ #include "api/cpp/cvc5.h" #include "base/configuration.h" +#include "base/cvc5config.h" #include "base/output.h" -#include "cvc4autoconfig.h" #include "main/command_executor.h" #include "main/interactive_shell.h" #include "main/main.h" @@ -91,7 +91,8 @@ void printUsage(Options& opts, bool full) { } } -int runCvc4(int argc, char* argv[], Options& opts) { +int runCvc5(int argc, char* argv[], Options& opts) +{ main::totalTime = std::make_unique(); // For the signal handlers' benefit pOptions = &opts; diff --git a/src/main/interactive_shell.cpp b/src/main/interactive_shell.cpp index 127b2c14d..516f9e621 100644 --- a/src/main/interactive_shell.cpp +++ b/src/main/interactive_shell.cpp @@ -27,7 +27,7 @@ #include // This must go before HAVE_LIBEDITLINE. -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #if HAVE_LIBEDITLINE #include @@ -112,13 +112,13 @@ InteractiveShell::InteractiveShell(api::Solver* solver, SymbolManager* sm) OutputLanguage lang = toOutputLanguage(d_options.getInputLanguage()); switch(lang) { case output::LANG_CVC: - d_historyFilename = string(getenv("HOME")) + "/.cvc4_history"; + d_historyFilename = string(getenv("HOME")) + "/.cvc5_history"; commandsBegin = cvc_commands; commandsEnd = cvc_commands + sizeof(cvc_commands) / sizeof(*cvc_commands); break; case output::LANG_TPTP: - d_historyFilename = string(getenv("HOME")) + "/.cvc4_history_tptp"; + d_historyFilename = string(getenv("HOME")) + "/.cvc5_history_tptp"; commandsBegin = tptp_commands; commandsEnd = tptp_commands + sizeof(tptp_commands) / sizeof(*tptp_commands); @@ -126,7 +126,7 @@ InteractiveShell::InteractiveShell(api::Solver* solver, SymbolManager* sm) default: if (language::isOutputLang_smt2(lang)) { - d_historyFilename = string(getenv("HOME")) + "/.cvc4_history_smtlib2"; + d_historyFilename = string(getenv("HOME")) + "/.cvc5_history_smtlib2"; commandsBegin = smt2_commands; commandsEnd = smt2_commands + sizeof(smt2_commands) / sizeof(*smt2_commands); diff --git a/src/main/main.cpp b/src/main/main.cpp index a4e70be89..6a7baebb3 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -41,13 +41,13 @@ using namespace cvc5::language; * cvc5's main() routine is just an exception-safe wrapper around cvc5. * Please don't construct anything here. Even if the constructor is * inside the try { }, an exception during destruction can cause - * problems. That's why main() wraps runCvc4() in the first place. - * Put everything in runCvc4(). + * problems. That's why main() wraps runCvc5() in the first place. + * Put everything in runCvc5(). */ int main(int argc, char* argv[]) { Options opts; try { - return runCvc4(argc, argv, opts); + return runCvc5(argc, argv, opts); } catch(OptionException& e) { #ifdef CVC5_COMPETITION_MODE *opts.getOut() << "unknown" << endl; diff --git a/src/main/main.h b/src/main/main.h index 121f9d951..54abbdbe9 100644 --- a/src/main/main.h +++ b/src/main/main.h @@ -18,8 +18,8 @@ #include #include +#include "base/cvc5config.h" #include "base/exception.h" -#include "cvc4autoconfig.h" #include "options/options.h" #ifndef CVC5__MAIN__MAIN_H @@ -62,19 +62,11 @@ extern bool segvSpin; /** A pointer to the options in play */ extern thread_local Options* pOptions; -/** Initialize the driver. Sets signal handlers for SIGINT and SIGSEGV. - * This can throw a cvc5::Exception. - */ -void cvc4_init(); - -/** Shutdown the driver. Frees memory for the signal handlers. */ -void cvc4_shutdown() noexcept; - } // namespace main } // namespace cvc5 -/** Actual Cvc4 driver functions **/ -int runCvc4(int argc, char* argv[], cvc5::Options&); +/** Actual cvc5 driver functions **/ +int runCvc5(int argc, char* argv[], cvc5::Options&); void printUsage(cvc5::Options&, bool full = false); #endif /* CVC5__MAIN__MAIN_H */ diff --git a/src/main/signal_handlers.cpp b/src/main/signal_handlers.cpp index 9a6e34075..503bbc198 100644 --- a/src/main/signal_handlers.cpp +++ b/src/main/signal_handlers.cpp @@ -32,8 +32,8 @@ #endif /* __WIN32__ */ +#include "base/cvc5config.h" #include "base/exception.h" -#include "cvc4autoconfig.h" #include "main/command_executor.h" #include "main/main.h" #include "options/options.h" @@ -73,8 +73,8 @@ void timeout_handler() #ifndef __WIN32__ #ifdef HAVE_SIGALTSTACK -size_t cvc4StackSize; -void* cvc4StackBase; +size_t stackSize; +void* stackBase; #endif /* HAVE_SIGALTSTACK */ /** Handler for SIGXCPU and SIGALRM, i.e., timeout. */ @@ -100,15 +100,15 @@ void sigint_handler(int sig, siginfo_t* info, void*) /** Handler for SIGSEGV (segfault). */ void segv_handler(int sig, siginfo_t* info, void* c) { - uintptr_t extent = reinterpret_cast(cvc4StackBase) - cvc4StackSize; + uintptr_t extent = reinterpret_cast(stackBase) - stackSize; uintptr_t addr = reinterpret_cast(info->si_addr); #ifdef CVC5_DEBUG safe_print(STDERR_FILENO, "cvc5 suffered a segfault in DEBUG mode.\n"); safe_print(STDERR_FILENO, "Offending address is "); safe_print(STDERR_FILENO, info->si_addr); safe_print(STDERR_FILENO, "\n"); - // cerr << "base is " << (void*)cvc4StackBase << endl; - // cerr << "size is " << cvc4StackSize << endl; + // cerr << "base is " << (void*)stackBase << endl; + // cerr << "size is " << stackSize << endl; // cerr << "extent is " << (void*)extent << endl; if (addr >= extent && addr <= extent + 10 * 1024) { @@ -211,7 +211,7 @@ void ill_handler(int sig, siginfo_t* info, void*) static terminate_handler default_terminator; -void cvc4terminate() +void cvc5terminate() { set_terminate(default_terminator); #ifdef CVC5_DEBUG @@ -301,8 +301,8 @@ void install() throw Exception(string("sigaltstack() failure: ") + strerror(errno)); } - cvc4StackSize = limit.rlim_cur; - cvc4StackBase = ss.ss_sp; + stackSize = limit.rlim_cur; + stackBase = ss.ss_sp; struct sigaction act4; act4.sa_sigaction = segv_handler; @@ -325,16 +325,16 @@ void install() #endif /* __WIN32__ */ - default_terminator = set_terminate(cvc4terminate); + default_terminator = set_terminate(cvc5terminate); } void cleanup() noexcept { #ifndef __WIN32__ #ifdef HAVE_SIGALTSTACK - free(cvc4StackBase); - cvc4StackBase = NULL; - cvc4StackSize = 0; + free(stackBase); + stackBase = nullptr; + stackSize = 0; #endif /* HAVE_SIGALTSTACK */ #endif /* __WIN32__ */ } diff --git a/src/main/time_limit.cpp b/src/main/time_limit.cpp index bd41ed7ed..82cfda017 100644 --- a/src/main/time_limit.cpp +++ b/src/main/time_limit.cpp @@ -41,7 +41,7 @@ #include "time_limit.h" -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #if HAVE_SETITIMER #include diff --git a/src/options/CMakeLists.txt b/src/options/CMakeLists.txt index 77c4d5a09..424f5e0df 100644 --- a/src/options/CMakeLists.txt +++ b/src/options/CMakeLists.txt @@ -16,7 +16,7 @@ # Check if the toml Python module is installed. check_python_module("toml") -libcvc4_add_sources( +libcvc5_add_sources( base_handlers.h decision_weight.h didyoumean.cpp @@ -66,7 +66,7 @@ set(options_toml_files string(REPLACE "toml" "cpp;" options_gen_cpp_files ${options_toml_files}) string(REPLACE "toml" "h;" options_gen_h_files ${options_toml_files}) -libcvc4_add_sources(GENERATED options.cpp ${options_gen_cpp_files}) +libcvc5_add_sources(GENERATED options.cpp ${options_gen_cpp_files}) list_prepend(options_toml_files "${CMAKE_CURRENT_LIST_DIR}/" abs_toml_files) @@ -88,7 +88,7 @@ add_custom_command( module_template.cpp options_holder_template.h options_template.cpp - ${CMAKE_CURRENT_BINARY_DIR}/../../doc/cvc4.1_template + ${CMAKE_CURRENT_BINARY_DIR}/../../doc/cvc5.1_template ${CMAKE_CURRENT_BINARY_DIR}/../../doc/SmtEngine.3cvc_template ${CMAKE_CURRENT_BINARY_DIR}/../../doc/options.3cvc_template ) diff --git a/src/options/datatypes_options.toml b/src/options/datatypes_options.toml index a43641c73..164dd736b 100644 --- a/src/options/datatypes_options.toml +++ b/src/options/datatypes_options.toml @@ -4,7 +4,7 @@ header = "options/datatypes_options.h" # How to handle selectors applied to incorrect constructors. If this option is set, # then we do not rewrite such a selector term to an arbitrary ground term. -# For example, by default cvc4 considers cdr( nil ) = nil. If this option is set, then +# For example, by default cvc5 considers cdr( nil ) = nil. If this option is set, then # cdr( nil ) has no set value. [[option]] name = "dtRewriteErrorSel" diff --git a/src/options/language.h b/src/options/language.h index 54e0e9dfa..04182cdd9 100644 --- a/src/options/language.h +++ b/src/options/language.h @@ -21,14 +21,14 @@ #include #include -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { namespace language { namespace input { -enum CVC4_EXPORT Language +enum CVC5_EXPORT Language { // SPECIAL "NON-LANGUAGE" LANGUAGES HAVE ENUM VALUE < 0 @@ -60,7 +60,7 @@ enum CVC4_EXPORT Language LANG_MAX }; /* enum Language */ -inline std::ostream& operator<<(std::ostream& out, Language lang) CVC4_EXPORT; +inline std::ostream& operator<<(std::ostream& out, Language lang) CVC5_EXPORT; inline std::ostream& operator<<(std::ostream& out, Language lang) { switch(lang) { case LANG_AUTO: @@ -84,7 +84,7 @@ inline std::ostream& operator<<(std::ostream& out, Language lang) { namespace output { -enum CVC4_EXPORT Language +enum CVC5_EXPORT Language { // SPECIAL "NON-LANGUAGE" LANGUAGES HAVE ENUM VALUE < 0 @@ -119,7 +119,7 @@ enum CVC4_EXPORT Language LANG_MAX }; /* enum Language */ -inline std::ostream& operator<<(std::ostream& out, Language lang) CVC4_EXPORT; +inline std::ostream& operator<<(std::ostream& out, Language lang) CVC5_EXPORT; inline std::ostream& operator<<(std::ostream& out, Language lang) { switch(lang) { case LANG_SMTLIB_V2_6: out << "LANG_SMTLIB_V2_6"; break; @@ -147,24 +147,24 @@ typedef language::output::Language OutputLanguage; namespace language { /** Is the language a variant of the smtlib version 2 language? */ -bool isInputLang_smt2(InputLanguage lang) CVC4_EXPORT; -bool isOutputLang_smt2(OutputLanguage lang) CVC4_EXPORT; +bool isInputLang_smt2(InputLanguage lang) CVC5_EXPORT; +bool isOutputLang_smt2(OutputLanguage lang) CVC5_EXPORT; /** * Is the language smtlib 2.6 or above? If exact=true, then this method returns * false if the input language is not exactly SMT-LIB 2.6. */ -bool isInputLang_smt2_6(InputLanguage lang, bool exact = false) CVC4_EXPORT; -bool isOutputLang_smt2_6(OutputLanguage lang, bool exact = false) CVC4_EXPORT; +bool isInputLang_smt2_6(InputLanguage lang, bool exact = false) CVC5_EXPORT; +bool isOutputLang_smt2_6(OutputLanguage lang, bool exact = false) CVC5_EXPORT; /** Is the language a variant of the SyGuS input language? */ -bool isInputLangSygus(InputLanguage lang) CVC4_EXPORT; -bool isOutputLangSygus(OutputLanguage lang) CVC4_EXPORT; +bool isInputLangSygus(InputLanguage lang) CVC5_EXPORT; +bool isOutputLangSygus(OutputLanguage lang) CVC5_EXPORT; -InputLanguage toInputLanguage(OutputLanguage language) CVC4_EXPORT; -OutputLanguage toOutputLanguage(InputLanguage language) CVC4_EXPORT; -InputLanguage toInputLanguage(std::string language) CVC4_EXPORT; -OutputLanguage toOutputLanguage(std::string language) CVC4_EXPORT; +InputLanguage toInputLanguage(OutputLanguage language) CVC5_EXPORT; +OutputLanguage toOutputLanguage(InputLanguage language) CVC5_EXPORT; +InputLanguage toInputLanguage(std::string language) CVC5_EXPORT; +OutputLanguage toOutputLanguage(std::string language) CVC5_EXPORT; } // namespace language } // namespace cvc5 diff --git a/src/options/mkoptions.py b/src/options/mkoptions.py index 4fe93c129..c28a6f0cf 100644 --- a/src/options/mkoptions.py +++ b/src/options/mkoptions.py @@ -33,7 +33,7 @@ - module_template.h Directory must contain: - - cvc4.1_template + - cvc5.1_template - options.3cvc_template - SmtEngine.3cvc_template These files get generated during autogen.sh from the corresponding *.in @@ -49,7 +49,7 @@ - /MODULE_options.cpp - /options_holder.h - /options.cpp - - /cvc4.1 + - /cvc5.1 - /options.3 - /SmtEngine.3 """ @@ -1133,7 +1133,7 @@ def codegen_all_modules(modules, dst_dir, tpl_options, tpl_options_holder, getoption_handlers='\n'.join(getoption_handlers) )) - write_file(doc_dir, 'cvc4.1', tpl_man_cvc.format( + write_file(doc_dir, 'cvc5.1', tpl_man_cvc.format( man_common='\n'.join(man_common), man_others='\n'.join(man_others) )) @@ -1330,7 +1330,7 @@ def mkoptions_main(): tpl_options_holder = read_tpl(src_dir, 'options_holder_template.h') # Read documentation template files from documentation directory. - tpl_man_cvc = read_tpl(doc_dir, 'cvc4.1_template') + tpl_man_cvc = read_tpl(doc_dir, 'cvc5.1_template') tpl_man_smt = read_tpl(doc_dir, 'SmtEngine.3cvc_template') tpl_man_int = read_tpl(doc_dir, 'options.3cvc_template') diff --git a/src/options/open_ostream.cpp b/src/options/open_ostream.cpp index fa36738d9..3b13c42e2 100644 --- a/src/options/open_ostream.cpp +++ b/src/options/open_ostream.cpp @@ -60,15 +60,16 @@ std::pair< bool, std::ostream* > OstreamOpener::open(const std::string& optarg) std::ofstream::out | std::ofstream::trunc); if(outStream == NULL || !*outStream) { std::stringstream ss; - ss << "Cannot open " << d_channelName << " file: `" - << optarg << "': " << cvc4_errno_failreason(); + ss << "Cannot open " << d_channelName << " file: `" << optarg + << "': " << cvc5_errno_failreason(); throw OptionException(ss.str()); } return make_pair(true, outStream); } } -std::string cvc4_errno_failreason() { +std::string cvc5_errno_failreason() +{ #if HAVE_STRERROR_R #if STRERROR_R_CHAR_P if(errno != 0) { diff --git a/src/options/open_ostream.h b/src/options/open_ostream.h index b135ef7ce..162bf3f11 100644 --- a/src/options/open_ostream.h +++ b/src/options/open_ostream.h @@ -54,7 +54,7 @@ class OstreamOpener { }; /* class OstreamOpener */ -std::string cvc4_errno_failreason(); +std::string cvc5_errno_failreason(); } // namespace cvc5 diff --git a/src/options/option_exception.h b/src/options/option_exception.h index 4cfe55a31..f5590709e 100644 --- a/src/options/option_exception.h +++ b/src/options/option_exception.h @@ -19,7 +19,7 @@ #define CVC5__OPTION_EXCEPTION_H #include "base/exception.h" -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { @@ -29,7 +29,7 @@ namespace cvc5 { * name is itself unrecognized, a UnrecognizedOptionException (a derived * class, below) should be used instead. */ -class CVC4_EXPORT OptionException : public cvc5::Exception +class CVC5_EXPORT OptionException : public cvc5::Exception { public: OptionException(const std::string& s) : cvc5::Exception(s_errPrefix + s) {} diff --git a/src/options/options.h b/src/options/options.h index 79b00de30..67707c990 100644 --- a/src/options/options.h +++ b/src/options/options.h @@ -25,7 +25,7 @@ #include "base/listener.h" #include "base/modal_exception.h" -#include "cvc4_export.h" +#include "cvc5_export.h" #include "options/language.h" #include "options/option_exception.h" #include "options/printer_modes.h" @@ -42,7 +42,7 @@ namespace options { class OptionsListener; -class CVC4_EXPORT Options +class CVC5_EXPORT Options { friend api::Solver; /** The struct that holds all option values. */ diff --git a/src/options/options_handler.cpp b/src/options/options_handler.cpp index 3c5616c73..0e2315aa0 100644 --- a/src/options/options_handler.cpp +++ b/src/options/options_handler.cpp @@ -15,15 +15,14 @@ #include "options/options_handler.h" +#include #include #include -#include - -#include "cvc4autoconfig.h" #include "base/check.h" #include "base/configuration.h" #include "base/configuration_private.h" +#include "base/cvc5config.h" #include "base/exception.h" #include "base/modal_exception.h" #include "base/output.h" diff --git a/src/options/options_template.cpp b/src/options/options_template.cpp index 91d06dec2..f24f83b2b 100644 --- a/src/options/options_template.cpp +++ b/src/options/options_template.cpp @@ -15,7 +15,7 @@ #if !defined(_BSD_SOURCE) && defined(__MINGW32__) && !defined(__MINGW64__) // force use of optreset; mingw32 croaks on argv-switching otherwise -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #define _BSD_SOURCE #undef HAVE_DECL_OPTRESET #define HAVE_DECL_OPTRESET 1 @@ -58,7 +58,7 @@ extern int optreset; ${headers_module}$ #include "options/options_holder.h" -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #include "options/base_handlers.h" ${headers_handler}$ diff --git a/src/options/set_language.h b/src/options/set_language.h index 5ff7cdb7b..45add38ac 100644 --- a/src/options/set_language.h +++ b/src/options/set_language.h @@ -20,7 +20,7 @@ #include -#include "cvc4_export.h" +#include "cvc5_export.h" #include "options/language.h" namespace cvc5 { @@ -29,7 +29,7 @@ namespace language { /** * IOStream manipulator to set the output language for Exprs. */ -class CVC4_EXPORT SetLanguage +class CVC5_EXPORT SetLanguage { public: /** @@ -87,7 +87,7 @@ private: * * The setting stays permanently (until set again) with the stream. */ -std::ostream& operator<<(std::ostream& out, SetLanguage l) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, SetLanguage l) CVC5_EXPORT; } // namespace language } // namespace cvc5 diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index da6b1bd58..f2596ceeb 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -19,9 +19,9 @@ find_package(ANTLR3 3.4 REQUIRED) find_package(Java COMPONENTS Runtime REQUIRED) #-----------------------------------------------------------------------------# -# libcvc4parser source files +# libcvc5parser source files -set(libcvc4parser_src_files +set(libcvc5parser_src_files antlr_input.cpp antlr_input.h antlr_input_imports.cpp @@ -96,28 +96,28 @@ foreach(lang Cvc Smt2 Tptp) ${gen_src_files} PROPERTIES COMPILE_FLAGS "-Wno-all -Wno-error") # Add generated source files to the parser source files - list(APPEND libcvc4parser_src_files ${gen_src_files}) + list(APPEND libcvc5parser_src_files ${gen_src_files}) endforeach() #-----------------------------------------------------------------------------# -# libcvc4parser configuration +# libcvc5parser configuration -add_library(cvc4parser ${libcvc4parser_src_files}) -set_target_properties(cvc4parser PROPERTIES SOVERSION ${CVC5_SOVERSION}) -target_compile_definitions(cvc4parser PRIVATE -D__BUILDING_CVC4PARSERLIB) -target_link_libraries(cvc4parser PUBLIC cvc4) -target_link_libraries(cvc4parser PRIVATE ANTLR3) +add_library(cvc5parser ${libcvc5parser_src_files}) +set_target_properties(cvc5parser PROPERTIES SOVERSION ${CVC5_SOVERSION}) +target_compile_definitions(cvc5parser PRIVATE -D__BUILDING_CVC5PARSERLIB) +target_link_libraries(cvc5parser PUBLIC cvc5) +target_link_libraries(cvc5parser PRIVATE ANTLR3) -install(TARGETS cvc4parser - EXPORT cvc4-targets +install(TARGETS cvc5parser + EXPORT cvc5-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}) # The generated lexer/parser files define some functions as # __declspec(dllexport) via the ANTLR3_API macro, which leads to lots of -# unresolved symbols when linking against libcvc4parser. +# unresolved symbols when linking against libcvc5parser. # -Wl,--export-all-symbols makes sure that all symbols are exported when # building a DLL. if(CVC5_WINDOWS_BUILD) - set_target_properties(cvc4parser + set_target_properties(cvc5parser PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") endif() diff --git a/src/parser/antlr_tracing.h b/src/parser/antlr_tracing.h index 595a2d784..e9d1d0758 100644 --- a/src/parser/antlr_tracing.h +++ b/src/parser/antlr_tracing.h @@ -44,7 +44,8 @@ */ /** A "System" object, just like in Java! */ -static struct __Cvc4System { +static struct __Cvc5System +{ /** * Helper class just to handle arbitrary string concatenation * with Java syntax. In C++ you cannot do "char*" + "char*", @@ -76,7 +77,11 @@ static struct __Cvc4System { // These are highly dependent on the bugs in a particular ANTLR release. // These seem to work with ANTLR 3.3 as of 4/23/2011. A different trick // works with ANTLR 3.2. EXPECT LOTS OF COMPILER WARNINGS. -#define println(x) println(({int failed=0;__Cvc4System::JavaPrinter()+x;})) +#define println(x) \ + println(({ \ + int failed = 0; \ + __Cvc5System::JavaPrinter() + x; \ + })) #undef ANTLR3_FPRINTF #define ANTLR3_FPRINTF(args...) {int failed=0;fprintf(args);} #undef ANTLR3_PRINTF diff --git a/src/parser/input.h b/src/parser/input.h index fb7ce2b40..47453e367 100644 --- a/src/parser/input.h +++ b/src/parser/input.h @@ -25,7 +25,7 @@ #include #include "api/cpp/cvc5.h" -#include "cvc4_export.h" +#include "cvc5_export.h" #include "options/language.h" #include "parser/parser_exception.h" @@ -78,7 +78,7 @@ class Parser; * for the given input language and attach it to an input source of the * appropriate type. */ -class CVC4_EXPORT Input +class CVC5_EXPORT Input { friend class Parser; // for parseError, parseCommand, parseExpr friend class ParserBuilder; diff --git a/src/parser/parser.h b/src/parser/parser.h index da35606c1..42baf98cd 100644 --- a/src/parser/parser.h +++ b/src/parser/parser.h @@ -23,7 +23,7 @@ #include #include "api/cpp/cvc5.h" -#include "cvc4_export.h" +#include "cvc5_export.h" #include "expr/kind.h" #include "expr/symbol_manager.h" #include "expr/symbol_table.h" @@ -101,7 +101,7 @@ inline std::ostream& operator<<(std::ostream& out, SymbolType type) { * name of the file, line number and column information, and in-scope * declarations. */ -class CVC4_EXPORT Parser +class CVC5_EXPORT Parser { friend class ParserBuilder; private: diff --git a/src/parser/parser_builder.h b/src/parser/parser_builder.h index b0f9e35e6..5d73fedfa 100644 --- a/src/parser/parser_builder.h +++ b/src/parser/parser_builder.h @@ -20,7 +20,7 @@ #include -#include "cvc4_export.h" +#include "cvc5_export.h" #include "options/language.h" #include "parser/input.h" @@ -42,7 +42,7 @@ class Parser; * called any number of times on an instance and will generate a fresh * parser each time. */ -class CVC4_EXPORT ParserBuilder +class CVC5_EXPORT ParserBuilder { enum InputType { FILE_INPUT, diff --git a/src/parser/parser_exception.h b/src/parser/parser_exception.h index 0372661a2..124013183 100644 --- a/src/parser/parser_exception.h +++ b/src/parser/parser_exception.h @@ -19,16 +19,16 @@ #define CVC5__PARSER__PARSER_EXCEPTION_H #include -#include #include +#include #include "base/exception.h" -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { namespace parser { -class CVC4_EXPORT ParserException : public Exception +class CVC5_EXPORT ParserException : public Exception { public: // Constructors diff --git a/src/prop/bvminisat/bvminisat.cpp b/src/prop/bvminisat/bvminisat.cpp index 7c7196822..1d8bf8f17 100644 --- a/src/prop/bvminisat/bvminisat.cpp +++ b/src/prop/bvminisat/bvminisat.cpp @@ -12,7 +12,7 @@ * * SAT Solver. * - * Implementation of the minisat for cvc4 (bit-vectors). + * Implementation of the minisat for cvc5 (bit-vectors). */ #include "prop/bvminisat/bvminisat.h" diff --git a/src/prop/bvminisat/bvminisat.h b/src/prop/bvminisat/bvminisat.h index 9d363224f..ea509ece6 100644 --- a/src/prop/bvminisat/bvminisat.h +++ b/src/prop/bvminisat/bvminisat.h @@ -12,7 +12,7 @@ * * SAT Solver. * - * Implementation of the minisat for cvc4 (bit-vectors). + * Implementation of the minisat for cvc5 (bit-vectors). */ #include "cvc5_private.h" diff --git a/src/prop/bvminisat/core/Solver.h b/src/prop/bvminisat/core/Solver.h index 3826eb9f9..d2423a71a 100644 --- a/src/prop/bvminisat/core/Solver.h +++ b/src/prop/bvminisat/core/Solver.h @@ -79,7 +79,7 @@ private: /** To notify */ Notify* d_notify; - /** Cvc4 context */ + /** cvc5 context */ cvc5::context::Context* c; /** True constant */ diff --git a/src/prop/cryptominisat.cpp b/src/prop/cryptominisat.cpp index eee0842de..ef13a0b46 100644 --- a/src/prop/cryptominisat.cpp +++ b/src/prop/cryptominisat.cpp @@ -12,7 +12,7 @@ * * SAT Solver. * - * Implementation of the cryptominisat for cvc4 (bit-vectors). + * Implementation of the cryptominisat for cvc5 (bit-vectors). */ #include "prop/cryptominisat.h" diff --git a/src/prop/cryptominisat.h b/src/prop/cryptominisat.h index f19821067..58ce33bcf 100644 --- a/src/prop/cryptominisat.h +++ b/src/prop/cryptominisat.h @@ -12,7 +12,7 @@ * * SAT Solver. * - * Implementation of the cryptominisat sat solver for cvc4 (bit-vectors). + * Implementation of the cryptominisat sat solver for cvc5 (bit-vectors). */ #include "cvc5_private.h" diff --git a/src/smt/command.h b/src/smt/command.h index 07dfa2b30..41a3639c9 100644 --- a/src/smt/command.h +++ b/src/smt/command.h @@ -28,7 +28,7 @@ #include #include "api/cpp/cvc5.h" -#include "cvc4_export.h" +#include "cvc5_export.h" #include "options/language.h" namespace cvc5 { @@ -53,12 +53,12 @@ class Model; * @param sexpr the symbolic expression to convert * @return the symbolic expression as string */ -std::string sexprToString(api::Term sexpr) CVC4_EXPORT; +std::string sexprToString(api::Term sexpr) CVC5_EXPORT; -std::ostream& operator<<(std::ostream&, const Command&) CVC4_EXPORT; -std::ostream& operator<<(std::ostream&, const Command*) CVC4_EXPORT; -std::ostream& operator<<(std::ostream&, const CommandStatus&) CVC4_EXPORT; -std::ostream& operator<<(std::ostream&, const CommandStatus*) CVC4_EXPORT; +std::ostream& operator<<(std::ostream&, const Command&) CVC5_EXPORT; +std::ostream& operator<<(std::ostream&, const Command*) CVC5_EXPORT; +std::ostream& operator<<(std::ostream&, const CommandStatus&) CVC5_EXPORT; +std::ostream& operator<<(std::ostream&, const CommandStatus*) CVC5_EXPORT; /** The status an SMT benchmark can have */ enum BenchmarkStatus @@ -71,7 +71,7 @@ enum BenchmarkStatus SMT_UNKNOWN }; /* enum BenchmarkStatus */ -std::ostream& operator<<(std::ostream& out, BenchmarkStatus status) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& out, BenchmarkStatus status) CVC5_EXPORT; /** * IOStream manipulator to print success messages or not. @@ -85,7 +85,7 @@ std::ostream& operator<<(std::ostream& out, BenchmarkStatus status) CVC4_EXPORT; * prints a success message (in a manner appropriate for the current * output language). */ -class CVC4_EXPORT CommandPrintSuccess +class CVC5_EXPORT CommandPrintSuccess { public: /** Construct a CommandPrintSuccess with the given setting. */ @@ -119,9 +119,9 @@ class CVC4_EXPORT CommandPrintSuccess * The depth stays permanently (until set again) with the stream. */ std::ostream& operator<<(std::ostream& out, - CommandPrintSuccess cps) CVC4_EXPORT; + CommandPrintSuccess cps) CVC5_EXPORT; -class CVC4_EXPORT CommandStatus +class CVC5_EXPORT CommandStatus { protected: // shouldn't construct a CommandStatus (use a derived class) @@ -134,7 +134,7 @@ class CVC4_EXPORT CommandStatus virtual CommandStatus& clone() const = 0; }; /* class CommandStatus */ -class CVC4_EXPORT CommandSuccess : public CommandStatus +class CVC5_EXPORT CommandSuccess : public CommandStatus { static const CommandSuccess* s_instance; @@ -146,7 +146,7 @@ class CVC4_EXPORT CommandSuccess : public CommandStatus } }; /* class CommandSuccess */ -class CVC4_EXPORT CommandInterrupted : public CommandStatus +class CVC5_EXPORT CommandInterrupted : public CommandStatus { static const CommandInterrupted* s_instance; @@ -158,7 +158,7 @@ class CVC4_EXPORT CommandInterrupted : public CommandStatus } }; /* class CommandInterrupted */ -class CVC4_EXPORT CommandUnsupported : public CommandStatus +class CVC5_EXPORT CommandUnsupported : public CommandStatus { public: CommandStatus& clone() const override @@ -167,7 +167,7 @@ class CVC4_EXPORT CommandUnsupported : public CommandStatus } }; /* class CommandSuccess */ -class CVC4_EXPORT CommandFailure : public CommandStatus +class CVC5_EXPORT CommandFailure : public CommandStatus { std::string d_message; @@ -183,7 +183,7 @@ class CVC4_EXPORT CommandFailure : public CommandStatus * for an unsat core in a place that is not immediately preceded by an * unsat/valid response. */ -class CVC4_EXPORT CommandRecoverableFailure : public CommandStatus +class CVC5_EXPORT CommandRecoverableFailure : public CommandStatus { std::string d_message; @@ -196,7 +196,7 @@ class CVC4_EXPORT CommandRecoverableFailure : public CommandStatus std::string getMessage() const { return d_message; } }; /* class CommandRecoverableFailure */ -class CVC4_EXPORT Command +class CVC5_EXPORT Command { public: typedef CommandPrintSuccess printsuccess; @@ -302,7 +302,7 @@ class CVC4_EXPORT Command * EmptyCommands are the residue of a command after the parser handles * them (and there's nothing left to do). */ -class CVC4_EXPORT EmptyCommand : public Command +class CVC5_EXPORT EmptyCommand : public Command { public: EmptyCommand(std::string name = ""); @@ -320,7 +320,7 @@ class CVC4_EXPORT EmptyCommand : public Command std::string d_name; }; /* class EmptyCommand */ -class CVC4_EXPORT EchoCommand : public Command +class CVC5_EXPORT EchoCommand : public Command { public: EchoCommand(std::string output = ""); @@ -344,7 +344,7 @@ class CVC4_EXPORT EchoCommand : public Command std::string d_output; }; /* class EchoCommand */ -class CVC4_EXPORT AssertCommand : public Command +class CVC5_EXPORT AssertCommand : public Command { protected: api::Term d_term; @@ -366,7 +366,7 @@ class CVC4_EXPORT AssertCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class AssertCommand */ -class CVC4_EXPORT PushCommand : public Command +class CVC5_EXPORT PushCommand : public Command { public: void invoke(api::Solver* solver, SymbolManager* sm) override; @@ -379,7 +379,7 @@ class CVC4_EXPORT PushCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class PushCommand */ -class CVC4_EXPORT PopCommand : public Command +class CVC5_EXPORT PopCommand : public Command { public: void invoke(api::Solver* solver, SymbolManager* sm) override; @@ -392,7 +392,7 @@ class CVC4_EXPORT PopCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class PopCommand */ -class CVC4_EXPORT DeclarationDefinitionCommand : public Command +class CVC5_EXPORT DeclarationDefinitionCommand : public Command { protected: std::string d_symbol; @@ -404,7 +404,7 @@ class CVC4_EXPORT DeclarationDefinitionCommand : public Command std::string getSymbol() const; }; /* class DeclarationDefinitionCommand */ -class CVC4_EXPORT DeclareFunctionCommand : public DeclarationDefinitionCommand +class CVC5_EXPORT DeclareFunctionCommand : public DeclarationDefinitionCommand { protected: api::Term d_func; @@ -425,7 +425,7 @@ class CVC4_EXPORT DeclareFunctionCommand : public DeclarationDefinitionCommand OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class DeclareFunctionCommand */ -class CVC4_EXPORT DeclarePoolCommand : public DeclarationDefinitionCommand +class CVC5_EXPORT DeclarePoolCommand : public DeclarationDefinitionCommand { protected: api::Term d_func; @@ -451,7 +451,7 @@ class CVC4_EXPORT DeclarePoolCommand : public DeclarationDefinitionCommand OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class DeclarePoolCommand */ -class CVC4_EXPORT DeclareSortCommand : public DeclarationDefinitionCommand +class CVC5_EXPORT DeclareSortCommand : public DeclarationDefinitionCommand { protected: size_t d_arity; @@ -473,7 +473,7 @@ class CVC4_EXPORT DeclareSortCommand : public DeclarationDefinitionCommand OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class DeclareSortCommand */ -class CVC4_EXPORT DefineSortCommand : public DeclarationDefinitionCommand +class CVC5_EXPORT DefineSortCommand : public DeclarationDefinitionCommand { protected: std::vector d_params; @@ -498,7 +498,7 @@ class CVC4_EXPORT DefineSortCommand : public DeclarationDefinitionCommand OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class DefineSortCommand */ -class CVC4_EXPORT DefineFunctionCommand : public DeclarationDefinitionCommand +class CVC5_EXPORT DefineFunctionCommand : public DeclarationDefinitionCommand { public: DefineFunctionCommand(const std::string& id, @@ -543,7 +543,7 @@ class CVC4_EXPORT DefineFunctionCommand : public DeclarationDefinitionCommand * This command will assert a set of quantified formulas that specify * the (mutually recursive) function definitions provided to it. */ -class CVC4_EXPORT DefineFunctionRecCommand : public Command +class CVC5_EXPORT DefineFunctionRecCommand : public Command { public: DefineFunctionRecCommand(api::Term func, @@ -588,7 +588,7 @@ class CVC4_EXPORT DefineFunctionRecCommand : public Command * (declare-heap (T U)) * where T is the location sort and U is the data sort. */ -class CVC4_EXPORT DeclareHeapCommand : public Command +class CVC5_EXPORT DeclareHeapCommand : public Command { public: DeclareHeapCommand(api::Sort locSort, api::Sort dataSort); @@ -614,7 +614,7 @@ class CVC4_EXPORT DeclareHeapCommand : public Command * The command when an attribute is set by a user. In SMT-LIBv2 this is done * via the syntax (! expr :attr) */ -class CVC4_EXPORT SetUserAttributeCommand : public Command +class CVC5_EXPORT SetUserAttributeCommand : public Command { public: SetUserAttributeCommand(const std::string& attr, api::Term term); @@ -650,7 +650,7 @@ class CVC4_EXPORT SetUserAttributeCommand : public Command * The command when parsing check-sat. * This command will check satisfiability of the input formula. */ -class CVC4_EXPORT CheckSatCommand : public Command +class CVC5_EXPORT CheckSatCommand : public Command { public: CheckSatCommand(); @@ -678,7 +678,7 @@ class CVC4_EXPORT CheckSatCommand : public Command * This command will assume a set of formulas and check satisfiability of the * input formula under these assumptions. */ -class CVC4_EXPORT CheckSatAssumingCommand : public Command +class CVC5_EXPORT CheckSatAssumingCommand : public Command { public: CheckSatAssumingCommand(api::Term term); @@ -701,7 +701,7 @@ class CVC4_EXPORT CheckSatAssumingCommand : public Command api::Result d_result; }; /* class CheckSatAssumingCommand */ -class CVC4_EXPORT QueryCommand : public Command +class CVC5_EXPORT QueryCommand : public Command { protected: api::Term d_term; @@ -727,7 +727,7 @@ class CVC4_EXPORT QueryCommand : public Command /* ------------------- sygus commands ------------------ */ /** Declares a sygus universal variable */ -class CVC4_EXPORT DeclareSygusVarCommand : public DeclarationDefinitionCommand +class CVC5_EXPORT DeclareSygusVarCommand : public DeclarationDefinitionCommand { public: DeclareSygusVarCommand(const std::string& id, api::Term var, api::Sort sort); @@ -764,7 +764,7 @@ class CVC4_EXPORT DeclareSygusVarCommand : public DeclarationDefinitionCommand * This command is also used for the special case in which we are declaring an * invariant-to-synthesize */ -class CVC4_EXPORT SynthFunCommand : public DeclarationDefinitionCommand +class CVC5_EXPORT SynthFunCommand : public DeclarationDefinitionCommand { public: SynthFunCommand(const std::string& id, @@ -815,7 +815,7 @@ class CVC4_EXPORT SynthFunCommand : public DeclarationDefinitionCommand }; /** Declares a sygus constraint */ -class CVC4_EXPORT SygusConstraintCommand : public Command +class CVC5_EXPORT SygusConstraintCommand : public Command { public: SygusConstraintCommand(const api::Term& t); @@ -853,7 +853,7 @@ class CVC4_EXPORT SygusConstraintCommand : public Command * than the precondition, not weaker than the postcondition and inductive * w.r.t. the transition relation. */ -class CVC4_EXPORT SygusInvConstraintCommand : public Command +class CVC5_EXPORT SygusInvConstraintCommand : public Command { public: SygusInvConstraintCommand(const std::vector& predicates); @@ -889,7 +889,7 @@ class CVC4_EXPORT SygusInvConstraintCommand : public Command }; /** Declares a synthesis conjecture */ -class CVC4_EXPORT CheckSynthCommand : public Command +class CVC5_EXPORT CheckSynthCommand : public Command { public: CheckSynthCommand(){}; @@ -927,7 +927,7 @@ class CVC4_EXPORT CheckSynthCommand : public Command /* ------------------- sygus commands ------------------ */ // this is TRANSFORM in the CVC presentation language -class CVC4_EXPORT SimplifyCommand : public Command +class CVC5_EXPORT SimplifyCommand : public Command { protected: api::Term d_term; @@ -949,7 +949,7 @@ class CVC4_EXPORT SimplifyCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class SimplifyCommand */ -class CVC4_EXPORT GetValueCommand : public Command +class CVC5_EXPORT GetValueCommand : public Command { protected: std::vector d_terms; @@ -972,7 +972,7 @@ class CVC4_EXPORT GetValueCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class GetValueCommand */ -class CVC4_EXPORT GetAssignmentCommand : public Command +class CVC5_EXPORT GetAssignmentCommand : public Command { protected: api::Term d_result; @@ -992,7 +992,7 @@ class CVC4_EXPORT GetAssignmentCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class GetAssignmentCommand */ -class CVC4_EXPORT GetModelCommand : public Command +class CVC5_EXPORT GetModelCommand : public Command { public: GetModelCommand(); @@ -1014,7 +1014,7 @@ class CVC4_EXPORT GetModelCommand : public Command }; /* class GetModelCommand */ /** The command to block models. */ -class CVC4_EXPORT BlockModelCommand : public Command +class CVC5_EXPORT BlockModelCommand : public Command { public: BlockModelCommand(); @@ -1030,7 +1030,7 @@ class CVC4_EXPORT BlockModelCommand : public Command }; /* class BlockModelCommand */ /** The command to block model values. */ -class CVC4_EXPORT BlockModelValuesCommand : public Command +class CVC5_EXPORT BlockModelValuesCommand : public Command { public: BlockModelValuesCommand(const std::vector& terms); @@ -1050,7 +1050,7 @@ class CVC4_EXPORT BlockModelValuesCommand : public Command std::vector d_terms; }; /* class BlockModelValuesCommand */ -class CVC4_EXPORT GetProofCommand : public Command +class CVC5_EXPORT GetProofCommand : public Command { public: GetProofCommand(); @@ -1072,7 +1072,7 @@ class CVC4_EXPORT GetProofCommand : public Command std::string d_result; }; /* class GetProofCommand */ -class CVC4_EXPORT GetInstantiationsCommand : public Command +class CVC5_EXPORT GetInstantiationsCommand : public Command { public: GetInstantiationsCommand(); @@ -1091,7 +1091,7 @@ class CVC4_EXPORT GetInstantiationsCommand : public Command api::Solver* d_solver; }; /* class GetInstantiationsCommand */ -class CVC4_EXPORT GetSynthSolutionCommand : public Command +class CVC5_EXPORT GetSynthSolutionCommand : public Command { public: GetSynthSolutionCommand(); @@ -1119,7 +1119,7 @@ class CVC4_EXPORT GetSynthSolutionCommand : public Command * find a predicate P, then the output response of this command is: (define-fun * s () Bool P) */ -class CVC4_EXPORT GetInterpolCommand : public Command +class CVC5_EXPORT GetInterpolCommand : public Command { public: GetInterpolCommand(const std::string& name, api::Term conj); @@ -1169,7 +1169,7 @@ class CVC4_EXPORT GetInterpolCommand : public Command * A grammar G can be optionally provided to indicate the syntactic restrictions * on the possible solutions returned. */ -class CVC4_EXPORT GetAbductCommand : public Command +class CVC5_EXPORT GetAbductCommand : public Command { public: GetAbductCommand(const std::string& name, api::Term conj); @@ -1208,7 +1208,7 @@ class CVC4_EXPORT GetAbductCommand : public Command api::Term d_result; }; /* class GetAbductCommand */ -class CVC4_EXPORT GetQuantifierEliminationCommand : public Command +class CVC5_EXPORT GetQuantifierEliminationCommand : public Command { protected: api::Term d_term; @@ -1234,7 +1234,7 @@ class CVC4_EXPORT GetQuantifierEliminationCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class GetQuantifierEliminationCommand */ -class CVC4_EXPORT GetUnsatAssumptionsCommand : public Command +class CVC5_EXPORT GetUnsatAssumptionsCommand : public Command { public: GetUnsatAssumptionsCommand(); @@ -1253,7 +1253,7 @@ class CVC4_EXPORT GetUnsatAssumptionsCommand : public Command std::vector d_result; }; /* class GetUnsatAssumptionsCommand */ -class CVC4_EXPORT GetUnsatCoreCommand : public Command +class CVC5_EXPORT GetUnsatCoreCommand : public Command { public: GetUnsatCoreCommand(); @@ -1277,7 +1277,7 @@ class CVC4_EXPORT GetUnsatCoreCommand : public Command std::vector d_result; }; /* class GetUnsatCoreCommand */ -class CVC4_EXPORT GetAssertionsCommand : public Command +class CVC5_EXPORT GetAssertionsCommand : public Command { protected: std::string d_result; @@ -1297,7 +1297,7 @@ class CVC4_EXPORT GetAssertionsCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class GetAssertionsCommand */ -class CVC4_EXPORT SetBenchmarkStatusCommand : public Command +class CVC5_EXPORT SetBenchmarkStatusCommand : public Command { protected: BenchmarkStatus d_status; @@ -1317,7 +1317,7 @@ class CVC4_EXPORT SetBenchmarkStatusCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class SetBenchmarkStatusCommand */ -class CVC4_EXPORT SetBenchmarkLogicCommand : public Command +class CVC5_EXPORT SetBenchmarkLogicCommand : public Command { protected: std::string d_logic; @@ -1336,7 +1336,7 @@ class CVC4_EXPORT SetBenchmarkLogicCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class SetBenchmarkLogicCommand */ -class CVC4_EXPORT SetInfoCommand : public Command +class CVC5_EXPORT SetInfoCommand : public Command { protected: std::string d_flag; @@ -1358,7 +1358,7 @@ class CVC4_EXPORT SetInfoCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class SetInfoCommand */ -class CVC4_EXPORT GetInfoCommand : public Command +class CVC5_EXPORT GetInfoCommand : public Command { protected: std::string d_flag; @@ -1381,7 +1381,7 @@ class CVC4_EXPORT GetInfoCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class GetInfoCommand */ -class CVC4_EXPORT SetOptionCommand : public Command +class CVC5_EXPORT SetOptionCommand : public Command { protected: std::string d_flag; @@ -1403,7 +1403,7 @@ class CVC4_EXPORT SetOptionCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class SetOptionCommand */ -class CVC4_EXPORT GetOptionCommand : public Command +class CVC5_EXPORT GetOptionCommand : public Command { protected: std::string d_flag; @@ -1426,7 +1426,7 @@ class CVC4_EXPORT GetOptionCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class GetOptionCommand */ -class CVC4_EXPORT DatatypeDeclarationCommand : public Command +class CVC5_EXPORT DatatypeDeclarationCommand : public Command { private: std::vector d_datatypes; @@ -1446,7 +1446,7 @@ class CVC4_EXPORT DatatypeDeclarationCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class DatatypeDeclarationCommand */ -class CVC4_EXPORT ResetCommand : public Command +class CVC5_EXPORT ResetCommand : public Command { public: ResetCommand() {} @@ -1460,7 +1460,7 @@ class CVC4_EXPORT ResetCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class ResetCommand */ -class CVC4_EXPORT ResetAssertionsCommand : public Command +class CVC5_EXPORT ResetAssertionsCommand : public Command { public: ResetAssertionsCommand() {} @@ -1474,7 +1474,7 @@ class CVC4_EXPORT ResetAssertionsCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class ResetAssertionsCommand */ -class CVC4_EXPORT QuitCommand : public Command +class CVC5_EXPORT QuitCommand : public Command { public: QuitCommand() {} @@ -1488,7 +1488,7 @@ class CVC4_EXPORT QuitCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class QuitCommand */ -class CVC4_EXPORT CommentCommand : public Command +class CVC5_EXPORT CommentCommand : public Command { std::string d_comment; @@ -1507,7 +1507,7 @@ class CVC4_EXPORT CommentCommand : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class CommentCommand */ -class CVC4_EXPORT CommandSequence : public Command +class CVC5_EXPORT CommandSequence : public Command { protected: /** All the commands to be executed (in sequence) */ @@ -1545,7 +1545,7 @@ class CVC4_EXPORT CommandSequence : public Command OutputLanguage language = language::output::LANG_AUTO) const override; }; /* class CommandSequence */ -class CVC4_EXPORT DeclarationSequence : public CommandSequence +class CVC5_EXPORT DeclarationSequence : public CommandSequence { void toStream( std::ostream& out, diff --git a/src/smt/smt_engine.h b/src/smt/smt_engine.h index 59081f63e..860caffa8 100644 --- a/src/smt/smt_engine.h +++ b/src/smt/smt_engine.h @@ -24,7 +24,7 @@ #include #include "context/cdhashmap_forward.h" -#include "cvc4_export.h" +#include "cvc5_export.h" #include "options/options.h" #include "smt/output_manager.h" #include "smt/smt_mode.h" @@ -119,7 +119,7 @@ namespace theory { /* -------------------------------------------------------------------------- */ -class CVC4_EXPORT SmtEngine +class CVC5_EXPORT SmtEngine { friend class ::cvc5::api::Solver; friend class ::cvc5::smt::SmtEngineState; @@ -243,18 +243,18 @@ class CVC4_EXPORT SmtEngine * to a state where its options were prior to parsing but after e.g. * reading command line options. */ - void notifyStartParsing(const std::string& filename) CVC4_EXPORT; + void notifyStartParsing(const std::string& filename) CVC5_EXPORT; /** return the input name (if any) */ const std::string& getFilename() const; /** * Helper method for the API to put the last check result into the statistics. */ - void setResultStatistic(const std::string& result) CVC4_EXPORT; + void setResultStatistic(const std::string& result) CVC5_EXPORT; /** * Helper method for the API to put the total runtime into the statistics. */ - void setTotalTimeStatistic(double seconds) CVC4_EXPORT; + void setTotalTimeStatistic(double seconds) CVC5_EXPORT; /** * Get the model (only if immediately preceded by a SAT or NOT_ENTAILED diff --git a/src/theory/CMakeLists.txt b/src/theory/CMakeLists.txt index a476592ce..8cc6b9f15 100644 --- a/src/theory/CMakeLists.txt +++ b/src/theory/CMakeLists.txt @@ -13,7 +13,7 @@ # The build system configuration. ## -libcvc4_add_sources(GENERATED +libcvc5_add_sources(GENERATED rewriter_tables.h theory_traits.h type_enumerator.cpp diff --git a/src/theory/arith/approx_simplex.cpp b/src/theory/arith/approx_simplex.cpp index 536a38739..f343ce56a 100644 --- a/src/theory/arith/approx_simplex.cpp +++ b/src/theory/arith/approx_simplex.cpp @@ -18,12 +18,13 @@ #include "theory/arith/approx_simplex.h" #include + #include #include #include +#include "base/cvc5config.h" #include "base/output.h" -#include "cvc4autoconfig.h" #include "smt/smt_statistics_registry.h" #include "theory/arith/constraint.h" #include "theory/arith/cut_log.h" diff --git a/src/theory/arith/cut_log.cpp b/src/theory/arith/cut_log.cpp index 4cdd242db..28fd80acc 100644 --- a/src/theory/arith/cut_log.cpp +++ b/src/theory/arith/cut_log.cpp @@ -16,17 +16,19 @@ * \todo document this file */ +#include "theory/arith/cut_log.h" + +#include +#include + #include #include -#include #include -#include +#include "base/cvc5config.h" #include "base/output.h" -#include "cvc4autoconfig.h" #include "theory/arith/approx_simplex.h" #include "theory/arith/constraint.h" -#include "theory/arith/cut_log.h" #include "theory/arith/normal_form.h" #include "util/ostream_util.h" diff --git a/src/theory/arith/cut_log.h b/src/theory/arith/cut_log.h index 5929bbd5a..7f0e2e586 100644 --- a/src/theory/arith/cut_log.h +++ b/src/theory/arith/cut_log.h @@ -20,9 +20,10 @@ #pragma once -#include #include +#include #include +#include #include "expr/kind.h" #include "theory/arith/arithvar.h" diff --git a/src/theory/bv/bv_subtheory_algebraic.cpp b/src/theory/bv/bv_subtheory_algebraic.cpp index 4c050b3f0..90276f8b1 100644 --- a/src/theory/bv/bv_subtheory_algebraic.cpp +++ b/src/theory/bv/bv_subtheory_algebraic.cpp @@ -979,5 +979,5 @@ Node mergeExplanations(TNode expl1, TNode expl2) { } } // namespace bv -} /* namespace CVc4::theory */ +} // namespace theory } // namespace cvc5 diff --git a/src/theory/logic_info.h b/src/theory/logic_info.h index 9d18d5145..107093a5c 100644 --- a/src/theory/logic_info.h +++ b/src/theory/logic_info.h @@ -22,7 +22,7 @@ #include #include -#include "cvc4_export.h" +#include "cvc5_export.h" #include "theory/theory_id.h" namespace cvc5 { @@ -42,7 +42,7 @@ namespace cvc5 { * (e.g., for communicating to the SmtEngine which theories should be used, * rather than having to provide an SMT-LIB string). */ -class CVC4_EXPORT LogicInfo +class CVC5_EXPORT LogicInfo { mutable std::string d_logicString; /**< an SMT-LIB-like logic string */ std::vector d_theories; /**< set of active theories */ diff --git a/src/theory/quantifiers/term_tuple_enumerator.cpp b/src/theory/quantifiers/term_tuple_enumerator.cpp index 431156c03..b75ebe288 100644 --- a/src/theory/quantifiers/term_tuple_enumerator.cpp +++ b/src/theory/quantifiers/term_tuple_enumerator.cpp @@ -36,7 +36,7 @@ namespace cvc5 { template -static CVC5ostream& operator<<(CVC5ostream& out, const std::vector& v) +static Cvc5ostream& operator<<(Cvc5ostream& out, const std::vector& v) { out << "[ "; std::copy(v.begin(), v.end(), std::ostream_iterator(out, " ")); diff --git a/src/theory/sets/cardinality_extension.cpp b/src/theory/sets/cardinality_extension.cpp index a9a7429b4..ec5abfacc 100644 --- a/src/theory/sets/cardinality_extension.cpp +++ b/src/theory/sets/cardinality_extension.cpp @@ -115,7 +115,7 @@ void CardinalityExtension::checkCardinalityExtended(TypeNode& t) if (it == d_univProxy.end()) { - // Force cvc4 to build the cardinality graph for the universe set + // Force cvc5 to build the cardinality graph for the universe set proxy = d_treg.getProxy(univ); d_univProxy[univ] = proxy; } diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index e495fd4d6..79a44f426 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -20,7 +20,7 @@ configure_file(rational.h.in rational.h) configure_file(integer.h.in integer.h) configure_file(real_algebraic_number.h.in real_algebraic_number.h) -libcvc4_add_sources( +libcvc5_add_sources( abstract_value.cpp abstract_value.h bin_heap.h @@ -84,13 +84,13 @@ libcvc4_add_sources( ) if(CVC5_USE_CLN_IMP) - libcvc4_add_sources(rational_cln_imp.cpp integer_cln_imp.cpp) + libcvc5_add_sources(rational_cln_imp.cpp integer_cln_imp.cpp) endif() if(CVC5_USE_GMP_IMP) - libcvc4_add_sources(rational_gmp_imp.cpp integer_gmp_imp.cpp) + libcvc5_add_sources(rational_gmp_imp.cpp integer_gmp_imp.cpp) endif() if(CVC5_USE_POLY_IMP) - libcvc4_add_sources(real_algebraic_number_poly_imp.cpp real_algebraic_number_poly_imp.h) + libcvc5_add_sources(real_algebraic_number_poly_imp.cpp real_algebraic_number_poly_imp.h) endif() diff --git a/src/util/integer.h.in b/src/util/integer.h.in index cfcef4ae2..3fb53a835 100644 --- a/src/util/integer.h.in +++ b/src/util/integer.h.in @@ -13,7 +13,7 @@ * A multi-precision integer constant. */ -// these gestures are used to avoid a public header dependence on cvc4autoconfig.h +// these gestures are used to avoid a public header dependence on base/cvc5config.h #if @CVC5_NEED_INT64_T_OVERLOADS@ # define CVC5_NEED_INT64_T_OVERLOADS @@ -28,14 +28,8 @@ #ifdef CVC5_CLN_IMP # include "util/integer_cln_imp.h" -# if SWIG - %include "util/integer_cln_imp.h" -# endif /* SWIG */ #endif /* CVC5_CLN_IMP */ #ifdef CVC5_GMP_IMP # include "util/integer_gmp_imp.h" -# if SWIG - %include "util/integer_gmp_imp.h" -# endif /* SWIG */ #endif /* CVC5_GMP_IMP */ diff --git a/src/util/integer_cln_imp.cpp b/src/util/integer_cln_imp.cpp index f54630d23..a9e4f6f0a 100644 --- a/src/util/integer_cln_imp.cpp +++ b/src/util/integer_cln_imp.cpp @@ -15,7 +15,7 @@ #include #include -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #include "util/integer.h" #ifndef CVC5_CLN_IMP diff --git a/src/util/integer_cln_imp.h b/src/util/integer_cln_imp.h index 303567dc6..80bc406ee 100644 --- a/src/util/integer_cln_imp.h +++ b/src/util/integer_cln_imp.h @@ -29,13 +29,13 @@ #include #include "base/exception.h" -#include "cvc4_export.h" // remove when Cvc language support is removed +#include "cvc5_export.h" // remove when Cvc language support is removed namespace cvc5 { class Rational; -class CVC4_EXPORT Integer +class CVC5_EXPORT Integer { friend class cvc5::Rational; diff --git a/src/util/integer_gmp_imp.cpp b/src/util/integer_gmp_imp.cpp index 52e408a37..f33a90408 100644 --- a/src/util/integer_gmp_imp.cpp +++ b/src/util/integer_gmp_imp.cpp @@ -13,15 +13,13 @@ * A multi-precision rational constant. */ -#include "util/integer.h" - #include #include #include -#include "cvc4autoconfig.h" - #include "base/check.h" +#include "base/cvc5config.h" +#include "util/integer.h" #include "util/rational.h" #ifndef CVC5_GMP_IMP diff --git a/src/util/integer_gmp_imp.h b/src/util/integer_gmp_imp.h index f2d568d13..ff2ea9815 100644 --- a/src/util/integer_gmp_imp.h +++ b/src/util/integer_gmp_imp.h @@ -23,13 +23,13 @@ #include #include -#include "cvc4_export.h" // remove when Cvc language support is removed +#include "cvc5_export.h" // remove when Cvc language support is removed namespace cvc5 { class Rational; -class CVC4_EXPORT Integer +class CVC5_EXPORT Integer { friend class cvc5::Rational; diff --git a/src/util/rational.h.in b/src/util/rational.h.in index c8b673d7e..981fceab2 100644 --- a/src/util/rational.h.in +++ b/src/util/rational.h.in @@ -13,7 +13,7 @@ * A multi-precision rational constant. */ -// these gestures are used to avoid a public header dependence on cvc4autoconfig.h +// these gestures are used to avoid a public header dependence on base/cvc5config.h #if @CVC5_NEED_INT64_T_OVERLOADS@ # define CVC5_NEED_INT64_T_OVERLOADS @@ -28,14 +28,8 @@ #ifdef CVC5_CLN_IMP # include "util/rational_cln_imp.h" -# if SWIG - %include "util/rational_cln_imp.h" -# endif /* SWIG */ #endif /* CVC5_CLN_IMP */ #ifdef CVC5_GMP_IMP # include "util/rational_gmp_imp.h" -# if SWIG - %include "util/rational_gmp_imp.h" -# endif /* SWIG */ #endif /* CVC5_GMP_IMP */ diff --git a/src/util/rational_cln_imp.cpp b/src/util/rational_cln_imp.cpp index 93816bd20..728b2d97e 100644 --- a/src/util/rational_cln_imp.cpp +++ b/src/util/rational_cln_imp.cpp @@ -12,12 +12,11 @@ * * A multi-precision rational constant. */ -#include "util/rational.h" - #include #include -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" +#include "util/rational.h" #ifndef CVC5_CLN_IMP #error "This source should only ever be built if CVC5_CLN_IMP is on !" diff --git a/src/util/rational_cln_imp.h b/src/util/rational_cln_imp.h index 9745bbdad..67e73f7e9 100644 --- a/src/util/rational_cln_imp.h +++ b/src/util/rational_cln_imp.h @@ -31,7 +31,7 @@ #include #include "base/exception.h" -#include "cvc4_export.h" // remove when Cvc language support is removed +#include "cvc5_export.h" // remove when Cvc language support is removed #include "util/integer.h" #include "util/maybe.h" @@ -52,7 +52,7 @@ namespace cvc5 { * in danger of invoking the char* constructor, from whence you will segfault. */ -class CVC4_EXPORT Rational +class CVC5_EXPORT Rational { public: /** @@ -337,7 +337,7 @@ struct RationalHashFunction inline size_t operator()(const cvc5::Rational& r) const { return r.hash(); } }; /* struct RationalHashFunction */ -std::ostream& operator<<(std::ostream& os, const Rational& n) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& os, const Rational& n) CVC5_EXPORT; } // namespace cvc5 diff --git a/src/util/rational_gmp_imp.cpp b/src/util/rational_gmp_imp.cpp index 24e6e96d7..0997b8b09 100644 --- a/src/util/rational_gmp_imp.cpp +++ b/src/util/rational_gmp_imp.cpp @@ -12,15 +12,14 @@ * * A multi-precision rational constant. */ -#include "util/rational.h" - #include #include #include -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" +#include "util/rational.h" -#ifndef CVC5_GMP_IMP // Make sure this comes after cvc4autoconfig.h +#ifndef CVC5_GMP_IMP // Make sure this comes after base/cvc5config.h #error "This source should only ever be built if CVC5_GMP_IMP is on !" #endif /* CVC5_GMP_IMP */ diff --git a/src/util/rational_gmp_imp.h b/src/util/rational_gmp_imp.h index 0961adc73..fd7492a87 100644 --- a/src/util/rational_gmp_imp.h +++ b/src/util/rational_gmp_imp.h @@ -22,7 +22,7 @@ #include -#include "cvc4_export.h" // remove when Cvc language support is removed +#include "cvc5_export.h" // remove when Cvc language support is removed #include "util/gmp_util.h" #include "util/integer.h" #include "util/maybe.h" @@ -44,7 +44,7 @@ namespace cvc5 { * in danger of invoking the char* constructor, from whence you will segfault. */ -class CVC4_EXPORT Rational +class CVC5_EXPORT Rational { public: /** @@ -327,7 +327,7 @@ struct RationalHashFunction inline size_t operator()(const cvc5::Rational& r) const { return r.hash(); } }; /* struct RationalHashFunction */ -std::ostream& operator<<(std::ostream& os, const Rational& n) CVC4_EXPORT; +std::ostream& operator<<(std::ostream& os, const Rational& n) CVC5_EXPORT; } // namespace cvc5 diff --git a/src/util/real_algebraic_number.h.in b/src/util/real_algebraic_number.h.in index 8eb8b35fb..077c260f6 100644 --- a/src/util/real_algebraic_number.h.in +++ b/src/util/real_algebraic_number.h.in @@ -13,7 +13,7 @@ * A real algebraic number constant. */ -// these gestures are used to avoid a public header dependence on cvc4autoconfig.h +// these gestures are used to avoid a public header dependence on base/cvc5config.h #if /* use libpoly */ @CVC5_USE_POLY_IMP@ # define CVC5_POLY_IMP diff --git a/src/util/real_algebraic_number_poly_imp.cpp b/src/util/real_algebraic_number_poly_imp.cpp index 736970129..58af26193 100644 --- a/src/util/real_algebraic_number_poly_imp.cpp +++ b/src/util/real_algebraic_number_poly_imp.cpp @@ -13,10 +13,10 @@ * Implementation of RealAlgebraicNumber based on libpoly. */ -#include "cvc4autoconfig.h" +#include "base/cvc5config.h" #include "util/real_algebraic_number.h" -#ifndef CVC5_POLY_IMP // Make sure this comes after cvc4autoconfig.h +#ifndef CVC5_POLY_IMP // Make sure this comes after base/cvc5config.h #error "This source should only ever be built if CVC5_POLY_IMP is on!" #endif /* CVC5_POLY_IMP */ diff --git a/src/util/safe_print.h b/src/util/safe_print.h index ba0704d9c..e3280bb55 100644 --- a/src/util/safe_print.h +++ b/src/util/safe_print.h @@ -43,7 +43,7 @@ #include #include -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { @@ -52,7 +52,7 @@ namespace cvc5 { * signal handler. */ template -void CVC4_EXPORT safe_print(int fd, const char (&msg)[N]) +void CVC5_EXPORT safe_print(int fd, const char (&msg)[N]) { ssize_t nb = N - 1; if (write(fd, msg, nb) != nb) { @@ -96,7 +96,7 @@ auto toStringImpl(const T& obj, int) -> decltype(toString(obj)) * @param obj The object to print */ template -void CVC4_EXPORT safe_print(int fd, const T& obj) +void CVC5_EXPORT safe_print(int fd, const T& obj) { const char* s = toStringImpl(obj, /* prefer the method that uses `toString()` */ 0); @@ -108,25 +108,25 @@ void CVC4_EXPORT safe_print(int fd, const T& obj) } template <> -void CVC4_EXPORT safe_print(int fd, const std::string& msg); +void CVC5_EXPORT safe_print(int fd, const std::string& msg); template <> -void CVC4_EXPORT safe_print(int fd, const int64_t& _i); +void CVC5_EXPORT safe_print(int fd, const int64_t& _i); template <> -void CVC4_EXPORT safe_print(int fd, const int32_t& i); +void CVC5_EXPORT safe_print(int fd, const int32_t& i); template <> -void CVC4_EXPORT safe_print(int fd, const uint64_t& _i); +void CVC5_EXPORT safe_print(int fd, const uint64_t& _i); template <> -void CVC4_EXPORT safe_print(int fd, const uint32_t& i); +void CVC5_EXPORT safe_print(int fd, const uint32_t& i); template <> -void CVC4_EXPORT safe_print(int fd, const double& _d); +void CVC5_EXPORT safe_print(int fd, const double& _d); template <> -void CVC4_EXPORT safe_print(int fd, const float& f); +void CVC5_EXPORT safe_print(int fd, const float& f); template <> -void CVC4_EXPORT safe_print(int fd, const bool& b); +void CVC5_EXPORT safe_print(int fd, const bool& b); template <> -void CVC4_EXPORT safe_print(int fd, void* const& addr); +void CVC5_EXPORT safe_print(int fd, void* const& addr); template <> -void CVC4_EXPORT safe_print(int fd, const timespec& t); +void CVC5_EXPORT safe_print(int fd, const timespec& t); /** Prints an integer in hexadecimal. Safe to use in a signal handler. */ void safe_print_hex(int fd, uint64_t i); diff --git a/src/util/unsafe_interrupt_exception.h b/src/util/unsafe_interrupt_exception.h index 72c67d24a..16364cba2 100644 --- a/src/util/unsafe_interrupt_exception.h +++ b/src/util/unsafe_interrupt_exception.h @@ -20,11 +20,11 @@ #define CVC5__UNSAFE_INTERRUPT_EXCEPTION_H #include "base/exception.h" -#include "cvc4_export.h" +#include "cvc5_export.h" namespace cvc5 { -class CVC4_EXPORT UnsafeInterruptException : public cvc5::Exception +class CVC5_EXPORT UnsafeInterruptException : public cvc5::Exception { public: UnsafeInterruptException() : diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4ede312f4..ac1848994 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -42,10 +42,6 @@ add_subdirectory(api EXCLUDE_FROM_ALL) if(ENABLE_UNIT_TESTING) add_subdirectory(unit EXCLUDE_FROM_ALL) - - if(BUILD_SWIG_BINDINGS_JAVA) - add_subdirectory(java) - endif() endif() # add Python bindings tests if building with Python bindings diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt index 48318012f..b340ec8ba 100644 --- a/test/api/CMakeLists.txt +++ b/test/api/CMakeLists.txt @@ -29,10 +29,9 @@ add_custom_target(apitests COMMAND ctest --output-on-failure -L "api" -j${CTEST_NTHREADS} $$ARGS DEPENDS build-apitests) -set(CVC5_API_TEST_FLAGS - -D__BUILDING_CVC5_API_TEST -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS) +set(CVC5_API_TEST_FLAGS -D__BUILDING_CVC5_API_TEST) -macro(cvc4_add_api_test name) +macro(cvc5_add_api_test name) set(test_bin_dir ${CMAKE_BINARY_DIR}/bin/test/api/) add_executable(${name} ${name}.cpp) target_link_libraries(${name} PUBLIC main-test) @@ -44,14 +43,14 @@ macro(cvc4_add_api_test name) add_dependencies(build-apitests ${name}) endmacro() -cvc4_add_api_test(boilerplate) -cvc4_add_api_test(ouroborous) -cvc4_add_api_test(reset_assertions) -cvc4_add_api_test(sep_log_api) -cvc4_add_api_test(smt2_compliance) -cvc4_add_api_test(two_solvers) -cvc4_add_api_test(issue5074) -cvc4_add_api_test(issue4889) +cvc5_add_api_test(boilerplate) +cvc5_add_api_test(ouroborous) +cvc5_add_api_test(reset_assertions) +cvc5_add_api_test(sep_log_api) +cvc5_add_api_test(smt2_compliance) +cvc5_add_api_test(two_solvers) +cvc5_add_api_test(issue5074) +cvc5_add_api_test(issue4889) # if we've built using libedit, then we want the interactive shell tests if (USE_EDITLINE) diff --git a/test/api/boilerplate.cpp b/test/api/boilerplate.cpp index 74714a753..0f561e7cf 100644 --- a/test/api/boilerplate.cpp +++ b/test/api/boilerplate.cpp @@ -10,7 +10,7 @@ * directory for licensing information. * **************************************************************************** * - * A simple start-up/tear-down test for CVC4. + * A simple start-up/tear-down test for cvc5. * * This simple test just makes sure that the public interface is * minimally functional. It is useful as a template to use for other diff --git a/test/api/interactive_shell.py b/test/api/interactive_shell.py index 3c8a1d5a8..c09f5f08b 100644 --- a/test/api/interactive_shell.py +++ b/test/api/interactive_shell.py @@ -24,7 +24,7 @@ def check_iteractive_shell(): """ # Open cvc5 - child = pexpect.spawnu("bin/cvc4", timeout=1) + child = pexpect.spawnu("bin/cvc5", timeout=1) # We expect to see the cvc5 prompt child.expect("cvc5>") diff --git a/test/api/python/CMakeLists.txt b/test/api/python/CMakeLists.txt index d6d14b310..246755492 100644 --- a/test/api/python/CMakeLists.txt +++ b/test/api/python/CMakeLists.txt @@ -27,7 +27,7 @@ if(RET_PYTEST) "Could not find Python module pytest. Install via `pip install pytest'.") endif() -macro(cvc4_add_python_api_test name filename) +macro(cvc5_add_python_api_test name filename) # we create test target 'api//myapitest' # and run it with 'ctest -R "api//myapitest"'. @@ -38,7 +38,7 @@ macro(cvc4_add_python_api_test name filename) endmacro() -cvc4_add_python_api_test(pytest_datatype_api test_datatype_api.py) -cvc4_add_python_api_test(pytest_grammar test_grammar.py) -cvc4_add_python_api_test(pytest_term test_term.py) -cvc4_add_python_api_test(pytest_to_python_obj test_to_python_obj.py) +cvc5_add_python_api_test(pytest_datatype_api test_datatype_api.py) +cvc5_add_python_api_test(pytest_grammar test_grammar.py) +cvc5_add_python_api_test(pytest_term test_term.py) +cvc5_add_python_api_test(pytest_to_python_obj test_to_python_obj.py) diff --git a/test/api/python/test_datatype_api.py b/test/api/python/test_datatype_api.py index 81c5478e8..06f4e0f3d 100644 --- a/test/api/python/test_datatype_api.py +++ b/test/api/python/test_datatype_api.py @@ -13,12 +13,12 @@ import pytest -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds def test_datatype_simply_rec(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() # Create mutual datatypes corresponding to this definition block: # diff --git a/test/api/python/test_grammar.py b/test/api/python/test_grammar.py index 30f01b59f..f83bee548 100644 --- a/test/api/python/test_grammar.py +++ b/test/api/python/test_grammar.py @@ -15,15 +15,15 @@ import pytest -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds def test_add_rule(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() boolean = solver.getBooleanSort() integer = solver.getIntegerSort() - nullTerm = pycvc4.Term(solver) + nullTerm = pycvc5.Term(solver) start = solver.mkVar(boolean) nts = solver.mkVar(boolean) @@ -50,11 +50,11 @@ def test_add_rule(): g.addRule(start, solver.mkBoolean(false)) def test_add_rules(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() boolean = solver.getBooleanSort() integer = solver.getIntegerSort() - nullTerm = pycvc4.Term(solver) + nullTerm = pycvc5.Term(solver) start = solver.mkVar(boolean) nts = solver.mkVar(boolean) @@ -79,10 +79,10 @@ def test_add_rules(): g.addRules(start, solver.mkBoolean(False)) def testAddAnyConstant(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() boolean = solver.getBooleanSort() - nullTerm = pycvc4.Term(solver) + nullTerm = pycvc5.Term(solver) start = solver.mkVar(boolean) nts = solver.mkVar(boolean) @@ -103,10 +103,10 @@ def testAddAnyConstant(): def testAddAnyVariable(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() boolean = solver.getBooleanSort() - nullTerm = pycvc4.Term(solver) + nullTerm = pycvc5.Term(solver) x = solver.mkVar(boolean) start = solver.mkVar(boolean) nts = solver.mkVar(boolean) diff --git a/test/api/python/test_term.py b/test/api/python/test_term.py index e47caaf5c..c0625095b 100644 --- a/test/api/python/test_term.py +++ b/test/api/python/test_term.py @@ -13,12 +13,12 @@ import pytest -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds def test_getitem(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() intsort = solver.getIntegerSort() x = solver.mkConst(intsort, 'x') y = solver.mkConst(intsort, 'y') @@ -29,7 +29,7 @@ def test_getitem(): def test_get_kind(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() intsort = solver.getIntegerSort() x = solver.mkConst(intsort, 'x') y = solver.mkConst(intsort, 'y') @@ -52,7 +52,7 @@ def test_get_kind(): def test_eq(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() usort = solver.mkUninterpretedSort('u') x = solver.mkConst(usort, 'x') y = solver.mkConst(usort, 'y') @@ -66,7 +66,7 @@ def test_eq(): def test_get_sort(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() intsort = solver.getIntegerSort() bvsort8 = solver.mkBitVectorSort(8) @@ -83,7 +83,7 @@ def test_get_sort(): assert solver.mkTerm(kinds.BVConcat, a, b).getSort() == solver.mkBitVectorSort(16) def test_get_op(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() intsort = solver.getIntegerSort() funsort = solver.mkFunctionSort(intsort, intsort) @@ -107,7 +107,7 @@ def test_get_op(): def test_const_sequence_elements(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() realsort = solver.getRealSort() seqsort = solver.mkSequenceSort(realsort) s = solver.mkEmptySequence(seqsort) diff --git a/test/api/python/test_to_python_obj.py b/test/api/python/test_to_python_obj.py index 5d55201de..d8094f801 100644 --- a/test/api/python/test_to_python_obj.py +++ b/test/api/python/test_to_python_obj.py @@ -14,12 +14,12 @@ from fractions import Fraction import pytest -import pycvc4 -from pycvc4 import kinds +import pycvc5 +from pycvc5 import kinds def testGetBool(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() t = solver.mkTrue() f = solver.mkFalse() assert t.toPythonObj() == True @@ -27,13 +27,13 @@ def testGetBool(): def testGetInt(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() two = solver.mkInteger(2) assert two.toPythonObj() == 2 def testGetReal(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() half = solver.mkReal("1/2") assert half.toPythonObj() == Fraction(1, 2) @@ -45,13 +45,13 @@ def testGetReal(): def testGetBV(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() three = solver.mkBitVector(8, 3) assert three.toPythonObj() == 3 def testGetArray(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() arrsort = solver.mkArraySort(solver.getRealSort(), solver.getRealSort()) zero_array = solver.mkConstArray(arrsort, solver.mkInteger(0)) stores = solver.mkTerm(kinds.Store, zero_array, solver.mkInteger(1), solver.mkInteger(2)) @@ -68,17 +68,17 @@ def testGetArray(): def testGetSymbol(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() solver.mkConst(solver.getBooleanSort(), "x") def testGetString(): - solver = pycvc4.Solver() + solver = pycvc5.Solver() s1 = '"test\n"😃\\u{a}' t1 = solver.mkString(s1) assert s1 == t1.toPythonObj() - s2 = '❤️CVC4❤️' + s2 = '❤️cvc5❤️' t2 = solver.mkString(s2) assert s2 == t2.toPythonObj() diff --git a/test/api/sep_log_api.cpp b/test/api/sep_log_api.cpp index c01d16bfc..04d4ce41d 100644 --- a/test/api/sep_log_api.cpp +++ b/test/api/sep_log_api.cpp @@ -37,7 +37,7 @@ int validate_exception(void) Solver slv; /* - * Setup some options for CVC4 -- we explictly want to use a simplistic + * Setup some options for cvc5 -- we explictly want to use a simplistic * theory (e.g., QF_IDL) */ slv.setLogic("QF_IDL"); @@ -129,7 +129,7 @@ int validate_getters(void) { Solver slv; - /* Setup some options for CVC4 */ + /* Setup some options for cvc5 */ slv.setLogic("QF_ALL_SUPPORTED"); slv.setOption("produce-models", "true"); slv.setOption("incremental", "false"); diff --git a/test/java/BitVectors.java b/test/java/BitVectors.java deleted file mode 100644 index 3f3d7f5c9..000000000 --- a/test/java/BitVectors.java +++ /dev/null @@ -1,118 +0,0 @@ -/****************************************************************************** - * Top contributors (to current version): - * Pat Hawks, Andres Noetzli, Mathias Preiner - * - * This file is part of the cvc5 project. - * - * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS - * in the top-level source directory and their institutional affiliations. - * All rights reserved. See the file COPYING in the top-level source - * directory for licensing information. - * **************************************************************************** - * - * [[ Add one-line brief description here ]] - * - * [[ Add lengthier description here ]] - * \todo document this file - */ - -import static org.junit.Assert.assertEquals; - -import edu.stanford.CVC4.*; -import org.junit.Before; -import org.junit.Test; - -public class BitVectors { - static { - System.loadLibrary("cvc4jni"); - } - ExprManager em; - SmtEngine smt; - - @Before - public void initialize() { - em = new ExprManager(); - smt = new SmtEngine(em); - } - - @Test - public void evaluatesExpression() { - Result.Entailment expect, actual; - smt.setLogic("QF_BV"); // Set the logic - - // The following example has been adapted from the book A Hacker's Delight by - // Henry S. Warren. - // - // Given a variable x that can only have two values, a or b. We want to - // assign to x a value other than the current one. The straightforward code - // to do that is: - // - //(0) if (x == a ) x = b; - // else x = a; - // - // Two more efficient yet equivalent methods are: - // - //(1) x = a xor b xor x; - // - //(2) x = a + b - x; - // - // We will use CVC4 to prove that the three pieces of code above are all - // equivalent by encoding the problem in the bit-vector theory. - - // Creating a bit-vector type of width 32 - Type bitvector32 = em.mkBitVectorType(32); - - // Variables - Expr x = em.mkVar("x", bitvector32); - Expr a = em.mkVar("a", bitvector32); - Expr b = em.mkVar("b", bitvector32); - - // First encode the assumption that x must be equal to a or b - Expr x_eq_a = em.mkExpr(Kind.EQUAL, x, a); - Expr x_eq_b = em.mkExpr(Kind.EQUAL, x, b); - Expr assumption = em.mkExpr(Kind.OR, x_eq_a, x_eq_b); - - // Assert the assumption - smt.assertFormula(assumption); - - // Introduce a new variable for the new value of x after assignment. - Expr new_x = em.mkVar("new_x", bitvector32); // x after executing code (0) - Expr new_x_ = em.mkVar("new_x_", bitvector32); // x after executing code (1) or (2) - - // Encoding code (0) - // new_x = x == a ? b : a; - Expr ite = em.mkExpr(Kind.ITE, x_eq_a, b, a); - Expr assignment0 = em.mkExpr(Kind.EQUAL, new_x, ite); - - // Assert the encoding of code (0) - smt.assertFormula(assignment0); - smt.push(); - - // Encoding code (1) - // new_x_ = a xor b xor x - Expr a_xor_b_xor_x = em.mkExpr(Kind.BITVECTOR_XOR, a, b, x); - Expr assignment1 = em.mkExpr(Kind.EQUAL, new_x_, a_xor_b_xor_x); - - // Assert encoding to CVC4 in current context; - smt.assertFormula(assignment1); - Expr new_x_eq_new_x_ = em.mkExpr(Kind.EQUAL, new_x, new_x_); - - expect = Result.Entailment.ENTAILED; - actual = smt.checkEntailed(new_x_eq_new_x_).isEntailed(); - assertEquals(expect, actual); - smt.pop(); - - // Encoding code (2) - // new_x_ = a + b - x - Expr a_plus_b = em.mkExpr(Kind.BITVECTOR_PLUS, a, b); - Expr a_plus_b_minus_x = em.mkExpr(Kind.BITVECTOR_SUB, a_plus_b, x); - Expr assignment2 = em.mkExpr(Kind.EQUAL, new_x_, a_plus_b_minus_x); - - // Assert encoding to CVC4 in current context; - smt.assertFormula(assignment2); - - expect = Result.Entailment.ENTAILED; - actual = smt.checkEntailed(new_x_eq_new_x_).isEntailed(); - assertEquals(expect, actual); - } -} diff --git a/test/java/BitVectorsAndArrays.java b/test/java/BitVectorsAndArrays.java deleted file mode 100644 index e2ea44d8a..000000000 --- a/test/java/BitVectorsAndArrays.java +++ /dev/null @@ -1,105 +0,0 @@ -/****************************************************************************** - * Top contributors (to current version): - * Pat Hawks, Andres Noetzli - * - * This file is part of the cvc5 project. - * - * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS - * in the top-level source directory and their institutional affiliations. - * All rights reserved. See the file COPYING in the top-level source - * directory for licensing information. - * **************************************************************************** - * - * [[ Add one-line brief description here ]] - * - * [[ Add lengthier description here ]] - * \todo document this file - */ - -import static org.junit.Assert.assertEquals; - -import edu.stanford.CVC4.*; -import org.junit.Before; -import org.junit.Test; - -public class BitVectorsAndArrays { - static { - System.loadLibrary("cvc4jni"); - } - ExprManager em; - SmtEngine smt; - - @Before - public void initialize() { - em = new ExprManager(); - smt = new SmtEngine(em); - } - - @Test - public void evaluatesExpression() { - smt.setOption("produce-models", new SExpr(true)); // Produce Models - smt.setOption("output-language", new SExpr("smtlib")); // output-language - smt.setLogic("QF_AUFBV"); // Set the logic - - // Consider the following code (where size is some previously defined constant): - // - // Assert (current_array[0] > 0); - // for (unsigned i = 1; i < k; ++i) { - // current_array[i] = 2 * current_array[i - 1]; - // Assert (current_array[i-1] < current_array[i]); - // } - // - // We want to check whether the assertion in the body of the for loop holds - // throughout the loop. - - // Setting up the problem parameters - int k = 4; // number of unrollings (should be a power of 2) - int index_size = log2(k); // size of the index - - // Types - Type elementType = em.mkBitVectorType(32); - Type indexType = em.mkBitVectorType(index_size); - Type arrayType = em.mkArrayType(indexType, elementType); - - // Variables - Expr current_array = em.mkVar("current_array", arrayType); - - // Making a bit-vector constant - Expr zero = em.mkConst(new BitVector(index_size, 0)); - - // Asserting that current_array[0] > 0 - Expr current_array0 = em.mkExpr(Kind.SELECT, current_array, zero); - Expr current_array0_gt_0 = em.mkExpr(Kind.BITVECTOR_SGT, current_array0, em.mkConst(new BitVector(32, 0))); - smt.assertFormula(current_array0_gt_0); - - // Building the assertions in the loop unrolling - Expr index = em.mkConst(new BitVector(index_size, 0)); - Expr old_current = em.mkExpr(Kind.SELECT, current_array, index); - Expr two = em.mkConst(new BitVector(32, 2)); - - vectorExpr assertions = new vectorExpr(em); - for (int i = 1; i < k; ++i) { - index = em.mkConst( - new BitVector(index_size, new edu.stanford.CVC4.Integer(i))); - Expr new_current = em.mkExpr(Kind.BITVECTOR_MULT, two, old_current); - // current[i] = 2 * current[i-1] - current_array = em.mkExpr(Kind.STORE, current_array, index, new_current); - // current[i-1] < current [i] - Expr current_slt_new_current = em.mkExpr(Kind.BITVECTOR_SLT, old_current, new_current); - assertions.add(current_slt_new_current); - - old_current = em.mkExpr(Kind.SELECT, current_array, index); - } - - Expr query = em.mkExpr(Kind.NOT, em.mkExpr(Kind.AND, assertions)); - smt.assertFormula(query); - - Result.Sat expect = Result.Sat.SAT; - Result.Sat actual = smt.checkSat(em.mkConst(true)).isSat(); - assertEquals(expect, actual); - } - - private static int log2(int n) { - return (int) Math.round(Math.log(n) / Math.log(2)); - } -} diff --git a/test/java/CMakeLists.txt b/test/java/CMakeLists.txt deleted file mode 100644 index 3293ca0ab..000000000 --- a/test/java/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################### -# Top contributors (to current version): -# Mathias Preiner, Andres Noetzli -# -# This file is part of the cvc5 project. -# -# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS -# in the top-level source directory and their institutional affiliations. -# All rights reserved. See the file COPYING in the top-level source -# directory for licensing information. -# ############################################################################# -# -# The build system configuration. -## - -find_package(Java REQUIRED) -find_package(JUnit 4.0 REQUIRED) -include(UseJava) - -set(java_test_src_files - BitVectors.java - BitVectorsAndArrays.java - Combination.java - HelloWorld.java - Issue2846.java - LinearArith.java -) - -add_jar(build-javatests - SOURCES ${java_test_src_files} - INCLUDE_JARS - ${CMAKE_BINARY_DIR}/src/bindings/java/CVC4.jar - ${JUnit_JAR} - OUTPUT_NAME javatests -) -add_dependencies(build-javatests cvc4jar) -add_dependencies(build-tests build-javatests) - -# Add java tests to ctest -set(classpath "${CMAKE_CURRENT_BINARY_DIR}/javatests.jar") -set(classpath "${classpath}:${CMAKE_BINARY_DIR}/src/bindings/java/CVC4.jar") -set(classpath "${classpath}:${JUnit_JAR}:${JUnit_JAR_DEPS}") - -foreach(src_file ${java_test_src_files}) - string(REPLACE ".java" "" name ${src_file}) - add_test( - NAME ${name} - COMMAND - ${Java_JAVA_EXECUTABLE} - -Djava.library.path=${CMAKE_BINARY_DIR}/src/bindings/java/ - -cp ${classpath} - org.junit.runner.JUnitCore - ${name} - ) - set_tests_properties(${name} PROPERTIES LABELS "java") -endforeach() diff --git a/test/java/Combination.java b/test/java/Combination.java deleted file mode 100644 index 21795942b..000000000 --- a/test/java/Combination.java +++ /dev/null @@ -1,90 +0,0 @@ -/****************************************************************************** - * Top contributors (to current version): - * Pat Hawks, Andres Noetzli, Andrew Reynolds - * - * This file is part of the cvc5 project. - * - * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS - * in the top-level source directory and their institutional affiliations. - * All rights reserved. See the file COPYING in the top-level source - * directory for licensing information. - * **************************************************************************** - * - * [[ Add one-line brief description here ]] - * - * [[ Add lengthier description here ]] - * \todo document this file - */ - -import static org.junit.Assert.assertEquals; - -import edu.stanford.CVC4.*; -import org.junit.Before; -import org.junit.Test; - -public class Combination { - static { - System.loadLibrary("cvc4jni"); - } - ExprManager em; - SmtEngine smt; - - @Before - public void initialize() { - em = new ExprManager(); - smt = new SmtEngine(em); - } - - @Test - public void evaluatesExpression() { - smt.setOption("tlimit", new SExpr(100)); - smt.setOption("produce-models", new SExpr(true)); // Produce Models - smt.setOption("output-language", new SExpr("cvc4")); // output-language - smt.setOption("dag-thresh", new SExpr(0)); //Disable dagifying the output - smt.setLogic("QF_UFLIRA"); - - // Sorts - SortType u = em.mkSort("u"); - Type integer = em.integerType(); - Type booleanType = em.booleanType(); - Type uToInt = em.mkFunctionType(u, integer); - Type intPred = em.mkFunctionType(integer, booleanType); - - // Variables - Expr x = em.mkVar("x", u); - Expr y = em.mkVar("y", u); - - // Functions - Expr f = em.mkVar("f", uToInt); - Expr p = em.mkVar("p", intPred); - - // Constants - Expr zero = em.mkConst(new Rational(0)); - Expr one = em.mkConst(new Rational(1)); - - // Terms - Expr f_x = em.mkExpr(Kind.APPLY_UF, f, x); - Expr f_y = em.mkExpr(Kind.APPLY_UF, f, y); - Expr sum = em.mkExpr(Kind.PLUS, f_x, f_y); - Expr p_0 = em.mkExpr(Kind.APPLY_UF, p, zero); - Expr p_f_y = em.mkExpr(Kind.APPLY_UF, p, f_y); - - // Construct the assumptions - Expr assumptions = - em.mkExpr(Kind.AND, - em.mkExpr(Kind.LEQ, zero, f_x), // 0 <= f(x) - em.mkExpr(Kind.LEQ, zero, f_y), // 0 <= f(y) - em.mkExpr(Kind.LEQ, sum, one), // f(x) + f(y) <= 1 - p_0.notExpr(), // not p(0) - p_f_y); // p(f(y)) - smt.assertFormula(assumptions); - - assertEquals(Result.Entailment.ENTAILED, - smt.checkEntailed(em.mkExpr(Kind.DISTINCT, x, y)).isEntailed()); - - assertEquals( - Result.Sat.SAT, - smt.checkSat(em.mkConst(true)).isSat() - ); - } -} diff --git a/test/java/HelloWorld.java b/test/java/HelloWorld.java deleted file mode 100644 index 65cada854..000000000 --- a/test/java/HelloWorld.java +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************** - * Top contributors (to current version): - * Pat Hawks, Andres Noetzli - * - * This file is part of the cvc5 project. - * - * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS - * in the top-level source directory and their institutional affiliations. - * All rights reserved. See the file COPYING in the top-level source - * directory for licensing information. - * **************************************************************************** - * - * [[ Add one-line brief description here ]] - * - * [[ Add lengthier description here ]] - * \todo document this file - */ - -import static org.junit.Assert.assertEquals; - -import edu.stanford.CVC4.*; -import org.junit.Before; -import org.junit.Test; - -public class HelloWorld { - static { - System.loadLibrary("cvc4jni"); - } - ExprManager em; - SmtEngine smt; - - @Before - public void initialize() { - em = new ExprManager(); - smt = new SmtEngine(em); - } - - @Test - public void evaluatesExpression() { - Expr helloworld = em.mkVar("Hello World!", em.booleanType()); - Result.Entailment expect = Result.Entailment.NOT_ENTAILED; - Result.Entailment actual = smt.checkEntailed(helloworld).isEntailed(); - assertEquals(actual, expect); - } -} diff --git a/test/java/Issue2846.java b/test/java/Issue2846.java deleted file mode 100644 index c7be5e718..000000000 --- a/test/java/Issue2846.java +++ /dev/null @@ -1,65 +0,0 @@ -/****************************************************************************** - * Top contributors (to current version): - * Andres Noetzli, Morgan Deters - * - * This file is part of the cvc5 project. - * - * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS - * in the top-level source directory and their institutional affiliations. - * All rights reserved. See the file COPYING in the top-level source - * directory for licensing information. - * **************************************************************************** - * - * Test case for issue #2846 - * - * This test case tests whether the dependency information for keeping the - * ExprManager alive is maintained correctly. - */ - -import edu.stanford.CVC4.*; -import org.junit.Test; - -public class Issue2846 { - static { - System.loadLibrary("cvc4jni"); - } - - @Test - public void test() throws InterruptedException { - testInternal(); - gc("h"); - } - - private static void testInternal() throws InterruptedException { - ExprManager em = new ExprManager(); - SmtEngine smt = new SmtEngine(em); - smt.setOption("produce-models", new SExpr(true)); - Expr x = em.mkVar("x", em.integerType()); - Expr y = em.mkVar("y", em.integerType()); - Expr z = em.mkVar("z", em.integerType()); - gc("a"); - Expr a1 = em.mkExpr(Kind.GT, x, em.mkExpr(Kind.PLUS, y, z)); - gc("b"); - smt.assertFormula(a1); - gc("c"); - Expr a2 = em.mkExpr(Kind.LT, y, z); - gc("d"); - smt.assertFormula(a2); - gc("e"); - System.out.println(a1); - System.out.println(a2); - gc("f"); - Result res = smt.checkSat(); - gc("g"); - System.out.println("Res = " + res); - System.out.println("x = " + smt.getValue(x)); - System.out.println("y = " + smt.getValue(y)); - System.out.println("z = " + smt.getValue(z)); - } - - private static void gc(String msg) throws InterruptedException { - System.out.println("calling gc " + msg); - Thread.sleep(100); - System.gc(); - } -} diff --git a/test/java/LinearArith.java b/test/java/LinearArith.java deleted file mode 100644 index 8bd0673d9..000000000 --- a/test/java/LinearArith.java +++ /dev/null @@ -1,89 +0,0 @@ -/****************************************************************************** - * Top contributors (to current version): - * Pat Hawks, Andres Noetzli - * - * This file is part of the cvc5 project. - * - * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS - * in the top-level source directory and their institutional affiliations. - * All rights reserved. See the file COPYING in the top-level source - * directory for licensing information. - * **************************************************************************** - * - * [[ Add one-line brief description here ]] - * - * [[ Add lengthier description here ]] - * \todo document this file - */ - -import static org.junit.Assert.assertEquals; - -import edu.stanford.CVC4.*; -import org.junit.Before; -import org.junit.Test; - -public class LinearArith { - static { - System.loadLibrary("cvc4jni"); - } - ExprManager em; - SmtEngine smt; - - @Before - public void initialize() { - em = new ExprManager(); - smt = new SmtEngine(em); - } - - @Test - public void evaluatesExpression() { - smt.setLogic("QF_LIRA"); // Set the logic - - // Prove that if given x (Integer) and y (Real) then - // the maximum value of y - x is 2/3 - - // Types - Type real = em.realType(); - Type integer = em.integerType(); - - // Variables - Expr x = em.mkVar("x", integer); - Expr y = em.mkVar("y", real); - - // Constants - Expr three = em.mkConst(new Rational(3)); - Expr neg2 = em.mkConst(new Rational(-2)); - Expr two_thirds = em.mkConst(new Rational(2,3)); - - // Terms - Expr three_y = em.mkExpr(Kind.MULT, three, y); - Expr diff = em.mkExpr(Kind.MINUS, y, x); - - // Formulas - Expr x_geq_3y = em.mkExpr(Kind.GEQ, x, three_y); - Expr x_leq_y = em.mkExpr(Kind.LEQ, x, y); - Expr neg2_lt_x = em.mkExpr(Kind.LT, neg2, x); - - Expr assumptions = - em.mkExpr(Kind.AND, x_geq_3y, x_leq_y, neg2_lt_x); - smt.assertFormula(assumptions); - smt.push(); - Expr diff_leq_two_thirds = em.mkExpr(Kind.LEQ, diff, two_thirds); - - assertEquals(Result.Entailment.ENTAILED, - smt.checkEntailed(diff_leq_two_thirds).isEntailed()); - - smt.pop(); - - smt.push(); - Expr diff_is_two_thirds = em.mkExpr(Kind.EQUAL, diff, two_thirds); - smt.assertFormula(diff_is_two_thirds); - - assertEquals( - Result.Sat.SAT, - smt.checkSat(em.mkConst(true)).isSat() - ); - - smt.pop(); - } -} diff --git a/test/python/CMakeLists.txt b/test/python/CMakeLists.txt index 59911299b..92fcb2a48 100644 --- a/test/python/CMakeLists.txt +++ b/test/python/CMakeLists.txt @@ -17,7 +17,7 @@ check_python_module("pytest") # Add Python bindings API tests. -macro(cvc4_add_python_api_test name filename) +macro(cvc5_add_python_api_test name filename) # We create test target 'python/unit/api/myapitest' and run it with # 'ctest -R "python/unit/api/myapitest"'. add_test (NAME python/unit/api/${name} @@ -27,5 +27,5 @@ add_test (NAME python/unit/api/${name} endmacro() # add specific test files -cvc4_add_python_api_test(pytest_solver unit/api/test_solver.py) -cvc4_add_python_api_test(pytest_sort unit/api/test_sort.py) +cvc5_add_python_api_test(pytest_solver unit/api/test_solver.py) +cvc5_add_python_api_test(pytest_sort unit/api/test_sort.py) diff --git a/test/python/unit/api/test_solver.py b/test/python/unit/api/test_solver.py index b4a19afa8..74eda63bc 100644 --- a/test/python/unit/api/test_solver.py +++ b/test/python/unit/api/test_solver.py @@ -12,14 +12,14 @@ ## import pytest -import pycvc4 +import pycvc5 import sys -from pycvc4 import kinds +from pycvc5 import kinds @pytest.fixture def solver(): - return pycvc4.Solver() + return pycvc5.Solver() def test_recoverable_exception(solver): solver.setOption("produce-models", "true") @@ -31,9 +31,9 @@ def test_recoverable_exception(solver): def test_supports_floating_point(solver): if solver.supportsFloatingPoint(): try: - solver.mkRoundingMode(pycvc4.RoundNearestTiesToEven) + solver.mkRoundingMode(pycvc5.RoundNearestTiesToEven) except RuntimeError: pytest.fail() else: with pytest.raises(RuntimeError): - solver.mkRoundingMode(pycvc4.RoundNearestTiesToEven) + solver.mkRoundingMode(pycvc5.RoundNearestTiesToEven) diff --git a/test/python/unit/api/test_sort.py b/test/python/unit/api/test_sort.py index b4aa3a11f..5e86382ee 100644 --- a/test/python/unit/api/test_sort.py +++ b/test/python/unit/api/test_sort.py @@ -1,27 +1,29 @@ -##################### -## test_sort.py -## Top contributors (to current version): -## Yoni Zohar -## This file is part of the CVC4 project. -## Copyright (c) 2009-2021 by the authors listed in the file AUTHORS -## in the top-level source directory and their institutional affiliations. -## All rights reserved. See the file COPYING in the top-level source -## directory for licensing information. +############################################################################### +# Top contributors (to current version): +# Yoni Zohar, Makai Mann +# +# This file is part of the cvc5 project. +# +# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS +# in the top-level source directory and their institutional affiliations. +# All rights reserved. See the file COPYING in the top-level source +# directory for licensing information. +# ############################################################################# +# +# Unit tests for sort API. +# +# Obtained by translating test/unit/api/sort_black.cpp ## -## ######################################################## -## -## Unit tests for sort API. -## Obtained by translating test/unit/api/sort_black.cpp import pytest -import pycvc4 -from pycvc4 import kinds -from pycvc4 import Sort +import pycvc5 +from pycvc5 import kinds +from pycvc5 import Sort @pytest.fixture def solver(): - return pycvc4.Solver() + return pycvc5.Solver() def create_datatype_sort(solver): @@ -561,6 +563,6 @@ def test_sort_scoped_tostring(solver): uninterp_sort = solver.mkUninterpretedSort(name) assert str(bvsort8) == "(_ BitVec 8)" assert str(uninterp_sort) == name - solver2 = pycvc4.Solver() + solver2 = pycvc5.Solver() assert str(bvsort8) == "(_ BitVec 8)" assert str(uninterp_sort) == name diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt index 24d6602e9..cbe62c26d 100644 --- a/test/regress/CMakeLists.txt +++ b/test/regress/CMakeLists.txt @@ -2613,10 +2613,10 @@ set(regression_disabled_tests # Add target 'regress', builds and runs # > regression tests of levels 0 and 1 -get_target_property(path_to_cvc4 cvc4-bin RUNTIME_OUTPUT_DIRECTORY) +get_target_property(path_to_cvc5 cvc5-bin RUNTIME_OUTPUT_DIRECTORY) set(run_regress_script ${CMAKE_CURRENT_LIST_DIR}/run_regression.py) -add_custom_target(build-regress DEPENDS cvc4-bin) +add_custom_target(build-regress DEPENDS cvc5-bin) add_dependencies(build-tests build-regress) add_custom_target(regress @@ -2624,11 +2624,11 @@ add_custom_target(regress ctest --output-on-failure -L "regress[0-2]" -j${CTEST_NTHREADS} $$ARGS DEPENDS build-regress) -macro(cvc4_add_regression_test level file) +macro(cvc5_add_regression_test level file) add_test(${file} ${run_regress_script} ${RUN_REGRESSION_ARGS} - ${path_to_cvc4}/cvc4 ${CMAKE_CURRENT_LIST_DIR}/${file}) + ${path_to_cvc5}/cvc5 ${CMAKE_CURRENT_LIST_DIR}/${file}) set_tests_properties(${file} PROPERTIES LABELS "regress${level}") # For CMake 3.9.0 and newer, skipped tests do not count as a failure anymore: @@ -2643,26 +2643,26 @@ endmacro() if(NOT ${CMAKE_VERSION} VERSION_LESS "3.9.0") # For CMake 3.9.0 and newer, we want the regression script to return 77 for # skipped tests, such that we can mark them as skipped. See the - # `cvc4_add_regression_test` macro for more details. + # `cvc5_add_regression_test` macro for more details. set(RUN_REGRESSION_ARGS ${RUN_REGRESSION_ARGS} --use-skip-return-code) endif() foreach(file ${regress_0_tests}) - cvc4_add_regression_test(0 ${file}) + cvc5_add_regression_test(0 ${file}) endforeach() foreach(file ${regress_1_tests}) - cvc4_add_regression_test(1 ${file}) + cvc5_add_regression_test(1 ${file}) endforeach() foreach(file ${regress_2_tests}) - cvc4_add_regression_test(2 ${file}) + cvc5_add_regression_test(2 ${file}) endforeach() foreach(file ${regress_3_tests}) - cvc4_add_regression_test(3 ${file}) + cvc5_add_regression_test(3 ${file}) endforeach() foreach(file ${regress_4_tests}) - cvc4_add_regression_test(4 ${file}) + cvc5_add_regression_test(4 ${file}) endforeach() diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index e99d92303..f0971db62 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -33,11 +33,10 @@ add_custom_target(units DEPENDS build-units) set(CVC5_UNIT_TEST_FLAGS_BLACK - -D__BUILDING_CVC4LIB_UNIT_TEST -D__BUILDING_CVC4PARSERLIB_UNIT_TEST - -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS) + -D__BUILDING_CVC5LIB_UNIT_TEST -D__BUILDING_CVC5PARSERLIB_UNIT_TEST) # Generate and add unit test. -macro(cvc4_add_unit_test is_white name output_dir) +macro(cvc5_add_unit_test is_white name output_dir) set(test_src ${CMAKE_CURRENT_LIST_DIR}/${name}.cpp) add_executable(${name} ${test_src}) target_compile_definitions(${name} PRIVATE ${CVC5_UNIT_TEST_FLAGS_BLACK}) @@ -79,11 +78,11 @@ macro(cvc4_add_unit_test is_white name output_dir) set_tests_properties(${test_name} PROPERTIES LABELS "unit") endmacro() -macro(cvc4_add_unit_test_black name output_dir) - cvc4_add_unit_test(FALSE ${name} ${output_dir}) +macro(cvc5_add_unit_test_black name output_dir) + cvc5_add_unit_test(FALSE ${name} ${output_dir}) endmacro() -macro(cvc4_add_unit_test_white name output_dir) - cvc4_add_unit_test(TRUE ${name} ${output_dir}) +macro(cvc5_add_unit_test_white name output_dir) + cvc5_add_unit_test(TRUE ${name} ${output_dir}) endmacro() add_subdirectory(api) diff --git a/test/unit/api/CMakeLists.txt b/test/unit/api/CMakeLists.txt index 899019b59..c01b1cfe0 100644 --- a/test/unit/api/CMakeLists.txt +++ b/test/unit/api/CMakeLists.txt @@ -14,13 +14,13 @@ ## # Add unit tests. -cvc4_add_unit_test_black(datatype_api_black api) -cvc4_add_unit_test_black(grammar_black api) -cvc4_add_unit_test_black(op_black api) -cvc4_add_unit_test_white(op_white api) -cvc4_add_unit_test_black(result_black api) -cvc4_add_unit_test_black(solver_black api) -cvc4_add_unit_test_white(solver_white api) -cvc4_add_unit_test_black(sort_black api) -cvc4_add_unit_test_black(term_black api) -cvc4_add_unit_test_white(term_white api) +cvc5_add_unit_test_black(datatype_api_black api) +cvc5_add_unit_test_black(grammar_black api) +cvc5_add_unit_test_black(op_black api) +cvc5_add_unit_test_white(op_white api) +cvc5_add_unit_test_black(result_black api) +cvc5_add_unit_test_black(solver_black api) +cvc5_add_unit_test_white(solver_white api) +cvc5_add_unit_test_black(sort_black api) +cvc5_add_unit_test_black(term_black api) +cvc5_add_unit_test_white(term_white api) diff --git a/test/unit/api/solver_black.cpp b/test/unit/api/solver_black.cpp index 5240d8020..c0258be9a 100644 --- a/test/unit/api/solver_black.cpp +++ b/test/unit/api/solver_black.cpp @@ -1814,9 +1814,9 @@ TEST_F(TestApiBlackSolver, blockModelValues5) TEST_F(TestApiBlackSolver, setInfo) { - ASSERT_THROW(d_solver.setInfo("cvc4-lagic", "QF_BV"), CVC5ApiException); + ASSERT_THROW(d_solver.setInfo("cvc5-lagic", "QF_BV"), CVC5ApiException); ASSERT_THROW(d_solver.setInfo("cvc2-logic", "QF_BV"), CVC5ApiException); - ASSERT_THROW(d_solver.setInfo("cvc4-logic", "asdf"), CVC5ApiException); + ASSERT_THROW(d_solver.setInfo("cvc5-logic", "asdf"), CVC5ApiException); ASSERT_NO_THROW(d_solver.setInfo("source", "asdf")); ASSERT_NO_THROW(d_solver.setInfo("category", "asdf")); diff --git a/test/unit/base/CMakeLists.txt b/test/unit/base/CMakeLists.txt index 65d352c0b..89f28390e 100644 --- a/test/unit/base/CMakeLists.txt +++ b/test/unit/base/CMakeLists.txt @@ -14,4 +14,4 @@ ## # Add unit tests. -cvc4_add_unit_test_black(map_util_black base) +cvc5_add_unit_test_black(map_util_black base) diff --git a/test/unit/context/CMakeLists.txt b/test/unit/context/CMakeLists.txt index e5a8caf0f..565b828de 100644 --- a/test/unit/context/CMakeLists.txt +++ b/test/unit/context/CMakeLists.txt @@ -14,10 +14,10 @@ ## # Add unit tests. -cvc4_add_unit_test_black(cdlist_black context) -cvc4_add_unit_test_black(cdhashmap_black context) -cvc4_add_unit_test_white(cdhashmap_white context) -cvc4_add_unit_test_black(cdo_black context) -cvc4_add_unit_test_black(context_black context) -cvc4_add_unit_test_black(context_mm_black context) -cvc4_add_unit_test_white(context_white context) +cvc5_add_unit_test_black(cdlist_black context) +cvc5_add_unit_test_black(cdhashmap_black context) +cvc5_add_unit_test_white(cdhashmap_white context) +cvc5_add_unit_test_black(cdo_black context) +cvc5_add_unit_test_black(context_black context) +cvc5_add_unit_test_black(context_mm_black context) +cvc5_add_unit_test_white(context_white context) diff --git a/test/unit/main/CMakeLists.txt b/test/unit/main/CMakeLists.txt index 36c4cfb48..b15e89bbd 100644 --- a/test/unit/main/CMakeLists.txt +++ b/test/unit/main/CMakeLists.txt @@ -14,4 +14,4 @@ ## # Add unit tests. -cvc4_add_unit_test_black(interactive_shell_black main) +cvc5_add_unit_test_black(interactive_shell_black main) diff --git a/test/unit/memory.h b/test/unit/memory.h index 68982077c..574488e21 100644 --- a/test/unit/memory.h +++ b/test/unit/memory.h @@ -19,7 +19,7 @@ * * The WithLimitedMemory destructor will re-establish the previous limit. * - * This class does not exist in CVC4_MEMORY_LIMITING_DISABLED is defined. + * This class does not exist in CVC5_MEMORY_LIMITING_DISABLED is defined. * This can be disabled for a variety of reasons. */ diff --git a/test/unit/node/CMakeLists.txt b/test/unit/node/CMakeLists.txt index 5f4c3458c..c42e0452a 100644 --- a/test/unit/node/CMakeLists.txt +++ b/test/unit/node/CMakeLists.txt @@ -14,18 +14,18 @@ ## # Add unit tests. -cvc4_add_unit_test_black(attribute_black expr) -cvc4_add_unit_test_white(attribute_white expr) -cvc4_add_unit_test_black(kind_black expr) -cvc4_add_unit_test_black(kind_map_black expr) -cvc4_add_unit_test_black(node_black expr) -cvc4_add_unit_test_black(node_algorithm_black expr) -cvc4_add_unit_test_black(node_builder_black expr) -cvc4_add_unit_test_black(node_manager_black expr) -cvc4_add_unit_test_white(node_manager_white expr) -cvc4_add_unit_test_black(node_self_iterator_black expr) -cvc4_add_unit_test_black(node_traversal_black expr) -cvc4_add_unit_test_white(node_white expr) -cvc4_add_unit_test_black(symbol_table_black expr) -cvc4_add_unit_test_black(type_cardinality_black expr) -cvc4_add_unit_test_white(type_node_white expr) +cvc5_add_unit_test_black(attribute_black expr) +cvc5_add_unit_test_white(attribute_white expr) +cvc5_add_unit_test_black(kind_black expr) +cvc5_add_unit_test_black(kind_map_black expr) +cvc5_add_unit_test_black(node_black expr) +cvc5_add_unit_test_black(node_algorithm_black expr) +cvc5_add_unit_test_black(node_builder_black expr) +cvc5_add_unit_test_black(node_manager_black expr) +cvc5_add_unit_test_white(node_manager_white expr) +cvc5_add_unit_test_black(node_self_iterator_black expr) +cvc5_add_unit_test_black(node_traversal_black expr) +cvc5_add_unit_test_white(node_white expr) +cvc5_add_unit_test_black(symbol_table_black expr) +cvc5_add_unit_test_black(type_cardinality_black expr) +cvc5_add_unit_test_white(type_node_white expr) diff --git a/test/unit/parser/CMakeLists.txt b/test/unit/parser/CMakeLists.txt index 0044a1d97..890a38f76 100644 --- a/test/unit/parser/CMakeLists.txt +++ b/test/unit/parser/CMakeLists.txt @@ -14,5 +14,5 @@ ## # Add unit tests. -cvc4_add_unit_test_black(parser_black parser) -cvc4_add_unit_test_black(parser_builder_black parser) +cvc5_add_unit_test_black(parser_black parser) +cvc5_add_unit_test_black(parser_builder_black parser) diff --git a/test/unit/preprocessing/CMakeLists.txt b/test/unit/preprocessing/CMakeLists.txt index c16cb07fc..0cebfb604 100644 --- a/test/unit/preprocessing/CMakeLists.txt +++ b/test/unit/preprocessing/CMakeLists.txt @@ -14,5 +14,5 @@ ## # Add unit tests. -cvc4_add_unit_test_white(pass_bv_gauss_white preprocessing) -cvc4_add_unit_test_white(pass_foreign_theory_rewrite_white preprocessing) +cvc5_add_unit_test_white(pass_bv_gauss_white preprocessing) +cvc5_add_unit_test_white(pass_foreign_theory_rewrite_white preprocessing) diff --git a/test/unit/printer/CMakeLists.txt b/test/unit/printer/CMakeLists.txt index 7cec81221..1b3e3c130 100644 --- a/test/unit/printer/CMakeLists.txt +++ b/test/unit/printer/CMakeLists.txt @@ -14,4 +14,4 @@ ## # Add unit tests. -cvc4_add_unit_test_black(smt2_printer_black printer) +cvc5_add_unit_test_black(smt2_printer_black printer) diff --git a/test/unit/prop/CMakeLists.txt b/test/unit/prop/CMakeLists.txt index 8e93c14f9..57143bf90 100644 --- a/test/unit/prop/CMakeLists.txt +++ b/test/unit/prop/CMakeLists.txt @@ -14,4 +14,4 @@ ## # Add unit tests. -cvc4_add_unit_test_white(cnf_stream_white prop) +cvc5_add_unit_test_white(cnf_stream_white prop) diff --git a/test/unit/theory/CMakeLists.txt b/test/unit/theory/CMakeLists.txt index 75dd8c32c..d0c0e2bd2 100644 --- a/test/unit/theory/CMakeLists.txt +++ b/test/unit/theory/CMakeLists.txt @@ -14,27 +14,27 @@ ## # Add unit tests. -cvc4_add_unit_test_black(regexp_operation_black theory) -cvc4_add_unit_test_black(theory_black theory) -cvc4_add_unit_test_white(evaluator_white theory) -cvc4_add_unit_test_white(logic_info_white theory) -cvc4_add_unit_test_white(sequences_rewriter_white theory) -cvc4_add_unit_test_white(strings_rewriter_white theory) -cvc4_add_unit_test_white(theory_arith_white theory) -cvc4_add_unit_test_white(theory_bags_normal_form_white theory) -cvc4_add_unit_test_white(theory_bags_rewriter_white theory) -cvc4_add_unit_test_white(theory_bags_type_rules_white theory) -cvc4_add_unit_test_white(theory_bv_rewriter_white theory) -cvc4_add_unit_test_white(theory_bv_white theory) -cvc4_add_unit_test_white(theory_bv_opt_white theory) -cvc4_add_unit_test_white(theory_bv_int_blaster_white theory) -cvc4_add_unit_test_white(theory_engine_white theory) -cvc4_add_unit_test_white(theory_int_opt_white theory) -cvc4_add_unit_test_white(theory_quantifiers_bv_instantiator_white theory) -cvc4_add_unit_test_white(theory_quantifiers_bv_inverter_white theory) -cvc4_add_unit_test_white(theory_sets_type_enumerator_white theory) -cvc4_add_unit_test_white(theory_sets_type_rules_white theory) -cvc4_add_unit_test_white(theory_strings_skolem_cache_black theory) -cvc4_add_unit_test_white(theory_strings_word_white theory) -cvc4_add_unit_test_white(theory_white theory) -cvc4_add_unit_test_white(type_enumerator_white theory) +cvc5_add_unit_test_black(regexp_operation_black theory) +cvc5_add_unit_test_black(theory_black theory) +cvc5_add_unit_test_white(evaluator_white theory) +cvc5_add_unit_test_white(logic_info_white theory) +cvc5_add_unit_test_white(sequences_rewriter_white theory) +cvc5_add_unit_test_white(strings_rewriter_white theory) +cvc5_add_unit_test_white(theory_arith_white theory) +cvc5_add_unit_test_white(theory_bags_normal_form_white theory) +cvc5_add_unit_test_white(theory_bags_rewriter_white theory) +cvc5_add_unit_test_white(theory_bags_type_rules_white theory) +cvc5_add_unit_test_white(theory_bv_rewriter_white theory) +cvc5_add_unit_test_white(theory_bv_white theory) +cvc5_add_unit_test_white(theory_bv_opt_white theory) +cvc5_add_unit_test_white(theory_bv_int_blaster_white theory) +cvc5_add_unit_test_white(theory_engine_white theory) +cvc5_add_unit_test_white(theory_int_opt_white theory) +cvc5_add_unit_test_white(theory_quantifiers_bv_instantiator_white theory) +cvc5_add_unit_test_white(theory_quantifiers_bv_inverter_white theory) +cvc5_add_unit_test_white(theory_sets_type_enumerator_white theory) +cvc5_add_unit_test_white(theory_sets_type_rules_white theory) +cvc5_add_unit_test_white(theory_strings_skolem_cache_black theory) +cvc5_add_unit_test_white(theory_strings_word_white theory) +cvc5_add_unit_test_white(theory_white theory) +cvc5_add_unit_test_white(type_enumerator_white theory) diff --git a/test/unit/util/CMakeLists.txt b/test/unit/util/CMakeLists.txt index 85cc04c94..26ab40614 100644 --- a/test/unit/util/CMakeLists.txt +++ b/test/unit/util/CMakeLists.txt @@ -14,25 +14,25 @@ ## # Add unit tests. -cvc4_add_unit_test_white(array_store_all_white util) -cvc4_add_unit_test_white(assert_white util) -cvc4_add_unit_test_black(binary_heap_black util) -cvc4_add_unit_test_black(bitvector_black util) -cvc4_add_unit_test_black(boolean_simplification_black util) -cvc4_add_unit_test_black(cardinality_black util) -cvc4_add_unit_test_white(check_white util) -cvc4_add_unit_test_black(configuration_black util) -cvc4_add_unit_test_black(datatype_black util) -cvc4_add_unit_test_black(exception_black util) +cvc5_add_unit_test_white(array_store_all_white util) +cvc5_add_unit_test_white(assert_white util) +cvc5_add_unit_test_black(binary_heap_black util) +cvc5_add_unit_test_black(bitvector_black util) +cvc5_add_unit_test_black(boolean_simplification_black util) +cvc5_add_unit_test_black(cardinality_black util) +cvc5_add_unit_test_white(check_white util) +cvc5_add_unit_test_black(configuration_black util) +cvc5_add_unit_test_black(datatype_black util) +cvc5_add_unit_test_black(exception_black util) if(CVC5_USE_SYMFPU) -cvc4_add_unit_test_black(floatingpoint_black util) +cvc5_add_unit_test_black(floatingpoint_black util) endif() -cvc4_add_unit_test_black(integer_black util) -cvc4_add_unit_test_white(integer_white util) -cvc4_add_unit_test_black(output_black util) -cvc4_add_unit_test_black(rational_black util) -cvc4_add_unit_test_white(rational_white util) +cvc5_add_unit_test_black(integer_black util) +cvc5_add_unit_test_white(integer_white util) +cvc5_add_unit_test_black(output_black util) +cvc5_add_unit_test_black(rational_black util) +cvc5_add_unit_test_white(rational_white util) if(CVC5_USE_POLY_IMP) -cvc4_add_unit_test_black(real_algebraic_number_black util) +cvc5_add_unit_test_black(real_algebraic_number_black util) endif() -cvc4_add_unit_test_black(stats_black util) +cvc5_add_unit_test_black(stats_black util) diff --git a/test/unit/util/check_white.cpp b/test/unit/util/check_white.cpp index 335c8c3b2..ff4712c63 100644 --- a/test/unit/util/check_white.cpp +++ b/test/unit/util/check_white.cpp @@ -28,7 +28,7 @@ class TestUtilWhiteCheck : public TestInternal static constexpr uint32_t K_ONE = 1; // This test just checks that this statement compiles. - std::string terminalCvc4Fatal() const + std::string terminalCvc5Fatal() const { CVC5_FATAL() << "This is a test that confirms that CVC5_FATAL can be a " "terminal statement in a function that has a non-void " diff --git a/test/unit/util/configuration_black.cpp b/test/unit/util/configuration_black.cpp index a651085c6..0b54af43a 100644 --- a/test/unit/util/configuration_black.cpp +++ b/test/unit/util/configuration_black.cpp @@ -77,7 +77,7 @@ TEST_F(TestUtilBlackConfiguration, static_flags) TEST_F(TestUtilBlackConfiguration, package_name) { - ASSERT_EQ(Configuration::getPackageName(), "cvc4"); + ASSERT_EQ(Configuration::getPackageName(), "cvc5"); } TEST_F(TestUtilBlackConfiguration, versions) diff --git a/test/unit/util/output_black.cpp b/test/unit/util/output_black.cpp index 37937769c..8a98a9601 100644 --- a/test/unit/util/output_black.cpp +++ b/test/unit/util/output_black.cpp @@ -10,7 +10,7 @@ * directory for licensing information. * **************************************************************************** * - * Black box testing of CVC4 output classes. + * Black box testing of cvc5 output classes. */ #include