This is the repo of the tool for static resource bound verification.
Annotate *.java
files with resource variables that track the amount of resource increments and decrements
- Initialize resource variables with statement
int R = 0
.- Note that resource variables' names must start with
R
.
- Note that resource variables' names must start with
- Use statement
R = R + e
to denote that the amount of resource consumption is the value of expressione
when reaching this control location.- Note that these increments/decrements must be at the end of a basic block (as opposed to being in the middle).
Annotate the bound expressions to verify
- Use statement
assert(e) : "bound"
to denote that the bound expression to verify ise
.- E.g. we may use
assert(R<n) : "bound"
to denote that the bound expression to verify isR<n
.
- E.g. we may use
- Each program may have more than 1 bound expressions to be verified.
A user may provide additional global invariants that can help the tool to verify bounds. The tool will not check the validity of these extra invariants.
- Use statement
assert(e): "global"
.
- Please do not use any method calls in
*.java
files.- Otherwise the generated control flow graphs will have edges pointing to exception handling blocks, causing the tool to crash.
- Please do not use prefix or post increment/decrement statements such as
i++
or--i
.
Directly run ./scripts/run.sh YourJavaFile.java
from the root directory of this project.
- To debug the semantic correctness of the generate predicates, check if for all variables, the guessed invariant can imply the inferred pre-conditions. If not, then either the guessed invariant is wrong, or the inferrence of pre-conditions is wrong. E.g.
(assert
(forall ((i Int) (n Int) (b Bool))
(=>
true
true
)
)
(check-sat)
; (get-model)
- To debug the semantic correctness of the generated predicates, analyze the WLPs in the form of high-level predicates, as opposed to SMTLIB2 outputs (which are extremely hard to read). E.g. think about what loop invariants might be needed to verify a predicate is valid.