138 Commits

Author SHA1 Message Date
Andrew Reynolds
00e19fdbe2 Minor improvements to difficulty manager (#9510)
We now track difficulty on lemmas themselves, which can potentially used as a heuristic for measuring the usefulness of lemmas.

This also makes it so that all literals in lemmas are used for incrementing difficulty.
2023-03-08 21:36:44 +00:00
Mathias Preiner
56e14c4639 Move public headers into top-level include directory. (#9555)
This PR moves the public API headers into a top-level include directory. This makes it easier to find the public API of cvc5 and makes the install headers script obsolete.

Fixes #9553
Fixes #9556
2023-03-07 23:39:29 +00:00
mudathirmahgoub
9a20c372b0 Expose sygus assumptions and constraints to the api (#9471) 2023-02-02 21:08:28 +00:00
Andrew Reynolds
25d781fc96 Do not use null sort as dummy for empty set and bag (#9469)
This is incompatible with forthcoming changes to the type checker where the null type node means "not well typed".
2023-01-27 20:48:08 +00:00
Andrew Reynolds
3f30adabe9 Add tests for uncovered API methods for abstract sorts (#9430) 2023-01-20 19:17:50 +00:00
Andrew Reynolds
b3fbf9afcc Add infrastructure and API for abstract sorts (#9263)
Adds necessary API methods for supporting abstract sorts in the cpp, java, python APIs.

An abstract sort represents a class of sorts. It is parameterized by a kind. For example, the abstract sort parameterized by the kind BITVECTOR_SORT denotes bitvectors of unspecified bit-width.

To support the above functionality, the kinds of Sort must be exported in the API, which is done in this PR.

This is the first step towards supporting the rewrite DSL for parameterized sorts, and planned SyGuS extensions that use gradual typing.
2023-01-17 19:37:10 +00:00
Alex Ozdemir
368f3c3ed6 ff: connect sub-theories to main solver & test (#9218)
Organizing the PR a bit:

we hook up the subtheories to TheoryFf
we expose FF-related things via the C++/Pytohn API and SMT-LIB2 interface.
we add a bunch of tests against these interfaces.
2022-12-16 16:36:41 +00:00
Andrew Reynolds
927eb940d2 Use separate subsolver for synthesizing rewrite rules from input (#9237)
This experimental option causes cvc5 to synthesize rewrite rules based on the input. The code for this is a preprocessing pass which used to rewrite the input to a sygus conjecture. This is confusing since it changes the semantics of the input. We now call a separate subsolver.

This also cleans up set defaults. The options required for synthesizing rewrite rules are now applied locally to the subsolver spawned by the preprocessing pass.

We now terminate with an exception in the rare case when rewrite rule synthesis terminates.

This is required for further enhancements to the sygus solver for answering infeasible.
2022-10-27 16:35:58 +00:00
Andrew Reynolds
4df373ae99 Allow SyGuS solver to answer infeasible (#9196)
Due to previous refactoring, the SMT solver called by the SyGuS solver no longer answers unsat when the synthesis problem has a valid solution.

This PR makes it so that unsat from the underlying SMT solver is now interpreted as "infeasible" and is officially returned as such by the SyGuS solver. Note that we return unsat when e.g. a CEGIS refinement lemma is equivalent to false. On the other hand, we do not yet answer unsat when we run out of terms (e.g. for finite grammars), as this is still guarded. A followup PR will address this.

To make the SMT solver answer unsat for infeasible conjectures, we do not guard CEGIS lemmas with the "feasible guard", instead we use the conjecture itself, similar to quantifier instantiation lemmas.

This further removes the "feasible guard" from the internal sygus solver, which was used as a way to prevent unsat due to the infeasibility of CEGIS refinement lemmas.
2022-10-13 15:56:55 +00:00
mudathirmahgoub
590af04a10 Remove reference to solver from java objects (#9147) 2022-10-04 17:06:02 +00:00
Andres Noetzli
bc6968a19d Better error checking for indices of to_fp (#9142)
Fixes #9140. Instead of crashing with an assertion error during the
creation of the operator, the commit introduces error checks at the API
level to ensure that the indices are `> 1` as required by the SMT-LIB
standard.

It also fixes our error check for `mkFloatingPointSort` to ensure that
the exponent and the significand length are both greater than one as
required by the SMT-LIB standard.
2022-09-24 01:59:29 +00:00
Aina Niemetz
dd767fe0b8 api: Associate nullary constructors with currentNM(). (#9161)
This makes Solver::getNullarySort() obsolete and refactors everything
related to this function on the C++ and Python level. We still have to
keep it (temporarily) in the C++ API until the Java API is also
refactored accordingly.
2022-09-23 15:53:32 -07:00
Andres Noetzli
da5ebd397a Fix computation of cardinality class (#9139)
Fixes cvc5/cvc5-projects#435. To compute the cardinality class of constructors, we compute the maximum of the cardinality of the arguments. However, we considered the result of max(INTERPRETED_ONE, FINITE) to be FINITE. This is not accurate when finite model finding is turned off. This led to issues in the sequences solver, because we considered a constructor with an argument of an uninterpreted sort as finite and tried to retrieve that cardinality. This commit fixes the issue by making the result of max(INTERPRETED_ONE, FINITE) be FINITE_INTERPRETED.

Note in the original issue, the following assertion failure:

Fatal failure within void cvc5::Minisat::Solver::pop() at src/prop/minisat/core/Solver.cc:1971
Check failure

 decisionLevel() == 0
occurred because of an IllegalArgumentException was being thrown (calling Cardinality::getFiniteCardinality() on a sort with an non-finite cardinality). This exception then lead to an unexpected decision level (similar to the issue with uncaught TypeCheckingExceptionPrivate exceptions fixed in c4be9f5). There is an on-going effort to get rid of IllegalArgumentException, so it is not worth adding a fix for this. For example, commit
f8306b2 changed the code in cardinality.cpp that was throwing the exception in this case.
2022-09-19 14:48:18 +00:00
Andrew Reynolds
c0f7d8b015 Fixes for API coverage (#9124)
Fixes issue in API coverage build for nightlies.

Also adds a missing print function for block models mode.
2022-09-14 07:43:21 +00:00
Aina Niemetz
85f62cb40c api: Add getVersion(). (#9093)
This adds support for querying the version string of the solver via the API.
2022-08-30 12:04:04 -07:00
Aina Niemetz
6552114986 api: Move well-foundedness guard of DT from parser to API. (#9074)
Fixes cvc5/cvc5-projects#527.
2022-08-23 19:38:25 +00:00
Andrew Reynolds
16c99817ff Fix for API guarding of double use of DatatypeDecl (#9028)
The method DatatypeDecl::isResolved() was not accurate, nor was it being checked in cvc5_checks.h when constructing multiple datatypes.

Fixes cvc5/cvc5-projects#522.
2022-08-23 15:56:47 +00:00
Aina Niemetz
475ecd13e9 Use assertions instead of (Pretty)CheckArgument in expr and smt. (#9065)
This is in preparation for getting rid of IllegalArgumentException.
This exception was originally used for guards in the old API and is now
obsolete.
2022-08-23 09:07:29 -05:00
Andrew Reynolds
9669fed459 Add Proof components to the API (#9030)
Also adds a no argument version of getLearnedLiterals to Java, for consistency.
2022-08-05 18:00:05 +00:00
Aina Niemetz
ec5e78f730 api: Refactor sort and term (like) objects to not depend on Solver. (#9020)
This refactors Sort, Term, Op and datatype objects to not maintain a
reference (and depend) on Solver, but an associated NodeManager. This
allows to share node managers between solver instances.
2022-08-03 10:15:50 -05:00
mudathirmahgoub
17d5e26a9a Add rel.project operator to sets (#8929) 2022-07-06 21:02:23 +00:00
mudathirmahgoub
a0b4c2bc73 Avoid quoting symbols already surrounded with vertical bars (#8896)
This PR fixes the issue of replacing bars with underscores in already quoted symbols.
For example previously this line would print |_a _|

std::cout << d_solver.declareFun("|a |", {}, d_solver.getRealSort()); 
Now it prints |a |.
2022-06-22 16:30:14 -05:00
Andrew Reynolds
4da459b5be Add declareOracleFun to API (#8794)
Java and Python will be added in followup PRs.
2022-05-24 14:07:42 +00:00
Ying Sheng
3690b354b4 Add getInterpolant with a grammar in the unit test for all language bindings (#8775)
Add getInterpolant with a grammar in the unit test for all language bindings
2022-05-17 13:40:32 +00:00
Andrew Reynolds
9fe8509ed9 Last remaining fixes for eliminating subtyping (#8772)
Also fixes a debug failure for the nightlies.

This also changes mkTuple to not rely on subtyping (this method should regardless be deleted from our API, as it is not the recommended way of constructing tuples).
2022-05-16 22:46:41 +00:00