Reference. The categorical contours of the Chomsky-Schützenberger representation theorem

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.

Cite

Cite as @mellies-2025-the (helia, typst) · \cite{mellies-2025-the} (LaTeX)
BibTeX
bibtex · 1 line
@article{mellies-2025-the, title={The categorical contours of the Chomsky-Schützenberger representation theorem}, volume={21}, number={2}, ISSN={1860-5974}, url={http://dx.doi.org/10.46298/lmcs-21(2:12)2025}, DOI={10.46298/lmcs-21(2:12)2025}, journal={Logical Methods in Computer Science}, publisher={Centre pour la Communication Scientifique Directe (CCSD)}, author={Melliès, Paul-André and Zeilberger, Noam}, year={2025}, month=May }
hayagriva YAML (typst)
yaml · 17 lines
mellies-2025-the:
  type: article
  title: The categorical contours of the Chomsky-Schützenberger representation theorem
  author:
  - Melliès, Paul-André
  - Zeilberger, Noam
  date: 2025-05
  url: http://dx.doi.org/10.46298/lmcs-21(2:12)2025
  serial-number:
    doi: 10.46298/lmcs-21(2:12)2025
    issn: 1860-5974
  parent:
    type: periodical
    title: Logical Methods in Computer Science
    publisher: Centre pour la Communication Scientifique Directe (CCSD)
    issue: 2
    volume: 21
Cites 74 works (8 here)
With notes (8)

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

Displayed Categories ahrens-lumsdaine-2019

We introduce and develop the notion of displayed categories. A displayed category over a category C is equivalent to “a category D and functor F : D –> C”, but instead of having a single collection of “objects of D” with a map to the objects of C, the objects are given as a family indexed by objects of C, and similarly for the morphisms. This encapsulates a common way of building categories in practice, by starting with an existing category and adding extra data/properties to the objects and morphisms. The interest of this seemingly trivial reformulation is that various properties of functors are more naturally defined as properties of the corresponding displayed categories. Grothendieck fibrations, for example, when defined as certain functors, use equality on objects in their definition. When defined instead as certain displayed categories, no reference to equality on objects is required. Moreover, almost all examples of fibrations in nature are, in fact, categories whose standard construction can be seen as going via displayed categories. We therefore propose displayed categories as a basis for the development of fibrations in the type-theoretic setting, and similarly for various other notions whose classical definitions involve equality on objects. Besides giving a conceptual clarification of such issues, displayed categories also provide a powerful tool in computer formalisation, unifying and abstracting common constructions and proof techniques of category theory, and enabling modular reasoning about categories of multi-component structures. As such, most of the material of this article has been formalised in Coq over the UniMath library, with the aim of providing a practical library for use in further developments.

We introduce and develop the notion of displayed categories. A displayed category over a category 𝐶 is equivalent to “a category 𝐷 and functor 𝐹:𝐷→𝐶, but instead of having a single collection of “objects of 𝐷” with a map to the objects of 𝐶, the objects are given as a family indexed by objects of 𝐶, and similarly for the morphisms. This encapsulates a common way of building categories in practice, by starting with an existing category and adding extra data/properties to the objects and morphisms. The interest of this seemingly trivial reformulation is that various properties of functors are more naturally defined as properties of the corresponding displayed categories. Grothendieck fibrations, for example, when defined as certain functors, use equality on objects in their definition. When defined instead as certain displayed categories, no reference to equality on objects is required. Moreover, almost all examples of fibrations in nature are, in fact, categories whose standard construction can be seen as going via displayed categories. We therefore propose displayed categories as a basis for the development of fibrations in the type-theoretic setting, and similarly for various other notions whose classical definitions involve equality on objects. Besides giving a conceptual clarification of such issues, displayed categories also provide a powerful tool in computer formalisation, unifying and abstracting common constructions and proof techniques of category theory, and enabling modular reasoning about categories of multi-component structures. As such, most of the material of this article has been formalised in Coq over the UniMath library, with the aim of providing a practical library for use in further developments.

DOI · arXiv

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

Functors are type refinement systems mellies_zeilberger_2015

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.

PDF · DOI · pldb

Type refinement and monoidal closed bifibrations mellies_zeilberger_2013

The concept of refinement in type theory is a way of reconciling the “intrinsic” and the “extrinsic” meanings of types. We begin with a rigorous analysis of this concept, settling on the simple conclusion that the type-theoretic notion of “type refinement system” may be identified with the category-theoretic notion of “functor”. We then use this correspondence to give an equivalent type-theoretic formulation of Grothendieck’s definition of (bi)fibration, and extend this to a definition of monoidal closed bifibrations, which we see as a natural space in which to study the properties of proofs and programs. Our main result is a representation theorem for strong monads on a monoidal closed fibration, describing sufficient conditions for a monad to be isomorphic to a continuations monad “up to pullback”.
Web

An efficient context-free parsing algorithm Earley1970

A parsing algorithm which seems to be the most efficient general context-free algorithm known is described. It is similar to both Knuth’s LR(k) algorithm and the familiar top-down algorithm. It has a time bound proportional to n3 (where n is the length of the string being parsed) in general; it has an n2 bound for unambiguous grammars; and it runs in linear time on a large class of grammars, which seems to include most practical context-free programming language grammars. In an empirical comparison it appears to be superior to the top-down and bottom-up algorithms studied by Griffiths and Petrick.
DOI

On the translation of languages from left to right KNUTH1965607

There has been much recent interest in languages whose grammar is sufficiently simple that an efficient left-to-right parsing algorithm can be mechanically produced from the grammar. In this paper, we define LR(k) grammars, which are perhaps the most general ones of this type, and they provide the basis for understanding all of the special tricks which have been used in the construction of parsing algorithms for languages with simple structure, e.g. algebraic languages. We give algorithms for deciding if a given grammar satisfies the LR(k) condition, for given k, and also give methods for generating recognizes for LR(k) grammars. It is shown that the problem of whether or not a grammar is LR(k) for some k is undecidable, and the paper concludes by establishing various connections between LR(k) grammars and deterministic languages. In particular, the LR(k) condition is a natural analogue, for grammars, of the deterministic condition, for languages.
DOI

Finite Automata and Their Decision Problems rabinFiniteAutomataTheir1959

Finite automata are considered in this paper as instruments for classifying finite tapes. Each onetape automaton defines a set of tapes, a two-tape automaton defines a set of pairs of tapes, et cetera. The structure of the defined sets is studied. Various generalizations of the notion of an automaton are introduced and their relation to the classical automata is determined. Some decision problems concerning automata are shown to be solvable by effective algorithms; others turn out to be unsolvable by algorithms.
DOI
External (66)
mellies-2025-the reference entries/refs/mellies-2025-the/mellies-2025-the.hel