Skip to content

Commit

Permalink
Update and adapt to GaloisInc/cryptol#1281 "toSignedInteger".
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Huffman committed Sep 15, 2021
1 parent 6a70cdd commit ee6629f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cryptol-saw-core/saw/Cryptol.sawcore
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,12 @@ ecSMod n =
(error (Stream Bool -> Stream Bool -> Stream Bool) "ecSMod: expected finite word")
n;

toSignedInteger : (n : Num) -> seq n Bool -> Integer;
toSignedInteger n =
Num#rec (\ (n:Num) -> seq n Bool -> Integer)
sbvToInt
(error (Stream Bool -> Integer) "toSignedInteger: expected finite word")
n;

-- Eq
ecEq : (a : sort 0) -> PEq a -> a -> a -> Bool;
Expand Down
2 changes: 2 additions & 0 deletions cryptol-saw-core/src/Verifier/SAW/Cryptol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ prelPrims =
, ("%$", flip scGlobalDef "Cryptol.ecSMod") -- {n} (fin n, n>=1) => [n] -> [n] -> [n]
, ("lg2", flip scGlobalDef "Cryptol.ecLg2") -- {n} (fin n) => [n] -> [n]
, (">>$", flip scGlobalDef "Cryptol.ecSShiftR") -- {n, ix} (fin n, n >= 1, Integral ix) => [n] -> ix -> [n]
, ("toSignedInteger",
flip scGlobalDef "Cryptol.toSignedInteger") -- {n} (fin n, n >= 1) => [n] -> Integer

-- -- Rational primitives
, ("ratio", flip scGlobalDef "Cryptol.ecRatio") -- Integer -> Integer -> Rational
Expand Down

0 comments on commit ee6629f

Please sign in to comment.