summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2020-08-21Remove BV equality slicer (#4928)Andrew Reynolds
This class is not used based on our coverage tests (although it appears to be possibly enabled based on non-standard runtime checking of assertions), and uses the equality engine in a highly nonstandard way that will be a burden to the new standardization of equality engine in theory solvers. FYI @aniemetz @mpreiner
2020-08-20Add TheoryState objects to each Theory (#4920)Andrew Reynolds
This initializes all theories with a TheoryState object (apart from bool and builtin which do not require one). Two additional theories are known to require special state objects: TheoryArith, which has a custom way of detecting when in conflict, and TheoryQuantifiers, which can leverage a special state object for the purposes of refactoring and splitting apart QuantifiersEngine further. All other theories use default TheoryState objects. Notice this PR does not update the theories to use these states yet, it simply adds the objects.
2020-08-20Split QuantElimSolver from SmtEngine (#4919)Andrew Reynolds
Towards refactoring SmtEngine / converting Expr -> Node.
2020-08-19Simplify trigger notifications in equality engine (#4921)Andrew Reynolds
This is further work towards a centralized approach for equality engines. This PR merges the eqNotifyTriggerEquality callback with the eqNotifyTriggerPredicate callback, and adds assertions that capture the current behavior. It furthermore makes addTriggerEquality private in equality engine and invoked as a special case of addTriggerPredicate. Note this PR does not impact the internal implementation of these methods in equality engine, which indeed is different. There are two reasons to merge these callbacks: (1) all theories implement exactly the same method for the two callbacks, whenever they implement both. It would be trivial to do something different (by case splitting on the kind of predicate that is being notified), and moreover it is not recommended they do anything other than immediately propagate the predicate (regardless of whether it is an equality). (2) It leads to some confusion with eqNotifyTriggerTermEquality, which is invoked when two trigger terms are merged.
2020-08-19Remove example theory (#4922)Andrew Reynolds
This code is unused and obsolete.
2020-08-19(cad solver) Add a partial check method. (#4904)Gereon Kremer
This PR extends the CAD-based solver to enable partial checks. Essentially, we only collect the first interval that is excluded for the first variable and return that one as a lemma. This does not leave a lot of choice on "how partial" the check should be, but it is fairly easy to implement and does not add additional overhead. It also fixes some confusion in excluding_interval_to_lemma...
2020-08-19Make sets and strings solver states inherit from TheoryState (#4918)Andrew Reynolds
This is towards the new standard for theory solvers. This PR makes the custom states of sets and strings inherit from the standard base class TheoryState. It also makes a minor change to InferenceManager/SolverState to make sets more in line with the plan for a standard base class InferenceManager. Followup PRs will establish the official TheoryState classes for all other theories (which in most cases will be an instance of the base class).
2020-08-19Require `--strings-exp` when using `str.substr` (#4916)Andres Noetzli
Fixes #4915. Previously, `str.substr` did not require `--strings-exp`. However, when `--strings-exp` is not active, we do not send terms to the extended solver for registration, which meant that `str.substr` was never reduced. This commit adds `str.substr` to the operators that require `--strings-exp`.
2020-08-19Changes assertion (about maximum set cardinality) to an exception. (#4907)Gereon Kremer
Changes the assertion that checks for the maximum cardinality of set models to an exception, following #4374. Also cleans up the code around it: previously, the Rational was checked against LONG_MAX, converted to std::uint32_t and then stored into an unsigned. Now we use std::uint32_t all the way. Fixes #4374.
2020-08-19Fix SmtEngine::reset() (#4917)Gereon Kremer
Calling (reset) multiple times produced parsing problems (#4866) and could probably lead to all kinds of interesting issues. In a nutshell, reset() failed to properly reset d_initialOptions (which is used to properly reset d_options) so that all options defaulted after the second call to reset(). This PR properly sets d_initialOptions after a reset (and the filename as well). Fixes #4866.
2020-08-18Refactor functions that print commands (Part 2) (#4905)Abdalrhman Mohamed
This PR is a step towards migrating commands to the Term/Sort level. It replaces the dynamic casts for printing commands with direct calls to corresponding functions. Those functions now take node level arguments instead of commands to make them available for internal code.
2020-08-18(proof-new) Theory preprocessor proof producing (#4807)Andrew Reynolds
This makes the theory preprocessor proof producing in the new infrastructure, which involves updating its interfaces to TrustNode in a few places.
2020-08-18Introduce the theory state object (#4910)Andrew Reynolds
This will be used as a standard way of querying and tracking state information in a Theory. The TheoryState object has a standard role in a number of the new standard templates for Theory:: methods. The theory state is a collection of 4 Theory members (SAT context, user context, valuation, equality engine), as well as a SAT-context dependent "conflict" flag that indicates whether we have sent a conflict in this SAT conflict. It contains (safe) versions of equality engine queries, which are highly common in many theory solvers. The next step will be to have the SolverState objects in theory of sets and strings inherit from this class.
2020-08-18Standardize collectModelInfo and theory-specific collectRelevantTerms (#4909)Andrew Reynolds
This is work towards a configurable approach to equality engine management. This PR does not change any behavior, it only reorganizes the code. This PR introduces the standard template for collectModelInfo, which isolates the usage of equality engine in relation to the model. In the future, theories will be encouraged to use the standard template for collectModelInfo and override collectRelevantTerms/collectModelValues only. This is to allow custom theory-independent modifications to building models (e.g. don't assert equality engine to model if we are using a centralized approach). This PR standardizes TheoryArrays and TheoryDatatypes custom implementation of collectRelevantTerms as work towards using the standard template for collectModelInfo. Notice this required separating two portions of a loop in TheoryArrays::collectModelInfo which was doing two different things (collecting arrays and relevant terms).
2020-08-18(proof-new) Minor updates to trust node (#4900)Andrew Reynolds
2020-08-18(proof-new) SMT proof postprocess callback (#4883)Andrew Reynolds
This is the callback class for processing the final proof, which connects proofs of preprocessing and expands unwanted macro steps based on proof granularity mode. The next step will be to add the ProofNodeUpdater that uses this callback and runs final sanity checks for checking proofs.
2020-08-18Quantifiers engine stores a pointer to the master equality engine (#4908)Andrew Reynolds
This is work towards a configurable approach to theory combination. Setting the master equality engine in QuantifiersEngine mimics setting EqualityEngine in Theory.
2020-08-18Split SygusSolver from SmtEngine (#4891)Andrew Reynolds
This is the solver for standard SyGuS queries. Notice it now depends only on SmtSolver and not SmtEngine. This PR updates Expr -> Node for the sygus interface in SmtEngine. SmtEnginePrivate is no longer needed and is deleted with this PR.
2020-08-18Add the relevance manager module (#4894)Andrew Reynolds
This PR adds the relevance manager module, which will be used in forthcoming PRs to query assignments for whether a literal is "relevant" (e.g. critical for satisfying the input formula). Leveraging this technique has led to noticeable improvements for non-linear arithmetic (https://github.com/ajreynol/CVC4/tree/relManager). This PR does not enable it, but adds the module only.
2020-08-18(proof-new) Callbacks for term-context-sensitive terms (#4842)Andrew Reynolds
Callbacks for term-context-sensitive terms. It gives two examples of such callbacks, "remove term formula (rtf) context" to be used in the remove term formulas pass and "polarity context" which is a highly common pattern in preprocessing. These utilities will be critical for maintain proofs for term-context-sensitive rewrites. An example user of these utilities is TermFormulaRemoval, which rewrites terms depending on whether they occur beneath quantifiers/terms. This utility currently has bugs in its proof generation since its proof cache does not consider the term context. This PR updates that class to use this utility. Its proof generator will be similarly extended in proof-new to synchronize its cache, relative to term context identifiers. Concretely, a TermContext callback will be passed to TConvProofGenerator, which will put together proof skeletons in a term-context-sensitive manner.
2020-08-17Dynamic allocation of equality engine in Theory (#4890)Andrew Reynolds
This commit updates Theory so that equality engines are allocated dynamically. The plan is to make this configurable based on the theory combination method. The fundamental changes include: - Add `d_equalityEngine` (raw) pointer to Theory, which is the "official" equality engine of the theory. - Standardize methods for initializing Theory. This is now made more explicit in the documentation in theory.h, and includes a method `finishInitStandalone` for users of Theory that don't have an associated TheoryEngine. - Refactor TheoryEngine::finishInit, including how Theory is initialized to incorporate the new policy. - Things related to master equality engine are now specific to EqEngineManagerDistributed and hence can be removed from TheoryEngine. This will be further refactored in forthcoming PRs. Note that the majority of changes are due to changing `d_equalityEngine.` to `d_equalityEngine->` throughout.
2020-08-17(proof-new) Prepare the theory of strings for proof reconstruction (#4885)Andrew Reynolds
This updates the internal data structure for strings inferences "InferInfo" such that it is amenable to proof reconstruction. Currently, the explanation for a conclusion is in two parts: (1) d_ant, the antecedents that can be explained by the current equality engine, (2) d_antn, the antecedents that cannot. For proof reconstruction, the order of some antecedents matters. This is difficult with the above data structure since elements in these two vectors are not given an ordering relative to each other. After this PR, we store: (1) d_ant, all antecedants, which are ordered in a way that is amenable to proofs (to be introduced on following PRs), (2) d_noExplain, the subset of d_ant that cannot be explained by the current equality engine. This PR modifies calls to InferenceManager in preparation for extending it with a proof reconstructor InferProofCons which will convert strings::InferInfo into instructions for building ProofNode.
2020-08-16Add non-emptiness to conclusion of positive RE star unfolding. (#4899)Andrew Reynolds
A recent commit (77e9881) simplified the form of the conclusion in regular expression star unfolding for the sake of uniformity in our internal proof calculus. However, this led to a noticeable drop in performance on a few specific RE benchmarks (the Norn set). This preserves the old behavior by extending the core rule for RE unfolding. It also makes one minor change to the strings proof checker carried over from the proof-new branch.
2020-08-15(cad solver) Use the current model as initial assignment (#4893)Gereon Kremer
This PR implements a first naive way to employ the linear model (obtained from the nonlinear extension) to guide the initial sampling within the cad solver.
2020-08-15Minor cleanup related to notifications (#4898)Andrew Reynolds
This includes eliminating TheoryBV's call to eqNotifyNewEqClass and fixing an issue with string's eqNotifyNewEqClass method, which was registering constant integers. It also removes some unnecessary methods in Theory.
2020-08-15Add finishInit method to PropEngine (#4895)Andrew Reynolds
This changes an initialization issue in regarding PropEngine and TheoryEngine. In the constructor for PropEngine, we convert and assert literals for true and false to CNF stream. Doing so triggers several things, including calls that preregister these literals with the associated TheoryEngine. This means that literals are preregistered to TheoryEngine before it has been fully initialized (TheoryEngine::finishInit). This is not currently an issue since this only involves modules that are constructed statically (e.g. SharedTermsDatabase), but this will lead to issues when the TheoryEngine is more configurable. The solution is to additionally have a PropEngine::finishInit, which is called after TheoryEngine::finishInit, which does this step. The PropEngine should not assert anything to CNF before this method is called.
2020-08-15(proof-new) Add the strings proof checker (#4858)Andrew Reynolds
It also adds enumeration for two new rules that have been recently added.
2020-08-14Simplify equality engine notifications (#4896)Andrew Reynolds
Previously, there was methods for being informed just before and just after equivalence classes are merged (eqNotifyPreMerge and eqNotifyPostMerge). The purpose of this was to allow e.g. the theory to inspect the equivalence classes in question before the equality engine modified them. However this is no longer used, and moreover is discouraged since Theory should generally buffer their usage of EqualityEngine while it is making internal calls. TheoryStrings was the only theory to use eqNotifyPreMerge (somewhat arbitrarily), all others used eqNotifyPostMerge. This makes post-merge the default, renames it to eqNotifyMerge and removes pre notifications. This will simplify the work of the new theory combination methods as well as leading to fewer spurious calls to callbacks in equality engine.
2020-08-14correctly parse sygus lang option (#4884)E Polgreen
--lang sygus is a synonym for --lang sygus2 also fixes typo in error message for language options parsing Signed-off-by: polgreen <epolgreen@gmail.com>
2020-08-14Inspect roots to avoid certain resultants (Algorithm 4, lines 8,9). (#4892)Gereon Kremer
This PR adds a small improvement to the CAD solver. In Algorithm 4 of https://arxiv.org/pdf/2003.05633.pdf in lines 8 and 9, we only consider polynomials for resultant computations that have roots outside of the current interval. This PR implements this check. Fixes CVC4/cvc4-projects#210.
2020-08-13Split SmtSolver from SmtEngine (#4880)Andrew Reynolds
This class is responsible for maintaining TheoryEngine and PropEngine and implementing the check-sat command. It also has an interface for processing/pushing the current assertions into the PropEngine. This class will be used directly by other extension solvers (for abduction, interpolation, qe, sygus, etc.).
2020-08-13Fixes for corner case of decision tree learning with different types (#4887)Andrew Reynolds
There was a last minute change was a typo when merging 103b5ea . Also the fix in that commit needed to be slightly more robust to the case when either branch of an ITE had a different sygus type. Fixes regress1.
2020-08-13More basic fix for dumping synth-fun (#4886)Andrew Reynolds
The commit (079a04b) appears to have broken the nightlies due to compile issues related a necessary addition to the Dump class (so that std::string could be printing on Dump streams). This changes the temporary solution so that we simply print a string on the standard output, when the Dump is enabled. This is required for temporarily keeping dump=raw-benchmark working for synth-fun commands.
2020-08-13Add the distributed equality engine manager (#4867)Andrew Reynolds
This is the first step towards making the approach for theory combination in CVC4 configurable. This PR introduces the "distributed equality engine manager", which encapsulates the current policy that TheoryEngine uses regarding equality engines: each Theory creates a separate copy of an equality engine. The eventual plan is that the official equality engine of Theory is not necessarily unique to the theory, if equality engines are shared. A variant of this class could implement that policy. This PR does not impact the code, it simply adds the definition of the class. A forthcoming PR will integrate this class into TheoryEngine, which will use dynamic allocation for equality engine objects. FYI @barrettcw
2020-08-12[proof-new] Adding support for corner case of transitivity simulating ↵Haniel Barbosa
MERGED_THROUGH_CONSTANTS (#4879)
2020-08-12generalize handling MERGED_THROUGH_CONSTANST in EqProof conversion (#4878)Haniel Barbosa
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.
2020-08-12Refactor functions that print commands (Part 1) (#4869)Abdalrhman Mohamed
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.
2020-08-12Fixes for degenerate case of sygus decision tree learning (#4800)Andrew Reynolds
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.
2020-08-12(proof-new) Improve robustness of CONG rule (#4882)Andrew Reynolds
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).
2020-08-12(proof-new) Proof support in the strings term registry. (#4876)Andrew Reynolds
Adds basic support for proofs in the strings term registry. This code is not yet active until further parts of proof-new are merged.
2020-08-12(proof-new) Improve interfaces to proof generators (#4803)Andrew Reynolds
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.
2020-08-12Add option to only build library (#4801)makaimann
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.
2020-08-12(proof-new) Witness form proof generator (#4782)Andrew Reynolds
This class is responsible for the connection between terms and their witness form in the final proof.
2020-08-12Add naive support for integer variables. (#4835)Gereon Kremer
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.
2020-08-12(proof-new) Improving proof-production in Equality Engine (#4871)Haniel Barbosa
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
2020-08-12Fix connection to master equality engine in sets (#4877)Andrew Reynolds
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.
2020-08-12Fix infinite loop in arith_ite_simp (#4805)Gereon Kremer
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.
2020-08-11Split SmtEngineState from SmtEngine (#4855)Andrew Reynolds
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).
2020-08-11Prepare theory of sets for dynamic allocation of equality engine (#4868)Andrew Reynolds
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.
2020-08-11Final preparations for changing API to use the Node-level datatype (#4863)Andrew Reynolds
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.
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback