We give a simple, direct and reusable logical relations technique for languages with recursive features and partially defined differentiable functions. We do so by working out the case of Automatic Differentiation (AD) correctness: namely, we present a proof of the dual numbers style AD macro correctness for realistic functional languages in the ML-family. We also show how this macro provides us with correct forward- and reverse-mode AD. The starting point was to interpret a functional programming language in a suitable freely generated categorical structure. In this setting, by the universal property of the syntactic categorical structure, the dual numbers AD macro and the basic $\omega$-cpo-semantics arise as structure preserving functors. The proof follows, then, by a novel logical relations argument. The key to much of our contribution is a powerful monadic logical relations technique for term recursion and recursive types. It provides us with a semantic correctness proof based on a simple approach for denotational semantics, making use only of the very basic concrete model of $\omega$-cpos.
翻译:我们为具有递归特性和部分定义不同功能的语言提供了简单、直接和可重复使用的逻辑关系技术。我们通过研究自动差异(AD)正确性的例子来这样做:即,我们为ML-Family中现实功能语言提供了双重数字样式AD宏正确性的证据。我们还展示了这个宏如何为我们提供正确的前向和反向模式AD。起点是在一个适当的自由生成的绝对结构中解释一种功能性编程语言。在这个环境中,通过综合绝对结构的普遍属性,二倍数字AD宏和基本的$\omega$-cpo-semantics作为结构的保护玩家出现。随后,我们的证据以新的逻辑关系论为根据。我们贡献的许多关键是术语递归和递归型的强烈的双元逻辑关系技术。它为我们提供了一个基于简单说明性语义学的语义正确性证据,仅使用美元/omega$-cpos的非常具体的模式。