Kananaskis-12
Release notes for HOL4, Kananaskis-12
(Released: 20 June 2018)
We are pleased to announce the Kananaskis-12 release of HOL 4.
We would like to dedicate this release to the memory of Mike Gordon (1948–2017), HOL’s first developer and the leader of the research group to which many of us were attached at various stages of our careers.
The official download tarball for this release is available from Sourceforge, with shasum
equal to 8d4754f11411c15501a23c218c0fe5561607de6c
, or attached below.
Contents
New features:
-
Holmake
under Poly/ML (i.e., for the moment only Unix-like systems (including OSX/MacOS, and Windows with Cygwin or the Linux subsystem)) now runs build scripts concurrently when targets do not depend on each other.
The degree of parallelisation depends on the-j
flag, and is set to 4 by default.
Output from the build processes is logged into a.hollogs
sub-directory rather than interleaved randomly to standard out. -
Theory files generated from script files now load faster.
The machinery enabling this generatesxTheory.dat
files alongsidexTheory.sig
andxTheory.sml
files.
Thanks to Thibault Gauthier for the work implementing this. -
We now support monadic syntax with a
do
-notation inspired by Haskell’s.
For example, themapM
function might be defined:Define‘(mapM f [] = return []) ∧ (mapM f (x::xs) = do y <- f x; ys <- mapM f xs; return (y::ys); od)’;
The HOL type system cannot support this definition in its full polymorphic generality.
In particular, the above definition will actually be made with respect to a specific monad instance (list, option, state, reader, etc).
There are API entry-points for declaring and enabling monads in themonadsyntax
module.
For more details see the DESCRIPTION manual. -
Users can define their own colours for printing types, and free and bound variables when printing to ANSI terminals by using the
PPBackEnd.ansi_terminal
backend.
(The default behaviour on what is called thevt100_terminal
is to have free variables blue, bound variables green, type variables purple and type operators “blue-green”.)
Thanks to Adam Nelson for this feature.
Configuring colours underemacs
is done withinemacs
by configuring faces such ashol-bound-variable
. -
We now support the infix
$
notation for function application from Haskell.
For examplef $ g x $ h y
is a low-parenthesis way of writing
f (g x (h y))
.
The dollar-operator is a low-precedence (tighter than infix,
but looser than other standard operators), right-associative infix.
This is a “parse-only technology”; the pretty-printer will always use the “traditional” syntax with parentheses as necessary and what might be viewed as an invisible infix application operator.
Bugs fixed:
-
Pretty-printing of record type declarations to TeX now works even if there are multiple types with the same name (necessarily from different theory segments) in the overall theory.
-
Pretty-printing has changed to better mesh with Poly/ML’s native printing, meaning that HOL values embedded in other values (e.g., lists, records) should print better.
New theories:
- We have promoted the theories of cardinality results for various flavours of infinite sets, and of ordinal numbers to
src
fromexamples
.
There is a minor backwards-incompatibility: references toexamples/set-theory/hol_sets
(in HolmakefileINCLUDES
specifications for example) should simply be deleted.
Any theory can build on these theories (cardinalTheory
,ordinalTheory
) simply byopen
-ing them in the relevant script file.
New tools:
-
For every algebraic type, the
TypeBase
now automatically proves what we term “case-equality” rewrite theorems that have LHSes of the form((case x of con1_pattern => e1 | con2_pattern => e2 ...) = v)
For example, the case-equality theorem for the
α option
type is(option_CASE opt nc sc = v) ⇔ (opt = NONE) ∧ (nc = v) ∨ ∃x. (opt = SOME x) ∧ (sc x = v)
where
option_CASE opt nc sc
is the general form of the term that underlies a case expression over an option valueopt
.These theorems can be powerful aids in simplifications (imagine for example that
v
isT
andnc
isF
), so we have made it easy to include them in arguments tosimp
,fs
,rw
etc.
TheCaseEq
function takes a string and returns the corresponding theorem, so thatCaseEq "option"
will return the theorem above.
TheCaseEqs
function takes a list of strings so that the simplifier-argument list doesn’t need to repeatCaseEq
invocations, and finally,AllCaseEqs()
returns a conjunction of all theTypeBase
’s case-equality theorems.
Then one might write something likesimp[AllCaseEqs(), thm1, thm2]
for example.
New examples:
-
We have resurrected Monica Nesi’s CCS example (from the days of HOL88, in
examples/CCS
), ported and extended by Chun Tian (based on HOL4’s co-induction packageHol_coreln
).
This includes all classical results of strong/weak bisimilarities and observation congruence, the theory of congruence for CCS, several versions of “bisimulation up to”, “coarsest congruence contained in weak bisimilarity”, and “unique solution of equations” theorems, mainly from Robin Milner’s book, and Davide Sangiorgi’s “unique solutions of contractions” theorem published in 2017.
There’s also a decision procedure written in SML for computing CCS transitions with the result automatically proved. -
Speaking of HOL88, we have also recovered an old hardware example.
This work is the verification of a version of a “toy microprocessor” that came to be called Tamarack (see Section 5 of the HOL history paper).
First done in a system calledLCF_LSM
by Mike Gordon (around 1983), this was then redone in HOL88 by Jeff Joyce in 1989, and these sources are now ported and available underexamples/hardware
.
Thanks to Larry Paulson for finding the HOL88 originals, and to Ramana Kumar and Thomas Tuerk for doing the work porting these to HOL4. -
A theory of the basic syntax and semantics of Linear Temporal Logic formulas, along with a verified translation of such formulas into Generalised Büchi Automata via alternating automata (in
examples/logic/ltl
).
This work is by Simon Jantsch. -
A theory of Lambek calculus (categorial grammars of natural or formal languages), in
examples/formal-languages/lambek
. Ported from Coq contribs by Chun Tian. c.f. "The Logic of Categorial Grammars" by Richard Moot and Christian Retoré. -
A library for regular expressions (
examples/formal-languages/regular
), including a compiler from regexps to table-driven DFAs. Proofs include standard regexp identities along with the correctness of the compiler. Also, there is a standalone toolregexp2dfa
that generates DFAs in a variety of languages. The library also supplies (informal and formal) parsers for regexps in Python syntax. See the README for more details.
Incompatibilities:
-
We have decided that the behaviour of
irule
(akaIRULE_TAC
) should not include the finishingrpt conj_tac
.
If users want that after the implicational theorem has been matched against, it is easy enough to add.
See the Github issue. -
The behaviour of the
by
andsuffices_by
tactics has changed.
Previously, a tactic of the form`term quotation` by tac
allowedtac
to fail to prove the sub-goal of the term quotation.
(The result would then be two or more sub-goals, where the first few of these correspond to the state of trying to prove the term quotation after applyingtac
.)
This is no longer the case: iftac
does not prove the new sub-goal then the overall tactic fails.The old implementation of
by
is available under the nameBasicProvers.byA
, so it is possible to revert to the old behaviour with the following declaration at the head of one’s script file:val op by = BasicProvers.byA
If one wanted to fix possibly broken occurrences to use the new semantics, the following Perl script might be helpful (it was used to adjust the core HOL sources):
$/ = "\n\n"; while (<>) { s/(`[^`]+`)(\s*)by(\s*)(ALL_TAC|all_tac)(\s*)(>-|THEN1)/\1 by/g; s/(Tactical\.)?REVERSE(\s*)\((`[^`]+`)(\s*)by(\s*)(ALL_TAC|all_tac)(\s*)\)(\s*)(THEN1|>-)(\s*)\(/\3 suffices_by\8(STRIP_TAC THEN /g; s/(Tactical\.)?REVERSE(\s*)\((`[^`]+`)(\s*)by(\s*)(ALL_TAC|all_tac)(\s*)\)(\s*)(THEN1|>-)(\s*)/\3 suffices_by /g; s/(`[^`]+`)(\s*)by(\s*)(ALL_TAC|all_tac)(\s*)/sg \1\5/g; print; }
If the above is called
byfix.pl
(for example), then a reasonable invocation would beperl -i byfix.pl *Script.sml
If one’s workflow was to write things like
`subgoal` by ALL_TAC THEN1 (tac1 THEN tac2 THEN ...)
and the same workflow makes
`subgoal` by (tac1 THEN tac2 THEN ...)
difficult (perhaps because the flow calls for cutting and pasting the
... by ALL_TAC
sub-string), we recommendsg `subgoal` THEN1 (tac1 THEN tac2 THEN ...)
where
sg `subgoal`
has the same effect as the old`subgoal` by ALL_TAC
. -
The type of the “system printer” used by user-defined pretty-printers to pass control back to the default printer has changed.
This function now gets passed an additional parameter corresponding to whether or not the default printer should treat the term to be printed as if it were in a binding position or not.
(Thisbinderp
parameter is in addition to the parameters indicating the “depth” of the printing, and the precedence gravities.)
See the REFERENCE manual for more details. -
The
PAT_ASSUM
tactics (Tactical.PAT_ASSUM
,Q.PAT_ASSUM
andbossLib.qpat_assum
) have all been renamed to pick up an internal_X_
(or_x_
).
Thus, the first becomesPAT_X_ASSUM
, and the last becomesqpat_x_assum
).
This makes the names consistent with other theorem-tactics (e.g.,first_x_assum
): theX
(orx
) indicates that the matching assumption is removed from the assumption list.
Using the old names, we also now have versions that don’t remove the theorems from the assumption list.The behaviour of the quoting versions of the tactics is also slightly different: they will always respect names that occur both in the pattern and in the goal.
Again, this is for consistency with similar functions such asqspec_then
.
This means, for example, thatqpat_assum `a < b`
will fail if the actual theorem being matched is somethingc < f a
.
(This is because the pattern and the goal share the namea
, so that the pattern is implicitly requiring the first argument to<
to be exactlya
, which is not the case.)
This example would have previously worked if there was exactly one assumption with<
.
The fix in cases like this is to use more underscores in one’s patterns. -
The functions
Parse.Unicode.uoverload_on
andParse.Unicode.uset_fixity
have been removed because their functionality should be accessed via the standardoverload_on
andset_fixity
functions.
The “temporary” versions of these functions (e.g.,Parse.Unicode.temp_uoverload_on
) have also been removed, analogously.
TheParse.Unicode.unicode_version
function remains, as does its temporary counterpart. -
The simpset fragment
MOD_ss
has been added to the standard stateful simpset.
This fragment does smart things with terms involving (natural number)MOD
, allowing, for example, something like((7 + y) * 100 + 5 * (z MOD 6)) MOD 6
to simplify to((1 + y) * 4 + 5 * z) MOD 6
.
If this breaks existing proofs in a script file, the fragment can be removed (for the rest of the execution of the script) with the commandval _ = diminish_srw_ss ["MOD_ss"]
-
The rewrites
listTheory.TAKE_def
andlistTheory.DROP_def
have been removed from the standard stateful simpset.
These rewrites introduce conditional expressions that are often painful to work with.
Other more specific rewrites have been added to the simpset in their place.
If the old behaviour is desired in a script file, the following will restore itval _ = augment_srw_ss [rewrites [listTheory.DROP_def, listTheory.TAKE_def]]
-
The rewrite that takes
LENGTH l = 0
tol = []
(as well as that which does the same thing to0 = LENGTH l
) is now an automatic simplification insrw_ss
. -
The command-line options to the
build
tool have changed in some of their details.
The standard usage by most users, which is to simply typebuild
with no options at all, behaves as it did previously.
For details on the options that are now handled, see the output ofbuild -h
. -
The associativity and precedence level of the finite-map composition operators (of which there are three:
f_o_f
,f_o
ando_f
) have been changed to match that of normal function composition (infixo
, or∘
), which is a right-associative infix at precedence level 800.
This level is tighter than exponentiation, multiplication and addition.
This also matches the syntactic details for relation composition (which is writtenO
, or∘ᵣ
).
If this causes problems within a script file, the old behaviour can be restored with, for example:val _ = set_fixity "o_f" (Infixl 500)
This call will change the grammar used in all descendant theories as well; if the change is wanted only for the current script, use
temp_set_fixity
instead. -
The tactic
ID_EX_TAC
has been moved from moduleQ
toTactic
. -
The tactic
Q.GENL
now processes its list of arguments (corresponding to variable names) in the same way asGENL
.
If one writesQ.GENL [`a`, `b`, `c`] th
, the result will be a theorem with conclusion!a b c. <concl-of-th>
, rather than!c b a. <concl-of-th>
. -
The constant
words$word_sdiv
has been renamed towords$word_quot
andwords$word_srem
has been renamed towords$word_rem
.
The constantwords$word_smod
has been moved tointeger_word$word_smod
and has been given a simpler definition. (There is also a new constantinteger_word$word_sdiv
whose definition differs from the oldwords$word_sdiv
.) -
The
--
function for doing term-parsing (typically written as, e.g.,(--`p /\ q`--)
) has been removed so that the--
name can be used as an infix set-difference operator.
We have long preferred eitherTerm`p /\ q`
, or``p /\ q``
, or“p /\ q”
for invoking the term-parser.