Skip to content

Commit b7d54d9

Browse files
committed
add a section explaining how loops and recursion can be addressed by K
1 parent f73b9a2 commit b7d54d9

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

doc/src/tools/kmir.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ leaf state is required to unify with the target state.
6262
A one-path-reachability proof is similar to the above, but the proof requirement
6363
is that _at least one_ leaf state unifies with the target state.
6464

65+
When performing a proof of a program that involves recursion or a loop construct,
66+
one of several possible techniques can be used:
67+
68+
1) K (and thus KMIR) are capable of unbounded verification via allowing the
69+
user to write loop invariants. However, these loop invariants would then
70+
need to be written in K's native language.
71+
2) As potential future work, it would be possible to implement an annotation
72+
language to provide the required context for loop invariant directly in
73+
source code (as done in the past using natspec for Solitidy code).
74+
3) In general, K also supports bounded loop unrolling, by way of identifying
75+
loop heads and counting how many times the same loop head has been observed.
76+
This technique is managed by the all-path reachability prover library for
77+
K and works out of the box with suitable arguments, without requiring any
78+
special support from the back-end.
79+
80+
Our front-end, at the time of writing, does not have either of these
81+
options turned on. As soon as larger programs will require it, we will decide
82+
whether the preference is to implement support for user-supplied K-level
83+
loop invariants, or bounded loop unrolling support, or (probably) offer both.
84+
6585
KMIR also prioritizes UI with interactive proof exploration available
6686
out-of-the-box through the terminal KCFG (K Control Flow Graph) viewer, allowing
6787
users to inspect intermediate states of the proof to get feedback on the

0 commit comments

Comments
 (0)