Commit Graph

1332 Commits

Author SHA1 Message Date
Eric Mullen
a67e350175 got rid of the pesky ascii logo 2017-06-26 13:32:31 -07:00
Eric Mullen
b456831602 give better names to type variables,and include a tool to print the AST 2017-06-26 13:23:08 -07:00
Aaron Tomb
49e847387e Simplify some type signatures in examples
These examples weren't type checking, and now do, with type constraints
that are no more awkward, and arguably less awkward, than before.
2017-06-22 10:09:13 -07:00
Eric Mullen
76dacbe1cd types print out correctly 2017-06-20 12:20:56 -07:00
Aaron Tomb
e282c65a7e Fix test failures from latest type checker changes
Recent changes resolved issue 002, so we no longer need to indicate that
it's expected to fail. Other small changes to the type checker have
made things like type variable numbers change slightly.
2017-06-20 10:08:36 -07:00
Eric Mullen
e28c0c43db explicit printing of decl groups 2017-06-16 17:37:54 -07:00
Iavor S. Diatchki
39b1e84dd3 When solving selectors, keep trying if any unifications happened 2017-06-16 16:05:51 -07:00
Iavor S. Diatchki
38f3a54a36 Comments, + apply the correct substitution 2017-06-16 16:04:56 -07:00
Iavor S. Diatchki
0985508bbc Add fin constraints on the message mart of trace. 2017-06-16 09:58:11 -07:00
Eric Mullen
ab0926e4eb print out all the declarations, not just current module 2017-06-15 17:20:32 -07:00
Eric Mullen
237a1bac7e don't print out proof things for now 2017-06-15 17:01:17 -07:00
Iavor S. Diatchki
509ef089c0 change in normalization of Min
Previously, we would factor out constants from `min`, now we push them in.

Thus:  `3 + min a b` becomes `min (3 + a) (3 + b)`.
This allows nested `min` to flow next to each other and interact.

We also add rules for moving constants out of nested `min`:

min a (min K b) ~> min K (min a b)

and another useful rule, which sort of factors out the constants again,
but notice that the result does not have a `min` in it.

min (K1 + a) (K2 + a) ~> min K1 K2 + a
2017-06-15 16:55:38 -07:00
Iavor S. Diatchki
fab66bbf36 New rule: min K1 a >= K2 ~> a >= K2 if K1 >= K2, and False otherwise 2017-06-15 16:51:16 -07:00
Iavor S. Diatchki
627d5aa269 Some code that is useful for tracing the simplifier when debugging. 2017-06-15 16:50:18 -07:00
Iavor S. Diatchki
7a42065a94 Just some comments that make it easy to disable defaulting. 2017-06-15 16:49:46 -07:00
Eric Mullen
a0cf0543c0 no longer defining new versions of Show, using different typeclass 2017-06-15 14:32:40 -07:00
Eric Mullen
c568c32855 :all command and :ast command work 2017-06-14 16:41:47 -07:00
Eric Mullen
3b80614a09 added :ast command, working on printing out all definitions 2017-06-14 15:45:28 -07:00
Brian Huffman
13fef57cca Updated with latest changes to Eval/Reference.lhs (5d9d8ba7) 2017-06-05 09:52:03 -07:00
Brian Huffman
9a267b1f0c Removed definition of binary infix (~) from Cryptol prelude. Fixes #423.
This change partially reverts changeset c620cbf2, which fixed #296,
which was about supporting `:t (~)` in the REPL.

As of this change, `:t (~)` will no longer work in the REPL.
The regression test for issue #296 is removed.
2017-05-24 09:39:50 -07:00
Brian Huffman
007c74cd97 Update doc-strings to mention syntactic sugar for complement and sequences. 2017-05-24 09:09:28 -07:00
Brian Huffman
5d9d8ba733 Avoid using copyByValue with the wrong type. Fixes #420. 2017-05-15 17:51:22 -07:00
Robert Dockins
d891fde0c7 Fix a corner case for join on 0-length inner sequences.
Both the standard and the reference interpreter were producing
incorrect behaviors.  The correct behavior is to return an
empty sequence.

