paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Parsing randomness

解析随机性
OOPSLA 6(OOPSLA2)2022匹配度 2/10 · 该论文属于函数式编程与形式语义领域的 PL 理论研究(free monad、生成器/解析器统一、Brzozowski 式导数、带前置条件的数据生成),与用户画像中 PL↔AI 的两条主线(静态分析用于 Agentic/ML 系统、LLM 改进静态分析与验证)、浮点程序分析、贝叶斯程序分析均无直接交集,仅在"为缺乏 benchmark 的场景生成满足前置条件的数据"上有一点间接的测试/生成意味。引用 11 inbox
Harrison Goldstein, Benjamin C. Pierce
crossref: 2026-09-10

AI 速览

一句话:用自由生成器统一随机生成与解析,证明生成器可分解为解析器加选择序列分布,并借助导数实现带前置条件的数据生成。

随机数据生成器可视为随机性流的解析器,这一视角在 PL 社区虽为常识却未被形式化。本文基于 freer monad 提出 free generator,用统一结构刻画解析与生成,使二者关系精确化。由此证明一个 monadic 生成器可分解为解析器与对选择序列的分布。Free generator 还支持类似形式语言中 Brzozowski 导数的导数概念,使分析工具能“预览”某个生成器选择的效果。基于该理论,作者给出一种新算法,用于生成满足用户指定前置条件的数据结构。

问题
随机数据生成器与解析器之间的直观联系缺乏形式化,且其理论后果未被充分探索;同时如何生成满足前置条件的数据结构也是待解问题。
方法
基于 freer monad 构造 free generator,统一解析与生成,引入导数以分析选择效果,并证明 monadic 生成器可分解为解析器加选择序列分布。
评估
评估以形式化证明和算法设计为主:给出分解定理与导数性质,并据此设计满足前置条件的数据结构生成算法;摘要未报告实验评估。
原文摘要(Abstract)

Random data generators can be thought of as parsers of streams of randomness. This perspective on generators for random data structures is established folklore in the programming languages community, but it has never been formalized, nor have its consequences been deeply explored. We build on the idea of freer monads to develop free generators, which unify parsing and generation using a common structure that makes the relationship between the two concepts precise. Free generators lead naturally to a proof that a monadic generator can be factored into a parser plus a distribution over choice sequences. Free generators also support a notion of derivative, analogous to the familiar Brzozowski derivatives of formal languages, allowing analysis tools to "preview" the effect of a particular generator choice. This gives rise to a novel algorithm for generating data structures satisfying user-specified preconditions.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1408,
  title = {Parsing randomness},
  author = {Harrison Goldstein and Benjamin C. Pierce},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {OOPSLA2},
  year = {2022},
  doi = {10.1145/3563291}
}