We show how to apply forward and reverse mode Combinatory Homomorphic Automatic Differentiation (CHAD) 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 analysing 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.
翻译:我们展示如何将前向和反向组合同态自动微分(Combinatory Homomorphic Automatic Differentiation,CHAD)应用于具有表达式类型系统的总泛函编程语言,这些类型系统具有以下组合:元组类型,总和类型,归纳类型,余归纳类型,函数类型。我们通过分析这些类型在适当范畴内的 Σ-类型(Grothendieck构造)的范畴语义来实现。使用一种新颖的范畴逻辑关系技术,我们为这些具有表达式类型系统的泛函编程语言提供了CHAD的正确性证明,证明它可以计算原始程序实现的函数的常规数学导数。结果是一种基于原理的、纯函数式的、可证明正确的方法,用于在具有表达式类型系统的总泛函编程语言上执行前向和反向模式自动微分(AD)。