summaryrefslogtreecommitdiff
path: root/src/parser
AgeCommit message (Collapse)Author
2021-02-24Enable -Werror. (#5969)Mathias Preiner
2021-02-08Remove support for inst closure (#5874)Andrew Reynolds
This was a feature implemented for "Deciding Local Theory Extensions via E-matching" CAV 2015 that is not used anymore, and will be a burden to maintain further with potential changes to term database. It also simplifies the TermDatabase::addTerm method (which changed indentation).
2021-01-21Add div, mod, abs in non-strict parsing mode (#5793)Andrew Reynolds
The recent change to the parser currently breaks our performance on several critical applications, including the use of CVC4 in Facebook. We should only throw a parse error for div in linear logics when strict mode is enabled.
2021-01-20SMT2 parser: Do not add non-linear symbols for linear Int arith logics. (#5787)Aina Niemetz
This enables more strict handling of operators div, mod and abs for Integer arithmetic logics. More strict handling for '/' for Real arithmetic logics is more involved and should be done in the parser -- instead at solving time, like is currently done for checking that the application * is in the linear fragment. The latter should be checked in the parser, too. This is postponed to a later PR.
2021-01-08Add bags inference generator (#5731)mudathirmahgoub
This PR adds inference generator for basic bag rules.
2021-01-07Remove dependency on expression layer in TPTP parser (#5753)Haniel Barbosa
2021-01-07Fix warning in TPTP parser (#5752)Haniel Barbosa
2021-01-05Remove a few miscellaneous references to the expr layer (#5661)Andrew Reynolds
Leftover from a development branch.
2020-12-16Use uint64 utility when parsing tuple selectors in smt2 (#5681)Andrew Reynolds
The smt2 parser is now 100% independent from the Expr-layer.
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-12-02Update copyright headers.Aina Niemetz
2020-12-02Rename macro Message to CVC4Message. (#5576)Aina Niemetz
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-25Use symbol manager for printing responses get-model (#5516)Andrew Reynolds
This makes symbol manager be in charge of determining which sorts and terms to print in response to get-model. This eliminates the need for the parser to call ExprManager::mkVar (and similar methods) with custom flags. This requires significant simplifications to the printers for models, where instead of a NodeCommand, we take a Sort or Term to print in the model. This is one of the last remaining steps for migrating the parser to the new API. The next step will be to remove a lot of the internal infrastructure for managing expression names, commands to print in models, node commands, node listeners, etc.
2020-11-20Fix use of declaration sequence command in cvc parser (#5479)Andrew Reynolds
This is required to make the cvc parser work properly with the new version of getting models based on the symbol manager.
2020-11-19Include stddef.h (needed for size_t) in cvc4_public.h (#5476)Aina Niemetz
This further removes obsolete explicit includes of stdint.h.
2020-11-19Use symbol manager for unsat cores (#5468)Andrew Reynolds
This PR uses the symbol manager for handling names for unsat cores. This replaces interfaces in SmtEngine for managing expression names. It removes the SetExpressionName command.
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-13Add more features to symbol manager (#5434)Andrew Reynolds
This is in preparation for having the symbol manager manage expression names at the parser level instead of inside SmtEngine. This adds some necessary features regarding scopes and global declarations. This PR still does not change the behavior of the parser.
2020-11-12Make symbol manager context dependent (#5424)Andrew Reynolds
This follows a similar style to symbol_table.h/cpp. This is required since context dependent data structures are cvc4_private, and symbol manager is cvc4_public.
2020-11-11Move symbol manager to src/expr/ (#5420)Andrew Reynolds
This is required since symbol manager will use context dependent data structures (in its cpp). This is required since classes in src/parser/ are not allowed to include private headers.
2020-11-10Add proper support for the declare-heap command for separation logic (#5405)Andrew Reynolds
This adds proper support for the (declare-heap (T U)) command, which declares the type of the heap in separation logic. This command is part of the standard for separation logic. This previous was handled in an ad-hoc way where the type of the heap would be inferred on demand. This was a poor solution and has led to a number of issues related to when the heap is inferred. Fixes #5343, fixes #4926. Work towards CVC4/cvc4-wishues#22.
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-11-05Simplify printing with respect to expression types (#5394)Andrew Reynolds
This removes infrastructure for stream property related to printing type annotations on all variables. This is towards refactoring the printers.
2020-11-05Remove mkSingleton from the API (#5366)mudathirmahgoub
This PR removes mkSingleton from the API after removing subtyping from set theory and introducing mkInteger to the API. Instead the user needs to use Solver::mkTerm(api::SINGLETON, element) where element has the right type. Internally NodeManager::mkSingleton(type, element) is still needed to determine the type of the set. Other changes: Renamed Solver::mkTerm(Op op, .. functions to Solver::mkTermFromOp(Op op, ... Added mkTermFromOp to the python API
2020-11-02Miscellaneous cleaning of parser (#5369)Andrew Reynolds
2020-10-29Update api::Sort to use TypeNode instead of Type (#5363)Andrew Reynolds
This is work towards removing the old API. This makes TypeNode the backend for Sort instead of Type. It also updates a unit test for methods isUninterpretedSortParameterized and getUninterpretedSortParamSorts whose implementation was previously buggy due to the implementation of Type-level SortType.
2020-10-29Add mkInteger to the API (#5274)mudathirmahgoub
This PR adds mkInteger to the API and update mkReal to ensure that the returned term has real sort. The parsers are modified to parse numbers like "0" "5" as integers and "0.0" and "15.0" as reals. This means subtyping is effectively eliminated from all theories except arithmetic. Other changes: Term::isValue is removed which was introduced to support parsing for constant arrays. It is no longer needed after this PR. Benchmarks are updated to match the changes in the parsers Co-authored-by: Andrew Reynolds andrew-reynolds@uiowa.edu
2020-10-28Convert symbol table from Expr-level to Term-level (#5355)Andrew Reynolds
This task is left over from parser migration. This PR also drops support for a case of symbol overloading, in particular symbols (constructors, selectors) for parametric datatypes cannot be overloaded. One regression is disabled as a result.
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-26Add DUPICATE_REMOVAL operator to bags (#5336)mudathirmahgoub
This PR adds duplicate removal operator to bags (also known as delta or squash). Other changes: print MK_BAG operator as "bag" in smt2 instead of "mkBag" renamed BAG_IS_INCLUDED operator to SUBBAG.
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-10-07New C++ API: Rename Term::isConst() to Term::isValue(). (#5211)Aina Niemetz
2020-10-06Add operators bag.from_set, bag.to_set to the theory of bags (#5186)mudathirmahgoub
2020-10-04Remove subtyping for sets theory (#5179)mudathirmahgoub
This PR removes subtyping for sets theory due to issues like #4502, #4507 and #4631. Changes: Add SingletonOp for singletons to specify the type of the single element in the set. Add mkSingleton to the solver to enable the user to pass the sort of the single element. Update smt and cvc parsers to use mkSingleton when the kind is SINGLETON
2020-09-22Refactor Commands to use the Public API. (#5105)Abdalrhman Mohamed
This is work towards eliminating the Expr layer. This PR does the following: Replace Expr/Type with Term/Sort in the API for commands. Remove the command export functionality which is not supported. Since many commands now call the Solver functions instead of the SmtEngine ones, their behavior may be a slightly different. For example, (get-unsat-assumptions) now only works in incremental mode. In some cases, CVC4 will not recover from non-fatal errors.
2020-09-22Add skeleton for theory of bags (multisets) (#5100)mudathirmahgoub
This PR adds initial headers and mostly empty source files for the theory of bags (multisets). It acts as a basis for future commits. It includes straightforward implementation for typing rules an enumerator for bags.
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-09-09Parser error for wrong number of datatypes (#5049)Andrew Reynolds
Fixes #4973.
2020-09-09Add is_singleton operator to the theory of sets (#5033)mudathirmahgoub
This pull request adds a new operator is_singleton for sets to determine whether a set is a singleton. Before this operator, the user either uses an existential quantifier or the cardinality operator in smtlib. The former affects the performance especially when polarity is negative. The latter requires the cardinality extension in sets theory. The implementation of is_singleton only uses an internal existential quantifier with the hope of optimizing it later. New rewriting rules: (is_singleton (singleton x)) is rewritten as true. (is_singleton A) is rewritten as (= A (singleton x)) where x is a fresh skolem of the same type of elements of A. (choose (singleton x)) is rewritten as x.
2020-09-02Drop {INCLUDE,LIBRARY,RUNTIME}_INSTALL_DIR variables in CMakeLists.txt (#4979)FabianWolff
On Debian (for instance), libraries aren't installed into `/usr/lib/`, but into something like `/usr/lib/x86_64-linux-gnu/`. In particular, this means that setting the `LIBRARY_INSTALL_DIR` to `lib` in the top-level `CMakeLists.txt` file is wrong. Luckily, there is a simple solution: CMake provides [`CMAKE_INSTALL_LIBDIR`](https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html) for this very purpose, which has sensible defaults and can be set by the user. In particular, since `CMAKE_INSTALL_LIBDIR` is a standardized variable, tools like the ones used for building Debian packages can set it to what they want it to be, whereas using a custom variable like `LIBRARY_INSTALL_DIR` wouldn't work in this setting. Signed-off-by: Fabian Wolff <fabi.wolff@arcor.de>
2020-09-01[API] Fix Python Examples (#4943)Andres Noetzli
When testing the API examples, Python examples were not included. This commit changes that and fixes multiple minor issues that came up once the tests were enabled: - It adds `Solver::supportsFloatingPoint()` as an API method that returns whether CVC4 is configured to support floating-point numbers or not (this is useful for failing gracefully when floating-point support is not available, e.g. in the case of our floating-point example). - It updates the `expections.py` example to use the new API. - It fixes the `sygus-fun.py` example. The example was passing a _set_ of non-terminals to `Solver::mkSygusGrammar()` but the order in which the non-terminals are passed in matters because the first non-terminal is considered to be the starting terminal. The commit also updates the documentation of that function. - It fixes the Python API for datatypes. The `__getitem__` function had a typo and the `datatypes.py` example was crashing as a result.
2020-08-31Fix spelling errors (#4977)FabianWolff
Signed-off-by: Fabian Wolff <fabi.wolff@arcor.de>
2020-08-25Replace Expr-level datatype with Node-level DType (#4875)Andrew Reynolds
This PR makes two simultaneous changes: The new API uses Node-level DType instead of Expr-level Datatype. This required converting 2 of the last remaining calls in the parser that used Expr to use the new API. Internally constructed datatypes (e.g. for sygus) use Node-level DType instead of Expr-level Datatype. Note this required moving a block of code for handling a corner case of sygus from Datatype -> DType. This PR removes : ExprManger::mkDatatypeType. The Expr-level datatype itself. This PR removes all references to its include file. It also updates one remaining unit test from Expr -> Node. This PR will enable further removal of other datatype-specific things in the Expr layer.
2020-08-24Fix memory issue in AntlrInput::parseError (#4873)Gereon Kremer
The `parseErrorHelper` message can run into memory errors when the it prints the last line and this last line is not terminated by a newline. I suspect other conditions may trigger it as well (like only using `\r` as line terminator). This comit computes the size of the buffer from the start of the current line to the end of the buffer and makes sure that we never go beyond this buffer. The calculation looks a bit awkward, I've not been able to obtain this information from the ANTLR input stream in a nicer way... (I found this issue when looking at #4866). Fixes #4069 .
2020-08-04Modify the smt2 parser to use the Sygus grammar. (#4829)Abdalrhman Mohamed
2020-08-04Add API interface for specialized constructor term (#4817)Andrew Reynolds
This is an interface to get the instantiated parametric datatype constructor operator to apply when the type of this operator cannot be inferred without a cast. This is required for eliminating the Expr-level datatype and calls to ExprManager from the parsers.
2020-08-03Update datatypes in cvc parser to the new API (#4826)Andrew Reynolds
This is leftover from the parser conversion. This is towards eliminating all remaining Expr-level calls in the parser. Notice that 2 parser-level checks for records are eliminated in this PR, since we do not export record objects in the new API.
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback