GamePad is a Python library that exposes parts of the Coq ITP to enable machine learning.
We expose the proof trace obtained from Coq as Python data structures, including Coq’s mid-level and kernel-level term languages, proof states, proof steps, and proof trees so that they can be manipulated with arbitrary Python code.
The API provides a thin wrapper around coqtop, the Coq repl, which can be used to interactively construct proof scripts from within Python. This component mediates all interaction with Coq, including proof state parsing into GamePad’s representation of Coq proofs and sending tactic actions
For more infromation, check out the associated paper GamePad: A Learning Environment for Theorem Proving. For datasets, models and results from the paper, check out the Google drive folder
To cite this repository in publications:
@article{huang2018gamepad,
title={{GamePad: A Learning Environment for Theorem Proving}},
author={Daniel Huang and Prafulla Dhariwal and Dawn Song and Ilya Sutskever},
journal={arXiv preprint arXiv:1806.00608},
year={2018},
}
coq, mathcomp-1.6.1, and mathcomp-odd-order-1.6.1 come from different repos.
|- examples (example Coq tactic scripts and their corresponding traces)
|- gamepad (Python learning environment for Coq proofs)
|- ssreflect (patch for ssreflect)
|- tcoq ("Traced Coq", i.e., modified version of Coq; created by get_data.sh)
|- odd-order (Feit-Thompson Coq repo; created by get_data.sh)
|- math-comp (Ssreflect Coq repo; created by get_data.sh)
|- mllogs (hold ml logs, will be auto-generated)
There are three components to install and setup.
To obtain the auxilliary repositories, you can run ./get_data.sh
(this obtains tcoq
, math-comp
, and odd-order
).
opam
. You may need to run:
opam switch 4.05.0
opam install camlp4
opam install ocamlfind
./get_data.sh
.)
./setup_tcoq.sh
-j4
flag from ./build_tcoq.sh
so that the log files will be output in order.
./build_tcoq.sh
source build_config.sh
patch math-comp/mathcomp/ssreflect/plugin/v8.6/ssreflect.ml4 ssreflect/ssreflect.ml4.patch
./build_mathcomp.sh
tcoq
.
which coqc
./build_oddorder.sh
python chunk.py <path-to-odd-order-build.log> <output-directory>
We recommend having a top-level data
folder and setting <output-directory> = data/odd-order
. For example,
python chunk.py odd-order/mathcomp/odd_order/build.log ./data/odd-order
As a reminder, use Python3. Change to the GamePad directory cd gamepad
.
gamepad3
).
virtualenv -p python3 gamepad3
If you have virtualenv wrapper, you can use the command below instead.
mkvirtualenv --python=<path/to/local/python3> gamepad3
pip install -r requirements.txt
pip install -e .