Commit Graph

908 Commits

Author SHA1 Message Date
Rob Dockins
c97988b568 Update metadata and add comments 2020-07-13 13:10:43 -07:00
Rob Dockins
972fa3425b Expose the asNonceExpr function 2020-07-09 12:28:57 -07:00
Rob Dockins
1f9e844b13 Simplify the OnlineSolver class so it only takes one parameter.
To make this work, we have to remove some phantom type parameters
from the `Yices` solver module.  I don't think they were contrinbuting
in any useful way.
2020-07-07 17:01:37 -07:00
Rob Dockins
558d47d1cb Break out the main App and NonceApp data types into a separate module.
This makes the `What4.Expr.Builder` module somewhat easier to navigate,
and may help reduce build times slightly.  To accomplish this change,
some API changes were necessary.  Most notable is the change to
`definedFn`, which now takes a datatype defining the unfolding policy
instead of a user-provided callback function.
2020-07-07 16:07:17 -07:00
Kevin Quick
a1290af1d5
Merge pull request #54 from GaloisInc/test_abstraction
Adds testing abstraction layer to remove direct test library dependency.
2020-07-07 09:37:35 -07:00
Rob Dockins
d40132e163 Limit the export list and update comments 2020-07-06 19:00:14 -07:00
Rob Dockins
9c711a7971 update code in a comment 2020-07-06 18:38:04 -07:00
Rob Dockins
5f1171ff83 Add realistic bounds for QuickCheck 2020-07-06 18:35:03 -07:00
Rob Dockins
a6f0f25c9e Merge remote-tracking branch 'origin/master' into test_abstraction 2020-07-06 17:51:55 -07:00
Rob Dockins
9951b827e2 Use Rank 2 types to close over the monad instance in
`Test.Verification`: this makes the testing changes have
very nearly no impact on the use sites.

