summaryrefslogtreecommitdiff
path: root/src/parser/smt2/smt2.h
AgeCommit message (Collapse)Author
2021-11-02Improve syntax for fmf cardinality constraints (#7556)Andrew Reynolds
This is an experimental extension of smt2.
2021-10-14Improve parser for tuple select (#7364)Andrew Reynolds
2021-09-22Minimal fixing version for tuple update parsing (#7228)Andrew Reynolds
This takes the essential changes from #7218 so that the current ANTLR issues are avoided.
2021-09-01No longer use direct access to options in driver (#7094)Gereon Kremer
This PR refactors the driver to no longer directly access the Options object, but instead use Solver::getOption() or Solver::getOptionInfo().
2021-08-27Handle languages as strings in driver (#7074)Gereon Kremer
This PR moves the first chunk of code in the driver to use the proper options API for the language options. It is now handled as a string.
2021-08-26Consolidate language types (#7065)Gereon Kremer
This PR combines the two enums InputLanguage and OutputLanguage into a single Language type. It makes sure that AST is not used as input language using a predicate whenever the option is set.
2021-06-03Simplify automatic set-logic in smt2 parser (#6678)Andrew Reynolds
This simplifies the smt2 parser so that automatically setting the logic is done directly instead of being buffered as a command. This prevents spurious errors for features that require (A) checking the logic is set and (B) fully intialize the underlying SMT engine. `declare-pool` is an example of an smt2 command where the user will get an error (instead of a warning) when set-logic is not used due to setting the logic, after fully initing SMT engine and then executing the buffered set-logic command. Note this should also make dump=raw-benchmark more accurate (no set-logic is included when dumping benchmarks with no set-logic command).
2021-05-14Decouple parser creation from input selection (#6533)Andres Noetzli
This commit decouples the creation of a `Parser` instance from creating an `Input` and setting the `Input` on the parser. This is a first step in refactoring the parser infrastructure. A future PR will split the parser class into three classes: `Parser`, `ParserState`, and `InputParser`. The `Parser` and `InputParser` classes will be the public-facing classes. The new `Parser` class will have methods to create `InputParser`s from files, streams, and strings. `InputParser`s will have methods to get commands/exprs from a given input. The `ParserState` class will keep track of the state of the parser and will be the internal interface for the parsers. The current `Parser` class is used both publicly and internally, which is messy.
2021-04-19Remove linking against gmp and cln in tests and parser (#6376)Gereon Kremer
Finally, we no longer need to link against GMP and CLN for the parser and the tests. To actually achieve this, this PR also removes some dead code and unused includes from some parser files.
2021-04-14Rename public and private headers in src/include. (#6352)Aina Niemetz
2021-04-12Refactor and update copyright headers. (#6316)Aina Niemetz
2021-04-09Rename CVC4__ header guards to CVC5__. (#6326)Aina Niemetz
2021-04-05New C++ Api: Rename and move headers. (#6292)Aina Niemetz
2021-04-01Rename namespace CVC5 to cvc5. (#6258)Aina Niemetz
2021-03-31Rename namespace CVC4 to CVC5. (#6249)Aina Niemetz
2021-03-18Eliminate more uses of SExpr. (#6149)Abdalrhman Mohamed
This PR eliminates all remaining uses of SExpr outside of statistics.
2021-03-09Update copyright headers to 2021. (#6081)Aina Niemetz
2021-03-06Remove SMT-LIB 2.5 and 2.0 support. (#6068)Mathias Preiner
This commit removes parser and printer support for old SMT-LIB standards and also converts all regression tests to 2.6.
2020-12-03Refactor handling of global declarations (#5577)Andrew Reynolds
This refactors how global declarations are handled in the parser. In particular, we do not push/pop user contexts in the symbol table and manager when global declarations are true, which is an equivalent behavior to declaring symbols globally. This further refactors to not use ExprManager flags, thus breaking most of the dependencies on the old API. This is work towards fixing global declarations in the smt2 parser. The parser still does not behave correctly for overloaded symbols + global declarations (e.g. see #4767), which require further refactoring. This is also work towards migrating the parser not to depend on the old API. There are a few miscellaneous things to change after this PR, but we are very close to breaking this dependency now.
2020-11-30Eliminate uses of SExpr from the parser. (#5496)Abdalrhman Mohamed
This is a step towards migrating Commands to the API. SExpr is an internal module that's not used by the API but is used by the parser and some commands. This PR replaces SExpr with terms of kind SEXPR in the parser and strings in commands (which brings them more inline with the API).
2020-11-18Use symbol manager for get assignment (#5451)Andrew Reynolds
This replaces the previous methods for get-assignment which involving making a DefinedNamedFunctIonCommand and storing the expression names map in the SmtEngine. Note: we now limit :named terms to those not beneath quantifiers and let-bindings.
2020-11-16Cleaning up scopes in preparation for symbol manager (#5442)Andrew Reynolds
This changes the default of Parser::pushScope and prepares symbol manager further for maintaining expression names.
2020-11-09Add symbol manager (#5380)Andrew Reynolds
This add the symbol manager class, which is a Term-level utility, separate of the API. This class manages things like expression and assertion names, which is intentionally done outside the solver. The symbol manager is intended to live at the same level as the Solver. When parsing input, the symbol manager will be used to model any interaction of e.g. named expressions and assertions. It also stores the symbol table of the parser. This PR adds the basic interface for the symbol manager and passes it to the parser. Later PRs will migrate the functionality for named expression out of e.g. SmtEngine and into SymbolManager. Commands will take Solver+SymbolManager instead of Solver. This will allow the parser to be fully migrated to the new API. Marking "complex" since this impacts further design of the parser and the code that lives in src/main. FYI @4tXJ7f
2020-10-27Refactor DeclareSygusVarCommand and SynthFunCommand to use the API. (#5334)Abdalrhman Mohamed
This PR is part of migrating commands. DeclareSygusVarCommand and SynthFunCommand now call public API function instead of their corresponding SmtEngine functions. Those two commands don't fully initialize the solver anymore. Some operations in SygusInterpol::solveInterpolation, which creates an interpolation sub-solver, depend on the solver being fully initialized and were affected by this change. Those operations are now executed by the main solver instead of the sub-solver, which is not fully initialized by the time they are needed.
2020-10-08reset-assertions: Remove all non-global symbols in the parser (#5229)Andres Noetzli
Fixes #5163. When `:global-declarations` is disabled (the default), then `(reset-assertions)` should remove all declared and defined symbols. Before this commit, we would remove the defined function from `SmtEngine` but the parser would not remove it from its symbol table because the symbol was defined at (what it considered) level 0. Level 0, however, is reserved for global symbols that we never want to remove. This commit adds an additional global `pushScope()`/`popScope()`, similar to what we have in `SmtEngine`. As a result, user-defined symbols are now defined at level 1 and get removed from the `SymbolTable` when `(reset-assertions)` is called. The commit also makes sure that symbols defined by the logic are asserted at level 0, so that they are not removed by `(reset-assertions)`. It adds a flag to `defineType` to ignore duplicate definitions because some symbols are defined by multiple logics, which leads to a failing assertion when inserting them both at level 0 in the hashmap of the `SymbolTable`. E.g. strings and integer arithmetic both define `Int`. The commit also fixes existing unit tests that fail with these stricter semantics of `(reset-assertions)`. Signed-off-by: Andres Noetzli <noetzli@amazon.com>
2020-09-22Update copyright header script to support CMake and Python files (#5067)Mathias Preiner
This PR updates the update-copyright.pl script to also update/add copyright headers to CMake specific files. It further fixes a small typo in the header.
2020-09-16Dump commands in internal code using command printing functions. (#5040)Abdalrhman Mohamed
This is work towards migrating commands to the new API. Internal code that creates command objects just for dumping is replaced with direct calls to functions that print the those commands.
2020-08-04Modify the smt2 parser to use the Sygus grammar. (#4829)Abdalrhman Mohamed
2020-06-25Remove sygus1 parser (#4651)Andrew Reynolds
We no longer support sygus v1 inputs. This PR removes support for sygus v1 (as well as a deprecated "z3str" variant of smt lib 2 which is subsumed by the new strings standard). As mentioned in the release notes, CVC4 1.8 supports a conversion from sygus v1 to v2 script. This removal is required for further updates to the new API. Further infrastructure (e.g. the sygus print callback) will be removed in a separate PR. FYI @abdoo8080 .
2020-06-16Update copyright headers.Aina Niemetz
2020-06-01Do not parse ->/lambda unless --uf-ho enabled (#4544)Andres Noetzli
Fixes #4477. Logic ALL includes higher-order but we currently do not support solving higher-order problems unless --uf-ho is enabled. This commit changes the condition under which we parse -> and lambda to only enabled parsing of those symbols if the logic allows higher-order constraints and --uf-ho is enabled.
2020-03-28Change is-cons to (_ is cons) in Sygus benchmarks. (#4174)Abdalrhman Mohamed
2020-03-18Only allow bv2nat/int2bv with BV and integer logic (#4118)Andres Noetzli
CVC4 supports `bv2nat` and `int2bv` to convert bit-vectors to/from integers. Those operators are not standard. This commit only enables those operators when parsing is non-strict and both bit-vectors and integers are enabled in the logic. To achieve this, the commit simplifies the handling of logics in the parser: Instead of defining a separate `Logic` enum in the `Smt2` class, we simply use `LogicInfo` directly.
2020-03-12Convert most instances of dataypes in parsers to the new API (#4054)Andrew Reynolds
I am still accessing Expr-level Datatypes for the sygus v1/v2 parsers (within smt2). This will be addressed in two ways in the future: (1) The sygus v1 parser will be deleted, (2) The sygus v2 parser will be updated to use a "Grammar" object as an extension of the new API, which will hide all calls to the underlying datatype. (See https://github.com/abdoo8080/CVC4/tree/sygus-api). FYI @abdoo8080 . Note I've renamed "mkMutualDatatypeTypes" to "bindMutualDatatypeTypes" to be more accurate and follow the updated name conventions in the parser. The next step will be to handle parametric datatypes, which are not specifically addressed by this PR.
2020-03-06Remove tester name from APIs (#3929)Andrew Reynolds
This removes the field "tester name" from the Expr-level and Term-level APIs. This field is an artifact of parsing and thus should be handled in the parsers. This refactor uncovered an issue in our regressions, namely our smt version >= 2.6 was not strictly complaint, since the symbol is-cons was being automatically defined for testers of constructors cons. This disables this behavior when strict mode is enabled. It updates the regressions with this issue. This is work towards parser migration.
2020-03-05Migrate a majority of the functionality in parsers to the new API (#3838)Andrew Reynolds
This PR migrates a majority of the functionality of the parsers (cvc, tptp, smt2/sygus) to the new API. The main omitted functionality not addressed in this PR is the datatypes. Largely, the Expr-level Datatype is still used throughout. Remaining tasks: Migrate the Datatypes to the new API in cvc/smt2. Eliminate the use of ExprManager::mkVar (with flags for DEFINED/GLOBAL). For the latter, I have made a utility function in Parser::mkVar that captures all calls to this function. Notice that the existing mkVar/mkBoundVar/mkDefinedFun have been renamed to the more fitting names bindVar/bindBoundVar/bindDefinedFun etc. Note: this PR contains no major code changes, each line of code should roughly correspond one-to-one with the changed version. This fixes CVC4/cvc4-projects#77, fixes CVC4/cvc4-projects#78, fixes CVC4/cvc4-projects#80, fixes CVC4/cvc4-projects#85.
2020-02-27Update purifySygusGTerm to the new API (#3830)Andrew Reynolds
Towards parser migration. (Partially) updates the central function used for synth-fun in sygus v2 to the new API. It also removes an optimization for "pure operators" from the v2 parser that is incompatible with the new API.
2020-02-26Refactor type ascriptions in the parser (#3825)Andrew Reynolds
Towards parser migration. This consolidates two blocks of code (cvc/smt2) that do type ascriptions to a utility function in the parser. It updates this function to use the new API. This code will be further refactored when the interface for parametric datatype constructors is further developed in the new API.
2020-02-26Minor cleaning of smt2 parser (#3823)Andrew Reynolds
Towards parser migration, will make the diff of the eventual conversion a bit smaller.
2020-02-14Remove quantifiers rewrite rules infrastructure (#3754)Andrew Reynolds
2020-02-13Update sygus v1 parser to use ParseOp utility (#3756)Andrew Reynolds
2020-01-07Fix unary minus parse check (#3594)Andrew Reynolds
2019-12-06Add ExprManager as argument to Datatype (#3535)Andrew Reynolds
2019-12-02OpTerm Refactor: Allow retrieving OpTerm used to create Term in public C++ ↵makaimann
API (#3355) * Treat uninterpreted functions as a child in Term iteration * Remove unnecessary const_iterator constructor * Add parameter comments to const_iterator constructor * Use operator[] instead of storing a vector of Expr children * Switch pos member variable from int to uint32_t * Add comment about how UFs are treated in iteration * Allow OpTerm to contain a single Kind, update OpTerm construction * Update mkTerm to use only an OpTerm (and not also a Kind) * Remove unnecessary function checkMkOpTerm * Update mkOpTerm comments to not use _OP Kinds * Update examples to use new mkTerm * First pass on fixing unit test * Override kind for Constructor and Selector Terms * More fixes to unit tests * Updates to parser * Remove old assert (for Kind, OpTerm pattern which was removed) * Remove *_OP kinds from public API * Add hasOpTerm and getOpTerm methods to Term * Add test for UF iteration * Add unit test for getOpTerm * Move OpTerm implementation above Term implemenation to match header file Moved in header because Term::getOpTerm() returns an OpTerm and the compiler complains if OpTerm is not defined earlier. Simply moving the declaration is easier/cleaner than forward declaring within the same file that it's declared. * Fix mkTerm in datatypes-new.cpp example * Use helper function for creating term from Kind to avoid nested API calls * Rename: OpTerm->Op in API * Update OpTerm->Op in examples/tests/parser * Add case for APPLY_TESTER * operator term -> operator * Update src/api/cvc4cpp.h Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Comment comment suggestion Co-Authored-By: Aina Niemetz <aina.niemetz@gmail.com> * Add not-null checks and implement Op from a single Kind constructor * Undo sed mistake for OpTerm replacement * Add 'd_' prefix to member vars * Fix comment and remove old commented-out code * Formatting * Revert "Formatting" This reverts commit d1d5fc1fb71496daeba668e97cad84c213200ba9. * More fixes for sed mistakes * Minor formatting * Undo changes in CVC parser * Add isIndexed and prefix with d_ * Create helper function for isIndexed to avoid calling API functions in other API functions
2019-10-07[SMT2 Parser] Move code of `rewriterulesCommand` (#3334)Andres Noetzli
This commit moves the code in `rewriterulesCommand` in the SMT2 parser to the `Smt2` class. Additionally, it creates a `boundVarList` rule to reduce code duplication.
2019-10-03[SMT2 Parser] Move code of `sygusCommand` (#3335)Andres Noetzli
This commit moves the code in `sygusCommand` in the SMT2 parser to the `Smt2` class. The original code was pushing and popping the current scope inline. This commit adds a class `SynthFunFactory` that takes care of that upon creation and destruction.
2019-09-13Disallow let in sygus grammars, check for free variables in sygus ↵Andrew Reynolds
constructors (#3259)
2019-09-06Remove SMT1 parser. (#3228)Mathias Preiner
This commit removes the SMT1 parser infrastructure and adds the SMT2 translations of the SMT1 regression tests. For now this commit removes regression test regress3/pp-regfile.smt since the SMT2 translation has a file size of 887M (vs. 172K for the SMT1 version). Fixes #2948 and fixes #1313.
2019-08-13Introduce smt2 parsing utility ParseOp and refactor (#3165)Andrew Reynolds
2019-08-12Clean smt2 parsing of named attributes (#3172)Andrew Reynolds
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback