pax_global_header00006660000000000000000000000064147524172220014520gustar00rootroot0000000000000052 comment=f13d74439a5b5c963ac5b02d05ce93a8098018b8 cadical-rel-2.1.3/000077500000000000000000000000001475241722200136635ustar00rootroot00000000000000cadical-rel-2.1.3/.clang-format000066400000000000000000000001451475241722200162360ustar00rootroot00000000000000AlignEscapedNewlines: DontAlign ColumnLimit: 76 SpaceBeforeParens: Always SpaceAfterCStyleCast: true cadical-rel-2.1.3/.dockerignore000066400000000000000000000000131475241722200163310ustar00rootroot00000000000000Dockerfile cadical-rel-2.1.3/.gitignore000066400000000000000000000000171475241722200156510ustar00rootroot00000000000000build makefile cadical-rel-2.1.3/BUILD.md000066400000000000000000000105161475241722200150470ustar00rootroot00000000000000# CaDiCaL Build Use `./configure && make` to configure and build `cadical` in the default `build` sub-directory. This will also build the library `libcadical.a` as well as the model based tester `mobical`: build/cadical build/mobical build/libcadical.a The header file of the library is in src/cadical.hpp The build process requires GNU make. Using the generated `makefile` with GNU make compiles separate object files, which can be cached (for instance with `ccache`). In order to force parallel build you can use the '-j' option either for 'configure' or with 'make'. If the environment variable 'MAKEFLAGS' is set, e.g., 'MAKEFLAGS=-j ./configure', the same effect is achieved and the generated makefile will use those flags. Options ------- You might want to check out options of `./configure -h`, such as ./configure -c # include assertion checking code ./configure -l # include code to really see what the solver is doing ./configure -a # both above and in addition `-g` for debugging. You can easily use multiple build directories, e.g., mkdir debug; cd debug; ../configure -g; make which compiles and builds a debugging version in the sub-directory `debug`, since `-g` was specified as parameter to `configure`. The object files, the library and the binaries are all independent of those in the default build directory `build`. All source files reside in the `src` directory. The library `libcadical.a` is compiled from all the `.cpp` files except `cadical.cpp` and `mobical.cpp`, which provide the applications, i.e., the stand alone solver `cadical` and the model based tester `mobical`. Manual Build ------------ If you can not or do not want to rely on our `configure` script nor on our build system based on GNU `make`, then this is easily doable as follows. mkdir build cd build for f in ../src/*.cpp; do g++ -O3 -DNDEBUG -DNBUILD -c $f; done ar rc libcadical.a `ls *.o | grep -v ical.o` g++ -o cadical cadical.o -L. -lcadical g++ -o mobical mobical.o -L. -lcadical Note that application object files are excluded from the library. Of course you can use different compilation options as well. Since `build.hpp` is not generated in this flow the `-DNBUILD` flag is necessary though, which avoids dependency of `version.cpp` on `build.hpp`. Consequently you will only get very basic version information compiled into the library and binaries (guaranteed is in essence just the version number of the library). And if you really do not care about compilation time nor caching and just want to build the solver once manually then the following also works. g++ -O3 -DNDEBUG -DNBUILD -o cadical `ls *.cpp | grep -v mobical` Further note that the `configure` script provides some feature checks and might generate additional compiler flags necessary for compilation. You might need to set those yourself or just use a modern C++11 compiler. This manual build process using object files is fast enough in combination with caching solutions such as `ccache`. But it lacks the ability of our GNU make solution to run compilation in parallel without additional parallel process scheduling solutions. Cross-Compilation ----------------- We have preliminary support for cross-compilation using MinGW32 (only tested for a Linux compilation host and Windows-64 target host at this point). There are two steps necessary to make this work. First make sure to be able to execute binaries compiled with the cross-compiler directly. Otherwise 'configure' does not work automatically and you have to build manually (as described above). For instance in order to use `wine` to execute the binaries first install `wine` which for instance on Ubuntu just requires sudo apt install wine Then on Linux you might want to look into the `binfmt_misc` module and as root register the appropriate interpreter for `DOSWin`. cd /proc/sys/fs/binfmt_misc echo ':DOSWin:M::MZ::/usr/bin/wine:' > register Finally simply tell the `configure` script to use the cross-compiler. CXX=i686-w64-mingw32-g++ ./configure -static -lpsapi && make cadical Note the use of '-static', which was necessary for me since by default `wine` did not find `libstdc++` if dynamically linked. There is also a dependency on the 'psapi' library. Also `mobical` does not compile with MinGW32 due to too many Unix dependencies and thus only make 'cadical'. cadical-rel-2.1.3/CONTRIBUTING.md000066400000000000000000000035601475241722200161200ustar00rootroot00000000000000# Contributing CaDiCaL is distributed under the MIT license (see [LICENSE](LICENSE) file). By submitting a contribution you automatically accept the conditions described in [LICENSE](LICENSE). Additionally, we ask you to certify that you have the right to submit such contributions. To manage this process we use a mechanism known as Developer Certificate of Origin, which can be acknowledged by signing-off your commits with `git commit -s`. **We require all pull requests to be squashed into a single commit and signed-off.** ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` cadical-rel-2.1.3/Dockerfile000066400000000000000000000016601475241722200156600ustar00rootroot00000000000000# ----------------------------------------------------------------------------- # Builder container # ----------------------------------------------------------------------------- FROM ubuntu:22.04 as builder ENV DEBIAN_FRONTEND "noninteractive" ENV TZ "Europe/Berlin" # Install compiler, build tools and required libraries RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential g++ \ && apt-get clean COPY . /work WORKDIR /work RUN ./configure \ && make # ----------------------------------------------------------------------------- # Runtime container # ----------------------------------------------------------------------------- FROM ubuntu:22.04 as runner ENV DEBIAN_FRONTEND "noninteractive" ENV TZ "Europe/Berlin" COPY --from=builder /work/build/cadical /cadical/cadical COPY --from=builder /work/build/mobical /cadical/mobical WORKDIR /cadical ENTRYPOINT ["/cadical/cadical"] CMD ["--help"] cadical-rel-2.1.3/LICENSE000066400000000000000000000031531475241722200146720ustar00rootroot00000000000000MIT License Copyright (c) 2016-2021 Armin Biere, Johannes Kepler University Linz, Austria Copyright (c) 2020-2021 Mathias Fleury, Johannes Kepler University Linz, Austria Copyright (c) 2020-2021 Nils Froleyks, Johannes Kepler University Linz, Austria Copyright (c) 2022-2024 Katalin Fazekas, Vienna University of Technology, Austria Copyright (c) 2021-2024 Armin Biere, University of Freiburg, Germany Copyright (c) 2021-2024 Mathias Fleury, University of Freiburg, Germany Copyright (c) 2023-2024 Florian Pollitt, University of Freiburg, Germany Copyright (c) 2024-2024 Tobias Faller, University of Freiburg, Germany Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cadical-rel-2.1.3/NEWS.md000066400000000000000000000252171475241722200147700ustar00rootroot00000000000000Version 2.1.3 ------------- - New interface to support propagation of assumptions. The following functions are available now: + `propagate ()`: Applies unit propagation on the assumptions given to the solver previously (supposed to be called instead of `solve ()`). + `get_entrailed_literals (std::vector &)`: In case `propagate ()` returned `0` (UNKNOWN), this function returns (the subset of) those literals that were assigned based on the assumptions and propagation. Those assigned literals that are tainted on the reconstruction stack (due to some preprocessing) are not returned, thus it is safe to combine it with the formula simplifications. - LIDRUP proofs now include information about queries that returned with UNKNOWN result. Version 2.1.2 ------------- - Fixed version number. - Reentrant multi-threaded writing of compressed files fixed with 'closeform' (using 'pipe|fork|exec|closefrom') on Linux. - New IPASIR-UP options, with the same default as in 1.1: + `exteagerreasons` where the solver eagerly asks for reasons before analysing conflicts instead of being lazy (default: eager) + `exteagerrecalc` where the solver recalculates the levels on the trail before conflict analysis (default: on). Mostly useful if the solver provides many propagations in a lazy fashion. Requires `exteagerreasons` to be on to have any effect. - Fix performance regression for incremental SAT solving due to too eager garbage collection before any incremental call in favor of only doing it during variable elimination - Fix performance regression for the SAT anniversary track. - Slight memory usage reduction expected thanks to not allocating some internal array only used for proof and external propagator. - Mobical deterministic compiled with or without logging. - Fixed memory corruption and leaks when allocation of arena fails and further added support in fuzzer to trigger such bad allocations. Version 2.1.0 ------------- - Major IPASIR-UP increment. Please be aware that some of these changes affect the syntax of the API, and thus updating to this version of CaDiCaL requires to modify the consuming code to accommodate to the new syntax: - Notification of assignments is batched into arrays and no more fixed flags are passed during notification (`breaking change`) - Allow clauses learned from the propagator to be deleted (see `is_forgettable` parameter and `are_reasons_forgettable` Boolean flag) (`breaking change`) - Added support to generate incremental proofs (LIDRUP) while using IPASIR-UP - Users can force to backtrack during `cb_decide` (see function `force_backtrack`) - Removed unnecessary notifications of backtrack during inprocessing (supposed to solve issue #92). - Call again `cb_propagate` if during final model checking a new clause is added. - Added a new interface `FixedAssignmentListener`: Eagerly calls a callback whenever a variable is fixed during search. Version 2.0.0 ------------- - We have now a `contrib` directory and for starters there our `CadiCraig` interpolator, which goes through the `Tracer` API. - We moved back to use the C99 flexible array member feature in `Clause` which however is not supported by all C++ compiler configurations, particularly if compiling in pedantic mode. Therefore the `configure` script checks for support of flexible array members and also has a new `--no-flexible` option. - Added `Dockerfile` to support docker containers. - Added `--no-status` to skip printing "s SATISFIABLE" or "s UNSATISFIABLE". This is useful for online proof checking. Version 1.9.5 ------------- - Removed an unexpected performance regression on the anniversary track due to marking forward strengthened redundant clauses as used. Version 1.9.4 ------------- - Simplified code by removing reimply again (but keeping ILB). Version 1.9.3 ------------- - Fixed bogus notification if a user propagator is connected with ILB and after local search preprocessing and a second incremental call lead to an inconsistent trail to assumption mapping, which might have lead to an infinite loop (in very rare cases). Version 1.9.2 ------------- - Important fixes for ILB, trail-reuse and external propagation with assumptions. - Restored effectiveness of Mobical and improved external mock propagator. - Forced garbage collection of binary clauses before restore. - Merge internal status and state encodings and made them consistent. - Disabled non-verbose message if empty clause found in input. - Improved support for IDRUP. Version 1.9.1 ------------- - Fixed position of `idrup` option. Version 1.9.0 ------------- - Clause IDs in binary LRAT proofs are now always signed. - Internal CNF regression suite also checks LRAT proofs now. - Improving the OTFS heuristic (properly bumping literals and considering that the conflict clause is updated). - Making progress to formal 1.9 release with minor fixes for different platforms and compilers. - Refine IPASIR-UP based on feedback from users. Version 1.8.0 ------------- - Explicit `Solver::clause` functions to simplify clause addition. - More fine-grained handling of printing proof size information by adding `bool print = false` flags to the `flush_proof_trace` and the `close_proof_trace` API calls. The former prints the number of addition and deletion steps, while the latter prints the size of the proof size (and the actual number of bytes if compressed). The main effect is that by default printing of proof size disabled for API usage but enabled for the stand-alone solver. Version 1.7.5 ------------- - Decreased verbosity level for printing proof size. Version 1.7.4 ------------- - As `fork` and `wait` do not exist on Windows writing compressed files through `pipe/fork/exec/wait` has to be disabled for Windows cross compilation to go through. Alternatively one could go back to `popen` for writing compressed files on Windows which however is not safe and therefore we simply decided to disable that feature for windows. Compressed file reading still (and as far we are aware safely) uses `popen` and thus also compiles for Windows. Version 1.7.3 ------------- - Replaced the unsafe `popen` approach for compressed file writing with an explicit `pipe/fork/exec/waitpid` flow and accordingly removed the `--safe` configuration option again. - Incremental lazy backtracking (ILB) enabled by `--ilb` allows to add new clauses incrementally while keeping the assignments on the trail. Also works for assumptions (`--ilbassumptions`). - Reimplication (`--reimply`) fixes assignment levels of literals by "elevating" them (assigning a lower decision level and propagating them out-of-order on this lower decision level). Out-of-order assignments are introduced by chronological backtracking, adding external clauses during solving (e.g., by a user propagation) or simply by ILB. Reimplication improves quality of learned clauses and potentially shortens search in such cases. - A new proof tracer interface allows to add a proof `Tracer` through the API (via `connect_proof_tracer`). This feature allows to use custom proof tracers to process clausal proofs on-the-fly while solving. Both proofs steps with proof antecedents (needed for instance for interpolation) as well as without (working directly on DRAT level) are supported. - Reworked options for proof tracing to be less confusing. Support for DRAT, LRAT, FRAT and VeriPB (with or without antecedents). Version 1.7.2 ------------- - Configuration option `--safe` disables writing to a file through `popen` which makes library usage safer. Version 1.7.1 ------------- - Added support for VeriPB proofs (--lrat --lratveripb). - Various fixes: LRAT proofs for constrain (which previously were not traced correctly); internal-external mapping issues for LRAT (worked for user propagator but now also in combination with LRAT); further minor bug fixes. - Added support for LRAT + external propagator in combination. Version 1.7.0 ------------- - Added native LRAT support. Version 1.6.0 ------------- - Added IPASIR-UP functions to the API to support external propagation, external decisions, and clause addition during search. For more details see the following paper at SAT 2023: Katalin Fazekas, Aina Niemetz, Mathias Preiner, Markus Kirchweger, Stefan Szeider and Armin Biere. IPASIR-UP: User Propagators for CDCL. - During decisions the phase set by `void phase (int lit)` has now higher precedence than the initial phase set by options `phase` and `forcephase`. Version 1.5.6 ------------- - Clang formatted all source code (and fixed one failing regression test by disabling `otfs` for it). - Implementing OTFS during conflict analysis (`--otfs`). - The last literal set by vivification is instantiated (`--vivifyinst`). - More accurate tracking of binary clauses in watch lists by updating the size in watch lists. Version 1.5.4 ------------- - Picking highest score literal in assumed clause (`constrain`) and caching of satisfied literal by moving them to the front. - Added `bool flippable (int lit)` to API. - Fixed `val` to return `lit` or `-lit` and not just `-1` and `1`. - Allowing `fixed` between `constrain` in `mobical`. - Fixed LZMA magic header. - Added `bool flip (int lit)` to API. - Fixed different garbage collection times with and without clause IDs (with `./configure -l` or just `./configure`). This solves issue #44 by John Reeves. At the same time made sure to trigger garbage collection independent on the number of clause header bytes by relying on the number of garbage literals instead. - Fixed `mmap` usage for FreeBSD (#48 issue of `yurivict`). - Removed several compiler warnings when using newer compilers, including gcc-11, gcc-12, clang-14, and clang-15. - Replaced `sprintf` by `snprintf` to avoid warning on MacOS (thanks to Marijn for bringing this up). - Assigning a C `FILE` pointer to `stdout` during initialization fails on MacOS and thus separated declaration and initialization. - Fixed random seed initialization from MAC address issue #47 as used by `mobical` which produces segmentation faults (thanks to Sam Bayless for pointing this out). Version 1.5.2 ------------- - Updates to documentation and copyright. Version 1.5.2 ------------- - More copyright updates in banner. - Fixed MinGW cross-compilation (see `BUILD.md`). Version 1.5.1 ------------- - Fixed copyright and added two regression traces. Version 1.5.0 ------------- - Added `constrain` API call described in our FMCAD'21 paper. - Replaced `while () push_back ()` with `if () resize ()` idiom (thanks go to Alexander Smal for pointing this out). cadical-rel-2.1.3/README.md000066400000000000000000000055721475241722200151530ustar00rootroot00000000000000[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) CaDiCaL Simplified Satisfiability Solver =============================================================================== The goal of the development of CaDiCaL was to obtain a CDCL solver, which is easy to understand and change, while at the same time not being much slower than other state-of-the-art CDCL solvers. Originally we wanted to also radically simplify the design and internal data structures, but that goal was only achieved partially, at least for instance compared to Lingeling. However, the code is much better documented and CaDiCaL actually became in general faster than Lingeling even though it is missing some preprocessors (mostly parity and cardinality constraint reasoning), which would be crucial to solve certain instances. Use `./configure && make` to configure and build `cadical` and the library `libcadical.a` in the default `build` sub-directory. The header file of the library is [`src/cadical.hpp`](src/cadical.hpp) and includes an example for API usage. See [`BUILD.md`](BUILD.md) for options and more details related to the build process and [`test/README.md`](test/README.md) for testing the library and the solver. Since release 1.5.1 we have a [`NEWS.md`](NEWS.md) file. You might also want to check out [`CONTRIBUTING.md`](CONTRIBUTING.md) on if you want to contribute. The solver has the following usage `cadical [ dimacs [ proof ] ]`. See `cadical -h` for more options. If you want to cite CaDiCaL please use as reference our CaDiCaL 2.0 tool paper which appeared at CAV'24:

