@@ -36,43 +36,43 @@ module SLOT-UPDATES [symbolic]
36
36
A |Int #asWord ( B1 +Bytes B2 ) =>
37
37
#asWord ( #buf ( 32 -Int lengthBytes(B2), (A /Int (2 ^Int (8 *Int lengthBytes(B2)))) |Int #asWord ( B1 ) ) +Bytes B2 )
38
38
requires #rangeUInt(256, A) andBool A modInt (2 ^Int (8 *Int lengthBytes(B2))) ==Int 0 andBool lengthBytes(B1 +Bytes B2) <=Int 32
39
- [simplification, preserves-definedness]
39
+ [simplification(40), comm , preserves-definedness]
40
40
41
41
// 2b. |Int of +Bytes, update to be done in right
42
42
rule [bor-update-to-right]:
43
43
A |Int #asWord ( B1 +Bytes B2 ) =>
44
44
#asWord ( B1 +Bytes #buf ( lengthBytes(B2), A |Int #asWord ( B2 ) ) )
45
45
requires 0 <=Int A andBool A <Int 2 ^Int (8 *Int lengthBytes(B2)) andBool lengthBytes(B2) <=Int 32
46
- [simplification, preserves-definedness]
46
+ [simplification(40), comm , preserves-definedness]
47
47
48
48
// 3a. Update with explicit shift and symbolic slot
49
49
rule [bor-update-with-shift]:
50
50
( SHIFT *Int X ) |Int Y => #asWord ( #buf( 32 -Int ( log2Int(SHIFT) /Int 8 ), X ) +Bytes #buf( log2Int(SHIFT) /Int 8, Y ) )
51
51
requires #isByteShift(SHIFT)
52
52
andBool 0 <=Int X andBool X <Int 2 ^Int (8 *Int (32 -Int ( log2Int(SHIFT) /Int 8 )))
53
53
andBool 0 <=Int Y andBool Y <Int SHIFT
54
- [simplification, concrete(SHIFT), comm, preserves-definedness]
54
+ [simplification(42) , concrete(SHIFT), comm, preserves-definedness]
55
55
56
- // 3b. Buffer cropping
56
+ // 3b. Update with implicit shift and symbolic slot
57
+ rule [bor-update-without-shift]:
58
+ X |Int Y => #asWord ( #buf ( 32 -Int #getFirstOneBit(X) /Int 8, X /Int ( 2 ^Int ( 8 *Int ( #getFirstOneBit(X) /Int 8 ) ) ) ) +Bytes
59
+ #buf ( #getFirstOneBit(X) /Int 8, Y ) )
60
+ requires #rangeUInt(256, X) andBool 0 <=Int #getFirstOneBit(X)
61
+ andBool 0 <=Int Y andBool Y <Int 2 ^Int ( 8 *Int ( #getFirstOneBit(X) /Int 8 ) )
62
+ [simplification(42), concrete(X), preserves-definedness]
63
+
64
+ // 4. Buffer cropping
57
65
rule [buf-asWord-crop]:
58
66
#buf (W:Int , #asWord(B:Bytes)) => #range(B, lengthBytes(B) -Int W, W)
59
67
requires 0 <=Int W andBool W <=Int 32 andBool W <Int lengthBytes(B)
60
68
andBool #asWord ( #range(B, 0, lengthBytes(B) -Int W) ) ==Int 0
61
69
[simplification, concrete(W), preserves-definedness]
62
70
63
- // 3c . Splitting the updated buffer into the updated value and the trailing zeros, explicit shift
64
- rule [buf-split-l ]:
71
+ // 5 . Splitting the updated buffer into the updated value and the trailing zeros
72
+ rule [buf-split-on-shift ]:
65
73
#buf ( W, SHIFT *Int X ) => #buf( W -Int ( log2Int(SHIFT) /Int 8 ), X ) +Bytes #buf( log2Int(SHIFT) /Int 8, 0)
66
74
requires 0 <=Int W andBool W <=Int 32 andBool #isByteShift(SHIFT)
67
75
andBool 0 <=Int X andBool X <Int 2 ^Int (8 *Int (W -Int ( log2Int(SHIFT) /Int 8)))
68
76
[simplification, concrete(W, SHIFT), preserves-definedness]
69
77
70
- // 3d. Splitting the updated buffer into the updated value and the trailing zeros, implicit shift
71
- rule [bor-split]:
72
- X |Int Y => #asWord ( #buf ( 32 -Int #getFirstOneBit(X) /Int 8, X /Int ( 2 ^Int ( 8 *Int ( #getFirstOneBit(X) /Int 8 ) ) ) ) +Bytes
73
- #buf ( #getFirstOneBit(X) /Int 8, Y ) )
74
- requires #rangeUInt(256, X) andBool 0 <=Int #getFirstOneBit(X)
75
- andBool 0 <=Int Y andBool Y <Int 2 ^Int ( 8 *Int ( #getFirstOneBit(X) /Int 8 ) )
76
- [simplification, concrete(X), preserves-definedness]
77
-
78
78
endmodule
0 commit comments