Commit Graph

1813 Commits

Author SHA1 Message Date
Brian Huffman
50f54c9610 Fix test output due to addition of new primitive. 2018-06-14 06:22:59 -07:00
Brian Huffman
5ac32d1ad5 Add a variant of the demote primitive for type Z n.
intmod : {val, mn} (fin val, n >= val + 1) => Z n
2018-06-14 06:17:51 -07:00
Brian Huffman
daac41fdec Fix implementation of ^^ on type Z n in symbolic backend. 2018-06-14 06:16:04 -07:00
Brian Huffman
a8f3e189e0 Remove unused import. 2018-06-13 11:57:51 -07:00
Brian Huffman
ea9b0a9194 Make type Z n an instance of class Literal.
instance (fin val, fin m, m >= val + 1) => Literal val (Z m)
2018-06-13 11:55:26 -07:00
Brian Huffman
b3d2851923 Merge branch 'master' into literal-class
# Conflicts:
#	src/Cryptol/TypeCheck/Kind.hs
#	src/Cryptol/TypeCheck/Solve.hs
2018-06-13 11:41:35 -07:00
Brian Huffman
4f1a743585 Remove special cases in evaluator for types Z 0 and Z inf.
These types are now forbidden by the type checker.
2018-06-13 11:32:23 -07:00
Brian Huffman
ec19538a3b Make type Z n a partial type operator, requiring (fin n, n >= 1). 2018-06-13 11:16:46 -07:00
Brian Huffman
9a2437b727 Use size parameter in random value generator for type Integer. 2018-06-13 10:50:58 -07:00
Brian Huffman
30ba719343 Fix exhaustive and random testing for integers-mod-n type. 2018-06-13 09:35:12 -07:00
Brian Huffman
7da2219caf Initial implementation of type Z n (integers mod n).
This covers most of #510, including the type itself and the
class instances, but not any of the new primitive functions.
2018-06-11 18:03:18 -07:00
Brian Huffman
e11806f64a Reimplement comparison primitives by recursion on the TValue. 2018-06-11 16:40:57 -07:00
Brian Huffman
f7b8373a4a Fix incomplete pattern match warnings. 2018-06-11 15:33:46 -07:00
Brian Huffman
4adb4bc13a Remove unused constructors from Parser.AST.Type datatype. 2018-06-11 15:23:09 -07:00
Brian Huffman
9188878c4e Renamer handles built-in types like Integer and Bit using TApp. 2018-06-11 15:03:12 -07:00
Brian Huffman
d5c9a030da Split new modules Fixity and Selector from Cryptol.Parser.AST. 2018-06-11 14:28:49 -07:00
Brian Huffman
7cf26f8653 Remove dead code. 2018-06-11 11:10:53 -07:00
Brian Huffman
083d42ad30 Remove integer-based arguments to logicUnary and logicBinary.
Type `Integer` is not an instance of class `Logic`, so we don't need
to implement logic operations for this type.
2018-06-11 11:04:56 -07:00
Brian Huffman
2228c03565 Simplify case expression. 2018-06-10 12:42:10 -07:00
Brian Huffman
6b3dc6d9d4 For quick-checking integer properties, use a randomized bit width.
The distribution is unbounded, but is biased to smaller bit widths,
and is designed to have an average bit-width of 64.
2018-05-25 11:07:19 -07:00
Brian Huffman
c7d5f51240 Report "untestable type" error when using :exhaust with type Integer. 2018-05-24 17:24:11 -07:00
Brian Huffman
ab000984d2 Remove redundant prelude functions not, extend, and extendSigned.
These were recently moved here from Cryptol::Extras. They are duplicates
of existing functions `complement`, `zext`, and `sext`.

See #427.
2018-05-24 14:41:09 -07:00
Brian Huffman
960143668d Formatting code and comments in Cryptol.cry. 2018-05-24 13:23:26 -07:00
Brian Huffman
7c1de9c133 Add short section to Cryptol book about type Integer.
Fixes #468.
2018-05-24 13:04:10 -07:00
Aaron Tomb
c42a135fce Update tests to account for Cryptol::Extras merge 2018-05-24 09:23:17 -07:00
Aaron Tomb
99f3fdbf37 Merge Cryptol/Extras.cry with Cryptol.cry
Closes #427.
2018-05-23 15:55:05 -07:00
Brian Huffman
ddfe615a14 Document :exhaust command in the cryptol book. Fixes #466. 2018-05-22 15:17:15 -07:00
Brian Huffman
3a4bc6a2af Allow ":set <boolean-flag> = false" and ":set <boolean-flag> = true".
Previously we only allowed enable/disable, on/off, or yes/no.
2018-05-22 15:17:15 -07:00
Iavor Diatchki
9e3f7ec13f Merge branch 'master' of github.com:GaloisInc/cryptol 2018-05-22 14:27:12 -07:00
Iavor Diatchki
a0c15874e2 Factor out panic code into its own little package. 2018-05-22 14:27:03 -07:00
Brian Huffman
9fccc00867 Remove obsolete GF(2) polynomial primitives from reference interpreter. 2018-05-14 17:32:09 -07:00
Brian Huffman
26acdd0dad Pass pretty printing options to printer for reference interpreter.
(The options are not actually used yet.)
2018-05-14 17:03:00 -07:00
Iavor Diatchki
52f335deaa Asllow writing fancier kinds. This is in preparation for type primitives/abstract types. 2018-05-11 16:05:20 -07:00
Iavor Diatchki
e0cbfb1531 Fixup and clean-up checking of non-builting type applications.
Fixes #506
2018-05-11 10:38:00 -07:00
Iavor Diatchki
35ece3c3ed Use a datatype instead of Bool, to be more explicit about what it means. 2018-05-11 10:37:18 -07:00
Iavor Diatchki
2e2ac8c09d Just comments and layout 2018-05-11 10:07:12 -07:00
Iavor Diatchki
812ecec79c Fail if a built-in type has been applied to some arguments.
Fixes #507
2018-05-11 10:05:39 -07:00
Brian Huffman
13363c4c9b fastTypeOf doesn't perform any simplification when substituting types.
This makes it more useful for the saw-core translation, because we
can notice when type coercions need to be applied.
2018-05-10 15:23:53 -07:00
Iavor Diatchki
ec5e84dd37 Add a fin constraint on following matches in a comprehension.
Fixes #505.   It doesn't really make sense to have infinite things
following a finite thing in a comprehension, as there would be a whole
lot of unreachable elements.  Since this is likely an error, we try
to catch it with the types.
2018-05-07 11:52:43 -07:00
Iavor Diatchki
59aa5f11d0 Fix typos 2018-05-07 11:50:51 -07:00
Aaron Tomb
984012a1a4 Don't freeze base version in cabal freeze files 2018-05-04 10:40:31 -07:00
Aaron Tomb
ca982f9f56 Update sbv versions in cabal freeze files 2018-05-04 10:10:26 -07:00
Brian Huffman
62dfa1d58f Use sbv version 7.7. Fixes #486.
Also add regression test for #486.
2018-04-30 09:54:26 -07:00
Brian Huffman
42e89b11ae Make :check work for tests involving type Integer. 2018-04-20 16:00:32 -07:00
Brian Huffman
e8a941ecbd Add prelude docstrings for 'head' and 'last'. 2018-04-18 17:01:24 -07:00
Brian Huffman
3be72ae2cb Replace indexing primitives (!!) and (@@) with cryptol implementations. 2018-04-18 16:50:39 -07:00
Aaron Tomb
126c384ff6 Avoid most recent version of base-compat
The latest version causes build failures. Ultimately, we should be able
to fix the code to work with newer base-compat versions on various GHC
verions, but this gets builds to work for now.
2018-04-18 10:07:08 -07:00
Brian Huffman
2cdf9bd159 Replace primitives pmult, pmod, pdiv with cryptol implementations. 2018-04-15 06:56:20 -07:00
Diatchki
fb98ed89d9 Merge branch 'master' of github.com:GaloisInc/cryptol 2018-04-03 10:42:57 -07:00
Diatchki
a444f2bd31 Script to run tests easily.
This is convenient for when
using cabal new-build.
2018-04-03 10:41:08 -07:00