Skip to content

Commit 2fc311e

Browse files
committed
Bump What4 and Cryptol submodules.
Add stub implementations of the new enumeration primitives from GaloisInc/cryptol#1227, and fix up the type of `ecFromTo`, which also changed slightly in that PR.
1 parent 8c81761 commit 2fc311e

File tree

4 files changed

+64
-21
lines changed

4 files changed

+64
-21
lines changed

cryptol-saw-core/saw/Cryptol.sawcore

+33-6
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ tcDiv =
128128
(\ (y:Nat) -> TCInf)
129129
-- infinity / infinity = 1
130130
(TCNum 1);
131-
132131
tcMod : Num -> Num -> Num;
133132
tcMod =
134133
binaryNumFun (\ (x:Nat) -> \ (y:Nat) -> modNat x y)
@@ -170,7 +169,7 @@ tcCeilDiv =
170169

171170
tcCeilMod : Num -> Num -> Num;
172171
tcCeilMod =
173-
binaryNumFun ceilModNat (\ (x:Nat) -> TCNum 0) (\ (y:Nat) -> TCInf) TCInf;
172+
binaryNumFun ceilModNat (\ (x:Nat) -> TCNum 0) (\ (y:Nat) -> TCNum 0) TCInf;
174173

175174
tcLenFromThenTo_Nat : Nat -> Nat -> Nat -> Nat;
176175
tcLenFromThenTo_Nat x y z =
@@ -1349,17 +1348,17 @@ ecAt n =
13491348
ecAtBack : (n : Num) -> (a ix : sort 0) -> PIntegral ix -> seq n a -> ix -> a;
13501349
ecAtBack n a ix pix xs = ecAt n a ix pix (ecReverse n a xs);
13511350

1352-
ecFromTo : (first last : Num) -> (a : sort 0) -> PLiteral a -> PLiteral a ->
1351+
ecFromTo : (first last : Num) -> (a : sort 0) -> PLiteral a ->
13531352
seq (tcAdd (TCNum 1) (tcSub last first)) a;
13541353
ecFromTo =
13551354
finNumRec
1356-
(\ (first:Num) -> (last:Num) -> (a : sort 0) -> PLiteral a -> PLiteral a ->
1355+
(\ (first:Num) -> (last:Num) -> (a : sort 0) -> PLiteral a ->
13571356
seq (tcAdd (TCNum 1) (tcSub last first)) a)
13581357
(\ (first:Nat) ->
13591358
finNumRec
1360-
(\ (last:Num) -> (a : sort 0) -> PLiteral a -> PLiteral a ->
1359+
(\ (last:Num) -> (a : sort 0) -> PLiteral a ->
13611360
seq (tcAdd (TCNum 1) (tcSub last (TCNum first))) a)
1362-
(\ (last:Nat) -> \ (a : sort 0) -> \ (pa : PLiteral a) -> \ (_ : PLiteral a) ->
1361+
(\ (last:Nat) -> \ (a : sort 0) -> \ (pa : PLiteral a) ->
13631362
gen (addNat 1 (subNat last first)) a
13641363
(\ (i : Nat) -> pa (addNat i first))));
13651364

@@ -1394,6 +1393,34 @@ ecFromThenTo first next _ a =
13941393
(mulNat i (getFinNat next)))
13951394
(mulNat i (getFinNat first)))));
13961395

1396+
ecFromToBy :
1397+
(first last stride : Num) -> (a : sort 0) -> PLiteral a ->
1398+
seq (tcAdd (TCNum 1) (tcDiv (tcSub last first) stride)) a;
1399+
ecFromToBy first last stride a PLit =
1400+
error (seq (tcAdd (TCNum 1) (tcDiv (tcSub last first) stride)) a)
1401+
"TODO implement ecFromToBy";
1402+
1403+
ecFromToByLessThan :
1404+
(first bound stride : Num) -> (a : sort 0) -> PLiteralLessThan a ->
1405+
seq (tcCeilDiv (tcSub bound first) stride) a;
1406+
ecFromToByLessThan first bound stride a PLit =
1407+
error (seq (tcCeilDiv (tcSub bound first) stride) a)
1408+
"TODO implement ecFromToByLessThan";
1409+
1410+
ecFromToDownBy :
1411+
(first last stride : Num) -> (a : sort 0) -> PLiteral a ->
1412+
seq (tcAdd (TCNum 1) (tcDiv (tcSub first last) stride)) a;
1413+
ecFromToDownBy first last stride a PLit =
1414+
error (seq (tcAdd (TCNum 1) (tcDiv (tcSub first last) stride)) a)
1415+
"TODO implement ecFromToDownBy";
1416+
1417+
ecFromToDownByGreaterThan :
1418+
(first bound stride : Num) -> (a : sort 0) -> PLiteral a ->
1419+
seq (tcCeilDiv (tcSub first bound) stride) a;
1420+
ecFromToDownByGreaterThan first bound stride a PLit =
1421+
error (seq (tcCeilDiv (tcSub first bound) stride) a)
1422+
"TODO implement ecFromToDownByGreaterThan";
1423+
13971424
-- Infinite word sequences
13981425
ecInfFrom : (a : sort 0) -> PIntegral a -> a -> seq TCInf a;
13991426
ecInfFrom a pa x =

