Graph Representations for Higher-Order Logic and Theorem Proving

TL;DR

A subexpression-sharing GNN reaches 49.95% proof closure on HOList.

cs.LG 🔴 Advanced 2019-05-24 39 views
Aditya Paliwal Sarah Loos Markus Rabe Kshitij Bansal Christian Szegedy
higher-order logic graph neural networks theorem proving HOList proof search

Key Findings

Methodology

The paper converts HOL formulas from S-expressions into directed graphs and applies message-passing GNNs. Each node aggregates information from both parents and children, producing context-aware embeddings for goals and premises. These embeddings feed a 41-way tactic classifier and a premise scorer, which are then plugged into DeepHOL-style breadth-first proof search for end-to-end evaluation.

Key Results

  • On the HOList validation split of 3,225 theorems, the best 12-hop subexpression-sharing GNN closed 49.95% of proofs, far above the WaveNet baseline at 32.65% and above the 37.98% bag-of-words max-pooling baseline.
  • A surprisingly strong 0-hop subexpression-sharing model already closed 40.86%, showing that graph construction alone gives a major gain; adding hops pushed performance further, with 8 hops at 47.22% and 12 hops at 49.95%.
  • Ablations show that top-down propagation beats bottom-up propagation (48.40% vs. 40.99% at 12 hops), while variable blinding and leaf sharing substantially hurt performance, indicating that variable names and shared subexpressions carry useful semantic signal.

Significance

This is the first systematic use of GNNs for higher-order proof search, demonstrating that graph structure is not just an implementation detail but a core source of learning signal. By moving from theorem-level premise selection to stepwise tactic-and-argument prediction, and by evaluating inside a real prover loop, the paper establishes an end-to-end metric of mathematical progress: how many new theorems can actually be proved. That is important both for automated reasoning research and for practical formalization workflows.

Technical Contribution

Technically, the paper contributes a family of HOL graph encodings—AST, leaf sharing, subexpression sharing, variable blinding, random edges, top-down, and bottom-up—and shows that representation choice materially changes model behavior. Its GNN update rule combines parent and child messages via residual aggregation, h_v^t = h_v^{t-1} + MLP_aggr([h_v^{t-1}, Σs_{u,v}^t, Σŝ_{u,v}^t]). The full system uses separate GNN encoders for goals and premises, 1x1 convolutions to expand 128-d embeddings to 1024-d vectors, max pooling, a tactic softmax head, and a combiner network for premise usefulness. This couples representation learning directly to theorem-proving decisions.

Novelty

The paper is novel in two senses. First, it is the first to apply GNNs to higher-order proof search rather than merely premise selection. Second, it provides a clear empirical demonstration that subexpression sharing and message direction matter: top-down message flow can outperform the TreeRNN-like bottom-up bias, showing that context from all occurrences of a subexpression is crucial. That is a substantive departure from earlier tree-only encoders.

Limitations

  • The strongest result is demonstrated on the HOList complex-analysis corpus, so cross-domain and cross-prover generalization remain unproven. Different theorem provers, tactic languages, and mathematical areas may behave very differently.
  • The system is computationally expensive: at inference it scores 19,262 candidate theorems/definitions and then runs prover search, so full evaluation takes hours and is not practical for all training iterations.
  • Performance is sensitive to graph design choices such as sharing, variable names, and edge direction, which means the method depends on careful engineering rather than a single universally robust representation.

Future Work

The obvious next step is to extend these graph encodings and search policies to other proof assistants such as Coq and HOL4, and to broader mathematical corpora. The results also suggest research into better graph construction, longer-range message passing, and tighter coupling between proof search and representation learning. More theoretically, it would be valuable to explain why subexpression sharing and top-down context help so much, and to reduce the search cost without sacrificing interpretability or proof power.

AI Executive Summary

