Commit Graph

1340 Commits

Author SHA1 Message Date
Rob Dockins
04f2f80c85 Tweak the squareAndMultiply algorithm to drop leading zeros first. 2020-05-27 15:53:38 -07:00
Rob Dockins
897f631910 Fix reference semantics of the signed bitvector primitives 2020-05-27 15:34:58 -07:00
Rob Dockins
0bc02bcae0 Typo 2020-05-27 15:31:45 -07:00
Rob Dockins
542debdb67 Documentation tweaks 2020-05-27 14:21:17 -07:00
Rob Dockins
e5d60efeec Merge remote-tracking branch 'origin/master' into split-arith 2020-05-27 12:56:29 -07:00
Rob Dockins
12814bd688 Update reference interpreter to match changes in the split-arith branch. 2020-05-27 12:53:30 -07:00
brianhuffman
63bfdb2c06
Merge pull request #720 from GaloisInc/fromInteger
Avoid using `fromInteger`.
2020-05-27 10:56:28 -07:00
Rob Dockins
23f22bbab7 Treat the Unsupported exception in the same way as the EvalErr
exception in the REPL.
2020-05-26 17:38:58 -07:00
Rob Dockins
bbba626052 Merge remote-tracking branch 'origin/master' into split-arith 2020-05-26 17:37:00 -07:00
Rob Dockins
da83c813b2 Additional code comments 2020-05-26 17:08:20 -07:00
Rob Dockins
06584f4d10 Refactor and comment the Cryptol.Symbolic.SBV module 2020-05-26 17:08:20 -07:00
Rob Dockins
aaf78e23ec Add a bit more output for the Satisfiable/Counterexample cases 2020-05-26 17:08:20 -07:00
Rob Dockins
1b584d9567 typo 2020-05-26 17:08:20 -07:00
Rob Dockins
60dcbd1d40 Make SBV backends behave the same as What4 backends WRT safety predicates.
For now, we always include the safety predicate as part of `:sat` and `:prove`
queries.  Eventually, we will make this more configurable and have the
UI indicate if the property or the safety condition failed on proof counterexamples,
etc.
2020-05-26 17:08:20 -07:00
Rob Dockins
dbbd8607a0 Invoke a more severe exception throwing mechanism when we cannot
symbolicly translate an operation in the SBV backend.

This matches the behavior of the What4 backends.
2020-05-26 17:08:20 -07:00
Rob Dockins
fd13055eb6 Remove UnsupportedSymbolicOp from the EvalErr type.
Instead, add a new `Unsupported` data type.  This requires
that we throw the unsupported exception instead of using `raiseError`.
2020-05-26 15:15:21 -07:00
Rob Dockins
8c6f8dcbe9 Reimplement (^^) as a primitive taking the exponent in class Integral 2020-05-26 15:13:08 -07:00
Rob Dockins
ca74fc8e98 Remove the vestigial intLg2 method from the Backend class 2020-05-26 14:10:55 -07:00
Rob Dockins
e78757199e remove Z n types from class Integral 2020-05-26 11:38:59 -07:00
Rob Dockins
85e49a92db Rearrange the Cryptol prelude according to the new typeclass system 2020-05-22 15:39:38 -07:00
Brian Huffman
e1fb6e940d Pretty-print Prop constructor PAnd using tuple-style syntax.
This matches the syntax used for parsing type constraint synonyms.

Fixes #731.
2020-05-18 17:15:13 -07:00
Brian Huffman
5c44ac6221 Properly parenthesize type applications in pretty printer for type Prop.
Special cases for PArith, PCmp, PSignedCmp, and PLiteral are removed,
as they are covered correctly by the fallback case.
2020-05-18 17:14:13 -07:00
Brian Huffman
0cf21ace93 Check for kind mismatch in singleSubst.
If there is a kind mismatch, it returns the new `SubstKindMismatch`
constructor of the `SubstError` type.

