Created
March 21, 2020 03:36
-
-
Save sskeirik/06d8bf552202679d2ea2e5392cef9794 to your computer and use it in GitHub Desktop.
KWasm Lemmas for Byte Manipulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rule lengthBytes(B1 +Bytes B2) => lengthBytes(B1) +Int lengthBytes(B2) [simplification] | |
rule substrBytes(B1 +Bytes B2, START, END) | |
=> substrBytes(B1, START, END) | |
requires lengthBytes(B1) >=Int END | |
[simplification] | |
rule substrBytes(B1 +Bytes B2, START, END) | |
=> substrBytes(B2, START -Int lengthBytes(B1), END -Int lengthBytes(B1)) | |
requires lengthBytes(B1) <=Int START | |
[simplification] | |
rule substrBytes(B1 +Bytes B2, START, END) | |
=> substrBytes(B1, START, lengthBytes(B1)) +Bytes | |
substrBytes(B2, START -Int lengthBytes(B1), END -Int lengthBytes(B1)) | |
requires notBool (lengthBytes(B1) >=Int END) | |
andBool notBool (lengthBytes(B1) <=Int START) | |
[simplification] | |
rule substrBytes(B, 0, END) => B | |
requires lengthBytes(B) ==Int END | |
[simplification] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment