Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental version of smtlib-backends-cvc5 #65

Merged
merged 7 commits into from
Nov 28, 2023
Merged

Experimental version of smtlib-backends-cvc5 #65

merged 7 commits into from
Nov 28, 2023

Conversation

goodlyrottenapple
Copy link
Contributor

I noticed that CVC5 has recently exported the parser into an API and have an example of parsing and executing SMTLIB commands: https://github.com/cvc5/cvc5/blob/main/examples/api/cpp/parser.cpp

I've implemented an initial version of smtlib-backends-cvc5 to use this API, however, there are a few caveats:

  • uses an unstable version of cvc5, hopefully the next release will include the new API
  • due to this bug on macOS https://gitlab.haskell.org/ghc/ghc/-/issues/11829, I've upgraded the nix shell to ghc 9.4.8 as I couldn't get the suggested fix work for the version of ghc in the current shell
  • The ParserException type doesn't seem to be exported in the parser API, so parsing errors are caught by a default catch (...) block, potentially giving sub-optimal error messages
  • The tests and likely any downstream executables have to be linked with clang++/g++. Not sure if this is likely to cause any issues?

Copy link
Member

@facundominguez facundominguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @goodlyrottenapple!

It looks like a fine contribution.

uses an unstable version of cvc5, hopefully the next release will include the new API

I'll edit the top-level README to mention this backend and remark the experimental nature of it.

due to this bug on macOS https://gitlab.haskell.org/ghc/ghc/-/issues/11829, I've upgraded the nix shell to ghc 9.4.8 as I couldn't get the suggested fix work for the version of ghc in the current shell

Fine by me. Worth mentioning in a new smtlib-backends-cvc5/README.md.

The ParserException type doesn't seem to be exported in the parser API, so parsing errors are caught by a default catch (...) block, potentially giving sub-optimal error messages

This is worth reporting to cvc5 devs. If you open an issue with them, it would be worth linking to it near the catchall.

The tests and likely any downstream executables have to be linked with clang++/g++. Not sure if this is likely to cause any issues?

There is not a problem that I can see for the other backends. Users of smtlib-backends-cvc5 might have to keep it in mind. Worth mentioning in smtlib-backends-cvc5/README.md as well.

basicUse =
-- 'CVC5.with' runs a computation using the 'CVC5' backend
-- it takes a configuration object as argument, whose use we describe in
-- 'settingOptions'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find this reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that was a copy paste from the Z3 library. Have now removed the reference.

smtlib-backends-cvc5/src/SMTLIB/Backends/CVC5.hs Outdated Show resolved Hide resolved
@goodlyrottenapple goodlyrottenapple marked this pull request as ready for review November 28, 2023 17:51
@goodlyrottenapple
Copy link
Contributor Author

This is worth reporting to cvc5 devs. If you open an issue with them, it would be worth linking to it near the catchall.

Perfect timing: cvc5/cvc5#10181 the issue was fixed just before I asked.

// should catch (ParserException& e) here - see https://github.com/cvc5/cvc5/issues/10181
catch (...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to single out ParserException's then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@facundominguez facundominguez merged commit 25e0baf into tweag:master Nov 28, 2023
4 checks passed
@goodlyrottenapple goodlyrottenapple deleted the smtlib-backends-cvc5 branch November 28, 2023 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants