-
Notifications
You must be signed in to change notification settings - Fork 39
VerCors usage tips
If you're working on a project with VerCors, you’re welcome to join the VerCors community chat. Feel free to ask any question, big or small. The chat is an informal place to get help and lowers the barrier to getting started. Send a message to vercors@lists.utwente.nl so we can invite you!
To verify a file:
vct <inputFile>-
--help– Displays all available options.
By default, VerCors uses the Silicon backend, which is based on symbolic execution.
Alternatively, you can use the Carbon backend:
--backend carbonCarbon generates verification conditions and passes them to Boogie.
In most cases, Silicon is the best option, but sometimes Carbon performs better.
Enable watch mode with:
--watchThis allows VerCors to automatically verify the specified file after edits.
It greatly speeds up verification after the first run and is highly recommended.
Flag:
--dev-no-satTurns off detection of unsound preconditions.
It is not needed for general use, but may help if you have many forall statements and verification is slow.
Java example:
class C {
//@ requires 1 == 2; // <-- Normally this causes an error; --dev-no-sat turns this off
void m() { }
}Flag:
--dev-unsafe-optimizationTurns off internal checks, which can greatly decrease running time, especially for larger files. Implies --dev-no-sat.
This does not impact the verification result; however, when errors occur, they are often less readable.
VerCors relies on SMT solvers such as Z3 to check verification conditions.
However, non-linear arithmetic is generally undecidable.
Example PVL code that does not verify:
requires x > 0 && a > 0 && n > 0 && x < n && x < a;
void f(int x, int a, int n) {
assert a * x + x < a * n;
}
If you are working with non-linearity, we suggest enabling Z3’s non-linear solver with the following flag:
--prover-config:smt.arith.solver=6With this option, the above example verifies.
VerCors translates its inputs to the Viper intermediate verification language. When verification fails and the error message does not help, it can be useful to inspect the generated backend file and verify it directly using the Viper plugin for VS Code.
To inspect the generated backend file, add the following flag:
--backend-file-base <outputFile>This creates a file named <outputFile>-0.vpr.
Often, it is useful to also pass --dev-no-sat to avoid superfluous verification errors about preconditions.
Note
The Viper version used by VerCors and the Viper VS Code plugin might be out of sync.
The Viper VS Code plugin has a 100-second timeout (which can be disabled).
Flags:
--output-before-pass:<pass>=<path>
--output-after-pass:<pass>=<path>Shows the internal AST before and after a pass.
Run:
vct --help-passesto list all pass names.
Located in the examples folder:
concepts/basic/BasicAssert.javaconcepts/parallel/block-par.pvl-
demo/demo1.pvl,demo/demo2.pvl
Additional examples are available in the wiki/tutorial.
Tutorial
- Introduction
- Installing and Running VerCors
- Prototypal Verification Language
- Specification Syntax
- Permissions
- Termination
- Axiomatic Data Types
- Arrays and Pointers
- Parallel Blocks
- GPGPU Verification
- Atomics and Locks
- Predicates
- Inheritance
- Exceptions & Goto
- VeyMont
- Platform-Dependent Verification
- Advanced Concepts
- Help My Verification Fails
- Proof Brittleness and Countermeasures
- Unsupported Features
- Annex
- Case Studies
Developing for VerCors