summaryrefslogtreecommitdiff
path: root/test/regress/CMakeLists.txt
AgeCommit message (Collapse)Author
2020-06-06Merge branch 'master' into issue4576issue4576Andrew Reynolds
2020-06-06Keep definitions when global-declarations enabled (#4572)Andres Noetzli
Fixes #4552. Fixes #4555. The SMT-LIB standard mandates that definitions are kept when `:global-declarations` are enabled. Until now, CVC4 was keeping track of the symbols of a definition correctly but lost the body of the definition when the user context was popped. This commit fixes the issue by adding a `global` parameter to `SmtEngine::defineFunction()` and `SmtEngine::defineFunctionRec()`. If that parameter is set, the definitions of functions are added at level 0 to `d_definedFunctions` and the lemmas for recursive function definitions are kept in an additional list and asserted during each `checkSat` call. The commit also updates new API, the commands, and the parsers to reflect this change.
2020-06-06Fix destruction order in NodeManagerAndres Noetzli
Fixes #4576. ASan was reporting memory leaks because the skolem manager was being destroyed after the attributes and zombies were already cleaned up in the destructor of NodeManager. This commit changes the destruction order to ensure that the skolem manager is destroyed before the rest of the cleanup. Note: this issue did not only make the benchmark in #4576 fail but several tests in our regressions.
2020-06-05Smt2 parsing support for nested recursive datatypes (#4575)Andrew Reynolds
Also includes some minor improvement to expand definitions in TheoryDatatypes leftover from the branch. Adds 3 regressions using the option --dt-nested-rec.
2020-06-05Fix handling of Boolean term variables (#4550)Andres Noetzli
Fixes #4446. This commit fixes two issues related to the handling of Boolean term variables: Removing Boolean subterms and replacing them with a Boolean term variable introduces an equality of the form (= v t) where v is the Boolean term variable and t is the term. It is important that these equalities do not get removed. This commit changes Theory::isLegalElimination() to take this into account. The incorrect model reported in the issue was caused by some of the Boolean term variables not being assigned values by the SAT solver when we decided that the benchmark is satisfiable. Our justification heuristic (correctly) decided that it is enough to satisfy one of the disjuncts in the assertion to satisfy the whole assertion. However, the assignments that we received from the SAT solver restricted us to pick a specific value for one of the Boolean constants: Literal | Value | Expr --------------------------------------------------------- '7 ' 0 c '0 ' 1 true '1 ' 0 false '2 ' 0 (a BOOLEAN_TERM_VARIABLE_274) '5 ' _ b '3 ' 1 (a BOOLEAN_TERM_VARIABLE_277) '4 ' _ BOOLEAN_TERM_VARIABLE_274 '6 ' 0 BOOLEAN_TERM_VARIABLE_277 This meant that we had to pick true for BOOLEAN_TERM_VARIABLE_274 but we picked false since we simply treated it as an unassigned variable. In general, the justification heuristic handles embedded skolems introduced by term removal first and asks the SAT solver to decide on Boolean term variables. However, for some logics, such as QF_AUFLIA, we use the justification heuristic not for decisions but only to decide when to stop, so those decisions were not done. This commit introduces a conservative fix that adds a check after satsifying all the assertions that makes sure that the equalities introduced for Boolean terms are satisfied as well. Due to the eager treatment of Boolean term variables when we use the justification heuristic also for decisions, it is likely that we don't really have the problem in that case but it doesn't hurt to enable the fix. It is also possible that this fix is only required with models but it is definitely safer to just always enable it (there could be tricky corner cases involving the theory combination between UF and Boolean terms). Additionally, this commit changes the ITE-specific naming in the justification heuristic to reflect more accurately that we are in general dealing with skolems introduced by term removals and not only due to ITE removal.
2020-06-04Fix abduction with datatypes (#4566)Andrew Reynolds
Previously we were treating constructor/selector/tester symbols as arguments to the abduct-to-synthesize.
2020-06-03Do not apply unconstrained simplification when quantifiers are present (#4532)Andrew Reynolds
Fixes #4437. This is a simpler fix that aborts the preprocessing pass when a quantifier is encountered. It also updates our smt2 parser to throw a logic exception when forall/exists is used in non-quantified logics. This is required to ensure that unconstrained simplification does not throw an exception to a user as a result of accidentally setting the wrong logic.
2020-06-02Fix scope issue with pulling ITEs in extended rewriter. (#4547)Andrew Reynolds
Fixes #4476.
2020-06-02Do not handle universal quantification on functions in model-based FMF (#4226)Andrew Reynolds
Fixes #4225, fixes CVC4/cvc4-projects#159, fixes CVC4/cvc4-projects#157, fixes #4289, fixes #4483. This makes it so that the main model-based instantiation algorithm is not applied to quantified formulas with universally quantified functions. Identation changed in a FMF function, this was refactored to conform to guidelines, and further cleaned.
2020-06-01Set theoryof-mode after theory widening (#4545)Andres Noetzli
Fixes #4367. We set the theoryof-mode depending on whether sharing is enabled or not. However, we were checking whether sharing was enabled before theory widening, leading to unexpected results. This commit moves the check after widening the theories. For the benchmark in the issue, setting the theoryof-mode before theory widening lead to problems because of the following: The main solver checks the condition for enabling term-based theoryof-mode, decides not to do it because sharing is not enabled Main solver adds UF to the logic Main solver does a check-sat all Unsat core check runs, sees both UF and NRA enabled, and switches to term-based mode Main solver gets to second check-sat call, now the theoryof-mode is suddenly changed, which leads to problems in the equality engine This commit fixes the issue in this particular instance but it is important to note that it does not address the issue of the subsolver changing settings in general. This can only really be solved by separating the options from the ExprManager/NodeManager and having separate options for each SmtEngine/Solver instance.
2020-06-01Do not parse ->/lambda unless --uf-ho enabled (#4544)Andres Noetzli
Fixes #4477. Logic ALL includes higher-order but we currently do not support solving higher-order problems unless --uf-ho is enabled. This commit changes the condition under which we parse -> and lambda to only enabled parsing of those symbols if the logic allows higher-order constraints and --uf-ho is enabled.
2020-05-31Do not cache operator eliminations in arith (#4542)Andres Noetzli
Fixes #4525. The actual problem in the issue is not that the unsat core is satisfiable but that our unsat core check is not working as intended. Our unsat core check uses the same `ExprManager` as the main `SmtEngine` and thus also shares the same attributes for nodes. However, since we have a different `SmtEngine` instance for the check, we also have different instances of `TheoryArith`. This leads to the check failing due to the following: - Our only input assertion is `(> (cot 0.0) (/ 1 0)))`. - `TheoryArith::expandDefinition()` gets called on `(> (cot 0.0) (/ 1 0))` but nothing happens. - `TheoryArith::expandDefinition()` gets called on `(/ 1 0)`, which gets expanded as expected but no attribute is set because it happens in a simple `TheoryArith::eliminateOperators()` call. - `TheoryArith::expandDefinition()` on `(cot (/ 0 1))` first expands to `(/ 1 0)` (not cached) and then we expand it recursively to the expected term and cache `(/ 1 0) ---> (ite (= 0 0) (divByZero 1.0) (/ 1 0))`. Up to this point, things are suboptimal but there are no correctness issues. The problem starts when we do the same process in the unsat core check: - Our only input assertion is again `(> (cot 0.0) (/ 1 0)))`. - `TheoryArith::expandDefinition()` gets called on `(> (cot 0.0) (/ 1 0))` but nothing happens. - `TheoryArith::expandDefinition()` gets called on `(/ 1 0)`, which gets expanded as expected but no attribute is set or checked because it happens in a simple `TheoryArith::eliminateOperators()` call. Note that the skolem introduced here for the division-by-zero case is different from the skolem introduced above because this is in a different `TheoryArith` instance that does not know the existing skolems. - `TheoryArith::expandDefinition()` on `(cot (/ 0 1))` first expands to `(/ 1 0)` (not cached) and then we use the cache from our solving call to expand it `(/ 1 0) ---> (ite (= 0 0) (divByZero 1.0) (/ 1 0))`. Note that `divByZero` here is the skolem from the main solver. As a result, the preprocessed assertions mix skolems from the main `SmtEngine` with the `SmtEngine` of the unsat core check, making the constraints satisfiable. To solve this problem, this commit removes the caching-by-attribute mechanism. The reason for removing it is that it is currently ineffective (since most eliminations do not seem to be cached) and there are caches at other levels, e.g. when expanding definitions. If we deem the operator elimination to be a bottleneck, we can introduce a similar mechanism at the level of `TheoryArith`.
2020-05-26Fix an incorrect limit in conversion from real to float (#4418)Martin
This error is a bit inexplicable but very very definitely wrong. A test case from the original bug report is included.
2020-05-22Refactor operator elimination in arithmetic (#4519)Andrew Reynolds
This is a major refactor of how operators are eliminated in arithmetic. Currently there were (at least) two things wrong: (1) ppRewriteTerm sent lemmas on the output channel. This behavior is incompatible with how preprocessing works. In particular, this caused unconstrained simplification to be unaware of terms from such lemmas, leading to incorrect "sat" answers. (2) Lemmas used to eliminate certain "div-like" terms were processed in a context-independent way. However, lemmas should be cached in a user-context-dependent way. This was leading to incorrect "sat" answers in incremental. The solution to these issues is to eliminate operators via the construction of witness terms. No lemmas are sent out, and instead these lemmas are the consequence of term formula removal in the standard way. As a result of the refactor, 2 quantifiers regressions time out due to infinite branch and bound issues (one only during --check-unsat-cores). These appear to be random and I've changed the options to avoid these issues. 3 others now have check-model warnings, which I've added --quiet to. Improving check-model will be addressed on a future PR. This PR is not required for SMT COMP since we have workarounds that avoid both the incorrect behaviors in our scripts. Also notice that --rewrite-divk is effectively now enabled by default always. Fixes #4484, fixes #4486, fixes #4481.
2020-05-22(proof-new) Add rewrite corresponding to regular expression inclusion (#4513)Andrew Reynolds
This introduces a rewrite based on regular expression inclusion (using calls to the RegExpEntail utility function). This allows us to justify the regular expression inclusion inference as a rewrite.
2020-05-20Fix missing check for cardinality one in unconstrained simplifier (#4504)Andrew Reynolds
Fixes #4482.
2020-05-20Normal form equality conflicts and uniqueness check (#4497)Andrew Reynolds
This adds a new inference schema to strings that was discovered by the internal proof checker. It says that we are in conflict when an equality between the normal forms of two terms in the same equivalence class rewrites to false. It also improves the efficiency of processing normal forms by only considering normal forms that are unique up to rewriting.
2020-05-20Fix parametric datatype instantiation (#4493)Andrew Reynolds
A bug was introduced when adding the Node-level datatype implementation in d803e7f. The code did not probably get the arity of a sort constructor. This adds TypeNode::getSortConstructorArity and uses it during parametric datatype type resolution.
2020-05-19Do not eliminate variables that are equal to unevaluatable terms (#4267)Andrew Reynolds
When we eliminate a variable x -> v during simplification, it may be the case that v contains "unevaluated" operators like forall, choice, etc. Thus, we do not produce correct models for such inputs unless simplification is disabled. This PR ensures we only eliminate variables when v contains only evaluated operators. Additionally, the kinds registered as unevaluated were slightly modified so that when we are in a logic like QF_LIA, there are no registered unevaluated operators, hence the check above is unnecessary. This is to minimize the performance impact of this change. Fixes #4500.
2020-05-19Fix cached free variable identifiers in sygus term database (#4394)Andrew Reynolds
Fixes an issue with over-pruning in SyGuS where using multiple sygus types that map to the same builtin type. Our mapping sygusToBuiltin did not ensure that free variables were unique. Fixes #4383.
2020-05-19Renamed operator CHOICE to WITNESS (#4207)mudathirmahgoub
Renamed operator CHOICE to WITNESS, and removed it from the front end
2020-05-19Make SolveEq and PlusCombineLikeTerms idempotent (#4438)Andres Noetzli
Fixes #3692 and an assertion failure that came up during the test runs for SMT-COMP. The bit-vector rewrites `SolveEq` and `PlusCombineLikeTerms` were not always idempotent. At a high level, `SolveEq` combines common terms from two sides of an equality and `PlusCombineLikeTerms` combines common terms within an addition. However, in doing so, these rewrites were reordering the operands of the bit-vector addition based on the node ids of the terms that were multiplied with their coefficients. Consider the addition `3 * x * y + 5 * y * z` (the bit-width does not matter). `PlusCombineLikeTerms` would reorder this addition to `5 * y * z + 3 * x * y` if the node id of `y * z` was smaller than the node id of `x * y`. The issue is that node ids are not fixed for a given term: If we have a term `x * y` and that term reaches ref count 0, we may get a different id for that same term if we recreate it later on. When terms reach ref count 0, we don't immediately delete them but add them to our set of zombies to be deleted whenever the list of zombies grows larger than some fixed size. When applying `SolveEq` and `PlusCombineLikeTerms` multiple times (even in direct succession without doing anything else), the node order may change because some of the terms like `x * y` may be zombies while others have been deleted and get new ids, leading to the relative order of node ids changing. I suspect that we could construct a case where we get into an infinite rewrite loop. This commit addresses the issue as follows: It does not perform the rewrites `SolveEq` and `PlusCombineLikeTerms` if none of the operands change. This makes the rewrites idempotent. Note however that we are still not guaranteeing that a term has the same rewritten form throughout an execution because the node ids may change if the term has been freed in the meantime. However, this limitation is consistent with other rewrites such as the reordering of equalities. I am including the minimized test case from our run on SMT-LIB. I am ommittin the test case from #3692 because I couldn't trigger it on master (not surprising since the issue requires very specific circumstances to actually occur). However, I was able to reproduce the issue on the CVC4 version mentioned in the issue and confirmed that this fix worked for that older version.
2020-05-05Always introduce fresh variable for unconstrained APPLY_UF (#4472)Andrew Reynolds
Fixes an unsoundness in unconstrained simplification, fixes #4469.
2020-05-01Move slow regression to regress3 (#4430)Andrew Reynolds
2020-04-30Remove skolem share involving pre_first_ctn. (#4423)Andrew Reynolds
This fixes a soundness issue in strings caused by an incorrect skolem share. This adds a regression that corresponds to the rewrite that this skolem share was justified by, which is "sat" (the rewrite does not hold). This benchmark in fact was answered "unsat" by CVC4 prior to this PR.
2020-04-29Avoid circular dependencies for justifying reductions in strings extf eval ↵Andrew Reynolds
(#4415) An incorrect answer of "sat" could be found after 8 seconds on the given benchmark (with --strings-fmf) due to a circular justification for why an extended function was reduced. In particular, we ran checkExtfInference on the same term twice and then marked it as reduced since we had already seen it. This makes the code more conservative. Notice I'm making the code doubly conservative in case there is any chance for duplication again (e.g. if ExtTheory provides duplicate terms).
2020-04-28Update cardinality in strings to unicode standard (#4402)Andrew Reynolds
This updates the default cardinality in strings to match the Unicode standard, 196608. This avoids a check-model failure from 25 benchmarks in SMT-LIB, which were related to a split due to insufficient constants being required during collectModelInfo. This also makes a few places throw an AlwaysAssert(false) that otherwise would lead to incorrect models. These regardless should never throw, but it would be better to have an assertion failure.
2020-04-25 Fix sets cardinality cycle rule (#4392)Andrew Reynolds
Fixes #4391. The sets cardinality cycle rule is analogous to the S-Cycle rule for strings (see Liang et al CAV 2014). This rule is typically never applied but can be applied in rare cases where theory combination does not determine a correct arrangement of equalities over sets terms that is consistent with the arithmetic arrangement of their cardinalities at full effort. Notice the regression from #4391 has non-linear arithmetic, (mod 0 d), which is translated to UF. The cardinality cycle rule had a bug: it assumed that cycles that were encountered were loops e1 = e2 = ... = e1 but in general they can be lassos e1 = ... = e2 = ... = e2. This ensures the Venn region cycle e2 = ... = e2 is the conclusion in this case, instead of unsoundly concluding e1 = ... = e2. Strings does not have a similar issue: https://github.com/CVC4/CVC4/blob/master/src/theory/strings/core_solver.cpp#L488 Here, when a cycle is encountered, it is processed at the point in traversal where the loop is closed. This is not critical for SMT-COMP but should be in the 1.8 release.
2020-04-22Ensure disequality splits are processed as lemmas (#4380)Andrew Reynolds
Fixes #4379. This was caused by a splitting lemma rewriting to a conjunction, being processed as a fact, and having a pending phase requirement sent out assuming the inference was to be processed as a lemma. This forces 2 of the splits in the core solver to be always processed as lemmas.
2020-04-22Reinstantiate support for conjunctions in facts (#4377)Andres Noetzli
Fixes #4376. Commit 6255c0356bd78140a9cf075491c1d4608ac27704 removed support for conjunctions in the conclusion of facts. However, `F_ENDPOINT_EMP` generates a conjunction in the conclusion of the inference if multiple components are inferred to be empty. This commit reinstantiates support for conjunctions in the conclusion of facts.
2020-04-16SyGuS instantiation quantifiers module (#3910)Mathias Preiner
2020-04-15Do not normalize to representatives for variable equalities in ↵Andrew Reynolds
conflict-based instantiation (#4280) Conflict-based instantiation would sometimes initialize a match x -> getRepresentative(t) when a quantified formula contained x = t. This leads to issues where getRepresentative(t) is an illegal term (say, in combination with CEGQI). This makes it so the representative is accessed when necessary instead of being set as part of the match. Fixes #4275.
2020-04-14Always assign function values in higher order (#4279)Andrew Reynolds
Fixes #4277.
2020-04-14Disable preregistration of instantiations for cegqi in incremental (#4251)Andrew Reynolds
Fixes #4243.
2020-04-14Remove a few spurious assertions (#4294)Andrew Reynolds
Fixes #4290 and fixes #4292.
2020-04-14Fix dump-unsat-cores-full (#4303)Andrew Reynolds
This adds a fix to ensure dump-unsat-cores-full works by modifying the public options function. This options currently does not work since dumpUnsatCores is only set internally now. This fix is only required until options are refactored so that SmtEngine owns the authoritative copy of options.
2020-04-13Fix SyGuS define-fun printing from benchmarks coming from v1 parser (#4256)Andrew Reynolds
A recent change made it so that defined functions would print as the anonymous lambda corresponding to their definition if the SyGuS v1 parser was used. This was caused by comparison with the wrong kind in the new API. Notice that the v2 parser does not have this issue. This also adds a regression to ensure this behavior is maintained by the SyGuS v2 parser.
2020-04-12Fixes for extended rewriter (#4278)Andrew Reynolds
Fixes #4273 and fixes #4274 . This also removes a spurious assertion from the Node::substitute method that the result node is not equal to the domain. This is violated for f(f(x)) { f(x) -> x }.
2020-04-12Move slow nl regression to regress3 (#4276)Andrew Reynolds
Should fix nightlies.
2020-04-10Ensure exported sygus solutions match grammar (#4270)Andrew Reynolds
Previously we were doing rewriting/expand definitions during grammar normalization, which overwrote the original sygus operators. The connection to the original grammar was maintained via the SygusPrintCallback utility, which ensured that a sygus term printed in a way that matched the grammar. We now have several use cases where solutions from SyGuS will be directly exported to the user, including the current use of get-abduct. This means that the terms must match the grammar, and we cannot simply rely on the print callback. This moves the code to normalize sygus operators to datatypes utils, where the conversion between sygus and builtin terms takes place. This allows a version of this function where isExternal = true, which constructs terms matching the original grammar. This PR enables the SyGuS API to have an accurate getSynthSolution method. It also will eliminate the need for SygusPrintCallback altogether, once the v1 parser is deleted.
2020-04-09Disable slow sygus regression (#4232)Andrew Reynolds
A regress2 SyGuS benchmark is taking 110 seconds in production on my machine. This was likely caused by the recent update v1 -> v2, which impacts the internal representation and hence the search. Disabling for now.
2020-04-08Added CHOOSE operator for sets (#4211)mudathirmahgoub
This PR enables THEORY_UF by default for sets and adds the operator CHOOSE for sets which returns an element from a given set. The semantics is as follows: If a set A = {x}, then the term (choose A) is equivalent to the term x. If the set is empty, then (choose A) is an arbitrary value. If the set has cardinality > 1, then (choose A) will deterministically return an element in A.
2020-04-08Perform theory widening eagerly (#4044)Andres Noetzli
Fixes #3971 and fixes #3991. In incremental mode, the logic can change from one (check-sat) call to another. In the reported issue, we start with QF_NIA but then switch to QF_UFNIA because there is a div term (which has a UF in its expanded form). Dealing with this issue is challenging in general. As a result, we have decided not to allow theory widening in Theory::expandDefinitions() anymore but instead to do it eagerly in SmtEngine::setDefaults().
2020-04-08Fix dump models and dump proofs (#4230)Andrew Reynolds
A recent commit (45e489e) made it so that dump-models did not automatically enable produce-models in the global options object, but instead the SmtEngine enabled produce-models internally. The code for dump-models and dump-proofs was (perhaps out of paranoia) checking produce-models and produce-proofs. This removes this check, which is the correct thing to do since SmtEngine internally ensures produce-models is set.
2020-04-06Disable slow regression (#4221)Andrew Reynolds
Benchmark recently became slow, disable for now.
2020-04-03Only rewrite lambdas via array representations when constant (#4203)Andrew Reynolds
Fixes #4170.
2020-03-31Support char smt-lib syntax (#4188)Andrew Reynolds
Towards support for the strings standard. Adds support to (_ char #x ... ) syntax for characters.
2020-03-30Support indexed operators re.loop and re.^ (#4167)Andrew Reynolds
Towards support for the strings standard. This modifies our interface so that we accept the SMT-LIB standard versions of re.loop and re.^. This means re.loop no longer accepts 3 arguments but 1 (with 2 indices). This means we no longer accept re.loop with only a lower bound and no upper bound on the number of repetitions. Also fixes #4161.
2020-03-30Frontend support for the choice operator (#4175)mudathirmahgoub
Added the operator choice to Smt2.g and Cvc.g. Removed the unused parameter hasBoundVars from TheoryModel::getModelValue
2020-03-27Fix issues with unsat cores and reset-assertions (#4159)Andres Noetzli
Fixes #4151. Commit e9f4cec2cad02e270747759223090c16b9d2d44c fixed how `(reset-assertions)` is handled by destroying and recreating the `PropEngine` owned by `SmtEngine`. When unsat cores are enabled, creating a `PropEngine` triggers the creation of a SAT proof and a CNF proof. In the `ProofManager`, we had assertions that checked that those kinds of proofs were only created once, which is not true anymore. This commit removes the assertions, cleans up the memory management in `ProofManager` to use `std::unique_ptr` and makes all the `ProofManager::init*` methods non-static for consistency. The commit also fixes an additional issue that I encountered while testing the fix: When creating the new `PropEngine`, we were not asserting `true` and `(not false)`, which lead to an error if we tried to get the unsat core after a `(reset-assertion)` command and we had asserted `(assert false)`. The commit fixes this by asserting `true` and `(not false)` in the constructor of `PropEngine`. The regression test is an extension of the example in #4151 and covers both issues.
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback