yav / simple-smt

BSD 3-Clause "New" or "Revised" License
20 stars 20 forks source link

add a Z3 backend, and more #23

Closed qaristote closed 1 year ago

qaristote commented 2 years ago

As explained in #22, I've been working on the possibility to use other backends (i.e. ways to interact with SMT solvers) than external processes, e.g. using Z3's C API. The point of this PR is not to be merged as is (unless you really like it), but to discuss what I've done and which features you would or would not be ready to merge. Here's a summary of the changes I made.

I tried separating these changes into different commits but this is still a big PR so, again, its point is not to necessarily be merged. I could create separate PRs for the different changes you'd be interested in for instance. I also haven't tested this code at all although I'm reusing tested code I wrote for Pirouette. I'll be writing tests next.

At Tweag we'd be interested in using simple-smt in two projects, Pirouette and LiquidFixpoint, if communication is done using bytestrings and the Z3 backend is available. We should also be able to help maintain the library if needed.

qaristote commented 2 years ago

I think these are all the features I wanted to add to the library. Again the point of this PR is not the be merged as is but to discuss which of these features you'd be interested in.

In our internal discussions we also came to the conclusion that it might make more sense to just create a separate library for communicating with SMT solver backends (using bytestrings), without tying it to any particular way of manipulating s-expressions. So it's likely we'll just create such a library, and you can always plug it in simple-smt if you're still interested in having alternative backends.

yav commented 2 years ago

Hello,

thank you for all this work. It is quite hard to review such a big pull request, you've kind of just rewritten the library :) Nothing wrong with this, but it might be easier to discuss things if the PR was split into multiple smaller PRs, each with a specific topic. Alternatively, I'd just have to find a large enough chunk of time to see what's happening here.

As a general note, I am using this library on a number of projects, so we should consider backward compatibility at least somewhat.

Also, I am not sure what you are planning to do with SMT, but if you are interested in a slightly more full featured library, you may want to have a look at what4 (https://github.com/GaloisInc/what4).

I'll try to find time to look through the PR on the weekend though.

qaristote commented 2 years ago

Yeah this is a big PR, I got carried away, sorry about that ! But a big part of the diff is just splitting the main file into several files, so hopefully the pointers I gave above are enough to get the gist of the features. Feel free to take your time and ask questions, and thanks for giving this a look :) (and thanks for the link to what4, I'll give it a look !)

qaristote commented 1 year ago

In our internal discussions we also came to the conclusion that it might make more sense to just create a separate library for communicating with SMT solver backends (using bytestrings), without tying it to any particular way of manipulating s-expressions.

We ended up doing just that: the library is available here. I'll thus close this PR now, but feel free to take inspiration from it :)