@@ -41,14 +41,14 @@ module BYTES-SIMPLIFICATION [symbolic]
41
41
requires 0 <=Int W
42
42
andBool 0 <=Int X andBool X <Int 2 ^Int (8 *Int W)
43
43
andBool 0 <=Int Y andBool Y <Int 2 ^Int (8 *Int W)
44
- [simplification]
44
+ [simplification, preserves-definedness ]
45
45
46
46
rule [buf-inject-ml]:
47
47
{ #buf(W:Int, X:Int) #Equals #buf(W:Int, Y:Int) } => { X #Equals Y }
48
48
requires 0 <=Int W
49
49
andBool 0 <=Int X andBool X <Int 2 ^Int (8 *Int W)
50
50
andBool 0 <=Int Y andBool Y <Int 2 ^Int (8 *Int W)
51
- [simplification]
51
+ [simplification, preserves-definedness ]
52
52
53
53
rule [buf-as-int]: B:Bytes ==K #buf(32, X:Int) => X ==Int #asInteger(B)
54
54
requires lengthBytes(B) <=Int 32
@@ -68,21 +68,21 @@ module BYTES-SIMPLIFICATION [symbolic]
68
68
#buf (W:Int , #asWord(B:Bytes)) => #range(B, lengthBytes(B) -Int W, W)
69
69
requires 0 <=Int W andBool W <Int lengthBytes(B) andBool lengthBytes(B) <=Int 32
70
70
andBool #asWord(B) <Int 2 ^Int (8 *Int W)
71
- [simplification, concrete(W)]
71
+ [simplification, concrete(W), preserves-definedness ]
72
72
73
73
rule [buf-asWord-invert-rl]:
74
74
#asWord ( #buf ( WB:Int, X:Int ) ) => X
75
75
requires 0 <=Int WB andBool 0 <=Int X andBool
76
76
( ( WB <=Int 32 andBool X <Int 2 ^Int (WB *Int 8) ) orBool
77
77
( WB >Int 32 andBool X <Int pow256 ) )
78
- [simplification, concrete(WB)]
78
+ [simplification, concrete(WB), preserves-definedness ]
79
79
80
80
rule [buf-asWord-invert-rl-range]:
81
81
#asWord ( #range ( #buf ( WB:Int, X:Int ), S:Int, WR:Int ) ) => X
82
82
requires 0 <=Int WB andBool 0 <=Int X andBool 0 <=Int S andBool 0 <=Int WR
83
83
andBool S +Int WR ==Int WB
84
84
andBool X <Int 2 ^Int (WR *Int 8)
85
- [simplification, concrete(WB, S, WR)]
85
+ [simplification, concrete(WB, S, WR), preserves-definedness ]
86
86
87
87
rule [buf-zero-concat-base]:
88
88
#buf(W1:Int, 0) +Bytes #buf(W2:Int, 0) => #buf(W1 +Int W2, 0)
@@ -189,13 +189,13 @@ module BYTES-SIMPLIFICATION [symbolic]
189
189
B:Bytes +Bytes #buf(W:Int, X:Int) => #buf(lengthBytes(B) +Int W, X)
190
190
requires 0 <=Int W andBool 0 <=Int X andBool X <Int 2 ^Int (W *Int 8)
191
191
andBool #asInteger(B) ==Int 0 andBool lengthBytes(B) +Int W <=Int 32
192
- [concrete(B, W), simplification]
192
+ [concrete(B, W), simplification, preserves-definedness ]
193
193
194
194
rule [range-buf-zero-concat-extend]:
195
195
B1:Bytes +Bytes #buf(W:Int, X:Int) +Bytes B2 => #buf(lengthBytes(B1) +Int W, X) +Bytes B2
196
196
requires 0 <=Int W andBool 0 <=Int X andBool X <Int 2 ^Int (W *Int 8)
197
197
andBool #asInteger(B1) ==Int 0 andBool lengthBytes(B1) +Int W <=Int 32
198
- [concrete(B1, W), simplification]
198
+ [concrete(B1, W), simplification, preserves-definedness ]
199
199
200
200
rule [range-memUpdate-before]:
201
201
#range(B1:Bytes [ S1:Int := B2:Bytes ], S2:Int, W2:Int) =>
@@ -220,13 +220,13 @@ module BYTES-SIMPLIFICATION [symbolic]
220
220
#range (#buf(W1:Int, X:Int), S2:Int, W2:Int) => #buf(W2, 0)
221
221
requires 0 <=Int X andBool X <Int 2 ^Int (8 *Int (W1 -Int (S2 +Int W2)))
222
222
andBool 0 <=Int S2 andBool 0 <=Int W2 andBool S2 +Int W2 <=Int W1
223
- [simplification, concrete(W1, S2, W2)]
223
+ [simplification, concrete(W1, S2, W2), preserves-definedness ]
224
224
225
225
rule [range-buf-value]:
226
226
#range (#buf(W1:Int, X:Int), S2:Int, W2:Int) => #buf(W2, X)
227
227
requires 0 <=Int X andBool X <Int 2 ^Int (8 *Int W2)
228
228
andBool 0 <=Int S2 andBool 0 <=Int W2 andBool W1 ==Int S2 +Int W2
229
- [simplification, concrete(W1, S2, W2)]
229
+ [simplification, concrete(W1, S2, W2), preserves-definedness ]
230
230
231
231
rule [range-padRightToWidth]:
232
232
#range(#padRightToWidth(_, BUF), 0, WIDTH) => BUF
@@ -239,7 +239,7 @@ module BYTES-SIMPLIFICATION [symbolic]
239
239
andBool #asInteger( BZ ) ==Int 0
240
240
andBool lengthBytes( BZ ) ==Int S
241
241
andBool #asWord ( B ) <Int 2 ^Int ( 8 *Int W )
242
- [simplification, concrete(BZ, S, W), comm]
242
+ [simplification, concrete(BZ, S, W), comm, preserves-definedness ]
243
243
244
244
rule [range-eq-check-ml]:
245
245
{ BZ +Bytes #range ( B, S, W ) #Equals B } => #Top
@@ -248,7 +248,7 @@ module BYTES-SIMPLIFICATION [symbolic]
248
248
andBool #asInteger( BZ ) ==Int 0
249
249
andBool lengthBytes( BZ ) ==Int S
250
250
andBool #asWord ( B ) <Int 2 ^Int ( 8 *Int W )
251
- [simplification, concrete(BZ, S, W), comm]
251
+ [simplification, concrete(BZ, S, W), comm, preserves-definedness ]
252
252
253
253
// Memory update
254
254
@@ -291,7 +291,9 @@ module BYTES-SIMPLIFICATION [symbolic]
291
291
292
292
// #asWord
293
293
294
- rule #asWord(WS) >>Int M => #asWord(#range(WS, 0, lengthBytes(WS) -Int (M /Int 8) )) requires 0 <=Int M andBool M modInt 8 ==Int 0 [simplification]
294
+ rule #asWord(WS) >>Int M => #asWord(#range(WS, 0, lengthBytes(WS) -Int (M /Int 8) ))
295
+ requires 0 <=Int M andBool M modInt 8 ==Int 0
296
+ [simplification, preserves-definedness]
295
297
296
298
// This simplification needs to be generalised properly
297
299
rule notMaxUInt224 &Int #asWord(#padRightToWidth(32, BUF)) => #asWord(#padRightToWidth(32, BUF))
0 commit comments