Gereon Kremer [Tue, 8 Mar 2022 01:29:03 +0000 (02:29 +0100)]
Rerun failed tests in CI (#8258)
This commit makes our CI rerun failed tests to have the error output at the bottom of the log. This simplifies retrieving the errors from CI logs.
Gereon Kremer [Tue, 8 Mar 2022 00:49:15 +0000 (01:49 +0100)]
Don't run the pypi packaging job on forks (#8256)
Right now, the nightly pypi packaging job runs on all forks. This commit disabled this.
See https://github.community/t/do-not-run-cron-workflows-in-forks/17636
Andres Noetzli [Mon, 7 Mar 2022 22:11:55 +0000 (14:11 -0800)]
Update documentation of `Solver::getUnsatCore()` (#8239)
Fixes https://github.com/cvc5/cvc5-projects/issues/308. This commit adds
documentation for the differences between `Solver::getUnsatCore()` and
SMT-LIB's `(get-unsat-core)`.
Gereon Kremer [Mon, 7 Mar 2022 21:22:44 +0000 (22:22 +0100)]
Fix docs warnings (#8019)
This fixes a bunch of warnings when generating our sphinx documentation.
They are mostly related to incorrect indentation/spacing, line breaks where
no line breaks should be, or missing code blocks.
Note that running clang-format causes some of these issues.
Andrew Reynolds [Mon, 7 Mar 2022 20:33:52 +0000 (14:33 -0600)]
Proper error message for non-first-class sets (#8245)
Fixes cvc5/cvc5-projects#347.
Gereon Kremer [Mon, 7 Mar 2022 15:31:07 +0000 (16:31 +0100)]
Try harder to show that a RAN is rational (#8230)
We try to rewrite real algebraic numbers to rationals. This is important to, e.g., allow the linear solver to see rational constants at all. Refining real algebraic numbers is done lazily, and (almost) any operation may trigger a refinement that makes libpoly realize it actually is rational. Thus, even the mere act of creating a node out of a real algebraic number may do this (it hashes it).
This PR thus introduces a fixed-point loop into the RAN node constructor that defends against this case.
Fixes #8226.
Andres Noetzli [Sun, 6 Mar 2022 16:02:26 +0000 (08:02 -0800)]
Disallow models with `--arrays-weak-equiv` (#8217)
Fixes #2007. We currently do not support generating models when
`--arrays-weak-equiv` is enabled. This commit adds a corresponding
user-facing error message.
Andrew Reynolds [Sat, 5 Mar 2022 20:50:25 +0000 (14:50 -0600)]
Unit tests for fixed projects issues (#8229)
Fixes cvc5/cvc5-projects#421.
Fixes cvc5/cvc5-projects#361.
Andrew Reynolds [Sat, 5 Mar 2022 19:43:43 +0000 (13:43 -0600)]
Make seq.unit robust wrt subtyping (#8209)
Fixes cvc5/cvc5-projects#384.
Fixes cvc5/cvc5-projects#426.
Fixes cvc5/cvc5-projects#427.
Fixes cvc5/cvc5-projects#429.
Issue cvc5/cvc5-projects#423 still remains, to be addressed in a followup PR.
Also fixes issues with subtyping in how sequence constants are printed.
Note this solution is required since we are not ready to eliminate arithmetic subtyping in the short term. These changes will be unnecessary when this happens.
Andres Noetzli [Sat, 5 Mar 2022 18:00:42 +0000 (10:00 -0800)]
[Docs] Add missing requirement (#8238)
Our docs do not build without the `sphinx-rtd-theme` package. This
commit adds the module as an explicit requirement such that if the
module is missing, building the docs fails when configuring and with a
useful error message.
Gereon Kremer [Sat, 5 Mar 2022 01:46:57 +0000 (02:46 +0100)]
Add regressions for fixed issue (#8237)
Adds regressions for an issue that has been fixed in the meantime.
Fixes #4334
Andrew Reynolds [Sat, 5 Mar 2022 00:47:13 +0000 (18:47 -0600)]
Enable NL tangent planes by default (#8233)
Fixes cvc5/cvc5-projects#215
Fixes cvc5/cvc5-projects#291
Fixes cvc5/cvc5-projects#292
Fixes cvc5/cvc5-projects#294
Fixes cvc5/cvc5-projects#297
Previously the concern was that this would interfere with e.g. quantifiers + non-linear. However, our strategy is now fair wrt other theories as we send lemmas at LAST_CALL effort, and is properly restricted by the nl-ext mode.
Moreover, this option increases our ability to solve problems (instead of saying "unknown") significantly, even for quantified logics like UFNIA.
mudathirmahgoub [Fri, 4 Mar 2022 23:33:47 +0000 (17:33 -0600)]
Fix bag.map upwards inferences (#8232)
Gereon Kremer [Fri, 4 Mar 2022 23:09:49 +0000 (00:09 +0100)]
Add unit test for fixed issue (#8235)
This unit test exercised a non-idempotent rewrite for RANs before the rewriter was fully refactored.
Fixed cvc5/cvc5-projects#455
Gereon Kremer [Fri, 4 Mar 2022 22:31:10 +0000 (23:31 +0100)]
Remove spurious assertion in linear solver (#8231)
This PR removes a spurious assertion about how integer equality should look like. It actually requires that the coefficients of the leading terms on both sides of the equation are positive, which can't be true in general anyway. Note that the regression failed before we refactored the arithmetic rewriter.
Fixes cvc5/cvc5-projects#469
Gereon Kremer [Fri, 4 Mar 2022 21:50:32 +0000 (22:50 +0100)]
Guard recursion into terms during substitution in arithmetic utility (#8234)
This PR fixes an issue during variable elimination using equalities in the nonlinear arithmetic solver. We need to make sure that we don't apply the substitutions within terms that are not native arithmetic terms. While we already did that whenever we actually used the resulting term, we did not when we just checked for a possible loop.
Although we always invalidate the substitution cache, the apply method also poisons the actual substitution map. By protecting the calls to apply where we don't actually store the result as well, we avoid this type of "poisoning".
Fixes #8161.
Andrew Reynolds [Fri, 4 Mar 2022 19:40:30 +0000 (13:40 -0600)]
Fix rewrite rule synthesis for 0-ary operators (#8221)
Fixes cvc5/cvc5-projects#422.
Also changes the default setting for rewrite rule synthesis to check correct of rewrite rules by default.
Andrew Reynolds [Fri, 4 Mar 2022 19:12:52 +0000 (13:12 -0600)]
Logic exception when using solution filtering for non-Boolean grammars (#8225)
Fixes cvc5/cvc5-projects#464.
Gereon Kremer [Fri, 4 Mar 2022 18:19:39 +0000 (19:19 +0100)]
Only build wheels nightly and for releases (#8223)
We accidentally enabled building the python wheels with every commit. This fixes it to only build them once at night and for releases.
Andrew Reynolds [Fri, 4 Mar 2022 17:22:18 +0000 (11:22 -0600)]
Add regressions for fixed projects issues (#8228)
Fixes cvc5/cvc5-projects#119
Fixes cvc5/cvc5-projects#135
Fixes cvc5/cvc5-projects#139
Fixes cvc5/cvc5-projects#151
Fixes cvc5/cvc5-projects#155
Fixed cvc5/cvc5-projects#158
Fixes cvc5/cvc5-projects#161
Fixes cvc5/cvc5-projects#165
Fixes cvc5/cvc5-projects#177
Fixes cvc5/cvc5-projects#231
Fixes cvc5/cvc5-projects#232
Fixes cvc5/cvc5-projects#251
Fixes cvc5/cvc5-projects#253
Fixes cvc5/cvc5-projects#264
Fixes cvc5/cvc5-projects#280
Fixes cvc5/cvc5-projects#281
Fixes cvc5/cvc5-projects#282
Fixes cvc5/cvc5-projects#285
Fixes cvc5/cvc5-projects#286
Fixes cvc5/cvc5-projects#290
Fixes cvc5/cvc5-projects#295
Andrew Reynolds [Fri, 4 Mar 2022 14:37:54 +0000 (08:37 -0600)]
Add support for get learned literals in the API (#8099)
This command will eventually take a mode; for now it assumes a default implementation. I've opened cvc5/cvc5-wishues#104 to track this.
This is a feature requested by Certora.
Andrew Reynolds [Thu, 3 Mar 2022 22:54:27 +0000 (16:54 -0600)]
Fix datatype declaration printing in LFSC printer (#8222)
Gereon Kremer [Thu, 3 Mar 2022 18:39:16 +0000 (19:39 +0100)]
Build python wheels in our CI (#8087)
This PR integrates building and publishing cvc5 with its base and pythonic python APIs as a package to PyPi into our CI.
We build wheels for Linux and macOS for CPython 3.6 to 3.10 and PyPy 3.7 and 3.8.
The job is run nightly and for a release, and only published to PyPi for a release (as long as there is no reasonable way to automatically prune nightly builds from either PyPi or TestPyPi).
Andrew Reynolds [Thu, 3 Mar 2022 15:59:04 +0000 (09:59 -0600)]
Generalize LFSC string signature to sequences (#8220)
Lachnitt [Thu, 3 Mar 2022 12:57:14 +0000 (04:57 -0800)]
[proofs] Alethe: Removed Steps that are Double-Printed (#7754)
This PR fixes that some steps are printed more than once. To this end, it deletes that the reference maps in which the steps are stored are constant and optimizes where the steps are added to the maps. It also stores ProofNodes instead of Nodes in the maps.
Co-authored-by: Haniel Barbosa <hanielbbarbosa@gmail.com>
Andrew Reynolds [Thu, 3 Mar 2022 05:00:32 +0000 (23:00 -0600)]
Throw logic exception if a transcendental function is encountered when nl-ext is not full (#8212)
Fixes cvc5/cvc5-projects#376.
Andrew Reynolds [Thu, 3 Mar 2022 04:26:54 +0000 (22:26 -0600)]
Add regression for fixed issue (#8213)
Fixes #5815.
This adds the regression, in theory I still think it is possible for the assertion to fail, but I don't think it is worth pursuing right now.
Andrew Reynolds [Thu, 3 Mar 2022 03:51:42 +0000 (21:51 -0600)]
Improve error for higher-order logic (#8207)
Makes the error more informative when a higher-order function variable is encountered.
Fixes cvc5/cvc5-projects#450.
Mathias Preiner [Thu, 3 Mar 2022 02:57:09 +0000 (18:57 -0800)]
cmake: Fix murxla setup. (#8215)
Gereon Kremer [Thu, 3 Mar 2022 02:16:09 +0000 (03:16 +0100)]
Integrate pythonic api (#8131)
We decided we want to ship the pythonic API together with our base python API.
This PR adds a new target cvc5_python_api that first builds the base python API and then copies the pythonic API over. Furthermore we now use the cvc5.pythonic module to generate the corresponding documentation.
Gereon Kremer [Thu, 3 Mar 2022 00:37:05 +0000 (01:37 +0100)]
Fix rewriting of mixed-integer atoms (#8214)
The sixth input from #8159 revealed a subtle issue in our rewriting of arithmetic atoms. As real and integer atoms are rewritten differently, we check this and then call different functions. However, we check this on the original input, although this property can change during rewriting, e.g., when the only real variable vanishes.
This PR fixes this issue.
Andrew Reynolds [Wed, 2 Mar 2022 23:09:24 +0000 (17:09 -0600)]
Fix issue with dropping non-reduced sine terms (#8211)
Fixes #8208.
A spurious "break" was leftover from when this code was a loop, this meant when the first reduced term was encountered, it ignored the remainder.
Andrew Reynolds [Wed, 2 Mar 2022 22:36:05 +0000 (16:36 -0600)]
Fix models involving cardinality of sets of finite type (#8206)
Was caused by a flag not being reset, thus making it so that subsequent models did not use exclusion sets.
Fixes #5402. (Fixes the last benchmark on that issue, the first two are fixed by #8201).
Andrew Reynolds [Wed, 2 Mar 2022 21:55:52 +0000 (15:55 -0600)]
Always purify universe from set minus (#8201)
This fixes a bug in our handling of set cardinality + set universe (also used for set complement).
The bug was caused by using the rewritten form of terms to compute siblings in the cardinality graph. This is problematic for
(set.minus set.universe t) whose sibling was computed to be rewrite( (set.inter set.universe t) ) = t.
To avoid the issue, we now purify the argument of set.minus to avoid this behavior.
Fixes #5400.
Fixes the first benchmark on #5402.
This also eliminates a spurious lemma schema for set universe that was leftover from handling set subtyping.
Andrew Reynolds [Wed, 2 Mar 2022 21:11:05 +0000 (15:11 -0600)]
Eliminate CDHashMap::insertAtContextLevelZero (#8173)
This method unnecessarily complicates the usage of CDHashMap. It had one usage in the current code, for dealing with global declarations. However, this was an entirely artificial use case, as one should properly manage scopes when this option is true (i.e. global-declarations simply disables user-level scoping in the symbol table).
It also simplifies the symbol table so that it doesn't automatically push a global outermost scope. Instead, this scope is pushed when the logic is declared, so that background symbols are correctly added at level 0.
Fixes #4767.
Andrew Reynolds [Wed, 2 Mar 2022 20:36:36 +0000 (14:36 -0600)]
Fix incorrect assertion in prop engine proofs (#8204)
Leftover from when unsat cores mode was tied to proof mode.
Fixes cvc5/cvc5-projects#462.
Andrew Reynolds [Wed, 2 Mar 2022 18:59:56 +0000 (12:59 -0600)]
Clean usage of options in regressions (#8190)
We now support tester annotations, thus it is best practice not to use check-unsat-cores or check-models explicitly in the regressions.
This changes regressions to not use these options, where these options are either:
removed entirely (the benchmark was fixed in the meantime)
changed to -q (the benchmark succeeds with a warning)
changed to produce- instead of check- if the option on the benchmark is required to ensure a configuration of models/unsat-cores is run. This is done for unsat-cores on sat benchmarks and models on unsat benchmarks.
replaced by DISABLE-TESTER: model.
one spurious regression is deleted, which was identical to another + check-models.
It also makes some fixes to enable more benchmarks succeed with check-models, and adds a warning when fmf-fun is combined with check-model.
Andrew Reynolds [Wed, 2 Mar 2022 18:16:20 +0000 (12:16 -0600)]
Improve error message when not using strings-exp (#8203)
Fixes #6005.
Also improves smt2 printing of sequences so that we print the compliant kinds, which is work towards cvc5/cvc5-wishues#106.
Gereon Kremer [Wed, 2 Mar 2022 17:21:32 +0000 (18:21 +0100)]
Move libpoly <-> CoCoA conversion to new utility (#8199)
This PR factors the conversion between libpoly and CoCoA out of the LazardEvaluation class into a new utility. The goal is to make it reusable for other applications of CoCoA within cvc5, for example to replace the (rather naive) equality substitution utility by a new simplification technique based on CoCoAs Gröbner bases. This PR merely moves code around and should not actually change anything.
Gereon Kremer [Wed, 2 Mar 2022 16:37:03 +0000 (17:37 +0100)]
Refactor rewriting of arithmetic division (#8195)
This PR does minor refactoring of how we rewrite division. Also, it moves some functions around to reconcile the order in header and source file.
Andrew Reynolds [Wed, 2 Mar 2022 15:48:54 +0000 (09:48 -0600)]
Add utility to access how to print floating point (#8141)
This makes the code for printing a floating point based on its BV components accessible as a utility.
This is required for proper printing of FP constants in LFSC.
Andrew Reynolds [Wed, 2 Mar 2022 05:12:08 +0000 (23:12 -0600)]
Make blockModelValues robust to non-closed enumerable types (#8055)
Fixes cvc5/cvc5-projects#420.
Also fixes the trivial case where there is nothing to block, in which case we should add false (via mkOr) not true.
Andrew Reynolds [Wed, 2 Mar 2022 02:38:21 +0000 (20:38 -0600)]
Add regressions for fixed issues (#8202)
Fixes #4463.
Fixes cvc5/cvc5-projects#403.
Gereon Kremer [Wed, 2 Mar 2022 01:27:02 +0000 (02:27 +0100)]
Prune spurious roots in lazard evaluation of coverings solver (#8200)
This PR fixes a subtle issue in the Lazard evaluation used in the coverings solver if --nl-cov-lift=lazard is used.
When isolating real roots (over a partial assignment that contains real algebraic number), the core root solver may find roots that are spurious, i.e., they are not actually roots of the input polynomial. This is due to the way how the multivariate polynomial is "partially evaluated" before calling the univariate real root isolation.
When using the libpoly real root isolation, this is all done internally. For the Lazard evaluation, however, we explicitly call the libpoly real root isolation on a univariate polynomial that already has these spurious roots, hence we need to remove them ourselves.
While debugging this issue, another weird oversight was detected (and fixed): for some reason we expected the vanishing factor (after factoring the defining polynomial when constructing the next field extension) to only have two term. There is no reason for this restriction, and the code below works just fine.
Gereon Kremer [Wed, 2 Mar 2022 00:44:03 +0000 (01:44 +0100)]
Add standard theories to documentation (#8192)
This PR adds the standardized theories to our theories overview.
Andrew Reynolds [Tue, 1 Mar 2022 21:14:16 +0000 (15:14 -0600)]
Fix issue involving dropped purification lemmas for transcendental functions (#8198)
Fixes #4693.
Fixes #8181 (which now times out).
The issue was caused by purification lemmas being dropped, often in incremental mode. This meant that we were replacing sin(t) by sin(k) when checking models, but not having any information about sin(k).
We now are more robust and send the purification lemmas for transcendental functions based on checking whether it is necessary to do so.
Andrew Reynolds [Tue, 1 Mar 2022 20:46:56 +0000 (14:46 -0600)]
Do not use sygus evaluation functions in sygus-inst (#8185)
This simplification was realized while we were writing the paper.
This should avoid spurious check-model failures when using sygus-inst.
Andrew Reynolds [Tue, 1 Mar 2022 17:01:50 +0000 (11:01 -0600)]
Disable regression (#8191)
Benchmark is "unknown" on some builds. We don't have a strong reason why we will always say "sat" for this benchmark.
Fixes one of the issues in the nightlies.
Andres Noetzli [Tue, 1 Mar 2022 09:07:56 +0000 (01:07 -0800)]
[BV] Fix rewriter policy for `bvneg` (#8196)
Our rewriter was returning `REWRITE_DONE` prematurely for `bvneg`. This
commit makes the status returned more conservative.
Andrew Reynolds [Tue, 1 Mar 2022 06:02:51 +0000 (00:02 -0600)]
Fix lambda lifting + proofs (#8152)
Was leading to eager proof checking failures on proof-new.
Andres Noetzli [Tue, 1 Mar 2022 02:19:02 +0000 (18:19 -0800)]
Remove unused data members from `TheoryArrays` (#8197)
Gereon Kremer [Tue, 1 Mar 2022 00:37:13 +0000 (01:37 +0100)]
Rename cad to coverings (#8187)
The nonlinear subsolver that implements cylindrical algebraic coverings is still called cad in many places, which really was a misnomer from the beginning. This PR renames it everywhere.
Andres Noetzli [Mon, 28 Feb 2022 23:56:38 +0000 (15:56 -0800)]
[Seq/Model] Do not enumerate elements of constants (#8179)
Fixes #8133. In the input from the issue, the string solver was
assigning a skeleton `(seq.unit smvX)` to a constant of sort `(Seq (Seq
Int))`. This constant was asserted to be different from `(seq.unit (as
seq.empty (Seq Int)))`. However, the `TheoryModelBuilder` was assigning
`smvX` the value `(as seq.empty (Seq Int))`, because `(as seq.empty (Seq
Int))` was not being registered with the equality engine. This is
because elements of constant sequences are not considered children, but
are a data member of the `Sequence` class. The commit updates
`TheoryStrings::collectModelInfoType()` to also register elements of
sequence constants with the equality engine.
Gereon Kremer [Mon, 28 Feb 2022 23:15:27 +0000 (00:15 +0100)]
Refactor rewriting of arithmetic atoms (#8175)
This PR uses the new utilities for atom rewriting in the arithmetic rewriter.
Andrew Reynolds [Mon, 28 Feb 2022 22:37:08 +0000 (16:37 -0600)]
Fix special casing for PI in model value (#8189)
PI should be considered a model value but not a "base" model value. This avoid spurious debug assertion failures, which are now treated as warnings. This makes a difference when another theory e.g. UF says that PI is currently equal to a constant value c. Since our lemma schemas are model-based, we may require building a spurious model where PI is c, and refine afterwards.
This also fixes a bug in our extended function rewriting which would mistakenly think that PI was reduced, and hence skip a full effort check if PI was the only extended function in the current context. This was previously causing a final model to be one where PI = 0.0.
Fixes #8183.
Andrew Reynolds [Mon, 28 Feb 2022 22:04:16 +0000 (16:04 -0600)]
Preserve model values for exact sine points (#8188)
Fixes #8182.
Andrew Reynolds [Mon, 28 Feb 2022 21:03:30 +0000 (15:03 -0600)]
Track names for witness terms in model (#8184)
This ensures that enough information is set to allow users to understand models with witness terms.
For example, for input:
(set-logic ALL)
(set-info :status sat)
(declare-fun x () String)
(declare-fun y () String)
(declare-fun z () String)
(assert (= (str.len x)
999999999999999999999999))
(assert (= (str.len y)
999999999999999999999999))
(assert (= z (str.++ x y)))
(check-sat)
we now get:
sat
(
(define-fun x () String (witness ((s String)) (! (= (str.len s)
999999999999999999999999) :qid w1) ))
(define-fun y () String (witness ((s String)) (! (= (str.len s)
999999999999999999999999) :qid w0) ))
(define-fun z () String (str.++ (witness ((s String)) (! (= (str.len s)
999999999999999999999999) :qid w1) ) (witness ((s String)) (! (= (str.len s)
999999999999999999999999) :qid w0) )))
)
Andrew Reynolds [Mon, 28 Feb 2022 20:01:30 +0000 (14:01 -0600)]
Add two reduction schemas for sin terms (#8171)
This restores our reasoning for symmetry of sine, now on-demand and without introducing sin terms eagerly.
It also ensures that sin terms whose arguments fall exactly on boundary points are removed from consideration from the transcendental solver. This allows us to answer sat for inputs involving sin(k) when k = pi/2.
It also cleans the relationship of sine solver and transcendental state, and makes a small fix to the monotonicity of sin schema.
Andres Noetzli [Mon, 28 Feb 2022 19:21:16 +0000 (11:21 -0800)]
Remove broken/unused `--mmap` option (#8178)
Fixes #2705. This commit removes the broken and unused --mmap option.
Given that we are planning to change to a different parser at some
point, it is not worth attempting to fix the option.
Gereon Kremer [Mon, 28 Feb 2022 18:47:28 +0000 (19:47 +0100)]
Add scripts to build python wheels (#8132)
This adds a new set of scripts to build python wheels for cvc5. It includes
mk_wheel.py which builds the python wheel within an existing build folder
mk_build_dir.py which runs configure.sh and directs cmake to a custom python interpreter
mk_clean_wheel.sh which builds the python wheel in a clean environment (a python venv and a fresh build folder)
a dockerfile that slightly customizes manylinux2014 to our use case
a readme giving a highlevel overview of what we are doing
Gereon Kremer [Mon, 28 Feb 2022 15:45:56 +0000 (16:45 +0100)]
Refactor rewriting of arithmetic leafs (#8177)
Minor refactoring of how we rewrite arithmetic leaf nodes (constants, algebraic numbers and "variables").
Gereon Kremer [Mon, 28 Feb 2022 15:22:48 +0000 (16:22 +0100)]
Refactor rewriting of arithmetic addition (#8180)
This PR uses the new addition utilities to refactor rewriting of arithmetic addition. This properly handles real algebraic numbers now, eliminating a few more edge cases where the previous solution might allow for non-idempotent rewrites.
Andrew Reynolds [Fri, 25 Feb 2022 22:48:12 +0000 (16:48 -0600)]
Consider PI to be a model value (#8176)
Fixes cvc5/cvc5-projects#460.
The special case is necessary due to the node representation of nullary operators, which uses variables internally to represent operators. The other nullary operators are not model values.
Andrew Reynolds [Fri, 25 Feb 2022 22:01:01 +0000 (16:01 -0600)]
Syntax fixes for LFSC signature (#8172)
Gereon Kremer [Fri, 25 Feb 2022 21:22:36 +0000 (22:22 +0100)]
Add utilities to rewrite atoms for the arithmetic rewriter (#8014)
This PR adds utilities to rewrite atoms in the arithmetic rewriter. They retain compatibility with the current normal_form utility, but make the process more transparent so that changing the normal form in the future should be simpler.
Gereon Kremer [Fri, 25 Feb 2022 20:56:21 +0000 (21:56 +0100)]
Refactor rewriting of arithmetic negation and subtraction (#8170)
Slightly refactor negation and subtraction, get rid of utility functions.
Gereon Kremer [Fri, 25 Feb 2022 20:17:34 +0000 (21:17 +0100)]
Slightly refactor arithmetic rewriting for extended operators (#8169)
This PR mostly reorders the implementation to match the order in the header, and does a few very minor refactorings for the rewriters for transcendental functions, and the pow2 and iand operators.
Andrew Reynolds [Fri, 25 Feb 2022 19:59:27 +0000 (13:59 -0600)]
Fix non-termination in quantifiers rewriter (#8165)
Caused by 2 rewrite steps (conditional splitting and extended rewriting) being inverses of each other when miniscoping is disabled.
Fixes the third benchmark on #8159.
Andrew Reynolds [Fri, 25 Feb 2022 18:45:43 +0000 (12:45 -0600)]
Simplify and fix how purified terms are managed in the trancendental solver (#8167)
Simplification is leftover from the sine symmetry heuristic, now the mapping from terms to what purifies them is injective.
Also makes the mapping context-dependent.
It also ensures that we keep model values for purification arguments. Fixes #8160.
Andrew Reynolds [Fri, 25 Feb 2022 17:15:00 +0000 (11:15 -0600)]
Fix dropped bounds on PI (#8164)
Fixes #8162.
In this example, we were failing to send the initial PI bound lemma, likely due to a conflict while this lemma was buffered.
This makes the PI refinement utility more robust by explicitly checking based on the model whether we need to refine PI.
Andrew Reynolds [Fri, 25 Feb 2022 16:45:41 +0000 (10:45 -0600)]
Remove approximations infrastructure from model (#8166)
We now allow partial specifications. Recording approximations is arithmetic specific, and if necessary could be added as a post-processing analysis e.g. during check-model.
Andrew Reynolds [Fri, 25 Feb 2022 16:27:16 +0000 (10:27 -0600)]
Remove spurious assertion involving constants for arguments to UF from FMF (#8168)
Fixes #8163.
Andrew Reynolds [Fri, 25 Feb 2022 07:13:43 +0000 (01:13 -0600)]
Make quantifiers terminate if it detects a (duplicate) quantifier-free conflict (#8157)
Fixes #6859.
The benchmark is now unknown.
Andrew Reynolds [Fri, 25 Feb 2022 06:27:29 +0000 (00:27 -0600)]
Add regression for fixed transcendental regression (#8155)
Fixes #7938.
Andrew Reynolds [Fri, 25 Feb 2022 06:05:41 +0000 (00:05 -0600)]
Consolidate extended rewrite preprocessing modes (#8156)
Andres Noetzli [Fri, 25 Feb 2022 00:32:18 +0000 (16:32 -0800)]
[Python API] Add support for blocking models (#8134)
The methods for blocking models were missing in the Python API. This
commit adds the blockModel() and blockModelValues() methods as well
as the corresponding tests.
Andrew Reynolds [Thu, 24 Feb 2022 23:56:33 +0000 (17:56 -0600)]
Ensure variables are constrained in model when equal to transcendental function apps (#8153)
Fixes #8147.
Andrew Reynolds [Thu, 24 Feb 2022 23:33:23 +0000 (17:33 -0600)]
Make model builder robust to multiple value-like terms in the same equivalence class (#8150)
This changes our policy on handling when two value-like terms are in the same equivalence class. We now give preference to the "base" model value, and either warn or throw a debug exception.
After
f7675b2, we can have the situation where e.g. (seq.nth seq.empty 1) is in the same equivalence class as a constant, where (seq.nth seq.empty 1) is considered value-like, despite being unevaluatable. We now ensure that the constant is taken as the representative of the equivalence class, and not this term.
It also removes assignable terms from consideration when assigning values to equivalence classes. In particular, (seq.nth seq.empty 1) is skipped, so a warning is not even given when the above occurs.
Fixes #8148.
Gereon Kremer [Thu, 24 Feb 2022 20:17:45 +0000 (21:17 +0100)]
Improve error message for missing options include (#8154)
This PR improves the error message if one tries to use options whose header have not been included.
Andrew Reynolds [Thu, 24 Feb 2022 19:08:07 +0000 (13:08 -0600)]
Make sine solver sound with respect to region boundaries (#8117)
Fixes the last benchmark on #7948.
Fixes a refutation soundness issue in the transcendental solver where a concavity region would be incorrectly assigned to a point if it was between the current model value of c*PI and its true value, where c in {-1, -1/2, 1/2, 1}.
We now only assign a concavity region if the model value of the argument lies within sound lower/upper bounds for the boundaries.
Notice that this means that points may be unassignable to a region if they lie inside the approximation interval for c*PI. An application of sin applied to an argument whose model value is that point cannot be refined.
A followup PR will address termination issues where the Taylor degree is incremented even when no function can be refined.
Andrew Reynolds [Thu, 24 Feb 2022 18:28:58 +0000 (12:28 -0600)]
Check for free variables in several SolverEngine calls (#8130)
Fixes the nightlies due to ensuring that a unit test fails in production (it was failing only in debug).
Fixes #8127.
Gereon Kremer [Thu, 24 Feb 2022 17:44:40 +0000 (18:44 +0100)]
Get rid of some static objects in arithmetic theory (#8146)
This PR tackles cvc5/cvc5-projects#17 by removing static variables or making them constexpr.
Most static variables are either compile-time constants (we make them static constexpr) or used to count how often a function is called for debug output (we remove these).
Andrew Reynolds [Thu, 24 Feb 2022 05:25:57 +0000 (23:25 -0600)]
Make uninterpreted sort owner non-static (#8144)
This eliminates the static member `s_uninterpretedSortOwner` from Theory which seems to be the cause of several issues related to the array solver in incremental mode, and with check-unsat-cores. This is moved to a data member of Env. This eliminates a static access to `theoryOfMode` from within theoryOf calls.
Note that static calls to `Theory::theoryOf` or `Theory::isLeafOf` now assume type-based theoryOf mode as a default argument. Thus, the preferred method for determining theoryOf types and terms is through `Env` now.
This fixes issues with the array solver in incremental mode.
The root issue is that spawning subsolvers (e.g. for check-unsat-core) can overwrite `s_uninterpretedSortOwner`. This means that a second call to `check-sat` (which does not reinitialize set_defaults) will use the *overwrtten* setting, which can be different from what was used for the first check-sat. In particular, for #5720, the uninterpreted sort owner changes from ARRAYS to UF at the 2nd call, and the array theory solver fails to send an extensionality lemma.
This commit also simplifies `Theory::theoryOf` slightly.
Fixes https://github.com/cvc5/cvc5-wishues/issues/52.
Fixes https://github.com/cvc5/cvc5/issues/5720.
Fixes https://github.com/cvc5/cvc5/issues/6276 .
Fixes https://github.com/cvc5/cvc5/issues/5836.
Andrew Reynolds [Thu, 24 Feb 2022 01:26:27 +0000 (19:26 -0600)]
Add regression for some fixed array issues (#8145)
Found while checking whether the latest fix solves array issues, these were already resolved.
Fixes #4414.
Fixes #4546.
Gereon Kremer [Wed, 23 Feb 2022 23:06:31 +0000 (00:06 +0100)]
Add two regressions related to RAN models (#8142)
This PR adds regressions for two issues that relate to the previously incomplete handling of real algebraic models.
The issue has been resolved by properly integrating real algebraic numbers as model values and in the rewriter.
Fixes #6547. Fixes #6619.
Andrew Reynolds [Wed, 23 Feb 2022 22:35:15 +0000 (16:35 -0600)]
Allow elimination of unevaluated terms by default (#8136)
Fixes #8118.
Andrew Reynolds [Wed, 23 Feb 2022 21:34:07 +0000 (15:34 -0600)]
Further relax what is considered a value in the model (#8095)
Fixes #8094.
This makes it so that "value-like" terms can appear as subterms in other terms that are then subsequently also considered values. For example (str.++ (witness ((x String)) (= (str.len x) 1000)) "A") is now considered a value.
This also changes the default option for when to use witness terms for strings in models, based on some user feedback.
Andrew Reynolds [Wed, 23 Feb 2022 20:59:37 +0000 (14:59 -0600)]
Do not insist that entries for UF are constant in FMF (#8140)
Fixes #8096.
Andrew Reynolds [Wed, 23 Feb 2022 20:08:49 +0000 (14:08 -0600)]
Eliminate match from LFSC proofs (#8090)
The smt 2.6 term match is very hard to represent in LFSC, this eliminates it in favor of the ITE term that it is syntax sugar for. Like other aspects of the LFSC conversion, this is part of the trusted core.
This avoids internal type errors in the LFSC node converter.
Gereon Kremer [Wed, 23 Feb 2022 19:09:52 +0000 (20:09 +0100)]
Remove long obsolete unsafe interrupt exception (#8139)
We used to use UnsafeInterruptException to deal with resource outs in the resource manager: when resources were exhausted, we would throw this exception that was catched in the core solver engine. This had the significant downside of leaving the solver in a potentially inconsistent state. We moved away from using it long ago in #4732.
What remained was the UnsafeInterruptException class itself and a bunch of places that still catch this exception that is no longer thrown anywhere.
This PR removes this class for good.
Andrew Reynolds [Wed, 23 Feb 2022 18:46:02 +0000 (12:46 -0600)]
Option exception when incompatible with proofs (#8064)
This changes set defaults so that it doesn't silently disable proofs or unsat cores.
Fixes cvc5/cvc5-projects#440.
Gereon Kremer [Wed, 23 Feb 2022 18:08:22 +0000 (19:08 +0100)]
Fix creation of RAN from non-dyadic rational (#8138)
Libpoly only allows to create real algebraic numbers from dyadic rationals. For non-dyadic rationals, we need to create a polynomials and create it the general way. Libpoly requires all defining polynomials to be primitive, in particular the leading coefficient must be positive. We would always have it negative, which only becomes a problem if libpoly has assertions enabled, though.
Fixes #8126.
Gereon Kremer [Wed, 23 Feb 2022 17:29:18 +0000 (18:29 +0100)]
Fix icp candidate parsing (#8137)
For constraints of the form c * x ~ poly(x) where c != 1 we would sometimes forget to take the inverse of c when parsing the assertion to the internal representation of the ICP solver. This PR fixes this issue, and does a few more changes:
--nl-icp is really not well-tested and disabled by default. We make it an expert option.
we no longer issue the propagation lemmas if we already found a conflict
the nl-icp trace was heavily polluted by output from the interval utils, which are now moved to a new nl-icp-debug trace
Fixes #8135.
Andrew Reynolds [Wed, 23 Feb 2022 16:46:50 +0000 (10:46 -0600)]
Properly sanatize user names in LFSC (#8080)
Previously, we would get LFSC proof checking failures if we were using an identifier that was valid in SMT-LIB but not LFSC.
Co-authored-by: Alex Ozdemir <aozdemir@hmc.edu>
Andres Noetzli [Wed, 23 Feb 2022 16:23:54 +0000 (08:23 -0800)]
[Rewriter] Do not attempt to rewrite constants (#8061)
This commit changes our rewriter policy to not attempt to rewrite nodes
with no children.
Gereon Kremer [Wed, 23 Feb 2022 15:18:07 +0000 (16:18 +0100)]
Fix pruning of covering intervals in proofs (#8084)
We need to mirror the pruning of intervals in the coverings solver in the corresponding proof. To match the proof nodes with the coverings-internal intervals, we use ids, where non-interval nodes have the id zero. In this process, we had three separate issues that never showed up because we don't have a proof checker for CAD proofs:
we did not check for zeros, pruning all non-interval nodes
we ran the pruning on the direct children of a CAD_RECURSIVE proof step, which are SCOPE nodes that don't have ids
iterating over and then removing children was done by a custom but faulty reimplementation of std::remove_if
Thus, we now
never prune zero nodes,
prune based on the (single) child node, if we are checking a SCOPE node, and
simply use std::remove_if.
Gereon Kremer [Wed, 23 Feb 2022 14:57:53 +0000 (15:57 +0100)]
Refactor multiplication in arithmetic rewriter (#7965)
This PR refactors the rewriting of multiplication. Most importantly, we explicitly deal with distributivity of addition and multiplication explicitly using the new utilities.
Andrew Reynolds [Wed, 23 Feb 2022 03:12:06 +0000 (21:12 -0600)]
Fix issue in datatypes care graph computation involving subtyping (#8125)
The datatypes care graph was incorrectly computed for constructors taking `Real` arguments, due to subtyping.
This fixes the term index to cache on the *return* type for constructors, not the argument types. Caching based on argument types was incorrect even for non-parametric datatypes with arguments that have subtyping.
Fixes https://github.com/cvc5/cvc5/issues/8124.
This also does minor cleanup and additions done while debugging the issue.
Andrew Reynolds [Tue, 22 Feb 2022 19:11:45 +0000 (13:11 -0600)]
Support some cases of isConst for regular expressions (#8114)
Fixes https://github.com/cvc5/cvc5/issues/8111.
Having `isConst` return true is required for some rare use cases of regular expressions, e.g. rewrite rule synthesis involving regular expression variables.
Andrew Reynolds [Tue, 22 Feb 2022 18:36:46 +0000 (12:36 -0600)]
Remove refineConflicts option (#8129)
Was introduced in
8a0c056.
Fixes #8119.