summaryrefslogtreecommitdiff
path: root/src/api/python
AgeCommit message (Collapse)Author
2021-04-05New C++ Api: Rename and move headers. (#6292)Aina Niemetz
2021-04-05parsekinds: Remove DEFAULT_HEADER. (#6294)Mathias Preiner
DEFAULT_HEADER in src/api/parsekinds.py is essentially unused since both genkinds.py scripts pass the kinds header to the script. The current value of DEFAULT_HEADER does not work for the scripts since the working directory for genkinds.py is in src/api/{java,python}.
2021-04-05python: Fix type casting in mkBitVector (#6261)NicolaasWeideman
Fixes #6260. Signed-off-by: Nicolaas <nweidema@usc.edu>
2021-04-01Refactor CLN dependency & Cleanup (#6251)Gereon Kremer
This PR migrates CLN to a new Find script and adds the possibility to install CLN if not found in the system. Also, it does a bit of cleanup.
2021-04-01Rename namespace CVC5 to cvc5. (#6258)Aina Niemetz
2021-03-31Rename namespace CVC4 to CVC5. (#6249)Aina Niemetz
2021-03-30Fix compilation of Python bindings for named build directories (#6244)yoni206
In current master, the following fails whenever <name> contains a /: ./configure.sh --python-bindings --name=<name> The reason is that src/api/python/genkinds.py adds a directory to the python path while relying on the fact that the build directory is located directly under the main repo directory, which is not the case if <name> contains a /. This PR fixes this by having cmake determine the right directory to add to the python path.
2021-03-20Generate cvc/Kind.java for the java API (#6143)mudathirmahgoub
PR changes: Refactor python/genkinds.py by separating parsing from file generation. Add java/genkinds.py to generate file Kind.java. Enable java API in ./configure.sh with "under development" warning.
2021-03-16cmake: Generate cvc4_export.h and set visibility to hidden. (#6139)Mathias Preiner
The build system (cmake) will automatically generate an export header cvc4_export.h, which makes sure that the correct export features are defined depending on the compiler and target platform. The macro CVC4_EXPORT replaces CVC4_PUBLIC and its usage is reduced by 2/3. Co-authored-by: Gereon Kremer <nafur42@gmail.com>
2021-03-09Update copyright headers to 2021. (#6081)Aina Niemetz
2021-02-24Enable -Werror. (#5969)Mathias Preiner
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-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-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-20Remove some Commands from the API. (#5268)Abdalrhman Mohamed
This PR removes Solver::getAssignment command from the API as there is no way to assign names to terms in the API. It also removes ExpandDefinitionsCommand, an internal functionality in CVC4.
2020-10-07New C++ API: Rename Term::isConst() to Term::isValue(). (#5211)Aina Niemetz
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-22[Python API] Conversion to/from Unicode strings (#5120)Andres Noetzli
Fixes #5024. This commit adds a conversion from constant string terms to native Python Unicode strings in Term.toPythonObj() and improves Solver.mkString() to accept strings containing characters outside of the printable range.
2020-09-22Add method to get Python object from constant value term in Python API (#5083)makaimann
This PR addresses issue https://github.com/CVC4/CVC4/issues/5014. It simply interprets the SMT-LIB string representation and produces a Python object. It currently supports booleans, ints, reals, bit-vectors, and arrays. The method (`toPythonObj`) is only valid to call if `isConst` returns true.
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-02[Python API] Add missing methods to Datatype/Term (#4998)Andres Noetzli
Fixes #4942. The Python API was missing some methods related to datatypes. Most importantly, it was missing mkDatatypeSorts, which meant that datatypes with unresolved placeholders could not be resolved. This commit adds missing methods and ports the corresponding tests of datatype_api_black.h to Python. The commit also adds support for __getitem__ in Term.
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-03Delete solver pointer in Cython __dealloc__ (#4799)makaimann
2020-07-31Add SyGuS Python API (#4812)yoni206
This commit extends the Python API with support for SyGuS functionality. This required the addition of a nullary constructor for `Grammar` in the C++ API. A unit test is also included, and is a translation of the corresponding C++ API unit test. Examples are not added yet, but are ready and planned for a next PR (in order to keep this one shorter).
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-29Python Sort tests (#4639)makaimann
This commit ports over the sort_black tests to the pytest infrastructure to test the Python bindings. It also adds missing functionality that was revealed during the testing.
2020-06-27Add API for retrieving separation heap/nil term (#4663)Andres Noetzli
This commit extends the API to support the retrieval of heap/nil term when separation logic is used and changes the corresponding system test accordingly. This commit is in preparation of making the constructor of `ExprManager` private.
2020-06-10Fix getKind for Python bindings (#4496)makaimann
I noticed recently that getKind for Op and Term was not correct in the python bindings. This PR would add maps to keep track of the Kind objects and the Python names (which are different from the C++ Kind names). Then a Python `kind` only needs the integer representation of a `Kind` to be constructed. Now, in `getKind` it can just pass the integer representation when constructing a `kind`.
2020-06-06Keep definitions when global-declarations enabled (#4572)Andres Noetzli
Fixes #4552. Fixes #4555. The SMT-LIB standard mandates that definitions are kept when `:global-declarations` are enabled. Until now, CVC4 was keeping track of the symbols of a definition correctly but lost the body of the definition when the user context was popped. This commit fixes the issue by adding a `global` parameter to `SmtEngine::defineFunction()` and `SmtEngine::defineFunctionRec()`. If that parameter is set, the definitions of functions are added at level 0 to `d_definedFunctions` and the lemmas for recursive function definitions are kept in an additional list and asserted during each `checkSat` call. The commit also updates new API, the commands, and the parsers to reflect this change.
2020-06-04Add a method for retrieving base of a constant array through API (#4494)makaimann
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-06-02Add Term::substitute to Python bindings (#4499)makaimann
2020-06-02Add hash Op, Sort and Term in Python bindings (#4498)makaimann
2020-04-03New C++ API: Remove Op::getSort(). (#4208)Aina Niemetz
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-12New C++ API: Remove support for (reset). (#4037)Aina Niemetz
Supporting SMT-LIB's (reset) command on the API level is dangerous and not required -- it's sufficient to just destroy the solver object and create a new one if necessary. It's dangerous because invalidated objects can be passed in after a reset, and we would need to find a clean way to guard against this. We want to guard against this in the future, but for now it is cleaner to make it explicit (by not having this functionality in the API but forcing the user to destroy and recreate the solver object) that these objects can't be reused.
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-03-11Add automatic Cython binding installation (#3933)makaimann
* Remove getIndices for Kinds * Test importing pycvc4 * Distutils install for pycvc4 * Use full path for cvc4kinds prefix * Remove zip_safe option (not needed for distutils) * Automatically clean up setup.py intermediate files * Rely on make install to install pycvc4 * Run make install when testing python bindings * Fix: Check importing pycvc4 when python bindings are built * Remove one -Wshadow warning for cython-generated files * Put the fake kinds submodule in generated __init__.py * Remove unnecessary file permission options in python CMakeLists * Respect install prefix unless in a virtualenv * Handle python2 print function * Use VIRTUAL_ENV environment variable to check if in python virtualenv * Add header and documentation to setup.py.in * Capitalize CVC4 in PyCVC4Install * Update src/api/python/CMakeLists.txt Co-Authored-By: Mathias Preiner <mathias.preiner@gmail.com> * Simplify CMakeLists for setup.py configuration * Shorten virtualenv check with Mathias's suggestion * Set TRAVIS_CVC4_PYTHON_BINDINGS to no in other builds * minor: bash syntax fix * Move pycvc4 import check to makeInstallCheck * Include installed pycvc4 location on PYTHONPATH * Better way to set PYTHONPATH Co-authored-by: Mathias Preiner <mathias.preiner@gmail.com> Co-authored-by: Andrew Reynolds <andrew.j.reynolds@gmail.com>
2020-02-19Add Python bindings using Cython -- see below for more details (#2879)makaimann
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback