一句话:用范畴论统一刻画程序分析鲁棒性,并给出设计鲁棒分析的通用方法。
程序分析结果常被期望随程序变化而可预测地改变,但许多分析并不具备这种鲁棒性。本文提出范畴论框架:将程序及其性质组织为范畴,把鲁棒分析刻画为保持结构的函子;变量重命名不变性、单调性等鲁棒性质可通过实例化范畴箭头得到。作者进一步给出获得鲁棒性的方法:一是从受限(亚图灵)计算模型上的可靠且鲁棒分析,提升为一般程序的可靠且鲁棒分析,并用该配方解释若干已有循环摘要与终止分析;二是证明若代数程序分析由鲁棒算子构成,则其本身鲁棒,并在变量重命名、循环展开等重构下表现可预测。
Users of program analyses expect that results change predictably in response to changes in their programs, but many analyses do not ensure such robustness. This paper introduces a theoretical framework that provides a unified language to articulate robustness properties. We adopt a categorical view in which programs and their properties form a category, and robust analyses are characterized as structure-preserving functors. A diverse range of robustness properties---e.g., invariance under variable renaming and monotonicity---arise from instantiating the category's arrows accordingly. Beyond formulating the meaning of robustness, this paper provides methods for achieving it. The first is a general recipe for designing robust analyses, by lifting a sound and robust analysis from a restricted (sub-Turing) model of computation to a sound and robust analysis for general programs. This recipe demystifies the design of several existing loop summarization and termination analyses by showing they are instantiations of this general recipe, and furthermore elucidates their robustness properties. The second is a characterization of a sense in which an algebraic program analysis is robust, provided that it is comprised of robust operators. In particular, we show that such analyses behave predictably under common refactoring patterns, such as variable renaming and loop unrolling.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@article{KincaidZ26,
title = {A Categorical Basis for Robust Program Analysis},
author = {Zachary Kincaid and Shaowei Zhu},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {PLDI},
year = {2026},
doi = {10.1145/3808307}
}