Commit Graph

3152 Commits

Author SHA1 Message Date
Rob Dockins
cfaafdce89 Update reference semantics with the new compare* primitives. 2021-08-20 13:29:31 -07:00
Rob Dockins
716c338090 Update book examples 2021-08-20 13:17:37 -07:00
Rob Dockins
7dcb2c6afa Update test suite output 2021-08-20 13:12:59 -07:00
Rob Dockins
59cc67d65b Suppress "unused name" warnings for primitive declarations. 2021-08-20 12:46:26 -07:00
Rob Dockins
12d1bd3582 Implement compareEq, compareLt and compareLeq primitives.
These allow users to test equalites between type variables and
branch on the results.  This could nearly be accomplished by
instead demoting the value of the numeric expressions to integers
and comparing them as integers.  However, this required `fin`
constraints on the expressions, which is sometimes undesirable.

We also implement the `coerceSize` operation discussed in
issue #704.  We may decide to make this a primitive at a
later time.
2021-08-20 12:33:04 -07:00
robdockins
fe4d5dd4e9
Merge pull request #1263 from GaloisInc/prettyprinter
Prettyprinter
2021-08-09 09:44:54 -07:00
Rob Dockins
1517f35afe Fix more test output 2021-08-06 16:27:33 -07:00
Rob Dockins
e742d24a14 Update documentation 2021-08-06 15:04:38 -07:00
Rob Dockins
097b8a22d2 Update test suite expected output to track changes
in the pretty printer code.
2021-08-06 14:18:12 -07:00
Rob Dockins
35bb83b80c Swap out pretty printer packages. We are now using prettyprinter.
This required a fair amount of fixup to the pretty-printing code,
as some of the primitives have semantics that differ in subtle ways
from the old package.  The output now is mostly the same as before,
although some improvements have been made here and there.

The one somewhat negative outcome of this change is that the
"line fill" algorithm in `prettyprinter` works a bit different
and makes choices about where to break lines that are arguably
less desirable than before. When laying out structures nested inside
sequences, it is more likely to break a line inside a substructure,
whereas the old algorithm prefered to break lines between elements
of the outer sequence.  There are also appear to be some minor
differences regarding how ribbon width is calculated.
2021-08-06 14:17:47 -07:00
robdockins
52fd555896
Merge pull request #1254 from GaloisInc/issue1239
Fix issue 1239
2021-08-03 12:38:17 -07:00
Rob Dockins
8e91fe5af9 Update regression test for 'ignore-safety'.
This tracks changes to the symbolic indexing primitives.
2021-08-03 09:15:42 -07:00
Rob Dockins
e54f8d973e Update indexing primitives to remove troublesome corner cases.
Previously, when indexing into a sequence, there were code paths
in both the SBV and What4 backends where an if/then/else tree
would be built to compute the value of a symbolic lookup, with one
branch for each valid sequence index.  They differed, however, in
what value they would comute for out-of-bound indices.  For SBV,
we would compute a `zero` value, whereas for What4 we would
raise an error.  For What4, this resulted in unfortunate and redundant
proof obligations, as we elsewhere add a test for in-bounds contditions
to the safety predicate.  Moreover, the strategy of returning a
`zero` value could panic in some situations, as not every type
has a `zero` value anymore (e.g., newtypes).

In both cases, we now do the same thing, which is not to have a case
of the if/then/else tree for out-of-bounds indices; the final element
of the sequence will simply be returned instead.  We will only raise
an out of bounds error in this code path if the sequence is actually
empty.

