The opentheory tool processes OpenTheory packages, which contains statements and proofs of theorems in higher order logic. These packages are used to share proofs between the different theorem prover implementations of higher order logic, including HOL4, ProofPower/HOL and HOL Light. See the OpenTheory project home page for more details.
The most recent version of the opentheory tool can be downloaded from http://www.gilith.com/software/opentheory/.
The doc/notes.html file of the opentheory release contains a collection of links to tool documentation.
I strongly recommend using MLton (or Poly/ML) over Moscow ML to run opentheory, for reasons of speed (MLton is about 10 times faster than Moscow ML).
The command
opentheory listdisplays all installed packages.
By default, opentheory installs packages in the directory ~/.opentheory. It is possible to specify a different package directory using the global option -d, --root-dir DIR.
The command
opentheory compile --summary-text - ~/.opentheory/packages/NAME-VERSION/NAME.thycompiles a text summary of the theory package NAME-VERSION, and displays it on stdout.
The theory file NAME.thy, normally found inside a package directory NAME-VERSION, contains instructions for how to construct the theory exported by the package. This might be as simple as
theory { article "NAME.art"; }which says that the theory is constructed by reading the article file NAME.art, but more complex theories are possible that import and combine other theory packages.
Theory files also contain some meta-information about the package in the form of tags, for example:
name: bool
version: 1.0
description: Basic boolean theory
author: Joe Hurd <joe@gilith.com>
license: PublicDomain
The article command in a theory file instructs the opentheory tool to read in an article file, which is conventionally saved in a file with .art suffix.
First, prepare HOL Light for logging primitive inferences:
Once HOL Light has been prepared, the theory file NAME.ml can be converted to the proof article file NAME.art by the following steps:
start_logging ();;
logfile "foo";;
logfile_end ();;
stop_logging ();;
ocamlwill generate a raw proof article file called foo.art.
#use "hol.ml";;
#use "NAME.ml";;
opentheory compile --article NAME.art foo.thyRunning this command will generate the proof article file NAME.art.
There are two steps to this:
opentheory compile --article NAME.art ~/.opentheory/packages/NAME-VERSION/NAME.thy
If your higher order logic theorem prover does not already have a reader for proof articles, there are detailed instructions for implementing one in the file format standard. It might be useful to refer to the article reader implementation in the opentheory tool (although opentheory needs to keep track of more state to rename and compress articles), in particular the following files in the release:
This file is part of the self-test for opentheory. The file is run by Moscow ML, MLton and Poly/ML, generating the files mosml-result, mlton-result and polyml-result (respectively). These are compared to the expected result in the result.ok file, to check that all has gone well.