67 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
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
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
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
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
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
Andrew Reynolds
1d62c72ff5 Add learned literal types to the API (#8990)
Also changes the name of the enum for now to have a prefix, since we are not using enum classes.

Furthermore this excludes true from being a preprocessed learned literal.
2022-08-03 01:33:56 +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
Andrew Reynolds
a2f5753469 Preserve types in rewriter and make core type rules strict (#8740)
This is the key step for eliminating the use of subtyping.

This makes several changes:
(1) CONST_INTEGER is now used for integer constants, which is now exported in the API. The type rule for CONST_RATIONAL is changed to always return Real, even if its value is integral. This means we can distinguish real and integer versions of the integers. Note this also implies that the rewriter now fully preserves types, as rewriting TO_REAL applied to a constant integer will return a constant integral rational.
(2) The type rules for EQUAL, DISTINCT, ITE and APPLY_UF are made strict, in other words, we given a type exception for equalities between an Int and a Real. This restriction impacts the API.
(3) The arithmetic rewrite for (Real) equality casts integers to reals as needed to ensure Reals are only made equal to Reals. The net effect is that TO_REAL may appear on either side of equalities.
(4) The core arithmetic theory solver is modified in several places to be made robust to TO_REAL occurring as the top symbol of sides of equality.

Several assertions are strengthened or added to ensure that equalities and substitutions are between terms of the same type, when it is necessary to do so.

Two quantifiers regressions are modified since the solving techniques are not robust to TO_REAL. A few unit tests are fixed to use proper types.
2022-05-12 17:48:27 +00:00
Gereon Kremer
fe939c31bd Fix some issues with the Python API tests (#8746)
This PR addresses a few issues in the Python API:
    the implementation of defineFunsRec() lacked the call to the C++ function
    a bunch of tests for defineFunsRec() were missing
    the test for getInstantiations() was incorrectly named and thus not valled.
    add missing test for hashing of Sort
2022-05-10 17:47:52 +00:00
Andrew Reynolds
9058998bfe Add unit tests for getInstantiations (#8741) 2022-05-09 10:05:28 -07:00
Gereon Kremer
79cf93488f Add missing tests for some corners of the API (#8688)
This PR adds a bunch of unit tests for some not yet covered corners of the API.
2022-05-02 21:08:58 +00:00
Andrew Reynolds
f6034c8ede Properly represent Tuples in the TypeNode AST (#8648)
This makes it so that Tuple types are properly represented in the AST. It also removes a spurious restriction that disallowed higher-order tuples (this was leftover from a very old sanity check in the old API).

For example, a tuple type over (Int, Int) is now (TUPLE_TYPE INT INT) instead of a DATATYPE_TYPE constant.

Tuple types behave exactly like datatypes; we can still retrieve their DType as before.

This is in preparation for gradual types and symbolic tuple projections.
2022-04-29 21:49:13 +00:00
Mathias Preiner
d01e59c13b Update copyright headers for release 1.0 (#8539) 2022-04-05 20:38:57 +00:00
Andrew Reynolds
df6ce0361d Rename mkSygusGrammar to mkGrammar (#8544) 2022-04-02 19:40:41 +00:00
Andrew Reynolds
40910fb3c6 Remove variant of mkDatatypeDecl with one sort parameter (#8543)
Subsumed by the vector version.

Also marks more methods as experimetnal.
2022-04-02 19:21:46 +00:00
Aina Niemetz
5dcb750667 api: Rename get(Selector|Constructor)Term() to getTerm(). (#8537) 2022-04-02 18:57:50 +00:00
Aina Niemetz
93247764b8 api: Remove DatatypeConstructor::getSelectorTerm(). (#8535) 2022-04-02 01:53:15 +00:00
Gereon Kremer
12c29b4db5 Simplify the python base API in a few places (#8514)
This PR simplifies a few methods in the python base API.
2022-04-01 23:53:33 +00:00