summaryrefslogtreecommitdiff
path: root/examples/api
AgeCommit message (Collapse)Author
2020-11-20Updates to API in preparation for using symbol manager for model (#5481)Andrew Reynolds
printModel no longer makes sense if the list of declared symbols is managed outside the solver. Also, mkConst needs a variant to distinguish a provided name of "" vs. a name that is not provided.
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-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-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-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-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-03Examples for using sygus python api (#4822)yoni206
This PR adds examples for using the sygus python api. The examples are obtained from the examples of the cpp sygus api.
2020-07-30Python API: Add support for sequences (#4757)Andres Noetzli
Commit 9678f58a7fedab4fc061761c58382f4023686108 added front end support for sequences. This commit extends that support to the Python API. It also adds simple C++ and Python examples that demonstrate how the API works for sequences.
2020-06-29Make ExprManager constructor private (#4669)Andres Noetzli
This commit makes the ExprManager constructor private and updates the initialization of subsolvers, unit tests, and system tests accordingly. This is a step towards making options part of SmtEngine instead of NodeManager.
2020-06-23New C++ API: Remove examples for old API. (#4650)Aina Niemetz
This removes obsolete examples for the old API in preparation of making the old API private. Examples for the new API are renamed from *-new.cpp to *.cpp.
2020-06-18Improve memory management in Java bindings (#4629)Andres Noetzli
Fixes #2846. One of the challenges of the Java bindings is that the garbage collector can delete unused objects at any time in any order. This is an issue with CVC4's API because we require all `Expr`s to be deleted before the corresponding `ExprManager`. In the past, we were using `NewGlobalRef`/`DeleteGlobalRef` on the wrapper object of `ExprManager`. The problem is that we can have multiple instances of the wrapper that internally all refer to the same `ExprManager`. This commit implements a different approach where the Java wrappers hold an explicit reference to the `ExprManager`. The commit also removes some unused or unimportant API bits from the bindings.
2020-06-16Update copyright headers.Aina Niemetz
2020-06-09Language bindings: Enable catching of exceptions (#2813)Andres Noetzli
Fixes #2810. SWIG relies on throw specifiers to determine which exceptions a method can throw. The wrappers generated by SWIG catch those C++ exceptions and turn them into exceptions for the target language. However, we have removed throw specifiers because they have been deprecated in C++11, so SWIG did not know about any of our exceptions. This commit fixes the issue using the %catches directive, declaring that all methods may throw a CVC4::Exception or a general exception. Note: This means that users of the language bindings will just receive a general CVC4::Exception instead of more specific exceptions like TypeExceptions. Given that we are planning to have a single exception type for the new CVC4 API, this seemed like a natural choice. Additionally, the commit (significantly) simplifies the mapping of C++ to Java exceptions and fixes an issue with Python exceptions not inheriting from BaseException. Finally, the commit adds API examples for Java and Python, which demonstrate catching exceptions, and adds Python examples as tests in our build system.
2020-06-08Fix Java target and Relations example (#4583)Andres Noetzli
Currently, our CVC4Config file is never including the CVC4 Java targets because of a typo in `cmake/CVC4Config.cmake.in`. For this reason, our build system for the examples would never actually build the examples. Fixing this issue brought up another issue in our Relations Java example that was using an outdated `System.loadLibrary()` call. This commit fixes the typo and the example. Note: Most changes in `Relations.java` were caused by ClangFormat.
2020-06-04Wrap Result in Python API (#4473)makaimann
This PR would change the Python API to wrap the C++ Result class instead of translating it to a pure Python class. This is more convenient because there are several possibilities other than sat/unsat/unknown. Furthermore, this PR updates the bitvectors.py example which had an incorrect function name "checkEntailment" and adds a floating point example contributed by Eva Darulova.
2020-06-03New C++ Api: First batch of API guards. (#4557)Aina Niemetz
This is the first batch of API guards, mainly extending existing guards in the Solver object with checks that Ops, Terms, Sorts, and datatype objects are associated to this solver object. This further changes how DatatypeConstructorDecl objects are created. Previously, they were not created via the Solver object (while DatatypeDecl was). Now, they are created via Solver::mkDatatypeConstructorDecl, consistent with how DatatypeDecl objects are created.
2020-05-22Fix mistakes in sygus API comments. (#4520)Abdalrhman Mohamed
2020-05-21Make Grammar reusable. (#4506)Abdalrhman Mohamed
This PR modifies the Grammar implementation to make it reusable (i.e., can be copied or passed multiple times to synthFun/synthInv) with the catch that it becomes read-only after the first use.
2020-04-20Introduce a public interface for Sygus commands. (#4204)Abdalrhman Mohamed
This commit addresses issue #38 in cvc4-projects by introducing public API for Sygus commands. It also includes two simple examples of how to use the API.
2020-04-15Change option names --default-dag-thresh and --default-expr-depth (#4309)Andrew Reynolds
2020-03-31Rename checkValid/query to checkEntailed. (#4191)Aina Niemetz
This renames api::Solver::checkValidAssuming to checkEntailed and removes api::Solver::checkValid. Internally, SmtEngine::query is renamed to SmtEngine::checkEntailed, and these changes are further propagated to the Result class.
2020-03-11Simplifications to the Datatypes API (#4040)Andrew Reynolds
Removes DatatypeSelectorDecl and DatatypeDeclSelfSort. Add selectors is now inlined. A special case is added for the "self selector", instead of using a class as a dummy argument. I updated the Python files, although would be helpful to double check this is correct. Co-authored-by: makaimann <makaim@stanford.edu>
2020-02-25Sets & Relations Java example (#3816)mudathirmahgoub
2020-02-19Add Python bindings using Cython -- see below for more details (#2879)makaimann
2020-02-18Change datatype selector/constructor/tester to terms (#3773)makaimann
2020-02-12Rename Java package to edu.stanford.CVC4 (#3752)Andres Noetzli
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-17Updates to the unit tests, api, and examples for datatypes (#3459)Andrew Reynolds
* Updates to the unit tests, api, and examples for datatypes * Format
2019-09-25Use separate CMake project for CVC4 examples. (#3196)Mathias Preiner
2019-06-21Add floating-point support in the Java API (#3063)Andres Noetzli
This commit adds support for the theory of floating-point numbers in the Java API. Previously, floating-point related classes were missing in the JAR. The commit also provides an example that showcases how to work with the theory of floating-point numbers through the API.
2019-05-15Fix iterators in Java API (#3000)Andres Noetzli
Fixes #2989. SWIG 3 seems to have an issue properly resolving `T::const_iterator::value_type` if that type itself is a `typedef`. This is for example the case in the `UnsatCore` class, which `typedef`s `const_iterator` to `std::vector<Expr>::const_iterator`. As a workaround, this commit changes the `JavaIteratorAdapter` class to take two template parameters, one of which is the `value_type`. The commit also adds a compile-time assertion that `T::const_iterator::value_type` can be converted to `value_type` to avoid nasty surprises. A nice side-effect of this solution is that explicit `typemap`s are not necessary anymore, so they are removed. Additionally, the commit adds a `toString()` method for the Java API of `UnsatCore` and adds examples that show and test the iteration over the unsat core and the statistics. Iterating over `Statistics` now returns instances of `Statistic` instead of `Object[]`, which is a bit cleaner and requires less glue code.
2019-04-25New C++ API: Clean up API: mkVar vs mkConst vs mkBoundVar. (#2977)Aina Niemetz
This cleans up naming of API functions to create first-order constants and variables. mkVar -> mkConst mkBoundVar -> mkVar declareConst is redundant (= mkConst) and thus, in an effort to avoid redundancy, removed. Note that we want to avoid redundancy in order to reduce code duplication and maintenance overhead (we do not allow nested API calls, since this is problematic when tracing API calls).
2019-04-03Update copyright headers.Aina Niemetz
2019-04-01Update includes to use cvc4 top-level directory in examples (#2877)makaimann
Because the headers are now installed in a `cvc4` directory, the examples need to include from there as well.
2019-03-26Update copyright headers.Aina Niemetz
2019-03-18New C++: Remove redundant mkVar function.Aina Niemetz
s
2019-02-13New C++ API: Remove redundant declareFun function. (#2837)Aina Niemetz
2019-01-29New C++ API: Fix checks for mkTerm. (#2820)Aina Niemetz
This required fixing the OpTerm handling for mkTerm functions in the API.
2019-01-02New C++ API: Add tests for mk-functions in solver object. (#2764)Aina Niemetz
2018-10-19Remove autotools build system. (#2639)Mathias Preiner
2018-10-04New C++ API: Add checks for Sorts. (#2519)Aina Niemetz
2018-09-22cmake: Add target runexamples.Aina Niemetz
2018-09-22cmake: Guard examples that require Boost.Mathias Preiner
2018-09-22cmake: examples: Configure output directory per target.Aina Niemetz
2018-09-22cmake: Added java examplesAina Niemetz
2018-09-22cmake: Added target examples (currently .cpp examples only)Aina Niemetz
2018-09-22cmake: Added initial build infrastructure.Aina Niemetz
2018-09-12Examples: Remove obsolete flag CVC4_MAKE_EXAMPLES. (#2461)Aina Niemetz
2018-08-08Plug solver API object into parser. (#2240)Aina Niemetz
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback