Commit Graph

2261 Commits

Author SHA1 Message Date
Brian Huffman
3584a97e8b Factor out new function listParamSubst. 2018-11-15 16:47:35 -08:00
Iavor Diatchki
2e4adccccb Just a note 2018-11-05 15:11:27 -08:00
Brian Huffman
2994ef9143 Symbolic + and - on Z n reduce mod n when arguments are concrete.
Fixes #554.
2018-11-05 11:24:08 -08:00
Brian Huffman
ac13b5e4bd Symbolic * on type Z n reduces mod n when arguments are concrete.
This helps with #554.
2018-11-05 10:26:36 -08:00
Aaron Tomb
231fe95a40 Add note in manual about satNum and Integer 2018-11-01 08:25:23 -07:00
Aaron Tomb
dede87609e
Merge pull request #552 from LeventErkok/master
Fix satNum
2018-10-31 14:00:03 -07:00
Levent Erkok
b801e6677e Fix satNum
Since SBV 7.0; allSat is no longer lazy. So, Cryptol's current
implementation is buggy:

   Cryptol> :set satNum=2
   Cryptol> :sat \x -> x >(3:Integer)
   .. Runs forever ..

This pull request fixes the issue:

   Cryptol> :set satNum=2
   Cryptol> :sat \x -> x>(3:Integer)
   (\x -> x > (3 : Integer)) 4 = True
   (\x -> x > (3 : Integer)) 5 = True
   (Total Elapsed Time: 0.000s, using Z3)

Note that if you set `satNum` to be `all` and if there are indeed an
infinite number of satisfying models, SBV (and thus Cryptol) will still
loop forever. There's really no good way to solve that problem,
unfortunately.
2018-10-28 14:16:52 -07:00
Brian Huffman
20b9b1c193 Rename prelude function width to length, and generalize its type.
Fixes #550.
2018-10-10 16:21:38 -07:00
Iavor Diatchki
a8eab11b31 Changes to avoid irrefutable patterns.
This is to make things build with GHC 8.6, which requires a MonadFail
instance.

Pretty much all of these should end up being `panic`, so perhaps we should
rewrite more of them to call `panic` (instead of using lazy patterns)
2018-10-08 13:50:25 -07:00
Brian Huffman
515642328a Make :browse handle shadowing of names from dynamic environment.
Fixes #538.
2018-09-17 11:04:45 -07:00
Brian Huffman
634c5a03e7 Suppress REPL instantiation messages when warnDefaulting = off.
Fixes #543.
2018-09-17 09:46:00 -07:00
Iavor Diatchki
ad766b3aa7 Reformulate the property, so that Z3 can still find models.
With the other formulation, Z3  became really bad at finding any kind
of model.  Basically, it would always answer `unsat` or `unknown`.

This is undesirable, because we use models when instantiating things
at the command line.  In those cases, however, we probably don't
need the rule at all...  Perhaps, we should provide a way to disable
the axioms when we are looking for models?
2018-09-15 11:04:37 +03:00
Iavor Diatchki
a8d5963bfa Add another property of width.
Fixes #548
2018-09-14 22:50:30 +03:00
Iavor Diatchki
4e843a3435 More consistent statement of axioms for cryWidthUnknown 2018-09-14 10:21:08 +03:00
Aaron Tomb
3caa3a8e82 Use 32-bit GMP size limit on unknown architectures
There doesn't seem to be a general-purpose way to determine architecture
word sizes from CPP as invoked by GHC, so we now fall back on the 32-bit
GMP size limit for unknown architectures. This is always safe, and can
be amended to allow larger words on other architectures as needed.

Closes #542.
2018-09-12 11:28:24 -07:00
Aaron Tomb
0d0eb2cbc3 Fix path names of .md files during tests 2018-09-04 16:31:36 -07:00
Kevin Quick
96cdcf76aa
Add checkE to Cryptol.TypeCheck.Infer exports (for crucible-server). 2018-08-27 13:45:04 -07:00
Kevin Quick
0616c72017
Raise base-compat upper constraint to < 0.11. 2018-08-24 16:45:28 -07:00
Iavor Diatchki
e0557d1694 Do not use parameterized modules when proving.
It turns out this is not the same probelm as #545, which appears
to be working as expected.  It is, however, a related problem,
so we'll say it fixes #545
2018-08-16 10:56:46 +03:00
Iavor Diatchki
c52ae7466a Correct printing of "parameterized" on the REPL.
We only print it when the current module is parameterized.
2018-08-15 20:53:44 +03:00
Iavor Diatchki
72009435c2 Fix script, to deal with multiple versions of Cryptol 2018-08-15 20:26:56 +03:00
Iavor Diatchki
b7b1baa25b Fix test, to account for changes to eval context checking 2018-08-15 20:26:25 +03:00
Iavor Diatchki
5a9a3b4ff1 Change the check for valid evaluation context, and add missing checks.
Parameterized modules are not part of the evaluation context at all,
so now we check that we don't depend on *any* values from them.

Also, now we check both expressions and the schema, and also do
the check when proving not just evaluating.

Hopefully this fixes issue #545
2018-08-15 19:53:23 +03:00
Iavor Diatchki
3b6b183999 Make it more obvious when we've loaded a parameterized module. 2018-08-15 18:16:14 +03:00
Brian Huffman
77db0bd32f Add documentation and comments for Subst module. 2018-08-10 11:54:19 -07:00
Brian Huffman
c047273565 Reimplement type substitutions using IntMap instead of Map.
This speeds up the test suite by about 10%, and makes the example
file from issue #544 typecheck about 7x faster.
2018-08-08 10:54:54 -07:00
Brian Huffman
f2c1946633 Factor out new function tCon in SimpType module. 2018-08-08 10:10:14 -07:00
Brian Huffman
607a55c76a Fix warnings about unused import and declarations. 2018-08-02 17:31:52 -07:00
Aaron Tomb
45ee929b2d Bump Cabal version to 2.6.1 now that 2.6.0 is out 2018-08-01 14:39:56 -07:00
Aaron Tomb
cfeef862e1 Disable warnings about fixity of &&, ||
Fixes #241.
2018-08-01 14:38:44 -07:00
Aaron Tomb
6b926b1b3c Update Cabal file copyright 2018-08-01 09:05:39 -07:00
Aaron Tomb
70fa2033d5 Update Cabal file for Hackage acceptance 2018-08-01 09:01:30 -07:00
Brian Huffman
9b97c74b48 Polishing of :help output.
:help with primitive types now uses vertical whitespace to match
the :help output for other types.

Help text for REPL commands can now contain linebreaks.

For quoted Cryptol syntax in docstrings, consistently use singlequotes
(') instead of backquotes (`). Backquotes are sometimes used within
the quoted code, so it's probably best to avoid using them for quotes.

Consistently capitalize and put a period at the end of docstrings.
2018-07-31 11:33:50 -07:00
Brian Huffman
2e1dbad005 Improve tab completion for :set command. Fixes #154.
Tab now completes option names after `:help :set`.

Tab also completes `:help` with names of primitive types
and type classes (cf. #504).
2018-07-30 18:11:14 -07:00
Aaron Tomb
ba140fb70a Update Programming in Cryptol PDF 2018-07-30 16:36:04 -07:00
Aaron Tomb
4ab7399ef9 Bump frozen SBV versions to 7.10 2018-07-30 16:26:25 -07:00
Aaron Tomb
e42500e706 Update version to 2.6.0 in preparation for release
After the release, let's update the version to 2.6.1 immediately.
2018-07-30 13:24:33 -07:00
Aaron Tomb
b111e78a30 Minor fixes to Programming in Cryptol 2018-07-27 16:09:50 -07:00
Brian Huffman
9e7ae9f9ce Reintroduce demote as a copy of number for backward compatibility. 2018-07-27 14:01:18 -07:00
Brian Huffman
f609b36225 Rename primitive demote to the more self-explanatory name number.
The name "demote" is only meaningful to those who already know what
the Cryptol primitive does. Also, due to recent changes in the error
and warning messages, the name "demote" is showing up much more often
in REPL output. For example:

    Defaulting type argument 'rep' of 'demote' to [2]

    Showing a specific instance of polymorphic result:
      * Using 'Integer' for type argument 'rep' of 'Cryptol::demote'

These messages will hopefully be made less confusing to non-experts
if the name "demote" is replaced with "number".
2018-07-27 13:52:57 -07:00
Brian Huffman
78fa2d58aa Fix typo in comment. 2018-07-27 13:44:31 -07:00
Brian Huffman
34e6a18efe Fix Cryptol output in exercise solution in the book. 2018-07-27 13:18:03 -07:00
Brian Huffman
35ccec83ce Fix some typos in comments/docs. 2018-07-27 13:17:45 -07:00
Aaron Tomb
1bd0b813e0 Add a table of type-level operators to the book 2018-07-27 10:23:55 -07:00
Aaron Tomb
afd9df342b Better wording for multi-way conditional appendix 2018-07-27 10:23:29 -07:00
Iavor Diatchki
30b281dbff Fix build on older GHCs 2018-07-27 09:09:45 +03:00
Iavor Diatchki
4a9de75e8c Merge branch 'master' of github.com:GaloisInc/cryptol 2018-07-26 22:06:47 +03:00
Iavor Diatchki
027037d6ee Fix test 2018-07-26 22:06:31 +03:00
Iavor Diatchki
6d789a1d64 Preserve prefix - and ~ until the renamer.
This allows to print back expressions in a form that looks more like what
the user typed.  Fixes #541
2018-07-26 22:04:45 +03:00
Aaron Tomb
7027b599a7 Update some copyright notices 2018-07-26 09:08:32 -07:00