Commit Graph

1510 Commits

Author SHA1 Message Date
Brian Huffman
2c4157ecd4 Merge branch 'master' into logic-class 2017-09-21 16:44:39 -07:00
Iavor S. Diatchki
bec59d2faa On my computer this is only trustworthy. strange 2017-09-21 14:58:12 -07:00
Iavor S. Diatchki
d1abac0cec Update design; handle numeric type parameters in type checking SMT 2017-09-21 14:57:53 -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
Iavor Diatchki
f7e1a941e2 checkpoint 2017-09-21 09:28:01 -07:00
Brian Huffman
c4af07a053 Remove unused TokenKW constructors. 2017-09-20 11:38:36 -07:00
Iavor Diatchki
c3882a79b5 Named instantiations 2017-09-19 14:47:40 -07:00
Iavor Diatchki
9f2a2ac3a4 Incomplete example of using 'abstract' types. 2017-09-19 14:28:08 -07:00
Iavor Diatchki
9d0092cfd9 Typos and language fixes 2017-09-19 10:32:08 -07:00
Iavor Diatchki
dd46e174e0 Another iteration of the design. 2017-09-19 10:25:17 -07:00
Brian Huffman
b4cf793e7f Adapt fastSchemaOf function to avoid simplifying when instantiating props.
Previously, checking the type of e.g. "(&&) `{[2]b}" would not return
"(Logic [2]b) => [2]b -> [2]b -> [2]b" as expected, but
"Logic b => [2]b -> [2]b -> [2]b". This made it impossible to reconstruct
the instances necessary to produce the required Logic dictionary when
translating to saw-core.
2017-09-18 15:54:35 -07:00
Iavor Diatchki
4bbf2fbb5a Some notes no how the design might work. 2017-09-18 15:04:08 -07:00
Brian Huffman
c6db409837 Add type-matching functions pIsZero and pIsLogic. 2017-09-15 21:50:21 -07:00
Brian Huffman
35423d0243 Update test output. 2017-09-15 16:38:03 -07:00
Brian Huffman
b03f1ae0c2 Add class Zero with zero :: {a} (Zero a) => a.
Shift operators also have a `Zero` constraint on the element type.
2017-09-15 16:37:44 -07:00
Iavor Diatchki
b5196dfb44 Remove warnings, moudule is safe 2017-09-15 16:05:26 -07:00
Iavor Diatchki
f3a3b1cbd0 Start on implementing abstract types/constants (module parameters) 2017-09-15 16:05:16 -07:00
Brian Huffman
860060c085 Fix test output. 2017-09-15 14:05:27 -07:00
Brian Huffman
a52510e56b Add 'Logic' class constraints to Cryptol::Extras 2017-09-15 13:38:43 -07:00
Brian Huffman
d1305b2860 Add 'Logic' typeclass with operations complement, &&, ||, ^, zero.
Left and right shift operations also gain a Logic constraint,
since they shift in zero values.
2017-09-15 13:33:56 -07:00
Brian Huffman
571d186c6c Support toInteger/fromInteger with symbolic arguments in :prove/:sat. 2017-09-14 17:51:03 -07:00
Brian Huffman
5332d98261 Fix test output 2017-09-13 17:04:52 -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
Brian Huffman
5d73b5d405 Merge branch 'master' into integer
This involved plenty of non-trivial merge edits to fix compilation errors.

# Conflicts:
#	src/Cryptol/Eval.hs
#	src/Cryptol/Eval/Value.hs
#	src/Cryptol/Prims/Eval.hs
#	src/Cryptol/Symbolic/Prims.hs
#	src/Cryptol/Symbolic/Value.hs
#	src/Cryptol/TypeCheck/AST.hs
2017-09-13 14:28:04 -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