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

Add CVC5 support #1504

Merged
merged 3 commits into from
Mar 6, 2023
Merged

Add CVC5 support #1504

merged 3 commits into from
Mar 6, 2023

Conversation

RyanGlScott
Copy link
Contributor

This patch:

  • Makes the necessary changes on the cryptol and cryptol-remote-api side needed add cvc5, w4-cvc5, and sbv-cvc5 solvers. This requires SBV 9.1 or later to include the changes from Consistently export solvers from Data.SBV.{Dynamic,Trans} LeventErkok/sbv#630, which re-exports CVC5-related functionality from all of the places that Cryptol imports from.
  • Adds a test case to ensure that basic CVC5 support works.
  • Updates the CI and Dockerfile to ensure that CVC5 is included from the what4-solvers bindists.

Fixes #1503.

Copy link
Member

@kquick kquick left a comment

Choose a reason for hiding this comment

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

Someday it would be nice to unify all those solver snapshot references into a single location. Somehow.

@RyanGlScott
Copy link
Contributor Author

I think I've set up everything correctly, but the test-lib, issues, windows-2019 CI job is mysteriously timing out with the message:

 Terminate batch job (Y/N)? 

Ugh. I will see if I can reproduce this locally.

@RyanGlScott
Copy link
Contributor Author

RyanGlScott commented Mar 1, 2023

I was able to reproduce this locally. The hang happens when running the :set prover=sbv-cvc5 command (but not when running :set prover=w4-cvc5). It appears that this command runs some SBV-related SMT2 commands, and I was able to reproduce the issue in a standalone SBV program as well. I have filed this upstream as LeventErkok/sbv#644.

I'm not quite sure what to do about this in the mean time. Should we remove sbv-cvc5, or just advertise the fact that it is broken on Windows?

@kquick
Copy link
Member

kquick commented Mar 2, 2023

My vote would be to leave it in and note the issue: I doubt we'll have immediate engagement on cvc5 such that it's worth the effort to remove it now and re-add it later. Assuming you can easily add a CI bypass, that is.

@RyanGlScott
Copy link
Contributor Author

I have good news and bad news. The good news is that the underlying issue in CVC5 (cvc5/cvc5#8900) has already been fixed upstream. I have no idea when we can expect a new CVC5 release with this fix, but I'm inclined to backport the bugfix to the version of CVC5 that we include in what4-solvers.

The bad news is that we still haven't quite figured out what causes SBV to go into an infinite loop when using CVC5 on Windows. I discovered in LeventErkok/sbv#644 (comment) two things:

  1. Changing from the default, POSIX IO manager on Windows to the newer (and generally more correct) native IO manager avoids the issue entirely. We may want to consider switching Cryptol to use the native IO manager, even independently of this issue.
  2. When using the POSIX IO manager on Windows, there is likely a GHC bug that is causing SBV to hang. We haven't quite gotten to the bottom of what it is yet.

@RyanGlScott
Copy link
Contributor Author

I have no idea when we can expect a new CVC5 release with this fix, but I'm inclined to backport the bugfix to the version of CVC5 that we include in what4-solvers.

Argh, except it isn't that simple. The problem is that what4-solvers isn't actually building its own Windows versions of CVC5, as it is currently impossible to build them natively on Windows—you have to use a somewhat elaborate cross-compilation setup. See GaloisInc/what4-solvers#4. As such, we have to download Windows releases from the CVC5 website. Unless we want to figure out how to replicate the cross-compilation setup in what4-solvers' CI (and truth be told, I really don't want to), I think it would be best to just wait for a new CVC5 release containing a fix for cvc5/cvc5#8900. I've opened GaloisInc/what4-solvers#31 as a reminder to bump the CVC5 version after this happens.

In the meantime, I will simply comment out the part of the test case that tests sbv-cvc5. We could always add it back later if we wanted.

This patch:

* Makes the necessary changes on the `cryptol` and `cryptol-remote-api` side
  needed add `cvc5`, `w4-cvc5`, and `sbv-cvc5` solvers. This requires SBV 9.1
  or later to include the changes from LeventErkok/sbv#630, which re-exports
  CVC5-related functionality from all of the places that Cryptol imports from.
* Adds a test case to ensure that basic CVC5 support works.
* Updates the CI and Dockerfile to ensure that CVC5 is included from the
  `what4-solvers` bindists.

Fixes #1503.
The previous version (`snapshot-20220812`) was using CVC5 1.0.1, which is too
old to work properly with `what4`. I have bumped the version to
`snapshot-20221212`, which includes CVC5 1.0.2.
CHANGES.md Outdated Show resolved Hide resolved
@RyanGlScott RyanGlScott merged commit c941edd into master Mar 6, 2023
@RyanGlScott RyanGlScott deleted the T1503 branch March 6, 2023 21:57
RyanGlScott added a commit to GaloisInc/saw-script that referenced this pull request Mar 22, 2023
The main payload of this commit is to bump the `what4` submodule to bring in
the changes from GaloisInc/what4#204. This also brings in a variety of other
submodule changes to accommodate this:

* GaloisIns/crucible#1068, which ensures that everything can build against
  `tasty-sugar >= 2.0` (the version of the library that `what4-1.4` depends on).
* GaloisInc/cryptol#1504, which adapts Cryptol to CVC5. This adjusts the lower
  and upper version bounds on SBV in Cryptol, so I do the same here in
  `saw-core.sbv.cabal` and `saw-script.cabal`.
* GaloisInc/language-sally#12, which performs a similar `what4` adaptation.
* GaloisInc/macaw#328, which performs a similar `what4` adaptation.
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.

Support CVC5
2 participants