Skip to content

Commit

Permalink
Define primitive ListBytes lookup using the hooked function (#306)
Browse files Browse the repository at this point in the history
* Rewrite ListBytes:primitiveLookup to a hooked operation when defined

* remove rule side conditions

* Set Version: 0.1.96

---------

Co-authored-by: devops <[email protected]>
  • Loading branch information
jberthold and devops authored Jul 16, 2024
1 parent 1a2c815 commit bf76305
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kmultiversx/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kmultiversx"
version = "0.1.95"
version = "0.1.96"
description = "Python tools for Elrond semantics"
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module LIST-BYTES-EXTENSIONS
[function, symbol(ListBytes:primitiveLookup)]
// -----------------------------------------------------------
rule L:ListBytes {{ I:Int }} => unwrap( L[ I ] )
[preserves-definedness] // defined or undefined on both sides

syntax Bytes ::= ListBytes "{{" Int "}}" "orDefault" Bytes
[ function, total, symbol(ListBytes:primitiveLookupOrDefault) ]
Expand Down Expand Up @@ -113,19 +114,19 @@ module LIST-BYTES-EXTENSIONS
// ----------------------------------------------------------
rule rangeTotal(L, Front, Back) => range(L, Front, Back)
requires 0 <=Int Front
andBool 0 <=Int Back
andBool 0 <=Int Back
andBool size(L) >=Int Front +Int Back

rule rangeTotal(L, Front, Back) => rangeTotal(L, 0, Back)
requires Front <Int 0

rule rangeTotal(L, Front, Back) => rangeTotal(L, Front, 0)
requires 0 <=Int Front
andBool Back <Int 0

rule rangeTotal(L, Front, Back) => .ListBytes
requires 0 <=Int Front
andBool 0 <=Int Back
andBool 0 <=Int Back
andBool size(L) <Int Front +Int Back

endmodule
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.95
0.1.96

0 comments on commit bf76305

Please sign in to comment.