Commit Graph

1329 Commits

Author SHA1 Message Date
Iavor Diatchki
6018af3537 Just documentation 2017-09-27 10:16:58 -07:00
Iavor Diatchki
60523d5986 Delete old solver stuff.
The main user visible effect of this might be that sometime things on
the Cryptol command line are instantiated in a slightly different way:
we get `inf` sometimes when we got a finite example before.

We could work around this if it is an issue, but I am not sure which
behavior is more reasonable.
2017-09-26 14:02:52 -07:00
Iavor Diatchki
0cc5151e6d Correct the handling of TCAnd in the SMT translation 2017-09-22 10:43:02 -07:00
Brian Huffman
2ce1ca3eca Change constraint synonym syntax from "constraint" to "type constraint".
For example:

type constraint NonZero n = (fin n, 1 <= n)

last : {n, a} NonZero n => [n]a -> a
last xs = xs!0
2017-09-21 13:21:51 -07:00
Brian Huffman
393a11e170 Implement constraint synonyms (#373).
The syntax is just as described in ticket #373: We have a new
declaration form consisting of the keyword 'constraint' followed
by a identifier and optionally a list of type parameters; the
right-hand side is either a single constraint or a parenthesized,
comma-separated list of type constraints. For example:

constraint NonZero n = (fin n, 1 <= n)

last : {n, a} NonZero n => [n]a -> a
last xs = xs!0
2017-09-21 09:40:22 -07:00
Brian Huffman
c4af07a053 Remove unused TokenKW constructors. 2017-09-20 11:38:36 -07:00
Aaron Tomb
c05281d390 Fix spurious failures due to lazy I/O
Regression test check31 was failing somewhat unpredictably due to the
use of lazy I/O when loading the Z3 prelude for the type checker. Using
the `strict` package seems to fix it.
2017-09-13 15:31:43 -07:00
Eric Mertens
28bc4f81de Work around happy bug by adding type signature on ipat 2017-09-11 10:36:59 -07:00
Eric Mertens
bf571569fa Add upper bound on happy
A bug introduced in happy-1.19.6 causes incorrect type signatures
to be generated in the parser source file which lead to type
checker errors
2017-09-11 10:20:22 -07:00
robdockins
bbcd39d400 Merge pull request #439 from GaloisInc/signed-arith
Add operations for signed arithmetic, and carry condition testing.
2017-08-17 10:27:18 -07:00
Robert Dockins
8333b81c16 Update CryptolPrims documentation 2017-08-16 18:26:40 -07:00
Robert Dockins
9550d1b8dd Update syntax documentation 2017-08-16 18:22:49 -07:00
Robert Dockins
ef047d3a19 Fix test breakage due to new operations in the Cryptol prelude. 2017-08-16 17:37:24 -07:00
Robert Dockins
cefc67a149 Implement signed division and remainder as methods of the Arith class.
Clarify the documentation that division is "round toward 0" division.
2017-08-16 17:34:22 -07:00
Robert Dockins
6a30560fc0 Implement the nested lexicographic order for signed comparisons.
This commit reorganizes how lexicographic comparisons are done in
the concrete simulator to reuse the same combinator from the symbolic
simulator.  This makes it more straightforward to implement the new
signed comparison.
2017-08-16 13:58:44 -07:00
Robert Dockins
86d28bc01e Merge remote-tracking branch 'origin' into signed-arith 2017-08-16 11:30:27 -07:00
Iavor Diatchki
b3f605d9f4 Pretty print with a bit more space, so we can see what's going on. 2017-08-15 10:52:32 -07:00
Iavor S. Diatchki
ca2136fab9 Merge pull request #440 from sliverdragon37/master
Adds the :ast and :extract-coq commands for printing out a parseable AST
2017-08-15 10:25:08 -07:00
Eric Mullen
05b8f0f3c1 more polished 2017-08-14 15:45:37 -07:00
Eric Mullen
505e565bbe performed all suggested changes except new module for ShowAST 2017-08-14 13:28:09 -07:00
Robert Dockins
987e4a0c3b Implement the type-level support required for the new SignedCmp class.
This class will represent types that can be meaningfully compared for
signed bitvector equality.  It lifts the comparison operations on
nonempty bitvectors through tuples, records and finite sequences via
lexicographic order.
2017-08-07 12:37:46 -07:00
Robert Dockins
a6d29c73c7 Merge remote-tracking branch 'origin' into signed-arith 2017-08-07 11:55:48 -07:00
Aaron Tomb
e40b15cc5d Fix type signatures in MiniLock SCrypt example 2017-08-07 08:37:20 -07:00
Robert Dockins
2b9e5a2421 Add signed and unsigned bitvector extensions 2017-08-04 17:04:29 -07:00
Robert Dockins
9a3b64e088 Fix the definition of the signed borrow function 2017-08-04 17:03:23 -07:00
Robert Dockins
e3dd83066e Rename signed bitvector operations to put the $ at the end 2017-08-04 17:02:10 -07:00
Robert Dockins
b1a821217e Merge remote-tracking branch 'origin/master' into signed-arith 2017-08-03 13:28:51 -07:00
Robert Dockins
4d974fefac Fix bugs in the signed right shift operation.
However, see the following SBV issue that currently affects
Cryptol behavior when computing signed right shifts with
symbolic index amounts:
https://github.com/LeventErkok/sbv/issues/323
2017-08-03 13:26:03 -07:00
Brian Huffman
1e453436b2 Fix grammatical errors in manuals 2017-08-02 19:46:26 -07:00
Brian Huffman
c5f34e1c51 Fix typos in Haddock strings 2017-08-02 19:46:03 -07:00
Robert Dockins
a68b835d51 Add operations for signed arithmetic, and carry condition testing. 2017-08-02 16:39:07 -07:00
Robert Dockins
08b334fce5 Rename LargeBitsVal into BitsVal
It is now the only unpack bitsequence representation, so no need to
distinguish it as being "large".
2017-08-01 16:26:24 -07:00
Robert Dockins
d4b70a039a Remove the Data.Sequence-based representation of unpacked bitsequences.
It appears to have negligable or negative performance advantages over
the representation on sequence maps.  Deleting the additional representation
removes a lot of code paths, and makes things somewhat simpler.
2017-08-01 16:04:25 -07:00
Robert Dockins
dcc143e3f4 Back out workaround for issue #375. 2017-08-01 15:08:04 -07:00
Robert Dockins
771d07f920 Implement new "large" bitsequence representation.
When bitsequences cannot be packed as words, they have been
represented using an explicit sequence datastructure containing
thunks for the individual bits.  However, for finite, but very large,
bitsequences this was consuming unacceptable amounts of memory.

When bitvector lengths cross an arbitrarily-designated threshold
(currently 2^16 bits) we instead use a sparse representation based
on SeqMap, similar to the representation used for other finite and
infinite sequence types.
2017-08-01 14:49:52 -07:00
Robert Dockins
063e3ba898 Update test suite to track typo fix 2017-07-31 14:39:01 -07:00
Robert Dockins
b564b21b31 Typo in error message 2017-07-31 10:04:52 -07:00
Robert Dockins
0b9c186132 Make 'random' compute on concrete inputs in the symbolic evaluator.
This patch does not add a warning when using 'random' in symbolic expressions.
We currently don't have any organized mechanism for generating warnings during
evaluation, and the value of emitting such a warning is debatable.

Fixes #364
2017-07-27 15:45:37 -07:00
Aaron Tomb
520ff9183a Build on Travis with GHC 8.2.1
Builds with 8.0.2 were timing out, and maybe this will help.
2017-07-27 12:08:05 -07:00
Robert Dockins
2fb706a44c Make sure EvalErrors are propigated to the REPL error handler.
This keeps runtime evaluation errors from killing the Cryptol process.
2017-07-26 18:05:30 -07:00
Robert Dockins
dba3d2f7d8 Avoid using partial indexing operations.
Instead raise evaluation errors when indexing into finite sequences
with invalid indices.
2017-07-26 18:04:38 -07:00
Robert Dockins
36dcd49803 Update the test suite now that issue #116 is fixed. 2017-07-26 15:31:36 -07:00
Robert Dockins
399a2e47d5 Add additional thunking in logical and arithemetic primitive operations.
This prevents a loss of desirable sharing in the interpreter, and turns
recursive algorithms with potential sharing from exponential-time to linear
time.  It appears to have little impact on other algorithms.

Fixes #432
2017-07-26 15:30:36 -07:00
Aaron Tomb
901a1d16ad Remove references to cryptol-server from README 2017-07-24 16:22:00 -07:00
Aaron Tomb
010540c4b4 Comment out cryptol-server from Cabal file 2017-07-24 15:26:49 -07:00
Aaron Tomb
69e49d4245 Bump version to 2.5.0 2017-07-24 09:16:40 -07:00
Aaron Tomb
de80a9c2f5 Update copyright dates in Cabal file 2017-07-24 09:01:34 -07:00
Aaron Tomb
2fd6599e0b Adopt LeventErkok's suggestion from #435
Closes #435.
2017-07-21 12:58:05 -07:00
Aaron Tomb
2885d469da Disabe the utf-8-ident test in a different way
If you use a `.fails` file, then the test suite fails if that test
succeeds, which it does on most platforms.
2017-07-21 12:25:44 -07:00
Aaron Tomb
bfe457f9ab Note that the test parser.utf-8-ident fails
This fails on Windows and we don't really know how to fix it. The fact
that it always fails masks more interesting failures, so I think it's
better to just skip it for now.
2017-07-21 11:04:06 -07:00