Papers for

functional programmers

Papers whose findings have a practical use for this group, as judged from the abstract. Open a paper to read what it means in practice.

Tool generates verified navigation code for algebraic data structures

Datatypes In, Zippers Out!

Abstract: A zipper represents a focused position in an algebraic data structure together with the context needed to reconstruct the whole. Datatype derivatives determine one-hole context types, but do not by themselves choose a zipper's concrete representation or specify navigation costs and demands. We present Kamot, a tool that converts regular algebraic datatype declarations in a restricted Haskell fragment into zipper implementations with operational contracts. Navigation, replacement, and reconstruction are proved correct against a reference traversal. Kamot supports mutual recursion and regular containers inside containers. A compositional analysis derives sound bounds on transitions and constructor demands for certified traversal directions. These bounds are affine in trail depth (the number of saved frames) and guarantee termination of each move on productive, potentially infinite inputs. For inhabited families the analysis is complete: when no move certificate is emitted, no bound depending only on trail depth exists, and some productive input makes a move diverge. We prove that the generated code preserves results and the reference order of constructor matches, including finite prefixes of divergent searches. Lean 4 verifies simulation, bounds, and completeness for finite values of single self-recursive datatypes, in both directions. On 19 datatype models and 81 generated families, every generated module passes Haskell type checking, and independent checkers validate certificates, traces, and bounds. In a prefetching workload, starting only searches whose bounds fit a budget answers every local query and avoids discarded source evaluations on long returns, but conservative bounds can lose answers that fuelled search delivers.

Tue 17 NovProgramming Languages
The gist
Manipulating complex data structures can be tricky, especially when you want to focus on one part without losing sight of the whole. The authors created a tool called Kamot that automatically generates precise and verified navigation code for these structures, ensuring moves like looking around or replacing parts are correct and efficient. They proved their tool’s correctness and worked with many example data types, showing it handles complicated cases and infinite inputs well. This helps developers build reliable software that navigates data safely and predictably.
Open → 2611.22572v1

Category theory result ties cartesian closedness to coproduct completion

Cartesian closedness of lax comma categories

Abstract: For a finitely complete category X, we prove that the lax comma category Cat//X is cartesian closed if and only if its free coproduct completion Fam(X) is cartesian closed. The proof uses a change-of-base theorem: postcomposition with a functor induces a left adjoint between lax comma categories precisely when that functor is a left multiadjoint. We describe the exponentials and derive examples from known results on family categories.

Sat 31 OctProgramming Languages
The gist
The authors explore a specific math structure called a 'lax comma category' and show it has a particular property, called cartesian closedness, exactly when a related construction called the 'free coproduct completion' does too. They use a technical tool that links functors and triangle-like diagrams to prove their result. This helps clarify when certain constructions in category theory behave nicely and provides examples based on earlier knowledge. Overall, their work connects two different categorical ideas with precise conditions.
Open → 2611.01184v1

Linear lambda calculus supports arbitrary functors as computational modalities

Arbitrary Functors as Modalities in a Linear Calculus

Abstract: We study modalities in the linear lambda calculus, by interpreting them as endofunctors in monoidal closed categories. We support functors that do not distribute over products, including (co)monads. We also support arbitrary natural transformations as conversion between modalities. We provide a generic categorical semantics, which we then specialise to a sound and complete resource semantics. We use this resource semantics to derive normalisation by evaluation. Along the way, we describe several applications of such models. This work aims at providing a foundation for future programming languages with modalities. The paper is backed by a mechanisation in Agda.

Fri 16 OctProgramming Languages
The gist
This paper looks at how certain features called modalities can be used inside a version of programming language theory called linear lambda calculus, which carefully tracks resources. The authors interpret these features using mathematical structures called functors, even when those functors don't behave in usual ways like distributing over products. They provide a general mathematical model and then focus on one that describes resources concretely. This lets them develop a method to simplify expressions systematically. Their approach is backed by formal computer-verified proofs to ensure correctness. The work sets the stage for new kinds of programming languages that can use these complex modality features.
Open → 2610.23023v1

Guarded recursion support embedded in Lean for safer programming

Garlene: Guarded Recursion in Lean

Abstract: Extending the recursion principles of a formal system is an enticing but dangerous endeavour with a well-documented history of leading to consistency bugs. Nakano's guarded recursion is an elegant, type-based approach to soundly extend type theory with a powerful recursion principle. This makes guarded recursion useful for many applications, from programming with infinite structures such as streams to reasoning about advanced programming language features using synthetic guarded domain theory. Sadly, guarded recursion is not directly supported by any major interactive theorem prover, which leaves users of guarded recursion with unmechanised pen-and-paper proofs or mechanisations that depend on unmaintained theorem provers. In this paper, we present an implementation of guarded recursion as an embedded language in Lean consisting of a simply-typed lambda calculus for definitions and a higher-order logic for reasoning. Using Lean's excellent support for metaprogramming, our language allows users to write guarded recursive definitions in an intuitive syntax and to prove properties about them using a dedicated proof mode. We give our language a presheaf model, which we use to prove the soundness of our language and to allow users to export guarded recursive definitions and their theorems into standard Lean developments. To demonstrate the usefulness of our language, we present several case studies for programming and reasoning with guarded recursion.

Mon 21 SeptLogic in Computer ScienceProgramming Languages
The gist
Extending recursion rules in formal systems can cause serious errors, but a technique called guarded recursion helps prevent these problems. The authors created a tool inside the Lean theorem prover that allows writing and reasoning about guarded recursive definitions more safely. They built a special model to prove their tool works correctly and let users move their guarded recursion work into standard Lean code. This makes it easier to work with infinite structures and advanced programming concepts in Lean.
Open → 2609.24345v1

Bluebird and mockingbird combinators cannot create fixed-point functions

Bluebirds and mockingbirds cannot produce a fixed-point combinator

Abstract: Let $B$ be the bluebird combinator with reduction rule $Bxyz \to_{w} x\left(yz\right)$, let $M$ be the mockingbird combinator with reduction rule $Mx \to_{w} xx$, and let $I$ be the identitybird combinator with reduction rule $Ix \to_{w} x$. For a fixed variable $x$, we construct an invariant $\mathrm{Tr}_{x}\left(u\right)$ of a $BMI$-term $u$ with respect to $\to_{w}$. This invariant traces the occurrences of $x$ in the leftmost-innermost reduction sequence of $u$. We then prove that $\mathrm{Tr}_{x}\left(Yx\right) \neq \mathrm{Tr}_{x}\left(x^{r}\left( Yx \right)\right)$ for every $x$-free $BMI$-term $Y$ and every $r\geq 1$. Consequently, there exists no fixed-point combinator in $BMI$-combinatory logic under weak equivalence. This provides a negative answer to the problem posed by Smullyan in 1985.

Fri 18 SeptLogic in Computer Science
The gist
This paper solves a long-standing question about certain building blocks of computer programs called combinators. The authors show that two particular combinators, known as bluebird and mockingbird, cannot be used together to create a fixed-point combinator, which is a tool that lets programs call themselves repeatedly. They developed a way to track variables during the program transformations to prove this. This means a class of programming tools has intrinsic limitations.
Open → 2609.21765v1