Commit Graph

334 Commits

Author SHA1 Message Date
Iavor S. Diatchki
a23d294b1c Use different names when naming multiple non-linear constraints. 2014-12-17 17:42:21 -08:00
Iavor S. Diatchki
284e079d59 Don't rewrite Width to Lg2.
Since we don't rewrite assumptions in the same way, we end up with
silly goals like:

x >= width y => x >= lg2 (y + 1)
2014-12-17 17:39:06 -08:00
Iavor S. Diatchki
5657754442 Some extra rules for simplifying + and - 2014-12-17 16:05:50 -08:00
Iavor S. Diatchki
9b420b3810 Convert simplified terms back into goal terms. 2014-12-17 15:40:26 -08:00
Iavor S. Diatchki
76dc6994c1 Convert from solver Prop to cryptol type Prop 2014-12-17 15:40:04 -08:00
Iavor S. Diatchki
cdf1afd261 A nicer way to desugar >= 2014-12-17 15:39:44 -08:00
Iavor S. Diatchki
0a02d7d68e Redo simplification---this is a bit simpler and, perhaps a little faster. 2014-12-17 14:31:22 -08:00
Iavor S. Diatchki
856e374e64 Re-simplify after applying substitution. 2014-12-17 14:29:50 -08:00
Iavor S. Diatchki
8b08cca51d Merge remote-tracking branch 'origin/master' into wip/cs 2014-12-16 17:47:50 -08:00
Iavor S. Diatchki
2836070488 Fixes to applying substitutin to TypeMap keys. 2014-12-16 17:47:22 -08:00
Iavor S. Diatchki
5666963cd1 Merge remote-tracking branch 'origin/master' into wip/cs 2014-12-16 15:20:14 -08:00
Iavor S. Diatchki
53cc08ece5 Fix a bug with being inconsistent with how we make substitutions. 2014-12-16 15:18:49 -08:00
Trevor Elliott
9e5bf0873f Fix apSubstTypeMapKeys
apSubstTypeMapKeys wasn't pushing the substitution down when the key contained
multiple variables.
2014-12-16 15:09:05 -08:00
Iavor S. Diatchki
494e6eca0e Clean-up things. 2014-12-16 10:59:00 -08:00
Trevor Elliott
b4d9c85635 Merge in the history of the mono-binds change 2014-12-16 09:58:06 -08:00
Adam C. Foltzer
284338c938 Add the mono-binds flag
When `:set mono-binds=on`, any local definitions lacking type
signatures will not be generalized (i.e., will be monomorphic). This
reduces what is in most cases unnecessary polymorphism that can give
rise to constraints that are difficult to solve. This also improves
the performance of the Cryptol interpreter by lifting many polymorphic
type applications out of the inner loops that are commonly defined as
bindings in `where` clauses.

The flag is on by default in the Cryptol REPL, and in most cases makes
it possible to leave out more type signatures in `where` clauses than
before. However, some programs really do rely on inferring polymorphic
types for local variables; in this case adding an explicit polymorphic
type signature to the local binding in question will make the program
typecheck.
2014-12-15 17:48:25 -08:00
Trevor Elliott
1ba8105ec4 Filter out "true" in simplifyProps 2014-12-15 17:33:38 -08:00
Trevor Elliott
21bf0cb62a Merge branch 'wip/cs' of github.com:GaloisInc/cryptol into wip/cs 2014-12-15 17:02:44 -08:00
Trevor Elliott
caab26946a Merge branch 'master' into wip/cs 2014-12-15 17:02:01 -08:00
Trevor Elliott
86585ccbe1 Add a Goals newtype
This makes it easier to get the behavior of the TVars instance under control,
as we can choose to only apply the substitution to the values of the map after
first applying it to the keys, and thus possibly removing redundant goals.
2014-12-15 17:01:30 -08:00
Iavor S. Diatchki
7e05e86500 Record the computed substitution. 2014-12-15 15:54:46 -08:00
Iavor S. Diatchki
a5aedf211d Add constraints araising from improvement. 2014-12-15 15:24:53 -08:00
Iavor S. Diatchki
b6dc236885 Remove smtpOrig, we don't really need it for now. 2014-12-15 14:35:28 -08:00
Trevor Elliott
24b80b1b40 Store goals in a TypeMap, instead of a list
This should reduce the number of redundant constraints getting generated.
2014-12-15 13:10:57 -08:00
Iavor S. Diatchki
8484c43f83 Merge branch 'wip/cs' of github.com:GaloisInc/cryptol into wip/cs
Conflicts:
	src/Cryptol/TypeCheck/Solve.hs
	src/Cryptol/TypeCheck/Solver/CrySAT.hs
2014-12-15 11:20:07 -08:00
Iavor S. Diatchki
dcbc3a7d8d Add improvements based on a linear relation (XXX: Still loosing constraints in imps.) 2014-12-15 11:01:27 -08:00
Adam C. Foltzer
80a3826ac9 fix up a couple mono-binds-related tests
mono-binds/test03 is no longer a really relevant test since mono-binds
doesn't do any generalization. However I fixed up the type signature
and updated the output in case it becomes relevant again in the
future.

issues/issue225 is fine, but work on the master branch increased the
verbosity of constraint solver failures when mono-binds is off. It
still works fine when we monomorphize the local definition.
2014-12-15 10:44:58 -08:00
Trevor Elliott
602ae4b242 Export the prop/expr maps 2014-12-15 09:18:27 -08:00
Trevor Elliott
bd13c30710 Add a TrieMaps for Props and Exprs 2014-12-14 14:10:02 -08:00
Adam C. Foltzer
c291ef5c06 Merge branch 'master' into wip/mono-binds 2014-12-12 15:55:27 -08:00
Adam C. Foltzer
ffb6148339 update documentation of where clauses with mono-binds info 2014-12-12 15:43:18 -08:00
Adam C. Foltzer
fed2978fda exclude emacs autosave files from Cryptol dependencies in Makefile 2014-12-12 15:41:49 -08:00
Trevor Elliott
157a7b9d8b Don't try to prove True 2014-12-12 15:22:20 -08:00
Brian Huffman
93b0789a98 Export schema-parsing functions 2014-12-12 15:08:53 -08:00
Trevor Elliott
73a2d0162b Derive Eq and Show for Prop 2014-12-12 15:07:49 -08:00
Trevor Elliott
c6351b0684 Group common inequalities together
Inequalities like (a >= 10, a >= 20) will be grouped together, and turned into
(a >= 20).
2014-12-12 15:07:35 -08:00
Trevor Elliott
8b018b5be2 Simplify the Exprs in goals 2014-12-12 15:06:05 -08:00
Iavor S. Diatchki
b1cdb94760 Tab and untab when pushing and popping, respectively. 2014-12-12 10:04:55 -08:00
Iavor S. Diatchki
7a933304bd Add dependency on fixed version of SimpleSMT 2014-12-12 10:04:36 -08:00
Iavor S. Diatchki
6088b0336a More on improvement.
Currently, there's a bug, where types seem to be going negative!
2014-12-11 17:20:17 -08:00
Brian Huffman
b88e2d1a11 Add test cases for issue #58. 2014-12-11 15:50:22 -08:00
Trevor Elliott
28fdd44100 Fix #140
The Smtlib solver was translating Fin constraints to True, as it didn't know
how to handle them.  They should have been skipped, and returned back as
unsolved goals instead.
2014-12-11 15:12:14 -08:00
Iavor S. Diatchki
6f65845e16 Some fixes to proving implications. 2014-12-11 10:30:25 -08:00
Iavor S. Diatchki
08cec44702 Merge remote-tracking branch 'origin/master' into wip/cs 2014-12-10 14:10:49 -08:00
Trevor Elliott
296ee335a0 Try to minimize the differences with master 2014-12-10 11:45:21 -08:00
Trevor Elliott
ad664014dd All bindings without signatures are monomorphic with mono-binds
Tracking the closed environment was tricky, and it wasn't clear how easy it
would be to find free type variables in bindings that lack signatures, as we
don't kind check the AST before making the decision about making it monomorphic.
2014-12-10 11:41:32 -08:00
Trevor Elliott
441d3e84f9 Add three more tests for mono-binds 2014-12-09 18:09:06 -08:00
Trevor Elliott
00b99b7581 Revert "Update two tests for mono-binds changes"
This reverts commit 23cd430f3b.
2014-12-09 16:54:45 -08:00
Trevor Elliott
8e954b1ab1 Stop accidentally clobbering the top-level closed env 2014-12-09 16:53:53 -08:00
Trevor Elliott
23cd430f3b Update two tests for mono-binds changes 2014-12-09 16:17:52 -08:00