120 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
Vinícius Camillo
1fc0f6416f Fixed CI actions on macOS. (#9448)
I increased cmake's minimum version in order to use the FindPython module, which allows the build system to specify python versions that are supported. Currently the support is extended to 3.6 through 3.10. I also removed some backward compatible conditions that do not apply anymore provided that cmake's minimum version is guaranteed to be 3.12.

MacOS builds are reenabled in ci.yml.
2023-01-24 19:01:36 +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
2f62d612ce fix ff coverage (#9381) 2023-01-05 15:43:49 -06: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
Mathias Preiner
dad5fa360f test: Fix Python uncovered test for declareOracleFun. (#9191)
This fixes the nightly coverage tests for the Python API.
2022-10-04 21:26:23 +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
Andrew Reynolds
3510b1feca Apply oracle function in uncovered python unit test (#9152) 2022-09-20 12:37:01 -05: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
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
mudathirmahgoub
17d5e26a9a Add rel.project operator to sets (#8929) 2022-07-06 21:02:23 +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