99 Commits

Author SHA1 Message Date
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
a3e8a80434 Add test coverage for almost everything from the Python API (#8720)
This PR adds tests for almost everything that is not yet covered by the python API tests.
2022-05-05 20:54:48 +00:00
Gereon Kremer
3db254027b Make printStatisticsSafe public (#8721)
Solver::printStatisticsSafe() is private right now. There is no real reason for that, and as we claim that the driver is only using the regular API we should just make it public.
2022-05-04 17:21:41 +00: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
Gereon Kremer
08c26d6fe7 Add unit test for code not exposed by python API (#8677)
This PR adds a C++ unit test that explicitly calls into API functions that are not exposed by the python API. This fixes the issue of false positives in our API coverage checks, as some parts of the C++ API are legitimately not used by the python API.
2022-04-29 01:09:03 +00:00
Gereon Kremer
13d891a718 Add some missing API tests (#8669)
This PR adds a couple of simple API tests for parts of the API that are not covered yet.
2022-04-29 00:47:10 +00:00
Mathias Preiner
d01e59c13b Update copyright headers for release 1.0 (#8539) 2022-04-05 20:38:57 +00:00
Andrew Reynolds
73a4978e53 Rename getInstantiatedConstructorTerm to getInstantiatedTerm (#8549)
This is in line with the change for non-parametric constructors (getConstructorTerm -> getTerm).

Also adds documentation to make the use of constructors, selectors, testers, updaters more clear.
2022-04-04 18:35:38 +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
Andrew Reynolds
430c11f879 Simplifications to the datatypes API (#8511)
This PR makes it so that common users of the datatypes API do not need to use "unresolved" datatypes sorts. Instead, these are automatically inferred by the NodeManager when calling mkMutualDatatypeTypes.

API Changes:
(1) adds addSelectorUnresolved to DatatypeConstructorDecl, which is the sole method needed to specify ordinary recursive selectors.
(2) adds to unit test examples that use this variant instead of using unresolved sorts.
(3) the API method mkUnresolvedSort is renamed to mkUnresolvedDatatypeSort and is marked experimental.

Note that unresolved datatype sorts are still needed to support mixed parametric datatypes and nested recursive datatypes in the smt2 parser, so they cannot be deleted yet.

Followup PR will add to documentation on elaborate further on how to use the datatypes API.
2022-04-01 23:23:18 +00:00
Aina Niemetz
a735215651 api: Remove Datatype::getConstructorTerm(). (#8529) 2022-04-01 21:36:07 +00:00
Aina Niemetz
506a7b8c4a Python API: Do not rename enumerators. (#8507)
Co-authored-by: Mathias Preiner <mathias.preiner@gmail.com>
Co-authored-by: mudathirmahgoub <mudathirmahgoub@gmail.com>
Co-authored-by: Gereon Kremer <gkremer@stanford.edu>
2022-04-01 19:45:36 +00:00
Gereon Kremer
a7779de22d Remove decorator from python API (#8505)
This PR removes the expand_list_arg decorator from the python API. It was used to allow calling a function f(x, *args) with a list as second argument and automatically expand the list into *args. While it merely allows for calling f(x, l) instead of f(x, *l), it adds considerable complexity to the code and documentation. Thus, following the Zen of python (have only one way to do it) we remove this decorator. This is also consistent with the pythonic API, were we made the same decision.
2022-04-01 16:58:00 +00:00
Andres Noetzli
f02847cdee [API] Add mode argument for Solver::blockModel() (#8521)
This commit changes Solver::blockModel() to take a mode as an argument
instead of relying on an option.
2022-04-01 16:26:14 +00:00
Mathias Preiner
8d7787f310 api: Swap arguments of declareSygusVar. (#8499)
Make it consistent with other declare*/define* functions.
2022-04-01 01:32:44 +00:00
Mathias Preiner
467c95cffb api: Use std::optional for symbols in mk* functions. (#8495)
Makes all symbols in mk* functions optional.
2022-04-01 01:10:29 +00:00