paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Sparcl: a language for partially-invertible computation

Sparcl:一种部分可逆计算语言
ICFP 4(ICFP)2020匹配度 2/10 · 该论文属于纯 PL 类型系统与语言设计,研究部分可逆计算的形式化保证,不涉及用户核心关注的静态分析、ML/Agentic 程序、LLM 辅助分析、浮点程序分析或贝叶斯程序分析。仅在 PL 理论形式化层面有很远的关联。引用 14 inbox
Kazutaka Matsuda, Meng Wang
crossref: 2026-09-10

AI 速览

一句话:提出线性类型语言 Sparcl,以部分可逆为常态,构造性保证程序可逆性并将双射作为特例。

完全可逆性要求函数为双射,但直接组合双射函数来开发可逆程序过于受限。本文转而研究部分可逆函数:当某些参数被固定后函数变为可逆,例如固定加法的一个操作数,或固定 Huffman 编码中的符号频率信息。作者设计了语言 Sparcl,使部分可逆成为常态、双射成为特例,从而在不牺牲正确性的前提下获得更强表达力。设计难点在于让普通编程部分与可逆部分自由交互,同时由构造保证可逆性。Sparcl 采用线性类型,并提供类型构造子区分可逆计算数据与普通数据。论文给出语法、类型系统与语义,并证明 Sparcl 正确保证程序可逆性;通过前序/中序重建树和 Huffman 编码等例子展示其表达力。

问题
完全可逆程序要求双射函数,而直接组合双射函数过于受限,难以自然表达压缩、序列化等实际可逆计算。
方法
提出部分可逆计算语言 Sparcl,采用线性类型和区分可逆数据的类型构造子,允许普通代码与可逆代码自由交互,同时由类型系统构造性保证可逆性。
评估
给出 Sparcl 的语法、类型系统与语义,并证明其正确保证可逆性;通过树重建和 Huffman 编码等示例说明语言表达力。
原文摘要(Abstract)

Invertibility is a fundamental concept in computer science, with various manifestations in software development (serializer/deserializer, parser/printer, redo/undo, compressor/decompressor, and so on). Full invertibility necessarily requires bijectivity, but the direct approach of composing bijective functions to develop invertible programs is too restrictive to be useful. In this paper, we take a different approach by focusing on partially-invertible functions—functions that become invertible if some of their arguments are fixed. The simplest example of such is addition, which becomes invertible when fixing one of the operands. More involved examples include entropy-based compression methods (e.g., Huffman coding), which carry the occurrence frequency of input symbols (in certain formats such as Huffman tree), and fixing this frequency information makes the compression methods invertible. We develop a language Sparcl for programming such functions in a natural way, where partial-invertibility is the norm and bijectivity is a special case, hence gaining significant expressiveness without compromising correctness. The challenge in designing such a language is to allow ordinary programming (the “partially” part) to interact with the invertible part freely, and yet guarantee invertibility by construction. The language Sparcl is linear-typed, and has a type constructor to distinguish data that are subject to invertible computation and those that are not. We present the syntax, type system, and semantics of the language, and prove that Sparcl correctly guarantees invertibility for its programs. We demonstrate the expressiveness of Sparcl with examples including tree rebuilding from preorder and inorder traversals and Huffman coding.

链接与引用

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

BibTeX
@article{paperbot928,
  title = {Sparcl: a language for partially-invertible computation},
  author = {Kazutaka Matsuda and Meng Wang},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {4},
  number = {ICFP},
  year = {2020},
  doi = {10.1145/3409000}
}