Rob Dockins
ed9742be5c
Use panic
instead of fail
2020-04-27 14:19:44 -07:00
Rob Dockins
85d727720d
Add sbv-any
and sbv-offline
to the no-warnings list
2020-04-27 14:19:44 -07:00
Rob Dockins
525ca4a6ec
Track what4 updates. Transition to use bvAtBE
bvSetBE
, etc.
2020-04-27 14:19:44 -07:00
Rob Dockins
8c9b9e9c53
Add "prefixed" versions of the SBV backend solvers in addition
...
to the default unprefixed ones (which are currently still
SBV-based).
2020-04-27 14:19:44 -07:00
Rob Dockins
904220c806
Add What4 provers alongside the SBV provers with names such as w4-z3
,
...
`w4-yices`, etc. Implement What4 based "offline" solving using
the pseudo-solver name `w4-offline`.
2020-04-27 14:19:44 -07:00
Rob Dockins
aaa0ea1744
Improve the what4 symbolic frontend. Individual solvers can
...
now be selected, and multisat queries are now supported.
2020-04-27 14:19:44 -07:00
Rob Dockins
5277c80522
Do explicit modular reduction for Z
operations when the inputs are concrete.
2020-04-27 14:19:44 -07:00
Rob Dockins
922350ff7a
Put together enough of the framework required to run :sat
and :prove
...
queries via What4. We still need to support configuring the solver to use,
multisat queries, and portfolio solving.
2020-04-27 14:19:44 -07:00
Rob Dockins
44a2b8e236
Very basic scaffolding for using what4 as a symbolic backend
2020-04-27 14:19:44 -07:00
robdockins
f29f0158ff
Merge pull request #703 from GaloisInc/issue702
...
issue702
2020-04-23 12:22:25 -07:00
brianhuffman
30b41e9c45
Merge pull request #700 from GaloisInc/fix-warnings
...
Fix warnings about redundant imports.
2020-04-18 06:34:52 -07:00
Rob Dockins
9434236cbd
Enforce a canonical field ordering in the field type constructor for FinType
...
This solves another manifestation of issue #702 .
2020-04-17 17:48:28 -07:00
Rob Dockins
194d02d06d
Sort the fields of a record type before comparing with the fields in
...
a concrete value in `toExpr`.
Fixes #702
2020-04-17 17:09:58 -07:00
robdockins
d8bf07320f
Merge pull request #638 from rjnw/master
...
Fix for freevars and adding some exports.
2020-04-17 16:25:01 -07:00
Brian Huffman
21a09179ff
Fix warnings about redundant imports.
2020-04-09 13:10:29 -07:00
Rob Dockins
c83f831763
Fix benchmark suite
2020-04-03 14:47:16 -07:00
robdockins
87ad864185
Merge pull request #684 from GaloisInc/eval-refactor
...
Evaluator refactor
2020-04-02 09:42:04 -07:00
Rob Dockins
4c6424c8a7
Fix for #662 .
...
This fix interprets integer division as "round down" division
in the symbolic simulator, to match the behavior of the concrete
simulator.
2020-03-30 22:53:10 -07:00
Rob Dockins
cfef882fe5
Minor tweaks in the concrete evaluator
2020-03-30 13:40:59 -07:00
Rob Dockins
bdfd4e6bc0
Add INLINE and SPECIALIZE pragmas to generate better code for the
...
concrete evaluator.
2020-03-30 13:01:06 -07:00
Rob Dockins
34ce8ecc00
Change uses of Z 0
to cause panics. The type constraints for
...
`Z` should make these cases impossible.
2020-03-30 09:54:27 -07:00
Rob Dockins
c94c929354
Comment tweaks
2020-03-30 09:35:00 -07:00
Rob Dockins
ffdf11d202
Minor style and bugfixes
2020-03-26 16:03:35 -07:00
Rob Dockins
058847f138
Break the symbolic query description datatypes into a separate
...
module, moving SBV specific code into `Cryptol.Symbolic.SBV`
2020-03-26 09:23:00 -07:00
Iavor Diatchki
fcc7a19998
More information when browsing.
...
This implements the feature request in #689
2020-03-24 16:53:48 -07:00
Iavor Diatchki
ec36d1aa38
Just comments and clean-up. Should contain no semantic changes.
2020-03-23 15:05:31 -07:00
Rob Dockins
0ce797f0c9
Fix a bugged implementation of symbolic bit update for SBV words.
2020-03-23 14:49:17 -07:00
Rob Dockins
d26966101f
Promote the logicShift
out of the SBV module into a generic implementation.
...
The concrete evaluator still uses a direct implementation, but this
one, based on a barrel-shifter, can also be used byt the what4 backend.
2020-03-23 14:49:05 -07:00
Rob Dockins
c2459cedb4
Minor consolidation/fixes to primitive definitions
2020-03-19 17:31:43 -07:00
Rob Dockins
20ad7e8e86
Remove the "round-to-zero" versions of integer division and modulus,
...
since we're going to restrict signed division to bitvectors.
2020-03-19 17:30:14 -07:00
Rob Dockins
72cf1ccd18
Implement the non-ring operations on Z_n via translation to integers
...
directly in the `Backend` class definition. Each backend was
essentially doing this anyway.
Also add an `integerAsLit` operation.
2020-03-19 16:44:38 -07:00
Rob Dockins
6029ed2198
More documenation in Backend
2020-03-18 14:31:16 -07:00
Rob Dockins
c3ab80721f
use wordAsChar
2020-03-18 14:30:54 -07:00
Rob Dockins
0cb075ead6
Rename intModXXX
operations to znXXX
. These names are less confusing.
2020-03-18 13:48:12 -07:00
Rob Dockins
5af4469fe1
Reorganize sequence index and update operations. They now uniformly
...
check for index in bounds conditions, and the interface between
the backend-specific operations is cleaned up.
2020-03-18 13:17:49 -07:00
Rob Dockins
9ed0c1d3a9
Make error
handling uniform across the symbolic and concrete backends.
...
Any non-concrete values in error messages are rendered as '?'
2020-03-18 08:28:36 -07:00
Rob Dockins
bc99e7d791
Take bitLit
out of the SEval
monad. The backends all support
...
a non-monadic version of bit literals, and it's somewhat more convenient.
2020-03-17 15:17:25 -07:00
Rob Dockins
47959c55cc
Rearrange/reorganize the primitive tables for the SBV and Concrete
...
backends to make them line up, and make it more obvious that most
of the primitives are uniformly defined for both backends.
The remaining primitives that have significant structural differences
are the sequence indexing and updating primitives, the shifts/rotates,
and `error`, `random` and `trace`.
While doing this, push the various to/from integer coercions
into the `Backend` class and make the operations uniform.
2020-03-17 15:04:36 -07:00
Rob Dockins
f016a9a9fc
Define carry
and scarry
instead of making them primitive.
2020-03-17 13:25:39 -07:00
Rob Dockins
e079ab4cf6
Push the Logic
, Cmp
and SignedCmp
class methods into the Backend
...
and use generic implementations.
2020-03-17 11:50:44 -07:00
Rob Dockins
31109c2143
Push error handling into the backend class using methods
...
that interact with the `SEval` monad. Also, finish pushing
the methods of the `Arith` class into the evaluation backend
where they can be generically referenced by both the concrete
and symbolic evaluators.
2020-03-16 17:52:59 -07:00
Rob Dockins
9d74dd1383
In symbolic evaluation mode, use a monad that tracks safety conditions
...
alongside the value being computed. For now, this is just the infrastructure;
soon, we'll push the computation of side effects into the `Backend`
class, where they can interact with this new monad.
2020-03-13 14:15:52 -07:00
Rob Dockins
b108bf0e79
Allow the evaluation monad to depend on the backend
2020-03-13 12:25:41 -07:00
Rob Dockins
71b2f8ce70
Rename the BitWord
class into Backend
, and split into a separate
...
module. Push primitive type if/then/else operations into the `Backend`
class, and promote `iteValue` and `mergeValue` to operations
on generic values.
2020-03-13 12:04:27 -07:00
Rob Dockins
8718489531
Create a new sentinal datatype Concrete
instead of using the unit
...
type to indicate concrete evaluation.
2020-03-11 14:08:30 -07:00
Rob Dockins
be45b4ea29
Move definitions specific to the concrete evaluator in to separate
...
modules. The module structure needs to be a bit more cut up than
I would like to avoid module import cycles.
2020-03-11 10:26:22 -07:00
Rob Dockins
bdb8f49143
Refactor Cryptol.Symbolic.Prims
and Cryptol.Symbolic.Value
into
...
a single new module `Crypol.Eval.SBV`.
2020-03-09 14:32:07 -07:00
Rob Dockins
0341fd0480
Split out the primitive definitions used by multiple evalautors
...
into a `Generic` module. Refactor the `EvalPrims` class away,
pusing the `iteValue` operation into `BitWord` and demoting
the `evalPrim` operation into an ordinary (non-typeclass)
operation.
2020-03-09 14:09:19 -07:00
Rob Dockins
fbbaed8c83
Rename module Cryptol.Prims.Eval
into Cryptol.Eval.Concrete
.
...
This fits better into the current module structure, and is a lot
less confusing.
2020-03-09 11:29:08 -07:00
Rob Dockins
d5a44a2d8d
Drop the Show
requirement for SBit
, SWord
and SInteger
2020-03-06 17:00:25 -08:00
Rob Dockins
0bee8c4167
Remove the BitsVal
constructor for WordVal
and instead exclusively
...
use the `LargeBitsVal` representation. This simplifies a lot of code,
and is probably more efficent in the most cases anyway.
2020-03-06 13:40:49 -08:00
Rob Dockins
df4332ea48
Remove unnecessary NFData constraints/instances
2020-03-05 16:53:41 -08:00
Rob Dockins
ce06a16d13
Push BitWord
operations into IO
and fixup
2020-03-05 16:28:56 -08:00
Rob Dockins
cb82015cd5
Refactor the BitWord
class to use associated types, and fixup use sites.
...
Uses of the `BitWord` operations now generally require an extra `sym`
argument that makes the types unambiguous, and this propigates through
quite a few functions. This other `sym` argument will be necessary
when we make a `what4` backend, so it's a necessary refactor anyway.
2020-03-05 10:29:06 -08:00
Brian Huffman
330d4dd2d9
Refactor Fixity module so Cryptol.Utils.PP can import it.
...
Also make some other parts of the code less dependent on the
internal representation of the Fixity datatype.
2019-12-16 18:05:30 -08:00
Brian Huffman
7211c9f251
Pretty-print infix type operators with unspecified fixity as infix.
...
Fixes #670 .
2019-12-16 18:02:56 -08:00
Brian Huffman
ccd388da2a
Do renaming on types the same way we do renaming on expressions.
...
Fixes #614 .
2019-12-13 11:12:36 -08:00
Brian Huffman
c230e2395c
Use Data.Map to normalize record field order in Value type.
...
Fixes #667 .
2019-12-06 15:48:50 -08:00
Brian Huffman
56f263895a
Fix bugs in the signed right shift operation.
...
Fixes #664 .
2019-11-26 22:23:00 -08:00
Brian Huffman
c859570234
Edit dropPrefix function to never require trailing whitespace.
...
Fixes #663 .
2019-11-21 06:45:41 -08:00
Brian Huffman
f99fe821da
Replace ornate help separator with more understated line of hyphens.
...
Fixes #660 .
2019-11-21 06:27:51 -08:00
Brian Huffman
5725d23e06
Add SBVException handler to prover calls. Fixes #444 .
2019-11-21 06:00:33 -08:00
Aaron Tomb
ddbd664326
Merge pull request #655 from GaloisInc/at-ghc-881
...
Fix build with GHC 8.8
Also updates CI to use GHC 8.4, 8.6, and 8.8 on both Travis and AppVeyor, and makes some small tweaks to make the tests pass in all six configurations.
2019-11-01 13:56:05 -07:00
Brian Huffman
42ab1ea48c
Reimplement readFileCmd
using a less memory-hungry expression.
...
When converting a binary file to a Cryptol expression, we now use
`split <large-literal>` instead of a list of 8-bit numeric literals.
To convert from `ByteString` to `Integer`, we use a balanced binary
fold to reduce the amount of allocation (and runtime) from O(n^2) to
O(n log n).
Fixes #346 .
2019-10-28 14:45:43 -07:00
Aaron Tomb
6c4101a0db
Use normalise
on file names when loading
...
This avoids unnecessary `./` at the beginnings of file names, which is
noisy and causes Windows tests to fail.
2019-10-28 13:48:07 -07:00
Aaron Tomb
8304eb74de
Better compilation fixes for GHC < 8.8
...
Now it actually runs!
2019-10-23 10:23:44 -07:00
Aaron Tomb
f275f082c2
Make build still work with GHC < 8.8
2019-10-22 16:40:02 -07:00
Brian Huffman
d163e61c63
Use appropriate markup for haddock code snippets.
...
Fixes #648 .
2019-10-21 15:24:01 -07:00
Brian Huffman
0a68d4e3a1
Haddock comment for instance Eq Type
. Fixes #645 .
2019-10-18 10:50:44 -07:00
Aaron Tomb
89ccdc0228
Fix build with GHC 8.8.1
...
This commit consists entirely of moving `fail` implementations to
`MonadFail` instance definitions.
2019-10-17 09:34:44 -07:00
brianhuffman
8581f8e0b2
Merge pull request #642 from GaloisInc/issue615
...
Make :dumptests check whether type is testable before starting.
2019-08-30 07:37:30 -07:00
Brian Huffman
64423cbcdc
Make :dumptests check whether type is testable before starting.
...
Instead of panicking, :dumptests will now print the message
"The expression is not of a testable type" when used with an
inappropriately-typed expression. Also, Integer return values
are now supported.
Fixes #615 .
2019-08-29 12:32:44 -07:00
Brian Huffman
9c55ec56c6
Export commandList
from module Cryptol.REPL.Command.
2019-08-28 11:22:29 -07:00
Rajan Walia
d26a80441f
factoring out fold in freevars
2019-08-08 11:07:05 -07:00
Rajan Walia
af1f590df7
adding more exports for code generation
2019-08-05 16:29:07 -07:00
Rajan Walia
90120932a7
fix for freevars of sequential where
2019-08-05 16:28:33 -07:00
Brian Huffman
12805bef0e
Avoid calling wordLit
with bitsizes greater than maxBitIntWidth.
...
Fixes #636 .
2019-07-24 16:50:40 -07:00
Brian Huffman
2e72a7387c
Replace fromIntegral
with fromInteger
or toInteger
where possible.
...
See #637 .
2019-07-24 13:13:11 -07:00
Brian Huffman
484f9fc631
Fix typos in comments.
2019-07-24 13:10:34 -07:00
Iavor Diatchki
ce26749142
Flush after storing, so that we can see the content.
2019-07-05 14:52:13 -07:00
Iavor Diatchki
8fe9f5efa9
Add support for working with in-memory sources.
...
Currently we only use this for the Prelude, which is baked into Cryptol.
Previously we used to save it in a temporary file, which would show
up in error messages, leading to bad user experience and unreliable
test outputs.
Also improves the shadowing errors.
Fixes #569
2019-07-05 14:09:04 -07:00
Iavor Diatchki
91b69e85cd
Remove debugging output.
2019-07-05 09:31:44 -07:00
Iavor Diatchki
7c708faa47
Show additional type constraints in help message.
2019-07-05 09:16:53 -07:00
Iavor Diatchki
a0b4b14f86
Make constraints on type constructors/functions explicit.
...
This is mostly working, but I still need to update the help on the REPL
to show the constraints.
2019-07-03 17:03:31 -07:00
Iavor Diatchki
971897d9ca
Use 'Prop' instead of '@' to write the kind of a constraint.
...
This is more consistent with how we've been printing kinds for a while,
so no need to change the notation.
2019-07-03 10:21:04 -07:00
Iavor Diatchki
72068cb961
Move type-level primitives to the Prelude.
...
For the time being, there is still some information about them that
is duplicated in Cryptol.TypeCheck.TCon, but we at least the parsed syntax
does not depend on the typechecked syntax.
2019-07-02 17:34:36 -07:00
Brian Huffman
8b0e236eec
Support element type ascriptions on list enumerations: [a,b..c:t]
.
...
Cf. issue #625 .
2019-06-27 14:31:06 -07:00
Brian Huffman
e03446dbc8
Adjust whitespace.
2019-06-27 14:25:08 -07:00
Brian Huffman
14d25e8f9a
Fix pretty printing for infix type/constraint synonyms.
2019-06-26 18:19:12 -07:00
Brian Huffman
10da255fd1
Re-implement infix type constraint (<=) as a constraint synonym.
...
Also removed special-case hack for (<=) in the renamer.
Also adapted test case output to account for the new prelude declaration.
2019-06-26 18:04:16 -07:00
Brian Huffman
17c47c4ac0
Update type pretty-printer to handle infix type synonyms.
2019-06-26 17:54:40 -07:00
Brian Huffman
fb86b1538c
Renamer looks up type operator fixities in the NamingEnv.
...
Primitive infix type operators are looked up in a hard-coded
table; everything else is looked up in the NamingEnv.
2019-06-26 17:36:46 -07:00
Brian Huffman
eadaf4473e
Add parser rules for infix type/constraint synonyms.
2019-06-26 17:35:19 -07:00
Brian Huffman
b54e4835ac
Make kind checker accept TInfix constructors from the renamer.
2019-06-26 17:29:55 -07:00
Brian Huffman
da1c509ffd
Propagate fixities from type declarations into the NamingEnv.
2019-06-26 16:54:40 -07:00
Brian Huffman
019d2af088
NoPat pass annotates type/constraint synonyms with fixities.
2019-06-26 15:20:00 -07:00
Brian Huffman
c0914c96df
Add fixity field to TySyn and PropSyn datatypes.
2019-06-26 15:13:37 -07:00
Brian Huffman
0f6e627b52
Fix typos in haddock comments.
2019-06-26 13:29:07 -07:00
Brian Huffman
546d7809e9
Remove fixity table from NamingEnv.
...
The Name type already contains fixity information we can use.
2019-06-26 13:17:13 -07:00
Brian Huffman
d3bc9baa43
Fix typo in haddock comment.
2019-06-26 12:59:41 -07:00