cvc5.git
3 years agoAdd Result.java to the java API (#6385)
mudathirmahgoub [Fri, 14 May 2021 01:15:21 +0000 (20:15 -0500)]
Add Result.java to the java API (#6385)

This PR adds Result.java ResultTest.java and cvc5_Result.cpp to the java api.

3 years agobv: Assert input facts on user-level 0. (#6515)
Mathias Preiner [Fri, 14 May 2021 00:29:52 +0000 (17:29 -0700)]
bv: Assert input facts on user-level 0. (#6515)

The bitblast solver currently uses solving under assumptions for all facts that are sent to the bit-vector solver. For input facts on user-level 0 we can however assert the fact to the SAT solver, which allows the SAT solver to do more preprocessing. This PR adds the option to assert user-level 0 input facts, which is disabled by default.

3 years agoapi docs: Tweak style to be consistent with website style. (#6537)
Aina Niemetz [Fri, 14 May 2021 00:05:18 +0000 (17:05 -0700)]
api docs: Tweak style to be consistent with website style. (#6537)

3 years agoAlways parse streams with line buffer (#6532)
Andres Noetzli [Thu, 13 May 2021 16:49:33 +0000 (09:49 -0700)]
Always parse streams with line buffer (#6532)

When cvc5 was compiled in competition mode (but not for the application
track), then it had a special behavior when reading from stdin. When it
received input from stdin, it would read all of stdin and then parse the
input as a string because it assumed that the full input is directly
available on stdin. However, the non-application tracks of SMT-COMP do
not use stdin anymore. They pass a filename to the solver. This special
case is not used as a result. Usually, cvc5 parses from stdin using the
line buffer, so this commit makes it so that this is always the case,
which simplifies the code.

3 years agoAdd std::hash overloads for Node, TNode and TypeNode. (#6534)
Mathias Preiner [Thu, 13 May 2021 06:33:00 +0000 (23:33 -0700)]
Add std::hash overloads for Node, TNode and TypeNode. (#6534)

Eliminates NodeHashFunction, TNodeHashFunction and TypeNodeHashFunction.

3 years agoSplit options holder class (#6527)
Gereon Kremer [Thu, 13 May 2021 06:02:58 +0000 (08:02 +0200)]
Split options holder class (#6527)

This PR splits the OptionsHolder class into separate holder classes for every options module and makes them directly accessible via appropriate Options::<module>() methods. We forward declare these new holder classes and thereby retain that we only need to recompile when we change an option module that is explicitly included.
All (generated) methods that previously accessed the old holder object are changed to instead use the new holder objects.
This PR does the bare minimum to do this change, further PRs will eventually get rid of all template specializations that currently surround our options class.

3 years agoAdding functions to the python API and testing them -- part 2 (#6517)
yoni206 [Thu, 13 May 2021 05:32:55 +0000 (22:32 -0700)]
Adding functions to the python API and testing them -- part 2 (#6517)

This PR adds some functions that are missing in the python API, along with unit tests for them.
The unit tests are translated from https://github.com/cvc5/cvc5/blob/master/test/unit/api/term_black.cpp

3 years agoFix error message in toPythonObj (#6524)
Alex Ozdemir [Thu, 13 May 2021 03:47:13 +0000 (20:47 -0700)]
Fix error message in toPythonObj (#6524)

3 years agoMove docs upload to a different workflow (#6512)
Gereon Kremer [Wed, 12 May 2021 17:13:06 +0000 (19:13 +0200)]
Move docs upload to a different workflow (#6512)

This PR (finally, I hope) uses a proper setup for uploading the documentation. One of the CI jobs generates the documentation and stores it in an artifact. Another workflow is triggered (via workflow_run) and then uploads this artifact. Only this setup seems to properly work for PR builds.

3 years agoPreliminary draft of changes for SMT comp 2021 (#6522)
Andrew Reynolds [Wed, 12 May 2021 14:38:59 +0000 (09:38 -0500)]
Preliminary draft of changes for SMT comp 2021 (#6522)

Covers improvements to quantifiers.

3 years agoEnsure sequences of Booleans generate Boolean term variable skolems when applicable...
Andrew Reynolds [Wed, 12 May 2021 13:30:42 +0000 (08:30 -0500)]
Ensure sequences of Booleans generate Boolean term variable skolems when applicable (#6529)

Fixes #6510.

This PR also eliminates a deprecated variant mkBooleanTermVariable from SkolemManager.

3 years agoUse signal(sig, SIG_DFL); raise(sig); instead of abort() (#6518)
Gereon Kremer [Wed, 12 May 2021 06:22:52 +0000 (08:22 +0200)]
Use signal(sig, SIG_DFL); raise(sig); instead of abort() (#6518)

As discussed in #6484 (and https://www.gnu.org/software/libc/manual/html_node/Termination-in-Handler.html), simply calling std::abort at the end of a custom signal handler seems to be bad practice. As suggested, this PR changes these calls to instead first reset to the default signal handler for the given signal, and then calling it.
Fixes #6484.

3 years agoRemove header for option modules (#6514)
Gereon Kremer [Mon, 10 May 2021 22:22:24 +0000 (00:22 +0200)]
Remove header for option modules (#6514)

This PR further simplifies the option declaration by removing the header attribute from module options.
Instead of specifying it manually, it is now automatically generated from the filename of the toml file. The header files and the toml files use matching names already, so this PR simply removes another mechanism that is not used anyway.
This PR also does a minor cleanup of the Options class in the mkoptions.py script.

3 years agoRemove read_only from options. (#6513)
Gereon Kremer [Mon, 10 May 2021 21:37:12 +0000 (23:37 +0200)]
Remove read_only from options. (#6513)

This PR removes the possibility of declaring options read_only.
It's only effect is making an attempts to disallow changing the respective option from within our internal code (by not providing a setter method). However, a "read-only" option can still be set via the setOption() methods that is also used by the API, and by SMT-LIB's set-option.

3 years agoUnify top-level substitutions and model substitutions (#6499)
Andrew Reynolds [Mon, 10 May 2021 14:29:09 +0000 (09:29 -0500)]
Unify top-level substitutions and model substitutions (#6499)

This unifies top-level substitutions and theory model substitutions. Env is now passed to the TheoryModel, which has access to top-level substitutions.

The former was used for simplfying assertions in the preprocessor, the latter was used for evaluating terms in the model.

There is no reason to have these two things be separate.

3 years agoAdd doc to Kind.java (#6498)
mudathirmahgoub [Mon, 10 May 2021 12:18:32 +0000 (07:18 -0500)]
Add doc to Kind.java (#6498)

This PR adds documentation to java kinds.

3 years agoAdding functions to the python API and testing them (#6477)
yoni206 [Sat, 8 May 2021 01:01:17 +0000 (18:01 -0700)]
Adding functions to the python API and testing them (#6477)

This PR adds some functions that are missing in the python API, along with unit tests for them.
Subsequent PR will include additional missing functions.

Also includes a yapf run to reformat the test file.

Co-authored-by: Makai Mann makaim@stanford.edu
3 years agoAdd support for datatype update (#6449)
Andrew Reynolds [Sat, 8 May 2021 00:25:27 +0000 (19:25 -0500)]
Add support for datatype update (#6449)

This removes the special case of TUPLE_UPDATE and RECORD_UPDATE in favor of the more general datatype update.

Datatype update is handled analogously to APPLY_SELECTOR / APPLY_TESTER.

3 years agoMove slow regressions and update guidelines. (#6508)
Aina Niemetz [Fri, 7 May 2021 23:30:48 +0000 (16:30 -0700)]
Move slow regressions and update guidelines. (#6508)

This moves regression test that exceed the time limit of their
respective level to the appropriate level. It further updates the
guidelines in the README with information on how to properly categorize
regression tests into levels (with time limits).

Note: Test regress3/issue4717.smt2 was previously unsolved (unknown) and
      is now sat (Z3 agrees).

3 years agoFix and add missing REQUIRE labels for FP regression tests. (#6506)
Aina Niemetz [Fri, 7 May 2021 23:23:08 +0000 (16:23 -0700)]
Fix and add missing REQUIRE labels for FP regression tests. (#6506)

3 years agoIntegrate documentation build with the regular CI workflow (#6490)
Gereon Kremer [Fri, 7 May 2021 23:14:13 +0000 (01:14 +0200)]
Integrate documentation build with the regular CI workflow (#6490)

The new documentation workflow requires building CVC5 again in a separate workflow, which takes quite some time.
This PR integrates building the documentation with the regular CI workflow.

3 years agoProperly printing INST_PATTERN_LIST by itself (#6507)
Haniel Barbosa [Fri, 7 May 2021 20:28:44 +0000 (17:28 -0300)]
Properly printing INST_PATTERN_LIST by itself (#6507)

Previously the SMT2 printer would print pattern lists wrong when they were not printed as part of a binder containing it. This commit fixes this by removing an unused hardcoded restriction that led to issues when printing the ASTs of proof nodes containing patterns.

3 years agoSimplifications to expand definitions (#6487)
Andrew Reynolds [Fri, 7 May 2021 19:09:58 +0000 (14:09 -0500)]
Simplifications to expand definitions (#6487)

This removes the expandOnly flag from expandDefinitions.

The use of expandOnly = true is equivalent to applying top-level substitutions only, which should be done explicitly via Env::getTopLevelSubstitutions. It updates the trust substitutions utility to distinguish apply vs applyTrusted for convenience for this purpose.

This also breaks several dependencies in e.g. expand definitions module.

3 years agoFix for toPythonObj of integer value with real sort (#6505)
makaimann [Fri, 7 May 2021 18:01:16 +0000 (14:01 -0400)]
Fix for toPythonObj of integer value with real sort (#6505)

3 years ago[proof-new] Updating documentation for Subs/Rw ids (#6502)
Haniel Barbosa [Thu, 6 May 2021 22:56:35 +0000 (19:56 -0300)]
[proof-new] Updating documentation for Subs/Rw ids (#6502)

3 years agoDiscard duplicate terms in patterns (#6501)
Andrew Reynolds [Thu, 6 May 2021 21:57:37 +0000 (16:57 -0500)]
Discard duplicate terms in patterns (#6501)

Fixes #6495.

3 years agoUpdate README.md and remove last CVC4 references. (#6497)
Mathias Preiner [Thu, 6 May 2021 19:55:51 +0000 (12:55 -0700)]
Update README.md and remove last CVC4 references. (#6497)

3 years agoUse constant folding for evaluating BV eager atom (#6494)
Andrew Reynolds [Thu, 6 May 2021 19:22:46 +0000 (14:22 -0500)]
Use constant folding for evaluating BV eager atom (#6494)

This is work towards unifying top-level substitutions with model substitutions.

Currently, for model evaluation, BV eager atom preprocessing pass adds mappings (BV_EAGER_ATOM X) -> X to say how (BV_EAGER_ATOM X) should be evaluated in the model. This is not necessary since a rewrite rule (BV_EAGER_ATOM c) -> c for constant c would suffice.

This eliminates the call to addModelSubstitution in that preprocessing pass.

It also makes it so that we don't make true/false themselves into eager atoms.

3 years agoDo not have quantifiers model inherit from theory model (#6493)
Andrew Reynolds [Wed, 5 May 2021 23:09:24 +0000 (18:09 -0500)]
Do not have quantifiers model inherit from theory model (#6493)

This is work towards making the initialization of theory engine, theory models, quantifiers engine more flexible.

This makes it so that the specialized quantifiers models classes (FirstOrderModel) do not inherit from TheoryModel. There is no longer any reason for this, since FirstOrderModel does not have any override methods.

As a result of this PR, there is only one kind of TheoryModel and it is constructed immediately when ModelManager is constructed.

This required refactoring the initialization of when FirstOrderModel is constructed in ModelBuilder classes in quantifiers.

This also avoids the need for casting TheoryModel to FirstOrderModel.

3 years agoSave block comments associated with each kind when parsing kinds file (#6489)
makaimann [Wed, 5 May 2021 07:15:39 +0000 (03:15 -0400)]
Save block comments associated with each kind when parsing kinds file (#6489)

This PR adds features to the KindsParser for saving and looking up the documentation comment associated with each Kind. This PR does not make use of it yet, but future PRs can query for the comment to automatically add it to language binding documentation (e.g., Python / Java bindings).

3 years agoAdd helper functions for multi-objective optimization + refactoring (#6473)
Ouyancheng [Wed, 5 May 2021 00:34:54 +0000 (17:34 -0700)]
Add helper functions for multi-objective optimization + refactoring (#6473)

add 3 helper functions
judge whether a node is optimizable
make strong improvement expression according to optimization objective
make weak improvement expression according to optimization objective
optChecker is now created by optimizationSolver instead of the minimize/maximize functions
Slightly refactors function signatures so that they are accepting OptimizationObjective instead of accepting target, type in separate parameters.

3 years agoMove current decision engine to decision engine old (#6466)
Andrew Reynolds [Wed, 5 May 2021 00:25:25 +0000 (19:25 -0500)]
Move current decision engine to decision engine old (#6466)

The decision engine is the class that contains strategies for doing e.g. justification heuristic.

The current implementation is hardcoded for the old implementation of justification heuristic.

Since both implementations will be maintained in the short term, this splits the parts of DecisionEngine that are specific to the old implementation to a class DecisionEngineOld.

It refactors the interface of DecisionEngine in a way that is compatible with both implementations.

3 years agoMove env into smt solver, theory engine, prop engine (#6486)
Andrew Reynolds [Tue, 4 May 2021 23:22:49 +0000 (18:22 -0500)]
Move env into smt solver, theory engine, prop engine (#6486)

This is work towards eliminating singletons.

Also, TheoryModel should use the same substitution map as the preprocessor. This is work towards unifying these things, which will be done in a future PR.

3 years agoDo not use proof CNF stream with assumptions-based cores (#6488)
Haniel Barbosa [Tue, 4 May 2021 18:36:41 +0000 (15:36 -0300)]
Do not use proof CNF stream with assumptions-based cores (#6488)

Previously using proof CNF stream together with assumptions-based unsat cores added unnecessary performance overhead.

Co-authored-by: Mathias Preiner mathias.preiner@gmail.com
3 years agoUse proper commit hash for PRs (#6485)
Gereon Kremer [Tue, 4 May 2021 17:06:35 +0000 (19:06 +0200)]
Use proper commit hash for PRs (#6485)

For PRs, the automatically generated documentation is stored under the current master commit hash instead of the hash of the latest commit on the PR. This PR fixes this issue by exporting the commit hash (much like the name of the PR or branch).

3 years agocmake: Fix ninja build. (#6481)
Mathias Preiner [Tue, 4 May 2021 16:55:28 +0000 (09:55 -0700)]
cmake: Fix ninja build. (#6481)

3 years agoImprove generation of python API documentation (#6482)
Gereon Kremer [Tue, 4 May 2021 16:33:59 +0000 (18:33 +0200)]
Improve generation of python API documentation (#6482)

This PR makes generating the python part of our API documentation more reliable. If python bindings are enabled, it makes the docs target depend on pycvc5 and renders a warning into the documentation if python bindings are disabled.
To make the dependency on pycvc5 work properly, it changes the python bindings build so that the library is directly put in the right place and avoid the manual rename, so that the pycvc5 target actually points to the correct file.
Unfortunately, this means we need to build libcvc5 when building docs with python bindings enabled.

3 years agoFP: Move removal of generic to_fp operations to rewriter. (#6480)
Aina Niemetz [Tue, 4 May 2021 02:07:52 +0000 (19:07 -0700)]
FP: Move removal of generic to_fp operations to rewriter. (#6480)

3 years agoFP: Move type check from expandDefinitions. (#6479)
Aina Niemetz [Tue, 4 May 2021 01:00:03 +0000 (18:00 -0700)]
FP: Move type check from expandDefinitions. (#6479)

3 years agoFP: Rewrite to_fp conversion from signed bit-vector. (#6472)
Aina Niemetz [Mon, 3 May 2021 20:27:02 +0000 (13:27 -0700)]
FP: Rewrite to_fp conversion from signed bit-vector. (#6472)

SymFPU does not allow to_fp conversion from signed bv of size 1. This
adds rewrites for this case.

Rewrites for the constant and the non-constant cases were tested in
isolation.

3 years agoAdd missing --auto-download in CI (#6478)
Gereon Kremer [Mon, 3 May 2021 20:15:36 +0000 (22:15 +0200)]
Add missing --auto-download in CI (#6478)

This PR adds --auto-download for the CI job that builds the documentation. Also makes sure that the documentation workflow never fails.

3 years agoAdd CI jobs to build docs (#6413)
Gereon Kremer [Mon, 3 May 2021 19:21:19 +0000 (21:21 +0200)]
Add CI jobs to build docs (#6413)

This PR adds CI jobs to automatically build documentation for branches on the main repository and for pull request.
The first job builds the documentation for every push and pr and stores the generated documentation in cvc5.github.io/docs-ci. All versions are stored and for every branch and PR a symbolic link to the most recent version is maintained.
Note that the PR jobs are run by the pull_request_target trigger that allows access to repository secrets, but runs in the context of the target branch and we thus need to (carefully!) pull in the relevant changes manually.
The second job runs once a week and prunes the docs-ci repository: all directories that have not been touched for a month are removed, and all commits older than a month are squashed into a single commit. This retains the full history for the last month, but effectively removes everything older than that.

3 years agoSymFPU: Automatically apply patch from 2020-11-14. (#6471)
Aina Niemetz [Mon, 3 May 2021 17:48:06 +0000 (10:48 -0700)]
SymFPU: Automatically apply patch from 2020-11-14. (#6471)

This automatically applies @martin-cs's working patch from 2020-11-14.
It fixes several issues, all covered open issues are added as
regression tests.

Fixes #3582.
Fixes #5511.
Fixes #6164.

3 years agoPython API tests for terms -- Part 1 (#6468)
yoni206 [Mon, 3 May 2021 06:35:47 +0000 (23:35 -0700)]
Python API tests for terms -- Part 1 (#6468)

This PR removes the old python api tests for terms from test/api/python/test_term.py and replaces it with a new test file test/python/unit/api/test_term.py. The new test file is obtained by translating test/unit/api/term_black.cpp.

In this PR I only include the tests that pass without requiring any change to the python API. The next PR will add functions to the python API that are currently not supported, along with corresponding tests.

Comment: This was originally done in #6460 on the wrong fork. Now it is re-opened, and addresses all comments given there.

3 years agobv: Refactor ppAssert and move to TheoryBV. (#6470)
Mathias Preiner [Fri, 30 Apr 2021 22:15:44 +0000 (15:15 -0700)]
bv: Refactor ppAssert and move to TheoryBV. (#6470)

This PR refactors ppAssert from the lazy BV solver and moves it to TheoryBV.

3 years agoAdd parameter name for argument `isPreRewrite` for FP rewrites. (#6469)
Aina Niemetz [Fri, 30 Apr 2021 22:06:30 +0000 (15:06 -0700)]
Add parameter name for argument `isPreRewrite` for FP rewrites. (#6469)

3 years agoRefactor optimization result and objective classes + add preliminary support for...
Ouyancheng [Fri, 30 Apr 2021 21:40:49 +0000 (14:40 -0700)]
Refactor optimization result and objective classes + add preliminary support for multiple objectives (#6459)

This PR is one part of multiple.
Preliminary support means currently only supports single objective.
It supports queue-ing up objectives and it always optimizes the first.
Multiple-obj optimization algorithm will be up next.

*  Refactor optimization result and objective classes
*  Add preliminary support for multiple objectives
* The unit tests are now comparing node values instead of node addresses

3 years agoUse substitutions for implementing defined functions (#6437)
Andrew Reynolds [Fri, 30 Apr 2021 19:12:56 +0000 (14:12 -0500)]
Use substitutions for implementing defined functions (#6437)

This eliminates explicit tracking of defined functions, and instead makes define-fun add to preprocessing substitutions.
In other words, the effect of:

(define-fun f X t)
is to add f -> (lambda X t) to the set of substitutions known by the preprocessor. This is essentially the same as when
(= f (lambda X t)) was an equality solved by non-clausal simplification

The motivation for this change is both uniformity and for performance, as fewer traversals of the input formula.

In this PR:

define-fun are now conceptually higher-order equalities provided to smt::Assertions. These assertions are always added as substitutions instead of being pushed to AssertionPipeline.
Top-level substitutions are moved from PreprocessingContext to Env, since they must be accessed by Assertions. Proofs for this class are enabled dynamically during SmtEngine::finishInit.
The expandDefinitions preprocessing step is replaced by apply-substs. The process assertions module no longer needs access to expand definitions.
The proof manager does not require a special case of using the define-function maps.
Define-function maps are eliminated from SmtEngine.
Further work will reorganize the relationship between the expand definitions module and the rewriter, after which global calls to SmtEngine::expandDefinitions can be cleaned up. There is also further work necessary to better integrate theory expand definitions and top-level substitutions, which will be done on a followup PR.

3 years agoAdd assertion list utility for justification heuristic (#6414)
Andrew Reynolds [Thu, 29 Apr 2021 16:48:29 +0000 (11:48 -0500)]
Add assertion list utility for justification heuristic (#6414)

3 years agoSimplify generated code for getOption() and setOption() (#6462)
Gereon Kremer [Thu, 29 Apr 2021 16:20:36 +0000 (18:20 +0200)]
Simplify generated code for getOption() and setOption() (#6462)

This PR simplifies the generated code for Options::getOption() and Options::setOption(). It now uses less string streams, less temporary vectors and the new options[...] syntax (instead of options::...().

3 years agoAdd missing include. (#6463)
Gereon Kremer [Thu, 29 Apr 2021 13:49:20 +0000 (15:49 +0200)]
Add missing include. (#6463)

This PR fixes an issue with one of our nightlies.

3 years agoAvoid exponential explosion of small constant in CEGQI (#6461)
Gereon Kremer [Thu, 29 Apr 2021 12:38:19 +0000 (14:38 +0200)]
Avoid exponential explosion of small constant in CEGQI (#6461)

This PR fixes an issue that can lead to an exponential explosion of a rational constant for repeated calls to the cegqi instantiation strategy. The d_small_const variable was squared regularly, we now simply multiply it with its original value.

3 years agoFix BV Optimization Boundary Condition when lower bound = upper bound + 1 (#6452)
Ouyancheng [Wed, 28 Apr 2021 23:10:51 +0000 (16:10 -0700)]
Fix BV Optimization Boundary Condition when lower bound = upper bound + 1 (#6452)

If lb = ub + 1 then (lb+ub)/2 =pivot == lb since it's rounding to -infinity.
and lb <= x < pivot will always be UNSAT.
We need to handle this differently.
And this only happens in minimization.

3 years agoRefactor resource manager options (#6446)
Gereon Kremer [Wed, 28 Apr 2021 19:50:23 +0000 (21:50 +0200)]
Refactor resource manager options (#6446)

This PR refactors how the resource manager options are used. It moves options relevant for the resource manager into its own file (making the number of smt options a bit smaller) and uses the Options object directly instead of using the old static accessors.

3 years agoRemove exception headers from options.h (#6456)
Gereon Kremer [Wed, 28 Apr 2021 18:32:42 +0000 (20:32 +0200)]
Remove exception headers from options.h (#6456)

This PR removes two headers for exceptions from options.h, and instead pushes the includes to a couple of source files.

3 years agoMake sure reference stats are reset properly (#6457)
Gereon Kremer [Wed, 28 Apr 2021 18:01:15 +0000 (20:01 +0200)]
Make sure reference stats are reset properly (#6457)

This PR adds a reset() method to the ReferenceStat class. It then uses it to properly reset such statistics in the minisat solvers where lifetime is an issue.

3 years agoClean up options holder class (#6458)
Gereon Kremer [Wed, 28 Apr 2021 17:31:41 +0000 (19:31 +0200)]
Clean up options holder class (#6458)

This PR does some cleanup on the options class: it puts the option defaults into the member declaration and removes the explicit constructor; it puts the holder into a unique_ptr; it uses the regular struct copy operation instead of reconstructing the holder object; it moves some macros required for option defaults into the option holder header.
Also, this PR removes some obsolete code related to suggestions for typos.

3 years agoCleanup DidYouMean (#6454)
Gereon Kremer [Wed, 28 Apr 2021 14:42:17 +0000 (16:42 +0200)]
Cleanup DidYouMean (#6454)

This PR does a bit of cleanup on our didyoumean code.

3 years agoAdd internal support for datatype update (#6450)
Andrew Reynolds [Tue, 27 Apr 2021 22:32:40 +0000 (17:32 -0500)]
Add internal support for datatype update (#6450)

3 years agoMove slow regression to regress3 (#6451)
Andrew Reynolds [Tue, 27 Apr 2021 21:58:25 +0000 (16:58 -0500)]
Move slow regression to regress3 (#6451)

Benchmark is taking 40 seconds on production, due to the configuration that tests --check-unsat-cores.

3 years agoFix refutational soundness bug in quantifier prenexing (#6448)
Andrew Reynolds [Tue, 27 Apr 2021 21:25:11 +0000 (16:25 -0500)]
Fix refutational soundness bug in quantifier prenexing (#6448)

This bug can be triggered by define-fun, quantifier macros or inferred substitutions whose RHS contain quantified formulas.

This corrects the issue by ensuring that bound variables introduced for prenexing are fresh for distinct quantified formula subterms that may share quantified variables.

This was reported by Geoff Sutcliffe via a TPTP run.

3 years agoSimplify making function types (#6447)
Andrew Reynolds [Tue, 27 Apr 2021 20:53:37 +0000 (15:53 -0500)]
Simplify making function types (#6447)

Previously, we were conditionally checking whether a function was "flat" e.g. did not have a function type as the range type.

The original motivation for this was to catch cases where the user made a declare-fun that had function return type, which is not permitted. All these checks are already done at the API level https://github.com/CVC4/CVC4/blob/master/src/api/cpp/cvc5_checks.h#L441.

However, internally we should have no such restriction. This is required for simplifying the LFSC term processor.

3 years agoInitial setup for docs of python API (#6445)
Gereon Kremer [Tue, 27 Apr 2021 13:29:19 +0000 (15:29 +0200)]
Initial setup for docs of python API (#6445)

This PR adds the basic setup for including the python API in our sphinx documentation and shows how it works using the Datatype class as an example. In detail
- it enables sphinx.ext.autodoc and makes sure the generated pycvc5 is in the search path
- adds a index page for the python API
- adds a page for the Datatype class
- adds docstrings for the Datatype class
- does some finetuning (remove source locations, but adds signature information)

3 years agoUse std::hash for API types (#6432)
Gereon Kremer [Tue, 27 Apr 2021 05:31:58 +0000 (07:31 +0200)]
Use std::hash for API types (#6432)

This PR replaces all api::*HashFunction objects by specializations of std::hash. std::hash is meant to be extended in this way, and it allows for a much cleaner usage of std::unordered_set and std::unordered_map with these types.

3 years agoBool: Move implementation of type rules to cpp. (#6420)
Aina Niemetz [Tue, 27 Apr 2021 03:33:03 +0000 (20:33 -0700)]
Bool: Move implementation of type rules to cpp. (#6420)

3 years agoGenerate docs conf.py by cmake (#6441)
Gereon Kremer [Mon, 26 Apr 2021 20:48:40 +0000 (22:48 +0200)]
Generate docs conf.py by cmake (#6441)

This PR makes cmake generate the sphinx configuration file. This will simplify dynamically modifying this file in the future, for example to add custom paths within the build directory (for the python API).

3 years agoProtect int stats methods (#6442)
Gereon Kremer [Mon, 26 Apr 2021 20:16:27 +0000 (22:16 +0200)]
Protect int stats methods (#6442)

This PR protects two methods of the IntStat class in case statistics are disabled.

3 years agoFirst part of options refactoring (#6428)
Gereon Kremer [Mon, 26 Apr 2021 19:43:15 +0000 (21:43 +0200)]
First part of options refactoring (#6428)

This PR does a first round of refactoring and gets rid of a significant portion of generated code. In particular

- it removes options::optionName.wasSetByUser() (we still have Options::wasSetByUser())
- it removes options::optionName.set() (we still have Options::set())
- it removes options::optionName.getName() in favor of options::optionName.name
- it removes the specializations of Options::assign() and Options::assignBool() from the headers
- it eliminates runHandlerAndPredicates() and runBoolPredicates()

The removed methods are only used in few places with are changed to using Options::current().X() instead.

In the future, we also want to get rid of options::optionName() and use Options::operator[]() instead, and furthermore not use Options::current() but use the options from the Env object. This PR already adds Env::getOption() as a shorthand for Env::getOptions()[...] and uses it as a proof of concept within SmtEngine.

3 years agoFix theoryOf for Boolean equalities (#6444)
Andrew Reynolds [Mon, 26 Apr 2021 18:58:53 +0000 (13:58 -0500)]
Fix theoryOf for Boolean equalities (#6444)

Required for fixing a bug in CNF stream's ensureLiteral, which was crashing when combined with unsat-cores-mode=assumptions.

With this PR, we assign a formula like (= (= x y) (= z w)) to have theoryOf THEORY_BOOL. Previously, it mistaken was assigned THEORY_UF if e.g. x,y z, w were terms whose type was an uninterpreted sort.

We should retest unsat-cores-mode=assumptions after this PR is merged.

3 years agoNew design in DOT representation, nodes colored based on visions(basic and propositio...
Diego Della Rocca de Camargos [Mon, 26 Apr 2021 17:36:55 +0000 (14:36 -0300)]
New design in DOT representation, nodes colored based on visions(basic and propositional) (#6423)

Conclusion and rule are placed on the same node (records nodes in the dot format).
Nodes are colored based on the view they will belong to.

Signed-off-by: Diego Della Rocca de Camargos diegodellarocc@gmail.com
3 years agoEnsure dependency is tracked for all substitutions (#6438)
Andrew Reynolds [Mon, 26 Apr 2021 15:13:50 +0000 (10:13 -0500)]
Ensure dependency is tracked for all substitutions (#6438)

This ensures that dependencies are tracked for all inferred substitutions, even if a trusted step is added.

This is required to ensure unsat cores are sound when we use e.g. non-clausal simplification + unsat cores.

3 years agoEnable print-inst-full by default (#6435)
Andrew Reynolds [Mon, 26 Apr 2021 14:57:36 +0000 (09:57 -0500)]
Enable print-inst-full by default (#6435)

This makes dump-instantiations print instantiations for all quantified formulas by default, regardless of whether they had an associated identifier.

3 years agoFix assertions in SAT solver (#6443)
Haniel Barbosa [Mon, 26 Apr 2021 14:46:56 +0000 (11:46 -0300)]
Fix assertions in SAT solver (#6443)

Due to our recent changes in the unsat core infrastructure we were doing a couple assertions wrong during conflict analysis. This commit fixes them.

3 years agoDo not process looping word equations over sequences (#6434)
Andrew Reynolds [Mon, 26 Apr 2021 07:34:14 +0000 (02:34 -0500)]
Do not process looping word equations over sequences (#6434)

3 years agoUse fast enumeration by default for Boolean predicate synthesis (#6440)
Andrew Reynolds [Sun, 25 Apr 2021 20:05:15 +0000 (15:05 -0500)]
Use fast enumeration by default for Boolean predicate synthesis (#6440)

This updates the policy of when to apply smart enumeration: we do so if the grammar has ITE or admits Boolean connective terms. Previously, we applied smart enumeration for ITE and all Boolean grammars. However, this is misguided since e.g. partial evaluation unfolding has no opportunity to be effective if the enumerated terms are only Boolean literals.

This significantly improves run time on a challenge benchmark from @makaimann.

3 years agoMore check models (#6439)
Andrew Reynolds [Sun, 25 Apr 2021 19:56:01 +0000 (14:56 -0500)]
More check models (#6439)

3 years agoImprove getValue for non-evaluated operators (#6436)
Andrew Reynolds [Sat, 24 Apr 2021 01:45:01 +0000 (20:45 -0500)]
Improve getValue for non-evaluated operators (#6436)

This makes it so that we attempt evaluation + rewriting on applications of operators that do not always evaluate, and return constants in case the evaluation was successful.

This fixes warnings for check-models on 43 of our regressions, and also uncovered one regression where our model was wrong but check-models silently succeeded. I've opened CVC4/cvc4-projects#276 for fixing the latter.

3 years agoAdd assumption-based unsat cores. (#6427)
Mathias Preiner [Sat, 24 Apr 2021 00:57:35 +0000 (17:57 -0700)]
Add assumption-based unsat cores. (#6427)

This PR adds an assumption-based unsat cores option. If enabled it will
disable proof logging in the SAT solver and adds input assertions as
assumptions to the SAT solver. When an unsat core is requested we
extract the unsat core in terms of the unsat assumption in the SAT
solver. Assumption-based unsat cores use the proof infrastructure to map
the input assumptions back to the original assertions.

3 years agoAdd missing dependency for CaDiCaL (#6431)
Gereon Kremer [Fri, 23 Apr 2021 21:50:02 +0000 (23:50 +0200)]
Add missing dependency for CaDiCaL (#6431)

This PR adds the dependency of the CaDiCaL cmake target on the external project CaDiCaL-EP if it is not found in the system.

3 years ago(proof-new) Proofs for sets purification lemmas (#6416)
Andrew Reynolds [Fri, 23 Apr 2021 20:44:39 +0000 (15:44 -0500)]
(proof-new) Proofs for sets purification lemmas (#6416)

This adds proofs for sets purification lemmas, which are of the form (= t (skolem t)) and (member t (skolem (singleton t))). Each can be trivially justified in the internal calculus by MACRO_SR_PRED_INTRO.

3 years agoAdd new substitution apply methods fixpoint, sequential, simultaneous (#6429)
Andrew Reynolds [Fri, 23 Apr 2021 18:31:37 +0000 (13:31 -0500)]
Add new substitution apply methods fixpoint, sequential, simultaneous (#6429)

This adds various methods for applying substitution as an options to MACRO_SR_* rules. It extends the proof checker and the proof post processor to eliminate based on these types.

It updates the trust substitutions utility used by non-clausal simplification to use fixed-point semantics for substitution, which is highly important for efficiency.

As a result of this PR, we are orders of magnitude faster for checking proofs for problems where non-clausal substitution infers many substitutions. It also makes our regressions noticeably faster:

3 years agoMake sure a ReferenceStat is set to values of the correct type (#6430)
Gereon Kremer [Fri, 23 Apr 2021 13:46:52 +0000 (15:46 +0200)]
Make sure a ReferenceStat is set to values of the correct type (#6430)

This PR fixes a very subtle issue with setting the values a ReferenceStat refers to.
ReferenceStat::set() would take a variable by const& and then store the pointer to it. When giving it a different, but implicitly convertible, type, the pointer would assume the wrong type and consequently read incorrect values from it.
This PR makes set() a template function that explicitly checks that the given type is the correct one.
As we can only export int64_t to the API, this forces users of ReferenceStat to use int64_t stats.

3 years agoEnable strings exp by default for strings specific logics (#6424)
Andrew Reynolds [Fri, 23 Apr 2021 02:18:13 +0000 (21:18 -0500)]
Enable strings exp by default for strings specific logics (#6424)

One of the main motivations for this PR is to simplify our process for doing SMT-LIB wide runs.

3 years agoBV: Add proof logging for bit-blasting. (#6373)
Aina Niemetz [Fri, 23 Apr 2021 01:19:05 +0000 (18:19 -0700)]
BV: Add proof logging for bit-blasting.  (#6373)

3 years agoMove implementation of UF rewriter to cpp (#6393)
Andrew Reynolds [Fri, 23 Apr 2021 00:06:10 +0000 (19:06 -0500)]
Move implementation of UF rewriter to cpp (#6393)

3 years agoMake trust substitution map generate proofs lazily (#6379)
Andrew Reynolds [Thu, 22 Apr 2021 22:53:15 +0000 (17:53 -0500)]
Make trust substitution map generate proofs lazily (#6379)

This is work towards addressing a bottleneck when generating proofs for substitutions from non-clausal simplification.

This makes the proof generation in trust substitution map lazy.

Further work is required to allow an alternative fixpoint semantics for substitutions in the proof checker instead of the current sequential one.

3 years agoMinor improvements to substitutions (#6380)
Andrew Reynolds [Thu, 22 Apr 2021 22:36:02 +0000 (17:36 -0500)]
Minor improvements to substitutions (#6380)

In preparation for using this class as part of our proof checker.

This removes an option that was previously used as a hack to try to make check-models work for quantifiers. It also makes supplying a context optional.

3 years agoMinor changes to unsat core default setting (#6425)
Andrew Reynolds [Thu, 22 Apr 2021 21:03:08 +0000 (16:03 -0500)]
Minor changes to unsat core default setting (#6425)

3 years agocmake: Do not require --auto-download for already downloaded dependencies. (#6417)
Mathias Preiner [Thu, 22 Apr 2021 20:22:36 +0000 (13:22 -0700)]
cmake: Do not require --auto-download for already downloaded dependencies. (#6417)

This will look for already downloaded dependencies in the build
directory and therefore will not require --auto-download if the
dependencies were already downloaded in a previous build.

3 years agoUpdate INSTALL.md (#6412)
Gereon Kremer [Thu, 22 Apr 2021 19:55:41 +0000 (21:55 +0200)]
Update INSTALL.md (#6412)

This PR updates our build and installation instructions in INSTALL.md after we have changed how we handle dependencies.
Thanks @polgreen / #6391.

3 years agoAdd API documentation for statistics (#6364)
Gereon Kremer [Thu, 22 Apr 2021 19:38:57 +0000 (21:38 +0200)]
Add API documentation for statistics (#6364)

This PR adds documentation for api::Statistics and api::Stat, as well as further explanations in sphinx.
It also adds a custom css to our sphinx theme that slightly changes how inline code blocks look.

3 years agoRemove unused stuff from options setup (#6422)
Gereon Kremer [Thu, 22 Apr 2021 19:27:54 +0000 (21:27 +0200)]
Remove unused stuff from options setup (#6422)

This PR removes some old stuff from our options setup that has not been used in a long time.
Most prominently, this includes the man pages that were still generated, and the alias and links options, which no longer worked anyway.

3 years ago Reorganizing use of skolem definition manager in prop engine (#6415)
Andrew Reynolds [Thu, 22 Apr 2021 19:12:23 +0000 (14:12 -0500)]
 Reorganizing use of skolem definition manager in prop engine (#6415)

Towards setting up the proper callbacks into the new justification heuristic.

Moves ownership of skolem definition manager from TheoryProxy to PropEngine.

3 years agoapi docs: Rename doxygen output directory. (#6426)
Aina Niemetz [Thu, 22 Apr 2021 17:46:04 +0000 (10:46 -0700)]
api docs: Rename doxygen output directory. (#6426)

3 years agoapi docs: Remove file reintroduced in past merge. (#6426)
Aina Niemetz [Thu, 22 Apr 2021 17:20:36 +0000 (10:20 -0700)]
api docs: Remove file reintroduced in past merge. (#6426)

3 years agoFix models for sygus-inference, bv2int, real2int (#6421)
Andrew Reynolds [Thu, 22 Apr 2021 15:02:05 +0000 (10:02 -0500)]
Fix models for sygus-inference, bv2int, real2int (#6421)

In each case, previously we were generating a define-fun, what we needed was to do a model substitution.

This actually meant that check-models was giving false positives. The model was incorrect but check-models succeeded due to its use of expand definitions.

3 years agoReconciling proofs and unsat cores (#6405)
Haniel Barbosa [Thu, 22 Apr 2021 14:33:38 +0000 (11:33 -0300)]
Reconciling proofs and unsat cores (#6405)

This commit changes how defaults are set and how the SMT solver is initialized so that proofs can be used fully with (new) unsat cores. Three modes of unsat cores are established now:

the upcoming assumption-based cores, which are incompatible with producing proofs (but enable proofs for preprocessing)
cores based on the SAT proof, which are incompatible with producing proofs (but enable proofs for preprocessing and the SAT solver)
cores based on the full proof, which are unrestricted
All the modes activate proofs but lead to errors if the user requires proofs but is not in the full proofs mode for cores.

3 years agoAllow in-place construction of `CDList` items (#6409)
Andres Noetzli [Thu, 22 Apr 2021 03:25:57 +0000 (20:25 -0700)]
Allow in-place construction of `CDList` items (#6409)

This commit adds CDList::emplace_back(), which allows users to create
elements in CDList in-place (as opposed to copying the items using
CDList::push_back(). This allows CDList to be used with
std::unique_ptrs, which do not allow copying. Using
CDList::emplace_back() could also be more efficient in certain cases.

3 years agoMove expand definition from Theory to TheoryRewriter (#6408)
Andrew Reynolds [Thu, 22 Apr 2021 02:42:08 +0000 (21:42 -0500)]
Move expand definition from Theory to TheoryRewriter (#6408)

This is work towards eliminating global calls to getCurrentSmtEngine()->expandDefinition.

The next step will be to add Rewriter::expandDefinition.

3 years agoArithmetic: Move implementation of type rules to cpp. (#6419)
Aina Niemetz [Wed, 21 Apr 2021 22:57:49 +0000 (15:57 -0700)]
Arithmetic: Move implementation of type rules to cpp. (#6419)