Automatic Differentiation for ML-family languages: correctness via logical relations
Fernando Lucatelli Nunes, Matthijs V\'ak\'ar

TL;DR
This paper presents a logical relations technique to prove the correctness of automatic differentiation code transformations in ML-family functional languages, ensuring reliable forward- and reverse-mode AD.
Contribution
It introduces a novel monadic logical relations approach for recursive types and terms, providing a semantic correctness proof for AD transformations in functional languages.
Findings
Correctness proof for dual numbers style AD in ML-family languages
Unified framework for forward- and reverse-mode AD correctness
Semantic proof based on simple denotational semantics using ω-cpos
Abstract
We give a simple, direct and reusable logical relations technique for languages with term and type recursion and partially defined differentiable functions. We demonstrate it by working out the case of Automatic Differentiation (AD) correctness: namely, we present a correctness proof of a dual numbers style AD code transformation for realistic functional languages in the ML-family. We also show how this code transformation provides us with correct forward- and reverse-mode AD. The starting point is to interpret a functional programming language as a suitable freely generated categorical structure. In this setting, by the universal property of the syntactic categorical structure, the dual numbers AD code transformation and the basic -cpo semantics arise as structure preserving functors. The proof follows, then, by a novel logical relations argument. The key to much of our…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSemantic Web and Ontologies · Logic, programming, and type systems · Advanced Database Systems and Queries
