CHAD:组合同态自动微分
CHAD: Combinatory Homomorphic Automatic Differentiation
摘要:
我们介绍了组合同态自动微分(CHAD),一个原则性的,纯粹的,可证明正确的定义,然后运行的方法进行正向和反向模式自动微分(AD)的程序设计语言的表达功能。它将AD实现为一种组合的、与类型相关的源代码转换,生成纯函数代码。这种代码转换是原则性的,因为它是艾略特对一阶函数语言的AD的著名和明确定义的表达语言的唯一同态(结构保持)扩展。该方法的正确性遵循(组合)逻辑关系参数,表明语法衍生物的语义是原始程序的语义的通常演算衍生物。在它们最优雅的公式中,转换生成具有线性类型的代码。然而,代码转换可以在缺乏线性类型的标准函数语言中实现:虽然正确性证明需要跟踪线性,但实际转换不需要。事实上,即使在标准的函数式语言中,我们也可以获得线性类型给我们的所有类型安全:我们可以通过使用基本模块系统来实现用于将转换类型化为抽象类型的所有线性类型。在本文中,我们详细的方法时,适用于一个简单的高阶语言操作静态大小的数组。然而,我们解释了如何应用的方法,更一般地说,与其他表达功能的函数式语言。最后,我们讨论了如何CHAD的范围扩展到AD中的应用程序以外的其他动态程序分析,积累数据在一个交换幺半群。
英文摘要:
We introduce Combinatory Homomorphic Automatic Differentiation (CHAD), a principled, pure, provably correct define-then-run method for performing forward and reverse mode automatic differentiation (AD) on programming languages with expressive features. It implements AD as a compositional, type-respecting source-code transformation that generates purely functional code. This code transformation is principled in the sense that it is the unique homomorphic (structure preserving) extension to expressive languages of Elliott's well-known and unambiguous definitions of AD for a first-order functional language. Correctness of the method follows by a (compositional) logical relations argument that shows that the semantics of the syntactic derivative is the usual calculus derivative of the semantics of the original program. In their most elegant formulation, the transformations generate code with linear types. However, the code transformations can be implemented in a standard functional language lacking linear types: while the correctness proof requires tracking of linearity, the actual transformations do not. In fact, even in a standard functional language, we can get all of the type-safety that linear types give us: we can implement all linear types used to type the transformations as abstract types, by using a basic module system. In this paper, we detail the method when applied to a simple higher-order language for manipulating statically sized arrays. However, we explain how the methodology applies, more generally, to functional languages with other expressive features. Finally, we discuss how the scope of CHAD extends beyond applications in AD to other dynamic program analyses that accumulate data in a commutative monoid.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。