You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: kmir/src/kmir/kdist/mir-semantics/lemmas/kmir-lemmas.md
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This file contains basic lemmas required for symbolic execution of MIR programs
4
4
5
5
Lemmas are simpliciations of symbolic function application that aims to confirm conditions for rewrite rules to avoid spurious branching on symbolic program parts.
6
6
7
-
Some of the lemmas relate to the control flow implementation in `kmir.md` and will be needed in various proofs (for instance the simplification of list size for partially-symbolic lists of locals or stack frames).
7
+
Some of the lemmas relate to the control flow implementation in `kmir.md` and will be needed in various proofs (for instance the simplification of list size for partially-symbolic lists of locals or stack frames).
8
8
Others are related to helper functions used for integer arithmetic.
9
9
10
10
```k
@@ -20,7 +20,7 @@ module KMIR-LEMMAS
20
20
```
21
21
## Simplifications for lists to avoid spurious branching on error cases in control flow
22
22
23
-
Rewrite rules that look up locals or stack frames require that an index into the respective `List`s in the configuration be within the bounds of the locals list/stack. Therefore, the `size` function on lists needs to be computed. The following simplifications allow for locals and stacks to have concrete values in the beginning but a symbolic rest (of unknown size).
23
+
Rewrite rules that look up locals or stack frames require that an index into the respective `List`s in the configuration be within the bounds of the locals list/stack. Therefore, the `size` function on lists needs to be computed. The following simplifications allow for locals and stacks to have concrete values in the beginning but a symbolic rest (of unknown size).
24
24
The lists used in the semantics are cons-lists, so only rules with a head element match are required.
25
25
26
26
```k
@@ -208,6 +208,25 @@ This avoids building up large expressions related to overflow checks and vacuous
208
208
[simplification, preserves-definedness, symbolic]
209
209
```
210
210
211
+
Another more general simplification relates a `NUMBER` and the bytes from its representation.
212
+
If the number is initially masked at 64 bits (`&Int bitmask64`), it is guaranteed to be positive
213
+
and therefore the masked value equals its bytes taken individually and multiplied.
214
+
Terms like this have been observed as branching conditions in a proof that heavily uses `[u8;8] <--> u64` conversions.
215
+
The simplification eliminates the vacuous branches instantly.
0 commit comments