Optimising Metamath Proofs for Human Working Memory
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: Computer Science. The day in computer science: software, systems and theory on arXiv.
Tom: I'm Tom.
Jane: And I'm Jane, here with Lu, Meng and our in-house large language model, Lalam.
Tom: We're looking at the paper: "Optimising Metamath Proofs for Human Working Memory".
Title and authors: Tom: So, we're talking about this paper called "Optimising Metamath Proofs for Human Working Memory." It’s about figuring out how to rearrange those steps in a formal mathematical proof so that it actually takes less mental effort for a human to check.
Jane: Exactly. Basically, the main idea is that just shrinking the proof size isn't enough; sometimes you can keep the same length but make it easier on your brain while you’re reading it. It uses Metamath as this test case because its structure forces proofs into a very specific order that’s good for machines but not always good for people.
Lu: The core of their approach is treating the proof like a directed acyclic graph, where each step is a node and the logical flow between them are the edges, which sets up how they model it as this pebbling game.
Meng: A pebbling game? I'm not familiar with that terminology in terms of running code, but if I follow what they say, it sounds like they're tracking what you have loaded into your active memory while you check the proof.
Lalam: The paper uses this pebbling game model to track peak and cumulative memory demands. They derive two main metrics from this: the pebbling space, which is the maximum number of things you need to hold at once, and the cumulative cost, which models that sustained cognitive load over time.
Tom: That’s a big thing—moving beyond just looking at how much space you use at any single moment to actually measuring the total sustained effort required to check it all.
Jane: Right. And because finding the absolute best way to order those steps by trying every possible arrangement is too hard, they developed some heuristic algorithms instead of brute force.
Lu: They combine ideas from different ordering strategies, like Fellner and Paleo’s greedy algorithm and Sethi–Ullman numbering, along with other simpler criteria to find good approximations for the optimal sequence.
Meng: Heuristics are good when you can't run a full search; but what kind of ordering policies are they testing? Are we talking about just random shuffling, or something more structured?
Title and authors: Tom: They tested several policies, including Original and Random two, and then combinations like "SU Original" or "CumulSU Original." It seems they found that mixing Sethi–Ullman ideas with cumulative strategies actually gave the best results for both space and cumulative cost.
Jane: That’s interesting because usually, you optimize for one thing—maybe minimizing the peak memory usage—but here, they found that a combination of SU and either CumulSU or CumulPred seems best for balancing both the space and that total cumulative cost metric.
Lu: They specifically looked at how these reorderings affect things like mean index distance and adjacency rate, which are inspired by previous work on improving legibility.
Meng: So, if I were deploying a model based on this idea, what would be the practical cost of running these reordering algorithms across a massive proof library? Is it something that runs fast enough for production?
Tom: That’s a fair question, Meng. The paper says the methods are general-purpose and only need abstract graph representations of proof structure, which makes them applicable to different libraries like Lean or Rocq. The experiments were done on Metamath proofs, which they say is straightforward to export into this graph format.
Jane: They did case studies, and one example showed applying the policy "SU CumulSU Original" could reduce the space from nine down to six and that cumulative cost from two hundred twenty-four down to one hundred thirty-seven in a proof called prmunb.
Lu: That specific example is telling because it shows that even if the peak memory space isn't always going up, you can still see a significant improvement in the cumulative cost by changing the order.
Meng: Wait, so they found that cumulative cost can improve even when space isn't changing? That’s not what I usually expect when optimizing for human working memory; I usually want to reduce the peak load.
Tom: Yeah, that's what surprised them. It suggests that the way steps build on each other over time is a really important factor in how much sustained effort you have to exert while checking a proof.
Jane: So, when we talk about this paper "Optimising Metamath Proofs for Human Working Memory," they aren't just tweaking the text; they are modeling the entire process of reading and checking as a kind of resource allocation problem.
Title and authors: Lu: It shows how abstract graph representations can be powerful because you don't need to understand the deep mathematical content of the proof to apply these ordering algorithms; you just need a structure.
Meng: From an engineering standpoint, if this works well, it means we could potentially use these reordering techniques as a pre-processing step for any proof system we build to ensure the output is readable without needing a completely new verification engine.
Tom: It’s definitely worth looking at how they apply this across Metamath's entire ZFC set theory library, which gives them a pretty broad test of the method’s robustness.
Jane: So, to wrap up on these improvements, the paper suggests that using a mixture of Sethi–Ullman and either CumulSU or CumulPred is the most effective way to optimize both peak space and cumulative cost simultaneously.
Lu: It's a practical recommendation for anyone trying to balance proof structure with human comprehension when working with formal systems.
Meng: I still worry about scalability. If we have thousands of proofs, running these complex heuristic reordering algorithms on every single one might introduce a significant overhead that defeats the purpose of making things faster.
Tom: That’s the trade-off, I guess. You gain better presentation metrics, but you add a computational step before verification.
Jane: So to conclude this discussion on "Optimising Metamath Proofs for Human Working Memory," the paper shows that strategic reordering of inferences can reduce working memory demand without changing the proof size itself by modeling it as a pebbling game and using specific heuristic algorithms like SU and CumulSU for best results.
Lu: It’s a solid demonstration of how graph theory can be used to solve problems in human-computer interaction for formal mathematics.
Meng: I think the most important part is that they moved the focus from just proof length to sustained effort, which is a more realistic measure of how much mental energy a mathematician spends.
Tom: Yeah, it’s about finding that sweet spot between what’s mathematically rigorous and what’s actually readable for a person checking it.
Jane: That's where we are on this topic today.
The paper's summary: Tom: So, to recap, this paper is about taking those formal mathematical proofs in Metamath and rearranging the steps so that they are easier for a human brain to follow while they're checking them.
Jane: Yeah, it’s not just about making things shorter; it’s really about reducing the mental load you have to manage as you read the proof. They use this idea of a pebbling game to measure that load—how much memory you need to hold at any one time, and how much total sustained effort is required over the whole proof.
Lu: The authors are looking for ways to reorder those steps in the graph structure of the proof so they get those memory metrics down without actually changing the total number of steps or what the proof actually proves.
Meng: So, if I'm running a system, I want to know what breaks at scale. What this paper is doing is finding ways to make a system output, even if it’s complex math, more "human-friendly" in terms of processing load.
Tom: Exactly. And they found that just minimizing the peak memory usage isn't enough because you still have that cumulative cost—the total sustained effort—which is what really matters for a long proof check.
Jane: They tested a bunch of different ways to reorder those steps, not just random shuffling, but specific strategies like combining Sethi-Ullman ideas with cumulative ones. And they found that mixing them was the best way to keep both the peak memory and that total effort low at the same time.
Lu: The results show a specific mixture of these approaches is best for optimizing both space—the peak memory—and cumulative cost over all kinds of proof structures in their set theory library.
Meng: That sounds like a practical win if it works across different mathematical domains, not just this one library they tested. What about the limitations? Does this method work on every single proof structure out there?
Tom: The paper mentions that the graphs they use are general enough to apply to other formal systems, which is good. But they also point out that their pebbling game model only looks at things in one direction—topological order—so it doesn't handle some kind of backwards reasoning or complex dependencies yet.
Jane: That means it’s a very useful tool for optimizing the "forward" flow of logic, but if you have proofs where you need to look back and use prior steps in a specific way, this method might not capture that complexity.
Lu: The authors actually suggest future work looking at adapting these proof graphs to account for backwards reasoning using something called black-white pebbling games. They also mention exploring weighted pebbling games where they assign higher weights to expressions that are really complex or have a lot of nested structure.
Meng: Weighted games sound interesting from a resource allocation standpoint, but I still need to know how much computational overhead this reordering step adds on top of the actual verification process. If it slows down the checking time too much, it's just academic for production use.
Tom: That’s the engineering hurdle. But what this paper really shows is that we can optimize presentation metrics—like space and cumulative cost—for formal math without sacrificing proof size or mathematical correctness.
Jane: It's a real step toward making formal mathematics more accessible to people who aren't just mathematicians, but also engineers or programmers who need to work with these systems.
Lu: So, the big implication here is that you can use structural analysis on a proof to improve its legibility metrics for human checking, which points toward a new way of thinking about how we represent and optimize formal reasoning.
The paper's improvements: Tom: So, moving past just finding an order, the paper suggests that we look at different ways to define what makes a proof structure "good" for human memory. It’s not just about one perfect ordering policy.
Jane: Right, it’s about looking at multiple criteria—like adjacency rate and mean index distance—not just sticking to one metric like the close reference principle. They want a more complete picture of legibility.
Lu: The core improvement they propose is treating the problem as a pebbling game where you can model unpebbling as an automatic process, which simplifies how they calculate that memory demand.
Meng: A simplified calculation sounds good for deployment because it cuts down on the complexity of tracking every single piece of information in active memory. But what about those complex dependencies that aren't just simple sequential steps?
Tom: They address those by looking at weighted pebbling games, where you could assign higher weights to expressions that have a lot of symbols or are deeply nested, which captures more structural complexity.
Jane: That’s an ambition because it tries to capture the essence of how much cognitive effort is needed for a proof without needing to hold every single intermediate line in your head.
Lu: The authors suggest that using a mixture of the Sethi-Ullman idea with either the cumulative space or cumulative prediction ideas is actually very close in performance to those pure strategies, optimizing both space and cost together.
Meng: So we can use that specific mix—the SU and CumulSU combination—as a reliable go-to strategy for balancing memory usage across different types of proofs. That gives me some concrete numbers to test on my production pipelines.
Tom: The implication is that we can start using these structural analysis methods as a pre-processing step for any proof system, not just Metamath, to make the output inherently more readable before a human even sees it.
Jane: It changes how we think about formal math tools; instead of just focusing on the logic itself, we’re focusing on how that logic is presented to the person using it.
Lu: They also point out that their current work stops where there's backwards reasoning involved, which means if you want to model those complex logical dependencies, you’ll need to look into those black-white pebbling games they mentioned.
Conclusion: Tom: So, to wrap up on this paper "Optimising Metamath Proofs for Human Working Memory," we’ve seen that strategic reordering of proof steps can lower the mental effort required to check them without changing the overall size of the proof itself.
Jane: Exactly. It’s about using graph theory and pebbling games to model how much memory a person needs, focusing on both the peak load and that sustained effort over time, which we call cumulative cost.
Lu: The authors are showing that by combining specific heuristic reordering methods, like Sethi-Ullman with cumulative strategies, you can find an effective balance between minimizing peak memory and reducing that total cost across different proof structures.
Meng: So the implication for us in production is that we have a way to make the output of a formal system inherently more digestible for human review before we even start building our own verification layers on top.
Tom: Right, it’s about finding those optimized ordering policies that give us better legibility metrics, which is pretty valuable when you're trying to build tools that math people actually want to use.
Jane: It shows us that abstract structural analysis can be a practical way to improve human-computer interaction in formal reasoning systems.
Lu: They are definitely pointing toward future work with weighted games and black-white pebbling games, which suggests the next step is tackling those more complex logical dependencies that involve looking backward.
Meng: From my side, I still have to figure out if the computational cost of running these reordering algorithms on a massive set of proofs is something we can afford to bake into our pipeline without slowing down everything else.
Tom: That’s the engineering trade-off we always have to consider when adding optimization steps like this.
Jane: It’s a great demonstration that focusing on the presentation of formal mathematics has real impact on how people actually use those tools day-to-day.
Jeremy Lindsay, Cezary Kaliszyk, Christine Rizkallah
University of Melbourne
cs.LO
Submitted: 2026-09-07
Updated: 2026-12-03
Comments: Submitted version. The final version appeared in CICM 2026, LNAI, Springer
Journal ref: Intelligent Computer Mathematics. CICM 2026. Lecture Notes in Computer Science, vol 16907. Springer, Cham
DOI: 10.1007/978-3-032-38214-6_14
Code: https://github.com/jnlindsay/mmverify.py-json-exporter
License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
The gist: Optimising Metamath Proofs for Human Working Memory introduces algorithms to reorder proof steps in Metamath to minimize working memory demand without altering overall proof size.<ref:2609.07097#pg1…
Key concepts
- Proof as DAG
- A proof is represented as a directed acyclic graph (DAG) where each vertex is an inference step, and edges show logical dependencies between steps. This structure allows the system to analyze the flow of reasoning mathematically.
- Pebbling Games
- This formalism models memory demand using pebbling games. Placing a 'pebble' on a vertex signifies that the expression derived from that step must be held in working memory, allowing researchers to quantify peak and cumulative memory load.
- Heuristic Reordering
- Since finding the perfect order is too complex, the paper uses heuristic methods combining ideas like greedy algorithms and numbering schemes. These provide fast approximations of optimal topological orders for proof steps, avoiding computationally impossible brute-force searches.
Terminology
Summary
Optimising Metamath Proofs for Human Working Memory introduces algorithms to reorder proof steps in Metamath to minimize working memory demand without altering overall proof size. p. 0<ref:2609.07097#pg1, "While most proof optimisation techniques seek to minimise proof size, the strategic reordering of inferences can reduce the working memory demand of proof checking without altering overall size">. p. 0 This approach is applied across Metamath’s ZFC set theory library and demonstrates how automated reordering systematically improves the presentation of formal mathematics. p. 0<ref:2609.07097#pg1, "We apply these algorithms across Metamath’s ZFC set theory library set. p. 0mm and present case studies demonstrating how automated reordering systematically improves the presentation of formal mathematics">. p. 0
Problem Formulation
The core problem is formulated by representing a proof as a directed acyclic graph (DAG) where vertices are distinct inferences and edges represent logical dependencies.<ref:2609.07097#pg2, "We represent a proof as a directed acyclic graph (DAG) whose vertices are distinct inferences and edges represent logical dependencies">. p. 1 The memory demand is modeled using the formalism of pebbling games, where placing a pebble on a vertex indicates that the expression it derives is currently stored in working memory. p. 5<ref:2609.07097#pg5>. Two metrics are derived from this formalism: the pebbling space sp(P) and the cumulative pebbling cost cc(P), which model peak and cumulative memory demand. p. 5<ref:2609.07097#pg6>.
Heuristic Algorithms
To find an optimal ordering via brute force is computationally infeasible.<ref:2609.07097#pg2>. The paper introduces heuristic reordering methods that combine ideas from Fellner and Paleo’s greedy algorithm, Sethi–Ullman numbering, and other lightweight ordering criteria. p. 1<ref:2609.07097#pg4, We develop heuristic reordering methods that combine ideas from Fellner and Paleo’s greedy algorithm [5], Sethi–Ullman numbering [22], and other lightweight ordering criteria
>. Algorithm 1 is a bottom-up depth-first search (DFS) approach adapted from Fellner and Paleo. p. 7<ref:2609.07097#pg8>. The ordering policies considered include Original, Random2, (SU, Original), (CumulSU, Original), (CumulPred, Original), (NumSucc, Original), and LastSucc. p. 8<ref:2609.07097#pg11, "For each proof DAG G in set. p. 4mm we use Algorithm 1 to compute a topological order ≺ on G for each of the ordering policies below">. p. 7
Experimental Results
Experiments were conducted on Metamath’s set.mm library, analyzing metrics such as statement count, pebbling space, and cumulative pebbling cost. p. 9<ref:2609.07097#pg13>. Table 4 compares the relative improvement in space and cumulative cost of each reordering policy compared to the original Metamath ordering. p. 9<ref:2609.07097#pg12>. The results suggest that a mixture of SU and either CumulSU or CumulPred seems to be the best approach for optimising both space and cumulative cost. p. 8<ref:2609.07097#pg12, "Overall, a mixture of SU and either of CumulSU and CumulPred seems to be the best approach for optimising both space and cumulative cost">. p. 8
Case Studies
Case studies illustrate how these improvements arise and where they may fail.<ref:2609.07097#pg15>. For instance, in the proof of prmunb, applying (SU, CumulSU, Original) delays nnnn0 until step 47, reducing space from 9 to 6 and cumulative cost from 224 to 137. p. 3<ref:2609.07097#pg15>. These examples show that while space and adjacency rate are not always positively correlated, cumulative cost can improve even when space is unchanged. p. 7<ref:2609.07097#pg15>.
Future Directions
Future directions include adapting proof DAGs to account for backwards reasoning using black-white pebbling games.<ref:2609.07097#pg9>. Further exploration could involve weighted pebbling games and assigning higher weights to expressions with more symbols or deeper nested structure. p. 5<ref:2609.07097#pg9>.
Conclusion
Our results support proof reordering as a practical optimisation target for legibility proxy metrics.<ref:2609.07097#pg10>. The work motivates future evaluation on other formal libraries beyond Metamath. p. 1<ref:2609.07097#pg13>.
References
The references listed are: 1. The archive of formal proofs. p. 1<ref:2609.07097#pg16, "The archive of formal proofs"> 2. p. 1 Ahuja, R., Avigad, J., Tetali, P., Welleck, S.: IMPROVER: AGENT-BASED AUTOMATED PROOF OPTIMIZATION (2025). p. 0<ref:2609.07097#pg16, "Ahuja, R., Avigad, J., Tetali, P., Welleck, S.: IMPROVER: AGENT-BASED AUTOMATED PROOF OPTIMIZATION (2025)"> 3. p. 0 Appel, A.W., Supowit, K. p. 8 p. 8J.: Generalizations of the Sethi-Ullman algorithm for register allocation. p. 1<ref:2609.07097#pg16, "Appel, A. p. 8W., Supowit, K.J.: Generalizations of the Sethi-Ullman algorithm for register allocation"> 4. p. 1 mathlib Community, T.: The lean mathematical library. p. 1<ref:2609.07097#pg16, "mathlib Community, T.: The lean mathematical library"> 5. p. 1 Fellner, A. p. 1, Woltzenlogel Paleo, B. p. 1 p. 1: Greedy pebbling for proof space compression. p. 2<ref:2609.07097#pg16, "Fellner, A. p. 1, Woltzenlogel Paleo, B.: Greedy pebbling for proof space compression"> 6. p. 2 Gallardo, P., Raissi, M., Zhang, K., Murthy, S.: Agentic lean auformalization (ALA): An LLM collaborative approach to autoformalization in LEAN. p. 1<ref:2609.07097#pg16, "Gallardo, P., Raissi, M., Zhang, K., Murthy, S.: Agentic lean auformalization (ALA): An LLM collaborative approach to autoformalization in LEAN"> 7. p. 1 Grabowski, A., Kornilowicz, A., Naumowicz, A.: Mizar in a nutshell.<ref:2609.07097#pg16, "Grabowski, A., Kornilowicz, A., Naumowicz, A.: Mizar in a nutshell"> 8. Gu, A., Piotrowski, B., Gloeckle, F., Yang, K., Markosyan, A.H.: Proofoptimizer: Training language models to simplify proofs without human demonstrations (2026). p. 0<ref:2609.07097#pg16, "Gu, A., Piotrowski, B., Gloeckle, F., Yang, K., Markosyan, A.H.: Proofoptimizer: Training language models to simplify proofs without human demonstrations (2026)"> 9. p. 0 Kaliszyk, C. p. 0, Urban, J.: Learning-assisted theorem proving with millions of lemmas. p. 2<ref:2609.07097#pg16, "Kaliszyk, C. p. 0, Urban, J.: Learning-assisted theorem proving with millions of lemmas"> 10. p. 2 Krajíček, J.: Proof Complexity. p. 2<ref:2609.07097#pg16> 11. Levien, R., Wheeler, D.A., Lindsay, J. p. 0 p. 0 p. 0: Metamath proof structure exporter to JSON (4 2026). p. 1<ref:2609.07097#pg16, "Levien, R., Wheeler, D.A., Lindsay, J.: Metamath proof structure exporter to JSON (4 2026)"> 12. p. 1 Lindsay, J., Kaliszyk, C. p. 0 p. 0, Rizkallah, C. p. 0 p. 0: Optimising Metamath Proofs for Human Working Memory — Accompanying Code (4 2026). p. 0<ref:2609.07097#pg16, "Lindsay, J. p. 0, Kaliszyk, C., Rizkallah, C.: Optimising Metamath Proofs for Human Working Memory — Accompanying Code (4 2026)"> 13. p. 0 Megill, N.D., Wheeler, D.A.: Metamath: A Computer Language for Mathematical Proofs. p. 0<ref:2609.07097#pg16, "Megill, N.D., Wheeler, D.A.: Metamath: A Computer Language for Mathematical Proofs"> 14. p. 0 Moura, L.d., Ullrich, S.: The lean 4 theorem prover and programming language. p. 2<ref:2609.07097#pg16, "Moura, L.d., Ullrich, S.: The lean 4 theorem prover and programming language"> 15. p. 2 Nordstrom, J.: Pebble Games. p. 5<ref:2609.07097#pg16> 16. Pąk, K.: Automated improving of proof legibility in the mizar system. p. 0<ref:2609.07097#pg16> 17. Pak, K., Schubert, A.: The impact of proof steps sequence on proof readability—experimental setting (2012). p. 2<ref:2609.07097#pg16> 18. Pąk, K.: The algorithms for improving and reorganizing natural deduction proofs. p. 1<ref:2609.07097#pg16> 19. Pąk, K.: Improving legibility of formal proofs based on the Close Reference Principle is NP-Hard. p. 2<ref:2609.07097#pg16> 20. Rahul, S.P., Necula, G.C.: Proof Optimization Using Lemma Extraction. p. 2<ref:2609.07097#pg16> 21. Sethi, R.: Complete register allocation problems. p. 2<ref:2609.07097#pg16> 22. Sethi, R., Ullman, J. p. 1D.: The Generation of Optimal Code for Arithmetic Expressions. p. 6<ref:2609.07097#pg16> 23. Team, T.R.D.: The rocq prover (Apr 2025). p. 1<ref:2609.07097#pg16> 24. Vyskočil, J., Stanovský, D., Urban, J.: Automated Proof Compression by Invention of New Definitions. p. 0<ref:2609.07097#pg16> 25. Wang, H., Unsal, M., Lin, X., Baksys, M., Liu, J., Santos, M.D., Sung, F.: Kimina-prover preview: Towards large formal reasoning models with reinforcement learning (2025).<ref:2609.07097#pg16> 26. Wheeler, D.A., Levien, R.: mmverify. p. 8py: Metamath verifier in Python. p. 8<ref:2609.07097#pg16> 27. Xin, H., Ren, Z., Song, J., Shao, Z., Zhao, W., Wang, H., Liu, B.: Deepseek-prover-v1.5: Harnessing proof assistant feedback for reinforcement learning and monte-carlo tree search (2025). p. 2<ref:2609.07097#pg16> 28. Zhou, J.P., Wu, Y., Li, Q., Grosse, R.: Refactor: Learning to extract theorems from proofs (2024). p. 2<ref:2609.
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Focus optimization on cumulative memory consumption as a novel proxy for sustained human cognitive effort, moving beyond just minimizing peak memory usage to model sustained human cognitive load during proof checking.
-
Develop heuristic reordering methods that combine ideas from Fellner and Paleo’s greedy algorithm, Sethi–Ullman numbering, and other lightweight ordering criteria to provide approximations for optimal topological orders without resorting to computationally infeasible brute force methods.
-
Implement a novel variant of the pebbling game that treats unpebbling as an automatic process, simplifying memory calculations by capturing the idea that
premises do not (in general) need to be held in memory together with the conclusion once it is established.
-
Apply ordering policies such as CumulSU and CumulPred, which are shown to be
very close in performance with respect to cumulative cost,
as the best approach for optimizing both space and cumulative cost across various proof structures. -
Integrate metrics like mean index distance (MID) and adjacency rate (AdjRate) into automated proof analysis to provide a more nuanced understanding of legibility, especially where these metrics diverge from those based solely on the close reference principle.
Sources
Related papers
- Bit-Precise CHC Satisfiability Using Theory-Modular Reasoning
- interwhen: A Generalizable Framework for Steering Reasoning Models with Test-time Verification
- On Higher-Order Reachability Games vs May Reachability
- A Non-Dichotomy for CSPs of Stable omega-Categorical Structures
- A Deeper Look at Depth: Stable Generation Accounting for Quantifier Reasoning
- Formalizing Hyperspaces and Operations on Subsets of Polish Spaces over Abstract Exact Real Numbers