paperbot · PL 论文追踪

RSS

Contract lenses: Reasoning about bidirectional programs via calculation

JFP vol.332023
HANLIANG ZHANG, WENHAO TANG, RUIFENG XIE, MENG WANG, ZHENJIANG HU

尚未生成 AI 速览(可能缺少 API key 或等待下次运行补跑)。

原文摘要(Abstract)

Abstract Bidirectional transformations (BXs) are a mechanism for maintaining consistency between multiple representations of related data. The lens framework, which usually constructs BXs from lens combinators, has become the mainstream approach to BX programming because of its modularity and correctness by construction. However, the involved bidirectional behaviors of lenses make the equational reasoning and optimization of them much harder than unidirectional programs. We propose a novel approach to deriving efficient lenses from clear specifications via program calculation, a correct-by-construction approach to reasoning about functional programs by algebraic laws. To support bidirectional program calculation, we propose contract lenses , which extend conventional lenses with a pair of predicates to enable safe and modular composition of partial lenses. We define several contract-lens combinators capturing common computation patterns including $\textit{fold}, \textit{filter},\textit{map}$ , and $\textit{scan}$ , and develop several bidirectional calculation laws to reason about and optimize contract lenses. We demonstrate the effectiveness of our new calculation framework based on contract lenses with nontrivial examples.

链接与引用

DOI 原文 ·

BibTeX
@article{paperbot2154,
  title = {Contract lenses: Reasoning about bidirectional programs via calculation},
  author = {HANLIANG ZHANG and WENHAO TANG and RUIFENG XIE and MENG WANG and ZHENJIANG HU},
  journal = {Journal of Functional Programming},
  volume = {33},
  year = {2023},
  doi = {10.1017/s0956796823000059}
}