This artifact holds the Coq formalization of Oblivious Algebraic Data Types, a language for writing secure computation with recursive data types whose structures are protected. More specifically, it formalizes the two core calculi from the paper, λOADT and λOADT✚, and proves their soundness and obliviousness.
The source code can be found on our Github repository. We use different branches to manage the two calucli: λOADT is on the branch pure, and λOADT✚ is on the branch tape. The generated CoqDoc can be found here.
The final versions of the formalization and a virtual machine image are also available on Zenodo:
The next section (Review Instructions) contains instructions on how to review our Coq development and check the mechanized proofs.
Section (Build Instructions) shows how to install the dependencies and build the project.
Section (Dependencies) explains the libraries and methodologies this artifact depends on and how we use them.
Section (File Structures) outlines how we organize the formalization by explaining the purpose of each file.
Section (Paper-to-artifact Correspondence) connects the definitions and theorems in the paper to the formalization in the artifact.
Section (Differences Between Paper and Artifact) discusses the minor discrepancies between our Coq formalization and the paper due to presentation reasons.
Section (Review the Build Logs) explains how to review the compilation output.
This artifact can be reviewed fully online.
We also provide a virtual machine (based on Debian 11 with Gnome desktop), available on Zenodo, so one can inspect our proofs interactively, with environment already set up. The virtual machine was tested in Oracle VirtualBox (6.1). To get started,
oadt-popl22.ova
file from Zenodo.File
then Import Appliance
.ova
file to import.You may need the login information to run sudo
command:
After launching the terminal (from the dock to the left, accessed by clicking
the top-left corner or pressing the Super
/Win
/Cmd
key), you can experiment
with our Coq development interactively:
# Check out λOADT
cd ~/oadt-pure
# Or check out λOADT✚
cd ~/oadt-tape
# Use CoqIDE
coqide theories/lang_oadt/metatheories.v
# Use Emacs
emacs theories/lang_oadt/metatheories.v
# Use VSCode
code theories/lang_oadt/metatheories.v
Emacs and VSCode are also accessible from the dock. The code is pre-compiled. To
build the project again, run make clean
first.
A few tips:
Settings
. Resolution options can be found under the Display
tab.Alternatively, you can build our project on your own machine following the next section.
Opam is needed to compile our Coq code. See opam’s documentation for install and setup instructions.
Once opam is set up, run the following commands:
# Create a fresh opam environment
opam switch create oadt-popl22 4.11.1+flambda
eval $(opam env)
opam repo add coq-released https://coq.inria.fr/opam/released
opam update
# Assume we are building it at home directory
cd ~
# Build λOADT
git clone -b pure https://github.com/ccyip/oadt.git oadt-pure
cd oadt-pure
opam install . --deps-only
make
cd ~
# Build λOADT✚
git clone -b tape https://github.com/ccyip/oadt.git oadt-tape
cd oadt-tape
opam install . --deps-only
make DEMO=1
If Ocaml 4.11.1 is not available on your system (e.g. certain macs), you may install 4.12.0 instead.
opam switch create oadt-popl22 --package=ocaml-variants.4.12.0+options,ocaml-option-flambda
Our formalization is tested against Coq 8.12 to Coq 8.13. We also rely on the following wonderful libraries:
Our formalization takes inspiration and ideas from the following work, though does not directly depend on them:
We list the files in the theories
directory and explain the purpose of each
file.
The following files appear in λOADT✚ and λOADT.
These files only appear in λOADT✚.
demo_prelude.v
, but for the integer
extensions.Definition | Paper | File | Name (link to CoqDoc) |
---|---|---|---|
Expression syntax | Fig. 21 | theories/demo/int.v | expr |
Typing rules | Fig. 21 | theories/demo/int.v | typing |
Small-step relation | Fig. 21 | theories/demo/int.v | step |
Example | Paper | File | CoqDoc |
---|---|---|---|
Oblivious trees | Fig. 3 | theories/demo/demo1.v | demo1 |
Section, retraction and oblivious lookup function | Fig. 3 | theories/demo/demo1.v | demo1 |
Oblivious list with the upper bound of its length | Section 4.6 | theories/demo/demo2.v | demo2 |
Oblivious tree with the upper bound of its depth | Section 4.6 | theories/demo/demo1.v | demo1 |
Oblivious tree with the upper bound of its spine | Section 4.6 | theories/demo/demo1.v | demo1 |
Oblivious tree with the upper bound of the number of its vertices | Section 4.6 | theories/demo/demo3.v | demo3 |
Example of the map function | Section 4.6 | theories/demo/demo4.v | demo4 |
theories/demo
) are encoded directly using de Bruijn
indices.We try to keep the notations used in Coq as consistent with the paper as possible, but there are still some differences. The major differences are:
\hat
s to distinguish
from the public counterparts, while in the formalization, they are prefixed by ~
,
e.g., ~case
for oblivious sum elimination.\hat
to decorate oblivious variables and oblivious values in the paper.
But in the formalization there is no visual “hint” for that. For example, v
is used
for both values and oblivious values. It should be obvious from the context though.The goal of reviewing the output of compilation is to confirm that Coq accepts our proofs, and the examples return correct results.
When reviewing online, one can find the compilation output by heading to the Github Action page (See Section (Review Instructions)). Then
Run coq-community/docker-coq-action@v1
, and then the
toggle Build project
.When reviewing with the provided virtual machine, run make clean
first and then run
make
(in the pure branch) or make DEMO=1
(in the tape branch).
What to look for:
Print Assumptions soundness
(the type safety theorem, a corollary
from preservation and progress) and Print Assumptions obliviousness
at the
end of file theories/lang_oadt/metatheories.v
to print out any axioms used
in these proofs. After compiling this file, it should output two Closed under
the global context
, showing that our proofs are axiom-free.demo1.v
and demo4.v
will print out the results of
running the sample programs, to test the small-step semantics. Check that
these results make sense.