@@ -23,6 +23,7 @@ module SearchConfigToInfo {
2323 import opened DynamoDbEncryptionUtil
2424 import opened TermLoc
2525 import opened StandardLibrary. String
26+ import opened MemoryMath
2627 import MaterialProviders
2728 import SortedSets
2829
@@ -757,15 +758,15 @@ module SearchConfigToInfo {
757758 function method MakeDefaultConstructor (
758759 parts : seq <CB .BeaconPart>,
759760 ghost allParts : seq <CB .BeaconPart>,
760- ghost numNon : nat ,
761+ ghost numNon : uint64 ,
761762 converted : seq <CB .ConstructorPart> := []
762763 )
763764 : (ret : Result< seq < CB. Constructor> , Error> )
764765 requires 0 < |parts| + |converted|
765766 requires |allParts| == |parts| + |converted|
766767 requires parts == allParts[|converted|.. ]
767- requires numNon <= |allParts|
768- requires CB. OrderedParts (allParts, numNon)
768+ requires numNon as nat <= |allParts|
769+ requires CB. OrderedParts (allParts, numNon as nat )
769770 requires forall i | 0 <= i < |converted| ::
770771 && converted[i]. part == allParts[i]
771772 && converted[i]. required
@@ -776,7 +777,7 @@ module SearchConfigToInfo {
776777 // = type=implication
777778 // # * This default constructor MUST be all of the signed parts,
778779 // # followed by all the encrypted parts, all parts being required.
779- && CB. OrderedParts (allParts, numNon)
780+ && CB. OrderedParts (allParts, numNon as nat )
780781 && (forall i | 0 <= i < |ret. value[0]. parts| ::
781782 && ret. value[0]. parts[i]. part == allParts[i]
782783 && ret. value[0]. parts[i]. required)
@@ -887,13 +888,13 @@ module SearchConfigToInfo {
887888 constructors : Option <ConstructorList >,
888889 name : string ,
889890 parts : seq <CB .BeaconPart>,
890- ghost numSigned : nat
891+ ghost numSigned : uint64
891892 )
892893 : (ret : Result< seq < CB. Constructor> , Error> )
893894 requires 0 < |parts|
894895 requires constructors. Some? ==> 0 < |constructors. value|
895- requires numSigned <= |parts|
896- requires CB. OrderedParts (parts, numSigned)
896+ requires numSigned as nat <= |parts|
897+ requires CB. OrderedParts (parts, numSigned as nat )
897898 ensures ret. Success? ==>
898899 && (constructors. None? ==> |ret. value| == 1)
899900 && (constructors. Some? ==> |ret. value| == |constructors. value|)
@@ -1065,10 +1066,11 @@ module SearchConfigToInfo {
10651066 :- Need (beacon.constructors.Some? || |signedParts| != 0 || |encryptedParts| != 0,
10661067 E("Compound beacon " + beacon.name + " defines no constructors, and also no local parts. Cannot make a default constructor from global parts."));
10671068
1068- var numNon := |signed|;
1069- assert CB. OrderedParts (signed, numNon);
1069+ SequenceIsSafeBecauseItIsInMemory (signed);
1070+ var numNon := |signed| as uint64;
1071+ assert CB. OrderedParts (signed, numNon as nat);
10701072 var allParts := signed + encrypted;
1071- assert CB. OrderedParts (allParts, numNon);
1073+ assert CB. OrderedParts (allParts, numNon as nat );
10721074
10731075 var isSignedBeacon := |encrypted| == 0;
10741076 var _ :- BeaconNameAllowed (outer, virtualFields, beacon.name, "CompoundBeacon", isSignedBeacon);
@@ -1087,7 +1089,7 @@ module SearchConfigToInfo {
10871089 ),
10881090 beacon. split[0],
10891091 allParts,
1090- numNon,
1092+ numNon as nat ,
10911093 constructors
10921094 )
10931095 }
0 commit comments