Skip to content

Commit efbf366

Browse files
committed
SMTChecker: Switch CVC4 from API to SMT-LIB2 interface
Instead of compiling `solc` itself with CVC4 support, it is now enough to have `cvc4` executable on PATH when running the compiler. Instead of using API of CVC4, we write the queries to temporary SMT-LIB2 files and call the solver process directly to run on the file.
1 parent ae79d13 commit efbf366

15 files changed

+44
-499
lines changed

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ elseif (${Z3_FOUND})
131131
message("Z3 SMT solver found. This enables optional SMT checking with Z3.")
132132
endif()
133133

134-
find_package(CVC4 QUIET)
135-
if (${CVC4_FOUND})
136-
add_definitions(-DHAVE_CVC4)
134+
find_program(CVC4_PATH cvc4)
135+
if (CVC4_PATH)
136+
add_compile_definitions(CVC4_PATH=${CVC4_PATH})
137137
message("CVC4 SMT solver found. This enables optional SMT checking with CVC4.")
138138
endif()
139139

140-
if (NOT (${Z3_FOUND} OR ${CVC4_FOUND}))
140+
if (NOT (${Z3_FOUND} OR CVC4_PATH))
141141
message("No SMT solver found (or it has been forcefully disabled). Optional SMT checking will not be available.\
142-
\nPlease install Z3 or CVC4 or remove the option disabling them (USE_Z3, USE_CVC4).")
142+
\nPlease install Z3 or CVC4 or remove the option disabling them (USE_Z3).")
143143
endif()
144144

145145
add_subdirectory(libsolutil)

cmake/EthCompilerSettings.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ option(USE_Z3 "Allow compiling with Z3 SMT solver integration" ON)
266266
if(UNIX AND NOT APPLE)
267267
option(USE_Z3_DLOPEN "Dynamically load the Z3 SMT solver instead of linking against it." OFF)
268268
endif()
269-
option(USE_CVC4 "Allow compiling with CVC4 SMT solver integration" ON)
270269

271270
if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
272271
option(USE_LD_GOLD "Use GNU gold linker" ON)

cmake/FindCVC4.cmake

Lines changed: 0 additions & 33 deletions
This file was deleted.

docs/installing-solidity.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,7 @@ The following are dependencies for all builds of Solidity:
336336
+-----------------------------------+-------------------------------------------------------+
337337
| `z3`_ (version 4.8.16+, Optional) | For use with SMT checker. |
338338
+-----------------------------------+-------------------------------------------------------+
339-
| `cvc4`_ (Optional) | For use with SMT checker. |
340-
+-----------------------------------+-------------------------------------------------------+
341339

342-
.. _cvc4: https://cvc4.cs.stanford.edu/web/
343340
.. _Git: https://git-scm.com/download
344341
.. _Boost: https://www.boost.org
345342
.. _CMake: https://cmake.org/download/
@@ -546,12 +543,6 @@ Inside the build folder you can disable them, since they are enabled by default:
546543
# disables only Z3 SMT Solver.
547544
cmake .. -DUSE_Z3=OFF
548545
549-
# disables only CVC4 SMT Solver.
550-
cmake .. -DUSE_CVC4=OFF
551-
552-
# disables both Z3 and CVC4
553-
cmake .. -DUSE_CVC4=OFF -DUSE_Z3=OFF
554-
555546
The Version String in Detail
556547
============================
557548

docs/smtchecker.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ The user can choose which solvers should be used, if available, via the CLI
825825
option ``--model-checker-solvers {all,cvc4,eld,smtlib2,z3}`` or the JSON option
826826
``settings.modelChecker.solvers=[smtlib2,z3]``, where:
827827

828-
- ``cvc4`` is only available if the ``solc`` binary is compiled with it. Only BMC uses ``cvc4``.
828+
- ``cvc4`` is used via its binary which must be installed in the system. Only BMC uses ``cvc4``.
829829
- ``eld`` is used via its binary which must be installed in the system. Only CHC uses ``eld``, and only if ``z3`` is not enabled.
830830
- ``smtlib2`` outputs SMT/Horn queries in the `smtlib2 <http://smtlib.cs.uiowa.edu/>`_ format.
831831
These can be used together with the compiler's `callback mechanism <https://github.com/ethereum/solc-js>`_ so that

libsmtutil/CMakeLists.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ else()
2020
set(z3_SRCS)
2121
endif()
2222

23-
if (${CVC4_FOUND})
24-
set(cvc4_SRCS CVC4Interface.cpp CVC4Interface.h)
25-
else()
26-
set(cvc4_SRCS)
27-
endif()
28-
2923
if (${USE_Z3_DLOPEN})
3024
file(GLOB Z3_HEADERS ${Z3_HEADER_PATH}/z3*.h)
3125
set(Z3_WRAPPER ${CMAKE_CURRENT_BINARY_DIR}/z3wrapper.cpp)
@@ -38,7 +32,7 @@ if (${USE_Z3_DLOPEN})
3832
set(z3_SRCS ${z3_SRCS} ${Z3_WRAPPER} Z3Loader.cpp Z3Loader.h)
3933
endif()
4034

41-
add_library(smtutil ${sources} ${z3_SRCS} ${cvc4_SRCS})
35+
add_library(smtutil ${sources} ${z3_SRCS})
4236
target_link_libraries(smtutil PUBLIC solutil Boost::boost)
4337

4438
if (${USE_Z3_DLOPEN})
@@ -47,7 +41,3 @@ if (${USE_Z3_DLOPEN})
4741
elseif (${Z3_FOUND})
4842
target_link_libraries(smtutil PUBLIC z3::libz3)
4943
endif()
50-
51-
if (${CVC4_FOUND})
52-
target_link_libraries(smtutil PUBLIC CVC4::CVC4)
53-
endif()

0 commit comments

Comments
 (0)