TY - JOUR
T1 - Fulls seldom differ
AU - Koch, Mark
AU - Lawrence, Alan
AU - McBride, Conor
AU - Roy, Craig
PY - 2025/8/5
Y1 - 2025/8/5
N2 - Many programs process lists by recursing in a wide variety of sequential and/or divide-and-conquer patterns. Reasoning about the correctness and completeness of these programs requires reasoning about the lengths of the lists, techniques for which are typically undecidable or at least NP-complete. In this paper we show how introducing a relatively simple (sub-)language for expressions describing list lengths, whilst not completely general, covers a great number of these patterns. It includes not only doubling but also exponentiation (iterated doubling), and moreover admits a simple length-checking algorithm that is complete over a predictable problem domain. We prove termination of the algorithm via category-theoretic pullbacks, formalized in Agda, as well as providing a more realistic implementation in Rocq, and a toy language Fulbourn with interpreter in Haskell.
AB - Many programs process lists by recursing in a wide variety of sequential and/or divide-and-conquer patterns. Reasoning about the correctness and completeness of these programs requires reasoning about the lengths of the lists, techniques for which are typically undecidable or at least NP-complete. In this paper we show how introducing a relatively simple (sub-)language for expressions describing list lengths, whilst not completely general, covers a great number of these patterns. It includes not only doubling but also exponentiation (iterated doubling), and moreover admits a simple length-checking algorithm that is complete over a predictable problem domain. We prove termination of the algorithm via category-theoretic pullbacks, formalized in Agda, as well as providing a more realistic implementation in Rocq, and a toy language Fulbourn with interpreter in Haskell.
KW - type systems
KW - functional programming
KW - length-indexed vectors
UR - https://github.com/CQCL/fulls-seldom-differ
UR - https://doi.org/10.5281/zenodo.15865590
UR - https://www.scopus.com/pages/publications/105012509159
U2 - 10.1145/3747526
DO - 10.1145/3747526
M3 - Article
SN - 2475-1421
VL - 9
SP - 616
EP - 642
JO - Proceedings of the ACM on Programming Languages (PACMPL)
JF - Proceedings of the ACM on Programming Languages (PACMPL)
IS - ICFP
ER -