Sources for "Verified Functional Programming of an Abstract Interpreter"
This git repository contains the source of the abstract interpreter presented in "Verified Functional Programming of an Abstract Interpreter".
Thanks to nix, our work is entierly reproducible, in no more than two lines of bash:
sh <(curl -L https://nixos.org/nix/install) --daemon
nix-build --attr all
Folder structure 📂
This repository is organized as following.
-
srccontains all the F* source code:-
src/corecontains the abstract interpreter itself, every definition presented in the paper lives in this directory; -
src/appcontains the command line frontend to the abstract interpreter; -
src/jscontains the sources of the web wrapper.
-
-
latexcontains LaTeX supplementary files, but the paper is written as F* comments directly in the modules available undersrc/code. -
testscontains a set of unit tests for the abstract interpreter.
Note: building the abstract interpreter triggers a build of F* and Z3 from scratch, which requires about 30 minutes on my machine.
How to build the abstract interpreter ⚙
1. Installing the Nix package manager
Install Nix on any Linux distribution, MacOS and Windows (via WSL) via the recommended multi-user installation:
sh <(curl -L https://nixos.org/nix/install) --daemon– Nix website
2. Build everything
The command nix-build --attr all creates the directory result with:
-
bin/analyser: the binary for the abstract interpretor (./analyser --helpexplain its usage); -
examples: the example programs,maketo run every test; -
paper.pdf,paper.tex: the paper; -
test-report.log: the log report for tests; -
typechecking.log: the output of F* typechecking the abstract interpreter.
Get a developpement environment 🧰
All the steps below require nix to be installed (sh <(curl -L https://nixos.org/nix/install) --daemon).
Ready-to-use, preconfigured Emacs
A single line of bash:
nix-shell --attr shellNix --run preconfigured-emacs
will open Emacs configured with the correct Z3 and F* binaries in
PATH, with fstar-mode
configured, and the important modules opened.
Pull the F* version we use
nix-shell --attr shellNix will drop you in a shell with the correct
fstar.exe in PATH.
Recompile the analyser
Just run again nix-build --attr analyser.
Try the analyser in your web browser 🌐
Hosted version
Just go to https://demo-abint.netlify.app/
Locally
Compile the analyser to JavaScript and run a server locally:
nix-shell --attr webapp-nix-shell --run httpserver
Then open http://localhost:8251/ in a web browser.
Other build recipies availables 💉
-
nix-build --attr analyser: builds the binary in./result/analyser; -
nix-build --attr js-analyser: builds the web application version of the analyser in./result/analyser; -
nix-build --attr fstar: builds the version we use of F* in./result/bin/fstar.exe; -
nix-build --attr latex -o paper.tex: builds the latex of the paper as./paper.tex; -
nix-build --attr ocaml: extract the abstract interpreter as OCaml code in./result/; -
nix-build --attr pdf -o paper.pdf: builds the PDF for the paper aspaper.pdf; -
nix-build --attr tests -o tests.log: run the tests; -
nix-build --attr typecheck -o typecheck.log: typecheck all the modules with F*.
Note on reproducability and on Nix ✨
Nix builds packages in isolation from each other. This ensures that they are reproducible and don't have undeclared dependencies, so if a package works on one machine, it will also work on another. – https://nixos.org/
Pointers on Nix
- https://nixos.org/
- https://www.tweag.io/blog/2020-06-18-software-heritage/
- https://serokell.io/blog/what-is-nix
Flakes
The abstract interpreter actually uses the recent Nix Flakes. If you happen to have flakes enabled on your machine, you can:
-
nix build .#any-of-the-targets-above; -
nix run .#emacs; -
nix run .#webapp.