Also remove the unnecessary `PropPropery` constructor.
2020-07-06 17:11:59 -07:00
Kevin Quick
d97954960e
Adds testing abstraction layer to remove direct test library dependency. 2020-07-06 08:35:53 -07:00
Rob Dockins
28125bcf53 Silence another noisy exception that sometimes occurs when
forcibly shutting down external solver processes.
2020-07-02 13:46:34 -07:00
Rob Dockins
51c3fb6526 squash import warnings 2020-06-30 12:38:29 -07:00
Rob Dockins
9bfde4f1ac Minor changes to process handling.
These changes make is to that threads that are waiting for
solver processes exit more gracefully if they are interrupted
by another thread throwing an exception to them.
2020-06-30 12:38:29 -07:00
Rob Dockins
218d7017e5 Add a smokeTest utility that performs a simple query test on a solver. 2020-06-30 12:38:29 -07:00
Andrei Stefanescu
4925cdf16e
Fix use of BVDomain.Arith.scale. (#51)
* Fix use of BVDomain.Arith.scale.

* Fix scale function and the unit test.

* Add the operation `scale` to the randomized BVDomain tests.

This operation was previously overlooked.

Co-authored-by: Rob Dockins <rdockins@galois.com>
2020-06-22 15:22:19 -07:00
Tristan Ravitch
95b600575c
Merge pull request #50 from GaloisInc/fix/issue-48
Fix a pretty printer typo for real multiplication
2020-06-19 12:47:09 -07:00
Tristan Ravitch
2ee2a13103 Fix a pretty printer typo for real multiplication
Fixes #48
2020-06-18 20:03:02 -07:00
Andrei Stefanescu
4b5b463bf1
Add BV or-shl-zext -> concat simplification. (#49)
* Add BV or-shl-zext -> concat simplification.

* Address comments.
2020-06-18 15:18:24 -07:00
Rob Dockins
72d105fd4e Add realTrunc and realRoundEven operations to fill out the
standard rounding modes.

Add test cases that prove the rounding operations satisfy their specifications.

Fixes #46
2020-06-15 17:09:19 -07:00
Valentin Robert
43516c6a32 Expose some SMT collector operations in SMTWriter. 2020-06-15 17:06:46 -07:00
Kevin Quick
5d1715aa82
Merge pull request #43 from GaloisInc/ghc_8_4
Make ADT field comments normal, not haddock for internal structure.
2020-06-04 21:43:14 -07:00
Kevin Quick
adb8c90f75
Make ADT field comments normal, not haddock for internal structure.
GHC 8.4 haddock does not support comments on individual fields of an
ADT.  This particular structure is internal only and lacks general
description haddocks, so simply converting these from haddock comments
to normal comments resolves this issue.
2020-06-04 18:32:46 -07:00
Ben Selfridge
213b23099c
migration to bv-sized representation (#34)
Update all `what4`-related packages to to concrete computation using the `bv-sized` library for fixed (but arbitrary) sized bitvector values.

Currently, the bitvector abstract domain computations are still being done directly on raw integers; we can revisit this in the future.

Co-authored-by: Ben Selfridge <benselfridge@000279.local>
Co-authored-by: Rob Dockins <rdockins@galois.com>
2020-06-04 15:07:57 -07:00
Rob Dockins
89e85e14f9 Tweak the BVDomain to handle common cases better.
Default to using the arithmetic mode so that when we union together
a collection of consecutive singleton values, we get a precise arithmetic
interval.  Add a test to the test suite to check for this property.
2020-05-28 13:37:32 -07:00
Kevin Quick
3a12e48f9e
Merge pull request #38 from GaloisInc/release_2_1_0
Update upper bound for parameterized-utils release 2.1.0.
2020-05-11 11:02:53 -07:00
Kevin Quick
7927ec39b7
Update upper bound for parameterized-utils release 2.1.0. 2020-05-08 17:26:15 -07:00
Rob Dockins
0a6a227f64 Implement the mixed domain overlap function, and add test cases for
the intermediate computations.  Also add a test that verifies that the
domain overlap test is precise; in other words, if the test indicates
that we have an overlap, then we can find a witness that constructively
proves that the two domains share a value.
2020-05-08 08:49:36 -07:00
Kevin Quick
245eb87d44 Use error instead of fail in tests for GHC 8.8 and later. 2020-05-08 08:49:36 -07:00
Rob Dockins
2fea904d3b Develop a precise test for mixed-domain overlap.
This turns out to be pretty tricky, but the Cryptol functions in this
patch demonstrate that we can compute a precise overlap test for mixed
bitvector domains without resorting to brute enumeration or other
inefficent methods.

The main operation of interest is the `bitwise_round_between` method,
which finds the arithmetically next value above some starting value
that is bitwise between consistent bitbounds.  This turns out to
be precisely what we need to test whether an arithmetic interval
which is nested "inside" a bitwise interval actually contains one
of the bitwise values.

It might be possible to simplify this operation, but the current
definition demonstrates it is possible using only word-level operations,
if we allow ourselves to use the `fillright` operation.
2020-05-08 08:49:36 -07:00
Rob Dockins
187443f2c5 Try to unstick the travis builds 2020-05-08 08:49:36 -07:00
Rob Dockins
eeabb06e1a Update what4-abc with new abstract domain representation. 2020-05-08 08:49:36 -07:00
Rob Dockins
2037458461 Fix some cases where domain values could overflow their bitwidth. 2020-05-08 08:49:36 -07:00
Rob Dockins
fcd94ded6e Add tests to the BVDomain test suite that check to ensure that
the results of domain operations are "proper", which means that
they satisfy their internal invariants.
2020-05-08 08:49:36 -07:00
Rob Dockins
8b0c3f22d1 Implement rotates, popcount and count zeros operations in the
bitvector abstract domains.
2020-05-08 08:49:36 -07:00
Rob Dockins
2e869fbcef Specialize the weighted sum, semiring product, and BVOrSet datastructures
to use the specific abstract sub-domain that is appropriate.
2020-05-08 08:49:36 -07:00
Rob Dockins
6cfdf1cd00 Implement the specialized XOR bitvector domain, and add random tests. 2020-05-08 08:49:36 -07:00
Rob Dockins
cce137e024 Reimplement the bitvector abstract domain using the two
Arithmetic and Bitvector domains, transitioning between them
only when necessary.  Add random tests for the combined domain.
2020-05-08 08:49:36 -07:00
Rob Dockins
12e36d6a22 Break out the bitvector domain computations into separate
arithmetic and bitwise domains, and provide quickcheck
properties for exercising the individual operations.

These quickcheck properties have been organized into a new package
test suite.
2020-05-08 08:49:36 -07:00
Rob Dockins
3083e4e818 Reorgainze the bitvector domain Cryptol specification
There are now three cooperating abstract domains: one for arithmetic
operations, another for bitwise operations and a third which is
an alternate presentation of the bitwise operation domain.
2020-05-08 08:49:36 -07:00
Rob Dockins
0a44276206 Relax base bounds for what4-abc and what4-blt 2020-05-07 13:09:38 -07:00
Rob Dockins
a2a81b7ee2 Update for GHC 8.10 2020-05-05 15:55:52 -07:00
Kevin Quick
1c4dcf094e
Merge pull request #35 from GaloisInc/no_test_warns
Remove warnings in what4 tests as well
2020-05-04 17:22:11 -07:00
Kevin Quick
2de1e20430
Remove unneeded imports in what4 iteexprs tests. 2020-04-27 15:12:44 -07:00
brianhuffman
e65ff5d487
Merge pull request #33 from GaloisInc/fix-warnings
Make code compile without warnings in ghc-8.6 and ghc-8.8.
2020-04-27 09:54:22 -07:00
Brian Huffman
6678683eb8 Make code compile without warnings in ghc-8.6 and ghc-8.8. 2020-04-23 20:26:28 -07:00
Rob Dockins
8d6bc58c6c Squash import warning 2020-04-17 16:27:14 -07:00
Rob Dockins
381fd05491 Further cleanups to SWord.
Make the bit order for indexed operations (at, set, slice, etc) more
obvious and provide both Big- and Little-endian variants.

Transition uses of "fail" to "panic" instead.
2020-04-17 16:27:14 -07:00
Rob Dockins
e43fd7ac26 Add an operation for generating a fresh SWord, and expand the definition
of the comparison operations to operate on zero-length words.
2020-04-17 16:27:14 -07:00
Rob Dockins
fc8b0a28d2 Tweaks to SWord 2020-04-17 16:27:14 -07:00