Commit Graph

254 Commits

Author SHA1 Message Date
Trevor Elliott
2401954532 The goals are equivalent 2014-12-16 17:56:07 -08:00
Iavor S. Diatchki
2836070488 Fixes to applying substitutin to TypeMap keys. 2014-12-16 17:47:22 -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
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
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
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
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
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
Brian Huffman
93b0789a98 Export schema-parsing functions 2014-12-12 15:08:53 -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
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
Trevor Elliott
1742ce0912 Forgot to add this module in the last commit 2014-12-09 16:17:36 -08:00
Trevor Elliott
808e16db2d Fix a bug with the closed env, and add a test
It was possible to exploit shadowing to get a name into the closed environment
that wasn't actually closed.  The change here is that `partitionClosed` now
returns a completely new closed environment with any shadowed names removed, and
that environment is used when checking the declarations it describes, instead.
2014-12-09 16:17:02 -08:00
Trevor Elliott
ae2f0b6770 Update issue 225 to reflect the use of mono-binds 2014-12-09 13:57:27 -08:00
Trevor Elliott
86336b9c02 Add a test that shows programs that fail with mono-binds 2014-12-09 13:54:22 -08:00
Trevor Elliott
21ab16db4b Add some tests for the mono-binds feature 2014-12-09 12:08:17 -08:00
Trevor Elliott
7dc76662e9 Better partitioning of the monomorphizing code 2014-12-09 12:07:52 -08:00
Trevor Elliott
48d1be1315 Merge branch 'master' into wip/mono-binds 2014-12-09 11:21:01 -08:00
Trevor Elliott
b1eae187e5 Make the cryptol binary depend on the sources
Instead of making the cryptol binary .PHONY, use find to locate all the
sources to depend on.
2014-12-09 11:20:31 -08:00
Trevor Elliott
29448e5789 Merge remote-tracking branch 'origin/master' into wip/mono-binds 2014-12-09 10:40:26 -08:00
Trevor Elliott
7b3fc614bf Remove debugging output 2014-12-08 18:20:32 -08:00
Trevor Elliott
4a0149ed52 Thread a flag through to manage let-generalization
Setting `mono-binds` to `yes` will cause bindings to be made monomorphic when
they don't refer to closed values, and setting `mono-binds` to no will cause
them to always be generalized.
2014-12-08 18:18:14 -08:00
Adam C. Foltzer
abf19641be small tweak to readme wording 2014-12-08 17:30:32 -08:00
Adam C. Foltzer
61e9b4e1fe add pointer to low-hanging fruit issue label 2014-12-08 17:29:26 -08:00
Trevor Elliott
0c22144f55 Test 225 no longer fails, this fixes #5 2014-12-08 16:57:02 -08:00
Trevor Elliott
a8dc88ffaf Merge remote-tracking branch 'origin/master' into wip/mono-binds 2014-12-08 16:46:02 -08:00
Trevor Elliott
f9319b4e9f Updated test output for monomorphic bindings 2014-12-08 16:45:51 -08:00
Trevor Elliott
ed81311a86 Only return changes to the closed environment 2014-12-08 16:35:06 -08:00
Trevor Elliott
55854f2eb0 Make sure to initialize iClosed with the imported environment 2014-12-08 15:58:23 -08:00
Trevor Elliott
b2b27b672f Make sure to pass out the new closed set from inferBinds 2014-12-08 15:57:13 -08:00
Trevor Elliott
907c5f393f Make bindings monomorphic based on use of closed values
Adopt the definition of closed values defined by this post on the ghc blog:

https://ghc.haskell.org/trac/ghc/blog/LetGeneralisationInGhc7
2014-12-08 15:18:40 -08:00
Adam C. Foltzer
7030924083 tweak escaped variable message to be more clear 2014-12-08 14:07:28 -08:00
Brian Huffman
25ee274d38 Merge changes from SBV version 3.3
Includes changes after LeventErkok/sbv@67656c6aba (Nov 3)
and up to LeventErkok/sbv@6468f41bde (Dec 5)
2014-12-08 11:04:28 -08:00
Adam C. Foltzer
9abc779340 update random values after changing random generation 2014-12-05 17:38:00 -08:00
Trevor Elliott
fa104983bd Merge branch 'master' into wip/mono-binds
Conflicts:
	Makefile
	tests/Main.hs
2014-12-05 17:25:56 -08:00
Adam C. Foltzer
969c96e8e1 Don't do fancy progress bars for :check in batch mode 2014-12-05 17:18:29 -08:00
Trevor Elliott
465b0eb103 Add a stdout file for the failing test, issues/T146 2014-12-05 16:52:45 -08:00
Trevor Elliott
b3341c02c9 Allow make test to output the diff results 2014-12-05 16:49:58 -08:00
Trevor Elliott
c2821da104 Make the diff command line absolute 2014-12-05 16:27:08 -08:00
Trevor Elliott
63fe690ef9 Add block decls to the local environment after partitioning 2014-12-05 16:23:51 -08:00
Trevor Elliott
2ea484288e Rename iParams to iLocalEnv 2014-12-05 16:23:26 -08:00