Skip to content

An abstract-interpretation-based static analysis for inferring refinement types

License

Notifications You must be signed in to change notification settings

nyu-acsys/drift

Repository files navigation

The ev-Drift Verifier

This tool uses a type-and-effect system and abstract interpretation to infer symbolic accumulation automaton (SAA) properties of higher order programs.

An example program can be seen in tests/effects/overview.ml

An example SAA property can be seen in tests/effects/overview.yml.prp

In addition, one can use our tuple-based product translation to transform these two inputs into an effectless program with assertions, and use the Drift tool (POPL 2020). This can be done by suppling -ev-trans true as a commandline argument (see details below).

Installation Requirements

Please use opam install to install the following opam libraries:

  • menhir, version >= 20230608
  • conf-ppl, version >= 1
  • apron, version >= 0.9.14
  • dune, version >= 3.15.3

Please execute the following commands in a terminal to satisfy these requirements. We here assume an Ubuntu/Debian system but the setup for other Linux distributions and Mac OS will be very similar. The first line can be omitted if you are working from an existing opam OCaml switch >= 4.06:

opam switch create 4.11.1
opam install menhir
opam install dune
sudo apt-get install libppl-dev
opam install conf-ppl
sudo apt-get install libmpfr-dev
opam install apron
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPAM_SWITCH_PREFIX/share/apron/lib

Compilation Instructions

To produce the native code executable file, run:

dune build

Usage

To test the analysis, run for example:

./drift.exe -file tests/effects/depend.ml -prop tests/effects/depend.yml.prp -out 2

or

./drift.exe -file tests/effects/depend.ml -prop tests/effects/depend.yml.prp -domain Polka_ls -thold true -out 2

Options

usage: ./drift.exe [-file <file name>] [-domain <domain name>] [-thold <true/false>] [-delay-wid <num>] [-nar <true/false>] [-prop <file name>] [-ev-trans <true/false>] [-cps-convert <true/false>] [-out <num>] [-debug] [-bt]
  -file : Input file specification
  -domain : Abstract domain specification (Oct, Polka_st, Polka_ls, PolkaGrid)
  -thold : Use threshold widening
  -delay-wid : Set number of delay widening steps (depricated)
  -nar : Use narrowing procedure (depricated)
  -out : Output result level

         0: Output map after each step

         1: Output map only for the last step

         2: Output the result only
  -debug : Debug mode
  -profile : Profiling output
  -bt : Allow trace back
  -prop : Automata specification of safety property for effect analysis
  -ev-trans Translate Ev expressions
  -trace-len : Set maximum allowed trace length. 0 -> not context sensitive
  -if-part : Partition traces on if tokens
  -cps-convert : Convert prog to CPS
  -help  Display this list of options
  --help  Display this list of options

Guides for Running Experiments

The sources can be found in tests/effects/*.ml, along with properties in tests/effects/*.yml.prp. Unsafe versions of the benchmarks are found in tests/effects/unsafe/*.ml.

The scripts to generate Drift-(with tuple translation) and evDrift results for tables 1 and table 2 are as follows:

  1. Reproduce Table 1 (including the Drift+Translation and evDrift columns):
sh generate_table1
  1. Reproduce Table 2
sh generate_table2
  1. Run evDrift on the /unsafe/ versions of the programs:
sh runall_unsafe