Fixes #1239
2021-08-03 09:15:42 -07:00
Andrew Kent
03311cec9e
fix(rpc): reset TC solver on file/module load (#1258)
* fix(rpc): reset TC solver on file/module load

Some difficult to reproduce bugs regarding the RPC server hanging
(https://github.com/GaloisInc/cryptol/issues/1250) seemed to be
related to the type checker solver (Z3) hanging after periods of
extended use. I.e., a module would load/error quickly normally,
but if preceded by enough prior solver/server activity, Z3
would consistently hang. To avoid this, we can simply reset the
solver and reload the type checker prelude when the server is asked
to load a file or module. This solves the Z3 hang issues in observed
cases and requires no additional forking (which we're trying to
minimize when possible).
2021-07-28 14:07:23 -07:00
robdockins
1b52a351f7
Merge pull request #1255 from GaloisInc/operator-let
Add new declaration forms that can be parsed at the REPL
2021-07-27 13:44:58 -07:00
Rob Dockins
0e9e4621f6 Update CHANGES 2021-07-27 12:50:35 -07:00
Rob Dockins
a1261b735e Add a regression test for new REPL declarations. 2021-07-27 12:45:55 -07:00
Rob Dockins
1532d8ab24 Allow signatures at the REPL also.
The syntax looks like:
```
let f : Integer -> Bool; let f x = x == 0
```

The leading `let` is not the most beautiful, but it gets
the job done and prevents parser conflicts.
2021-07-27 12:23:20 -07:00
Rob Dockins
de02fdacdb When using checkTopDecls, avoid unused name warnings.
Top-level declarations that introduce type names should not
generate warnings.
2021-07-27 12:06:55 -07:00
Rob Dockins
4f23456559 Add new declaration forms that can be parsed at the REPL.
In particular, we can now define operators using `let` in the
same way that they can be inside modules and `where`.

In addition, we allow `type` and `type constraint` definitions
at the REPL, and `infix`, `infixl` and `infixr` declarations.

Becase it is an error for an infix declaration to be stated
without its corresponding declaration, we have added the ability
to enter multiple definitions at once, separated by `;`.  This
is also useful for definition mutually recursive definitions using
`let`.
2021-07-26 17:32:51 -07:00
Aaron Tomb
5c3cdffa4f
Improve CI for Windows and portable Docker container (#1248)
* Disable Windows RPC tests

They seem to hang instead of failing at the moment, so until we get them
working it seems like it's better to just leave them out.

* Attempt to make "portability" build only run nightly.
2021-07-26 09:40:44 -07:00
Andrew Kent
8e7e04726c
feat(rpc): logging for server and client (#1251)
* feat(rpc): logging for server and client

* fix: CryptolConnection dflt val for proc

* fix: activate logging on connection, not process

* chore: remove unnecessary proc field
2021-07-23 13:02:55 -07:00
robdockins
e6f80ed50a
Merge pull request #1219 from GaloisInc/felixonmars-patch-2
Allow sbv 8.15 (#1205)
2021-07-23 11:53:44 -07:00
robdockins
41f7f1ce6a
Merge pull request #1252 from GaloisInc/fasttypeof
fastTypeOf fixes
2021-07-23 11:52:41 -07:00
Ben Selfridge
51befdff79 Adds more info to panic in fastTypeOf
I needed more information to debug my use of this function, and including more
information here seems reasonable in general.
2021-07-23 10:19:57 -07:00
Rob Dockins
5aa2cdd62e Add missing cases for newtypes and functions to fastTypeOf.
Add comments describing the cases.
2021-07-23 10:18:48 -07:00
Rob Dockins
5cd0e47a13 Update an outdated comment 2021-07-23 10:17:32 -07:00
Felix Yan
4526f5090e Allow sbv 8.15 (#1205) 2021-07-23 08:27:04 -07:00
Aaron Tomb
17f5dc723b
Build distribution tarballs with and without solvers (#1228) 2021-07-23 08:00:26 -07:00
Iavor S. Diatchki
e78195a733
Merge pull request #1245 from GaloisInc/T1240
The types of module parameters use constraints
2021-07-22 19:20:32 +03:00
Iavor S. Diatchki
5b21f3655d
Merge pull request #1246 from GaloisInc/fix-build
Temporarily disable uploading artifacts for Windows.
2021-07-22 17:06:18 +03:00
Iavor Diatchki
57283e26f2 Disable push-image with PORTABILITY=true
This takes way too long to run on every commit
2021-07-22 16:25:28 +03:00
Iavor Diatchki
75ab0ec09d Temporarily disable uploading artifacts for Windows.
This seems to break the CI, we need to investigate why
2021-07-22 15:21:25 +03:00
Iavor Diatchki
31cd9fea43 The types of module parameters use constraints
Fixes #1240
2021-07-22 14:41:34 +03:00
robdockins
51b7c6dc2e
Merge pull request #1225 from GaloisInc/T1167
Fixes #1167
2021-07-21 11:58:38 -07:00
Rob Dockins
0699063a50 Uniformly use atomicModifyIORef for changes to the REPL state. 2021-07-21 10:54:03 -07:00
Iavor Diatchki
2234defcf1 Make the remote-api build 2021-07-21 10:54:03 -07:00
Iavor Diatchki
5af4377dd3 Add a counter for solver restarts
This should avoid a potential (rare) race condition where the callback
for a dead solver runs after a new solver has already been started,
which would result in a "lost" solver process just hanging around
2021-07-21 10:54:03 -07:00
Iavor Diatchki
0237a8d1de Update to require 0.9.7 which has the callback capability 2021-07-21 10:54:03 -07:00
Iavor Diatchki
befcb3aa29 Use atomicModifyRef to avoid races 2021-07-21 10:54:03 -07:00
Iavor Diatchki
816523df10 Fixes #1167
This requires newer version simple-smt, which supports calling back into
the program when the solver exits
2021-07-21 10:54:03 -07:00
Andrew Kent
ce647eba21
chore: bump cryptol client patch number (#1244) 2021-07-21 08:26:59 -07:00
robdockins
746e04f4f5
Merge pull request #1243 from GaloisInc/explicit-stride
Update documenetation with new enumeration forms
2021-07-20 20:55:12 -07:00
Andrew Kent
e5bab3019e
fix: remove automatic reset from python client connection (#1242) 2021-07-20 19:19:34 -07:00
Rob Dockins
9705ab63cf Update CHANGES to mention new enumeration forms. 2021-07-20 17:25:33 -07:00
Rob Dockins
d740442035 Update documenetation with new enumeration forms,
and update the reference semantics.
Other minor documentation fixes and updates.
2021-07-20 17:01:50 -07:00
robdockins
914f7fbe18
Merge pull request #1234 from GaloisInc/what4-online
What4 online
2021-07-20 12:50:12 -07:00
Rob Dockins
7a1843056d Update CHANGES 2021-07-20 12:48:21 -07:00
Rob Dockins
9fcdb9be21 Remove unnecessary SBV upper bound in cryptol-remote-api 2021-07-20 11:13:03 -07:00
Rob Dockins
c248320ca5 Change to use Z3 instead of yices for the all-sat test.
Despite the fact that Z3 is easily the slowest solver at this
task, it is the one that is reliably avaliable on the CI servers.
2021-07-20 11:05:12 -07:00