You need to set up an environment on your computer to solve Coq tasks. We recommend two alternatives:
Once you finish setting up Coq and necessary libraries, you will also need to setup an editor to be able to use Coq interactively. Check the corresponding section below.
In order to install Coq we will use opam
package manager.
You can find the installation instructions for opam
here.
Please note, that as of today opam
does not support Windows.
Initialize opam
by running the following command.
opam init -a
Create a new switch. Switches allow you to easily change the version of OCaml compiler toolchain used to build Coq. Switch creation process may take few minutes.
opam switch create semantics 4.12.0
opam switch set semantics
eval $(opam env)
Install Coq. In this course we will use Coq version 8.15.2.
You can tell opam
to fix this version using opam pin
command
(it means that opam
will not try to install more recent versions, even if they are available).
Coq installation may take few minutes.
opam remote add coq-released https://coq.inria.fr/opam/released
opam pin add coq 8.15.2
opam install coq
Install additional Coq libraries required by this course.
opam remote add coq-weakmemory-local -k git https://github.com/weakmemory/local-coq-opam-archive
opam install coq-hahn
Check that your environent is propery set up.
Download the course assignments repository.
In the root folder of course assignments run the make
command.
It should start proof-checking the file src/b1.v
and then fail with the message Tactic failure: tauto failed
.
For proof editing you may use any of the editors proposed in the corresponding section of this manual below.
Make sure you have correctly set up editor of your choice.
Try to open file src/b1.v
and proof-check it in the step-by-step mode (see below).
It should be checked successfully up until lemma nat_eq_tests_pass
. The latter should fail with the message mentioned above.
You can use the provided virtual machine with Ubuntu 22.04 OS. It already has Coq, required libraries and all the code editors installed.
Install VirtualBox (we recommend version 6.1), and Oracle VM VirtualBox Extension pack.
Import the downloaded .ova
file following the
instructions
in the official documentation.
vagrant
vagrant
make
command.
It should start proof-checking file src/b1.v
and then fail with the message Tactic failure: tauto failed
.Proofs in Coq are intended to be written interactively. To help with that, there exist IDEs and plugins listed below.
To check that you setted up an editor from the list correctly, open a *.v
file from the repo
and execute command “make a step” in the editor.
pkg-config
, libgtk-3-dev
, and libgtksourceview-3.0-dev
.
CoqIDE itself can be installed via opam
: opam install coqide
.->
in the toolbox.Alt-Down
(on Linux) and Ctrl-Option-Down
(on MacOS).C-c C-n
key combination by default.ttf-ancient-fonts
.<leader> c j
(<leader>
equals to \
by default).