Haniel Barbosa [Thu, 13 Aug 2020 00:01:40 +0000 (21:01 -0300)]
[proof-new] Adding support for corner case of transitivity simulating MERGED_THROUGH_CONSTANTS (#4879)
Haniel Barbosa [Wed, 12 Aug 2020 23:18:16 +0000 (20:18 -0300)]
generalize handling MERGED_THROUGH_CONSTANST in EqProof conversion (#4878)
Now that we are using the constant folding in equality engine for more than equality it is necessary to generalize the previously-hard-coded handling of MERGED_THROUGH_CONSTANTS.
Abdalrhman Mohamed [Wed, 12 Aug 2020 22:51:48 +0000 (17:51 -0500)]
Refactor functions that print commands (Part 1) (#4869)
This PR is a step towards migrating commands to the Term/Sort level. The functions for printing synth-fun command and its grammar were modified to remove their dependency on command objects and use nodes instead of exprs and types. Similar changes to other functions that print commands will follow.
Andrew Reynolds [Wed, 12 Aug 2020 22:13:14 +0000 (17:13 -0500)]
Fixes for degenerate case of sygus decision tree learning (#4800)
Fixes #4790.
Fixes two bugs in the decision tree learning solver for sygus, one involving evaluation of "templated" enumerators, and one involving ITE strategies where child types are different than the root.
Andrew Reynolds [Wed, 12 Aug 2020 21:34:47 +0000 (16:34 -0500)]
(proof-new) Improve robustness of CONG rule (#4882)
This makes it so that the explicit Kind is wrapped in a Node as an argument to the CONG proof rule. This allows us to distinguish applications with the same parameterized operator but different kinds (e.g. APPLY_SELECTOR vs APPLY_SELECTOR_TOTAL).
Andrew Reynolds [Wed, 12 Aug 2020 20:51:15 +0000 (15:51 -0500)]
(proof-new) Proof support in the strings term registry. (#4876)
Adds basic support for proofs in the strings term registry. This code is not yet active until further parts of proof-new are merged.
Andrew Reynolds [Wed, 12 Aug 2020 19:48:31 +0000 (14:48 -0500)]
(proof-new) Improve interfaces to proof generators (#4803)
This includes configurable naming and a caching policy for term conversion proof generator.
Also corrects a subtle issue in LazyCDProof related to making getProofFor idempotent using the notion of owned proofs.
makaimann [Wed, 12 Aug 2020 19:03:45 +0000 (12:03 -0700)]
Add option to only build library (#4801)
This PR would add an option to only build the CVC4 library and not the parser or executable. This can be used for projects that only intend to use CVC4 through the API.
It seems to be working now, but it's not necessarily the cleanest solution. In particular, if you'd like the polarity to be different I'm happy to change that. Polarity meaning something like "${WITH_BINARY}" STREQUAL "YES" instead of NOT "${LIB_ONLY} STREQUAL "YES" which is admittedly a little strange.
Andrew Reynolds [Wed, 12 Aug 2020 16:41:26 +0000 (11:41 -0500)]
(proof-new) Witness form proof generator (#4782)
This class is responsible for the connection between terms and their witness form in the final proof.
Gereon Kremer [Wed, 12 Aug 2020 15:01:58 +0000 (17:01 +0200)]
Add naive support for integer variables. (#4835)
This PR adds naive support for integer reasoning to the CAD-based solver.
Essentially, it checks whether the sampled value is integral. If this is not the case, we "invent" a new interval covering the area between the two neighbouring integers with appropriate border polynomials.
Haniel Barbosa [Wed, 12 Aug 2020 14:31:30 +0000 (11:31 -0300)]
(proof-new) Improving proof-production in Equality Engine (#4871)
This commit improves functionalities of the equality engine so that it is easier to produce proofs for its reasoning. They are:
avoiding assertion of already entailed predicates/equalities.
better EqProof of disequalities with constants
correct EqProof involving n-ary congruence kinds
Andrew Reynolds [Wed, 12 Aug 2020 14:18:24 +0000 (09:18 -0500)]
Fix connection to master equality engine in sets (#4877)
This corrects an issue introduced by a merge of a previous commit (
b5b2858) which dropped the connection from sets to its master equality engine.
Fixes several issues in sets regressions, including a timeout in regress0.
Gereon Kremer [Wed, 12 Aug 2020 13:17:18 +0000 (15:17 +0200)]
Fix infinite loop in arith_ite_simp (#4805)
We have an open issue with an infinite loop with --ite-simp for a long time in #789 , for example on
(declare-fun a () Int)
(declare-fun b () Int)
(assert
(and
(= 1 (+ a b))
(or (= 0 a) (= 0 b))
(or (= 0 b) (>= b 8))
(or (= 0 a) (not (>= b 8)))
)
)
(check-sat)
The problem goes back to arith_ite_utils.cpp and roughly is as follows:
The method solveBinOr looks for patterns like (or (= b 0) (= b 1)). It introduces a new Boolean variable deor_1 and substitutes b -> (ite deor_1 1 0).
The method also stores another mapping in d_skolems: deor_1 -> (>= b 8) here which is also used in selectForCmp. However, these skolems are also used to add even more substitutions here after applying the already added substitutions to it. Eventually, we have a substitution deor_1 -> (>= (ite deor_1 1 0) 8) which inevitably leads to an infinite loop.
I have found no reason for the second mapping (deor_1 -> (>= b 8)) to be added as a substitution, and thus this PR removes it.
Benchmarks are running to check whether there are further issues with this, and whether this simplification is beneficial.
Fixes #789.
Andrew Reynolds [Wed, 12 Aug 2020 06:41:45 +0000 (01:41 -0500)]
Fix unsupported option in regress1. (#4874)
Fixes regress1.
Andrew Reynolds [Wed, 12 Aug 2020 05:08:32 +0000 (00:08 -0500)]
Split SmtEngineState from SmtEngine (#4855)
This splits a utility for tracking the "basic" state of the SmtEngine. This class tracks its high-level state, including the "SMT mode", last/expected status and manages the contexts. It is not responsible more detailed state information (e.g. the assertions).
Andrew Reynolds [Wed, 12 Aug 2020 03:53:58 +0000 (22:53 -0500)]
Prepare theory of sets for dynamic allocation of equality engine (#4868)
In forthcoming PRs, Theory objects will be assigned equality engine objects dynamically.
This PR prepares the theory of sets for this update, which involves refactoring of its internal members.
Andrew Reynolds [Wed, 12 Aug 2020 02:53:13 +0000 (21:53 -0500)]
Final preparations for changing API to use the Node-level datatype (#4863)
This includes all fixes encountered while fixing unit tests with the Term -> Node version of Datatypes in the API.
After all pending PRs are merged, the next step will be to convert the new API to use e.g. CVC4::DType instead of CVC4::Datatype everywhere.
Andrew Reynolds [Wed, 12 Aug 2020 02:06:17 +0000 (21:06 -0500)]
(proof-new) Extensions to proof checker interface (#4857)
This includes support for pedantic levels, as well as a utility for wrapping Kind in a Node (for the updated CONG rule, to be updated in a later PR).
Andrew Reynolds [Tue, 11 Aug 2020 20:56:24 +0000 (15:56 -0500)]
Update Expr-level unit tests that depend on datatypes to Node (#4860)
In preparation for eliminating the Expr-level datatype.
Andrew Reynolds [Tue, 11 Aug 2020 20:36:38 +0000 (15:36 -0500)]
Remove instantiation model true option (#4861)
This was an option that rejected instantiations that are true according to the current
model's equality engine.
This option was never helpful and will be burdensome to maintain with new updates
to equality engine infrastructure.
Aina Niemetz [Tue, 11 Aug 2020 19:58:28 +0000 (12:58 -0700)]
New C++ API: Remove redundant API functions for mkReal. (#4870)
This further removes redundant API functions with a `const char*`
parameter. These are redundant (and can create ambiguity) since they
have `const string&` counterparts.
Andrew Reynolds [Sun, 9 Aug 2020 22:36:22 +0000 (17:36 -0500)]
Make valuation class more robust to null underlying TheoryEngine. (#4864)
In some use cases (unit tests, old proofs infrastructure), we use a Theory with no associated TheoryEngine. This PR makes the Valuation class more robust to this case.
This includes making the "unevaluated kinds" a no-op in this case (this is necessary for Theory::finishInit with no TheoryEngine) and adding some assertions to cases that the Theory should never call without TheoryEngine.
This is required for a new policy for dynamically configuring equality engine infrastructure in Theory.
Andrew Reynolds [Sun, 9 Aug 2020 21:50:09 +0000 (16:50 -0500)]
Splitting a few utility classes from EqualityEngine to their own file (#4862)
Includes iterators and notification callbacks. These classes will be highly relevant for planned extensions to the core theory engine infrastructure.
Andrew Reynolds [Sat, 8 Aug 2020 01:22:55 +0000 (20:22 -0500)]
Move datatype index constant to its own file (#4859)
Towards removing the Expr-level datatype.
Moves DatatypeIndex to its own file, which is the only thing that is necessary remaining from expr/datatype.h.
Also updates the datatype kinds file in preparation for the removal.
Aina Niemetz [Fri, 7 Aug 2020 21:56:28 +0000 (14:56 -0700)]
GH Actions: Remove cancel action. (#4843)
The previously introduced action to cancel running builds is not able to
cancel builds on other branches, only on the same branch. As a consequence,
when pushing to a branch for which a PR has been submitted, builds on the
main repository are not cancelled.
This removes the cancel build. If we want behavior similar to how it was
on Travis, we need a workaround / more sophisticated solution since GH
Actions doesn't really allow / support this (due to permission issues).
Andrew Reynolds [Thu, 6 Aug 2020 18:41:24 +0000 (13:41 -0500)]
Updates not related to creation for eliminating Expr-level datatype (#4838)
This updates remaining uses of the Expr-level Datatype that are not related to their creation / memory management in ExprManager.
This required updating a unit test from Expr -> Node.
Andrew Reynolds [Thu, 6 Aug 2020 13:29:17 +0000 (08:29 -0500)]
Split preprocessor from SmtEngine (#4854)
This splits a collection of utilities from SmtEngine that work in cooperation to preprocess assertions (Boolean circuit propagator, preprocessing context, process assertions, term formula removal).
It updates various interfaces in SmtEngine from Expr -> Node and simplifies SmtEngine to use this utility.
Andrew Reynolds [Thu, 6 Aug 2020 11:48:45 +0000 (06:48 -0500)]
(proof-new) Refactor regular expression operation (#4596)
This refactors the regular expression operation class so that some of its key methods are static, so that they can used by both the regular expression solver and the strings proof checker.
Notice that many cases of regular expression unfolding are deleted by this PR, since they are unnecessary. This is due to the fact that all regular expression memberships are rewritten except those whose RHS are re.++ or re.*.
Andrew Reynolds [Wed, 5 Aug 2020 19:14:23 +0000 (14:14 -0500)]
Split Assertions from SmtEngine (#4788)
This splits all things related to storing assertions in the SmtEngine into a separate class "Assertions". It also converts the interface for its methods from Expr to Node.
Gereon Kremer [Wed, 5 Aug 2020 18:55:00 +0000 (20:55 +0200)]
Improve error message for unsupported exponents (#4852)
We have had a few issues where essentially users misinterpreted the error message about which types of exponents are supported for (^ base exp). Given that this is rewritten to a multiplication of length exp, we only support reasonably small natural numbers.
This PR improves the error message.
Fixes #4692
Andrew V. Jones [Wed, 5 Aug 2020 17:38:15 +0000 (18:38 +0100)]
When checking models, ensure that error message is correctly formatted (#4853)
Issue
When CVC4 is checking models and encounters an issue, it presents an message like this:
Internal error detectedTHEORY_ARITH has an asserted fact that the model doesn't satisfy.
Notice: there's no space between detected and THEORY_ARITH.
Resolution
This PR ensures that the error message is correctly formatted.
Signed-off-by: Andrew V. Jones andrew.jones@vector.com
Andres Noetzli [Wed, 5 Aug 2020 14:18:10 +0000 (07:18 -0700)]
[Strings] Add eager context-dependent evaluation (#4847)
This commit adds eager evaluation of string terms based on the current
context. To do so, it declares the string kinds to be "interpreted" in
the equality engine. This allows us to avoid making a series of
decisions such as:
** (= "describe" (str.substr actionName 0 8)) :DE-DECISION:
*** (= actionName "deletecertificate") :DE-DECISION:
**** (= resource_partition "aws") :DE-DECISION:
***** (= resource_region "af-south-1") :DE-DECISION:
****** (= resource_account "") :DE-DECISION:
******* (= (str.len (str.substr actionName 0 3)) 0) :DE-DECISION:
******** (= (str.len (str.substr actionName 0 4)) 0) :DE-DECISION:
********* (= (str.len (str.substr actionName 0 6)) 0) :DE-DECISION:
********** (= (str.len (str.substr actionName 0 5)) 0) :DE-DECISION:
*********** (= (str.len (str.substr actionName 0 9)) 0) :DE-DECISION:
************ (= (str.len (str.substr actionName 0 7)) 0) :DE-DECISION:
************* (= (str.len (str.substr actionName 0 10)) 0) :DE-DECISION:
************** (= (str.len (str.substr actionName 0 2)) 0) :DE-DECISION:
*************** (= (str.len (str.substr actionName 0 13)) 0) :DE-DECISION:
**************** (= (str.len (str.substr actionName 0 12)) 0) :DE-DECISION:
***************** (= (str.len resource_service) 0) :DE-DECISION:
****************** (= (str.len resource_account) 0) :DE-DECISION:
In such a case, we can detect that there is a conflict after the first
two decisions because (str.substr "deletecertificate" 0 8) is
deletece which is different from describe. The equality engine uses
the rewriter to evaluate interpreted kinds with constant arguments.
This technique leads to a significant speedup on some of the newer
Amazon benchmarks.
Gereon Kremer [Wed, 5 Aug 2020 02:32:10 +0000 (04:32 +0200)]
Add dummy returns if libpoly is unavailable. (#4845)
This PR adds dummy return statements do CadSolver in case libpoly is not available.
Andrew Reynolds [Tue, 4 Aug 2020 23:27:27 +0000 (18:27 -0500)]
Fixes for getInterpolant and getAbduct API methods (#4846)
This fixes three issues in the getInterpolant method in the API, which was also copied to the getAbduct method:
(1) Use Node not Expr
(2) Must set up ExprManager scope
(3) The wrong solver pointer was passed to the returned term, which was causing segfaults on all abduction regressions.
We should also consider changing the interface of this method to return the term instead of a Boolean. This could be done as future work.
This fixes regress1.
Mathias Preiner [Tue, 4 Aug 2020 21:03:36 +0000 (14:03 -0700)]
Add documentation and build instructions for recompilation (LGPL). (#4844)
Abdalrhman Mohamed [Tue, 4 Aug 2020 20:23:54 +0000 (15:23 -0500)]
Modify the smt2 parser to use the Sygus grammar. (#4829)
Andrew Reynolds [Tue, 4 Aug 2020 19:01:47 +0000 (14:01 -0500)]
Add API interface for specialized constructor term (#4817)
This is an interface to get the instantiated parametric datatype constructor operator to apply when the type of this operator cannot be inferred without a cast.
This is required for eliminating the Expr-level datatype and calls to ExprManager from the parsers.
Gereon Kremer [Tue, 4 Aug 2020 11:32:21 +0000 (13:32 +0200)]
Properly initialize d_fullyInited. (#4840)
Fixed #4839.
The Boolean flag d_fullyInited is not properly initialized and is thus flagged by --ubsan.
Gereon Kremer [Tue, 4 Aug 2020 10:57:34 +0000 (12:57 +0200)]
Add CAD-based solver (#4834)
Based on #4774, this PR adds a new CadSolver class that allows the NonlinearExtension to actually employ the CAD-based method. In more detail:
add --nl-cad option
add CadSolver class that wraps cad::CDCAC with support for checks, model construction and conflict generation
add new Inference types for the NlLemma class
use CadSolver in NonlinearExtension (if --nl-cad is given)
Andres Noetzli [Mon, 3 Aug 2020 23:26:42 +0000 (16:26 -0700)]
Update documentation for Solver::mkVar() (#4833)
The documentation of `Solver::mkVar()` was not very clear regarding what
it could be used for. This lead to some confusion (see e.g. #4828).
This commit makes the documentation more explicit.
Ying Sheng [Mon, 3 Aug 2020 23:26:08 +0000 (16:26 -0700)]
Add implementation for SyGuS interpolation module (step4) (#4811)
This is the 4th step of adding interface for SyGuS Interpolation module. The whole change will be adding the API for (get-interpol s B), which is aim for computes an I that A->I and I->B. Here A is the assertions in the stack.
The 4th step finished the implementation of the interpolation module.
yoni206 [Mon, 3 Aug 2020 22:28:29 +0000 (15:28 -0700)]
New BV rewrite rules aimed at bv_to_int preprocessing pass (#4769)
This PR adds new rewrite rules for BV.
None of them is meant to be used by the default BV rewriter.
However, they are planned to be used in bv_to_int preprocessing pass.
In the pass we use FixpointRewriteStrategy to call various rewrite rules.
After consulting @4tXJ7f , we thought that the best way to include more rewrite rules in that call is to implement them using the existing BV rewrites infrastructure.
Andrew Reynolds [Mon, 3 Aug 2020 22:05:35 +0000 (17:05 -0500)]
Generalize interface for candidate rewrite database (#4797)
This class will be used as a utility in a new algorithm for solution reconstruction and requires a generalized interface.
FYI @abdoo8080
Andrew Reynolds [Mon, 3 Aug 2020 21:35:19 +0000 (16:35 -0500)]
Update datatypes in cvc parser to the new API (#4826)
This is leftover from the parser conversion. This is towards eliminating all remaining Expr-level calls in the parser.
Notice that 2 parser-level checks for records are eliminated in this PR, since we do not export record objects in the new API.
yoni206 [Mon, 3 Aug 2020 21:02:35 +0000 (14:02 -0700)]
Examples for using sygus python api (#4822)
This PR adds examples for using the sygus python api.
The examples are obtained from the examples of the cpp sygus api.
makaimann [Mon, 3 Aug 2020 20:39:44 +0000 (13:39 -0700)]
Delete solver pointer in Cython __dealloc__ (#4799)
Andrew Reynolds [Mon, 3 Aug 2020 18:42:17 +0000 (13:42 -0500)]
Split expression names from SmtEngine (#4832)
Towards splitting SmtEngine / deleting SmtEnginePrivate.
Andrew Reynolds [Mon, 3 Aug 2020 14:40:52 +0000 (09:40 -0500)]
Split dump manager from SmtEngine (#4824)
Towards splitting SmtEngine.
This moves utilities related to managing information for dumping to its own utility, DumpManager.
Its current responsibilities are to track information about how to print a model, and the implementation of some dumping traces, although its responsibilities should be extended further so that SmtEngine is not responsible for any command dumping. This is future work.
Andrew Reynolds [Sun, 2 Aug 2020 13:50:57 +0000 (08:50 -0500)]
Updates to dtype constructor in preparation for eliminating Expr-level datatype (#4825)
Andres Noetzli [Sun, 2 Aug 2020 12:57:24 +0000 (05:57 -0700)]
Fix ASan failure in interactive_shell_black (#4827)
This commit fixes an issue reported by ASan for unit test
interactive_shell_black. The unit test was failing because nodes were
created in the wrong node manager. The issue was likely introduced with
e8bbee7.
Andres Noetzli [Sun, 2 Aug 2020 06:56:27 +0000 (23:56 -0700)]
Ensure strict length constraint for decompose rule (#4821)
Fixes #4820. The performance issue was caused by
0988217562006d3f59e01dc261f39121df6d75f5. That commit introduced an
option (`--strings-len-conc`) that optionally moves the length
constraint for skolems to the conclusion of an inference instead of
making it part of the term registration. However, for
`DEQ_DISL_STRINGS_SPLIT`, we were only asserting that `LENGTH_GEQ_ONE`
in the case where this option was not enabled, instead of asserting that
the length of the skolem is equal to the component on the other side of
the disequality. This lead to an infinite loop of inferences because we
effectively were just splitting a component into two skolems and the
only restriction was that the first one was non-empty. We guessed the
second skolem to be empty, so the first skolem was equal to the
component, the skolem was marked congruent, and we ended up with the
same normal form as before.
The commit fixes the issue by adding an argument to
`getDecomposeConclusion()` that specifies whether to add the length
constraint or not. This option is used to always add the length
constraint in the case of `DEQ_DISL_STRINGS_SPLIT`.
Andrew Reynolds [Sun, 2 Aug 2020 03:27:08 +0000 (22:27 -0500)]
Add methods for constructing datatype types from NodeManager (#4823)
This is work towards eliminating the Expr-level datatype.
This PR implements the required methods for constructing datatype types from NodeManager.
In particular, this PR copies the "mkMutualDatatypeTypes" methods and converts them to Node-level.
The next PRs will be in preparation for using these methods instead of the Expr-level ones.
It also adds a flag d_isRecord to DType, which is required for supporting record printing in the cvc printer, which will be updated in another PR.
It also eliminates an interface for constructing constructor types via Expr-level DatatypeConstructor objects, which was unused.
Andrew V. Jones [Sat, 1 Aug 2020 07:34:37 +0000 (08:34 +0100)]
Ensure that we only find '.a's when building statically (#4785)
## Issue
When trying to building statically, and if your machine *does not* have static libraries (e.g., there is [no static GMP on CentOS 8](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/considerations_in_adopting_rhel_8/index#removed-packages_changes-to-packages)), then CVC4's CMake does not detect this:
```
FAILED: bin/cvc4
: && /usr/bin/c++ -O3 -Wall -Wno-deprecated -Wsuggest-override -Wnon-virtual-dtor -Wimplicit-fallthrough -Wshadow -Wno-class-memaccess -fuse-ld=gold -static src/main/CMakeFiles/main.dir/command_executor.cpp.o src/main/CMakeFiles/main.dir/interactive_shell.cpp.o src/main/CMakeFiles/main.dir/signal_handlers.cpp.o src/main/CMakeFiles/main.dir/time_limit.cpp.o src/main/CMakeFiles/cvc4-bin.dir/driver_unified.cpp.o src/main/CMakeFiles/cvc4-bin.dir/main.cpp.o -o bin/cvc4 src/libcvc4.a src/parser/libcvc4parser.a src/libcvc4.a -Wl,-Bdynamic /usr/lib64/libgmp.so -Wl,-Bstatic ../deps/install/lib/libantlr3c.a && :
/usr/bin/ld.gold: error: cannot mix -static with dynamic object /usr/lib64/libgmp.so
```
## Resolution
This PR changes CVC4's CMakeLists such that, if you're building statically, it *only* allows for linking against `.a`s (or `.a`s + `.lib`s on Windows).
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
Andrew Reynolds [Sat, 1 Aug 2020 07:20:24 +0000 (02:20 -0500)]
Fix component contains for splicing due to substring. (#4705)
Fixes #4701. That benchmark now times out.
yoni206 [Sat, 1 Aug 2020 06:50:40 +0000 (23:50 -0700)]
Add SyGuS Python API (#4812)
This commit extends the Python API with support for SyGuS functionality.
This required the addition of a nullary constructor for `Grammar` in the C++ API.
A unit test is also included, and is a translation of the corresponding C++ API unit test.
Examples are not added yet, but are ready and planned for a next PR (in order to keep this one shorter).
Andrew Reynolds [Fri, 31 Jul 2020 12:19:35 +0000 (07:19 -0500)]
Split listener classes from SmtEngine (#4816)
This moves listener classes owned by SmtEngine to their own file.
The SmtEnginePrivate class previously what itself a NodeManagerListener. This class will be deleted. Instead a new NodeManagerListener is introduced here whose sole responsibility is to do the work required for node manager listening.
Note I had to add a (temporary) friend relationship to SmtEngine, which will be removed in an upcoming PR to split the management of dumping to its own utility.
Andrew Reynolds [Fri, 31 Jul 2020 00:35:22 +0000 (19:35 -0500)]
Standardize explanations in arrays (#4804)
Some internal inferences had a non-standard way of providing (disjunctive) reasons and a custom way of explaining them.
This PR simplifies the array solver so that its explanations are analogous to the other equality engine based theory solvers (strings, datatypes, sets, ...). This is done in preparation for the incorporation of the proof equality engine in arrays, which follows a standard design for reasons/explanations.
The performance impact on QF arrays is negligible
Andres Noetzli [Thu, 30 Jul 2020 23:56:33 +0000 (16:56 -0700)]
Python API: Add support for sequences (#4757)
Commit
9678f58a7fedab4fc061761c58382f4023686108 added front end support
for sequences. This commit extends that support to the Python API. It
also adds simple C++ and Python examples that demonstrate how the API
works for sequences.
Gereon Kremer [Thu, 30 Jul 2020 21:59:40 +0000 (23:59 +0200)]
Cad implementation (#4774)
This commit implements the CAD interface added in #4773.
Gereon Kremer [Thu, 30 Jul 2020 16:16:25 +0000 (18:16 +0200)]
Adds the interface for the CAD-based arithmetic solver. (#4773)
This PR adds some utilities and, most importantly, the interface of the new
CAD-based solver.
The approach is based on https://arxiv.org/pdf/2003.05633.pdf and the code
structure follows the paper rather closely.
Andrew V. Jones [Thu, 30 Jul 2020 15:51:42 +0000 (16:51 +0100)]
When linking Editline, use 'pkg-config' to correctly find the link-time dependencies (#4809)
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
Andrew Reynolds [Thu, 30 Jul 2020 14:54:57 +0000 (09:54 -0500)]
Fix null case for sygus printing (#4793)
Avoids crashing on some of our debug traces.
Andrew Reynolds [Thu, 30 Jul 2020 14:18:06 +0000 (09:18 -0500)]
(proof-new) Stream output for ProofNode (#4789)
Andrew Reynolds [Thu, 30 Jul 2020 01:15:44 +0000 (20:15 -0500)]
(proof-new) Fixes for getFreeAssumptions (#4802)
Free assumptions weren't getting cleaned up due to not doing a postorder traversal. This issue came up when doing subproof sharing involving SCOPE proofs.
Ying Sheng [Tue, 28 Jul 2020 22:35:06 +0000 (15:35 -0700)]
fixing issue #4808. (#4810)
fixing issue #4808. Remove structural binding, which only supported by c++17.
Andrew Reynolds [Tue, 28 Jul 2020 21:02:41 +0000 (16:02 -0500)]
Remove arrays lazy rintro option (#4806)
This option has model soundness issues (#4771) and moreover is overall worse performance on SMT-LIB {QF_ABV QF_ABVFP QF_ABVFPLRA QF_ALIA QF_ANIA QF_AUFBV QF_AUFLIA QF_AUFNIA QF_AX}:
Configuration #unsat time #sat time #solved #total
CVC4-072720_def 9428 9405.46 24932 16631.6 34360 35399
CVC4-072720_nalr1 9446 9536.41 24924 16146.3 34370 35399
where def = default, nalr1 = --no-arrays-lazy-rintro1.
Fixes #4771.
FYI @barrettcw
Andres Noetzli [Tue, 28 Jul 2020 18:59:28 +0000 (11:59 -0700)]
Replace Expr with Node in Term/Op (#4781)
This commit changes Term and Op to use Nodes internally instead of
Exprs. This is a step towards removing the Expr-layer. This commit also
adds some missing checks regarding the number of arguments for a given
kind that were previously missing, which caused issues in unit tests when
using Node instead of Expr.
Andrew Reynolds [Tue, 28 Jul 2020 18:25:40 +0000 (13:25 -0500)]
Fix regular expression delta for complement (#4765)
Fixes #4759 .
Also refactors this method.
yoni206 [Tue, 28 Jul 2020 17:44:55 +0000 (10:44 -0700)]
Supporting seq.nth (#4723)
This PR adds support for seq.nth operator by eliminating it during expandDefinitions, based on sub-sequences.
Tests that use this operator are also included.
Ying Sheng [Tue, 28 Jul 2020 16:55:52 +0000 (09:55 -0700)]
Interpolation: Add interface for SyGuS interpolation module (step3) (#4726)
This is the 3rd step of adding interface for SyGuS Interpolation module. The whole change will be adding the API for (get-interpol s B), which is aim for computes an I that A->I and I->B. Here A is the assertions in the stack.
The 3rd step partially implemented the interpolation module.
Andrew Reynolds [Tue, 28 Jul 2020 16:03:33 +0000 (11:03 -0500)]
Use lemma property enum for OutputChannel::lemma (#4755)
There are 3 Boolean flags for OutputChannel::lemma, and plans to add another for relevance.
This makes them into a enum.
Andrew Reynolds [Mon, 27 Jul 2020 20:33:12 +0000 (15:33 -0500)]
(proof-new) Proof production for term formula removal (#4687)
This adds proof support in the term formula removal pass.
It also refactors this class heavily so that its interface is more intuitive and does not depend on AssertionPipeline.
Andrew Reynolds [Mon, 27 Jul 2020 19:44:49 +0000 (14:44 -0500)]
(proof-new) Arithmetic operator elim proof producing (#4783)
This updates the interface for arithmetic operator elimination for the new proof format.
The actual proof production of the operator elimination class (providing proofs for
introduced witness terms) will be done in a separate PR.
This also changes the witness terms introduced by this class so their body is in
Skolem form, which simplifies term formula removal.
Co-authored-by: Alex Ozdemir <aozdemir@hmc.edu>
Alex Ozdemir [Mon, 27 Jul 2020 17:20:07 +0000 (10:20 -0700)]
Consider negation's proof before triggering arith pfs. (#4776)
The current arith proof machinery can prove conflicts which are
explained by assumptions and tightened assumptions.
Previously we verified that the conflict constraint was explained in
terms of assumptions and tightened assumptions, before trying to
save/produce a proof.
We did not verify that the negated constraint was an assumption or
tightened assumption.
This caused us to attempt to prove conflicts around constraints whose
negations where proven by general means (in the case of #4714, by the
equality engine), which the proof machinery was not prepared to handle.
This PR also checks that the negate constraint is an assumption or
tightened assumption, before saving the proof.
Thanks, Gereon, for doing the initial investigation into this!
fixes 4714
Co-authored-by: Gereon Kremer <nafur42@gmail.com>
Aina Niemetz [Tue, 21 Jul 2020 17:50:54 +0000 (10:50 -0700)]
GH Actions: Cancel builds on push, remove redundant mac OS build. (#4779)
Andrew Reynolds [Tue, 21 Jul 2020 16:15:39 +0000 (11:15 -0500)]
Support uninterpreted constants in the evaluator (#4777)
Gereon Kremer [Tue, 21 Jul 2020 13:28:38 +0000 (15:28 +0200)]
Preparations for a CAD-based arithmetic solver (#4762)
Based on #4679, this PR contains further preparations for a CAD-based arithmetic solver that extends the current NonlinearExtension.
In detail, it provides:
a Constraints class that manages all (polynomial) constraints visible to the cad solver,
a collection of methods used for cad projections,
a VariableOrdering class that provides different variable ordering heuristics tailored to cad,
an extension to the NlModel class, allowing for witness terms,
further conversion methods, in particular between Node and poly::Polynomial, poly::Value and RealAlgebraicNumber.
Alex Ozdemir [Mon, 20 Jul 2020 20:21:06 +0000 (13:21 -0700)]
Fix a deadlock in the signature tests. (#4772)
* wait() deadlocks if the OS pipe fills
* communicate() does not
This is essentially a duplicate of [this](https://github.com/CVC4/LFSC/pull/38).
Haniel Barbosa [Sat, 18 Jul 2020 05:20:19 +0000 (02:20 -0300)]
Improving equality engine tracing (#4770)
To keep track of the reasoning in the equality engine for n-ary kinds, for which partial applications amount to valid fully-applied terms, it's imperative to be able to see the IDs of the internal representation of the equality engine nodes. This commit updates tracing messages to print these IDs. It also improves the tracing for explanation generation.
Andrew Reynolds [Sat, 18 Jul 2020 04:16:18 +0000 (23:16 -0500)]
(proof-new) Proof recording for assertions pipeline (#4766)
Adds explicit steps to preprocess proof generator if one is provided.
Andrew Reynolds [Sat, 18 Jul 2020 02:24:22 +0000 (21:24 -0500)]
Enumerate shapes feature in fast sygus enumerator (#4742)
This adds the feature of enumerating shapes in the fast sygus enumerator, which is required for a new algorithm for sygus solution reconstruction.
This also adds a builtinToSygus backwards mapping that is required for that algorithm as well.
Note this also changes the implementation of mkFreeVar in sygus term database from skolem to bound variable, which is required to do proper caching for expr::hasBoundVar.
Andres Noetzli [Fri, 17 Jul 2020 22:25:54 +0000 (15:25 -0700)]
Add NodeManagerScopes to fix use-after-free issues (#4768)
This commit fixes our current ASan issues. Some methods in `NodeManager`
were not creating a `NodeManagerScope` for `this` but were indirectly
calling methods that get the `NodeManager` from the current scope, so we
ended up calling methods on a `NodeManager` that had already been
destroyed.
Andrew Reynolds [Fri, 17 Jul 2020 18:38:50 +0000 (13:38 -0500)]
Replace options listener infrastructure (#4764)
This replaces the old options listener infrastructure with the OptionsManager introduced in
cb8d041.
It eliminates a "beforeSearchListener", which was a custom way of some options throwing a modal exception if they were set after initialization. Now all options are consistent: no option can be set after initialization.
It also moves managed ostream objects to the OptionsManager.
@mpreiner The next step will be to remove the "notifies" field from the Options build system and then proceed with cleaning src/options/.
Andrew V. Jones [Fri, 17 Jul 2020 17:09:14 +0000 (18:09 +0100)]
Support for using 'libedit' over 'readline' #4571 (#4579)
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
Andrew Reynolds [Fri, 17 Jul 2020 14:40:56 +0000 (09:40 -0500)]
(proof-new) Updates to strings core solver (#4642)
This updates the core strings solver in preparation for proofs.
The main changes include:
The addition of the strings PfRule enum values.
The definition of a "getConclusion" static method, used by the core solver, and to be used in the future by the strings proof checker. This includes several optional forms of lemmas, which are added as options in this PR.
Major simplifications to our inference schemas for disequality handling (a STRING_DECOMPOSE inference rule). Note this is the only significant intended behavioral change in this PR.
Minor updates to the form of inferences send to inference manager, for instance to orient equalities in the expected way, and to reorder assumptions. These changes are done for uniformity and make the strings proof reconstruction from inference steps easier.
Andrew Reynolds [Fri, 17 Jul 2020 12:35:14 +0000 (07:35 -0500)]
Add option manager and simpler option listener (#4745)
This adds the "OptionManager" class, which will live in SmtEngine. This is the required infrastructure for implementing all "reactive" options, i.e. those that must take effect immediately.
This PR does not enable this class yet, it simply adds the definitions.
After this PR, we can connect it to SmtEngine and delete the old options listener infrastructure.
Gereon Kremer [Fri, 17 Jul 2020 07:06:31 +0000 (09:06 +0200)]
Integration of libpoly (#4679)
This commit integrates LibPoly into CVC4. It adds `contrib/get-poly`, adds it to the configure script, cmake and places where CVC4 inspects its own build configuration.
Furthermore, it adds `CVC4::RealAlgebraicNumber` (which wraps `poly::AlgebraicNumber`) including some basic unit tests and some utilities.
Haniel Barbosa [Fri, 17 Jul 2020 02:23:05 +0000 (23:23 -0300)]
Fix EqProof to ProofNode conversion (#4760)
A wrong change slipped away during the cleaning of the module. This commit fixes the conversion.
Haniel Barbosa [Thu, 16 Jul 2020 21:52:15 +0000 (18:52 -0300)]
(proof-new) Implements the conversion between EqProof and ProofNode (#4756)
Gereon Kremer [Thu, 16 Jul 2020 19:57:36 +0000 (21:57 +0200)]
Resource manager cleanup (#4732)
This PR performs some general cleanup in and around the ResourceManager class. In detail, it does
remove --hard-limit (we decided to always leave the solver in a usable state, i.e. always do a soft limit),
remove --cpu-time (we decided to always use wall-clock time for time limiting)
replace old gettimeofday-based Timer by new std::chrono-based WallClockTimer
clean up the logic around beginCall() and endCall()
Andrew Reynolds [Thu, 16 Jul 2020 19:00:59 +0000 (14:00 -0500)]
Split abstract values utility from SmtEngine (#4754)
Towards refactoring SmtEngine.
Andrew Reynolds [Thu, 16 Jul 2020 17:10:58 +0000 (12:10 -0500)]
Make ExtTheory a utility and not a member of Theory (#4753)
Previously, we assumed that ExtTheory, the module for doing context-dependent simplification, was one-to-one with Theory. This design is not necessary. This makes this class a utility, which can be used as needed. This makes e.g. the initialization of TheoryStrings much easier, since the ExtTheory object can be created first.
Gereon Kremer [Thu, 16 Jul 2020 14:33:58 +0000 (16:33 +0200)]
Remove cumulative time limits and cpu time limits (#4711)
This PR removes two things from the resource manager:
cumulative time limits
cpu time limits
Cumulative time limiting has been moved to the binary and is (as before) accessible via --tlimit. As per discussion among the devs, we no longer support time limits based on CPU time and thus everything related to that is removed as well.
Note that this includes the option --cpu-time, removes an argument from SmtEngine::setTimeLimit() and the method SmtEngine::getTimeRemaining() .
Gereon Kremer [Thu, 16 Jul 2020 04:34:14 +0000 (06:34 +0200)]
Fixes memory leak when an exception goes through runCvc4(). (Fixes #4590) (#4750)
As noted in #4590, CVC4 may leak memory if an exception is thrown that interrupts the command execution loop in runCvc4().
While not a major issue (the binary is terminated anyway in this case, this is also why we label it as feature), we should fix it nevertheless.
This commit makes sure that the current command is properly managed by using `std::unique_ptr` to handle its deletion.
Haniel Barbosa [Thu, 16 Jul 2020 00:40:01 +0000 (21:40 -0300)]
(proof-new) Adding API for converting EqProof into ProofNode (#4747)
Also puts EqProof into its own module. Next will come the implementation of the API.
Andres Noetzli [Wed, 15 Jul 2020 23:42:00 +0000 (16:42 -0700)]
Use Nodes for SmtEngine assertions (#4752)
This commit changes SmtEngine::assertFormula() to use Nodes rather
than Exprs and changes AssertionList to be Node-based. This is
work towards removing the Expr layer.
Andrew Reynolds [Wed, 15 Jul 2020 18:30:23 +0000 (13:30 -0500)]
Split abduction solver from SmtEngine (#4733)
This splits everything related to abducts into its own standalone module, AbductionSolver.
It furthermore converts some of the interfaces of SmtEngine to make them take Node instead of Expr (this will be done for every method eventually).
The code for interpolation should follow a similar pattern, e.g. InterpolantSolver.
Andres Noetzli [Wed, 15 Jul 2020 15:27:13 +0000 (08:27 -0700)]
Use TypeNode in UninterpretedConstant (#4748)
This commit changes UninterpretedConstant to use TypeNode instead of
Type.
Gereon Kremer [Wed, 15 Jul 2020 11:15:24 +0000 (13:15 +0200)]
Add missing header (Fixes #4743) (#4749)
Thanks to Dejan for this hint (in #4743)
Andrew Reynolds [Wed, 15 Jul 2020 08:58:54 +0000 (03:58 -0500)]
Simplify entailment check interface (#4744)
The generality of this interface is unnecessary.