This paper makes a landmark move: it brings graph neural networks into higher-order theorem proving and shows that the representation choice itself can change proof success dramatically. Higher-order logic underlies interactive provers such as HOL Light, which have been used to formalize large swaths of mathematics, but proof search in this setting is notoriously hard. Earlier sequence models and TreeRNN-style encoders often compressed syntax too locally, missing the wider context that determines whether a subexpression is useful in a proof.

The authors recast HOL formulas as graphs rather than plain trees. Starting from HOList S-expressions, they study several encodings: ordinary ASTs, leaf sharing, subexpression sharing, variable blinding, random edges, and direction-restricted variants that allow only top-down or only bottom-up message flow. On top of these graphs they build a message-passing GNN that updates each node from both its parents and children, then pools node states into goal and premise embeddings. Those embeddings power two heads: a 41-way tactic classifier and a premise scorer that ranks up to 19,262 candidate theorems and definitions.

The empirical picture is clear. On the HOList validation set of 3,225 held-out complex-analysis theorems, the best model—a 12-hop GNN with subexpression sharing—closed 49.95% of proofs. That is a major jump over the prior HOList WaveNet baseline at 32.65% and also better than a strong bag-of-words max-pooling baseline at 37.98%. The ablations are equally revealing: top-down message passing reaches 48.40%, bottom-up only 40.99%, and variable blinding drops performance to 37.36%. In other words, the model benefits not merely from syntax, but from context, sharing, and the direction in which information is allowed to travel. The paper therefore establishes a new, stronger benchmark for learning-based higher-order reasoning.

Deep Analysis

Background

Higher-order theorem proving is central to formalized mathematics because it allows quantification over propositions and functions, which makes it expressive enough for real mathematical theories. Systems such as HOL Light, Coq, and HOL4 have supported major formalization efforts in topology, analysis, geometry, and the Kepler conjecture. HOList was introduced as a learning environment for this domain: it offers a stateless theorem-proving API, a benchmark with over twenty thousand theorems, and human proofs generated inside HOL Light. Before this paper, deep learning had shown promise in premise selection and tactic prediction, but TreeRNNs, LSTMs, and other sequence/tree encoders had not delivered decisive gains on end-to-end proof search.

Core Problem

The core problem is how to represent higher-order logic formulas so that a neural model can capture both local syntax and global proof-relevant context. A pure tree representation repeats identical subexpressions and isolates sibling branches; a sequence representation loses structure altogether. For theorem proving, this is especially harmful because the same subexpression may play different roles in different locations, and successful proof steps depend on the surrounding goal, available premises, and tactic semantics. The challenge is therefore not only classification, but representation for search.

Innovation

The paper's innovations are structural and end-to-end. First, it introduces several graph encodings of HOL, especially subexpression sharing, which merges syntactically identical subterms and lets multiple occurrences contribute to the same node state. Second, it uses a bidirectional message-passing GNN so each node can combine parent context and child content instead of encoding only bottom-up like a TreeRNN. Third, it evaluates representations inside an actual theorem prover loop, not just on proxy accuracy. Fourth, it explicitly studies edge direction, random edges, leaf sharing, and variable blinding, showing that graph design choices materially affect proof success.

Methodology

  • �� Input representation: HOList S-expressions are converted into directed graphs. Node labels include application (a), variable (v), lambda (l), constant (c), and type constructors such as fun; edge labels preserve child order.
  • �� Representation variants: ordinary AST; leaf sharing; subexpression sharing; variable blinding; random edges; top-down only; bottom-up only. Subexpression sharing merges identical expressions so repeated occurrences of x or a typed subterm point to one shared node.
  • �� Node initialization: each token gets a trainable embedding; ML Pv and MLP_E embed node and edge labels into a latent space.
  • �� Message passing: for T rounds, each edge produces two directional messages, one from parent to child and one from child to parent. Messages are computed with separate MLPs over [h_u^{t-1}, h_v^{t-1}, e], then summed over parents and children and combined with a residual update.
  • �� Goal/premise encoding: the goal and each premise are encoded by separate, non-shared GNNs. Two 1x1 convolutions expand node depth from 128 to 512 and 1024 before max pooling yields a fixed-size embedding.
  • �� Prediction heads: the tactic head uses two fully connected layers plus softmax over 41 tactics. The combiner concatenates goal, premise, and elementwise product, then uses three fully connected layers to score premise usefulness.
  • �� Search loop: at proof time, the system selects the top-5 tactics, ranks all 19,262 candidate premises, keeps the top-20 as parameters, and uses HOList/DeepHOL breadth-first search to close goals recursively.

Experiments

The main benchmark is HOList, built from the HOL Light complex-analysis corpus. Training data come from 10,200 top-level theorems and about 375,000 proof steps. Evaluation is the standard HOList validation split with 3,225 held-out theorems. The authors report end-to-end proof closure as the primary metric, because it measures whether a model can actually help prove new theorems. They also track tactic-prediction accuracy and relative premise-ranking accuracy during training, then select the best checkpoint for full prover evaluation. Crucially, they compare multiple graph representations and multiple hop counts under the same architecture.

Results

The strongest result is 49.95% proof closure for the 12-hop subexpression-sharing model. This substantially outperforms the previous HOList WaveNet baseline at 32.65% and the bag-of-words max-pooling baseline at 37.98%. The 0-hop subexpression-sharing model already reaches 40.86%, which shows that the graph representation itself is powerful even before deep propagation. Increasing hops generally helps for ASTs and subexpression-sharing graphs: AST rises from 40.18% at 0 hops to 46.66% at 8 hops; subexpression sharing rises from 40.86% to 47.22% at 8 hops and 49.95% at 12 hops. By contrast, leaf sharing collapses with message passing, confirming that not all compression schemes are equally useful.

Applications

In practice, this work is relevant wherever formal proof assistance matters. A prover integrated with a GNN ranker can recommend tactics and premises to mathematicians, speeding up interactive proofs. The same setup can support large formal verification projects, where engineers need to search thousands of lemmas and definitions quickly. More broadly, the representation ideas may transfer to symbolic reasoning tasks such as program verification, specification checking, and structured knowledge retrieval, provided the target system exposes a theorem-proving style search loop.

Limitations & Outlook

The approach relies on a specific theorem-proving environment and a fixed tactic vocabulary of 41 actions, so portability is limited. It also requires scoring 19,262 candidate premises, which is expensive and makes training/evaluation slow. The best result is tied to subexpression-sharing graphs in HOList's complex-analysis domain, so broader generalization remains an open question. Finally, the sensitivity to representation choices suggests that more principled theory of graph construction and context propagation is still needed.

Plain Language Accessible to non-experts

Imagine you are trying to solve a giant jigsaw puzzle, but the pieces are not just lying on the table—they are written as rules, definitions, and little sub-rules that refer to each other. If you only read them one by one, it is easy to miss how the same piece shows up in several places and changes meaning depending on where it sits. The paper's idea is to turn the whole puzzle into a connected map, so the computer can see not only each piece, but also how it links to the rest.

Then the computer does something like a team meeting. Each piece sends messages to the pieces next to it, and those pieces send messages back. After a few rounds, every part knows more about its neighborhood and the bigger picture. With that richer picture, the system tries to guess the next move in the proof and which earlier facts are most helpful. Those guesses are then tested by the real theorem prover, which is like the final referee.

The result is that the computer becomes much better at finishing proofs. On the benchmark used in the paper, the best version solves nearly half of the test problems, while older methods solve only about a third. The most important lesson is simple: for hard reasoning tasks, the way you draw the map can matter as much as the model itself. If the map keeps repeating important pieces in smart ways, the computer can think more like a careful mathematician and less like a robot reading a sentence list.

ELI14 Explained like you're 14

Think of this paper like training a super-smart homework helper for math proof problems. The old helpers mostly read the problem like a line of text. That works a little, but for really hard proofs it is kind of like trying to understand a whole movie by only reading subtitles one word at a time. You miss who is connected to whom, and you miss the repeated clues that show up in different scenes.

