The opentheory tool processes OpenTheory packages, which contain 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.
There is an email list for OpenTheory users: you can subscribe and view the archives at http://www.gilith.com/mailman/listinfo/opentheory-users.
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 list
displays 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 files for package NAME-VERSION are stored in the subdirectory packages/NAME-VERSION of the package directory.
The best way to view the contents of a theory package NAME-VERSION is by opening the file
packages/NAME-VERSION/NAME-VERSION.html
in the package directory.
On the command line, executing
opentheory info --summary NAME-VERSION
prints a text summary of the theory package NAME-VERSION 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
main {
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: MIT
The article: directive in a theory file causes the opentheory tool to read in a file in article format—such files have extension .art.
start_logging ();;
logfile "THEORY";;
let THM = ...HOL Light proof of the theorem... ;;
export_thm THM;;
logfile_end ();;
stop_logging ();;
to generate a raw proof article file and an associated theory file:ocaml
#use "hol.ml";;
#use "NAME.ml";;
opentheory/articles/THEORY.art
opentheory/articles/THEORY.thy
Running this command will generate the OpenTheory proof article file THEORY.art.opentheory info --article -o THEORY.art opentheory/articles/THEORY.thy
Note: You can change the HOL Light name of the type operators and constants that you define in NAME.ml by adding lines to the opentheory/hol-light.int file.
Compile the theory package NAME-VERSION to the proof article file THEORY.art using the command:
opentheory info --article -o THEORY.art NAME-VERSION
Read the proof article file NAME.art into your theorem prover, using existing type operators, constants and theorems for the ones in the input-types, input-consts and assumptions sections of the article summary.
If your higher order logic theorem prover does not already have a reader for proof articles, you can contribute to the OpenTheory project by implementing one yourself! To do this you need to write an ML function that takes as input the article file name, and reads in the commands in the article file one by one, processing them exactly as described in the article 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.
