56 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
6007962d5e Add test coverage for almost everything from the Java API (#8723)
This PR adds tests for almost everything that is not yet covered by the java API tests.
2022-05-10 14:55:44 +00:00
Andrew Reynolds
9058998bfe Add unit tests for getInstantiations (#8741) 2022-05-09 10:05:28 -07: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
72fd917fcd Add unit test for code not exposed by java API (#8678)
This PR adds a C++ unit test that explicitly calls into API functions that are not exposed by the java 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 java API.
It also corrects a few other minor issues.
2022-04-29 03:21:12 +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
mudathirmahgoub
ffe428bb7f Remove java API methods that accepts lists as arguments (#8541)
This PR removes some unnecessary methods in the Java API that were added to simplify several unit tests that use dynamic arrays. The goal is to make the java API consistent and as small as possible.
Users could use asList, toArray methods to use generic lists if they wish.
2022-04-02 00:40:47 +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
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
Andres Noetzli
c93de62d8b Move Java package to io.github.cvc5 (#8469)
Previously, we were using io.github.cvc5.api to mirror the C++
namespace that the API was in. The namespace of the C++ API changed to
simply cvc5 and so this commit updates the Java package accordingly.
2022-03-31 04:09:03 +00:00
mudathirmahgoub
c56a361253 Patch cross reference in Kind.java documentation (#8458)
This PR patches cross reference links in Kind.java comments for now until a proper way is implemented that handles documentation for cpp, python and Java API.
2022-03-30 21:58:08 +00:00
Andrew Reynolds
4eac250cf2 Change tuple tokens and update datatypes theory ref (#8420)
Changes tuple_ to tuple. for consistency.

Also fixes the lexer list for smt2 and updates the datatypes theory reference with missing content.
2022-03-30 04:39:29 +00:00
mudathirmahgoub
69643856df Fix some documentation warnings (#8453) 2022-03-30 03:15:58 +00:00
Mathias Preiner
bbcd471ed4 Introduce internal namespace and remove api namespace. (#8443)
The public cvc5 API now lives in the cvc5 namespace. All internal parts were moved into the (new) internal namespace.
The final hierarchy will be as follows:

cvc5
  ~~ public API
  ::context
  ::internal
  ::parser
  ::main

After this PR it will be:

cvc5
  ~~ public API
  ::internal
      ::context
      ::main
  ::parser
2022-03-29 23:23:01 +00:00
Andres Noetzli
bf2d64336c Move RoundingMode to cvc5_types.h (#8427)
This moves RoundingMode to cvc5_types.h and switches to using the
auto-generated enum bindings. It also fixes the Java-bindings generator
for enums (certain parts were previously hardcoded for Kind) and
extends the unit tests for Solver::mkRoundingMode() to actually check
the value being created.
2022-03-29 01:13:46 +00:00
Mathias Preiner
8ae907ba48 Rename get-interpol to get-interpolant. (#8424) 2022-03-28 15:30:19 -07:00