Also change `bindVar` to rely on `singleSubst` for kind checking.
2020-05-18 12:34:01 -07:00
Brian Huffman
2c72419b1a Document kind-correctness invariant for Subst datatype. 2020-05-18 12:31:19 -07:00
Rob Dockins
e7470ec7e1 Implement the Round operations for Rational 2020-05-15 09:06:59 -07:00
Brian Huffman
df4af1af3b Make singleSubst perform checks and return Either type.
The old `singleSubst` has been renamed to `uncheckedSingleSubst`.

Fixes #723.
2020-05-15 07:30:48 -07:00
Brian Huffman
08db8868e5 Make extendSubst re-use freeParams function. 2020-05-15 07:28:13 -07:00
Brian Huffman
6ea73cdf39 Move function freeParams into a different module. 2020-05-15 07:20:38 -07:00
Brian Huffman
c0ebf1132c Introduce convenience function singleTParamSubst. 2020-05-15 07:10:15 -07:00
Brian Huffman
2f21e65d0e Document additional invariant on 'Subst' type. 2020-05-15 07:06:15 -07:00
Rob Dockins
6e812221f2 Print concrete rationals in reduced form 2020-05-14 17:49:22 -07:00
Rob Dockins
cfe790c13b Implement a new primitive type Rational.
Rational numbers are implemented as a pair of integers via the usual construction.
2020-05-14 17:48:54 -07:00
Rob Dockins
7053c98257 Update the update and updateBack primitives to work over Integral 2020-05-14 16:06:51 -07:00
Rob Dockins
442d9eec4b Generalize >>$ to accept Integral shift amounts. 2020-05-14 14:59:54 -07:00
Rob Dockins
8da51d3eb0 Rearrange evaluation backends to follow new typeclass structures 2020-05-14 14:58:12 -07:00
Rob Dockins
07865237cf Enumerate the bits of a bounded integer in a different way 2020-05-14 09:34:37 -07:00
Rob Dockins
3b910b9d70 Fixup/clean some of the what4 primitives 2020-05-14 09:33:51 -07:00
Rob Dockins
dc4efc4482 specialize the type of the lg2 primitive 2020-05-14 09:32:05 -07:00
Rob Dockins
f6b929ace4 Implement (^^) via square-and-multiply rather than making it a primitive. 2020-05-14 09:23:58 -07:00
Rob Dockins
97d99072a0 Fix the solver code for Integral. It was previously failing too
early if sequence element type is a variable.
2020-05-14 09:18:30 -07:00
Brian Huffman
9424752b45 Specialize types of signed div/mod operators (/$) and (%$) to bitvectors. 2020-05-13 17:19:18 -07:00
Brian Huffman
dbd1543548 Generalize shift/rotate operations to class 'Index'. 2020-05-13 17:17:28 -07:00
Brian Huffman
09cf32060f Generalize indexing operations to class 'Integral'. 2020-05-13 14:01:29 -07:00
Rob Dockins
202ddba695 Remove the Arith class from the typechecker, and replace it with
the new numeric clasess `Ring`, `Integral`, `Field`, and `Round`.
2020-05-13 13:28:03 -07:00
Kevin Quick
393451681b
Updates for haskeline 0.8 and use of exceptions package. 2020-05-06 14:16:53 -07:00
Iavor Diatchki
c3eca4f22a Check that the declared type of prims matches the expected one.
Fixes #711
2020-05-05 14:30:25 -07:00
Brian Huffman
cc7ab17ac5 Add constructor ECChar to avoid needing to use fromInteger. 2020-05-05 13:03:53 -07:00
Brian Huffman
b16f2cf2c6 Change type of function numToken to avoid use of fromInteger. 2020-05-05 12:43:16 -07:00
Brian Huffman
74f7ee15ac Add function getChr to avoid unnecessary use of fromInteger. 2020-05-05 12:42:46 -07:00
Brian Huffman
d53c2e0a25 Remove calls to fromInteger at type Integer -> Integer. 2020-05-05 10:53:41 -07:00