Commit Graph

2398 Commits

Author SHA1 Message Date
Iavor Diatchki
42b2ac6b45 Add parsing for binary and octal fractional literals.
I doubt these are super common but we add them for completeness,
and because with the floats we can print in those bases
2020-07-14 11:31:59 -07:00
robdockins
173a04fc01
Merge pull request #817 from GaloisInc/issue802
Suppress the `Must be at least` line of defaulting error
2020-07-14 11:27:26 -07:00
Aaron Tomb
2f4684c8af
Build system and documentation cleanup (#816)
* Remove `Makefile`
* Remove Travis and AppVeyor configurations
* Improve portability of the `cry` script
* Fix Docker builds
* Update documentation to remove references to `make`
* Update copyright dates
* Fix omitted section of CONTRIBUTING.md
* Update Z3 installation instructions

Fixes #570, #603, #790, #807.
2020-07-14 10:58:38 -07:00
Iavor Diatchki
6e412ed32e A hack to always print .0 for non base 10 numbers.
This helps with copy-pasting values, as non base 10 literals
are not overloaded.
2020-07-14 10:47:30 -07:00
Rob Dockins
bccc098a2b Suppress the Must be at least line of defaulting error
messages when the calculated bound is 0.
2020-07-14 10:32:57 -07:00
Jared Ziegler
1dd4bbd22c
Add additional SMT solvers to Docker image. (#811)
* Add additional SMT solvers to Docker image.

This change downloads specific stable release versions of each supported SMT solver to the Dockerfile. In cases where a build was available(yices, cvc4, Mathsat), it is downloaded directly. In other cases, it is build from a specific source snapshot (boolector, abc). These versions could be changes if desired.

This allows easy access to Cryptol and all solvers in a single Docker container, which is useful since some common problems are not amenable to solution with Z3 alone.

As with the original Cryptol Dockerfile, this implementation uses Docker's staged build functionality both to keep the final size as small as possible and to modularize the build. If desired, this segment could be copied verbatim to the SAW Dockerfile to add additional solvers there as well.

Note that this Dockerfile doesn't currently build. However, the new segment has been tested and does work. It may be desirable to update the rest of the Dockerfile before adding this change.
2020-07-13 16:47:25 -07:00
Iavor Diatchki
2605a276ac Allow writing floating point literals, as long as they can be represented 2020-07-13 16:22:13 -07:00
Iavor Diatchki
30056a0d28 Don't loose part of the type when you find an error. 2020-07-13 15:49:39 -07:00
Iavor Diatchki
449fa5ef41 Change the printing of the special values.
We use the same names as in `Float`, so that it is easy to copy an
and paste an answer.
2020-07-13 15:27:11 -07:00
Iavor Diatchki
3a6806136e Tweak names and printing for expressions evaluated at the REPL.
Fixes 587
2020-07-13 10:19:43 -07:00
robdockins
bafc6c7711
Merge pull request #792 from GaloisInc/parmap
Implement an experimental `parmap` operation
2020-07-09 11:18:15 -07:00
Rob Dockins
a4b137da4a Fix fragile tests 2020-07-09 10:54:03 -07:00
Rob Dockins
39eec9c90b Update CHANGES 2020-07-09 10:54:03 -07:00
Rob Dockins
0d7d98bcfb Add a trivial "parmap" implementation to the reference interpreter. 2020-07-09 10:54:03 -07:00
Rob Dockins
7b0f69de28 Implement an experimental parmap operation.
This is semantically the same as `map` on finite sequences,
but forks a separate Haskell thread for each element of the sequence.
When the GHC runtime is instructed to use multiple OS threads,
data-parallel exeuction can be achieved.
2020-07-09 10:54:03 -07:00
Brett Boston
58e83a0686
Merge pull request #806 from GaloisInc/elem-type-constraints-docs
Document element type constraints for enumerations
2020-07-08 11:24:06 -07:00
Brett Boston
088fe960e0
Merge pull request #800 from GaloisInc/repl-help-docs
Better document `:help` and `:set tc-debug`
2020-07-08 10:17:58 -07:00
Brett Boston
0e35995ee4 Document element type constraints for enumerations 2020-07-08 10:13:55 -07:00
Iavor Diatchki
8b68bd1373 Don't report the reason why a constraint is impossible twice 2020-07-07 15:51:16 -07:00
Iavor Diatchki
372d2bf3aa Make :m work the same way as :l
More precisely, in both cases we unload all modules and then reload
everything (this is what `:l` used to do, while `:m` only reloaded
the current module).  This fixes #668.

There are opportunities to be smarter here: in particular when we
reload modules, we do need to parse them so that we can find out what
their dependencies are, and if needed to reload those.  However, if
none of the dependencies have changed, and we didn't change, then we
could reuse the current module.  This could be quite useful for modules
that take a long time to load.
2020-07-07 15:34:03 -07:00
Iavor Diatchki
be408d7bfe Change to markdown preprocessor.
We now allow indented fenced blocks.  Apparently those happen if you
want to put code in a list.  This being markdown, things are ambiguous,
but the main change is that if we see an indented line that starts with
``` now we treat it as starting a fenced block, rather than an
indented code block.

This fixes #805
2020-07-07 13:44:51 -07:00
Iavor S. Diatchki
3c9c3280ec
Merge pull request #801 from weaversa/master
wording fix
2020-07-06 09:41:34 -07:00
weaversa
d4b4d5fe2f
wording fix 2020-07-05 14:54:34 -04:00
robdockins
1dbafa52fe
Merge pull request #774 from GaloisInc/defaulting 2020-07-02 16:55:11 -07:00
Brett Boston
0298e5aa38 Support long help descriptions + provide one for :help 2020-07-02 16:21:03 -07:00
Rob Dockins
a0b4e269eb Correct the commend describing how literal defaulting works. 2020-07-02 15:04:07 -07:00
Rob Dockins
e543ce4ce3 Remove an obsolete short-cut in the type inference engine.
This used to look for decimal literals applied to specific primitive
operations and cause them to silently default to bitvector types
large enough to hold their values.

With the new literal defaulting system, this special case is no longer
necessary.
2020-07-02 15:04:07 -07:00
Rob Dockins
ac3676ddde Fixup test suite 2020-07-02 15:04:07 -07:00
Rob Dockins
c2d053e940 style fixes 2020-07-02 15:04:07 -07:00
Rob Dockins
84e1a06536 Tenatively apply defaulting to definitions when typechecking the
rest of a module.  This helps prevent a single ambiguous size
variable from causing additional errors in other definition.
2020-07-02 15:04:07 -07:00
Rob Dockins
e9c22ad0cf Still compute width defaulting information as before, but
use that information to emit error messages rather than warnings.

This provides more specific messages than simply allowing the
affected type variables to remain uninstantiated and failing later.
It also causes some examples that otherwise would have ambiguous
types to fail earlier.  This converts some test instances where
REPL defaulting would eventually succeed into examples that fail
outright instead.  I largely think these instances are improvements.
2020-07-02 15:04:07 -07:00
Rob Dockins
7cd5e7bcef Change the default so that defaulting warnings are suppressed.
Now that we only default to unlimited-precision types, this warning
is considerably less useful.
2020-07-02 14:56:27 -07:00
Rob Dockins
620e62c8e3 Remove all defaulting, except for literals.
Fix up the test suite.  This mostly delays defaulting
warnings into "showing specific instance of polymorpic
type warnings", but requires actual fixes in a small number
of places.  Those places were higly questionable, in my opinion.
2020-07-02 14:56:27 -07:00
Rob Dockins
709dc939ed Change the defaulting rules for Literal constraints.
Instead of defaulting to `[n]` for some `n`, prefer instead
to default to `Integer` or `Rational` depending on the
other required constraints.
2020-07-02 14:56:27 -07:00
Rob Dockins
233830243a Add a hash-consing option that controls if the What4 backend
uses hash-consing when constructing terms.
2020-07-02 14:44:47 -07:00
Rob Dockins
35852baf1e Update CHANGES 2020-07-02 14:44:47 -07:00
Jared Weakly
5ffc213454 Use binary release from github release page on macos. 2020-07-02 14:44:47 -07:00
Jared Weakly
a108859925 Bump CVC4 2020-07-02 14:44:47 -07:00
Rob Dockins
b9a7e88b6c Fix the SBV any solver so that it waits for the first successful result.
Instead of relying on the internal SBV portfolio mechanism, we simply
do it ourselves "from the outside".  The SBV portfolio solver now works
in essentially the same way as the What4 one: if the first result we
get is an error, we continue waiting for other solvers and only
present exceptions to the user if all provers fail.

Fixes #798
Fixes #693
2020-07-02 14:44:47 -07:00
Rob Dockins
e73407a3f7 Fix the w4-any solver so that it waits for the first non-error
result before returning.  If all solvers return error results,
the collection of all errors is returned and presented to the user.
2020-07-02 14:44:47 -07:00
Rob Dockins
bce6747a03 Keep exceptions originating from What4 from bubbling out
and killing the REPL.
2020-07-02 14:44:47 -07:00
Rob Dockins
1be435c67a Set SBV bounds to >= 8.6
This is consistent with our current testing, and
fixes #795
2020-07-02 14:44:47 -07:00
Rob Dockins
06590ced48 bump what4 submodule 2020-07-02 14:44:47 -07:00
Rob Dockins
a9e2eed755 Add any solver support to the What4 backend.
This turned out to be relatively straightforward.  Using
a simliar strategy to SBV, we simply spawn off all the solvers
in separate threads and wait using the `async` package.
Some minor fixes in `What4` allow the threads to respond properly
to being interrupted.

Some care is required to install the necessary solver options
_before_ spawning off the threads to avoid race conditions
in the configuration datastructure itself; such race conditions should
be fixed in What4 at some point.
2020-07-02 14:44:47 -07:00
Rob Dockins
6be878f5e0 Run a smokeTest when selecting What4 solvers. 2020-07-02 14:44:47 -07:00
Rob Dockins
b351177378 Make prover names for :set prover= case insensitive.
We force solver names to lowercase before testing them
against the preset solver names from the backend.
2020-07-02 14:44:47 -07:00
Rob Dockins
512fed90e1 Search for both yices-smt2 and yices_smt2
When configuring the SBV `yices` solver, search for both
spellings of the SMTLib2 executable for `yices`.  Different
environments/packaging, for some reason, use different names
for this.

Fixes #592
2020-07-02 14:44:47 -07:00
Rob Dockins
cf9420262a Refactor how prover configurations are chosen.
Rather than looking up prover information by name every
time we do a proof, we fetch the prover configuration as soon
as the user selects a prover using `:set prover=` and remember
it as part of the REPL state.  This will allow us to
do some work at configuration time and remember the results.

As part of this refactoring, we now print the list of solvers
that SBV found when using `:set prover=any`.
2020-07-02 14:44:47 -07:00
Jared Weakly
71828412fb
Merge pull request #789 from GaloisInc/actions/deprecate-ghc-8.4-support
Remove GHC 8.4 from CI
2020-07-02 09:52:43 -07:00
Jared Weakly
677097310c Avoid pinning hsc2hs so that windows builds 2020-07-01 18:15:09 -07:00