Commit Graph

1553 Commits

Author SHA1 Message Date
Rob Dockins
2894a1fdef Make solver startup/shutdown exception-safe. 2017-10-02 14:06:44 -07:00
Rob Dockins
12ac2c383a Revert "Remove the Data.Sequence-based representation of unpacked bitsequences."
This may improve performace on some examples.
This reverts commit d4b70a039a.
2017-10-02 11:12:50 -07:00
Iavor Diatchki
7135284f80 Basics of sort of module instantiation 2017-09-29 16:27:13 -07:00
Brian Huffman
940b9c80ec Merge branch 'integer' 2017-09-29 14:23:28 -07:00
Brian Huffman
5e4d094eb3 Fix test output due to counterexample printing change. 2017-09-29 14:23:18 -07:00
Aaron Tomb
da1ff8f225 Merge pull request #454 from madnight/patch-1
Update copyright notice year from 2016 to 2017
2017-09-29 10:59:16 -07:00
Brian Huffman
3fb74f7f60 Make :check and :exhaust print counterexamples the same way :prove does.
This addresses the first part of issue #449.
2017-09-29 10:19:56 -07:00
Iavor Diatchki
ff94ef30e1 Merge branch 'master' into abstract-types
# Conflicts:
#	src/Cryptol/TypeCheck/Depends.hs
#	src/Cryptol/TypeCheck/Infer.hs
2017-09-29 10:06:27 -07:00
Iavor Diatchki
fe88d98213 Merge branch 'master' of github.com:GaloisInc/cryptol 2017-09-29 09:44:42 -07:00
Brian Huffman
7be06d803e Fix typo in error message. 2017-09-29 09:28:46 -07:00
Iavor S. Diatchki
75ca6b7fa2 Say something if name does not refer to anything 2017-09-28 15:47:23 -07:00
Iavor S. Diatchki
aa44dd7860 Add support for docstrings on type things
See #456
2017-09-28 14:39:22 -07:00
Brian Huffman
d9cbfd62d1 Add instance Zero Integer. 2017-09-28 13:26:01 -07:00
Brian Huffman
cce32a4868 Merge branch 'master' into integer
This brings the Logic and Zero type classes into the integer branch.
2017-09-28 13:18:27 -07:00
Brian Huffman
7e34c25e4d Switch to infix syntax for blocks and padding operators.
"x /^ y" is x/y rounded up, i.e. the least n such that x <= y*n.
"x %^ y" is the least k such that x+k is a multiple of y.

For comparison,
"x / y" is x/y rounded down, i.e. the greatest n such that x >= y*n.
"x % y" is the least k such that x-k is a multiple of y.

The new syntax is much more suggestive of the relation to "/" and "%".
2017-09-28 10:26:31 -07:00
Brian Huffman
defadf8730 Fix cut-and-paste error. 2017-09-28 09:45:40 -07:00
Brian Huffman
1e41541405 Let type checker discharge fin (blocks x y) and fin (padding x y).
Both of these type operators are always either finite or undefined.
2017-09-28 09:28:07 -07:00
Fabian Beuke
ab75f152d1 Update copyright notice year from 2016 to 2017 2017-09-28 16:18:00 +02:00
Iavor Diatchki
3f80cc92f9 Checkpoint: not complete, commit to continue WFH 2017-09-27 16:43:00 -07:00
Brian Huffman
f04908a551 Adapt example code to use new blocks and padding operators. 2017-09-27 13:55:55 -07:00
Brian Huffman
9bc6d02019 Implement blocks and padding operators for numeric types.
The design is as described in issue #96:

blocks msgLen blockSize = the least n such that msgLen <= blockSize * n
padding msgLen blockSize = least k such that msgLen + k divides blockSize

or alternatively:

msgLen + padding msgLen blockSize = blocks msgLen blockSize * blockSize
2017-09-27 13:43:26 -07:00
Iavor Diatchki
aab03be26a More wibbles 2017-09-27 10:24:30 -07:00
Iavor Diatchki
208119fbbf Merge branch 'master' of github.com:GaloisInc/cryptol 2017-09-27 10:17:06 -07:00
Iavor Diatchki
6018af3537 Just documentation 2017-09-27 10:16:58 -07:00
Iavor Diatchki
920cb58ad0 Some cleanup and doubt that I've enconded the algorithm correctly 2017-09-27 09:50:47 -07:00
brianhuffman
c32d68dade Merge pull request #445 from GaloisInc/logic-class
Introduce a `Logic` class for bitwise logical operations
2017-09-27 09:10:47 -07:00
Brian Huffman
1ed5640339 Merge branch 'master' into logic-class
# Conflicts:
#	tests/mono-binds/test05.icry.stdout
2017-09-26 16:50:53 -07:00
Iavor Diatchki
8ea27a3c24 Keep track of tparam types; make bound vars be just tparams.
The two are very similar anyway, so it makes sense to merge the types.
This also helps display module type parameters using their name, rather
than treating them as unknown variables.

The whole printing of names system is still quite confusing, so maybe
there is a better way to do this, but keeping track of the source of
type parameters seems potentially useful information anyway...
2017-09-26 16:30:02 -07:00
Iavor Diatchki
b8707033d7 Add module parameters as extra vars---prints nicer error messages. 2017-09-26 15:29:23 -07:00
Iavor Diatchki
83d0132e50 Add module-level constraints to assumptions when proving implications. 2017-09-26 15:21:40 -07:00
Iavor Diatchki
12ee62ff9d Merge branch 'master' into abstract-types
# Conflicts:
#	src/Cryptol/TypeCheck/Solver/SMT.hs
2017-09-26 15:21:18 -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
8e7aff62b4 Checkpoint, adding constraints 2017-09-26 10:23:34 -07:00
Iavor Diatchki
7dc1ffc456 Some support for constraints on parameters. 2017-09-25 15:37:50 -07:00
Iavor Diatchki
2c07a55d15 Add call stacks here and there 2017-09-25 15:37:22 -07:00
Iavor Diatchki
9f3f592a2f Add a 5 second time-out to calls to z3 2017-09-25 11:41:20 -07:00
Iavor Diatchki
ccc4b828c2 Represent type parameters as just type variables. 2017-09-25 11:41:00 -07:00
Iavor Diatchki
019d935c2f Merge branch 'master' into abstract-types
# Conflicts:
#	src/Cryptol/Parser/Lexer.x
#	src/Cryptol/Parser/LexerUtils.hs
#	src/Cryptol/TypeCheck/Depends.hs
#	src/Cryptol/TypeCheck/Infer.hs
#	src/Cryptol/TypeCheck/Kind.hs
#	src/Cryptol/TypeCheck/Solver/SMT.hs
2017-09-22 16:23:12 -07:00
Brian Huffman
36f8fff3ca Support Integer type in reference evaluator (:eval). 2017-09-22 15:45:43 -07:00
Iavor Diatchki
0cc5151e6d Correct the handling of TCAnd in the SMT translation 2017-09-22 10:43:02 -07:00
Iavor Diatchki
9432f33ca1 Add some missing method defintions 2017-09-22 10:10:04 -07:00
Brian Huffman
1d71fa141c Merge branch 'master' into integer 2017-09-21 17:05:00 -07:00
Brian Huffman
d545abceec Fix incomplete pattern match warning caused by merge. 2017-09-21 16:47:36 -07:00
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