summaryrefslogtreecommitdiff
path: root/test/unit
AgeCommit message (Collapse)Author
2019-12-06Simplify rewrite for character matching (#3545)Andres Noetzli
2019-12-06Add ExprManager as argument to Datatype (#3535)Andrew Reynolds
2019-12-06[proof] Eliminate side-condition from ER signature (#3230)Alex Ozdemir
* [proof] Eliminate the side condition in er.plf By tweaking the axioms a bit, I got rid of the lone SC in the Extended Resolution signature. * [proof] Changed er_proof.cpp in line with signature The new signature requires slightly different proof printing. * [proof] clang-format er_proof.cpp * Fix tests * [proof] Actually delete the SC * Apply suggestions from code review Co-Authored-By: yoni206 <yoni206@users.noreply.github.com> * Add LFSC-checking unit test for ER proof * Gate the lfsc invocation on the build system * Properly gate the lfsc check on the build system * gate the plf_signatures forward def on the build system
2019-12-04Add mkOp for a single Kind (#3522)makaimann
2019-12-03Rewrite `str.contains` used for character matching (#3519)Andres Noetzli
2019-12-02Minor refactor: rename opterm_black to op_black (#3521)makaimann
2019-12-02OpTerm Refactor: Allow retrieving OpTerm used to create Term in public C++ ↵makaimann
API (#3355) * Treat uninterpreted functions as a child in Term iteration * Remove unnecessary const_iterator constructor * Add parameter comments to const_iterator constructor * Use operator[] instead of storing a vector of Expr children * Switch pos member variable from int to uint32_t * Add comment about how UFs are treated in iteration * Allow OpTerm to contain a single Kind, update OpTerm construction * Update mkTerm to use only an OpTerm (and not also a Kind) * Remove unnecessary function checkMkOpTerm * Update mkOpTerm comments to not use _OP Kinds * Update examples to use new mkTerm * First pass on fixing unit test * Override kind for Constructor and Selector Terms * More fixes to unit tests * Updates to parser * Remove old assert (for Kind, OpTerm pattern which was removed) * Remove *_OP kinds from public API * Add hasOpTerm and getOpTerm methods to Term * Add test for UF iteration * Add unit test for getOpTerm * Move OpTerm implementation above Term implemenation to match header file Moved in header because Term::getOpTerm() returns an OpTerm and the compiler complains if OpTerm is not defined earlier. Simply moving the declaration is easier/cleaner than forward declaring within the same file that it's declared. * Fix mkTerm in datatypes-new.cpp example * Use helper function for creating term from Kind to avoid nested API calls * Rename: OpTerm->Op in API * Update OpTerm->Op in examples/tests/parser * Add case for APPLY_TESTER * operator term -> operator * Update src/api/cvc4cpp.h Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Comment comment suggestion Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Add not-null checks and implement Op from a single Kind constructor * Undo sed mistake for OpTerm replacement * Add 'd_' prefix to member vars * Fix comment and remove old commented-out code * Formatting * Revert "Formatting" This reverts commit d1d5fc1fb71496daeba668e97cad84c213200ba9. * More fixes for sed mistakes * Minor formatting * Undo changes in CVC parser * Add isIndexed and prefix with d_ * Create helper function for isIndexed to avoid calling API functions in other API functions
2019-12-01Prevent ref count from reaching zero in BV instantiator (#3512)Andres Noetzli
2019-11-18Use -Wimplicit-fallthrough (#3464)Andres Noetzli
This commit enables compiler warnings for implicit fallthroughs in switch statements that are not explicitly marked as such. The commit introduces a new macro `CVC4_FALLTHROUGH` that can be used to indicate that a fallthrough is intentional. The commit fixes existing warnings and a bug in the arithmetic rewriter for `abs` (the bug likely couldn't be triggered easily because we rewrite `abs` to an `ite` while expanding definitions). To have the new macro also available in the parser, the commit changes `src/base/check.h` to be visible to the parser (it includes `cvc4_private_library.h` now instead of `cvc4_private.h`).
2019-11-17Updates to the unit tests, api, and examples for datatypes (#3459)Andrew Reynolds
* Updates to the unit tests, api, and examples for datatypes * Format
2019-11-14Use Shebang in cxxtestgen when appropriate (#3458)Alex Ozdemir
CxxTest's generator has one of three names, depending on the CxxTest version: * `cxxtestgen.py`, a python program * `cxxtestgen`, some kind of program with a shebang * `cxxtestgen.pl`, a perl program We were mistakenly assuming that the `cxxtestgen` form was always a python program. Now, if we find that form on the system, we assume that it is has a shebang, and is executable.
2019-10-30Unify CVC4_CHECK/CVC4_DCHECK/AlwaysAssert/Assert. (#3366)Mathias Preiner
2019-10-18Update overflow check to handle negative numbers (#3396)makaimann
2019-10-09test: Add TS_UTILS_EXPECT_ABORT macro for unit tests. (#3378)Mathias Preiner
TS_UTILS_EXPECT_ABORT can be used if an expression in a unit test is expected to abort() instead of throwing an exception. This can happen if CVC4_CHECK or CVC4_DCHECK fail.
2019-10-08New C++ API: Term: Add missing checks for null. (#3364)Aina Niemetz
Co-Authored-By: Andres Noetzli <andres.noetzli@gmail.com>
2019-10-07New C++ API: Add Term::getId(). (#3360)Aina Niemetz
+ use explicit types in NodeValue + add unit test for Term::isParameterized() Co-Authored-By: makaimann <makaim@stanford.edu>
2019-09-29Add rewrite for splitting equalities (#2957)Andres Noetzli
2019-09-18Add support for creating constant arrays to the new C++ API (#3296)makaimann
* Add support for constant arrays to new C++ API * Fix macro usage in unit test * Add not null check * Add test for null term * Formatting
2019-09-06Remove SMT1 parser. (#3228)Mathias Preiner
This commit removes the SMT1 parser infrastructure and adds the SMT2 translations of the SMT1 regression tests. For now this commit removes regression test regress3/pp-regfile.smt since the SMT2 translation has a file size of 887M (vs. 172K for the SMT1 version). Fixes #2948 and fixes #1313.
2019-08-29Infer conflicts based on regular expression inclusion (#3234)Andres Noetzli
We have a conflict if we have `str.in.re(x, R1)` and `~str.in.re(x, R2)` and `R2` includes `R1` because there is no possible value for `x` that satisfies both memberships. This commit adds code to detect regular expression inclusion for a small fragment of regular expressions: string literals with single char (`re.allchar`) and multichar wildcards (`re.*(re.allchar)`). Signed-off-by: Andres Noetzli <anoetzli@amazon.com>
2019-08-19New C++ API: Add checks for Solver::checkValid and ↵Aina Niemetz
Solver::checkValidAssuming. (#3197)
2019-08-13New C++ API: Add checks and tests for Solver::simplify. (#3170)Aina Niemetz
2019-08-13New C++ API: Fix test names of solver_black unit test. (#3170)Aina Niemetz
2019-08-13Properly implement logic info for separation logic (#3176)Andrew Reynolds
2019-08-11New C++ API: Add templated getIndices method for OpTerm (#3073)makaimann
* Implement templated getIndices method for OpTerm * Add getIndices unit tests * Update src/api/cvc4cpp.cpp Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Update src/api/cvc4cpp.cpp Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Add comment about DIVISIBLE_OP * Update test/unit/api/opterm_black.h Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Update test/unit/api/opterm_black.h Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Update test/unit/api/opterm_black.h Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Update test/unit/api/opterm_black.h Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Add exception checks to other unit tests (instead of having its own function) * Fix unit test names in opterm_black.h * Add description to docstring for getIndices * Formatting * Clang format older commits * Use '-' in docstring list to match other docstrings * Support creating DIVISIBLE_OP with a string (for arbitrary precision integers) * Move mkOpTerm(DIVISIBLE_OP, <str>) test to solver_black.h * Fix pointer access * Replace switch statement with if statement * Guard string input for CVC4::Integer in mkOpTerm for consistency on GMP/CLN back-end
2019-08-08Fix issues with Ninja build system and add configure option. (#3166)Mathias Preiner
Adds option --ninja to configure.sh.
2019-08-07New C++ API: Add checks and tests for push/pop. (#3121)Aina Niemetz
2019-08-01Fix BVGauss unit tests. (#3142)Mathias Preiner
pass_bv_gauss_white.h included bv_gauss.cpp to test the functions in the anonymous namespace, which resulted in ODR (one definition rule) violations reported by ASAN. This commit exposes the functionality required in the unit tests as private static members of the BVGauss class. Since this is a white unit test, we can access private members in the tests.
2019-07-31adding bv_gauss unit test to build files (#3135)yoni206
2019-07-22Get operators in node (#3094)yoni206
This commit adds a function to node_algorithm.{h,cpp} that returns the operators that occur in a given node.
2019-06-24Fix memory leak in unit test (#3068)Andres Noetzli
PR #3062 changed `Smt2::setLogic()` to return a heap-allocated command, which didn't get cleaned up by our `parser_black` unit test. This commit fixes the memory leak.
2019-06-21Fix and simplify handling of --force-logic (#3062)Andres Noetzli
The `--force-logic` command line argument can be used to override a logic specified in an input file or to set a logic when none is given. Before this commit, both the `SmtEngine` and the parser were aware of that argument. However, there were two issues if an input file didn't specify a logic but `--force-logic` was used: - Upon parsing `--force-logic`, the `SmtEngine` was informed about it and set the logic to the forced logic. Then, the parser detected that there was no `set-logic` command, so it set the logic to `ALL` and emitted a corresponding warning. Finally, `SmtEngine::setDefaults()` detected that `forceLogic` was set by the user and changed the logic back to the forced logic. The warning was confusing and setting the logic multiple times was not elegant. - For eager bit-blasting, the logic was checked before resetting the logic to the forced logic, so it would emit an error that eager bit-blasting couldn't be used with the logic (which was `ALL` at that point of the execution). This was a problem in the competition because our runscript parses the `set-logic` command to decide on the appropriate arguments to use and passes the logic to CVC4 via `--force-logic`. This commit moves the handling of `--force-logic` entirely into the parser. The rationale for that is that this is not an API-level issue (if you use the API you simply set the logic you want, forcing a different logic in addition doesn't make sense) and simplifies the handling of the option (no listeners need to be installed and the logic is set only once). This commit also removes the option to set the logic via `(set-option :cvc4-logic ...)` because it complicates matters (e.g. which method of setting the logic takes precedence?). For the CVC and the TPTP languages the commit creates a command to set the logic in `SmtEngine` when the logic is forced in the parser instead of relying on `SmtEngine` to figure it out itself.
2019-06-21Use TMPDIR environment variable for temp files (#2849)Andres Noetzli
Previously, we were just writing temporary files to `/tmp/` but this commit allows the user to use the `TMPDIR` environment variable to determine which directory the temporary file should be written to. The commit adds a helper function for this and also includes some minor cleanup of existing code.
2019-06-12Refactor parser to define fewer tokens for symbols (#2936)Andres Noetzli
2019-06-05DRAT-Optimization (#2971)Alex Ozdemir
This commit enables DRAT-optimization, which consists of two sub-processes: 1. removing unnecessary instructions from DRAT-proofs and 2. not proving clauses which are not needed by DRAT proofs. These changes have the effect of dramatically shortening some some bit-vector proofs. Specifically, proofs using lemmas in the ER, DRAT, and LRAT formats, since proofs in any of these formats are derived from a (now optimized!) DRAT proof produced by CryptoMiniSat. What follows is a description of the main parts of this PR: ## DRAT Optimization The DRAT-optimization is done by `drat-trim`, which is bundled with `drat2er`. The (new) function `ClausalBitVectorProof::optimizeDratProof` is our interface to the optimization machinery, and most of the new logic in this PR is in that function. ## CNF Representation The ability to not prove unused clauses requires a slight architectural change as well. In particular, we need to be able to describe **which** subset of the original clause set actually needs to be proved. To facilitate this, when the clause set for CryptoMiniSat is first formed it is represented as a (a) map from clause indices to clauses and (b) a list of indices. Then, when the CNF is optimized, we temporarily store a new list of the clauses in the optimized formula. This change in representation requires a number of small tweaks throughout the code. ## Small Fixes to Signatures When we decided to check and accept two different kinds of DRAT, some of our DRAT-checking broke. In particular, when supporting one kind of DRAT, it is okay to `fail` (crash) when a proof fails to check. If you're supporting two kinds of DRAT, crashing in response to the first checker rejecting the proof denies the second checker an opportunity to check the proof. This PR tweaks the signatures slightly (and soundly!) to do something else instead of `fail`ing.
2019-06-04Enable proof checking for QF_LRA benchmarks (#2928)Andres Noetzli
Due to issues in the current proof code, this commit also disables proof checking for five QF_LRA benchmarks (see issue #2855).
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-04-25New C++ API: Clean up API: mkVar vs mkConst vs mkBoundVar. (#2977)Aina Niemetz
This cleans up naming of API functions to create first-order constants and variables. mkVar -> mkConst mkBoundVar -> mkVar declareConst is redundant (= mkConst) and thus, in an effort to avoid redundancy, removed. Note that we want to avoid redundancy in order to reduce code duplication and maintenance overhead (we do not allow nested API calls, since this is problematic when tracing API calls).
2019-04-03Update copyright headers.Aina Niemetz
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-28Fix freeing nodes with maxed refcounts (#2903)Andres Noetzli
2019-03-26Update copyright headers.Aina Niemetz
2019-03-23BV: Fix typerules for rotate operators. (#2895)Aina Niemetz
2019-03-23Strip non-matching beginning from indexof operator (#2885)Andres Noetzli
This commit adds a rewrite that strips endpoints from `str.indexof` operators if they don't overlap with the string that is being searched for using `stripConstantEndpoints()`. In addition to that, it makes `stripConstantEndpoints()` slightly more aggressive by allowing it to drop substring components that have zero overlap with the string that we are looking at. Finally, the commit fixes the default argument for `fullRewriter` of `checkEntailContains()` to be true instead of false, which should allow for more rewriting opportunities.
2019-03-22Fix stripConstantEndpoints in strings rewriter (#2883)Andres Noetzli
`TheoryStringsRewriter::stripConstantEndpoints()` returns the stripped endpoints in the vectors `nb` and `ne`. These endpoints were not computed correctly if string literal had to be split. For example: ``` stripConstantEndpoints({ "ABC" }, { "C" }, {}, {}, 1) ``` returned `true` and only "A" for `nb` (instead of "AB") because we mistakenly used the amount of overlap between "ABC" and "C" (which is one) for the length of the stripped prefix. This commit fixes the issue and adds several unit tests.
2019-03-18New C++: Remove redundant mkBoundVar function.Aina Niemetz
2019-03-18New C++: Remove redundant mkVar function.Aina Niemetz
s
2019-03-18BitVector: Allow base 10 in constructor. (#2870)Aina Niemetz
2019-03-16Enable CryptoMiniSat-backed BV proofs (#2847)Alex Ozdemir
* Connect the plumbing so that BV proofs are enabled when using CryptoMiniSat * Also fixed a bug in CNF-proof generation * Specifically, CNF proofs broke when proving tautological clauses. Now they don't.
2019-02-28ErProof class with LFSC output (#2812)Alex Ozdemir
* ErProof class with LFSC output * Created a TraceCheckProof class * parsable from text * Created an ErProof class * constructible from a TraceCheckProof * writable as LFSC * A bunch of unit tests * Reponded to Mathias's first set of comments. Credits to Mathias for many of the fixes! * Responed to Andres's first set, fixed tests I accidentally deleted a "!" last time, causing stuff to fail. * Use Configuration::isAssertionBuild * Clarified comment * Responded to Andres's 2nd review * Gaurding against a memory error. * Renaming a file. * Aggressively unlinking temporary files.
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback