Hostname: page-component-5db58dd55d-bthnr Total loading time: 0 Render date: 2026-05-26T23:53:44.858Z Has data issue: false hasContentIssue false

Semantics of pattern unification

Published online by Cambridge University Press:  24 March 2026

AMBROISE LAFONT
Affiliation:
LIX, CNRS, Inria, École polytechnique, Institut Polytechnique de Paris, Palaiseau, France (e-mail: ambroise.lafont@lix.polytechnique.fr)
NEEL KRISHNASWAMI
Affiliation:
University of Cambridge, Cambridge, UK (e-mail: nk480@cl.cam.ac.uk)
Rights & Permissions [Opens in a new window]

Abstract

We propose a notion of syntax with metavariables that generalises Miller’s decidable pattern fragment of second-order unification for simply typed $\lambda$-calculus. Using categorical semantics, we show that, under some conditions, a generalisation of Miller’s unification algorithm applies. To illustrate our semantic analysis, we implemented our generic unification algorithm in Agda. The syntax with metavariables given as input of the algorithm is specified by a notion of signature generalising binding signatures, covering a wide range of examples, including ordered $\lambda$-calculus and (intrinsic) polymorphic syntax such as System F. Although we do not explicitly handle equations, we also tackle simply typed $\lambda$-calculus modulo $\beta$- and $\eta$-equations (Miller’s original setting) by working on the syntax of normal forms.

Information

Type
Research Article
Creative Commons
Creative Common License - CCCreative Common License - BYCreative Common License - NCCreative Common License - SA
This is an Open Access article, distributed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike licence (http://creativecommons.org/licenses/by-nc-sa/4.0/), which permits non-commercial re-use, distribution, and reproduction in any medium, provided the same Creative Commons licence is used to distribute the re-used or adapted article and the original article is properly cited. The written permission of Cambridge University Press or the rights holder(s) must be obtained prior to any commercial use.
Copyright
© The Author(s), 2026. Published by Cambridge University Press
Figure 0

Fig. 1. Syntax of $\lambda$-calculus (Section 2.1)

Figure 1

Fig. 2. Metavariable substitution for $\lambda$-calculus (Section 2.1)

Figure 2

Fig. 3. Unification for $\lambda$-calculus

Figure 3

Fig. 4. Pruning for $\lambda$-calculus

Figure 4

Fig. 5. Generalised binding signatures in Agda

Figure 5

Fig. 6. Implementation of the signature of pure $\lambda$-calculus

Figure 6

Fig. 7. Syntax generated by a GB-signature

Figure 7

Fig. 8. Metavariable substitution for a GB-signature (Section 2.2)

Figure 8

Fig. 9. Type signatures of unification and pruning

Figure 9

Fig. 10. Our generic pattern unification algorithm

Figure 10

Fig. 11. Pattern unification for $\lambda$-calculus (Section 2.1)

Figure 11

Fig. 12. Pattern-friendly GB-signatures in Agda

Figure 12

Table 1. Simply typed $\lambda$-calculus (Section 7.2)

Figure 13

Table 2. Ordered $\lambda$-calculus (Section 7.4)

Figure 14

Table 3. The (pattern-friendly) GB-signature of (syntactic) System F (Section 7.5.1)

Submit a response

Discussions

No Discussions have been published for this article.