You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR exposes the concrete term simplification routines already used
by the booster to the Python bindings so that they can be called from
Pyk. Specifically, it adds two free functions to the `runtime` module:
```python
simplify_pattern(Pattern, Sort) -> Pattern
simplify_bool_pattern(Pattern) -> bool
```
These are exposed as free functions because they depend on the runtime
library and so can't be automatically bound to the `Pattern` class as
methods; I suggest Pyk probably wants to monkey-patch them into its
`Pattern` class along with some kind of dynamic check for whether the
`runtime` module has been loaded or not.
Previously, the C and Python bindings didn't share a great deal of code;
the simplification routine is the first bit of non-trivial behaviour
that they need to share. I have therefore started a reorganisation of
the bindings code to extract as much functionality to a common library,
which has the additional benefit of reducing the amount of memory-leak
prone handling of C wrapper structures. To keep the diff in this PR
reasonable I have not completed this migration, but this is future work
that I will complete in a future PR.
A summary of the changes in this PR is as follows:
* Build a common bindings library that the C and Python bindings link
against.
* Extract the minimal set of features from the existing C bindings that
the Python bindings require to perform term simplification, and port the
C bindings over to calling the extracted common features.
* Add a test case to the Python bindings test suite that performs a few
small simplifications of sort `Int` and `Bool`; these are really just
smoke tests and Pyk should test the feature more thoroughly.
0 commit comments