Recognition: 2 theorem links
· Lean TheoremAutomated Amortised Analysis of Skew Heaps and Leftist Heaps (Extended Version)
Pith reviewed 2026-05-13 04:28 UTC · model grok-4.3
The pith
A generic type system enables automated amortised analysis of skew heaps and leftist heaps using arbitrary potential functions.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
By developing a generic type system and extending the type inference algorithm with path sensitivity, data structure invariants, and templates for piecewise potentials, the approach supports the encoding and use of all known potential functions for skew heaps and leftist heaps, thereby confirming the known amortized bounds through fully automated analysis.
What carries the argument
The generic type system, which permits arbitrary classes of potential functions and is implemented in a modular way, combined with enhancements to the inference algorithm for handling invariants and templates.
If this is right
- Optimal amortized bounds can be inferred automatically for skew heaps.
- Both weight-biased and rank-biased variants of leftist heaps can be analyzed automatically.
- The known manual bounds for these structures are reproduced by the automated system.
- Modular reasoning becomes possible for data structures with complex invariants.
- The method extends previous type-based analyses to a broader class of potential functions.
Where Pith is reading between the lines
- This could enable rapid experimentation with novel potential functions via the template mechanism.
- The path-sensitive analysis might help with other data structures involving conditional behaviors.
- Future extensions could target additional functional data structures beyond heaps.
Load-bearing premise
The generic type system correctly encodes the required data-structure invariants and potential function templates for skew and leftist heaps without introducing unsound approximations.
What would settle it
If the implemented system fails to derive the known optimal bounds when applied to the standard definitions of skew heaps or leftist heaps, or if it produces unsound bounds, the claim would be falsified.
Figures
read the original abstract
We study the fully automated amortised analysis of purely functional data structures like skew heaps, as well as weight- and rank-biased leftist heaps. For that we generalise earlier works on automated amortised resource analysis by developing a type inference based approach with a generic type system. This allows for modular reasoning and the inference of precise and optimal cost bounds. More specifically, we extend the work on the ATLAS system by Leutgeb et al. which was developed to cover the analysis of splay trees and some closely related data structures. To enable the analysis of skew heaps, however, and the even more challenging (amortised) analysis of leftist heaps, we have developed a range of new techniques for type-based automated analysis. By introducing a generic type system we allow for arbitrary (classes of) potential functions, compared to the use of hard-coded potential functions in ATLAS, which we have implemented in Haskell in an entirely modular way. We have also greatly enhanced the existing type inference algorithm by extensions in multiple directions, including path-sensitive reasoning, data structure invariants, and template parameters for piecewise defined potential functions. We show how our newly developed system supports the use of all known potential functions for analysing skew heaps and leftist heaps, confirming the known bounds.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The manuscript presents a generic type system for amortised resource analysis of purely functional data structures, generalizing the ATLAS system to support arbitrary classes of potential functions in a modular Haskell implementation. It extends the type inference algorithm with path-sensitive reasoning, data-structure invariants, and template parameters for piecewise-defined potentials. The system is applied to skew heaps and both weight-biased and rank-biased leftist heaps, recovering all known potential functions from the literature and confirming the textbook amortised bounds without manual intervention or post-hoc adjustments.
Significance. If the claims hold, the work meaningfully advances automated amortised analysis by handling data structures whose invariants and potentials are more intricate than those covered by prior hard-coded systems. The modular design, explicit side conditions preserving standard accounting, and reported success on canonical examples constitute concrete strengths; the provision of an implementation and falsifiable example outcomes aids reproducibility.
minor comments (3)
- The description of how template parameters interact with the path-sensitive rules (around the extensions to the inference algorithm) would benefit from a small worked example using one of the leftist-heap potentials to illustrate the side conditions.
- A compact table summarizing the recovered bounds versus the textbook bounds for each heap variant and each potential function would improve readability and make the confirmation claim easier to verify at a glance.
- The paper should explicitly state in the main text (rather than only in the implementation section) that the potential-function templates are taken directly from the literature without fitting or approximation inside the tool.
Simulated Author's Rebuttal
We thank the referee for the positive assessment of our manuscript, the accurate summary of its contributions, and the recommendation for minor revision. No specific major comments were raised in the report.
Circularity Check
No significant circularity
full rationale
The paper generalises the ATLAS system by introducing a generic type system parameterised over arbitrary classes of potential functions taken from the existing literature on skew and leftist heaps. It extends the type inference algorithm with path-sensitive rules, data-structure invariants, and template parameters, then reports that the resulting implementation successfully encodes and discharges the known potentials and invariants to recover the textbook amortised bounds. Because the potential functions themselves are external inputs rather than fitted or redefined inside the derivation, and the central result is verification of pre-existing bounds on canonical examples, no step reduces to its own inputs by construction.
Axiom & Free-Parameter Ledger
axioms (1)
- domain assumption The type system correctly encodes the data-structure invariants and potential functions used in prior manual analyses of skew and leftist heaps.
Lean theorems connected to this paper
-
IndisputableMonolith/Constants/AlphaDerivationExplicit.leanphi_golden_ratio echoes?
echoesECHOES: this paper passage has the same mathematical shape or conceptual pattern as the Recognition theorem, but is not a direct formal dependency.
the exact bound for meld has been shown to be log_ϕ(|x|+|y|), where ϕ denotes the golden ratio [13]
-
IndisputableMonolith/Cost/FunctionalEquation.leanwashburn_uniqueness_aczel echoes?
echoesECHOES: this paper passage has the same mathematical shape or conceptual pattern as the Recognition theorem, but is not a direct formal dependency.
Φϕ(t) + 105/163 log2(|t|+|u|) − 105/163 log2|t| + Φϕ(u)
What do these tags mean?
- matches
- The paper's claim is directly supported by a theorem in the formal canon.
- supports
- The theorem supports part of the paper's argument, but the paper may add assumptions or extra steps.
- extends
- The paper goes beyond the formal theorem; the theorem is a base layer rather than the whole result.
- uses
- The paper appears to rely on the theorem as machinery.
- contradicts
- The paper's claim conflicts with a theorem or certificate in the canon.
- unclear
- Pith found a possible connection, but the passage is too broad, indirect, or ambiguous to say the theorem truly supports the claim.
Reference graph
Works this paper leans on
-
[1]
Journal of Experimental Algorithmics (JEA)3, 2–es (1998).https://doi.org/10
Cho, S., Sahni, S.: Weight-biased leftist trees and modified skip lists. Journal of Experimental Algorithmics (JEA)3, 2–es (1998).https://doi.org/10. 1145/297096.297111
-
[2]
Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to al- gorithms. MIT press (2022)
work page 2022
-
[3]
PhD thesis, Computer Science, Stanford University, CA (1972)
Crane, C.A.: Linear Lists and Priority Queues as Balanced Binary Trees. PhD thesis, Computer Science, Stanford University, CA (1972). Automated Amortised Analysis of Skew Heaps and Leftist Heaps 21
work page 1972
- [5]
-
[6]
ACM Transactions on Algorithms (TALG)11(4), 1–26 (2015).https : / / doi
Haeupler, B., Sen, S., Tarjan, R.E.: Rank-balanced trees. ACM Transactions on Algorithms (TALG)11(4), 1–26 (2015).https : / / doi . org / https : //doi.org/10.1145/2689412
-
[7]
Hoffmann, J., Aehlig, K., Hofmann, M.: Multivariate amortized resource analysis. In: Proceedings of the 38th annual ACM SIGPLAN-SIGACT sym- posium on Principles of programming languages, pp. 357–370 (2011).https: //doi.org/10.1145/1926385.1926427
-
[8]
Hoffmann, J., Hofmann, M.: Amortized resource analysis with polynomial potential: A static inference of polynomial bounds for functional programs. In: Programming Languages and Systems: 19th European Symposium on Programming, ESOP 2010, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2010, Paphos, Cyprus, March 20-...
work page 2010
-
[9]
Hofmann, M., Jost, S.: Static prediction of heap space usage for first-order functionalprograms.ACMSIGPLANNotices38(1),185–197(2003).https: //doi.org/10.1145/640128.604148
-
[10]
Mathematical Structures in Computer Science32(6), 794–826 (2022)
Hofmann, M., Leutgeb, L., Obwaller, D., Moser, G., Zuleger, F.: Type-based analysis of logarithmic amortised complexity. Mathematical Structures in Computer Science32(6), 794–826 (2022)
work page 2022
-
[11]
Jost, S., Hammond, K., Loidl, H.-W., Hofmann, M.: Static determination of quantitative resource usage for higher-order programs. In: Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 223–236 (2010).https://doi.org/10.1145/ 1706299.1706327
-
[12]
Kahn, D.M., Hoffmann, J.: Exponential automatic amortized resource anal- ysis. In: Foundations of Software Science and Computation Structures: 23rd International Conference, FOSSACS 2020, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2020, Dublin, Ireland, April 25–30, 2020, Proceedings 23, pp. 359–380 (2020).htt...
-
[13]
Information Processing Letters37(5), 265–271 (1991)
Kaldewaij, A., Schoenmakers, B.: The derivation of a tighter bound for top- down skew heaps. Information Processing Letters37(5), 265–271 (1991). https://doi.org/10.1016/0020-0190(91)90218-7
-
[14]
Addison Wesley Longman Publishing Co., Inc., USA (1998)
Knuth, D.E.: The art of computer programming, volume 3: (2nd ed.) sorting and searching. Addison Wesley Longman Publishing Co., Inc., USA (1998)
work page 1998
-
[15]
Leutgeb, L., Moser, G., Zuleger, F.: ATLAS: automated amortised complex- ity analysis of self-adjusting data structures. In: Computer Aided Verifica- tion: 33rd International Conference, CAV 2021, Virtual Event, July 20–23, 22 A. Walch et al. 2021, Proceedings, Part II 33, pp. 99–122 (2021).https://doi.org/10. 1007/978-3-030-81688-9_5
work page 2021
-
[16]
In: International Conference on Computer Aided Verification, pp
Leutgeb, L., Moser, G., Zuleger, F.: Automated expected amortised cost analysis of probabilistic data structures. In: International Conference on Computer Aided Verification, pp. 70–91 (2022).https : / / doi . org / 10 . 1007/978-3-031-13188-2_4
work page 2022
-
[17]
Journal of Auto- mated Reasoning62, 367–391 (2019).https://doi.org/10.1007/s10817- 018-9459-3
Nipkow, T., Brinkop, H.: Amortized complexity verified. Journal of Auto- mated Reasoning62, 367–391 (2019).https://doi.org/10.1007/s10817- 018-9459-3
-
[18]
Cambridge University Press (1998)
Okasaki, C.: Purely functional data structures. Cambridge University Press (1998)
work page 1998
-
[19]
Cambridge University Press (1998)
Reynolds, J.C.: Theories of programming languages. Cambridge University Press (1998)
work page 1998
-
[20]
Rondon, P.M., Kawaguci, M., Jhala, R.: Liquid types. In: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 159–169 (2008).https : / / doi . org / 10 . 1145 / 1379022.1375602
-
[21]
PhD thesis, Math & CS, TU Eindhoven, Netherlands (1992)
Schoenmakers, B.: Data Structures and Amortized Complexity in a Func- tional Setting. PhD thesis, Math & CS, TU Eindhoven, Netherlands (1992)
work page 1992
-
[22]
Informa- tion processing letters61(5), 279–284 (1997).https://doi.org/10.1016/ s0020-0190(97)00028-8
Schoenmakers, B.: A tight lower bound for top-down skew heaps. Informa- tion processing letters61(5), 279–284 (1997).https://doi.org/10.1016/ s0020-0190(97)00028-8
work page 1997
-
[23]
Schoenmakers, B.: Amortized Analysis of Leftist Heaps. In: Principles of Verification:CyclingtheProbabilisticLandscape:EssaysDedicatedtoJoost- Pieter Katoen on the Occasion of His 60th Birthday, Part I, pp. 73–84. Springer (2024).https://doi.org/10.1007/978-3-031-75783-9_3
-
[24]
In: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming, pp
Simoes, H., Vasconcelos, P., Florido, M., Jost, S., Hammond, K.: Automatic amortised analysis of dynamic memory allocation for lazy functional pro- grams. In: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming, pp. 165–176 (2012).https://doi.org/10. 1145/2398856.2364575
-
[25]
Sleator, D.D., Tarjan, R.E.: Self-adjusting binary search trees. Journal of the ACM (JACM)32(3), 652–686 (1985).https : / / doi . org / 10 . 1145 / 3828.3835
-
[26]
SIAM Journal on Com- puting15(1), 52–69 (1986).https://doi.org/10.1137/0215004
Sleator, D.D., Tarjan, R.E.: Self-adjusting heaps. SIAM Journal on Com- puting15(1), 52–69 (1986).https://doi.org/10.1137/0215004
-
[27]
SIAM Journal on Alge- braic Discrete Methods6(2), 306–318 (1985).https://doi.org/10.1137/ 0606031
Tarjan, R.E.: Amortized computational complexity. SIAM Journal on Alge- braic Discrete Methods6(2), 306–318 (1985).https://doi.org/10.1137/ 0606031
work page 1985
-
[28]
Vasconcelos, P., Jost, S., Florido, M., Hammond, K.: Type-based allocation analysis for co-recursion in lazy functional languages. In: Programming Lan- guages and Systems: 24th European Symposium on Programming, ESOP 2015, Held as Part of the European Joint Conferences on Theory and Prac- tice of Software, ETAPS 2015, London, UK, April 11-18, 2015, Procee...
-
[29]
209–228 (2013).https://doi.org/10
Vazou,N.,Rondon,P.M.,Jhala,R.:Abstractrefinementtypes.In:European Symposium on Programming, pp. 209–228 (2013).https://doi.org/10. 1007/978-3-642-37036-6_13
work page 2013
-
[30]
Wang, D., Kahn, D.M., Hoffmann, J.: Raising expectations: automating ex- pected cost analysis with types. Proceedings of the ACM on Programming Languages4(ICFP), 1–31 (2020).https://doi.org/10.1145/3408992 24 A. Walch et al. Table 2: Exact cost bounds ofmeldanddelete_minfor skew and leftist heaps. Potentialmeld delete_min skew heap Φ[t<u] log2(|y|+|x| −1)...
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.