Reference. Profunctor Optics, a Categorical Update

Optics are bidirectional data accessors that capture data transformation patterns such as accessing subfields or iterating over containers. Profunctor optics are a particular choice of representation supporting modularity, meaning that we can construct accessors for complex structures by combining simpler ones. Profunctor optics have previously been studied only in an unenriched and non-mixed setting, in which both directions of access are modelled in the same category. However, functional programming languages are arguably better described by enriched categories; and we have found that some structures in the literature are actually mixed optics, with access directions modelled in different categories. Our work generalizes a classic result by Pastro and Street on Tambara theory and uses it to describe mixed V-enriched profunctor optics and to endow them with V-category structure. We provide some original families of optics and derivations, including an elementary one for traversals. Finally, we discuss a Haskell implementation.

Cite

Cite as @clarke-2024-profunctor (helia, typst) · \cite{clarke-2024-profunctor} (LaTeX)
BibTeX
bibtex · 1 line
@article{clarke-2024-profunctor, title={Profunctor Optics, a Categorical Update}, volume={6}, ISSN={2631-4444}, url={http://dx.doi.org/10.32408/compositionality-6-1}, DOI={10.32408/compositionality-6-1}, journal={Compositionality}, publisher={Centre pour la Communication Scientifique Directe (CCSD)}, author={Clarke, Bryce and Elkins, Derek and Gibbons, Jeremy and Loregian, Fosco and Milewski, Bartosz and Pillmore, Emily and Román, Mario}, year={2024}, month=Feb, pages={1} }
hayagriva YAML (typst)
yaml · 22 lines
clarke-2024-profunctor:
  type: article
  title: Profunctor Optics, a Categorical Update
  author:
  - Clarke, Bryce
  - Elkins, Derek
  - Gibbons, Jeremy
  - Loregian, Fosco
  - Milewski, Bartosz
  - Pillmore, Emily
  - Román, Mario
  date: 2024-02
  page-range: '1'
  url: http://dx.doi.org/10.32408/compositionality-6-1
  serial-number:
    doi: 10.32408/compositionality-6-1
    issn: 2631-4444
  parent:
    type: periodical
    title: Compositionality
    publisher: Centre pour la Communication Scientifique Directe (CCSD)
    volume: 6
Cited by (10)

Univalent Enriched Categories and the Enriched Rezk Completion vanderweide-2026-univalent

Enriched categories are categories whose sets of morphisms are enriched with extra structure. Such categories play a prominent role in the study of higher categories, homotopy theory, and the semantics of programming languages. In this paper, we study univalent enriched categories. We prove that all essentially surjective and fully faithful functors between univalent enriched categories are equivalences, and we show that every enriched category admits a Rezk completion. Finally, we use the Rezk completion for enriched categories to construct univalent enriched Kleisli categories.
DOI

Reinforcement Learning in Categorical Cybernetics hedges-2025-reinforcement

DOI · arXiv

Insights from Univalent Foundations: A Case Study Using Double Categories rasekh-2025-insights

Category theory unifies mathematical concepts, aiding comparisons across structures by incorporating not just objects, but also morphisms capturing interactions between objects. Of particular importance in some applications are double categories, which are categories with two classes of morphisms, axiomatizing two different kinds of interactions between objects. These have found applications in many areas of mathematics and theoretical computer science, for instance, the study of lenses, open systems, and rewriting. However, double categories come with a wide variety of equivalences, which makes it challenging to transport structure along equivalences. To deal with this challenge, we propose the univalence maxim: each notion of equivalence of categorical structures has a corresponding notion of univalent categorical structure which induces that notion of equivalence. We also prove corresponding univalence principles, which allow us to transport structure and properties along equivalences. In this way, the usually informal practice of reasoning modulo equivalence becomes grounded in an entirely formal logical principle. We apply this perspective to various double categorical structures, such as (pseudo) double categories and double bicategories. Concretely, we characterize and formalize their definitions in Coq UniMath up to chosen equivalences, which we achieve by establishing their univalence principles.
DOI

On a fibrational construction for optics, lenses, and Dialectica categories capucci-2024-onx

Categories of lenses/optics and Dialectica categories are both comprised of bidirectional morphisms of basically the same form. In this work we show how they can be considered a special case of an overarching fibrational construction, generalizing Hofstra’s construction of Dialectica fibrations and Spivak’s construction of generalized lenses. This construction turns a tower of Grothendieck fibrations into another tower of fibrations by iteratively twisting each of the components, using the opposite fibration construction.
DOI · arXiv

Contextads as Wreaths; Kleisli, Para, and Span Constructions as Wreath Products capucci-2024-contextads

We introduce contextads and the Ctx construction, unifying various structures and constructions in category theory dealing with context and contextful arrows – comonads and their Kleisli construction, actegories and their Para construction, adequate triples and their Span construction. Contextads are defined in terms of Lack–Street wreaths, suitably categorified for pseudomonads in a tricategory of spans in a 2-category with display maps. The associated wreath product provides the Ctx construction, and by its universal property we conclude trifunctoriality. This abstract approach lets us work up to structure, and thus swiftly prove that, under very mild assumptions, a contextad equipped colaxly with a 2-algebraic structure produces a similarly structured double category of contextful arrows. We also explore the role contextads might play qua dependently graded comonads in organizing contextful computation in functional programming. We show that many side-effects monads can be dually captured by dependently graded comonads, and gesture towards a general result on the ‘transposability’ of parametric right adjoint monads to dependently graded comonads.
DOI · arXiv

Fundamental Components of Deep Learning: A category-theoretic approach gavranovicFundamentalComponentsDeep

Deep learning, despite its remarkable achievements, is still a young field. Like the early stages of many scientific disciplines, it is marked by the discovery of new phenomena, ad-hoc design decisions, and the lack of a uniform and compositional mathematical foundation. From the intricacies of the implementation of backpropagation, through a growing zoo of neural network architectures, to the new and poorly understood phenomena such as double descent, scaling laws or in-context learning, there are few unifying principles in deep learning. This thesis develops a novel mathematical foundation for deep learning based on the language of category theory. We develop a new framework that is a) end-to-end, b) unform, and c) not merely descriptive, but prescriptive, meaning it is amenable to direct implementation in programming languages with sufficient features. We also systematise many existing approaches, placing many existing constructions and concepts from the literature under the same umbrella. In Part I we identify and model two main properties of deep learning systems parametricity and bidirectionality by we expand on the previously defined construction of actegories and Para to study the former, and define weighted optics to study the latter. Combining them yields parametric weighted optics, a categorical model of artificial neural networks, and more. Part II justifies the abstractions from Part I, applying them to model backpropagation, architectures, and supervised learning. We provide a lens-theoretic axiomatisation of differentiation, covering not just smooth spaces, but discrete settings of boolean circuits as well. We survey existing, and develop new categorical models of neural network architectures. We formalise the notion of optimisers and lastly, combine all the existing concepts together, providing a uniform and compositional framework for supervised learning.
DOI