What these authors did was smarter: they turned each formula into a map of connected parts. Then the AI could look around each part, see its neighbors, and even notice when the same little chunk appears in more than one place. It is a bit like studying a school project with sticky notes and arrows instead of just a plain paragraph. Suddenly the structure becomes obvious!

The AI then had to pick the next move in the proof game and choose which previous facts to use, kind of like choosing the right move in a strategy game. And yes, it really worked: on the HOList test set, the best model solved 49.95% of the problems, compared with 32.65% for the older WaveNet system. That is a big jump!

So the big idea is: if you want AI to do serious math, don't just feed it the words. Give it the structure, the connections, and the repeating patterns. Then it has a much better chance of figuring out what comes next. Pretty cool, right?

Glossary

Graph Neural Network (GNN)

A neural network designed for graph-structured data. Instead of reading tokens in order, it repeatedly exchanges information between neighboring nodes to build context-aware representations.

Used to encode HOL formulas as graphs and to compare different message-passing directions and sharing schemes.

Subexpression sharing

A graph transformation that merges syntactically identical subexpressions into a single node. This allows multiple occurrences of the same formula fragment to contribute to one shared representation.

The best-performing representation in the paper, yielding 49.95% proof closure at 12 hops.

Tactic

A proof step or proof method used by an interactive theorem prover to transform a goal or generate subgoals. It is the action vocabulary of the prover.

The model predicts one of 41 tactics at each proof state.

Premise selection

The task of choosing which previously proved theorems or definitions are relevant for the current goal. In theorem proving, this strongly affects search efficiency.

The combiner network ranks 19,262 candidate premises for each goal.

Max pooling

An aggregation operation that compresses many node vectors into a single fixed-size vector by taking the maximum value per dimension. It is a simple way to form a graph-level embedding.

Used after GNN encoding to produce goal and premise embeddings before classification/scoring.

Open Questions Unanswered questions from this research

  • 1 How well do these graph encodings transfer beyond HOList's complex-analysis corpus? The paper shows strong gains in one benchmark, but it remains unclear whether the same subexpression-sharing and top-down advantages survive in Coq, HOL4, or substantially different mathematical domains.
  • 2 The paper establishes empirical effects but not a theory of why top-down context beats bottom-up structure in this setting. A principled explanation of when sharing, directionality, and variable names help—or hurt—would make the method easier to generalize and design.
  • 3 The proof search loop is still expensive because every goal is scored against a large theorem database. More efficient candidate retrieval, better search pruning, or joint search-and-encoding training would be needed for practical large-scale deployment.

Applications

Immediate Applications

Proof assistant guidance

A HOL Light-style assistant can use the model to recommend tactics and promising premises to human users. This is most useful for mathematicians and formalization engineers working on large proof scripts, provided the theorem database is already available in machine-readable form.

Lemma and theorem retrieval

Large formal libraries can use the premise scorer as a retrieval engine to surface relevant lemmas for a current goal. Users benefit by searching less manually and reusing prior proofs more effectively, especially in repositories with tens of thousands of statements.

Long-term Vision

General-purpose mathematical reasoning systems

In the long run, graph-based proof representation could become a core component of unified theorem-proving agents that operate across proof assistants and domains. The main obstacles are scaling, transfer, and search efficiency, but the paper suggests a credible path toward more capable formal reasoning systems.

Abstract

This paper presents the first use of graph neural networks (GNNs) for higher-order proof search and demonstrates that GNNs can improve upon state-of-the-art results in this domain. Interactive, higher-order theorem provers allow for the formalization of most mathematical theories and have been shown to pose a significant challenge for deep learning. Higher-order logic is highly expressive and, even though it is well-structured with a clearly defined grammar and semantics, there still remains no well-established method to convert formulas into graph-based representations. In this paper, we consider several graphical representations of higher-order logic and evaluate them against the HOList benchmark for higher-order theorem proving.

cs.LG cs.AI cs.LO stat.ML