English

Bottom-up computation using trees of sublists (Functional Pearl)

Programming Languages 2024-03-05 v2

Abstract

Some top-down problem specifications, if executed directly, may compute sub-problems repeatedly. Instead, we may want a bottom-up algorithm that stores solutions of sub-problems in a table to be reused. It can be tricky, however, to figure out how the table can be represented and efficiently maintained. We study a special case: computing a function hh taking lists as inputs such that h xsh~xs is defined in terms of all immediate sublists of xsxs. Richard Bird studied this problem in 2008, and presented a concise but cryptic algorithm without much explanation. We give this algorithm a proper derivation, and discover a key property that allows it to work. The algorithm builds trees that have certain shapes -- the sizes along the left spine is a diagonal in Pascal's triangle. The crucial function we derive transforms one diagonal to the next.

Keywords

Cite

@article{arxiv.2311.18528,
  title  = {Bottom-up computation using trees of sublists (Functional Pearl)},
  author = {Shin-Cheng Mu},
  journal= {arXiv preprint arXiv:2311.18528},
  year   = {2024}
}

Comments

Submitted to Journal of Functional Programming

R2 v1 2026-06-28T13:36:55.050Z