Context-Free Languages of String Diagrams
Matt Earnshaw, Mario Román
TL;DR
The paper extends formal language theory to monoidal categories by defining context-free monoidal languages as morphisms into diagram contexts, unifying languages of words, trees, and graphs within a single algebraic framework. It develops diagram-contexts, raw optics, and the optical-contour adjunction to prove a two-dimensional representation theorem: any context-free monoidal language is the image of a regular monoidal language under a monoidal functor. By leveraging polygraphs, multicategories, and diagrammatic syntax, the work provides a versatile, unified approach to parsing and reasoning about diagrammatic languages, with concrete instances such as balanced parentheses, unbraids, and hypergraphs. The results open pathways to automata-like formalisms for monoidal languages and suggest broader applicability to other diagrammatic structures beyond monoidal categories.
Abstract
We introduce context-free languages of morphisms in monoidal categories, extending recent work on the categorification of context-free languages, and regular languages of string diagrams. Context-free languages of string diagrams include classical context-free languages of words, trees, and hypergraphs, when instantiated over appropriate monoidal categories. Using a contour-splicing adjunction, we prove a representation theorem for context-free languages of string diagrams: every such language arises as the image under a monoidal functor of a regular language of string diagrams.
