Reference. Functors are type refinement systems

The standard reading of type theory through the lens of category theory is based on the idea of viewing a type system as a category of well-typed terms. We propose a basic revision of this reading: rather than interpreting type systems as categories, we describe them as functors from a category of typing derivations to a category of underlying terms. Then, turning this around, we explain how in fact any functor gives rise to a generalized type system, with an abstract notion of typing judgment, typing derivations and typing rules. This leads to a purely categorical reformulation of various natural classes of type systems as natural classes of functors.

The main purpose of this paper is to describe the general framework (which can also be seen as providing a categorical analysis of refinement types), and to present a few applications. As a larger case study, we revisit Reynolds’ paper on “The Meaning of Types” (2000), showing how the paper’s main results may be reconstructed along these lines.

Cite

Cite as @mellies_zeilberger_2015 (helia, typst) · \cite{mellies_zeilberger_2015} (LaTeX)
BibTeX
bibtex · 9 lines
@inproceedings{mellies_zeilberger_2015,
 title = {Functors are type refinement systems},
 author = {Melli\`es, Paul-Andr\'e and Zeilberger, Noam},
 year = {2015},
 booktitle = {Proceedings of the 42nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL)},
 pages = {3--16},
 url = {http://noamz.org/papers/funts.pdf},
 doi = {10.1145/2676726.2676970}
}
hayagriva YAML (typst)
yaml · 14 lines
mellies_zeilberger_2015:
  type: article
  title: Functors are type refinement systems
  author:
  - Melliès, Paul-André
  - Zeilberger, Noam
  date: 2015
  page-range: 3-16
  url: http://noamz.org/papers/funts.pdf
  serial-number:
    doi: 10.1145/2676726.2676970
  parent:
    type: proceedings
    title: Proceedings of the 42nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL)
Cited by (12)

From Semantics to Syntax: A Type Theory for Comprehension Categories najmaei-2026-from

Recent models of intensional type theory have been constructed in algebraic weak factorization systems (AWFSs). AWFSs give rise to comprehension categories that feature non-trivial morphisms between types; these morphisms are not used in the standard interpretation of Martin-Löf type theory in comprehension categories. We develop a type theory that internalizes morphisms between types, reflecting this semantic feature back into syntax. Our type theory comes with Π-, Σ-, and identity types. We discuss how it can be viewed as an extension of Martin-Löf type theory with coercive subtyping, as sketched by Coraglia and Emmenegger. We furthermore define semantic structure that interprets our type theory and prove a soundness result. Finally, we exhibit many examples of the semantic structure, yielding a plethora of interpretations.
PDF · DOI · arXiv · pldb

The free bifibration on a functor clarke-2025-the

We consider the problem of constructing the free bifibration generated by a functor of categories 𝑝:𝐷→𝐶. This problem was previously considered by Lamarche, and is closely related to the problem, considered by Dawson, Paré, and Pronk, of “freely adjoining adjoints” to a category. We develop a proof-theoretic approach to the problem, beginning with a construction of the free bifibration Λ𝑝:𝐵𝑖𝑓𝑖𝑏(𝑝)→𝐶 in which objects of 𝐵𝑖𝑓𝑖𝑏(𝑝) are formulas of a primitive “bifibrational logic”, and arrows are derivations in a cut-free sequent calculus modulo a notion of permutation equivalence. We show that instantiating the construction to the identity functor generates a _zigzag double category_ ℤ(𝐶), which is also the free double category with companions and conjoints (or fibrant double category) on 𝐶. The approach adapts smoothly to the more general task of building (𝑃,𝑁)-fibrations, where one only asks for pushforwards along arrows in 𝑃 and pullbacks along arrows in 𝑁 for some subsets of arrows; this encompasses Kock and Joyal’s notion of _ambifibration_ when (𝑃,𝑁) form a factorization system. We establish a series of progressively stronger normal forms, guided by ideas of _focusing_ from proof theory, and obtain a canonicity result under assumption that the base category is factorization preordered relative to 𝑃 and 𝑁. This canonicity result allows us to decide the word problem and to enumerate relative homsets without duplicates. Finally, we describe several examples of a combinatorial nature, including a category of plane trees generated as a free bifibration over 𝜔, and a category of increasing forests generated as a free ambifibration over Δ, which contains the lattices of noncrossing partitions as quotients of its fibers by the Beck-Chevalley condition for bicartesian squares.
arXiv

The categorical contours of the Chomsky-Schützenberger representation theorem mellies-2025-the

We develop fibrational perspectives on context-free grammars and on nondeterministic finite-state automata over categories and operads. A generalized CFG is a functor from a free colored operad (aka multicategory) generated by a pointed finite species into an arbitrary base operad: this encompasses classical CFGs by taking the base to be a certain operad constructed from a free monoid, as an instance of a more general construction of an operad of spliced arrows 𝒲︀𝒞︀ for any category 𝒞︀. A generalized NFA is a functor from an arbitrary bipointed category or pointed operad satisfying the unique lifting of factorizations and finite fiber properties: this encompasses classical word automata and tree automata without 𝜖-transitions, but also automata over non-free categories and operads. We show that generalized context-free and regular languages satisfy suitable generalizations of many of the usual closure properties, and in particular we give a simple conceptual proof that context-free languages are closed under intersection with regular languages. Finally, we observe that the splicing functor 𝒲︀:Cat→Oper admits a left adjoint 𝒞︀:Oper→Cat, which we call the contour category construction since the arrows of 𝒞︀𝒪︀ have a geometric interpretation as oriented contours of operations of 𝒪︀. A direct consequence of the contour / splicing adjunction is that every pointed finite species induces a universal CFG generating a language of tree contour words. This leads us to a generalization of the Chomsky-Schützenberger Representation Theorem, establishing that a subset of a homset 𝐿⊆𝒞︀(𝐴,𝐵) is a CFL of arrows if and only if it is a functorial image of the intersection of a 𝒞︀-chromatic tree contour language with a regular language.
DOI · arXiv

Univalent Double Categories vanderweide-2024-univalent

PDF · DOI · pldb

Focusing on Refinement Typing economou-2023-focusing

We present a logically principled foundation for systematizing, in a way that works with any computational effect and evaluation order, SMT constraint generation seen in refinement type systems for functional programming languages. By carefully combining a focalized variant of call-by-push-value, bidirectional typing, and our novel technique of value-determined indexes, our system generates solvable SMT constraints without existential (unification) variables. We design a polarized subtyping relation allowing us to prove our logically focused typing algorithm is sound, complete, and decidable. We prove type soundness of our declarative system with respect to an elementary domain-theoretic denotational semantics. Type soundness implies, relatively simply, the total correctness and logical consistency of our system. The relative ease with which we obtain both algorithmic and semantic results ultimately stems from the proof-theoretic technique of focalization.
PDF · DOI · arXiv · pldb

Explicit Refinement Types ghalayini-2023-explicit

We present 𝜆ert, a type theory supporting refinement types with explicit proofs. Instead of solving refinement constraints with an SMT solver like DML and Liquid Haskell, our system requires and permits programmers to embed proofs of properties within the program text, letting us support a rich logic of properties including quantifiers and induction. We show that the type system is sound by showing that every refined program erases to a simply-typed program, and by means of a denotational semantics, we show that every erased program has all of the properties demanded by its refined type. All of our proofs are formalised in Lean 4.
PDF · DOI · arXiv · pldb

CN: Verifying Systems C Code with Separation-Logic Refinement Types pulte-2023-cn

Despite significant progress in the verification of hypervisors, operating systems, and compilers, and in verification tooling, there exists a wide gap between the approaches used in verification projects and conventional development of systems software. We see two main challenges in bringing these closer together: verification handling the complexity of code and semantics of conventional systems software, and verification usability. We describe an experiment in verification tool design aimed at addressing some aspects of both: we design and implement CN, a separation-logic refinement type system for C systems software, aimed at predictable proof automation, based on a realistic semantics of ISO C. CN reduces refinement typing to decidable propositional logic reasoning, uses first-class resources to support pointer aliasing and pointer arithmetic, features resource inference for iterated separating conjunction, and uses a novel syntactic restriction of ghost variables in specifications to guarantee their successful inference. We implement CN and formalise key aspects of the type system, including a soundness proof of type checking. To demonstrate the usability of CN we use it to verify a substantial component of Google’s pKVM hypervisor for Android.
PDF · DOI · pldb

Parsing as a lifting problem and the Chomsky-Schützenberger representation theorem mellis_zeilberger_2022

We begin by explaining how any context-free grammar encodes a functor of operads from a freely generated operad into a certain “operad of spliced words”. This motivates a more general notion of CFG over any category 𝐶, defined as a finite species 𝑆 equipped with a color denoting the start symbol and a functor of operads 𝑝:𝐹𝑟𝑒𝑒[𝑆]→𝑊[𝐶] into the operad of spliced arrows in 𝐶. We show that many standard properties of CFGs can be formulated within this framework, and that usual closure properties of CF languages generalize to CF languages of arrows. We also discuss a dual fibrational perspective on the functor 𝑝 via the notion of “displayed” operad, corresponding to a lax functor of operads 𝑊[𝐶]→𝑆𝑝𝑎𝑛(𝑆𝑒𝑡).

We then turn to the Chomsky-Schützenberger Representation Theorem. We describe how a non-deterministic finite state automaton can be seen as a category 𝑄 equipped with a pair of objects denoting initial and accepting states and a functor of categories 𝑄→𝐶 satisfying the unique lifting of factorizations property and the finite fiber property. Then, we explain how to extend this notion of automaton to functors of operads, which generalize tree automata, allowing us to lift an automaton over a category to an automaton over its operad of spliced arrows. We show that every CFG over a category can be pulled back along a ND finite state automaton over the same category, and hence that CF languages are closed under intersection with regular languages. The last important ingredient is the identification of a left adjoint 𝐶[−]:𝑂𝑝𝑒𝑟𝑎𝑑→𝐶𝑎𝑡 to the operad of spliced arrows functor, building the “contour category” of an operad. Using this, we generalize the C-S representation theorem, proving that any context-free language of arrows over a category 𝐶 is the functorial image of the intersection of a 𝐶-chromatic tree contour language and a regular language.

DOI · arXiv

First Steps in Synthetic Tait Computability: The Objective Metatheory of Cubical Type Theory sterling_2021

The implementation and semantics of dependent type theories can be studied in a syntax-independent way: the objective metatheory of dependent type theories exploits the universal properties of their syntactic categories to endow them with computational content, mathematical meaning, and practical implementation (normalization, type checking, elaboration). The semantic methods of the objective metatheory inform the design and implementation of correct-by-construction elaboration algorithms, promising a principled interface between real proof assistants and ideal mathematics. In this dissertation, I add synthetic Tait computability to the arsenal of the objective metatheorist. Synthetic Tait computability is a mathematical machine to reduce difficult problems of type theory and programming languages to trivial theorems of topos theory. First employed by Sterling and Harper to reconstruct the theory of program modules and their phase separated parametricity, synthetic Tait computability is deployed here to resolve the last major open question in the syntactic metatheory of cubical type theory: normalization of open terms.
DOI

Bifibrations of Polycategories and Classical Linear Logic blanco-2020-bifibrations

DOI

An Isbell duality theorem for type refinement systems mellies-2017-an

Any refinement system (= functor) has a fully faithful representation in the refinement system of presheaves, by interpreting types as relative slice categories, and refinement types as presheaves over those categories. Motivated by an analogy between side effects in programming and context effects in linear logic, we study logical aspects of this ‘positive’ (covariant) representation, as well as of an associated ‘negative’ (contravariant) representation. We establish several preservation properties for these representations, including a generalization of Day’s embedding theorem for monoidal closed categories. Then, we establish that the positive and negative representations satisfy an Isbell-style duality. As corollaries, we derive two different formulas for the positive representation of a pushforward (inspired by the classical negative translations of proof theory), which express it either as the dual of a pullback of a dual or as the double dual of a pushforward. Besides explaining how these constructions on refinement systems generalize familiar category-theoretic ones (by viewing categories as special refinement systems), our main running examples involve representations of Hoare logic and linear sequent calculus.
DOI · arXiv

Models for Polymorphism over Physical Dimension atkey-2015-models

We provide a categorical framework for models of a type theory that has special types for physical quantities. The types are indexed by the physical dimensions that they involve. Fibrations are used to organize this index structure in the models of the type theory. We develop some informative models of this type theory: firstly, a model based on group actions, which captures invariance under scaling, and secondly, a way of constructing new models using relational parametricity.
DOI
Cites 32 works (10 here)
With notes (10)

Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages carette-2009-finally

We have built the first family of tagless interpretations for a higher-order typed object language in a typed metalanguage (Haskell or ML) that require no dependent types, generalized algebraic data types, or postprocessing to eliminate tags. The statically type-preserving interpretations include an evaluator, a compiler (or staged evaluator), a partial evaluator, and call-by-name and call-by-value continuation-passing style (CPS) transformers. Our principal technique is to encode de Bruijn or higher-order abstract syntax using combinator functions rather than data constructors. In other words, we represent object terms not in an initial algebra but using the coalgebraic structure of the λ-calculus. Our representation also simulates inductive maps from types to types, which are required for typed partial evaluation and CPS transformations. Our encoding of an object term abstracts uniformly over the family of ways to interpret it, yet statically assures that the interpreters never get stuck. This family of interpreters thus demonstrates again that it is useful to abstract over higher-kinded types.
PDF · DOI · pldb

BI-hyperdoctrines, higher-order separation logic, and abstraction biering-2007-bi

We present a precise correspondence between separation logic and a simple notion of predicate BI, extending the earlier correspondence given between part of separation logic and propositional BI. Moreover, we introduce the notion of a BI hyperdoctrine, show that it soundly models classical and intuitionistic first- and higher-order predicate BI, and use it to show that we may easily extend separation logic to higher-order . We also demonstrate that this extension is important for program proving, since it provides sound reasoning principles for data abstraction in the presence of aliasing.
PDF · DOI · pldb

Separation logic: A logic for shared mutable data structures reynolds_separation_2002

In joint work with Peter O’Hearn and others, based on early ideas of Burstall, we have developed an extension of Hoare logic that permits reasoning about low-level imperative programs that use shared mutable data structure. The simple imperative programming language is extended with commands (not expressions) for accessing and modifying shared structures, and for explicit allocation and deallocation of storage. Assertions are extended by introducing a “separating conjunction” that asserts that its subformulas hold for disjoint parts of the heap, and a closely related “separating implication”. Coupled with the inductive definition of predicates on abstract data structures, this extension permits the concise and flexible description of structures with controlled sharing. In this paper, we survey the current development of this program logic, including extensions that permit unrestricted address arithmetic, dynamically allocated arrays, and recursive procedures. We also discuss promising future directions.
DOI

Categorical Logic and Type Theory jacobs-1999

This book is an attempt to give a systematic presentation of both logic and type theory from a categorical perspective, using the unifying concept of fibred category. Its intended audience consists of logicians, type theorists, category theorists and (theoretical) computer scientists.

The logic of bunched implications ohearn_pym_bi_1999

We introduce a logic BI in which a multiplicative (or linear) and an additive (or intuitionistic) implication live side-by-side. The propositional version of BI arises from an analysis of the proof-theoretic relationship between conjunction and implication; it can be viewed as a merging of intuitionistic logic and multiplicative intuitionistic linear logic. The naturality of BI can be seen categorically: models of propositional BI’s proofs are given by bicartesian doubly closed categories, i.e., categories which freely combine the semantics of propositional intuitionistic logic and propositional multiplicative intuitionistic linear logic. The predicate version of BI includes, in addition to standard additive quantifiers, multiplicative (or intensional) quantifiers [inline image] and [inline image] which arise from observing restrictions on structural rules on the level of terms as well as propositions. We discuss computational interpretations, based on sharing, at both the propositional and predicate levels.

Introduction to Higher-Order Categorical Logic lambek_scott_1986

Web

Categories for the Working Mathematician maclane_1971

Web

Adjointness in Foundations lawvere_1969

DOI

Functorial Semantics of Algebraic Theories lawvere_1963

Web

The mathematics of sentence structure lambek58

DOI
External (22)
mellies_zeilberger_2015 reference entries/refs/mellies_zeilberger_2015/mellies_zeilberger_2015.hel