summaryrefslogtreecommitdiff
path: root/src/theory/bv
AgeCommit message (Collapse)Author
2020-03-05Enable -Wshadow and fix warnings. (#3909)Mathias Preiner
Fixes all -Wshadow warnings and enables the -Wshadow compile flag globally. Co-authored-by: Clark Barrett <barrett@cs.stanford.edu> Co-authored-by: Andres Noetzli <andres.noetzli@gmail.com> Co-authored-by: Aina Niemetz <aina.niemetz@gmail.com> Co-authored-by: Alex Ozdemir <aozdemir@hmc.edu> Co-authored-by: makaimann <makaim@stanford.edu> Co-authored-by: yoni206 <yoni206@users.noreply.github.com> Co-authored-by: Andrew Reynolds <andrew.j.reynolds@gmail.com> Co-authored-by: AleksandarZeljic <zeljic@stanford.edu> Co-authored-by: Caleb Donovick <cdonovick@users.noreply.github.com> Co-authored-by: Amalee <amaleewilson@gmail.com> Co-authored-by: Scott Kovach <dskovach@gmail.com> Co-authored-by: ntsis <nekuna@gmail.com>
2020-02-27Fix -Wshadow warnings in common headers (#3826)Andres Noetzli
2020-02-26Initial work towards -Wshadow (#3817)Andrew Reynolds
2020-02-26Fix regression (#3827)Andrew Reynolds
2020-02-26Fix node arity issue in reduction of int2bv (#3777)Andrew Reynolds
2020-02-19resource manager: Add statistic for every resource. (#3772)Mathias Preiner
This commit adds statistics for all resource steps. A resource statistic is incremented by 1 if the resource is spent (via `spendResource`). Fixes #3751.
2020-01-28Avoid PLUS with one child for bv2nat elimination (#3639)Andrew Reynolds
2020-01-10Fix enum names in AIG bitblaster. (#3599)Mathias Preiner
2019-12-17Generate code for options with modes. (#3561)Mathias Preiner
This commit adds support for code generation of options with modes (enums). From now on option enums can be specified in the corresponding *.toml files without the need of extra code. All option enums are now in the options namespace.
2019-12-09Make theory rewriters non-static (#3547)Andres Noetzli
This commit changes theory rewriters to be non-static. This refactoring is needed as a stepping stone to making our rewriter configurable: If we have multiple solver objects with different rewrite configurations, we cannot use `static` variables for the rewriter table in the BV rewriter for example. It is also in line with our goal of getting rid of singletons in general. Note that the `Rewriter` class is still a singleton, which will be changed in a future commit.
2019-10-30Unify CVC4_CHECK/CVC4_DCHECK/AlwaysAssert/Assert. (#3366)Mathias Preiner
2019-10-11Add support for UBSan instrumentation (#3382)Andres Noetzli
This commit adds support for compiling CVC4 with UBSan instrumentation. The commit also adds a dummy version of `AigBitblaster`. Previously, when CVC4 was built without ABC, `AigBitblaster` was not fully defined (the class was declared but the implementation was not being compiled). This lead to missing RTTI information when compiling with UBSan instrumentation.
2019-10-08pass parameters by reference where it affects performancePiotr Trojanek
Detected with cppcheck static analyser, which said: (performance) Function parameter should be passed by reference. Reformat with clang-format as needed. Signed-off-by: Piotr Trojanek <piotr.trojanek@gmail.com>
2019-09-28Introduce template classes for simple type rules (#2835)Andres Noetzli
This commit introduces two template classes `SimpleTypeRule` and `SimpleTypeRuleVar` to help define simple type rules without writing lots of redundant code. The main advantages of this approach are: - Less code - More consistent error reporting - Easier to extend type checking with other functionality (e.g. getting the type of a symbol)
2019-07-29Refactoring of bit-vector elimination rules (#3105)yoni206
This commit makes the following minor refactors to src/theory/bv/theory_bv_rewrite_rules_operator_elimination.h: - Including options/bv_options.h: this is needed because this header file is being used. - Marking all functions as inline: details in a discussion inside the PR.
2019-05-17Fix BV ITE rewrite (#3004)Andres Noetzli
The rewrite `BvIteConstChildren` assumes that `BvIteEqualChildren` has been applied before it runs. However, with nested ITEs, it was possible to violate that assertion. Given `bvite(c1, bvite(c2, 0, 0), bvite(c3, 0, 0))`, `BvIteEqualChildren` would rewrite that term to `bvite(c2, 0, 0)`. The `LinearRewriteStrategy` then ran `BvIteConstChildren` on `bvite(c2, 0, 0)` which complained about the equal children. This commit implements a simple fix that splits the `LinearRewriteStrategy` into two strategies to make sure that if `BvIteEqualChildren` rewrites a node, we drop back to the `Rewriter`. This ensures that the rewrites on the rewritten node are invoked in the correct order.
2019-05-15Fix model of Boolean vars with eager bit-blaster (#2998)Andres Noetzli
When bit-blasting eagerly, we were not assigning values to the Boolean variables in the `TheoryModel`. With eager bit-blasting, the BV SAT solver gets all (converted) terms, including the Boolean ones, so `EagerBitblaster::collectModelInfo()` is responsible for assigning values to Boolean variables. However, it has only been assigning values to bit-vector variables, which lead to wrong models. This commit fixes the issue by asking the `CnfStream` for the Boolean variables, querying the SAT solver for their value, and assigning them in the `TheoryModel`.
2019-04-24Do not use __ prefix for header guards. (#2974)Mathias Preiner
Fixes 2887.
2019-04-01Fix RewriteITEBv to ensure rewrite to fixpoint (#2878)Andres Noetzli
`TheoryBVRewriter::RewriteITEBv()` is currently always returning the status `REWRITE_DONE`. This can result in a situation where a rewritten node can be rewritten again (which breaks the contract of our rewriter). The unit test in this commit illustrates the issue. The commit fixes the issue by returning `REWRITE_AGAIN` or `REWRITE_AGAIN_FULL` if a node changed. `REWRITE_AGAIN_FULL` is needed if the resulting node may have a child that is not a subterm of the original expression.
2019-03-26Update copyright headers.Aina Niemetz
2019-03-23BV: Fix typerules for rotate operators. (#2895)Aina Niemetz
2019-01-19Fix missing-override warning (#2811)Andres Noetzli
`TLazyBitblaster::setProofLog()` was defined even though the method was not virtual before PR #2808 and `TBitblaster` was implementing the same method. After that PR, which made the method virtual, GCC complained about a missing `override` keyword for `setProofLog()`. However, the method should have been removed (see [comment](https://github.com/CVC4/CVC4/pull/2786#discussion_r247299617)). This commit removes the function definition.
2019-01-18 Fix ABC build (#2808)Andres Noetzli
PR #2786 introduced a pure virtual method `TBitblaster::getSatSolver()`. `AigBitblaster` was missing the implementation of that method. This commit adds an implementation that simply returns the underlying SAT solver. Note: The method is currently only used for proofs and CVC4 does not support proofs in combination with ABC. To make this explicit, the commit also adds a check in `SmtEngine::setDefaults()` that makes sure that we are not trying to produce proofs with `--bitblast-aig` (before the commit, we just crashed with an assertion failure/null pointer dereference).
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-20Clean up BV kinds and type rules. (#2766)Aina Niemetz
2018-12-20Add missing type rules for parameterized operator kinds. (#2766)Aina Niemetz
2018-12-12Fix compiler warnings. (#2748)Aina Niemetz
2018-12-10BoolToBV modes (off, ite, all) (#2530)makaimann
2018-12-06Enable BV proofs when using an eager bitblaster (#2733)Alex Ozdemir
* Enable BV proofs when using and eager bitblaster Specifically: * Removed assertions that blocked them. * Made sure that only bitvectors were stored in the BV const let-map * Prevented true/false from being bit-blasted by the eager bitblaster Also: * uncommented "no-check-proofs" from relevant tests * Option handler logic for BV proofs BV eager proofs only work when minisat is the sat solver being used by the BV theory. Added logic to the --proof hanlder to verify this or throw an option exception. * Bugfix for proof options handler I forgot that proofEnabledBuild runs even if the --proof option is negated. In my handler I now check that proofs are enabled. * Clang-format
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-19BV rewrites (mined): Rule 35: ConcatPullUp with special const simplified. ↵Aina Niemetz
(#2647) Simplifications based on the special const is now delegated down, only the concat is pulled up.
2018-10-19BV rewrites (mined): Rule 35: ConcatPullUp (BITVECTOR_XOR) with special ↵Aina Niemetz
const. (#2647)
2018-10-16BV rewrites (mined): Rule 35: ConcatPullUp (BITVECTOR_OR) with special ↵Aina Niemetz
const. (#2643) Match: `x_m | concat(y_my, 0_n, z_mz)` Rewrites to: `concat(x[m-1:m-my] | y, x[m-my-1:m-my-n], x[m-my-n-1:0] | z)` Match: `x_m | concat(y_my, 1_n, z_mz)` Rewrites to: `concat(x[m-1:m-my] | y, x[m-my-1:m-my-n+1], 1_1, x[m-my-n-1:0] | z)` Match: `x_m | concat(y_my, ~0_n, z_mz)` Rewrites to: `concat(x[m-1:m-my] | y, ~0_n, x[m-my-n-1:0] | z)` On QF_BV with eager and CaDiCaL (time limit 600s, penalty 600s): ``` | CVC4-base | CVC4-concatpullup-or | BENCHMARK | SLVD SAT UNSAT TO MO CPU[s] | SLVD SAT UNSAT TO MO CPU[s] | totals | 38992 13844 25148 1082 28 984887.4 | 39028 13845 25183 1046 28 974819.1 | ```
2018-10-16BV rewrites (mined): Rule 35: Generalized ConcatPullUp (BITVECTOR_AND) with ↵Aina Niemetz
ones (#2596).
2018-10-16BV rewrites (mined): Rule 35: Generalized ConcatPullUp (BITVECTOR_AND) with ↵Aina Niemetz
1 (#2596).
2018-10-16BV rewrites (mined): Rule 35: Generalized ConcatPullUp (BITVECTOR_AND) with ↵Aina Niemetz
0 (#2596).
2018-10-16BV rewrites (mined): Rule 35: ConcatPullUp (BITVECTOR_AND) with 0 (#2596).Aina Niemetz
2018-09-22cmake: Remove unused CMakeLists.txtMathias Preiner
2018-09-22cmake: Added initial build infrastructure.Aina Niemetz
2018-09-11Support model cores via option --produce-model-cores. (#2407)Andrew Reynolds
This adds support for model cores, fixes #1233. It includes some minor cleanup and additions to utility functions.
2018-08-27Use std:unique_ptr instead of raw pointers in theory/bv. (#2385)Mathias Preiner
This should also fix CIDs 1465687, 1465695, 1465696, and 1465701.
2018-08-21Add constexpr annotations to help coverity understand constant ... (#2314)Tim King
2018-08-16Move node algorithms to separate file (#2311)Andres Noetzli
2018-08-07Require Swig 3 (#2283)Andres Noetzli
Removes some hacks due to Swig 2's incomplete C++11 support and adds checks for version 3 at configuration time as well as in swig.h
2018-08-07Add rewrite for nested BITVECTOR_ITE that can be merged. (#2273)Aina Niemetz
2018-08-03 Add rewrite for nested BITVECTOR_ITE with cond_outer == cond_inner. (#2272)Aina Niemetz
2018-08-03Add rewrite for BITVECTOR_ITE with const children. (#2271)Aina Niemetz
2018-08-03Add rewrite for BITVECTOR_ITE with term_then == term_else. (#2268)Aina Niemetz
2018-08-02 Add timer for BV inequality solver. (#2265)Aina Niemetz
2018-08-02Add rewrites for BITVECTOR_ITE and BITVECTOR_COMP with const ↵Aina Niemetz
condition/child. (#2259)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback