26 Commits

Author SHA1 Message Date
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
Andrew Reynolds
f4176a5d4f Proper memory management of parsed commands (#9511) 2023-03-07 17:40:06 +00:00
Andrew Reynolds
eabeb34e89 Bind declarations and definitions only when commands are invoked (#9355)
This corrects issues in our parser related to when symbols should be added to our symbol table.

In particular, symbols should be bound only when commands are executed and not as they are parsed. Binding during parsing leads to errors in interactive mode where those symbols are bound more than once, say if a command is partially parsed and then re-parsed based on our line buffering. This required further modifications to the interactive shell to execute commands immediately as they are parsed, since executing them may impact parsing (say if a declare-fun was on the same line as the subsequent command).

This adds new methods for accessing the binding methods of the underlying symbol table of symbol manager.

There are further issues of this form to correct, e.g. for define-fun-rec, which will be addressed in a separate PR.
2023-01-05 21:12:37 +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
ee97e826a5 Decouple parser state from ANTLR specific parsing (#9312)
This renames Smt2 and Tptp to Smt2State and TptpState, and decouples their implementation from ANTLR specific parsing. The Smt2State will be reused in the new flex parser.

It introduces ANTLR-specific wrappers of these classes (called by their previous names Smt2 and Tptp to avoid propagating further name changes), having the same functionality for parsing.

Followup PRs will clean Smt2State / TptpState and move them to smt2_state.h / tptp_state.h.
2022-12-13 17:25:32 -06: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
Andres Noetzli
66d374cd5c Move Command infrastructure to parser (#8893)
This commit moves the `Command` infrastructure to the parser (to
`src/parser/api/cpp`) and moves it to the `cvc5::parser` namespace. The
`Command`-related files are compiled with `-D__BUILDING_CVC5LIB`,
because they need access to the internal printers. The commit refactors
the internal code to not depend on `Command` anymore. To do this, the
commit refactors printing derived classes of `CommandStatus` to follow a
similar structure to printing commands (so that we can also print
command statuses internally without creating instances of
`Commandstatus`). This is a step towards a parser API.
2022-09-16 18:57:55 -07:00
yoni206
6fefd71563 Dismissing a redundant assertion (#9118)
solves cvc5/cvc5-projects#418.
This assertion is redundant: we just pass the old kind while the children were not converted.
2022-09-06 08:19:55 -05:00
Andrew Reynolds
e8c3db9e0e Use STRING_NTH in strings reductions and eliminate STRING_TO_CODE (#8851)
This updates our string reductions for `to_lower`, `to_upper`, `from_int`, `to_int` to use STRING_NTH instead of STRING_TO_CODE applied to STRING_SUBSTR.

It optionally replaces STRING_TO_CODE with STRING_NTH during preprocessing (true by default).

This is work towards efficient support for `to_lower`/`to_upper`.
2022-06-07 00:49:15 +00:00
Andrew Reynolds
42e503ba7d More preparation for strict type rules (#8733)
This is work towards making equalities and substitutions between terms of equal types.
2022-05-07 02:22:12 +00:00
Gereon Kremer
9dc2d55ce2 Move tests around (#8670)
This PR moves two tests that dealt with particular issues out of unit/api/cpp (which should only have generic unit tests). They are now in unit/theory and api/cpp/.
2022-04-28 18:30:46 +00:00
Mathias Preiner
d01e59c13b Update copyright headers for release 1.0 (#8539) 2022-04-05 20:38:57 +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
Mathias Preiner
cc808da53d api: Unify mkOp variants. (#8369)
Co-authored-by: Gereon Kremer <nafur42@gmail.com>
2022-03-25 23:57:10 +00:00
Mathias Preiner
4a58ed7daf api: Unify mkTerm variants. (#8357) 2022-03-22 00:22:41 +00:00
Andrew Reynolds
2f1483e2e3 Remove unecessary methods from the API (#8260)
Removes checkEntailed from Solver.
Removes isEntailed, isNotEntailed, isEntailedUnknown from Result.
Removes isSubsortOf, isFunctionLike, getUninterpretedSortName, getSortConstructorName from Sort.

Updates examples and unit tests.
2022-03-14 18:29:30 +00:00
Andrew Reynolds
27b4722406 Always ensure literal when requiring phase via inference manager (#8292)
Also to be safe, ensures we clear pending in quantifiers engine.

Fixes cvc5/cvc5-projects#484.
2022-03-12 00:26:37 +00:00
Andrew Reynolds
444a2f493e Add unit for fixed project issue (#8253)
Fixes cvc5/cvc5-projects#377.

Was not able to reproduce this on master.
2022-03-08 02:53:18 +00:00
Aina Niemetz
f33c9b608b FP: Rename tester kinds. (#8037)
This renames FP tester kinds for consistency:
FLOATINGPOINT_ISINF -> FLOATINGPOINT_IS_INF
FLOATINGPOINT_ISN -> FLOATINGPOINT_IS_NORMAL
FLOATINGPOINT_ISNAN -> FLOATINGPOINT_IS_NAN
FLOATINGPOINT_ISNEG -> FLOATINGPOINT_IS_NEG
FLOATINGPOINT_ISPOS -> FLOATINGPOINT_IS_POS
FLOATINGPOINT_ISZ -> FLOATINGPOINT_IS_ZERO
2022-02-04 15:01:42 +00:00
Andres Noetzli
f25aa7f135 [Rewrite Synthesis] Fix args for non-chaining ops (#7996)
Fixes https://github.com/cvc5/cvc5-projects/issues/445. Fixes
https://github.com/cvc5/cvc5-projects/issues/446. The issue is related
to the preprocessing pass for doing rewrite rule synthesis based on the
input. It was removing duplicate arguments from both chaining operators
and non-chaining operators when constructing the corresponding
datatypes. In the case of non-chaining operators, it could happen that
the constructor of the datatype did not have the correct number of
arguments for a given kind if there was a term where multiple arguments
were the same. This commit fixes the issue by doing the duplicate
elimination only for chaining operators.
2022-01-28 16:56:27 +00:00
Andres Noetzli
7ed586537b Fix TypeNode::substitute() for type constants (#7920)
Fixes cvc5/cvc5-projects#395. The
TypeNode::substitute() method did not account for type constants such
as the Boolean type and was trying to use a NodeBuilder to build such
constants instead. This commit fixes the issue by adding a special case
for types without children.
2022-01-11 17:19:15 +00:00
Andres Noetzli
f18f1bd8c6 Fix TypeNode::substitute() (#7916)
Fixes cvc5/cvc5-projects#397. Fixes
cvc5/cvc5-projects#399. After performing the
substitution on the child node, the result was not added as a child to
the node under construction, resulting in nodes with too few children.
This commit fixes that issue.
2022-01-11 14:29:49 +00:00
yoni206
ad885db118 Integrate new int-blaster (#7781)
This PR removes the code that translates from bit-vectors to integers from the bv_to_int preprocessing pass, and replaces it with a call to the IntBlaster module.

Tests are updated and added, as well as other minor changes.

Solves the following issues (and contains corresponding tests):
cvc5/cvc5-projects#345
cvc5/cvc5-projects#344
cvc5/cvc5-projects#343

@mpreiner FYI
2021-12-13 16:16:08 +00:00
Gereon Kremer
5108f5c667 Fix 32bit issue in sep_log_api test (#7752)
This uses the proper `t.getInt64Value()` getter instead of `std::stoll(t.toString())`, fixing an issue on 32bit platforms.
2021-12-07 01:46:54 +00:00
Gereon Kremer
561b989855 Refactor IO stream manipulators (#7555)
This PR consolidates SetLanguage, ExprSetDepth and ExprDag into a single consistent utility. Also, it makes it play more nicely with users setting these options and removes some obsolete code.
2021-11-22 22:31:31 +00:00