cryptol-saw-core/src/Verifier/SAW/Cryptol.hs

+29-13
Original file line numberDiff line numberDiff line change
@@ -759,21 +759,37 @@ prelPrims =
759759

760760
-- -- Enumerations
761761
, ("fromTo", flip scGlobalDef "Cryptol.ecFromTo")
762-
-- -- fromTo : {first, last, bits, a}
763-
-- -- ( fin last, fin bits, last >== first,
764-
-- -- Literal first a, Literal last a)
765-
-- -- => [1 + (last - first)]a
762+
-- fromTo : {first, last, bits, a}
763+
-- ( fin last, fin bits, last >== first,
764+
-- Literal first a, Literal last a)
765+
-- => [1 + (last - first)]a
766766
, ("fromToLessThan", flip scGlobalDef "Cryptol.ecFromToLessThan")
767-
-- -- fromToLessThan : {first, bound, a}
768-
-- -- ( fin first, bound >= first,
769-
-- -- LiteralLessThan bound a)
770-
-- -- => [bound - first]a
767+
-- fromToLessThan : {first, bound, a}
768+
-- ( fin first, bound >= first,
769+
-- LiteralLessThan bound a)
770+
-- => [bound - first]a
771771
, ("fromThenTo", flip scGlobalDef "Cryptol.ecFromThenTo")
772-
-- -- fromThenTo : {first, next, last, a, len}
773-
-- -- ( fin first, fin next, fin last
774-
-- -- , Literal first a, Literal next a, Literal last a
775-
-- -- , first != next
776-
-- -- , lengthFromThenTo first next last == len) => [len]a
772+
-- fromThenTo : {first, next, last, a, len}
773+
-- ( fin first, fin next, fin last
774+
-- , Literal first a, Literal next a, Literal last a
775+
-- , first != next
776+
-- , lengthFromThenTo first next last == len) => [len]a
777+
, ("fromToBy", flip scGlobalDef "Cryptol.ecFromToBy")
778+
-- fromToBy : {first, last, stride, a}
779+
-- (fin last, fin stride, stride >= 1, last >= first, Literal last a) =>
780+
-- [1 + (last - first)/stride]a
781+
, ("fromToByLessThan", flip scGlobalDef "Cryptol.ecFromToByLessThan")
782+
-- fromToByLessThan : {first, bound, stride, a}
783+
-- (fin first, fin stride, stride >= 1, bound >= first, LiteralLessThan bound a) =>
784+
-- [(bound - first)/^stride]a
785+
, ("fromToDownBy", flip scGlobalDef "Cryptol.ecFromToDownBy")
786+
-- fromToDownBy : {first, last, stride, a}
787+
-- (fin first, fin stride, stride >= 1, first >= last, Literal first a) =>
788+
-- [1 + (first - last)/stride]a
789+
, ("fromToDownByGreaterThan", flip scGlobalDef "Cryptol.ecFromToDownByGreaterThan")
790+
-- fromToDownByGreaterThan : {first, bound, stride, a}
791+
-- (fin first, fin stride, stride >= 1, first >= bound, Literal first a) =>
792+
-- [(first - bound)/^stride]a
777793

778794
-- Evaluation primitives: deepseq, parmap
779795
, ("deepseq", flip scGlobalDef "Cryptol.ecDeepseq") -- {a, b} (Eq b) => a -> b -> b

deps/cryptol

Submodule cryptol updated 79 files

0 commit comments

Comments
 (0)