Papers for

programming language developers

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.

Category theory library supports reusable programming language proofs

Logical Relations on Display

Abstract: The metatheory of programming languages suffers from a lack of reuse. Researchers develop individual calculi and prove standard properties, but very few results are truly reused across papers. The problem is worse in proof assistants, where developments routinely duplicate code from prior work or rebuild it from scratch. Category theory provides the most promising path toward reusable programming language semantics. Universal properties capture the type connectives---products, functions, sums---together with their $β$/$η$ laws. Free categorical structures identify syntactic calculi. \emph{Displayed} categories provide a uniform language for specifying logical relations, and general theorems about fibrations allow their structure to be assembled compositionally. In this work we develop a library of formalized category theory in the Cubical Agda proof assistant directly applicable to programming language metatheory. We develop theories of universal properties and free categorical structures, apply them to define denotational semantics and logical relations for simply typed calculi, and identify encodings of the categorical constructions that make typechecking them tractable. From the same categorical components, we construct several familiar results via a logical relations construction---canonicity,parametricity,conservativity---and provide a proof of coherence for monoidal categories.

Mon 16 NovProgramming LanguagesLogic in Computer Science
The gist
Programming language researchers often redo similar math work, making it hard to reuse their proofs and tools. This paper presents a library that uses category theory to capture key properties of programming languages and logical relations in a reusable way. The authors build this library inside a proof assistant, which checks the math details, and they use it to prove important results about simple programming language features. This approach could help developers and researchers avoid repetitive work by providing shared, composable building blocks.
Open → 2611.21826v1

Session types can fully model complex asynchronous processes

On the Expressiveness of Asynchronous Processes with Nested Session Types

Abstract: Session types are a type-based approach to correct message-passing programs, where types specify protocols for channels and type checking guarantees communication correctness. Traditional session types express regular protocols only, which leaves out many protocols found in practice. Aiming at overcoming this limitation, Nested Session Types (NSTs) can specify nested recursive protocols. NSTs are known to be characterised by one-counter machines and deterministic context-free languages. In this paper, we study the expressiveness of ASP (Asynchronous Session Processes), the process model associated with NSTs as introduced by Das et al. We prove that AST is Turing complete by giving a correct encoding of two-counter machines into typed processes. Our encoding uses a non-trivial state-aware representation of counters and instructions that is neatly governed by NSTs.

Fri 23 OctProgramming LanguagesDistributed, Parallel, and Cluster Computing
The gist
Communication protocols must be correct to avoid errors, but traditional types used to check these protocols only handle simple patterns. The authors study Nested Session Types (NSTs), which can describe more complex and nested communication sequences. They show that the corresponding process model, ASP, is powerful enough to perform any computation a Turing machine can, by representing counters and instructions through NSTs. This means NSTs capture very complex communication behaviors that were not previously possible with basic session types.
Open → 2610.32558v1

Typechecking works without minimum types in advanced programming systems

Typechecking without Minimum Types: Finite Bases and Backward Checking for $F_{<:}^{\top}$

Abstract: System $F_{<:}^{\top}$ has decidable subtyping but lacks minimum types. We prove that typechecking is decidable for arbitrary explicitly annotated terms with unrestricted subsumption. The difficulty is that type abstraction uses a variable's declared bound to type its body, while quantified subtyping forgets that bound. We construct finite covers that preserve all required subtype comparisons across this change of context. These covers yield a compositional finite typing basis and a decision procedure. We then derive a backward checker that propagates acceptable targets without constructing the complete typing basis. Rectangularity of typing families gives a uniform elimination domain while retaining every result type, even when the canonical type is not least. Finite inverse families transport targets through type substitution. The same inverse specification recovers bound forgetting and yields finite type-avoidance families. Both typechecking procedures are total Rocq functions proved equivalent to the original typing judgment. For a separate symbolic word-RAM realization, we prove a quartic worst-case work bound. We measure family representation sizes and comparison storage in independent OCaml prototypes on synthetic checking judgments.

Wed 14 OctProgramming Languages
The gist
Some programming languages use a system of types to catch errors before running code, but certain advanced type systems have challenges with deciding if a piece of code is correct. This paper shows a way to decide type correctness even when the standard tool of 'minimum types' is missing. The authors construct special finite structures that keep track of all subtype relationships needed and develop backward checking methods that avoid building these structures fully. They also prove that their methods are correct and measure their efficiency using computer prototypes.
Open → 2610.20356v1

Reusable modal logic framework simplifies reasoning across domains

Library-Grade Modal Logic

Abstract: Modal logic comprises a broad family of logics to reason about relational structures. The literature presents many such logics, displaying diverse operators, semantics, and applications. This plurality is reflected in a zoo of mechanised modal logics, which often duplicate syntax, semantics, metatheory, and reasoning infrastructure. We present a library-grade formalisation of modal logic in Lean, developed as part of CSLib (the Lean Computer Science Library) and designed around two complementary forms of reuse: vertical reuse, whereby specialised logics inherit from common abstractions, and horizontal reuse, whereby modal logic becomes a reasoning tool for independently formalised domains. Our development provides a generic framework for polyadic modal languages, reusable metatheory and proof automation, and derived interfaces for specialised modal logics. We exemplify our infrastructure by deriving basic modal logic, basic temporal logic, and Hennessy-Milner Logic; the latter subsumes and extends CSLib's previous implementation while reducing its logic-specific code by 67%. We further apply the same modal infrastructure to reasoning about mathematics (radicals of ideals), theory of programming languages (the type safety strategy for the simply typed $λ$-calculus), and concurrency theory (reasoning about processes in the Calculus of Communicating Systems). Our experience suggests that reuse, automation, and integration with the strong Lean ecosystem should be treated as first-class design concerns when formalising theories for shared libraries.

