Skip to content

Commit 887dcd9

Browse files
committed
Add rules for handling 6th and 7th registers in zkevm-mstore claim and update requirements in test specification.
1 parent 9717462 commit 887dcd9

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/kriscv/kdist/riscv-semantics/lemmas/zkevm-harness-simplifications.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ rule A <Int B +Int C => A -Int C <Int B [simplification, concrete(A,C), symbolic
3636
rule 0 |Int X => X [simplification]
3737
```
3838

39+
To handle the 6-th and 7-th registers in the zkevm-mstore claim, we need the following rules:
40+
```k
41+
rule Bool2Word(B) ==Int 0 => notBool B [simplification]
42+
rule Bool2Word(B) ==Int 1 => B [simplification]
43+
```
44+
3945
```k
4046
endmodule
4147
```

src/tests/integration/test-data/specs/zkevm-mstore-0.k

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ module ZKEVM-MSTORE-0
1010
3 |-> (Bool2Word(0 <Int Bytes2Int ( OFFSET:Bytes +Bytes b"\x00\x00\x00" , LE , Unsigned ) +Int 32) => 1)
1111
4 |-> (Bool2Word(0 <Int 0 -Int Bool2Word ( 4294967295 <Int Bytes2Int ( OFFSET:Bytes +Bytes b"\x00\x00\x00" , LE , Unsigned ) +Int 32 ) &Int 4294967295 |Int Bytes2Int ( OFFSET:Bytes +Bytes b"\x00\x00\x00" , LE , Unsigned ) +Int 32 &Int 4294967295) => 1)
1212
// 5 |-> (Bool2Word(4294967295 <Int Bytes2Int ( OFFSET:Bytes +Bytes b"\x00\x00\x00" , LE , Unsigned ) +Int 32) => 0)
13+
6 |-> (Bool2Word(Y <=Int Z) => 0)
14+
7 |-> (Bool2Word(Z <=Int 4294967295) => 1)
1315
</regs>
1416
<haltCond> ADDRESS ( 0 ) </haltCond>
15-
requires 0 <Int X andBool 0 <=Int Y andBool 0 <Int Z
17+
requires 0 <Int X
1618
andBool lengthBytes(OFFSET) ==Int 1
19+
andBool notBool (Y <=Int Z)
20+
andBool notBool (Bool2Word(Z <=Int 4294967295) ==Int 0)
1721
endmodule

0 commit comments

Comments
 (0)