paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Synthesizing quotient lenses

合成商透镜
ICFP 2(ICFP)2018匹配度 2/10 · 论文主题是双向变换中的商透镜与基于示例的程序合成,属于形式化 PL/DSL 方向,虽包含规范化定理和工具实现,但与用户核心关注的 LLM/Agent、静态分析、浮点程序分析及贝叶斯程序分析均无直接交集。引用 13 inbox
Solomon Maina, Anders Miltner, Kathleen Fisher, Benjamin C. Pierce, David Walker, Steve Zdancewic
crossref: 2026-09-10

AI 速览

一句话:提出商正则表达式与商透镜,并利用规范化定理从示例合成双向变换。

商透镜是一类双向变换,其正确性定律由指定等价关系“放宽”,可忽略数据格式中不重要的细节(如 XML 字段顺序)。本文研究如何从高层规格合成这类透镜。作者引入商正则表达式(QRE),用注解正则表达式同时刻画正则语言及其上的等价关系;进而定义 QRE 透镜,并证明关键规范化定理:每个 QRE 透镜都可转换为功能等价的透镜,仅在“边缘”规范化源和目标数据,中间映射由双射透镜完成。基于该范型,他们从一对 QRE 与输入输出示例合成 QRE 透镜,复用已有普通双射透镜合成算法。该方法已在双向编程语言 Boomerang 中实现,并在 Optician 基准的真实数据格式间合成 QRE 透镜进行评估。

问题
如何从高层规格或示例合成商透镜,以在忽略格式中不重要的等价细节的同时保持双向变换的正确性。
方法
引入商正则表达式(QRE)与 QRE 透镜,证明可将任意 QRE 透镜规范化为只在边缘做规范化、内部使用双射透镜的形式,并据此复用普通双射透镜合成算法从 QRE 对和示例合成 QRE 透镜。
评估
在双向编程语言 Boomerang 中实现 QRE 与 QRE 透镜合成,并在 Optician 基准的真实数据格式上合成 QRE 透镜,验证方法有效性。
原文摘要(Abstract)

Quotient lenses are bidirectional transformations whose correctness laws are “loosened” by specified equivalence relations, allowing inessential details in concrete data formats to be suppressed. For example, a programmer could use a quotient lens to define a transformation that ignores the order of fields in XML data, so that two XML files with the same fields but in different orders would be considered the same, allowing a single, simple program to handle them both. Building on a recently published algorithm for synthesizing plain bijective lenses from high-level specifications, we show how to synthesize bijective quotient lenses in three steps. First, we introduce quotient regular expressions (QREs), annotated regular expressions that conveniently mark inessential aspects of string data formats; each QRE specifies, simulteneously, a regular language and an equivalence relation on it. Second, we introduce QRE lenses , i.e., lenses mapping between QREs. Our key technical result is a proof that every QRE lens can be transformed into a functionally equivalent lens that canonizes source and target data just at the “edges” and that uses a bijective lens to map between the respective canonical elements; no internal canonization occurs in a lens in this normal form. Third, we leverage this normalization theorem to synthesize QRE lenses from a pair of QREs and example input-output pairs, reusing earlier work on synthesizing plain bijective lenses. We have implemented QREs and QRE lens synthesis as an extension to the bidirectional programming language Boomerang. We evaluate the effectiveness of our approach by synthesizing QRE lenses between various real-world data formats in the Optician benchmark suite.

链接与引用

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

BibTeX
@article{paperbot289,
  title = {Synthesizing quotient lenses},
  author = {Solomon Maina and Anders Miltner and Kathleen Fisher and Benjamin C. Pierce and David Walker and Steve Zdancewic},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {2},
  number = {ICFP},
  year = {2018},
  doi = {10.1145/3236775}
}