Sat 3 OctLogic in Computer Science
The gist
Modal logic is a way to think about relationships between things, but many versions exist with repeated work in their details. The authors created a shared library in the Lean programming language that lets different kinds of modal logics reuse common parts and tools. This helps build new logics faster and connect modal logic reasoning to other fields like math, programming languages, and process communication. Their library reduces repetitive code and supports better automation and integration in formal reasoning.
Open → 2610.04511v1

Lean tactic enables flexible proof rewriting across related types

A Transfer Tactic for Lean

Abstract: Rewriting in proof assistants spans a strict hierarchy. Equational rewriting substitutes based on extensional equality; subequational rewriting substitutes based on homogeneous relations such as $\leq$ or $\subseteq$, justified by monotonicity lemmas; and generalized rewriting relates different operations across different types, justified by transfer rules. All three are specializations of one schema, the function relator $(R \Rightarrow S)\,f\,g$. Lean 4's rw and Mathlib's grw/gcongr implement the first two levels, but the third has had no Lean implementation. We present one: a transfer tactic family over a tagged rule database, benchmarked using Mathlib's own test suites, of which 112 of 178 ported tests close through the transfer engine. An evaluation of the design's three motivating hypotheses returns a mixed result: generality holds, authoring effort wins in its amortized form (averaged per use), but on dependency footprint, transfer only ties a mature library and loses on coercions. This shows that transfer's value is concentrated on transferring into domains where few theorems exist.

Sat 26 SeptLogic in Computer Science
The gist
In computer-assisted math proofs, rewriting helps replace parts of proofs with equivalent or related expressions. There are different levels of rewriting, each allowing more flexibility but needing more complex justifications. The authors created a new tactic for the Lean 4 system that supports the most flexible kind, which works across different types and operations. This tactic uses a database of tagged rules to automate these transfers and was tested on many existing proofs, successfully closing many cases. The evaluation showed the tactic is broadly useful and saves effort over time, especially where few existing theorems are available.
Open → 2609.32115v1

Modular composing of user-defined data types in lean proof assistant

Modular Composition of Inductive Types Using Lean Meta-programming

Abstract: Inductive types are ubiquitous building blocks in many programming and theorem proving languages. An inductive type is a closed set of constructors from which values of the type can be created. That set cannot be extended though once a type is defined. This limits extensibility, reuse, and modular separation of concerns when defining types and functions operating over their values. This limitation is manifested in the expression problem, where extending an expression language with new syntactic constructors without having to modify or re-compile existing ones is a challenge in almost all programming languages. This paper presents inductive type and function implementation composition algorithms based on meta-programming. In addition, a set of syntactic extensions to the Lean proof assistant implementing those algorithms are presented. This framework allows for modular reuse, composition, and extension of a subset of Lean type and function definitions. In addition, semantic subtyping relations between component and composite types are discussed both at the type theoretic and implementation levels. The framework is demonstrated on a case study, involving the composition of syntactic and semantic artifacts of three sublanguages into one language. The case study highlights both the features and limitations of the composition framework.

Mon 21 SeptProgramming LanguagesLogic in Computer ScienceSoftware Engineering
The gist
Programming languages often have fixed building blocks called inductive types, which can't be changed once made, limiting how you can extend or combine them. The authors develop new techniques using meta-programming in the Lean proof assistant to compose and extend these types more flexibly. They also present new Lean language features that let programmers reuse and build on parts of their code without rewriting everything. A case study shows how their method can combine parts of three smaller languages into a bigger one, revealing benefits and current limits of the approach.
Open → 2609.25427v1

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

Monadic interpreter and checker keep type effects separate in haskell

A monadic interpreter and type-and-effect checker

Abstract: We present a concrete implementation in Haskell of a monadic framework that includes both a small-step interpreter and a type-and-effect checker for the corresponding language. Our approach separates the language syntax from the semantics of its effects. This design allows the interpreter to remain parametric over the underlying monad, while the static checker approximates effects independently of their concrete implementation. The theoretical foundation of this framework-applied to a call-by-value lambda calculus with generic effects represented by operations that produce monadic values and are managed through handlers-was introduced in previous work, where the focus was on proving the soundness of the approach. In contrast, the present work leverages Haskell's support for modular programming and monads to demonstrate that the framework is practically implementable and usable. We illustrate the approach with examples using the monad of exceptions and the one of nondeterminism and expressions both with and without handlers.

Mon 7 SeptProgramming Languages
The gist
Programs often have side effects like errors or running multiple options, and it's useful to keep track of these effects when running or analyzing code. The authors show how to build a small-step interpreter and a type-and-effect checker using Haskell that cleanly separates the syntax of a language from how these effects work. This allows different kinds of effects to be plugged in without changing the core interpreter, and a checker can estimate effects without depending on their exact details. Their work demonstrates that a previously theoretical framework can be implemented practically in Haskell and used with examples like exceptions and nondeterminism.
Open → 2609.07667v1