Repository navigation
Make MESON faster - #216
Merged
Merged
Conversation
Speedups, with the search and its results unchanged (same inference counts
and same theorems):
- Polymorphic comparison is replaced in the inner loops by monomorphic
versions: lookups of instantiations, unification, the continuation cache
and the ancestor checks; equality of instantiations first checks for
physical equality, since they share long tails.
- The input clauses are kept in an array indexed by predicate code instead
of an association list, and the clauses within the size bound are taken
as a prefix of the already-sorted list.
- Duplicate clauses are removed by hashing instead of a quadratic number of
comparisons, and the variable/constant stores use hash tables for lookup.
The instantiations stay association lists: on the goals below they never
exceed 18 entries (about 3 are scanned per lookup), and a Map version was
about 33% slower and changed the search slightly.
On 5554 goals recorded from MESON calls in Library/card.ml, rstc.ml,
Multivariate/misc.ml, Library/{permutations,products,floor,prime,
pocklington}.ml and Examples/{inverse_bug_puzzle_tac,forster,mizar}.ml, the
time in PURE_MESON_TAC goes from 37.8s to 28.5s (1.33x).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aqjune-aws
marked this pull request as ready for review
November 25, 2026 13:23
Contributor
Author
fol_of_hol_clauses concatenated all contrapositives and then ran a non-tail-recursive fold over the flat list, so stack use grew with the total number of generated rules (overflowing on e.g. thousands of duplicate 24-literal disjunctions that the original code handled). Fold over the theorems and then over each theorem's rules instead, sharing one hash table. This keeps the same surviving rules in the same order, and also restores the original right-to-left translation order so fresh symbol codes match the pre-speedup numbering. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
jrh13
approved these changes
Nov 26, 2026
jrh13
left a comment
Owner
There was a problem hiding this comment.
Great improvement thank you! This helps the performance of almost all proofs.
jargh
pushed a commit
to jargh/hol-light-dev
that referenced
this pull request
Nov 27, 2026
Brought the changes of pull request jrh13#216, merged upstream as 1cd9471, into this series: monomorphic comparisons in MESON's inner loops, the input clauses in an array indexed by predicate code, the removal of duplicate clauses by hashing, folded per theorem, and hash tables for the variable and constant stores, with the search and its results unchanged. Adapted to this series, which removes genvar from meson.ml: the variable store keeps jrh13#216's hash table and loses its global store of genvars for bumped variables, which meson_to_hol now names locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jargh
added a commit
to jargh/hol-light-dev
that referenced
this pull request
Nov 27, 2026
…ries and added one for pull request jrh13#216 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jargh
added a commit
to jargh/hol-light-dev
that referenced
this pull request
Nov 27, 2026
… are already in this series
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Speedups, with the search and its results unchanged (same inference counts
and same theorems):
versions: lookups of instantiations, unification, the continuation cache
and the ancestor checks; equality of instantiations first checks for
physical equality, since they share long tails.
of an association list, and the clauses within the size bound are taken
as a prefix of the already-sorted list.
comparisons, and the variable/constant stores use hash tables for lookup.
The instantiations stay association lists: on the goals below they never
exceed 18 entries (about 3 are scanned per lookup), and a Map version was
about 33% slower and changed the search slightly.
On 5554 goals recorded from MESON calls in Library/card.ml, rstc.ml,
Multivariate/misc.ml, Library/{permutations,products,floor,prime,
pocklington}.ml and Examples/{inverse_bug_puzzle_tac,forster,mizar}.ml, the
time in PURE_MESON_TAC goes from 37.8s to 28.5s (1.33x).
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com