Commit 9dcf1970 by Paul Wild



Logical Relations in Coq

This project is an extension of the development in the ModuRes tutorial, mostly following the exercises set at the end of chapter 3 (Fmu.v). Present in this project are three logical relations:

the exercises set at the end of chapter 3 (Fmu.v). The code from the project can be found inside the project/ directory, the other directories have been taken from the ModuRes tutorial archive as-is*. The file ModuResREADME.org contains the readme from that archive.

*: Two lemmas were added in the file dblib/Environments.v: subst_insert and lookup_lift.

Present in this project are three logical relations:

• The first LR is an extension of the unary LR for type safety given in the tutorial,
• The first LR is an extension of the unary LR for type safety given in the tutorial, where unit, sum and existential types have been added, thus providing a solution for the first two exercises. This LR can be found in the subdirectory Unary.

• The second LR is binary and sound with respect to contextual approximation, and is built for the same language. the first two exercises. For ease of reading, the documentation from the tutorial has been kept, and new comments have been added wherever changes were made. To differentiate between the two, all the text from the tutorial has been set in italics. This LR can be found in the subdirectory project/Unary/.

• The second LR is a binary LR that is sound with respect to contextual approximation, and is built for the same language. The main source for this and the next part is "Birkedal, Dreyer, Ahmed. Logical Step Indexed Logical Relations" (LSLR). The soundness proof is provided and the LR is then used to prove two examples of approximation: one involving two implementations of an abstract queue data type of approximation, one involving two implementations of an abstract queue data type (file Queues.v) as well as a simple parametricity result (file Parametricity.v) This LR and the examples can be found in the subdirectory Binary.

• The third LR is also a binary LR for contextual approximation but it is more "complete": This LR and the examples can be found in the subdirectory project/Binary/.

• The third LR is another binary LR for contextual approximation that is more "complete": syntactic types are included right in the definition of the LR. This makes it possible to prove, for example, that terms that are logically related at some type are actually of that type. This LR is then used to prove one of the examples from the LSLR paper (file SyntacticMinimalInvariance.v, all of this can be found in the subdirectory BinaryTyped.

• of that type, which then enables reasoning about their structure. This LR is first proven to be sound and then used to prove one of the examples from the LSLR paper (file SyntacticMinimalInvariance.v). All of this can be found in the subdirectory project/BinaryTyped/.

As all three LRs share the same language and many of the proofs have a similar structure, some definitions and tactics that are useful for all of them have been moved to the top level directory and are imported appropriately. The full dependency graph is provided in dependencies.png. The intended order of reading is in a depth-first, left-to-right order.

Common/ subdirectory and are imported appropriately. The full dependency graph can be seen below.

All files have Coqdoc documentation explaining the most important parts of the development. The intended way of reading through the files is in a depth-first, left-to-right order. The files Language.v, Lib.v and Tactics.v can be found in the Common/ subdirectory.

To build:

\$ (cd dblib && make)

Run the commands

\$ (cd dblib && make)
\$ (cd ModuRes && make)
\$ (cd project && make)

\$ (cd ModuRes && make)

The Coqdoc HTML files can be generated by running make html from the project/ directory and can then be found in project/html/.

\$ (cd project && make)

The code has been tested with Coq version 8.4pl5.

To run interactively:

To run the proof scripts interactively:

The project comes with a _CoqProject file that contains a list of all the necessary -R remappings. If you are using Proof General, it should autmatically apply them and -R remappings. If you are using Proof General, it should automatically apply them and you should be able to run through the scripts in interactive mode. If you are using CoqIDE, you have to change the project file options in Preferences > Project first to taken instead of arguments.

you have to first go to the project file options (Preferences > Project) and then select the option taken instead of arguments in the drop-down menu.