Fixes #395.
2017-05-10 17:49:37 -07:00
Robert Dockins
24d542c5c2 Ignore stack and cabal new-build build artifacts 2017-05-10 16:57:52 -07:00
Robert Dockins
7add78ec3c Implement a missing case in the definition of 'transpose'.
Fixes issue #407
2017-05-10 16:54:26 -07:00
Brian Huffman
f5aa763988 Reference interpreter: update raises run-time error on invalid index.
Fixes #415.
2017-05-08 12:10:07 -07:00
Brian Huffman
e23a8175cc Add regression tests for #406, #408, and #410. 2017-05-05 14:17:45 -07:00
Brian Huffman
d9146efe81 Merge branch 'robdockins-master' 2017-05-05 14:05:47 -07:00
Brian Huffman
7284821020 Merge branch 'master' of https://github.com/robdockins/cryptol into robdockins-master
# Conflicts:
#	src/Cryptol/Eval/Reference.lhs
2017-05-05 13:59:52 -07:00
Brian Huffman
d02ac0764d Fix type sanity checker problems on list comprehensions.
Fixes #410.
2017-05-05 12:01:49 -07:00
Brian Huffman
617dfb0c93 Reference interpreter: fix bug in tuple comparisons 2017-05-05 10:28:46 -07:00
Brian Huffman
0d2e36a18a Reference interpreter: Fix strictness of enumeration, shift/rotate, indexing
Fixes #406.
2017-05-05 09:57:37 -07:00
Brian Huffman
f67480fae2 Reference interpreter: Fix strictness of Arith and polynomial functions 2017-05-05 09:02:29 -07:00
Rob Dockins
6a3f51b34f Perform more careful handling of divide-by-0 conditions.
Make values lazier with respect to when they produce divide-by-0
errors.  Divide-by-0 should now propigate in the same way that
user errors do.

In addition, fix a bug in the reference evaluator with respect to
divide-by-0 handling of pmod and pdiv.  Previously, the `polyDivMod`
function would raise a division by zero error, in contravariance
to the reference implementation invariant that errors may only
occur when forcing values at type `Bit`.
2017-05-04 23:21:16 -07:00
Aaron Tomb
9add6a4b2f Clarify which prover finished first
With `:set prover=any`, and when prover stats are enabled, the prover
that finished first is now prefixed with a "*".
2017-03-31 14:02:41 -07:00
Aaron Tomb
aeff31d0c0 Add rendered semantics document to repository 2017-03-31 08:28:04 -07:00
Trevor Elliott
7fc50a9cbb Write out the typechecker prelude when necessary
Bundle the typechecker prelude (CryptolTC.z3) with the executable, so
that it's able to write it out and re-use it when necessary.

Fixes #404
2017-03-28 16:30:40 -07:00
Brian Huffman
f89c23b594 Edit documentation for reference interpreter. 2017-03-28 14:19:32 -07:00
Brian Huffman
ecfcb6ad25 Add rules for Semantics.pdf to docs/Makefile 2017-03-28 14:19:24 -07:00
Brian Huffman
9228cf0400 Reorder and add documentation to reference evaluator 2017-03-28 14:19:08 -07:00
Brian Huffman
e15e8ee8bb Makefile looks for .lhs source files 2017-03-28 14:18:52 -07:00
Brian Huffman
1a38f470a1 Convert module Cryptol.Eval.Reference to literate Haskell. 2017-03-28 14:18:35 -07:00
Trevor Elliott
20f4f9a108 Simplify addition of constants in equality and geq constraints
Simplifying constraints of the form `k1 + a == k2 + b`. If `k1 > k2`,
then the constraint can be rewritten to `(k1 - k2) + a == b`, or
`a == (k2 - k1) + b` otherwise. This allows the constraint solver to
make progress in cases where `a` or `b` include unification variables.
2017-03-28 13:20:35 -07:00
Trevor Elliott
576df9fa95 More precise rule for k >= width var interval derivation 2017-03-27 16:47:26 -07:00
Trevor Elliott
5a43c1d1fe More precise definition of chunks
Use `padding` directly in the definition of `chunks`, giving an aligned
value to the division.
2017-03-27 16:37:55 -07:00
Trevor Elliott
b93f84cf78 Remove unnecessary constraint that was preventing malicious_SHA1.cry from loading
Cryptol could not prove that subtracting `65 + padding` from `512 * chunks`
in the constraint `msgLen == 512 * chunks - (65 + padding)` was well
defined, and rejected the function. This constraint was redundant, so
removing it allowed the function to typecheck.
2017-03-27 16:36:09 -07:00
Trevor Elliott
4dc5eda23a Expand the width table, and fix a bug in CryptoBox (Thanks @tommd)
The width table in CryptolTC.z3 wasn't large enough to solve constraints
about the width of 64-bit words. This change is a bit of a band-aid, as
larger words will expose the same problem. Longer-term, we should try to
solve these constraints after the SMT-based phase, using some other
approach.

The constraints in CryptoBox were too permissive, and when adjusted to
represent the true intent (that values fit within 64-bits), and the
width table was updated, the example will type-check again.

Thanks to @tommd for tracking both of these down.
2017-03-27 13:45:50 -07:00
Trevor Elliott
f018522b31 Fix upper bound on the interval derived from k >= width x 2017-03-25 09:44:32 -07:00
Trevor Elliott
8a4eadfdac Add a rule for simplifying x +y = inf 2017-03-24 18:02:29 -07:00
Trevor Elliott
90f7d0c330 First attempt at interval computation for k >= width x 2017-03-24 18:02:03 -07:00