Hostname: page-component-74656f9884-rdgjk Total loading time: 0 Render date: 2026-11-06T23:51:55.531Z Has data issue: false hasContentIssue false

Formal p-category theory and normalization by evaluation in Rocq

Published online by Cambridge University Press:  18 May 2026

David Berry*
Affiliation:
Department of Computer Science and Technology, University of Cambridge , Cambridge, CB3 0FD, UK
Marcelo Fiore
Affiliation:
Department of Computer Science and Technology, University of Cambridge , Cambridge, CB3 0FD, UK
*
Corresponding author: David Berry; Email: David.Berry@cl.cam.ac.uk
Rights & Permissions [Opens in a new window]

Abstract

Traditional category theory is typically based on set-theoretic principles and ideas, which are often nonconstructive. An alternative approach to formalizing category theory is to use e-category theory, where hom sets become setoids. Our work reconsiders a third approach – p-category theory – from Čubrić et al. (Mathematical Structures in Computer Science 8(2) 153–192, 1998) emphasizing a computational standpoint. We formalize in Rocq a modest library of p-category theory – where homs become subsetoids – and apply it to formalizing algorithms for normalization by evaluation, which are purely categorical but, surprisingly, do not use neutral and normal terms. Čubrić et al. (Mathematical Structures in Computer Science 8(2) 153–192, 1998) establish only a soundness correctness property by categorical means; here, we extend their work by providing a categorical proof also for a strong completeness property. For this, we formalize the full universal property of the free Cartesian-closed category, which is not known to have been performed before. We further formalize a novel universal property of unquotiented simply typed $\lambda$-calculus syntax and apply this to a proof of correctness of a categorical normalization by evaluation algorithm. We pair the overall mathematical development with a formalization in the Rocq proof assistant, following the principle that the formalization exists for practical computation. Indeed, it permits extraction of synthesized normalization programs that compute (long) $\beta$$\eta$-normal forms of simply typed $\lambda$-terms together with a derivation of $\beta$$\eta$-conversion.

Information

Type
Special Issue: Phil Scott memorial issue
Copyright
© The Author(s), 2026. Published by Cambridge University Press
Figure 0

Listing 2.1.1. PER Rocq Definition.

Figure 1

Listing 2.2.1. p-Category Rocq Definition.

Figure 2

Listing 2.2.2. p-Functor Rocq Definition.

Figure 3

Listing 2.2.3. p-Natural Transformation Rocq Definition.

Figure 4

Listing 3.1.1. p-Terminal Object Rocq Definition.

Figure 5

Listing 3.1.2. p-Cartesian Product Rocq Definition.

Figure 6

Listing 3.1.3. p-Equalizers Rocq Definition.

Figure 7

Listing 3.2.1. p-Cartesian Exponential Rocq Definition.

Figure 8

Figure 1. Lifting of Cartesian-pre-closure to induced p-functors into comma p-categories.

Figure 9

Listing 4.1.1. De Bruijn Index Rocq Definition.

Figure 10

Listing 4.1.2. STLC Term Rocq Definition.

Figure 11

Listing 4.2.1. Context Renaming Rocq Definition.

Figure 12

Listing 4.3.1. Context Substitution Rocq Definition.

Figure 13

Figure 2. Freeness property for a free Cartesian-closed p-category.

Figure 14

Figure 3. Universal property for subst$_{\alpha }$ relative to subst$_{\beta \eta }$.

Figure 15

Figure 4. Interpretation of subst$_{\beta \eta }$ into its p-category of presheaves.

Figure 16

Figure 5. Interpretation of subst$_{\beta \eta }$ into the p-category of presheaves over subst$_{\alpha }$.

Figure 17

Figure 6. Interpretation of subst$_{\beta \eta }$ into the p-category of presheaves over subst$_{\alpha }$.

Figure 18

Figure 7. Interpretation of subst$_{\beta \eta }$ into the gluing p-category $\widehat {\mathsf{Subst}}_{\alpha } \downarrow \widehat {\mathsf{Subst}}_{\alpha }$.

Figure 19

Listing A.1. p-Isomorphism Rocq Definition.

Figure 20

Listing A.2. Cartesian p-Category Rocq Definition.

Figure 21

Listing A.3. Cartesian p-Functor Rocq Definition.

Figure 22

Listing A.4. Cartesian-Closed p-Category Rocq Definition.

Figure 23

Listing A.5. Cartesian-Closed p-Functor Rocq Definition.

Figure 24

Listing A.6. Simple Types Rocq Definition.

Figure 25

Listing A.7. Context Rocq Definition.

Figure 26

Listing A.8. Term $\beta \eta$-Conversion Rocq Definition.

Figure 27

Listing A.9. Context Substitution $\beta \eta$-Conversion Rocq Definition.