Value Iteration is Optic Composition hedges-2023-value

DOI · arXiv

Towards Foundations of Categorical Cybernetics capucci-2022-towards

DOI · arXiv

Lenses for Composable Servers videla-2022-lenses

We implement the semantics of server operations using parameterised lenses. They allow us to define endpoints and extend them using classical lens composition. The parameterised nature of lenses models state updates while the lens laws mimic properties expected from HTTP. This first approach to server development is extended to use dependent parameterised lenses. An upgrade necessary to model not only endpoints, but entire servers, unlocking the ability to compose them together.
DOI · arXiv

Fibre optics braithwaite-2021-fibre

Lenses, optics and dependent lenses (or equivalently morphisms of containers, or equivalently natural transformations of polynomial functors) are all widely used in applied category theory as models of bidirectional processes. From the definition of lenses over a finite product category, optics weaken the required structure to actions of monoidal categories, and dependent lenses make use of the additional property of finite completeness (or, in case of polynomials, even local cartesian closure). This has caused a split in the applied category theory literature between those using optics and those using dependent lenses. The goal of this paper is to unify optics with dependent lenses, by finding a definition of fibre optics admitting both as special cases.
arXiv
Cites 44 works (4 here)
With notes (4)

What you needa know about Yoneda: profunctor optics and the Yoneda lemma (functional pearl) boisseau-2018-what

Profunctor optics are a neat and composable representation of bidirectional data accessors, including lenses, and their dual, prisms. The profunctor representation exploits higher-order functions and higher-kinded type constructor classes, but the relationship between this and the familiar representation in terms of “getter” and “setter” functions is not at all obvious. We derive the profunctor representation from the concrete representation, making the relationship clear. It turns out to be a fairly direct application of the Yoneda Lemma, arguably the most important result in category theory. We hope this derivation aids understanding of the profunctor representation. Conversely, it might also serve to provide some insight into the Yoneda Lemma.
PDF · DOI · pldb

Compositional Game Theory ghani-2018-compositional

DOI · arXiv

Profunctor Optics: Modular Data Accessors pickering-2017-profunctor

DOI

Applicative programming with effects mcbride-2008-applicative

In this article, we introduce Applicative functors – an abstract characterisation of an applicative style of effectful programming, weaker than Monads and hence more widespread. Indeed, it is the ubiquity of this programming pattern that drew us to the abstraction. We retrace our steps in this article, introducing the applicative pattern by diverse examples, then abstracting it to define the Applicative type class and introducing a bracket notation that interprets the normal application syntax in the idiom of an Applicative functor. Furthermore, we develop the properties of applicative functors and the generic operations they support. We close by identifying the categorical structure of applicative functors and examining their relationship both with Monads and with Arrow.
PDF · DOI · pldb
External (40)
clarke-2024-profunctor reference entries/refs/clarke-2024-profunctor/clarke-2024-profunctor.hel