Artifact for #78 =========================================================== The artifact submission consists of two files: 1. README.md (This file) 2. A Virtualbox appliance (artifact078.ova). The appliance runs a minimal Xubuntu 18.04 installation. Using the VM: ------------ To log in to the machine, use - username: artifact - password: artifact The artifact code is in `~/src/`. There are two subfolders: 1. `Mtac2`: A clone of [Mtac2/master](https://github.com/Mtac2/Mtac2) at commit `1f4e5a6cb272a000ceb4edc6ce9287925982d5d5` 2. `iris-3.1.0-mtac2`: A clone of [iris-coq/mtac2-tt](https://gitlab.mpi-sws.org/FP/iris-coq/tree/mtac2-tt) at commit `c5ffd28cc76706595accacaf4844315c5312df8e` (with two lines added to `_CoqProject`, see below.) To cleanly separate dependencies of the artifact from the artifact code, all dependencies of `Mtac2` and `iris-3.1.0` are pre-installed. While `Mtac2` is a dependency of `iris-3.1.0-mtac2`, we opted to not install it (as it is also part of the artifact code) but instead modify that project's `_Coqproject` file by adding two additional lines to let Coq know to look for Mtac2 in the sibling directory. ``` -Q ../Mtac2/theories Mtac2 -I ../Mtac2/src ``` Setup Without a VM ------------------ This setup assumes a recent, linux-based system. 1. Install opam v2.0beta2. 2. Add Coq' opam repository with `opam repo add coq-released https://coq.inria.fr/opam/released` 3. Execute: `opam install Coq8.7.1 coq-unicoq`. 4. Replace `${WORKINGDIR}` in all snippets below by a suitable (empty), existing directory. OR: set the variable via `export ${WORKINGDIR}="yourdirectory"` 5. Execute ``` git clone https://github.com/Mtac2/Mtac2 ${WORKINGDIR}/Mtac2; cd ${WORKINGDIR}/Mtac2; git reset --hard 1f4e5a6cb272a000ceb4edc6ce9287925982d5d5 ``` 6. Execute ``` git clone https://gitlab.mpi-sws.org/FP/iris-coq/tree/mtac2-tt ${WORKINGDIR}/iris-3.1.0-mtac2; cd ${WORKINGDIR}iris-3.1.0-mtac2; git reset --hard c5ffd28cc76706595accacaf4844315c5312df8e ``` 7. To configure Mtac2, execute `cd ${WORKINGDIR}/Mtac2; ./configure.sh` 8. To install all remaining dependencies of iris, perform the following steps: 1. `cd ${WORKINGDIR}/iris-3.1.0-mtac2` 2. Remove the dependency to the opam distribution of Mtac2 (currently outdated) by removing the line with `coq-mtac2` in file `opam`. 3. `make build-dep` **NOTE** The remaining instructions will assume that `${WORKINGDIR}` is set to `~/src`, to match the VM setup. Building the Code ----------------- 1. Build Mtac2 by executing the following commands in a shell: ``` cd ~/src/Mtac2 ./configure.sh make && make test ``` 2. Build iris-mtac2 by executing the following commands in a shell: ``` cd ~/src/iris-3.1.0-mtac2 make ``` These commands may print warnings and debug output but should not fail. If all commands succeed, the artifact was built successfully. Note: All invocations of `make` can be augmented with `-jN`, where N is the number of parallel jobs to be spawned. This number should match the number of CPU cores assigned to the Virtualbox appliance after importing it. For `iris-3.1.0-mtac2`, this will speed up the compilation quite significantly. The expected build times (with one make job and on semi-recent desktop computers) are: 1. `Mtac2` <2min 2. `iris-3.1.0-mtac2** <10min Exploring the Code ------------------ The code of Mtac2 is structured as follows: - Files in `theories/intf/` contain definitions that are (largely) shared between the OCaml interpreter and derived Mtac2 constructs. Notably, `theories/intf/M.v` contains the definition of the Mtac2 monad. - The remaining files in `theories/` contain derived constructs and some non-Mtac2-specific definitions such as a library for depedently-typed telescopes in `theories/Mtele.v`. - Finally, `src/` contains the OCaml interpreter (`run.ml`) and various helpers to interact with the Coq API. The directory structure of iris-3.1.0-mtac2 is explained in the accompanying `README.md** file in that directory. It is worth noting that all differences related to tactics in the Mtac2 version with respect to the original iris-3.1.0 are contained to the three following files: - theories/proofmode/tactics.v - theories/heap_lang/tactics.v - theories/heap_lang/proofmode.v The remaining differences are minor changes due to incompatible notations in Mtac2 and iris-3.1.0. The full list of changes can be seen by executing `cd ~/src/iris-3.1.0-mtac2; git diff iris-3.1.0`. **Mapping of Code in the Paper to Source Code** We list here the examples shown in the paper and their corresponding files and line numbers in the artifact code. Differences to the code presented in the paper are indicated, and, if necessary, explained further below. 1. Fig. 1: `Lemma tac_wp_pure` (type only, simplified[S1]) `iris-3.1.0-mtac2/theories/heap_lang/proofmode.v:25` 2. Fig. 1: `Tactic Notation "wp_pure" ..` (simplified[S1]) `iris-3.1.0-mtac2/theories/heap_lang/proofmode.v:159` (commented out) 3. Fig. 2: `Definition solve_tauto` (simplified[D1, P]) `Mtac2/tests/tauto.v:19` 4. Section 2, page 6: `bind, ret, <-, >>=` `Mtac2/theories/intf/M.v:25,22,358,372` (respectively) 5. Section 2, page 9: `nu, abs_fun, evar, is_evar` `Mtac2/theories/intf/M.v:72,87,323,148` (respectively) 6. Section 2, page 10: `Fixpoint lookup` `Mtac2/tests/tauto.v:12` 7. Section 2, page 10: `Example test_tauto` `Mtac2/tests/tauto.v:54` (written as an anonymous `Goal`) 8. Page 9: `Definition solve_tauto_mtac2` `Mtac2/tests/tauto.v:112` (called `solve_tauto`) 9. Fig. 3: `Inductive goal` `Mtac2/theories/intf/Goals.v:12` (simplified[S2,PT]) 10. Section 3.1: `Definition tactic` (simplified[Gt]) `Mtac2/theories/Tactics.v:38` 11. Fig. 4: `Definition open_and_apply` (simplified[Gt], 1 case elided) `Mtac2/theories/Tactics.v:200` 12. Section 3.3: `Definition bind` (simplified[Gt,GR]) `Mtac2/theories/Tactics.v:214` 13. Fig. 5: `Definition cintro` (simplified[Gt], `let` cases elided) `Mtac2/theories/Tactics.v:305` (called `intro_cont`) 14. Section 3.3: `Definition close_goals` (simplified[Gt]) `Mtac2/theories/Tactics.v:165` 15. Section 3.3: `Definition rem_hyp` (simplified[Gt,GR]) `Mtac2/theories/Tactics.v:175` 16. Fig. 6: `Definition solve_tauto_mtac2` `Mtac2/tests/tauto.v:112` (called `solve_tauto`) 17. Fig. 7: `Definition solve_tauto` (simplified[P]) `Mtac2/tests/tauto.v:145` 18. Section 4: definitions of `ttac, apply`: (simplified[Ls]) `Mtac2/theories/Ttactics.v:239,309` 19. Section 4: `Definition tspec` (simplified[GR]) `Mtac2/theories/Ttactics.v:287` (called `fappgl`) 20. Section 4: definitions `to_goal` and `demote` (simplified[PT]) `Mtac2/theories/Ttactics.v:244,259` 21. Section 4: definitions `use` and `by'` (simplified[GR]) `Mtac2/theories/Ttactics.v:262,273` 22. Fig. 9: `Ltac reshape_expr` (abridged[AE]) `iris-3.1.0-mtac2/theories/heap_lang/tactics.v:556` 23. Fig. 10: `Inductive ectx_item, Definition fill_item` (abridged[AE]) `iris-3.1.0-mtac2/theories/heap_lang/lang.v:238,262` (respectively) 25. Section 5.1: `Lemma tac_wp_value, Lemma tac_wp_expr_eval` `iris-3.1.0-mtac2/theories/heap_lang/proofmode.v:36,9` (respectively) 26. Fig. 11: `Definition wp_pure` (simplified[S1]) `iris-3.1.0-mtac2/theories/heap_lang/proofmode.v:126` 27. Fig. 12: `Definition TryNextDecomposition, Definition reshape_expr` (abridged[AE], simplified[DT]) `iris-3.1.0-mtac2/theories/heap_lang/tactics.v:506,507` (`reshape_expr` is called `reshape_expr_dep`) 28. Fig. 12: `Definition reshape_expr_wp` `iris-3.1.0-mtac2/theories/heap_lang/proofmode.v:78` 29. Section 5.3.2: definitions `wp_expr_eval` and `wp_value_head` `iris-3.1.0-mtac2/theories/heap_lang/proofmode.v:108,88` (simplified[DT]) 30. Fig. 13: `Inductive RedFlags, Inductive Reduction` `Mtac2/theories/intf/Reduction.v:15,21` (respectively; [Ls]) 31. Section 6.2: `Definition reduce` `Mtac2/theories/intf/Reduction.v:30` ([Ls]) 32. Section 6.4: `Inductive M` `Mtac2/theories/intf/M.v:18` (called `t`) 33. Section 6.4: `Definition fix1` `Mtac2/theories/intf/M.v:34` **Differences** | Difference Code | Explanation | |-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | S1 | For presentation purposes, the 3rd hypothesis of `tac_wp_pure` (`IntoLaters …`) has been omitted from the paper in all code | | AE | To reduce clutter, we omit most constructors of the `expr` type in all functions that inspect `expr` values and in the definition of the type itself. | | Ls | As discussed in the paper, re-using Coq's standard library `list` type can be dangerous due to universe issues. Whenever it is not important, we omit the difference between our (universe polymorphic) copy of `list` and Coq's `list`. Similar for the product type. | | P | Some of the definitions shown in the paper only typecheck in Coq's `Program` mode. We omit this to reduce visual clutter. | | D1 | The artifact code differs by containing an additional `in Prop` annotation for `mmatch`es on proposition. This helps Coq typecheck the code but does not influence the semantics. | | Gt | For reasons of abstraction, `tactic` is actually defined as a specialization of a more general `gtactic`. The definition shown in the paper is equivalent. | | GR | To reduce the OCaml code of Mtac2, the interpreter expects the list of goals returned by tactics to be reduced. This is done in the code of combinators. The code for this is elided in the paper. | | PT | Mtac2 has its own first-class Prop/Type polymorphism to distinguish, amongst other things, `goal`s of type Prop and `goal`s of type Type. We elide these constructs in the paper. | | S2 | For presentation purposes, we renamed the constructor `Goal` to be `Metavar` in the paper. We also elided the presentation of the `HypLet` construct, see Footnote 11. | | DT | The type of some of our tactics are more general than the one presented in the code, in order to facilitate code reuse. | How the VM was created ---------------------- The Virtualbox appliance was created using the following steps: 1. Create a new Virtualbox machine with a dynamically-sized virtual HDD with a maximal size of 20GB. 2. Install Xubuntu minimal core with the help of the 64-bit Ubuntu 18.04 Bionic Beaver mini.iso from [Ubuntu.com/community/InstallationMinimalCD](https://help.ubuntu.com/community/Installation/MinimalCD) (Use defaults for all questions during the interactive installer.) 3. Execute `sudo apt-get install opam m4` to install opam and OCaml (v4.05.0). 4. Initialize opam: `opam init`. 5. Run `eval ``opam config env``. 6. Upgrade to (a release candidate) of opam2 by executing `opam install opam-devel`. Follow opam's instructions to activate the new opam installation. 7. Add Coq' opam repository with `opam repo add coq-released https://coq.inria.fr/opam/released` 8. Execute `opam install coq.8.7.1 coq-unicoq coqide`. This step will fail with missing dependencies. Use `apt install` to fix and repeat the opam invocation. 9. ` git clone https://github.com/Mtac2/Mtac2 ~/src/Mtac2; cd ~/src/Mtac2; git reset --hard 1f4e5a6cb272a000ceb4edc6ce9287925982d5d5 ` 10. ` git clone https://gitlab.mpi-sws.org/FP/iris-coq.git ~/src/iris-3.1.0-mtac2; cd ~/src/iris-3.1.0-mtac2; git reset --hard c5ffd28cc76706595accacaf4844315c5312df8e ` 11. `cd ~/src/Mtac2; ./configure.sh` 12. `cd ~/src/iris-3.1.0-mtac2` 13. Remove the line `coq-mtac` from the `opam` file (e.g., with `nano opam`). 14. `make build-dep` 15. `make` 13. Finally, export the VM to `.ova` file.