Kananaskis-11
(Released: 3 March 2017)
We are pleased to announce the Kananaskis-11 release of HOL 4.
New features:
-
We have ported HOL Light’s
PAT_CONV
andPATH_CONV
“conversionals”, providing nice machinery for applying conversions to specific sub-terms. -
The tactic
PAT_ABBREV_TAC
(also available in theQ
module) can now use patterns that are more polymorphic than the sub-term in the goal that is ultimately matched. (Github issue) -
We have implemented the rule for constant specification described by Rob Arthan in HOL Constant Definition Done Right.
The new primitivegen_prim_specification
in the kernel is used to implement the new rule,gen_new_specification
, and is also used to re-implementnew_definition
andnew_specification
.
We removedprim_constant_definition
from the kernel, but keptprim_specification
because the new derivation ofnew_specification
uses pairs.
(Github pull-req) -
Various commands for moving over and selecting HOL tactics in the emacs mode have been improved.
We have also added a new commandhol-find-eval-next-tactic
(bound toM-h M-e
by default), which selects and highlights the next tactic in the source text, and then applies it to the current goal in the*HOL*
buffer.
This shortcuts the current idiom, which requires the tactic to be highlighted manually, and then applied viaM-h e
.
(The advantage of the latter is that one can select specific tactic sequences to be applied all at once.) -
Record updates can now be more polymorphic. For example, if one defined
Datatype`rcd = <| myset : α -> bool ; size : num |>`
one used to get back an update constant for the
myset
field:rcd_myset_fupd : ((α -> bool) -> (α -> bool)) -> α rcd -> α rcd
Now, the same constant is
rcd_myset_fupd : ((α -> bool) -> (β -> bool)) -> α rcd -> β rcd
One might use this to define
Define`img (f:α->β) r = r with myset updated_by IMAGE f`
This definition would have previously been rejected. (Github issue)
This change can cause incompatibilities.
If one wants the old behaviour, it should suffice to overload the record update syntax to use a more specific type.
For example:val _ = gen_remove_ovl_mapping (GrammarSpecials.recfupd_special ^ "myset") ``λf x. rcd_myset_fupd f x`` val _ = Parse.add_record_fupdate( "myset", Term.inst[beta |-> alpha] ``rcd_myset_fupd``);
-
PolyML “heaps” are now implemented with its
SaveState
technology, used hierarchically.
This should make heaps smaller as they now only save deltas over the last used heap.
Bugs fixed:
-
An embarrassing infinite loop bug in the integration of the integer decision procedures (the Omega test, Cooper’s algorithm) into the simplifier was fixed.
-
Theorems can now have names that are the same as SML constructor names (e.g.,
Empty
). (Github issue) -
Holmake
will now followINCLUDES
specifications fromHolmakefiles
when given “phony” targets to build on the command-line. (A typical phony target isall
.) As in the past, it will still act only locally if given just a clean target (clean
,cleanDeps
orcleanAll
). To clean recursively, you must also pass the-r
flag toHolmake
. (Github issue) -
We fixed three problems with
Datatype
. Thanks to Ramana Kumar for the reports.
First,Datatype
will no longer create a recursive type if the recursive instance is qualified with a theory name other than the current one.
In other words,Datatype`num = C1 num$num | C2`
won’t create a recursive type (assuming this is not called in theory
num
).
(Hol_datatype
had the same problem.)Second,
Datatype
will handle antiquotations in its input properly (Hol_datatype
already did).Third,
Datatype
(andHol_datatype
) allows the definition of identical record types in different theories. -
Attempts to define constants or types with invalid names are now caught much earlier.
An invalid name is one that contains “non-graphical” characters (as per SML’sChar.isGraph
) or parentheses.
This means that Unicode cannot be used in the kernel’s name for a constant, but certainly doesn’t prevent Unicode being used in overloaded notation.
Functions such asoverload_on
,add_rule
andset_mapped_fixity
can still be used to create pretty notation with as many Unicode characters included as desired. -
Loading theories under Poly/ML would fail unnecessarily if the current directory was unwritable.
Working in such directories will likely cause problems when and if anexport_theory
call is made, so there is a warning emitted in this situation, but theload
now succeeds.
Thanks to Narges Khakpour for the bug report. -
The function
thm_to_string
was creating ugly strings full of special codes (encoding type information) rather than using the “raw” backend. -
Bare record operations (e.g.,
rcdtype_field
, the function that accessesfield
of typercdtype
) would occasionally pretty-print badly. (Github issue)
New tools:
-
Holyhammer: A method for automatically finding relevant theorems for Metis.
Given a term, the procedure selects a large number of lemmas through different predictors such as KNN or Mepo.
These lemmas are given to the external provers E-prover (1.9), Vampire (2.6) or Z3 (4.0).
The necessary lemmas in the provers' proofs are then returned to the user.
Modifications to the kernels to track dependencies between theorems allow predictors to learn from the induced relation improving future predictions.
The build of the source directorysrc/holyhammer
needs ocaml (> 3.12.1) installed as well as a recent version of g++ that supports the C++11 standard.
The three ATPs have to be installed independently.
At least one of them should be present, preferably E-prover (1.9).Thanks to Thibault Gauthier for this tool.
-
A principle for making coinductive definitions,
Hol_coreln
.
The input syntax is the same as forHol_reln
, that is: a conjunction of introduction rules.
For example, if one is representing coalgebraic lists as a subset of the type:num → α option
, the coinductive predicate specifying the subset would be given asval (lrep_ok_rules, lrep_ok_coind, lrep_ok_cases) = Hol_coreln` lrep_ok (λn. NONE) ∧ ∀h t. lrep_ok t ⇒ lrep_ok (λn. if n = 0 then SOME h else t(n - 1)) `;
as is now done in
src/llist/llistScript.sml
.Thanks to Andrea Condoluci for this tool.
New examples:
-
A theory of balanced binary trees (
examples/balanced_bst
), based on Haskell code by Leijen and Palamarchuk, and mechanised by Scott Owens. The type supports operations such asinsert
,union
,delete
, filters and folds. Operations are parameterised by comparison operators for comparing keys. Balanced trees can themselves be compared. -
A formalisation of pattern matches (
examples/pattern_matches
).
Pattern matching is not directly supported by higher-order logic.
HOL4’s parser therefore compiles case-expressions (case x of ...
) to decision trees based on case constants.
For non-trivial case expressions, there is a big discrepancy between the user’s view and this internal representation.
Thepattern_matches
example defines a new general-purpose representation for case expressions that mirrors the input syntax in the internal representation closely.
Because of this close connection, the new representation is more intuitive and often much more compact.
Complicated parsers and pretty-printers are no longer required.
Proofs can more closely follow the user’s intentions, and code generators (like CakeML) can produce better code.
Moreover, the new representation is strictly more general than the currently used representation.
The new representation allows for guards, patterns with multiple occurrences of the same bound variable, unbound variables, arithmetic expressions in patterns, and more.
The example provides the definitions as well as tools to work with the new case-expressions.
These tools include support for evaluating and simplifying them, a highly configurable pattern compilation algorithm inside the logic, and optimisations like detecting redundant rows and eliminating them.
Incompatibilities:
-
The function
optionSyntax.dest_none
will now unwrap the type of its result, e.g., returning:α
rather than:α option
when applied toNONE : α option
. This brings it into line with the behaviour oflistSyntax.dest_nil
. See this github issue. -
The functions
Q.MATCH_RENAME_TAC
andQ.MATCH_ASSUM_RENAME_TAC
have been adjusted to lose their second arguments (the list of variable names that are not to be bound). For example, applyingQ.MATCH_RENAME_TAC `(f x = Pair c1 c2) ⇒ X` ["X"]
to the goal?- (f x = Pair C'' C0') ⇒ (f C'' = f C0')
used to result in the renamed goal
?- (f x = Pair c1 c2) ⇒ (f c1 = f c2)
where the
X
in the pattern was ignored.
The interface now achieves the same end by simply allowing the user to write underscores in the pattern.
Thus, the tactic would becomeQ.MATCH_RENAME_TAC `(f x = Pair c1 c2) ⇒ _`
.
Multiple underscores can be used to ignore multiple sub-terms.Of course, the
qmatch_rename_tac
andqmatch_assum_rename_tac
names for these tactics inbossLib
have changed types as well.
The newQ.MATCH_GOALSUB_RENAME_TAC
andQ.MATCH_ASMSUB_RENAME_TAC
(and their lower-case versions) have similar types, without explicit lists of variable names to ignore. -
The theory
state_option
was removed.
The better-developederrorStateMonad
theory should be used instead.