Skip to content

Commit bd8d70d

Browse files
committed
Add new simplification rule for concatenating byte substrings in BYTES-SIMPLIFICATIONS and update ZKEVM-SSTORE test specification to include padding bytes.
1 parent db72be8 commit bd8d70d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/kriscv/kdist/riscv-semantics/lemmas/bytes-simplifications.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ module BYTES-SIMPLIFICATIONS [symbolic]
4747
rule [bytes-concat-substr]: substrBytes(A, I0, J0) +Bytes substrBytes(A, I1, J1) => substrBytes(A, I0, J1)
4848
requires I0 <=Int J0 andBool I1 <=Int J1 andBool J0 ==Int I1 andBool J1 <=Int lengthBytes(A)
4949
[simplification, preserves-definedness]
50+
rule [bytes-concat-substr-cxt]: substrBytes(A, I0, J0) +Bytes substrBytes(A, I1, J1) +Bytes B => substrBytes(A, I0, J1) +Bytes B
51+
requires I0 <=Int J0 andBool I1 <=Int J1 andBool J0 ==Int I1 andBool J1 <=Int lengthBytes(A)
52+
[simplification, preserves-definedness]
5053
```
5154

5255
## Bytes Update Lemmas

src/tests/integration/test-data/specs/zkevm-sstore.k

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ module ZKEVM-SSTORE
55
<instrs> #CHECK_HALT => #HALT </instrs>
66
<pc> 0 </pc>
77
<mem>
8-
#bytes(substrBytes(reverseBytes(VALUE), 0, 4) +Bytes substrBytes(reverseBytes(VALUE), 4, 8) +Bytes substrBytes(reverseBytes(VALUE), 8, 12) +Bytes substrBytes(reverseBytes(VALUE), 12, 16) +Bytes substrBytes(reverseBytes(VALUE), 16, 20) +Bytes substrBytes(reverseBytes(VALUE), 20, 24) +Bytes substrBytes(reverseBytes(VALUE), 24, 28) +Bytes substrBytes(reverseBytes(VALUE), 28, 32)) .SparseBytes
8+
#bytes(b"\x00\x00\x00\x00" +Bytes substrBytes(reverseBytes(VALUE), 0, 4) +Bytes substrBytes(reverseBytes(VALUE), 4, 8) +Bytes substrBytes(reverseBytes(VALUE), 8, 12) +Bytes substrBytes(reverseBytes(VALUE), 12, 16) +Bytes substrBytes(reverseBytes(VALUE), 16, 20) +Bytes substrBytes(reverseBytes(VALUE), 20, 24) +Bytes substrBytes(reverseBytes(VALUE), 24, 28) +Bytes substrBytes(reverseBytes(VALUE), 28, 32) +Bytes b"\x00\x00\x00\x00" ) .SparseBytes
99
=>
10-
#bytes(reverseBytes(VALUE)) .SparseBytes
10+
#bytes(b"\x00\x00\x00\x00" +Bytes reverseBytes(VALUE) +Bytes b"\x00\x00\x00\x00" ) .SparseBytes
1111
</mem>
1212
<haltCond> ADDRESS ( 0 ) </haltCond>
1313
requires lengthBytes(VALUE) ==Int 32

0 commit comments

Comments
 (0)