paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Linear Types with Dynamic Multiplicities in Dependent Type Theory (Functional Pearl)

依赖类型论中具有动态重数的线性类型(函数式珍珠)
ICFP 9(ICFP)2025匹配度 1/10 · 该论文属于纯类型论/函数式编程方向,讨论线性类型与依赖类型中的动态重数,与用户关注的静态分析×LLM/Agent、浮点程序分析、贝叶斯程序分析几乎没有交集。虽然同属PL领域,但未涉及LLM、Agentic程序、工业落地或相关benchmark,因此匹配度很低。引用 1 inbox
Maximilian Doré
crossref: 2026-09-10

AI 速览

一句话:在依赖类型论内嵌线性类型系统,支持动态重数,为更多函数式程序给出精确类型。

本文在依赖类型论内部构造线性类型系统,以解决线性与依赖类型结合时难以精确刻画输入使用次数的问题。核心做法是让程序输出类型携带一个 bag,其中包含各输入变量的若干副本,副本数量称为重数;再定义依赖类型,确保程序恰好按给定重数使用每个输入。由于系统深度嵌入函数式语言,重数可动态计算,从而表达某输入的使用次数随其他输入变化的情形。作者用列表上的 fold、unfold 和排序等标准程序展示实用性。关键结果是:系统虽不封闭于线性函数类型,仍可用普通依赖函数实用编程,并为静态重数系统无法类型化的许多程序给出精确类型。

问题
如何在依赖类型论中集成线性类型,精确刻画程序对每个输入变量的使用次数,尤其是当该次数随其他输入动态变化时。
方法
将程序输出类型与记录各输入变量副本的 bag 关联,以副本数作为重数,并用依赖类型保证恰好按给定重数使用输入;系统深度嵌入函数式语言,因此重数可动态计算。
评估
通过构造列表上的 fold、unfold 与排序等标准程序进行评估;结果表明系统不封闭于线性函数类型,但仍可用普通依赖函数实用编程,并类型化静态重数系统无法处理的程序。
原文摘要(Abstract)

We construct a linear type system inside dependent type theory. For this, we equip the output type of a program with a bag containing copies of each of the input variables. We call the number of copies of an input variable its multiplicity. We then characterise a dependent type which ensures that a program uses exactly the given multiplicity of each input variable. While our system is not closed under linear function types, we can program in the resulting system in a practical way using usual dependent functions, which we demonstrate by constructing standard programs on lists such as folds, unfolds and sorting algorithms. Since our linear type system is deeply embedded in a functional language, we can moreover dynamically compute multiplicities, which allows us to capture that a program uses a varying number of copies of some input depending on the other inputs. We can thereby give precise types to many functional programs that cannot be typed in systems with static multiplicities.

链接与引用

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

BibTeX
@article{paperbot3043,
  title = {Linear Types with Dynamic Multiplicities in Dependent Type Theory (Functional Pearl)},
  author = {Maximilian Doré},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {ICFP},
  year = {2025},
  doi = {10.1145/3747531}
}