Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark updateSparseBytes(setRange) as preserving definedness, add #signed simplification #176

Merged
merged 10 commits into from
Jul 29, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ module SET-RANGE-LEMMAS
=> SBChunk(#bytes(replaceAtBytes(A, Start, Int2Bytes(Width, Value, LE))))
requires functionSparseBytesWellDefined(setRange(Value), Start, Width)
andBool Start +Int Width <=Int lengthBytes(A)
[simplification, concrete(A)]
[simplification, concrete(A), preserves-definedness]
// all arguments are checked to be in the required range/of the required size

rule updateSparseBytes(setRange(Value:Int), SBChunk(#empty(A)), Start:Int, Width:Int)
=> SBChunk(#empty(Start))
Expand Down
8 changes: 8 additions & 0 deletions kmxwasm/src/kmxwasm/kdist/mxwasm-semantics/mx-lemmas.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ module MX-LEMMAS [symbolic]
andBool A <Int #pow1(IType)
[simplification]

// equivalent rule for #signed
rule #signed(IType:IValType, A modIntTotal M) => A
requires M ==Int #pow(IType)
andBool A <Int #pow1(IType)
andBool 0 -Int #pow1(IType) <=Int A
[simplification, preserves-definedness]
// LHS always defined because 0 <= modIntTotal(_, _)

rule -1 <=Int #cmpInt(_:Int, _:Int) => true
[simplification, smt-lemma]
rule #cmpInt(_:Int, _:Int) <=Int 1 => true
Expand Down
Loading