summaryrefslogtreecommitdiff
path: root/src/parser/smt2/smt2.cpp
AgeCommit message (Collapse)Author
2020-02-28Add support for str.from_code (#3829)Andres Noetzli
This commit adds support for `str.from_code`. This is work towards supporting the new strings standard. The code currently just does an eager expansion of the operator. The commit also renames `STRING_CODE` to `STRING_TO_CODE` to better reflect the names of the operators in the new standard.
2020-02-27Refactor operator applications in the parser (#3831)Andrew Reynolds
This PR refactors how a term is constructed based on information regarding an operator (ParseOp) and its arguments. It also makes a few miscellaneous fixes. This includes: Indexed ops are carried in ParseOp via api::Op not Expr, getKindForFunction is limited to "APPLY" kinds from the new API, The TPTP/SMT2 parsers rely on mkTermInternal for handling associativity. TPTP should use DIVISION not DIVISION_TOTAL. This is in preparation for parser migration. These are the essential behavioral changes required for using the new API for the majority of the parser.
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-26Add support for is_digit and regular expression difference (#3828)Andrew Reynolds
Towards support for the strings standard. This adds support for str.is_digit and re.diff, which both can be eliminated eager during preprocessing.
2020-02-26More fixes for printing sygus commands (#3812)Andrew Reynolds
Towards v1 -> v2 sygus conversion. This makes several fixes and improvements related to printing sygus commands: (1) The logic is extended with LIA, DT, UF internally during setDefaults instead of during parsing. This is the correct place for this extension of the logic since it should be applied regardless of the parser. 5 existing logic bugs were discovered as a result of this in regressions, which are fixed by this PR. (2) Ensures that terms in sygus grammars are printed without letification, since this is prohibited in sygus. Notice the formulas printed by constraints need to be letified (otherwise we can't convert large lustre benchmarks). Thus, the letification threshold should determine this but always be overridden for grammar terms. (3) Ensures final options are set for all sygus-specific commands, which follows the standards prescribed by sygus v2 (all set-* commands come before other commands).
2020-02-26Basic support for regular expression complement (#3437)Andrew Reynolds
Fixes #3408 . Adds basic rewriter, parsing, type checking and implements the required cases in regexp_operation.cpp. It also adds some missing documentation in regexp_operation.h
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-25Embed mkAssociative utilities within the API. (#3801)Andrew Reynolds
Towards parser/API migration.
2020-02-24Fix bugs related to printing Sygus commands (#3804)Abdalrhman Mohamed
With this commit, most Sygus problems should print correctly. The current printing functionality was tested on 158 Sygus regress files (0, 1, and 2) and 153 of them were printed in Sygus2 format and contained "(check-synth)". The printing functionality was tested again on the generated files and gave almost the same results.
2020-02-21Simple changes towards unicode string standard (#3791)Andrew Reynolds
This updates --lang=smt2.6.1 with the minor syntactic differences from the current syntax and the standard here: http://smtlib.cs.uiowa.edu/theories-UnicodeStrings.shtml. The next steps will be to address the more invasive changes required to support the standard.
2020-02-20Remove front-end support for Chain (#3767)Andrew Reynolds
2020-02-17Using ParseOp in TPTP (#3764)Haniel Barbosa
2020-02-14Remove quantifiers rewrite rules infrastructure (#3754)Andrew Reynolds
2020-02-13Update sygus v1 parser to use ParseOp utility (#3756)Andrew Reynolds
2019-12-23Initial support for string reverse (#3581)Andrew Reynolds
Type rules, parsing and printing, basic rewriting including constant evaluation, reduction for string reverse (`str.rev`). Also improves support in a few places for tolower/toupper.
2019-12-17Fix spurious parse error for rational real array constants (#3554)Andrew Reynolds
Currently we can't parse constant arrays that store real values that are given as rationals `(/ n m)`. We throw a spurious parse error for `((as const (Array Int Real)) (/ 1 3))`, indicating that the argument of the array is not constant. This is caused by the fact that `(/ 1 3)` is parsed as a *division* term not a rational value. This adds a special case to constant array construction so that we compute the result of a constant division instead of using the division term `(/ n m)` when constructing an array constant.
2019-12-10Fix ufho issues (#3551)Haniel Barbosa
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-11-25Better front-end type checking for SyGuS (#3496)Andrew Reynolds
2019-11-18Use -Wimplicit-fallthrough (#3464)Andres Noetzli
This commit enables compiler warnings for implicit fallthroughs in switch statements that are not explicitly marked as such. The commit introduces a new macro `CVC4_FALLTHROUGH` that can be used to indicate that a fallthrough is intentional. The commit fixes existing warnings and a bug in the arithmetic rewriter for `abs` (the bug likely couldn't be triggered easily because we rewrite `abs` to an `ite` while expanding definitions). To have the new macro also available in the parser, the commit changes `src/base/check.h` to be visible to the parser (it includes `cvc4_private_library.h` now instead of `cvc4_private.h`).
2019-11-15Fix wrong kind in sygus version 1 parser (#3463)Andrew Reynolds
2019-11-13Allow (set-logic ...) after (reset) (#3457)Andres Noetzli
Fixes #3353. #3062 introduced a flag that tracks whether we have seen a `(set-logic ...)` command to improve the handling of `--force-logic`. However, the flag was not set to `false` when `(reset)` was called. This commit fixes the issue.
2019-10-11Check that logic is set when synth-fun command is encountered (#3384)Andrew Reynolds
2019-10-10Make order of theories explicit in the source code. (#3379)Aina Niemetz
Fixes #2517. This makes the order of theories explicit in the source code rather than relying on the order defined via the build system. Previously, the build system ensured the order of the theories via the KINDS_FILES variable, which is a list of kinds files that is fed to code generation scripts (mkkind, mkmetakind, mkrewriter, mktheorytraits). The generated code critical to the order of theories w.r.t. soundess is the TheoryId enum, and the CVC4_FOR_EACH_THEORY macro. Ideally, we would want to get rid of the latter (ugly and error prone), which is not possible in the current configuration, and to be discussed in the future. This PR moves the TheoryID enum and related functions to theory/theory_id.h, and the CVC4_FOR_EACH_THEORY macro to theory/theory_engine.cpp, the only place where it is used. I ran it on whole SMT-LIB (non-incremental and incremental) and did not encounter any soundness issues. The only issue that did occur is not related to these changes, non-critical and known: #2993
2019-10-08Avoid printing success for `--force-logic` (#3363)Andres Noetzli
CVC4 was printing success when `--force-logic` was used because internally, `--force-logic` generates a `SetBenchmarkLogicCommand`. This caused issues with the SMT-COMP trace executor. This commit fixes the behavior by muting the command if it was not issued by the user. The issue was likely introduced with #3062.
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-25Add isParameterized function to Expr (#3303)Andrew Reynolds
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-17Mark symbols introduced by named attributes as defined. (#3190)Andrew Reynolds
2019-08-13Introduce smt2 parsing utility ParseOp and refactor (#3165)Andrew Reynolds
2019-08-12Clean smt2 parsing of named attributes (#3172)Andrew Reynolds
2019-08-10Simplify how defined functions are tracked during parsing (#3177)Andrew Reynolds
2019-08-06Properly parse qualified identifiers (#3111)Andrew Reynolds
2019-07-29Support get-abduct smt2 command (#3122)Andrew Reynolds
2019-07-23Fix sygus datatype parsing in sygus v1 format (#3113)Andrew Reynolds
2019-07-16Add support for str.tolower and str.toupper (#3092)Andrew Reynolds
2019-07-01Support sygus version 2 format (#3066)Andrew Reynolds
2019-06-21Fix and simplify handling of --force-logic (#3062)Andres Noetzli
The `--force-logic` command line argument can be used to override a logic specified in an input file or to set a logic when none is given. Before this commit, both the `SmtEngine` and the parser were aware of that argument. However, there were two issues if an input file didn't specify a logic but `--force-logic` was used: - Upon parsing `--force-logic`, the `SmtEngine` was informed about it and set the logic to the forced logic. Then, the parser detected that there was no `set-logic` command, so it set the logic to `ALL` and emitted a corresponding warning. Finally, `SmtEngine::setDefaults()` detected that `forceLogic` was set by the user and changed the logic back to the forced logic. The warning was confusing and setting the logic multiple times was not elegant. - For eager bit-blasting, the logic was checked before resetting the logic to the forced logic, so it would emit an error that eager bit-blasting couldn't be used with the logic (which was `ALL` at that point of the execution). This was a problem in the competition because our runscript parses the `set-logic` command to decide on the appropriate arguments to use and passes the logic to CVC4 via `--force-logic`. This commit moves the handling of `--force-logic` entirely into the parser. The rationale for that is that this is not an API-level issue (if you use the API you simply set the logic you want, forcing a different logic in addition doesn't make sense) and simplifies the handling of the option (no listeners need to be installed and the logic is set only once). This commit also removes the option to set the logic via `(set-option :cvc4-logic ...)` because it complicates matters (e.g. which method of setting the logic takes precedence?). For the CVC and the TPTP languages the commit creates a command to set the logic in `SmtEngine` when the logic is forced in the parser instead of relying on `SmtEngine` to figure it out itself.
2019-06-12Refactor parser to define fewer tokens for symbols (#2936)Andres Noetzli
2019-05-06Add support for re.all (#2980)Andres Noetzli
2019-04-29Eliminate APPLY kind (#2976)Andrew Reynolds
2019-03-26Update copyright headers.Aina Niemetz
2018-11-21Support string replace all (#2704)Andrew Reynolds
2018-10-18Introducing internal commands for SyGuS commands (#2627)Haniel Barbosa
2018-10-02Allow (_ to_fp ...) in strict parsing mode (#2566)Andres Noetzli
When parsing with `--strict-parsing`, we are checking whether the operators that we encounter have been explicitly added to the `d_logicOperators` set in the `Parser` class. We did not do that for the indexed operator `(_ to_fp ...)` (which is represented by the kind `FLOATINGPOINT_TO_FP_GENERIC`). This commit adds the operator.
2018-09-26Makes SyGuS parsing more robust in invariant problems (#2509)Haniel Barbosa
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback