Optics are constructions used in computer science as bidirectional data accessors. They include lenses and prisms, used to access and modify, respectively, components of product data types and components of coproduct data types.
Unlike lenses, in general optics do not require a cartesian structure to be present. That’s replaced by a bi-actegorical structure and a quotient which ‘ties’ residual and incoming views.
Let be a symmetric monoidal category. Let and be -actegories, i.e. there are pseudoactions and of acting on and , respectively.
The category of -mixed optics has objects given by pairs and hom-sets given by
Optics are morphisms in this category. See Riley 2018 for the composition rule.
Concretely, an optic is specified by a triple of where is called residual, is called ‘view’ or ‘get’ or ‘forward part’ or ‘left part’, and is called ‘update’ or ‘put’ or ‘backward part’ or ‘right part’.
In the non-mixed case , the category of optics is defined exactly as the ‘double’ of as introduced by Pastro and Street in PS07. Their theory has been extended to the mixed case in CEGLMPR20. This provides the fundamental link between optics and the theory of Tambara modules, which gives to mixed-optics the alternative name of ‘profunctor optics’. See ‘Profunctor representation’.
The coend in the above definition has the effect of making two optics and (with same boundaries) equal if there exists a morphism such that or a morphism such that .
One says optics are defined up to sliding along the residual, a terminology suggested by the graphical representation of optics as open diagrams, see (Román).
Let be a monoidal V-category with two monoidal actions and . A generalized Tambara module is a V-profunctor endowed with a family of morphisms
V-natural in and and V-dinatural in , which additionally satisfies some axioms, see PS07.
Generalized Tambara modules are the copresheaves of the category of optics, see CEGLMPR20.
A brief account of the purpose of optics is in:
A similar, but more detailed account, is in:
Articles:
Mitchell Riley, Categories of optics, [arXiv:1809.00738, video:YT]
Bryce Clarke, Derek Elkins, Jeremy Gibbons, Fosco Loregian, Bartosz Milewski, Emily Pillmore, Mario Román, Profunctor optics: a categorical update, Compositionality 6 1 (2024) (arXiv:2001.07488, doi:10.32408/compositionality-6-1)
Mario Román, Open Diagrams via Coend Calculus, Electronic Proceedings in Theoretical Computer Science 333 (2021) 65-78 (doi:10.4204/EPTCS.333.5)
Last revised on March 14, 2024 at 06:55:09. See the history of this page for a list of all contributions to it.