paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Domain-specific tensor languages

领域特定张量语言
JFP vol.352025匹配度 3/10 · 论文关注嵌入 Haskell 的张量 EDSL、索引记法与代数语义,属于函数式编程/DSL 方向,与用户核心关注的静态分析、LLM/Agent、浮点程序分析及贝叶斯程序分析没有直接交集;仅在“机器学习系统/张量语言”层面存在边缘关联。引用 0 inbox
JEAN-PHILIPPE BERNARDY, PATRIK JANSSON
crossref: 2026-09-10

AI 速览

一句话:提出嵌入 Haskell 的 EDSL,以索引记法表达张量并用代数结构定义语义。

张量记号在数学多个领域广泛使用,却未被函数式编程社区普遍支持。现有张量代数 DSL 要么面向数组、未能利用张量代数性质,要么遵循范畴结构但要求不便的无点(point-free)风格。更根本地,张量微积分教学常默认读者接受程序员难以承受的记号自由,并忽视变量绑定、语法与语义等语言层面问题。本文指出标准张量记号的一些性质从 λ 演算视角看颇为特殊,进而定义一种嵌入 Haskell 的 DSL,其语法贴近文献常用的张量索引记法,并以定义张量的代数结构给出语义。作者认为该 EDSL 既可用于科学计算,也可作为表达和呈现张量理论及应用的载体。摘要未报告实验评估。

问题
张量记号虽在数学中广泛使用,但函数式编程社区缺乏良好支持;现有张量 DSL 要么不利用张量代数结构,要么强制使用难以操作的无点风格,且教学材料常忽略其语法与语义等语言层面问题。
方法
定义一种嵌入 Haskell 的领域特定语言,使其语法贴近标准张量索引记法,并依据定义张量的代数结构来给出该 EDSL 的语义。
评估
摘要未报告基准测试或用户研究;论文主要通过 Haskell 嵌入实现与代数语义定义来论证该 DSL 可同时用于科学计算和张量理论的表达与呈现。
原文摘要(Abstract)

Abstract The tensor notation used in several areas of mathematics is a useful one, but it is not widely available to the functional programming community. In a practical sense, the (embedded) domain-specific languages ( dsl s) that are currently in use for tensor algebra are either 1. array-oriented languages that do not enforce or take advantage of tensor properties and algebraic structure or 2. follow the categorical structure of tensors but require the programmer to manipulate tensors in an unwieldy point-free notation. A deeper issue is that for tensor calculus, the dominant pedagogical paradigm assumes an audience which is either comfortable with notational liberties which programmers cannot afford, or focus on the applied mathematics of tensors, largely leaving their linguistic aspects (behaviour of variable binding, syntax and semantics, etc.) for the reader to figure out by themselves. This state of affairs is hardly surprising, because, as we highlight, several properties of standard tensor notation are somewhat exotic from the perspective of lambda calculi. We bridge the gap by defining a dsl , embedded in Haskell, whose syntax closely captures the index notation for tensors in wide use in the literature. The semantics of this edsl is defined in terms of the algebraic structures which define tensors in their full generality. This way, we believe that our edsl can be used both as a tool for scientific computing, but also as a vehicle to express and present the theory and applications of tensors.

链接与引用

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

BibTeX
@article{BernardyJ25,
  title = {Domain-specific tensor languages},
  author = {JEAN-PHILIPPE BERNARDY and PATRIK JANSSON},
  journal = {Journal of Functional Programming},
  volume = {35},
  year = {2025},
  doi = {10.1017/s0956796825000048}
}