summaryrefslogtreecommitdiff
path: root/src/prop
AgeCommit message (Collapse)Author
2019-09-06Remove portfolio (#3236)Andrew Reynolds
2019-08-02Update CaDiCaL to version 1.0.3. (#3137)Mathias Preiner
* Removes incremental API check (#3011) * Fixes toSatValueLit to use the new semantics of CaDiCaL's val() Fixes #3011
2019-07-02Optimize DRAT optimization: clause matching (#3074)Alex Ozdemir
* improved proof production statistics This commit creates new statistics which will help us understand what is so expensive about proof production. There are already statistics for: * Net time spent building/printing the LFSC proof. * Size of the LFSC proof. This commit adds statistics for: * The time cost of DRAT optimization: * net time * tool time (drat-trim) * clause matching time (matching core clauses with input clauses) * Non-trivial because drat-trim can (and does) dedup and reorder literals * The advantage of DRAT optimization (proof/formula size before/after) * The time cost of DRAT translation [to LRAT or ER] (net time, tool time) * The time cost of skeleton traversal * The time cost of printing declatations * The time cost of printing CNF proofs * The time cost of printing theory lemmas * The time cost of printing final UNSAT proof. There is a method, toStream, which is responsible for much of proof production. The whole method was timed, but subsections were not. The timings above consider subsections of it. I also wanted to better understand the cost of DRAT optimization and translation. * [BV Proof] Optimize DRAT optimization tldr: I made a bad data-structure/algorithm choice when implementing part of DRAT/CNF-optimization, which consumed **a lot** of time on some bechmarks. This commit fixes that choice. Long Version: Set-Keyed Maps Considered Harmful ================================= Algorithmic Problem ------------------- The DRAT optimization process spits out a unsatifiable core of the CNF. The clauses in the core are all from the original formula, but their literals may have been reordered and deduplicated. We must match the old clauses with new ones, so we know which old clauses are in the core. Old (BAD) Solution ------------------ Before I didn't really think about this process very much. I built a solution in which clauses were canonically represented by hash sets of literals, and made a hash map from canonical clauses to clause indices into the original CNF. Problem With Old Solution ------------------------- In hindsight this was a bad idea. First, it required a new hash set to be heap-allocated for every clause in the CNF. Second, the map lookups required set-hashes (reasonable -- linear time, once) and hash-set equality (not reasonable -- quadratic time, multiple times) on every lookup. New Solution ------------ The ideal solution is probably to have the map from clauses to clause ids be something like a trie. STL doesn't have a trie, but representing clauses as sorted, deduped vectors of literal in a tree based on lexicographical comparison is pretty closed to this. On randomly chosen examples it seems to be a huge improvement over the old map-keyed-by-sets solution, and I'm in the process of running a full set of bechmarks. Also, we store pointers to the clauses already stored elsewhere in the proof, instead of allocating new memory for them. Future Work ----------- It may also be reasonable to do a hash map of sorted, deduped, vector clauses. I haven't tried this, yet (there's a TODO in the code). * Update src/proof/clausal_bitvector_proof.h Thanks andres! Co-Authored-By: Andres Noetzli <andres.noetzli@gmail.com> * Respond to Andres' Review: better use of CodeTimer * Removed commented code (Andres)
2019-05-17Support for incremental bit-blasting with CaDiCaL (#3006)Andres Noetzli
This commit adds support for eager bit-blasting with CaDiCaL on incremental benchmarks. Since not all CaDiCaL versions support incremental solving, the commit adds a CMake check that checks whether `CaDiCaL::Solver::assume()` exists. Note: The check uses `check_cxx_source_compiles`, which is not very elegant but I could not find a better solution (e.g. `check_cxx_symbol_exists()` does not seem to support methods in classes and `check_struct_has_member()` only seems to support data members).
2019-04-24Do not use __ prefix for header guards. (#2974)Mathias Preiner
Fixes 2887.
2019-04-05SatClauseSetHashFunction (#2916)Alex Ozdemir
* SatClauseHashFunction Added to the same file as SatLiteralHashFunction. * clang-format Thanks Andres!
2019-03-26Update copyright headers.Aina Niemetz
2019-01-23Avoid using ProofManager in non-proof CMS build (#2814)Andres Noetzli
PR #2786 changed `CryptoMinisatSolver::addClause()` to register clauses with the bit-vector proof if proofs are turned on. The new code requested the `ProofManager` even when proofs were turned off, which made the `eager-inc-cryptominisat.smt2` regression and our nightlies fail. This commit guards the access to the `ProofManager`, restoring the semantics of the original code when proofs are turned off.
2019-01-14ClausalBitvectorProof (#2786)Alex Ozdemir
* [DRAT] ClausalBitvectorProof Created a class, `ClausalBitvectorProof`, which represents a bitvector proof of UNSAT using an underlying clausal technique (DRAT, LRAT, etc) It fits into the `BitvectorProof` class hierarchy like this: ``` BitvectorProof / \ / \ ClausalBitvectorProof ResolutionBitvectorProof ``` This change is a painful one because all of the following BV subsystems referenced ResolutionBitvectorProof (subsequently RBVP) or BitvectorProof (subsequently BVP): * CnfStream * SatSolver (specifically the BvSatSolver) * CnfProof * TheoryProof * TheoryBV * Both bitblasters And in particular, ResolutionBitvectorProof, the CnfStream, and the SatSolvers were tightly coupled. This means that references to and interactions with (R)BVP were pervasive. Nevertheless, an SMT developer must persist. The change summary: * Create a subclass of BVP, called ClausalBitvectorProof, which has most methods stubbed out. * Make a some modifications to BVP and ResolutionBitvectorProof as the natural division of labor between the different classes becomes clear. * Go through all the components in the first list and try to figure out which kind of BVP they should **actually** be interacting with, and how. Make tweaks accordingly. * Add a hook from CryptoMinisat which pipes the produced DRAT proof into the new ClausalBitvectorProof. * Add a debug statement to ClausalBitvectorProof which parses and prints that DRAT proof, for testing purposes. Test: * `make check` to verify that we didn't break any old stuff, including lazy BB, and eager BB when using bvminisat. * `cvc4 --dump-proofs --bv-sat-solver=cryptominisat --bitblast=eager -d bv::clausal test/regress/regress0/bv/ackermann2.smt2`, and see that 1. It crashed with "Unimplemented" 2. Right before that it prints out the (textual) DRAT proof. * Remove 2 unneeded methods * Missed a rename * Typos Thanks Andres! Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu> * Address Andres comments * Reorder members of TBitblaster
2018-12-03Bit vector proof superclass (#2599)Alex Ozdemir
* Split BitvectorProof into a sub/superclass The superclass contains general printing knowledge. The subclass contains CNF or Resolution-specific knowledge. * Renames & code moves * Nits cleaned in prep for PR * Moved CNF-proof from ResolutionBitVectorProof to BitVectorProof Since DRAT BV proofs will also contain a CNF-proof, the CNF proof should be stored in `BitVectorProof`. * Unique pointers, comments, and code movement. Adjusted the distribution of code between BVP and RBVP. Notably, put the CNF proof in BVP because it isn't resolution-specific. Added comments to the headers of both files -- mostly BVP. Changed two owned pointers into unique_ptr. BVP's pointer to a CNF proof RBVP's pointer to a resolution proof BVP: `BitVectorProof` RBVP: `ResolutionBitVectorProof` * clang-format * Undo manual copyright modification * s/superclass/base class/ Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu> * make LFSCBitVectorProof::printOwnedSort public * Andres's Comments Mostly cleaning up (or trying to clean up) includes. * Cleaned up one header cycle However, this only allowed me to move the forward-decl, not eliminate it, because there were actually two underlying include cycles that the forward-decl solved. * Added single _s to header gaurds * Fix Class name in debug output Credits to Andres Co-Authored-By: alex-ozdemir <aozdemir@hmc.edu> * Reordered methods in BitVectorProof per original ordering
2018-10-19Remove autotools build system. (#2639)Mathias Preiner
2018-10-01Fix compiler warnings. (#2555)Aina Niemetz
2018-09-22cmake: Various CMakeLists.txt fixes/cleanup.Mathias Preiner
2018-09-22cmake: Only build libcvc4 and libcvc4parser as libraries.Mathias Preiner
The sources of all previous libraries are now added to libcvc4 and built as libcvc4. This removes circular dependencies between libcvc4 and libexpr. Further, we now only have one parser library and don't build additional libraries for each language.
2018-09-22cmake: Cleanup CMakeLists.txt files, remove SHARED.Mathias Preiner
2018-09-22cmake: Working build infrastructure.Mathias Preiner
TODO: cvc4autoconfig.h
2018-09-22cmake: Added initial build infrastructure.Aina Niemetz
2018-09-13Fix #include for minisat headers in bvminisat. (#2463)Mathias Preiner
2018-08-17Remove support for flipDecision (#2319)Andrew Reynolds
2018-08-07Delete functions instead of using CVC4_UNDEFINED (#1794)Andres Noetzli
C++11 supports explicitly deleting functions that should not be used (explictly or implictly), e.g. copy or assignment constructors. We were previously using the CVC4_UNDEFINED macro that used a compiler-specific attribute. The C++11 feature should be more portable.
2018-08-02 Remove references to deprecated propagate as decision feature (#2258)Andrew Reynolds
2018-07-30Add support for incremental eager bit-blasting. (#1838)Mathias Preiner
Eager incremental solving is achieved via solving under assumptions. As soon as incremental and eager bit-blasting is enabled, assertions are passed to the SAT solver as assumptions rather than assertions. This requires the eager SAT solver to support incremental solving, which is currently only supported by CryptoMiniSat.
2018-07-30Fix several spelling errors (#2231)FabianWolff
2018-07-13Properly clean up assertion stack in CnfProof (#2147)Andres Noetzli
Fixes issue #2137. CnfProof has a stack of assertions that are being converted to clauses. Previously, it could happen that while an assertion was being added, TheoryProxy::explainPropagation() would be called from Solver::reason() and push an assertion to the stack that was then not removed. This lead to a clause id of the assertion being associated with the explanation instead, which in turn could lead to a wrong unsat core. This commit identifies two cases where TheoryProxy::explainPropagation() is called without cleaning up the assertion stack afterwards. It also adds an assertion that the assertion stack must be empty when we are getting the unsat core.
2018-06-28Fix stale reference in MiniSat when generating UC (#2113)Andres Noetzli
In MiniSat's analyze(), we were taking a reference of a clause that could be invalidated by a call to resolveOutUnit(). resolveOutUnit() can lead to allocation of clauses which in turn can lead to clauses being reallocated, making the reference stale. The commit encloses the reference in a code block that makes the lifetime of the reference more obvious and removes uses of the potentially stale reference.
2018-06-25Updated copyright headers.Aina Niemetz
2018-06-13Workaround for incremental unsat cores (#1962)Andres Noetzli
This commit implements a workaround for computing unsat cores while doing incremental solving to address #1349. Currently, our resolution proofs do not handle clauses with a lower-than-assertion-level correctly because the resolution proofs for them get removed when popping the context but the SAT solver keeps using them. The workaround changes the behavior of the SAT solver to add clauses always at the current level if incremental solving and unsat cores are enabled. This makes sure that all learned clauses are removed when we pop below the level that they were learned at. This may degrade performance because the SAT solver has to relearn clauses.
2018-06-08Reset decisions at SAT level after solving (#2059)Andres Noetzli
Some quick background: CVC4 has two primary contexts: the assertion context (which corresponds to the push/pops issued by the user) and the decision/SAT context (which corresponds to the push/pops done by the user and each decision made by MiniSat. Before 2cc0e2c6a691fb6d30ed8879832b49bc1f277d77, we had an additonal push/pop when doing the actual solving. With these removed, it could happen that we get a wrong result when doing incremental solving: ``` ... ; check-sat call returns sat, the decision level in the SAT solver is ; non-zero at this point (check-sat) ; Solver::addClause_() determines that we cannot add the clause to the ; SAT solver directly because the decision level is non-zero (i.e. the ; clause is treated like a theory lemma), thus it is added to the lemmas ; list. (assert false) ; The solver stores some information about the current state, including ; the value of the "ok" flag in Solver, which indicates whether the ; current constraints are unsatisfiable. Note that "ok" is true at this ; point. (push) ; Now, in Solver::updateLemmas(), we add clauses from the lemmas list. ; The problem is that empty clauses (which "false" is after removing "false" ; literals) and unit clauses are not added like normal clauses. Instead, ; the empty clause, essentially just results in the "ok" flag being set to ; false (unit clauses are added to the decision trail). (check-sat) ; Here, the solver restores the information stored during ; (push), including the "ok" flag, which is now true again. (pop) ; At this point, the solver has "forgotten" about (assert false) since ; the "ok" flag is back to true and it answers sat. (check-sat) ``` There are multiple ways to look at the problem and to fix it: - One could argue that an input assertion should always be added directly to the clauses in the SAT solver, i.e. the solver should always be at decision level 0 when we are adding input clauses. The advantage of this is that it is relatively easy to implement, corresponds to what the original MiniSat code does (it calls Solver::cancelUntil(0) after solving), and is no worse than what we had before commit 2cc0e2c6a691fb6d30ed8879832b49bc1f277d77 (push/pop do a strict superset of what resetting the decision at the current assertion level does). The disadvantage is that we might throw away some useful work. - One could argue that is fine that (assert false) is treated like a theory lemma. The advantage being that it might result in more efficient solving and the disadvantage being that it is much trickier to implement. Unfortunately, it is not quite clear from the code what the original intention was but we decided to implement the first solution. This commit exposes a method in MiniSat to reset the decisions at the current assertion level. We call this method from SmtEngine after solving. Resetting the decisions directly after solving while we are still in MiniSat does not work because it causes issues with datastructures in the SMT solver that use the decision context (e.g. TheoryEngine::d_incomplete seems to be reset too early, resulting in us answering sat instead of unknown).
2018-05-25MiniSat: Be more careful about running proof code (#1982)Andres Noetzli
In `addClause_()`, we were checking the condition `ca[confl].size() == 1` regardless if proofs were enabled or not, even though both branches of the if statement only do something when proofs are enabled. This lead to issue #1978 occurring even when not generating proofs. Note: This commit is *not* a fix for #1978 but it makes sure that the issue does not occur when not generating proofs/unsat cores.
2018-05-23Remove ProofProxy (#1965)Andres Noetzli
2018-04-03[BVMiniSat] Avoid duplicates in conflicts (#1745)Andres Noetzli
If analyzeFinal() in BVMiniSat was called with a literal that also occurred in the trail, it could happen that the set of assumptions that led to the assignment of `p` contained `p` twice. BitVectorProof::endBVConflict would then register that conflict with the duplicate literal but at the same time compute a conflict expression with the duplicate removed. LFSCSatProof::printAssumptionsResolution would then output two resolutions for the same literal, which made the simplify_clause side condition fail because it couldn't find the literal in the clause anymore after the first removal. The fix simply avoid adding `p` to the set of assumptions if it is found in the trail. In this situation, `p` is guaranteed to be in the set of assumptions already because it has been added at the beginning of analyzeFinal(). This issue originally came up in PR #1384. With this fix the regression tests pass in #1384.
2018-03-26Fix memory leak in bvminisat (#1710)Andres Noetzli
While reviewing #1695, I realized that bvminisat is leaking memory for each call to setNotify(). This commit uses std::unique_ptr to fix the issue. It also adds std::unique_ptr to manage d_minisat.
2018-03-20Add support for CaDiCaL as eager BV SAT solver. (#1675)Mathias Preiner
2018-03-13Use Cryptominisat version 5.0.2 (instead of 4.2.0). (#1664)Mathias Preiner
2018-03-08Cleanup Cryptominisat SAT wrapper. (#1652)Mathias Preiner
Cryptominisat has name conflicts with the other Minisat implementations since the Minisat implementations export var_Undef, l_True, ... as macro whereas Cryptominisat uses static const. In order to avoid these conflicts we forward declare CMSat::SATSolver and include the cryptominisat header only in cryptominisat.cpp. Further, the helper functions are moved into an anonymous namespace in the .cpp file and functions that were not used are removed.
2018-03-06Make statistics output consistent. (#1647)Mathias Preiner
* Fixes --hide-zero-stats (and really skips the 0 values) * Removes the additional newline after each statistic * Introduces theory::getStatsPrefix(TheoryId) to generate consistent prefixes for statistics based on the theory id (e.g., THEORY_BV -> "theory::bv").
2018-03-05Enable -Wsuggest-override by default. (#1643)Mathias Preiner
Adds missing override keywords.
2018-02-07Cleanup Cryptominisat header. (#1561)Mathias Preiner
Clang formatted sat_solver_factor.cpp
2018-01-15Removing more miscellaneous throw specifiers. (#1509)Tim King
Removing more miscellaneous throw specifiers. Also fixing the spelling of amount in several places.
2017-12-06Fixed time stats for MiniSat solve time. (#1431)Aina Niemetz
Also, moved implementation of BVMinisatSatSolver::MinisatNotify::notify to .cpp file.
2017-09-25Initializing BVMinisat Solver::notify to nullptr. (#1132)Tim King
2017-07-20Moving from the gnu extensions for hash maps to the c++11 hash mapsTim King
* Replacing __gnu_cxx::hash_map with std::unordered_map. * Replacing __gnu_cxx::hash_set with std::unordered_set. * Replacing __gnu_cxx::hash with std::hash. * Adding missing includes.
2017-07-07Update copyright headers.Mathias Preiner
2017-07-07Use new copyright header format.Mathias Preiner
2017-06-22Fix assertion failure due to missing clause id (#180)Andres Nötzli
This commit fixes bug 821. As written in the description of the bug, the issue is that `id` is not being set on one of the paths in addClause(), specifically in the case where all but one literal are assigned false and the remaining literal is assigned true. In that case, we are not actually adding anything and set the `id` to `ClauseIdUndef`.
2017-03-23support incremental unsat coresguykatzz
2017-03-02Eliminate Boolean term conversion. Generalizes removeITE pass to remove ↵ajreynol
Boolean terms, treats distinguished BOOLEAN_TERM_VARIABLE kind as theory literal. Fixes bugs 597, 604, 651, 652, 691, 694. Add regressions.
2016-11-07Fixing a memory leak in the CnfStream unit tests.Tim King
2016-10-13Revert "Merge branch 'origin' of https://github.com/CVC4/CVC4.git"Tim King
This reverts commit 3395c5c13cd61d98aec0d9806e3b9bc3d707968a, reversing changes made to 5f415d4585134612bc24e9a823289fee35541a01.
2016-10-11Merge branch 'origin' of https://github.com/CVC4/CVC4.gitPaul Meng
Conflicts: src/options/quantifiers_options
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback