Commit Graph

1198 Commits

Author SHA1 Message Date
Langston Barrett
494ac6416e
Inject ground values back into symbolic expressions (#268) 2024-06-07 10:02:01 -04:00
Ryan Scott
85e68eba85 CI: Use CVC5 1.1.2
CVC5 1.0.2 appears to suffer from a bug that causes it to hang when run on the
`expr-builder-smtlib2` test suite. Let's upgrade to a more recent version that
does not suffer from this bug.
2024-06-03 12:08:08 -04:00
Ryan Scott
bcbfd9d3eb CVC5: Don't use Tuple workaround when declaring structs
Due to a bug in CVC4 (https://github.com/cvc5/cvc5/issues/3402), the What4
bindings to CVC4 avoid user-defined datatypes and instead use CVC4's built-in
`Tuple` datatype. This same `Tuple` workaround was applied to the CVC5 bindings
(added in #204), but they don't really work properly, as CVC4 and CVC5 use
completely different syntaxes for tuples. See #265.

We could attempt to update the CVC5 bindings to use the modern tuple syntax,
but this is somewhat non-trivial, as the syntax for 1-tuples changed in
`cvc5-1.0.9` from `Tuple` to `UnitTuple` (see
https://github.com/cvc5/cvc5/pull/10012). As such, we would have to generate
different code for different versions of CVC5, which would be unpleasant.

Thankfully, we need not worry about tuples at all when it comes to CVC5. This
is because the original CVC4 issue (https://github.com/cvc5/cvc5/issues/3402)
does not affect CVC5. As such, we can drop the tuple workaround entirely and
just generate user-defined datatypes to represent What4 structs, exactly like
the other solver bindings do. This means that we can fix #265 by simply
deleting code, which is nice.

This is regression-tested as part of the `expr-builder-smtlib2` test suite
(which includes several tuple-related tests), after a previous commit made it
so that the tests are run with both CVC4 and CVC5.

Fixes #265.
2024-06-03 12:08:08 -04:00
Ryan Scott
e5712726ff expr-builder-smtlib2: Actually run tests with CVC5
Due to a silly oversight, we weren't actually running the
`expr-builder-smtlib2` tests on CVC4. Instead, we were simply defining `let
cvc5Tests = cvc4Tests`, which meant that running `cvc5Tests` would simply
re-run the CVC4 tests.

This patch tweaks the tests to _actually_ run the tests separately with CVC5.
Doing so reveals some test failures with CVC5 specifically, all of which are
caused by the bug described in #265. I will fix this bug in a follow-up commit.
2024-06-03 12:08:08 -04:00
Ryan Scott
fcb0e38f1f expr-builder-smtlib2: Fix shadowed name warning 2024-06-03 12:08:08 -04:00
Ryan Scott
60cb3b8efe
Merge pull request #263 from GaloisInc/1.6
1.6 release prep
2024-05-15 11:26:21 -04:00
Ryan Scott
09e2a8a84d Bump what4 development version to 1.6.0.0.99 2024-05-15 10:12:17 -04:00
Ryan Scott
9324120977 Bump what4 release version to 1.6 2024-05-15 10:12:17 -04:00
Ryan Scott
e97989c069 CHANGES.md: Mention #258 2024-05-15 10:09:09 -04:00
Ryan Scott
97643c4a86 CHANGES.md: Mention #250 2024-05-15 10:06:34 -04:00
Ryan Scott
6c7a676a1d CHANGES.md: Mention #255 2024-05-15 09:59:43 -04:00
Ryan Scott
eb19778cf9 CHANGES.md: Mention #245 2024-05-15 09:59:10 -04:00
Ryan Scott
8c9401b5d2
Merge pull request #256 from GaloisInc/push-mux-ops-setting
Guard mux-pushing simplifications behind option
2024-05-14 10:05:59 -04:00
Ryan Scott
fa36855a8c Review comments 2024-05-14 06:52:06 -04:00
Ryan Scott
512eca6637 Document pushMuxOps in Haddocks and CHANGELOG 2024-05-13 16:41:55 -04:00
Ryan Scott
7c90b6a36b Merge branch 'master' into push-mux-ops-setting 2024-05-13 16:36:43 -04:00
Langston Barrett
30309b5d86
Add bv{Zero,One} helpers, hlint config (#258)
Fixes #257. The HLint configuration only checks that these helpers are
used where appropriate. I used it to find places where they would be
useful. It may also serve as a template for downstream repos. I added
HLint checking to CI as well.
2024-04-03 15:02:40 -04:00
Ryan Scott
c011f5b9fd
Merge pull request #255 from GaloisInc/ghc-9.8
Allow building with GHC 9.8
2024-03-04 15:08:03 -05:00
Ryan Scott
33f95836cd Refactor code to avoid needing unsnoc
The previous code, defined in terms of `unsnoc`, required multiple `panic`
cases, which was somewhat unsightly. This new implementation is functionally
equivalent, does not require any `panic` fall-through cases, and is much nicer
to look at.
2024-03-04 13:56:22 -05:00
Ryan Scott
11309c4843 Comment the length operands > 2 case 2024-03-04 12:46:51 -05:00
Ryan Scott
4a25bc2332 CI: Test GHC 9.8.1 2024-03-04 09:38:02 -05:00
Ryan Scott
86bbf67fb3 Allow building with GHC 9.8
This patch contains a variety of fixes needed to build the libraries in the
what4 repo with GHC 9.8:

* Bump the upper version bounds on `base` and `text` to allow building with the
  versions that are bundled with GHC 9.8 (`base-4.19.*` and `text-2.1.*`,
  respectively).
* Replace uses of `head` and `tail` (which trigger `-Wx-partial` warnings with
  GHC 9.8) with total functions or `panic`s, depending on what is appropriate.
* Bump the `aig` submodule to bring in the changes from GaloisInc/aig#16 and
  GaloisInc/aig#17.
2024-03-04 09:37:43 -05:00
Ryan Scott
72dd5ff574 Guard mux-pushing simplifications behind option 2024-03-01 11:16:40 -05:00
Ryan Scott
f1317962f6 Remove redundant import 2024-03-01 10:11:19 -05:00
Vekhir
735bac81af Bump text dependency
Builds fine
2024-02-01 11:17:18 -05:00
Andrei Stefanescu
670c8aca55
BV <> LIA translation for CHC solvers (#250)
* Fix SMTWriter fn name lookup.

* Add Pred and SymFn transformer.

* Translate Z3 CHC from bitvectors to integers.

* Always unfold functions to enable translation to saw core.

* Parse SMTLib extract and associative operators.

* Support bvlshr, bvudiv, bvurem in transformExprBV2LIA.

* More constant expression simplifications.

* More simplifications.

* Remove arrayIte concrete updates extraction.

* Address comments.
2024-01-18 19:54:05 -08:00
Andrei Stefanescu
d3b5907d78
More simplifications (#252)
* More constant expression simplifications.

* More simplifications.

* Remove arrayIte concrete updates extraction.
2024-01-17 21:07:15 -08:00
Ryan Scott
6f9915b553 CI: Remove Yices-2.6.1 configuration
This was removed from the `flakes` repo in GaloisInc/flakes#7. The rationale is
that odd Yices version numbers are development versions, and we only want to
test release versions. `what4`'s CI was testing 2.6.1 (a development version),
so let's just remove it.
2024-01-12 15:35:02 -05:00
Tristan Ravitch
108aac7777 Add a solver adapter for bitwuzla
Bitwuzla is a relatively new SMT solver with support for the bitvector,
floating point, array, and uninterpreted function theories. This patch adds the
necessary plumbing to invoke Bitwuzla using What4.

Co-authored-by: Ryan Scott <rscott@galois.com>
2024-01-12 15:35:02 -05:00
Langston Barrett
e46dff4209 Remove getUnannotatedTerm case for bound variables 2023-12-06 12:06:21 -05:00
Langston Barrett
be3e8b1189 what4: Don't annotate bound variables 2023-12-06 12:06:21 -05:00
Ryan Scott
076f49b996 Bump what4 development version to 1.5.1.0.99 2023-10-13 10:51:11 -04:00
Ryan Scott
13e788f234 Bump what4 release version to 1.5.1 2023-10-13 10:51:11 -04:00
Ryan Scott
1de86e42fc Mention versions-6–related changes in what4 changelog 2023-10-13 10:51:11 -04:00
Ryan Scott
c3f9e1bbeb Require versions >= 6.0.2
`versions-6.0.2` introduces a `Lift Version` instance, which finally allows us
to delete the ugly, CPP'd mess of orphan instances that we define in
`What4.Utils.Versions`.

Related to #240.
2023-10-12 14:56:09 -04:00
Ryan Scott
0489772d39 Allow building with versions-6.0.*
`versions-6.0.*` removes the `VChunk` data type, which `what4` defines an
orphan `Lift` instance for. This requires some CPP to fix up. This is somewhat
messy, and in an ideal world, we'd move these orphan instances directly to the
`versions` library. (See also https://github.com/fosskers/versions/issues/68.)

Fixes #240.
2023-10-10 10:58:24 -04:00
Ryan Scott
28744e48e0 Bump what4 development version to 1.5.0.0.99 2023-07-31 11:34:35 -04:00
Ryan Scott
0f0110e320 Bump what4 release version to 1.5 2023-07-31 11:34:35 -04:00
Ryan Scott
ed2aefb8bb Mention #232 in the what4 changelog 2023-07-31 11:34:35 -04:00
Ryan Scott
3b00db770c CI: Obtain GHC 9.4.2, 9.6.2 from nixos-23.05 2023-07-28 15:13:12 -04:00
Ryan Scott
f0e5db3c44 CI: Always save cache, even on failure 2023-07-28 15:13:12 -04:00
Ryan Scott
e7381c9baf CI: Test GHC 9.6 2023-07-28 15:13:12 -04:00
Ryan Scott
3a425a85d5 gen_matrix.pl: Set main GHC version to 9.2 2023-07-28 15:13:12 -04:00
Ryan Scott
a865c6b658 Remove unused th-abstraction dependency
Not only is it not used, the version bounds were interfering with GHC 9.6 build
plans. Let's just remove it.
2023-07-28 15:13:12 -04:00
Ryan Scott
c46f802d12 Support building with GHC 9.6
This patch contains a variety of fixes needed to build the libraries in the
`what4` repo with GHC 9.6:

* GHC 9.6 bundles `mtl-2.3.*`, which no longer re-exports `Control.Monad`,
  `Control.Monad.IO.Class`, and similar modules from `mtl`-related modules.
  To accommodate this, various imports have been made more explicit.
* `MonadTrans t` now has a quantified `forall m. Monad m => Monad (t m)`
  superclass in `mtl-2.3.*`. As a result, the `MonadTrans (PartialT sym)`
  instance must now have an `IsExpr (SymExpr sym)` instance context in order
  for it to typecheck, as this is the same instance context that `PartialT`'s
  `Monad` instance has.

  This is technically a breaking change, so I have noted it in the `what4`
  changelog. That being said, this change is unlikely to affect many people
  in practice, considering that the `MonadTrans` instance for `PartialT` is
  usually used in tandem with the `Monad` instance.
* Various upper version bounds on `base` have been lifted to allow building
  with `base-4.18`.
* The `aig` submodule has been bumped to bring in the changes from
  GaloisInc/aig#15, which allows it to build with GHC 9.6.
2023-07-28 15:13:12 -04:00
Ryan Scott
b987ec4cfe Whitespace only 2023-07-28 15:13:12 -04:00
Ryan Scott
2d22d4afaf Allow building with tasty-sugar-2.2.* 2023-05-04 11:33:54 -04:00
Ryan Scott
ffbad75b1c Allow building with tasty-sugar-2.1.* 2023-04-03 11:26:35 -04:00
Andrei Stefanescu
5a6864ace5
Simplify bvult by extracting sum common when sound. (#232)
* Simplify bvult by extracting sum common when sound.

* Add tests.

* Edit comments.
2023-04-02 19:41:35 -07:00
Ryan Scott
6c462cd46e What4 development version number 2023-01-27 09:49:48 -05:00