The recommended tools for verifying HOLTrace files
are holtrace_restore and its variants.
You can also compile holtrace_restore for extra speed.
There are also some experimental tools,
examples of traces,
and examples of timings.
holtrace_restore is a command available in a new HOL Light session
after HOLTrace is installed.
Running
holtrace_restore !theorems "holtrace-12345.50";;
will read and verify a trace file holtrace-12345.50.
Verification checks the following:
- The HOL Light kernel accepts the types, terms, and inferences in the trace.
- The resulting theorems match the theorem statements in the trace.
- If any name in the trace matches a name
listed in
!theoremsthen the theorem by that name in the trace matches the theorem by that name listed in!theorems. - Axioms in the trace are already in the kernel's
axioms()list. - Constant definitions in the trace
are already in the kernel's
definitions()list. Beware that new versions of HOL Light often make superficial changes to constant definitions, so traces using the old definitions will be rejected. - Type definitions in the trace
are already in the
holtrace_typedef_thms()list.
The holtrace_typedef_thms() list is not in the kernel;
it is a separate list maintained by HOLTrace,
whether or not traces are being
saved in this session.
The !theorems list is also outside the kernel but is built into HOL Light.
Verification remembers named theorems from the trace
(whether or not those are listed in !theorems),
and you can inspect those theorems:
holtrace_restore_name2thm "ONE_OR_PRIME";;
The theorems are erased by the next holtrace_restore run.
Variants
There is a holtrace_restore_allownew variant
that will instead add any new axioms,
add any new constant definitions (failing if the constant name is used already),
and add any new type definitions (again failing on collisions).
With more work to add bindings for new names and any related syntax,
it should be possible to use holtrace_restore and holtrace_restore_allownew
to build a faster replacement for the normal loading of hol.ml
or of other HOL Light libraries.
There is also an even faster variant holtrace_restore_skipthmchecks
that should be suitable in this context:
this variant skips checking whether the theorems
match the theorem statements in the trace,
but still runs all of the same inferences through the HOL Light kernel.
Compilation
The following steps produce a self-contained restore binary
that, given the name of a trace file,
prints out the results of loading HOL Light and running holtrace_restore_allownew [] on that trace.
The filename is specified by the HOLTRACE_RESTORE environment variable.
This binary is still using the HOL Light kernel,
but with the OCaml compiler instead of the OCaml interpreter.
First, after HOLTrace's ./install,
modify the HOL Light installation to include a compiled HOL Light module:
( cd `hol.sh -dir`; HOLLIGHT_USE_MODULE=1 make )
Second, in another directory,
create a file restore.ml with the following lines:
open Hol_lib;;
open Hol_loader;;
holtrace_restore_allownew [] (try Sys.getenv "HOLTRACE_RESTORE" with Not_found -> "restore.50");;
Third, compile restore.ml into restore:
ocamlfind ocamlopt -package zarith \
-linkpkg -pp "`hol.sh -pp`" -I `hol.sh -dir` \
bignum.cmx hol_loader.cmx hol_lib.cmx \
restore.ml -o restore
Example of using restore:
wget https://holtrace.cr.yp.to/hull_light.50.zst
unzstd hull_light.50.zst
env HOLTRACE_RESTORE=hull_light.50 ./restore > hull_light.restore
You can then check the theorems printed in hull_light.restore,
such as the following, an example of a theorem proven via a large computation:
thm endtoend_simple concise:
|- forall i f g M m.
i 0 = &0
==> &0 < M
==> &0 <= g 0
==> g 0 <= f 0
==> f 0 <= M
==> (forall n.
i (n + 1) = &1 + i n /\
f (n + 1) = f n /\
g (n + 1) = g n / &2 \/
(if i n < &0
then i (n + 1) = &1 + i n /\
f (n + 1) = f n /\
g (n + 1) = (g n + f n) / &2
else i (n + 1) = --i n /\
f (n + 1) = g n /\
g (n + 1) = (g n - f n) / &2))
==> (forall n. integer (f n))
==> (forall n. integer (g n))
==> M * divsteps_s pow m <= &8388391 / &8388608
==> (exists n. n <= m /\ g n = &0)
The meaning of this theorem depends on earlier definitions listed in hull_light.restore,
including
constant divsteps_s concise:
|- divsteps_s = &30902639 / &41749730
and various standard definitions and axioms.
Experimental tools
This package includes two experimental command-line tools for verifying traces.
First,
holtrace-verify-simple tries to verify traces
in essentially the same way that the HOL Light kernel does.
Beware that this tool is likely to have soundness bugs
that let it accept false theorems:
the tool has had vastly less review than the HOL Light kernel.
Second,
holtrace-verify tries to verify traces
and is more efficient than the HOL Light kernel.
Beware that this tool is even more likely than holtrace-verify-simple
to have soundness bugs
that let it accept false theorems:
the tool has had vastly less review than the HOL Light kernel
and is more complicated than holtrace-verify-simple.
Furthermore, unlike holtrace-verify-simple,
this tool currently does not check whether a name refers to multiple theorems.
holtrace-verify is written in C
and is not necessarily safe to run on untrusted input.
A VM is recommended.
holtrace-verify-simple is written in Python.
Outside this package,
https://github.com/hol-light-family/HolLean
includes a HOLTrace reader.
To check a trace file hol_lib.50 on a system with elan installed,
run lake exe holtrace hol_lib.50
in the HolLean directory;
the first run will automatically build HolLean.
Examples of traces
The following pruned traces are hosted on https://holtrace.cr.yp.to:
-
prime.50.zst, 555702 bytes: a trace of a formal proof ofONE_OR_PRIME(obtained by pruninghol_lib.50.zstdown toONE_OR_PRIME). -
hol_lib.50.zst, 7281233 bytes: a trace of the HOL Light 3.1.0 standard library. -
jordan.50.zst, 18927119 bytes: a trace of a formal proof of the Jordan-curve theorem (contributed to the HOL Light library by Thomas C. Hales, formalizing a proof from Camille Jordan). -
hull_light.50.zst, 25235838 bytes: a trace of a formal proof of 2.3040 divstep convergence (contributed to the HOL Light library by Daniel J. Bernstein; part of the safegcd2 paper). -
fta.50.zst, 53320776 bytes: a trace of a formal proof of the Fundamental Theorem of Algebra (obtained by pruningmulti.50.zstdown toFTA). -
multi.50.zst, 154591580 bytes: a trace of a run ofMultivariate(from the HOL Light library). -
navierstokes.50.zst, 273230636 bytes: a trace of a formal proof of finite-time blowup for forced Navier–Stokes (from https://github.com/hol-light-family/Navier_Stokes, formalizing a proof from OpenAI, adapting an approach of Diego Córdoba and Luis Martínez Zoroa). -
poincare.50.zst, 970814720 bytes: a trace of a formal proof of the Poincare conjecture (from https://github.com/hol-light-family/poincare, formalizing a proof from Grigori Perelman, generalizing an approach of Richard S. Hamilton). Could prune this further; currently it includes all ofMultivariate.
Examples of timings
These timings are single measurements on rome1.
The time for unzstd to decompress zst files is negligible
(e.g., under 20 seconds to decompress poincare.50.zst)
and is not included below.
For prime.50:
-
holtrace-verify:0.07user 0.03system 0:00.10elapsed 99%CPU (0avgtext+0avgdata 14336maxresident)k -
holtrace-verify-simple:4.37user 0.09system 0:04.47elapsed 99%CPU (0avgtext+0avgdata 114800maxresident)k -
restore(using HOL Light 3.1.0):23.84user 0.11system 0:23.99elapsed 99%CPU (0avgtext+0avgdata 58752maxresident)k. (This is almost entirely the HOL Light startup time. Separate measurement of the startup time on an empty trace:22.58user 0.11system 0:22.72elapsed 99%CPU (0avgtext+0avgdata 44448maxresident)k.)
For hol_lib.50:
-
holtrace-verify:1.33user 0.15system 0:01.48elapsed 99%CPU (0avgtext+0avgdata 254836maxresident)k -
HolLean (
lake exe holtrace hol_lib.50):9.41user 1.86system 0:11.28elapsed 99%CPU (0avgtext+0avgdata 839328maxresident)k -
holtrace_restore_skipthmchecksinsidehol.shafter./install: 28 seconds -
holtrace_restore_skipthmchecksinsidehol.shafter./install+hashtt: 33 seconds -
holtrace-verify-simple:40.73user 0.59system 0:41.34elapsed 99%CPU (0avgtext+0avgdata 647220maxresident)k -
holtrace_restoreinsidehol.shafter./install: 54 seconds -
holtrace_restoreinsidehol.shafter./install+hashtt: 65 seconds
For hull_light.50:
-
holtrace-verify:7.81user 0.64system 0:08.63elapsed 97%CPU (0avgtext+0avgdata 1598116maxresident)k -
HolLean (
lake exe holtrace hull_light.50):51.95user 4.61system 0:56.59elapsed 99%CPU (0avgtext+0avgdata 2102360maxresident)k -
restore(using HOL Light 3.1.0):583.47user 2.11system 9:45.86elapsed 99%CPU (0avgtext+0avgdata 2443232maxresident)k -
holtrace-verify-simple:1561.75user 7.33system 26:09.99elapsed 99%CPU (0avgtext+0avgdata 6879364maxresident)k
For poincare.50:
-
holtrace-verify:204.97user 12.28system 3:44.94elapsed 96%CPU (0avgtext+0avgdata 42611268maxresident)k -
restore(using HOL Light e5236a5839b4d08dc2536b325cea0af855e6c379 from 20261110): 7.6 hours, 53GB RAM
Version: This is version 2026.11.22 of the "Verify" web page.