paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Relational cost analysis for functional-imperative programs

函数式-命令式程序的关系代价分析
ICFP 3(ICFP)2019匹配度 2/10 · 该论文属于程序语言与形式验证中的关系代价分析/类型效应系统,关注函数式-命令式程序的可变数组代价,与用户关注的 LLM/Agentic 程序静态分析、LLM 辅助静态分析、浮点或贝叶斯程序分析没有直接交集;仅在 PL/类型系统形式化与实现方面有一般性关联。引用 12 inbox
Weihao Qu, Marco Gaboardi, Deepak Garg
crossref: 2026-09-10

AI 速览

一句话:提出 ARel 类型与效应系统,用类型精化与 Hoare 式三元组追踪可变数组关系,分析函数式-命令式程序相对代价。

关系代价分析旨在形式化地界定两个程序求值代价之差,也可用于比较同一程序在两个输入上的代价差异。已有方法多用关系类型与效应系统,但难以处理会命令式更新可变数组的高阶程序。本文提出 ARel:一个面向数组操作的高阶函数式-命令式程序的关系类型与效应系统。其关键是一种轻量级类型精化机制,用于追踪两个可变数组之间的关系(差异),并与内建于类型中的 Hoare 式三元组结合,从而表达和证明若干会命令式更新数据的有趣程序的精确相对代价。作者基于双向类型检查实现了 ARel,以验证系统的可实施性与表达力。

问题
如何形式化地界定两个程序(或同一程序在两个输入上)求值代价之差,尤其是对会命令式更新可变数组的高阶函数式-命令式程序。
方法
提出关系类型与效应系统 ARel,核心是追踪两个可变数组差异的轻量级类型精化,并将 Hoare 式三元组内建到类型中以表达相对代价;实现采用双向类型检查。
评估
通过若干会命令式更新数据的程序示例展示系统能表达并证明精确的相对代价,并以基于双向类型检查的原型实现验证可行性。
原文摘要(Abstract)

Relational cost analysis aims at formally establishing bounds on the difference in the evaluation costs of two programs. As a particular case, one can also use relational cost analysis to establish bounds on the difference in the evaluation cost of the same program on two different inputs. One way to perform relational cost analysis is to use a relational type-and-effect system that supports reasoning about relations between two executions of two programs. Building on this basic idea, we present a type-and-effect system, called ARel, for reasoning about the relative cost of array-manipulating, higher-order functional-imperative programs. The key ingredient of our approach is a new lightweight type refinement discipline that we use to track relations (differences) between two mutable arrays. This discipline combined with Hoare-style triples built into the types allows us to express and establish precise relative costs of several interesting programs which imperatively update their data. We have implemented ARel using ideas from bidirectional type checking.

链接与引用

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

BibTeX
@article{paperbot615,
  title = {Relational cost analysis for functional-imperative programs},
  author = {Weihao Qu and Marco Gaboardi and Deepak Garg},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {3},
  number = {ICFP},
  year = {2019},
  doi = {10.1145/3341696}
}