oadt

POPL22 artifact of Oblivious Algebraic Data Types

Introduction

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.

Review Instructions

Review online

This artifact can be reviewed fully online.

Virtual Machine

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,

  1. Download the oadt-popl22.ova file from Zenodo.
  2. Open VirtualBox and select menu File then Import Appliance.
  3. Choose the downloaded ova file to import.
  4. Adjust settings such as CPU cores and RAM. Note that compiling our Coq code requires more than 1.2 GB of RAM, not including RAM used by system and other applications, so we suggest allocate 4 GB of RAM.
  5. Import it and boot up the system.

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:

Build manually

Alternatively, you can build our project on your own machine following the next section.

Build Instructions

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

Dependencies

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:

File Structures

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✚.

Paper-to-artifact Correspondence

Definition/Theorems Paper File Name (link to CoqDoc)
Expression syntax Fig. 9 theories/lang_oadt/syntax.v expr
Global definitions Fig. 9 theories/lang_oadt/syntax.v gdef
Oblivious type values Fig. 9 theories/lang_oadt/syntax.v otval
Oblivious values Fig. 9 theories/lang_oadt/syntax.v oval
Values Fig. 9 theories/lang_oadt/syntax.v val
Small-step relation Fig. 10 theories/lang_oadt/semantics.v step
Evaluation context Fig. 10 theories/lang_oadt/semantics.v ectx
Auxiliary oblivious value typing relation Fig. 10 theories/lang_oadt/semantics.v ovalty
Kinds At the begining of Section 3.3 theories/lang_oadt/typing.v kind
Kinding rules Fig. 12 theories/lang_oadt/typing.v kinding
Typing rules Fig. 13 theories/lang_oadt/typing.v typing
Parallel reduction rules Fig. 14 theories/lang_oadt/typing.v pared
Global definition typing Fig. 15 theories/lang_oadt/typing.v gdef_typing
Theorem 3.1 (Progress) Section 3.4 theories/lang_oadt/progress.v progress, kinding_progress
Theorem 3.2 (Preservation) Section 3.4 theories/lang_oadt/preservation.v preservation, kinding_presevation
Lemma 3.3 (Preservation for parallel reduction) Section 3.4 theories/lang_oadt/preservation.v pared_preservation
Lemma 3.4 (Regularity) Section 3.4 theories/lang_oadt/preservation.v regularity
Lemma 3.5 (Confluence of parallel reduction) Section 3.4 theories/lang_oadt/equivalence.v pared_confluent
Definition 3.6 (indistinguishability) Section 3.4 theories/lang_oadt/syntax.v indistinguishable
Theorem 3.7 (Obliviousness) Section 3.4 theories/lang_oadt/metatheories.v obliviousness
Lemma 3.8 Section 3.4 theories/lang_oadt/obliviousness.v indistinguishable_obliv_val
Lemma 3.9 Section 3.4 theories/lang_oadt/obliviousness.v indistinguishable_val_obliv_type_equiv
Lemma 3.10 Section 3.4 theories/lang_oadt/obliviousness.v pared_equiv_obliv_preservation
Corollary 3.11 Section 3.4 theories/lang_oadt/metatheories.v obliviousness_open_obliv_val
Definition/Theorems Paper File Name (link to CoqDoc)
Expression syntax Fig. 16 theories/lang_oadt/syntax.v expr
Global definitions Fig. 16 theories/lang_oadt/syntax.v gdef
Leakage label Fig. 16 theories/lang_oadt/syntax.v llabel
Small-step relation Fig. 17 theories/lang_oadt/semantics.v step
Weak values Fig. 17 theories/lang_oadt/semantics.v wval
Evaluation context Fig. 17 theories/lang_oadt/semantics.v ectx
Leaky context Fig. 17 theories/lang_oadt/semantics.v lectx
Typing rules Fig. 18 theories/lang_oadt/typing.v typing
Kinding rules Fig. 19 theories/lang_oadt/typing.v kinding
Parallel reduction rules Fig. 20 theories/lang_oadt/typing.v pared
Theorem 4.1 (Progress) Section 4.4 theories/lang_oadt/progress.v progress, kinding_progress
Lemma 4.2 Section 4.4 theories/lang_oadt/progress.v progress_weak
Updated version of Lemma 3.10 Section 4.4 theories/lang_oadt/progress.v pared_equiv_obliv_preservation
Theorem 4.3 (Preservation) Section 4.4 theories/lang_oadt/preservation.v preservation, kinding_preservation
Theorem 4.4 (Obliviousness) Section 4.4 theories/lang_oadt/metatheories.v obliviousness
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

Differences Between Paper and Artifact

Notation differences

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:

Review the Build Logs

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

  1. Select the latest workflow.
  2. Select a job, e.g., build (8.13, 4.11-flambda).
  3. Expand the toggle 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: