Andrew Reynolds [Sun, 18 Oct 2020 22:17:37 +0000 (17:17 -0500)]
(proof-new) More features for SMT proof post-processor (#5246)
This updates the SMT proof postprocessor with additional stats. It also adds the feature to handle conjunctions as substitution, e.g. a child proof concluding (and (= x t) (= y s)) is interpreted as a substitution for x, y, whereas previously we insisted they must be provided separately.
Andrew Reynolds [Sun, 18 Oct 2020 02:24:10 +0000 (21:24 -0500)]
(proof-new) Improvements for theory engine (#5292)
Avoids use of macro rules in a few places.
Andrew Reynolds [Fri, 16 Oct 2020 18:32:42 +0000 (13:32 -0500)]
Refactor SMT-level model object (#5277)
This refactors the SMT-level model object so that it is a wrapper around TheoryModel instead of a base class. This inheritance was unnecessary.
Moreover, it removes the virtual base models of the SMT-level model which were based on Expr. Now the interface is more minimal and in terms of Node only.
This PR further simplifies a few places in the code that interface with the SmtEngine with things related to models.
Andrew Reynolds [Fri, 16 Oct 2020 17:20:53 +0000 (12:20 -0500)]
Catch more cases of nested recursion in datatypes (#5285)
Fixes #5280.
Previously we were checking for nested recursive datatypes in expandDefinitions. This does not catch cases where the only terms of a malformed nested recursive datatype are variables. The proper place to check is in preRegisterTerm. The benchmark from that issue now gives an error.
yoni206 [Fri, 16 Oct 2020 15:04:22 +0000 (08:04 -0700)]
bv2int: caching introduced terms (#5283)
The bv-to-int preprocessing pass has a cache that maps each BV node to its translated integer node.
In case the BV node is a function symbol, it's translated integer node is a fresh function symbol.
On current master, if we later process this fresh function symbol in the preprocessing pass, we again create a fresh function symbol as its translation. This is unsound, and was discovered in #5281, whose benchmark is added to regressions.
Closes #5281 if merged.
Andrew Reynolds [Fri, 16 Oct 2020 14:17:24 +0000 (09:17 -0500)]
Add inference enumeration to datatypes (#5275)
This adds an inference enumeration for datatypes, which is analogous to what is done in strings and non-linear arithmetic. Inferences are informal identifiers that serve the purpose of (1) debugging the code, (2) providing hints on how proofs can be reconstructed.
This PR also splits the InferenceManager file in datatypes into 2.
Alex Ozdemir [Thu, 15 Oct 2020 22:27:44 +0000 (15:27 -0700)]
(proof-new) TheoryArithPrivate: farkas lemma proof (#5267)
Use a farkas proof to prove one of arithmetic's lemmas.
These changes were checked-out directly from proof-new, without modification.
mudathirmahgoub [Wed, 14 Oct 2020 23:02:27 +0000 (18:02 -0500)]
Fix issue #5269 (#5270)
This PR fixes issue #5269 of unnecessary calling TheorySetsRels::areEqual in a product relation (which compares the rightmost element of the first child with the leftmost element in the second child). This may violate an assertion in TheorySetsRels::areEqual that the types of the 2 elements should be the same
yoni206 [Wed, 14 Oct 2020 19:40:13 +0000 (12:40 -0700)]
bv2int: implementing the iand-sum mode (#5265)
There are 3 potential modes to lazily treat the iand operator:
(1) by value (typical CEGAR loop)
(2) by sum (lazily expanding each iand node into a sum of ITEs)
(3) by bit-wise equalities (lazily expanding each iand node into bit-wise equalities)
This PR implements (2).
The relevant option is added to existing tests, and a new test is added. In a few other tests, some options are removed to make them run faster.
Alex Ozdemir [Wed, 14 Oct 2020 18:37:54 +0000 (11:37 -0700)]
(proof-new) debug statements & docs for INT_TRUST (#5259)
Alex Ozdemir [Wed, 14 Oct 2020 17:17:35 +0000 (10:17 -0700)]
(proof-new) pfs in TheoryArith(Private) explainations (#5258)
Very simple, just threading the proofs through.
Andrew Reynolds [Wed, 14 Oct 2020 14:38:45 +0000 (09:38 -0500)]
Guard uses of printing approximations for constants (#5247)
Errors with these methods were encountered while working on new techniques for arithmetic preprocessing.
Also, there is obvious inefficiency since approximations for constants are being computed when certain traces are disabled.
Alex Ozdemir [Wed, 14 Oct 2020 14:00:08 +0000 (07:00 -0700)]
(proof-new) pfs for conflicts in TheoryArithPrivate (#5257)
Threads conflict proofs through TheoryArithPrivate.
Mostly just wiring things up.
yoni206 [Wed, 14 Oct 2020 06:28:36 +0000 (23:28 -0700)]
bv2int: rewritings and unsat cores (#5263)
This commit fixes several issues with bv-to-int preprocessing pass, mostly raised by @ajreynol:
1. make sure to rewrite the processed node before and after processing it
2. use the new `mkAnd` function
3. remove `--no-check-unsat-cores` from tests whenever possible
4. add new tests from #5230 . These tests now pass, and so this PR closes #5230 if merged. This also makes #5253 redundant.
5. remove an unused test
Haniel Barbosa [Wed, 14 Oct 2020 04:43:14 +0000 (01:43 -0300)]
using NOT_NOT_ELIM rather than macros to do double-neg elimination (#5261)
Alex Ozdemir [Wed, 14 Oct 2020 04:15:25 +0000 (21:15 -0700)]
(proof-new) Prove lemmas in Constraint (#5254)
Includes:
T/F splitting lemmas for any arith constraint
Unate lemmas produced early on
The hard part is proving the unate lemmas. In general, they are all implied by 2-constraint farkas proofs, so we ultimately map them all down to proveOr, which constructs that proof.
make check was happy with this change. Hopefully the CI agrees :).
Andrew Reynolds [Wed, 14 Oct 2020 03:23:38 +0000 (22:23 -0500)]
(proof-new) Generalize preprocess proof generator (#5245)
This class is of general use, not just as the overall maintainer of proofs of preprocessing, but also locally within preprocessing passes. This generalizes the interface slightly and also does some minor cleaning.
Andrew Reynolds [Wed, 14 Oct 2020 00:50:19 +0000 (19:50 -0500)]
(proof-new) Simplifications for proof rule checker interface (#5244)
Some of the interfaces in the proof rule checker are unnecessary now and can be deleted.
This also updates STRING_TRUST to have pedantic level 2.
Andrew Reynolds [Wed, 14 Oct 2020 00:10:19 +0000 (19:10 -0500)]
(proof-new) Miscellaneous minor improvements and fixes to proofs in theory files. (#5241)
Andrew Reynolds [Tue, 13 Oct 2020 23:33:57 +0000 (18:33 -0500)]
(proof-new) New rules for Booleans (#5243)
This adds 2 new rules for convenience to the Boolean checker.
Andrew Reynolds [Tue, 13 Oct 2020 22:18:02 +0000 (17:18 -0500)]
(proof-new) Change merge policy for proof node updater (#5242)
This updates the proof node updater with a mergeSubproofs field which automatically merges subproofs in the same SCOPE that prove the same thing. This is currently enabled by default, it is now configurable and disabled by default.
yoni206 [Tue, 13 Oct 2020 17:25:25 +0000 (10:25 -0700)]
bv2int: improving bvand tables (#5235)
The bv-to-int preprocessing pass introduces large ite terms that correspond to truth tables of bvand for various bit-widths.
Previously there were two inefficiencies in those tables:
They weren't being cached
The ite was not optimized
This PR adds a cache for the tables that induce the ite terms.
In addition, it computes smaller ite terms by computing the most common value of each table and using it as the default value of the ite.
Andrew Reynolds [Mon, 12 Oct 2020 22:56:32 +0000 (17:56 -0500)]
Remove uf-ss-totality option (#5251)
This option has a number of subtle bugs, it should be reimplemented if/when finite-model-find is refactored. It is not high priority enough to maintain.
This does some additional cleaning of the uf cardinality extension, some methods changed indentation.
Fixes #5239, fixes #4872, fixes #4865.
Andrew Reynolds [Mon, 12 Oct 2020 16:14:08 +0000 (11:14 -0500)]
Eliminate uses of Expr in SmtEngine interface (#5240)
This eliminates all use of Expr in the SmtEngine except in a few interfaces (setUserAttribute, getAssignment) whose signature is currently in question.
The next steps will be to (1) eliminate Expr from the smt/model.h interface, (2) replace Type by TypeNode in Sort.
Andrew Reynolds [Mon, 12 Oct 2020 13:33:32 +0000 (08:33 -0500)]
Ensure uninterpreted sort owner is UF if uf-ho or finite-model-find is enabled. (#5248)
This ensures that arrays is not the owner of uninterpreted sorts if uf-ho or finite-model-find are enabled. In these cases, the UF solver implements special techniques (cardinality, ho reasoning) that should take priority.
Fixes #5233.
Mathias Preiner [Sun, 11 Oct 2020 18:10:16 +0000 (11:10 -0700)]
SyGuS instantiation modes (#5228)
This PR adds three instantiation modes to the SyGuS instantiation module.
Gereon Kremer [Sun, 11 Oct 2020 16:22:51 +0000 (18:22 +0200)]
Add conversion of poly polynomial to cvc node. (#5218)
This PR adds a new utility function to convert a poly::Polynomial back to a cvc4 Node.
Abdalrhman Mohamed [Sat, 10 Oct 2020 13:25:24 +0000 (08:25 -0500)]
Provide API version of some SMT Commands. (#5222)
This PR provides an SMT version of the following SMT commands:
get-instantiations
block-model
block-model-values
get-qe
get-qe-disjunct
command.cpp now calls those functions instead of their SmtEngine counterparts. In addition, SEXPR is now an API kind.
yoni206 [Sat, 10 Oct 2020 01:40:52 +0000 (18:40 -0700)]
bv2int: bvand translation code move (#5227)
This PR is essentially a code move.
It moves the code that translates bvand from the bv_to_int preprocessing pass to a new class IAndHelper, in the new files nl_iand_utils.{h,cpp}. The goal is to have this code in a place which can be shared between the bv2int preprocessing pass and the iand solver.
Future PRs will:
Optimize this utility
Make use of it in the iand solver
The code in nl_iand_utils.{h,cpp} is almost completely a move from bv_to_int.{h,cpp}. The changes are all minor, and include, e.g., the following changes:
the node manager is no longer a member, and so is the constant 0.
using the oneBitAnd function directly, without a function pointer.
Mathias Preiner [Fri, 9 Oct 2020 18:42:25 +0000 (11:42 -0700)]
Remove deprecated add-path commands and use $GITHUB_PATH instead. (#5232)
Alex Ozdemir [Fri, 9 Oct 2020 17:48:16 +0000 (10:48 -0700)]
use right arith explanation fn to fix regressions (#5231)
Use the Node-returning variants of
Constraint::externalExplainByAssertions in TheoryArithPrivate locations
that aren't computing proofs.
The problem is that the TrustNode returning variant requires that arith
has stored an externally valid literal for the constraint, which is not
always the case.
This is what we did on proof-new, I just forgot.
Alex Ozdemir [Fri, 9 Oct 2020 12:55:14 +0000 (05:55 -0700)]
(proof-new) proofs for arith-constraint explanations (#5224)
Threads proofs through arith::Constraint's machinery for explaining
constraints. Changes, by function:
externalExplainByAssertions:
introduce scope to prove the implication
externalExplainForPropagation:
introduce scope to prove the implication
externalExplainConflict:
use other machinery to prove conflicting constraints
use the CONTRA rule
introduce scope to close the conflict proof
Future commits will pick up these proofs in theory_arith_private.cpp.
Future commits will prove the "split" lemmas produced in constraint.cpp
Andres Noetzli [Fri, 9 Oct 2020 05:28:42 +0000 (22:28 -0700)]
reset-assertions: Remove all non-global symbols in the parser (#5229)
Fixes #5163. When `:global-declarations` is disabled (the default), then
`(reset-assertions)` should remove all declared and defined symbols. Before
this commit, we would remove the defined function from `SmtEngine` but the
parser would not remove it from its symbol table because the symbol was defined
at (what it considered) level 0. Level 0, however, is reserved for global
symbols that we never want to remove.
This commit adds an additional global `pushScope()`/`popScope()`, similar to
what we have in `SmtEngine`. As a result, user-defined symbols are now defined
at level 1 and get removed from the `SymbolTable` when `(reset-assertions)` is
called. The commit also makes sure that symbols defined by the logic are
asserted at level 0, so that they are not removed by `(reset-assertions)`. It
adds a flag to `defineType` to ignore duplicate definitions because some
symbols are defined by multiple logics, which leads to a failing assertion when
inserting them both at level 0 in the hashmap of the `SymbolTable`. E.g.
strings and integer arithmetic both define `Int`. The commit also fixes
existing unit tests that fail with these stricter semantics of
`(reset-assertions)`.
Signed-off-by: Andres Noetzli <noetzli@amazon.com>
Andrew Reynolds [Fri, 9 Oct 2020 01:07:41 +0000 (20:07 -0500)]
Simplify approach for collapsed selectors over non-closed enumerable types (#5223)
This simplifies the approach for wrongly-applied selectors whose range type involves e.g. uninterpreted sorts. These cases are particularly tricky since uninterpreted constants should never appear in facts or lemmas.
Previously, the rewriter had special cases for either making a ground term or value, and a purify step was used to eliminate the occurrences of uninterpreted sorts afterwards.
This PR leverages mkGroundTerm in this inference instead, and makes the rewriter uniformly use mkGroundValue.
This also required making the type enumerator for datatypes more uniform. In particular, we require that the first value enumerated by the type enumerator is of the same shape as the term required by mkGroundTerm, or else debug-check-model will fail. This is due to the fact that now the inference for wrongly applied selectors uses terms while the rewriter uses values. The type enumerator is updated so that recursive codatatypes also first take mkGroundValue as the zero term, when they are well-founded. Previously this was skipped since the codatatype enumerator uses a different algorithm for computing its ground terms.
This is in preparation for further work on optimizations and proofs for datatypes.
Andrew Reynolds [Fri, 9 Oct 2020 00:34:12 +0000 (19:34 -0500)]
(proof-new) Add lazy proof set utility (#5221)
This is a common pattern that is required in several places in preprocessing.
Andrew Reynolds [Fri, 9 Oct 2020 00:07:52 +0000 (19:07 -0500)]
(proof-new) Theory engine proof producing (#5195)
This completes proof support in TheoryEngine.
The main addition in this PR is to make its getExplanation method proof producing.
Andrew Reynolds [Thu, 8 Oct 2020 22:10:36 +0000 (17:10 -0500)]
(proof-new) Fixes and improvements for smt proof postprocessor (#5197)
This includes several subtle issues encountered in the past month based on our regressions.
It also improves the expansion forms of MACRO_ rules to use EQ_RESOLVE instead of a TRUE_INTRO/TRUE_ELIM scheme. This is both more compact and avoids cyclic proofs for some corner cases of proofs with Boolean constant equalites.
makaimann [Thu, 8 Oct 2020 16:35:56 +0000 (09:35 -0700)]
Get correct NodeManagerScope for toStrings in API (#5216)
Gets the correct `NodeManagerScope` for getting the `toString` of a term, op, or sort. The following program had strange output:
```
#include "cvc4/api/cvc4cpp.h"
using namespace CVC4::api;
using namespace std;
int main()
{
Solver s;
Term x = s.mkConst(s.getIntegerSort(), "x");
cout << "x = " << x << endl;
Solver s2;
cout << "x = " << x << endl;
return 0;
}
```
It was outputting:
```
x = x
x = var_267
```
Fixing the scope makes the output `x = x` both times, as expected.
yoni206 [Thu, 8 Oct 2020 00:20:52 +0000 (17:20 -0700)]
fix unit failures on debug without symfpu (#5212)
The following tests fail (locally) when compiling with debug and without symfpu:
unit/api/sort_black (Failed)
unit/theory/logic_info_white (Failed)
unit/util/floatingpoint_black (Child aborted)
This PR conditions the relevant parts of these tests to the availability of symfpu.
Co-authored-by: Aina Niemetz <aina.niemetz@gmail.com>
Alex Ozdemir [Wed, 7 Oct 2020 18:48:06 +0000 (11:48 -0700)]
(proof-new) proofs in ee -> arith pipeline (#5215)
Threads proofs through the flow of information from the equality engine
into the theory of arithmetic.
Pretty straightforward. You just have to bundle up information from the EE.
Aina Niemetz [Wed, 7 Oct 2020 17:55:29 +0000 (10:55 -0700)]
New C++ API: Rename Term::isConst() to Term::isValue(). (#5211)
Gereon Kremer [Wed, 7 Oct 2020 14:13:41 +0000 (16:13 +0200)]
Make sure conflicts are not rewritten (in arithmetic) (#5219)
The arithmetic inference manager did rewrite conflicts, which lead to nodes from the conflict not being assumptions (but rewritten assumptions) triggering an assertion. This rewrite is now removed.
Furthermore rewrites triggering the same assertion within the icp subsolver have been refactored to avoid this issue.
Andrew Reynolds [Wed, 7 Oct 2020 12:23:53 +0000 (07:23 -0500)]
(proof-new) Add the strings proof constructor (#4903)
This is the method for converting strings InferInfo into instructions for building ProofNode. Notice that this is done as a standalone module, and thus the theory of strings uses Inferences only, not PfRule.
The next step will be to integrate this utility into InferenceManager.
Malte Mues [Wed, 7 Oct 2020 06:50:45 +0000 (08:50 +0200)]
Improve OSX support by adding os detection and adapting calls for OSX. (#5023)
On OSX there is another libtoolize tool already available.
The gnu libtoolize version installed with MacPorts or brew is called glibtoolize.
This change makes it easier to run the file on OSX.
Signed-off-by: Malte Mues (mail.mues@gmail.com)
Andrew Reynolds [Wed, 7 Oct 2020 03:22:16 +0000 (22:22 -0500)]
Process pending inferences at the beginning of datatypes post check (#5213)
This fixes a potential crash in datatypes where a pending inference is not processed on a call to Theory::check. This ensures the pending set of inferences in datatypes is empty after each check. This also ensures the pending vectors are cleared before each check in datatypes.
yoni206 [Tue, 6 Oct 2020 20:47:58 +0000 (13:47 -0700)]
bv-to-int: change order of passes (#5208)
Closes #5095 and replaces #5110.
There are two tests in #5095 that produce two different assertion failures when using bv-to-int.
The first happens because the substitution map wasn't applied after the pass.
The second happens because div (that is introduced in the pass) is not rewritten using witness.
Both problems are solved by making sure that apply-substs, theory-preprocess and ite-removal are executed after bv-to-int.
The two tests from #5095 are included as regressions.
Alex Ozdemir [Tue, 6 Oct 2020 19:15:46 +0000 (12:15 -0700)]
(proof-new) proofs for ArithCongMan -> ee facts (#5207)
Threads proof production through the ArithCongruenceManager's pipeline
of information to the equality engine.
The idea is to define a method:
ArithCongruenceManager::assertLitToEqualityEngine(literal, reason, pf)
This method asserts a literal to the equality engine with the given
proof and reason. It stores the proof of the literal for the equality
engine's future reference, and is smart about symmetric literals.
This machinery uses proofs that are not closed over the reason, as the
equality engine requires.
Other functions in the pipeline:
assertionToEqualityEngine
equalsCostant
construct proofs and call assertLitToEqualityEngine.
Future commits will address the ee -> ArithCongruenceManager pipeline,
and the relationship between ArithCongruenceManager and the rest of
arithmetic.
Andrew Reynolds [Tue, 6 Oct 2020 15:02:54 +0000 (10:02 -0500)]
(proof-new) Add interface for trusted substitution and update ppAssert (#5193)
The current work on proof-new involves proofs for preprocessing. The biggest issue currently is that our preprocessing passes do not track proofs for substitutions.
This adds a "trusted substitution" class with is a layer on substitution map. The proof aspect of this class is not yet implemented, this PR just adds its interface.
This also updates Theory::ppAssert to take a TrustSubstitutionMap instead of a SubstitutionMap, since eventually we will require proofs to be provided for substitutions that are added to this map.
Andrew Reynolds [Tue, 6 Oct 2020 14:31:16 +0000 (09:31 -0500)]
(proof-new) Allow null proofs from generators in LazyCDProof (#5196)
In some cases, a proof generator provided to a LazyCDProof may provide a null proof, which causes a segfault on proof-new currently. This PR makes LazyCDProof robust to this case; nullptr is interpreted as the fact is an assumption.
mudathirmahgoub [Tue, 6 Oct 2020 13:23:40 +0000 (08:23 -0500)]
Add operators bag.from_set, bag.to_set to the theory of bags (#5186)
Andrew Reynolds [Tue, 6 Oct 2020 12:00:22 +0000 (07:00 -0500)]
Add arithmetic preprocess module (#5188)
This class serves a similar purpose to the strings preprocess module (https://github.com/CVC4/CVC4/blob/master/src/theory/strings/theory_strings_preprocess.h).
It can potentially be used for reducing extended arithmetic operators on demand via lemmas.
This PR does not change the current behavior, but generalizes the use of operator elimination in TheoryArith to make this possible.
Abdalrhman Mohamed [Tue, 6 Oct 2020 01:11:44 +0000 (20:11 -0500)]
Recover from some exceptions. (#5203)
This PR replaces more calls to SmtEngine functions with calls to corresponding Solver functions in command.cpp. The PR also adds CVC4_API_RECOVERABLE_CHECK macro to use for recoverable exceptions.
mudathirmahgoub [Tue, 6 Oct 2020 00:49:32 +0000 (19:49 -0500)]
Remove subtyping for sets (#5205)
Removed subtyping for sets in type_node.h
Fixes #4502, fixes #4631.
Aina Niemetz [Mon, 5 Oct 2020 23:14:10 +0000 (16:14 -0700)]
cmake: Add warning when unit testing is disabled due to assertions being disabled. (#5204)
This further fixes the testing instructions for API tests (formerly known as system tests)
in INSTALL.md.
Co-authored-by: Haniel Barbosa <hanielbbarbosa@gmail.com>
Aina Niemetz [Mon, 5 Oct 2020 22:35:23 +0000 (15:35 -0700)]
SyGuS: Add fp.sub to default FP grammar. (#5206)
Aina Niemetz [Mon, 5 Oct 2020 22:03:18 +0000 (15:03 -0700)]
Integer: GMP: Move implementation of member functions to .cpp file. (#5190)
This moves the GMP implementation of member functions of class Integer from
the header to the .cpp file. This only moves code, and adds documentation for
previously undocumented or poorly documented functions.
I ran a performance check on the cluster on non-incremental QF_BV, QF_BVFP,
QF_FP, QF_LIA, QF_LIRA and QF_LRA (BV and FP logics heavily rely on class
Integer since class BitVector is implemented on top of Integer). This change has
no impact on performance.
Andrew Reynolds [Mon, 5 Oct 2020 19:30:02 +0000 (14:30 -0500)]
Make sygus more robust to unknown responses in solution verification (#5199)
This makes it so that an "unknown" response in a CEGIS verification step causes the sygus solver to exclude the current solution and mark incomplete. Previously, the sygus solver was non-terminating in such cases, trying the same solution continously.
This also removes the option "sygusVerifySubcall", as this option should always be used. It also makes --nl-ext-tplanes enabled by default when sygus is enabled.
mudathirmahgoub [Sun, 4 Oct 2020 20:10:24 +0000 (15:10 -0500)]
Remove subtyping for sets theory (#5179)
This PR removes subtyping for sets theory due to issues like #4502, #4507 and #4631.
Changes:
Add SingletonOp for singletons to specify the type of the single element in the set.
Add mkSingleton to the solver to enable the user to pass the sort of the single element.
Update smt and cvc parsers to use mkSingleton when the kind is SINGLETON
Aina Niemetz [Sat, 3 Oct 2020 20:18:45 +0000 (13:18 -0700)]
sygus-inst: Add more special BV values. (#5191)
Mathias Preiner [Sat, 3 Oct 2020 19:39:37 +0000 (12:39 -0700)]
Fix CI builds and add cancel workflow.
Andrew Reynolds [Sat, 3 Oct 2020 19:07:16 +0000 (14:07 -0500)]
Fix theory white unit test (#5194)
Andrew Reynolds [Sat, 3 Oct 2020 11:11:02 +0000 (06:11 -0500)]
Standardization of Theory (#5181)
This cleans up various interfaces of Theory now that all theories have been updated to the new standard. This includes making check non-virtual, standardizing when trigger terms are added to equality engines, and simplifications for collectModelInfo.
Andrew Reynolds [Fri, 2 Oct 2020 23:17:53 +0000 (18:17 -0500)]
Minor simplifications to substitution map class (#5180)
This class is an important utility in preprocessing, which we are adding proof support for. This simplifies the interface of this class with regards to unused interfaces for clarity.
Andrew Reynolds [Fri, 2 Oct 2020 21:15:16 +0000 (16:15 -0500)]
(proof-new) Fixes for theory preprocessing proofs (#5171)
This fixes several subtle issues with theory preprocessing.
The main fix is to ensure proofs are correct for cases where the theory preprocessor applies either with or without theory preprocessing (calling Theory::ppRewrite on subterms) enabled, see argument doTheoryPreprocess of preprocess. If disabled, it applies term formula removal and rewriting only. This is required for processing lemmas that are marked as "do not preprocess", which is an optimization, but is also necessary since theory combination may e.g. split on equality that was solved during ppRewrite. The solution is to use 2 separate term conversion sequences for these 2 cases.
It also fixes an issue where preprocessing is term-context-sensitive: terms underneath quantifiers are treated differently. This is now handled by a new TermContext callback "InQuantTermContext".
Andrew Reynolds [Fri, 2 Oct 2020 19:55:31 +0000 (14:55 -0500)]
(proof-new) Make shared solver proof producing (#5169)
This makes the shared terms database use a proof equality engine as a layer on top of its equality engine, analogous to how this done in theories.
Gereon Kremer [Fri, 2 Oct 2020 15:25:29 +0000 (17:25 +0200)]
Allow for theory combination of strings with nonlinear real arithmetic. (#5111)
This PR makes sure that enabling strings and nonlinear real arithmetic at the same time works fine.
Right now, the configuration for strings enforces linear arithmetic if no integers are enabled, in particular for NRA.
Fixed #5109.
Andrew Reynolds [Fri, 2 Oct 2020 14:06:02 +0000 (09:06 -0500)]
Decouple modules from TheoryArithPrivate (#5184)
This decouples the arithmetic rewriter, the operator eliminator and the non-linear extension from TheoryArithPrivate and performs some minor cleanup.
This is in preparation for further refactoring of (lazy) arithmetic operator elimination.
Alex Ozdemir [Fri, 2 Oct 2020 13:03:23 +0000 (06:03 -0700)]
(proof-new) New proofs in arith::Constraint::externalExplain (#5176)
This commit threads proofs through the core of arith:
Constraint::externalExplain, which recursively explain arith literals.
One of the base cases here is asking the EE for an explanation, through
the congruence manager. To delay implementing proofs in
ArithCongruenceManager to a separate commit, we stub out proof
production in ArithCongruenceManager::explain for now.
Alex Ozdemir [Fri, 2 Oct 2020 12:26:28 +0000 (05:26 -0700)]
Remove duplicate declarations in th_bv.plf (#5183)
I think this is dead code now, but still good to fix.
Aina Niemetz [Fri, 2 Oct 2020 00:29:17 +0000 (17:29 -0700)]
SyGuS: Add min/max (sub)normal constants to FP default grammar. (#5185)
Andrew Reynolds [Thu, 1 Oct 2020 22:19:08 +0000 (17:19 -0500)]
(proof-new) Make arrays proof producing (#5112)
This includes adding a basic inference manager to arrays that ensures that the correct applications of PfRule are given to the inference manager.
Note that some calls to lemma are yet to be converted. Also note that some minor simplifications were made for unnecessary parts of the code.
Mathias Preiner [Thu, 1 Oct 2020 20:48:37 +0000 (13:48 -0700)]
Add additional ground terms to SyGuS instantiation grammar (#5167)
This PR adds options to add additional ground terms to the SyGuS instantiation grammars.
Andrew Reynolds [Thu, 1 Oct 2020 19:12:08 +0000 (14:12 -0500)]
Update theory of arithmetic to standard check (#5178)
This updates the theory of arithmetic to use the standard check callbacks (preCheck, postCheck, preNotifyFact, notifyFact). It also refactors some use of the non-linear solver which will solely live in TheoryArith.
The longer term goal is to have TheoryArithPrivate be responsible for linear arithmetic solving only, and to be treated as a black box. Eventually, the non-linear solver will be removed from this class.
This PR is required for several things, including refactoring of preprocessing and expand definitions for arithmetic (div/mod will not be eliminated eagerly). It is also required for fixing issues related to div/mod appearing in instantiations.
This is the last class to have a custom check method. Followup PR will make Theory::check non-virtual.
Aina Niemetz [Thu, 1 Oct 2020 18:29:39 +0000 (11:29 -0700)]
FloatingPoint: Add utility functions for largest and smallest normal. (#5174)
Gereon Kremer [Thu, 1 Oct 2020 16:24:55 +0000 (18:24 +0200)]
Allow to use the initial assignment for CAD (#5177)
While the CAD subsolver already provided for a way to use the linear model to seed the model search, it was not actually used yet.
This PR now does use it, though it is disabled by a Boolean flag.
Andrew Reynolds [Thu, 1 Oct 2020 15:36:14 +0000 (10:36 -0500)]
(proof-new) Preprocessing passes use proper interfaces to assertions pipeline (#5164)
This PR eliminates all uses of assertions pipeline that are not proper, which two-fold:
(1) The assertion list should never be modified in a custom way (without going through replace / push_back),
(2) Places where an assertion is "conjoined" to an existing spot in the vector should use conjoin instead of replace.
This is required for proper proof generation.
This fixes CVC4/cvc4-projects#75.
Andrew Reynolds [Thu, 1 Oct 2020 13:40:06 +0000 (08:40 -0500)]
Make SygusSolver use sygus attributes directly (#5172)
Previously, the SmtEngine was using an interface through TheoryEngine to set user attributes to indicate that e.g. a synth-fun is associated with a given grammar. Since SmtEngine and its members are internal now, this can simply be done directly via attributes. This makes it so that SygusSolver does not depend on TheoryEngine nor does it require the TheoryEngine to be initialized at the time a synth-fun is created.
Mathias Preiner [Thu, 1 Oct 2020 01:17:45 +0000 (18:17 -0700)]
Add GH action to cancel previous pending/running CI builds. (#5175)
GH introduced a new workflow event pull_request_target that now makes it
possible to cancel builds on the base repository.
Aina Niemetz [Thu, 1 Oct 2020 00:26:46 +0000 (17:26 -0700)]
BitVector: Extend interface of setBit to set it to a specific value. (#5173)
Previously, BitVector::setBit only allowed to set the bit at the given
index to 1. This changes its behavior to be also able to set it to 0.
Aina Niemetz [Wed, 30 Sep 2020 21:05:29 +0000 (14:05 -0700)]
FloatingPoint: Add utility functions for largest and smallest subnormal. (#5166)
Gereon Kremer [Wed, 30 Sep 2020 17:41:36 +0000 (19:41 +0200)]
Remove too strict assertion to allow for approximate models (#5168)
This PR simply removes an assertion that would trigger whenever the arithmetic theory asserts a model that contains something else than a constant. This can be the case with witness terms.
In offline discussion we concluded that this discussion was overly strict. Note that these examples may still hit an error during model validation (Cannot run check-model on a model with approximate values.).
This PR also fixes a debug output I found during debugging.
Fixes #5113.
Gereon Kremer [Wed, 30 Sep 2020 17:26:21 +0000 (19:26 +0200)]
Add missing includes. (#5170)
The strategy class added in #5160 was missing the proper includes for std::ostream. For some reason it works for most configurations, but triggers compilation errors in certain cases.
Gereon Kremer [Wed, 30 Sep 2020 15:39:58 +0000 (17:39 +0200)]
Add strategy for nonlinear extension (#5160)
This PR adds a flexible strategy for the nonlinear extension that replaces the handwritten code in checkLastCall().
Andrew Reynolds [Wed, 30 Sep 2020 15:06:58 +0000 (10:06 -0500)]
Dynamic allocation of equality engine for shared solver (#5152)
This updates shared solver to have dynamic allocation of equality engine, analogous to theory solvers.
Andrew Reynolds [Wed, 30 Sep 2020 13:20:03 +0000 (08:20 -0500)]
(proof-new) Add the term conversion sequence generator (#5097)
This class will be used in the theory preprocessor and is planned to be used in other preprocessing passes that can be understood as sequences of rewrite systems.
Haniel Barbosa [Tue, 29 Sep 2020 19:15:06 +0000 (16:15 -0300)]
[proof-new] Adds a proof manager for prop engine (#5162)
Also fixes some weird orderings in src/CMakeLists.txt
mudathirmahgoub [Tue, 29 Sep 2020 18:48:16 +0000 (13:48 -0500)]
Fix bags headers (#5165)
Fix bags headers
Alex Ozdemir [Tue, 29 Sep 2020 16:39:11 +0000 (09:39 -0700)]
(proof-new) Add proof managers and eager gens to arith (#5159)
This commit threads ProofNodeManager, EagerProofGenerator, etc
throughout the arith theory into the appropriate locations. These
objects are currently unused, but will be used in future commits.
Crediting Andy, since he set up some of this.
Co-authored-by: Andrew Reynolds andrew.j.reynolds@gmail.com
Andrew Reynolds [Tue, 29 Sep 2020 14:57:35 +0000 (09:57 -0500)]
(proof-new) Fixes for preprocess proof generator and proofs in assertion pipeline (#5136)
This PR makes several fixes to preprocess proof generator, making it user-context dependent and making it avoid cyclic proofs. It additionally makes assertion pipeline a new interface "conjoin" which should always be used when we conjoin a new assertion to an old position in the assertion vector. It also removes an unnecessary interface to assertion pipeline.
Next PRs will clean up the use of assertions pipeline in all preprocessing passes to use the proper interfaces. This includes removing non-constant references to assertions, which has been fixed on proof-new.
Haniel Barbosa [Tue, 29 Sep 2020 13:57:37 +0000 (10:57 -0300)]
[proof-new] Adds a proof post processor for the Prop Engine (#5161)
The post processor connects the two proofs in the prop engine: the refutation proof in the SAT solver and the CNF transformation proof in the CNF stream. The proof generators from theory engine in the latter are also expanded during the connection.
Haniel Barbosa [Tue, 29 Sep 2020 13:20:02 +0000 (10:20 -0300)]
[proof-new] Updates to proof node updater (#5156)
Haniel Barbosa [Tue, 29 Sep 2020 12:35:46 +0000 (09:35 -0300)]
[proof-new] Adds a proof-producing CNF converter (#5137)
A proof generator that wraps the original CNF stream, to be used when the prop engine is proof producing. It tracks in a lazy cdproof both the concrete clausification steps and the proof generators of the formulas being clausified (in particular, theory lemmas).
Gereon Kremer [Tue, 29 Sep 2020 12:05:46 +0000 (14:05 +0200)]
Clean up nonlinear extension (#5149)
This PR performs some cleanups in the nonlinear extension, in particular it removes the old lemma collection scheme. It is no longer needed, as all subsolvers use the inference manager.
Andrew Reynolds [Tue, 29 Sep 2020 03:56:20 +0000 (22:56 -0500)]
Reset assertions on resetAssertions (#5153)
The assertions object is currently not cleared on resetAssertions, only the prop engine is reset. This means that if a user added assertion, did not use them in a check-sat, and then called reset-assertions, they would not be removed from the assertions pipeline (storing the pending assertions before they are sent to the prop engine).
This fixes #5144.
Alex Ozdemir [Tue, 29 Sep 2020 03:14:47 +0000 (20:14 -0700)]
Add utilities for arith/proof_checker and build it (#5157)
The arith proof checker was not being built (not in cmake). Now it is. A
few dependencies were missing.
Haniel Barbosa [Tue, 29 Sep 2020 02:34:34 +0000 (23:34 -0300)]
[proof-new] Removing spurious forward declaration in CnfStream (#5155)
Haniel Barbosa [Tue, 29 Sep 2020 01:22:29 +0000 (22:22 -0300)]
[proof-new] Adds a proof node hash function (#5154)
Andrew Reynolds [Tue, 29 Sep 2020 00:54:25 +0000 (19:54 -0500)]
Disable regression that is timing out (#5142)
Seems to be timing out on 1/5 of our CI runs currently.
Andrew Reynolds [Mon, 28 Sep 2020 23:33:03 +0000 (18:33 -0500)]
Minor fixes to quantifiers proofs (#5151)
Includes minor changes to the proof checker and a fix in the instantiate module.
Haniel Barbosa [Mon, 28 Sep 2020 20:38:59 +0000 (17:38 -0300)]
[proof-new] Adds a proof manager for the SAT solver (#5140)
Tracks the refutation proof built by Minisat. See the header for extensive explanations.
This commit also adds a few dependencies for the SAT proof manager to work (making it a friend of the SAT solver, getting the cnf stream from theory proxy, having lazy cdproof chain give all the links).