CaDiCaL 2.0
Armin Biere, Tobias Faller, Katalin Fazekas, Mathias Fleury, Nils Froleyks and Florian Pollitt
Proc. Computer Aidded Verification - 26th Intl. Conf. (CAV'24)
Lecture Notes in Computer Science (LNCS)
vol. 14681, pages 133-152, Springer 2024
[ paper | bibtex | official | artifact | github | doi ]

cadical-rel-2.1.3/VERSION000066400000000000000000000000061475241722200147270ustar00rootroot000000000000002.1.3 cadical-rel-2.1.3/configure000077500000000000000000000376701475241722200156070ustar00rootroot00000000000000#!/bin/sh #--------------------------------------------------------------------------# # Run './configure' to produce a 'makefile' in the 'build' sub-directory or # in any immediate sub-directory different from the 'src', 'scripts' and # 'test' directories. #--------------------------------------------------------------------------# rm -f configure.log #--------------------------------------------------------------------------# # Common default options. all=no debug=no libs="" logging=no check=no closefrom=yes competition=no coverage=no flexible=yes profile=no memory_fuzzing=no contracts=yes tracing=yes unlocked=yes pedantic=no options="" quiet=no m32=no contrib=yes ipasir=yes #--------------------------------------------------------------------------# if [ -f ./scripts/colors.sh ] then . ./scripts/colors.sh elif [ -f ../scripts/colors.sh ] then . ../scripts/colors.sh else BAD="" HILITE="" BOLD="" NORMAL="" fi die () { if [ -f configure.log ] then checklog=" (check also 'configure.log')" else checklog="" fi cecho "${BOLD}configure:${NORMAL} ${BAD}error:${NORMAL} $*${checklog}" exit 1 } rm -f configure.log msg () { cecho "${BOLD}configure:${NORMAL} $*" } # if we can find the 'color.sh' script source it and overwrite color codes for dir in . .. do [ -f $dir/scripts/colors.sh ] || continue . $dir/scripts/colors.sh || exit 1 break done #--------------------------------------------------------------------------# # Parse and handle command line options. usage () { cat << EOF usage: configure [