Commit Graph

2364 Commits

Author SHA1 Message Date
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
Jared Weakly
99d563790f Run cabal update unconditionally before configure 2020-07-01 16:43:33 -07:00
Jared Weakly
79c9049730 Remove GHC 8.4 from CI 2020-07-01 16:43:33 -07:00
Brett Boston
6de2283ace
Merge pull request #794 from GaloisInc/module-doc-clarification
Clarify that each file can only contain a single module
2020-07-01 13:34:35 -07:00
Iavor Diatchki
332450ebb2 Switch to using libBF from hackage 2020-07-01 11:35:45 -07:00
Kevin Quick
745dc77f19
Added arrayPrim to generate PrimIdent, alongside prelPrim and floatPrim. 2020-07-01 10:38:10 -07:00
Iavor Diatchki
f6213aff33 Improve error messages when we know a constraint will always fail.
This changes the way the special "Error" type is used. The error
message now contains only an explanation of what happened,
and the actual malformed type is the parameter of the error function,
which is always used at kind `k -> k` where `k` is the malformed kind.

This fixes (or at least improves) #768
2020-06-30 20:03:50 -07:00
Brett Boston
a87684aad4 Clarify that each file can only contain a single module 2020-06-30 19:10:33 -07:00
Iavor Diatchki
670982254b Some improvement on issue #768.
The error messages are better but still need a bit of work,
especially when there are malformed types, such as `0 - 1`
2020-06-30 18:09:23 -07:00
Rob Dockins
ea5508a638 Add some additional conveniences to RecordMap and
address review comments.
2020-06-30 12:34:50 -07:00
Rob Dockins
ac85c25389 Doc typos 2020-06-30 12:34:50 -07:00
Rob Dockins
249ad85d27 Add unit test to make sure we reject records with repeated fields 2020-06-30 12:34:50 -07:00
Rob Dockins
6c6cb94d46 Implement and use a new RecordMap type.
This type stores records as a finite map from field names to
values, while also remembering the original order of the fields
from when the record was generated (usually, from the program source).
For all "semantic" purposes, the fields are treated as appearing in
a canoical order (in sorted order of the field names).  However, for
user display purposes, records are presented in the order in which
the fields were originally stated.

In the course of implementing this, I discovered that we were not
previously checking for repeated fields in the parser or typechecker,
which would result in some rather strange situations and could probably
be used to break the type safety. This is now fixed and repeated fields
will result in either a parse error or a panic (for records generated
internally).

Fixes #706
2020-06-30 12:34:50 -07:00
robdockins
87d5edab00
Documentation updates (#779)
* Add docstrings for all prelude functions and fix minor style issues.

Fixes #771

* Update `CryptolPrims` documentation

* Minor updates to the prelude

* Update CHANGES

* Updates to the cryptol book and CryptolPrims

* Fix several additional docstrings

* Specify and document properties of signed bitvector division.

Fixes #677

* Fixup test

* typos and style

* Regenerate PDFs
2020-06-30 10:58:25 -07:00
Iavor Diatchki
e291e8c827 Change dependency again 2020-06-29 15:31:34 -07:00
Iavor Diatchki
a0da7d7f97 Update to latest master 2020-06-29 15:31:34 -07:00
Iavor Diatchki
0047eaf77a Initial support for floating point computation 2020-06-29 15:31:34 -07:00
Brett Boston
7caf72abb4
Merge pull request #785 from GaloisInc/syntax-polynomial-docs
Document polynomial syntax + escape pipes in Version2Table
2020-06-29 14:40:28 -07:00
Jared Weakly
625ea505fd
Merge pull request #783 from GaloisInc/actions/disable-ghc-8.8.3-windows
Disable builds on windows for which there's a memory leak
2020-06-29 09:44:28 -07:00
Rob Dockins
07b81b3b9c Add a command-line option to disable unicode characters in the REPL logo
Fixes #659
2020-06-29 08:36:19 -07:00
Brett Boston
f742b1614a Document polynomial syntax + escape pipes in Version2Table 2020-06-26 15:32:47 -07:00
Rob Dockins
d2490e724f Implement roundToEven and roundAway.
The old `round` operation is renamed into `roundAway` to make its
semantics more obvious.
2020-06-25 13:52:36 -07:00
Jared Weakly
f915b118da disable builds on windows for which there's a memory leak 2020-06-24 13:36:49 -07:00
Rob Dockins
6a05e86658 unit test for issue 712 2020-06-23 12:42:03 -07:00
Rob Dockins
a95fab29c5 Be more careful about using fromInteger in the parser.
Fixes #712
2020-06-23 12:42:03 -07:00
Brett Boston
f54f671731
Merge pull request #773 from GaloisInc/doc-fixes-brett-dev
Minor typo fixes in Cryptol documentation
2020-06-19 14:42:41 -07:00
Jared Weakly
144a54c6de
Merge pull request #761 from GaloisInc/actions/improve-nightlies
Improve nightlies and add cvc4
2020-06-19 12:40:43 -07:00
Rob Dockins
dea6c9f633 Regression test for new :safe feature. 2020-06-19 12:11:29 -07:00
Rob Dockins
6a0fe05d78 Add a new :safe command that attempts to prove that a term
is safe for all inputs.

This is similiar to the `:prove` command, except that it ignores
the computed value and only checks for safety condition violations.
Because the value is ignored, a wider variety of types can be
checked with `:safe`.  Instead of just `Bit`, any finite return
type is allowed.
2020-06-19 12:11:29 -07:00
Rob Dockins
8641baa599 Add a new "ignore-safety" flag that causes :prove and :sat
calls to ignore safety predicates on terms.
2020-06-19 12:11:29 -07:00
Rob Dockins
f52d30e829 Refactor the way :prove counterexamples are represented and printed.
This allows us to distinguish cases where counterexamples find inputs
that violate safety conditions from cases where inputs cause the
predicate to be false.
2020-06-19 12:11:29 -07:00
Rob Dockins
332a0a3fdc Add an assert combinator to the prelude.
Fix up fragile test outputs.
2020-06-19 12:11:29 -07:00
Rob Dockins
8a0e92bf6e Remove the ordering operations on Z_n 2020-06-19 12:00:12 -07:00
Rob Dockins
6bedcbb4b3 Add a new Eq typeclass for types that have equality tests.
The `(==)` and `(!=)` operators move into the new `Eq` typeclass,
which becomes a superclass of `Cmp` and `SignedCmp`.
2020-06-19 12:00:12 -07:00