Skip to content

Commit 6e44c4b

Browse files
committed
fix: move the simlification rules to the same place
1 parent 52372f4 commit 6e44c4b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

kmir/src/kmir/kdist/mir-semantics/lemmas/kmir-lemmas.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,16 @@ If nothing is removed, the list remains the same. If all elements are removed, n
5252
```
5353

5454
The `#mapOffset` function maps `#adjustRef` over a lists of `Value`s, leaving the list length unchanged.
55-
Definedness of the list and list elements is also guaranteed.
55+
Definedness of the list and list elements is also guaranteed.
56+
The helper `#adjustRef` reduces to the original value when the offset is zero and merges nested offset adjustments.
5657

5758
```k
59+
rule #adjustRef(VAL:Value, 0) => VAL [simplification]
60+
61+
rule #adjustRef(#adjustRef(VAL, OFFSET1), OFFSET2)
62+
=> #adjustRef(VAL, OFFSET1 +Int OFFSET2)
63+
[simplification]
64+
5865
rule size(#mapOffset(L, _)) => size(L) [simplification, preserves-definedness]
5966
6067
rule #Ceil(#mapOffset(L, _)[I]) => #Ceil(L) #And {true #Equals 0 <=Int I} #And {true #Equals I <Int size(L)} [simplification]

kmir/src/kmir/kdist/mir-semantics/rt/data.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,6 @@ These helpers mark down, as we traverse the projection, what `Place` we are curr
428428
=> Range(#mapOffset(ELEMS, OFFSET))
429429
rule #adjustRef(TL, _) => TL [owise]
430430
431-
rule #adjustRef(#adjustRef(VAL, OFFSET1), OFFSET2)
432-
=> #adjustRef(VAL, OFFSET1 +Int OFFSET2)
433-
[simplification]
434-
435-
rule #adjustRef(VAL:Value, 0) => VAL [simplification]
436-
437431
syntax List ::= #mapOffset ( List, Int ) [function, total]
438432
// -------------------------------------------------------
439433
rule #mapOffset(.List, _)

0 commit comments

Comments
 (0)