Commit Graph

2833 Commits

Author SHA1 Message Date
robdockins
9c4e8fb05e
Merge pull request #1077 from GaloisInc/nopat-refactor
NoPat refactor
2021-02-15 13:58:51 -08:00
Rob Dockins
752e1d0d8a Fix the funny numbers.
Reordering the where declarations in pattern desugaring caused
some minor changes in error message output, as well as
changes in the specializer.
2021-02-13 14:58:48 -08:00
Rob Dockins
b5b7403bd8 Add FunDesc information to the parsed AST.
This allows us to attach information to `EFun` nodes that describe
which named function the lambda belongs to, and which arguments
it handles.  This information is filled in by the `NoPat` pass
as it desugars multi-argument functions into a sequence of lambdas
and is used during typechecking to produce error messages.

There is an odd potential for the renamer to get things wrong here.
If a named function has an argument that shadows it's own name,
the renamer may incorrectly resolve the name in a function description
for later arguments.  The resulting error message will then point to
the wrong name (although it will be in the vicinity...).  It's hard
to fix this without folding the NoPat pass into the renamer (which
we should also do, but it's a nontrivial refactoring).
2021-02-13 14:58:44 -08:00
Rob Dockins
a1b678a5ec Refactor the desugaring of multi-argument functions.
Multi-argument functions are now desuguared into nested lambdas
in the `NoPat` phase instead of during typechecking.  This gives
more sensible results when the same variable is shadowed in the argument
list.  In particular, extra "where" bindings that are added for pattern
desugaring now have a scope that is outside patterns and variables
occuring further to the right.

Some programs that used to produce "overlapping symbols" errors are
now accepted with a shadowing warning instead.

The main downside of this refactoring is that the `checkFun` operation
no longer has access to function name or argument numbers for definitions,
as all functions have become single-argument lambdas by typechecking time.
This can be fixed by recording this information in the AST during the
NoPat desugaring instead.
2021-02-13 14:57:06 -08:00
Rob Dockins
710f13c0b0 Document the current state of affairs regarding issue 567.
The name binding structure that results from multi-parameter
functions with repeated names, and the interaction with pattern
desugaring is currently very counterintuitive.  See issue #567 for
more discussion.
2021-02-13 14:57:06 -08:00
Rob Dockins
ecde98e5bf Minor updates to CryHtml.hs
This produces more useful "raw" source rendering.
2021-02-12 10:35:42 -08:00
LisannaAtGalois
bcc7612b76
Init ghcr.io/galoisinc/cryptol-remote-api:nightly-portable (#1065) 2021-02-10 13:16:35 -08:00
robdockins
c25a1bd181
Merge pull request #1070 from GaloisInc/issue975
Fix printing of parse errors in enumeration sequences
2021-02-10 09:23:12 -08:00
robdockins
11247b628e
Merge pull request #1069 from GaloisInc/float-check
Float check
2021-02-10 09:22:16 -08:00
Rob Dockins
44ef7434db Fix printing of parse errors in enumeration sequences.
Previously, raw AST would be printed instead of pretty-printed syntax
Also tweak the indentation for multiline parse errors.

Fixes #975
2021-02-09 18:06:23 -08:00
Rob Dockins
1f230d30ab minor updates to floating point tests 2021-02-09 17:24:47 -08:00
Rob Dockins
4dfdcc414f Improve the random generator for floating-point values.
This generator will will generate "special" values, and should
also provide better coverage across the range of values the type
can represent, instead of being strongly biased toward values near
1, as the old generator was.
2021-02-09 17:04:49 -08:00
Rob Dockins
ceb222e968 Allow :exhaust to work directly on floating-point values
by enumerating all bitpatterns.

Note, this overcounts somewhat the number of distinct floating point
values there are, since all NaNs are considered identical
as `Float` values.  We could be more careful here to avoid
generating more NaN values than required, but I'm not sure it's worth
the effort.

Fixes #1051
2021-02-09 16:33:40 -08:00
robdockins
022dfebaa0
Merge pull request #1067 from GaloisInc/issue1044
Relax the check that all values are consumed
2021-02-09 16:10:35 -08:00
Rob Dockins
a33814d50a Skip further processing of all type declarations in a scope
if any of them form a recursive group.

Fixes #1040
2021-02-09 13:59:19 -08:00
Rob Dockins
3c50959a36 Relax the check that all values are consumed when parsing SBV counterexamples.
After parsing all the "input" values, there may be some left over
if we have used constructs (like prime field recip) that are
defined via uniquely specified variables.  We can simply ignore
these extra values.
2021-02-09 13:14:33 -08:00
robdockins
38a9c58d75
Merge pull request #1066 from GaloisInc/demote-nat
What 1.1
2021-02-09 12:34:19 -08:00
Rob Dockins
8e6a4007fc Update freeze files 2021-02-09 11:04:45 -08:00
Rob Dockins
0909120a68 Convert to using the SFloat module from What4.
Expose some additional primitives, such as FMA,
abs, sqrt, and more classification predicates.

Refactor the primitives table for floating-point
values into a single generic table that uses
methods from the `Backend` class.
2021-02-08 17:47:49 -08:00
Rob Dockins
e5d5a38597 Update to track What4 changes with floating point values 2021-02-05 14:04:50 -08:00
Aaron Tomb
eb9ea33607 Fix cryptol-remote-api nightly builds 2021-02-05 08:18:54 -08:00
robdockins
6e3c0816b7
Merge pull request #1055 from GaloisInc/libBF-0.6
Update to use `libBF` version 0.6
2021-02-02 09:00:53 -08:00
Rob Dockins
78855e7967 Update to use libBF version 0.6, which has some bugfixes
and additional operations.
2021-01-28 17:03:46 -08:00
robdockins
7eba2307b4
Merge pull request #1053 from GaloisInc/issue1049
Fix the binary encoding of floating-point values.
2021-01-28 10:43:47 -08:00
Rob Dockins
b974e78805 Fix the binary encoding of floating-point values. Previously,
some subnormal values were being incorrectly encoded.

Fixes #1049
2021-01-27 16:06:29 -08:00
Aaron Tomb
9b9f452257
Add remote API calls for for proving properties (#1046) 2021-01-25 13:30:52 -08:00
Iavor Diatchki
8796390244 Add name etc. 2021-01-25 08:33:11 -08:00
Andrew Kent
70442e497f
cryptol-remote-api: submod bump and docs (#1038)
* cryptol-remote-api: submod bump and docs

* bump submodule

* chore: improve cryptol-remote-api summary docs portion

* cryptol-remote-api/chore: dedup doc strings for servers

* chore: submodule bump (argo) and fixes
2021-01-20 15:40:19 -08:00
Iavor Diatchki
c9307065b9 A short talk on the new parameterized moduels design 2021-01-14 15:43:04 -08:00
Jared Weakly
1b482ba9ed
Fix helm testing and cvc4 url fix to missing locations (#1031)
* Fix helm testing and cvc4 url fix to missing locations

* Update tag for test-cryptol-remote-api in helm tests
2021-01-14 11:18:06 -08:00
robdockins
f55aea6b9f
Merge pull request #1015 from GaloisInc/newtypes
Newtypes
2021-01-12 17:18:41 -08:00
Rob Dockins
301c74cb8f Docs typos 2021-01-12 17:00:24 -08:00
Rob Dockins
1c382634eb More principled errors for the remote API 2021-01-12 16:27:59 -08:00
Rob Dockins
976468dce7 Fix typos 2021-01-12 11:20:57 -08:00
Rob Dockins
e19adee102 Add another regression test for newtypes 2021-01-12 11:19:53 -08:00
Rob Dockins
600f43b5f0 Update the Programming Cryptol book with documentation about newtypes. 2021-01-12 11:19:53 -08:00
Rob Dockins
557b928caf Update syntax and semantics documents with newtype changes 2021-01-12 11:18:58 -08:00
Rob Dockins
e5bc98a59f Make newtype applications check constraints that are implied
by the newtype body.
2021-01-12 11:17:27 -08:00
Rob Dockins
a479deb052 Update the instances regression test with newtypes 2021-01-12 11:17:27 -08:00
Rob Dockins
baf6ac7c72 Make class resolution for newtypes fail early. 2021-01-12 11:17:27 -08:00
Rob Dockins
8241366b13 Tweak counterxample printing for :check and :exhaust and
make it responsive to the `show-examples` option.
2021-01-12 11:17:27 -08:00
Rob Dockins
40def1b760 Add a regression test that exercises newtypes 2021-01-12 11:17:27 -08:00
Rob Dockins
4c53d2e4e0 Remove the NewtypeEnv arguments from various evaluation
functions.  Newtype information is now propigated directly
into types via the typechecker instead of being looked up
separately.
2021-01-12 11:17:27 -08:00
Rob Dockins
252d8080f8 Lift newtypes from a TCon to a full-fledged constructor
of `Type`.  This allows us to directly carry the `Newtype`
instead of having to look it up in a table at use sites.
2021-01-12 11:17:27 -08:00
Rob Dockins
35ea58c1ca Fix a bug where the symbolic backends did not have newtype constructors
in scope.  Also, demote the `NewtypeEnv` to a type synonym, as the
newtype was just annoying.
2021-01-12 11:17:27 -08:00
Rob Dockins
2944f08fac Add newtype to the routines that transfer values back to expressions,
and use `TValue` instead of `Type` in more places.
2021-01-12 11:17:27 -08:00
Rob Dockins
70796c2134 Add type evaluation for newtypes, use the RecordMap type for
the fields of the newtype body, and push newtypes into
various parts of the evaluator, random testing, etc.
2021-01-12 11:17:27 -08:00
Ben Selfridge
7489dbd52e
Doc fixes (#1016)
* Updates all the examples in CrashCourse.tex up to the functions section

This adds more REPL annotations for the exercise checker in the Programming
Cryptol book. There is still more work needed to support many of the examples in
the functions section (and presumably the rest of the book as well), so I think
this is a logical stopping point for now until we add a feature that lets you
write out a file and load it into the repl.

* Updates ProgrammingCryptol.pdf wrt recent changes
2021-01-11 14:52:21 -08:00
Jared Weakly
75211f3dac Switch default in cryptol-remote-api Dockerfile to 8.10.3 2021-01-11 12:16:06 -08:00
Jared Weakly
5971ac3bed
Support ghc 8.10.3 cryptol remote api (#1026)
* Use ghc 8.10.3 for cryptol-remote-api to test SGX compatibility
* Fix cvc4
* Fix test suite for cryptol-remote-api
* Default to putting the heap as low in address space as possible
2021-01-11 11:36:21 -08:00