Work

Toepassingen van functioneel modelleren aan de hand van abstracte algebra: hogere-orde effecten en automatische differentiatie

Year: 2023
Type: dissertation
Abstract: algebra is the field that studies the underlying algebraic structures of a programming language, such as rings, monoids, and modules. It leverages insights into their fundamental properties and behavior. The goal of this work is to use abstract algebra to better understand two different concepts: computational effects and automatic differentiation. The first part of this thesis studies higher-order effects & handlers, an extension of algebraic effects & handlers where effects can contain an internal computation. Examples are scoped effects, that have a computation in scope; latent effects, that defer a computation; and parallel effects, that parallelize different computations. We abstract over these and other classes of effects, using a generic framework that is based on a free-forgetful adjunction. This generalization retains the separation of syntax and semantics, one of the coveted properties of algebraic effects & handlers, but also adds a challenge in terms of forwarding unknown effects. We show that different classes of effects each form an instance of our framework. Furthermore, we define operational semantics for scoped effects by extending Eff, a calculus that supports algebraic effects as built-in primitives. The second part of this thesis applies abstract algebra to differentiation algorithms. We show that the essence of (both symbolic and automatic) differentiation can be captured in a oneliner: an abstract differentiation function that is based on three algebraic structures. First, we introduce the notion of semimodules (modules over a semiring). Second, we generalize dual numbers into Nagata numbers, where the two components can have distinct types. Third, we need Kronecker's delta function, and Kronecker isomorphisms in order to devise correct-by-construction variants of automatic differentiation. We show that subsequent versions of the differentiation algorithm have improved computational complexity, starting from the naive symbolic differentiation via forward-mode automatic differentiation to the efficient reverse-mode with mutable arrays. Thus, having generalized and formalized two popular programming concepts (computational effects and automatic differentiation), we aim to provide a better understanding of their underlying formalisms, and to facilitate programming with them.
Language: English
Subfield: Software
Open Access status: green
OpenAlex ID: W7025140001
Cites: 139
Cited by:
Related to: 10