arXiv:2610.27519cs.PLOct 2026

Manuscript Offprint

arXiv:2610.27519

Record Types Everywhere

Matthew Toohey, Ara Jamalzadeh, Ningning Xie

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

A Record Calculus for Arguments and First-Class Environments

MATTHEW TOOHEY, University of Toronto, Canada

ARA JAMALZADEH, University of Toronto, Canada

NINGNING XIE, University of Toronto, Canada

This paper introduces a novel calculus that models first-class environments and function application paradigms using standard record types. By proposing new extensions to general record types, we achieve a design that is remarkably simple and principled. We formalise this design in a core calculus and prove several desirable properties, including type soundness, normalization, and a simulation of the simply typed lambda calculus. Additionally, we extend the design with mutable references. The calculus, its semantics, along with the extension, and all stated properties are fully mechanized in the Lean 4 proof assistant, alongside an interpreter formally verified to be equivalent to the operational semantics.

1 Introduction

The lambda calculus [Church 1941] provides a foundational model for computation and serves as the theoretical basis for modern functional programming languages. A lambda abstraction λx\lambda x. e denotes a function binding a variable xx within the body expression ee, with its core evaluation step defined by the β\beta-reduction rule via substitution: (λx.e1)e2⟶e1[e2/x](\lambda x. e_1) e_2 \longrightarrow e_1[e_2/x].

However, managing variable bindings remains a classic challenge in language implementation, reasoning, and mechanization. In particular, ensuring variable freshness can be quite tricky. While paper formalisms and pen-and-paper proofs often assume α\alpha-equivalence, concrete implementations typically require more complex machinery such as de Bruijn indices [de Bruijn 1972] to define capture-avoiding substitution. De Bruijn indices, however, are famously difficult to formalise and implement correctly. Moreover, substitution and de Bruijn indices are often inefficient because reduction requires a traversal of the expression body. Finally, β\beta-reduction fails to capture many common argument-passing paradigms such as named arguments, which allow arguments to be supplied by explicit parameter names.

In this paper, we show how standard record types can be leveraged to model first-class environments [Gelernter et al. 1987; Sato et al. 2001; Tan and Oliveira 2024] and function arguments, establishing an environment-based model that sidesteps traditional binding and inefficiency issues while capturing diverse function application paradigms. Our design is remarkably simple and principled; it uncovers subtle interactions that emerge when combining features and provides a general framework for function application paradigms by exploiting inherent record properties.

We offer the following contributions:

• A novel design: We propose a design that models first-class environments and function arguments using standard record types ( §2§2). Specifically, our design:

– Is simple and principled, yet naturally expresses diverse features, including first-class environments ( §2.2§2.2), along with named ( §2.3−§2.4§2.3-§2.4), positional ( §2.5§2.5), and optional ( §2.7§2.7) arguments, while supporting a form of partial application ( §2.6§2.6, §2.7§2.7).

– Generalizes traditional function application paradigms to general records ( §2.8,§2.9§2.8, §2.9); and

– Unifies disparate approaches to handling duplicate labels in record calculi [Leijen 2005; Rémy 1994] ( §2.9§2.9).

Authors' Contact Information: Matthew Toohey, University of Toronto, Toronto, Canada, mtoohey@cs.toronto.edu; Ara Jamalzadeh, University of Toronto, Toronto, Canada, a.jamalzadeh@mail.utoronto.ca; Ningning Xie, University of Toronto, Toronto, Canada, ningningxie@cs.toronto.edu.

Matthew Toohey, Ara Jamalzadeh, and Ningning Xie

• Formalisation: We formalise this design as a core record calculus, λρ+\lambda^{\rho+} ( §3\S3). We establish key structural properties of its record operators (Lemma 3.1-3.6), determinacy (Theorem 3.7), type soundness (Theorems 3.8 and 3.9), and normalization (Theorem 3.11). We also prove that it simulates the simply typed lambda calculus (Theorems 3.14 and 3.15).

• Imperative extension: We extend the calculus with mutable references, under which the precise behaviour of function application becomes important ( §4§4). To safely handle type generalization in the presence of side-effects, we adopt the approach of Dolan [2024] and adapt it to closures and applications.

• Mechanization: The calculus, including its operational semantics and all stated lemmas and theorems, is fully mechanized in the Lean 4 proof assistant ( §5§5). The complete proof artifact is provided in the supplementary materials.

• Implementation: We implement an interpreter for λρ+\lambda^{\rho+} and formally verify its equivalence with the operational semantics (Theorem 5.1).

Lastly, we explore the broader design space in §6.

References (27)