CHAD for expressive total languages

被引:6
作者
Nunes, Fernando Lucatelli [1 ]
Vakar, Matthijs [1 ]
机构
[1] Univ Utrecht, Dept Informat & Comp Sci, Utrecht, Netherlands
关键词
Automatic differentiation; Software correctness; Programming languages; Scientific computing; Program transformations; Type systems; Dependently typed languages; Artin gluing; Comma categories; Logical relations; Initial algebra semantics; Creation of initial algebras; Coalgebras; Grothendieck construction; Exponentiability; Fibered categories; Polynomial functors; Linear types; Variant types; Inductive types; Coinductive types; Cartesian closed categories; Denotational semantics; Extensive indexed categories; Extensive categories; (Co)monadicity; Free cocompletion under coproducts;
D O I
10.1017/S096012952300018X
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
We show how to apply forward and reversemode Combinatory Homomorphic Automatic Differentiation (CHAD) (Vakar (2021). ESOP, 607-634; Vakar and Smeding (2022). ACM Transactions on Programming Languages and Systems 44 (3) 20:1-20:49.) to total functional programming languages with expressive type systems featuring the combination of tuple types; sum types; inductive types; coinductive types; function types. We achieve this by analyzing the categorical semantics of such types in Sigma-types (Grothendieck constructions) of suitable categories. Using a novel categorical logical relations technique for such expressive type systems, we give a correctness proof of CHAD in this setting by showing that it computes the usual mathematical derivative of the function that the original program implements. The result is a principled, purely functional and provably correct method for performing forward- and reverse-mode automatic differentiation (AD) on total functional programming languages with expressive type systems.
引用
收藏
页码:311 / 426
页数:116
相关论文
共 68 条
[61]  
Sprunger, 2023, 31 EACSL ANN C COMPU, V252
[62]  
Tu Loring W., 2011, An Introduction to Manifolds, P47
[63]  
Vakar M., 2017, ARXIV
[64]   CHAD: Combinatory Homomorphic Automatic Differentiation [J].
Vakar, Matthijs ;
Smeding, Tom .
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 2022, 44 (03)
[65]   Reverse AD at Higher Types: Pure, Principled and Denotationally Correct [J].
Vakar, Matthijs .
PROGRAMMING LANGUAGES AND SYSTEMS, ESOP 2021, 2021, 12648 :607-634
[66]  
Vytiniotis D., 2019, DIFFERENTIABLE CURRY
[67]   Demystifying Differentiable Programming: Shift/Reset the Penultimate Backpropagator [J].
Wang, Fei ;
Zheng, Daniel ;
Decker, James ;
Wu, Xilun ;
Essertel, Gregory M. ;
Rompf, Tiark .
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2019, 3 (ICFP)
[68]   A SIMPLE AUTOMATIC DERIVATIVE EVALUATION PROGRAM [J].
WENGERT, RE .
COMMUNICATIONS OF THE ACM, 1964, 7 (08) :463-464