Content uploaded by Valeria De Paiva
Author content
All content in this area was uploaded by Valeria De Paiva on Oct 19, 2022
Content may be subject to copyright.
Applied Category Theory
in Chemistry, Computing,
and Social Networks
John Baez, Simon Cho, Daniel Cicala, Nina Otter,
and Valeria de Paiva
The authors of this piece are organizers of the AMS 2022
Mathematics Research Communities summer conference
Applied Category Theory, one of four topical research
conferences offered this year that are focused on
collaborative research and professional development for
early-career mathematicians. Additional information can
be found at https://www.ams.org/programs
/research-communities/2022MRC-Categories.
Applications are open until February 15, 2022.
1. Introduction
Society is increasingly complex and connected through the
internet and social media, planetary climate and ecologi-
cal challenges, transnational organization and global sup-
ply chains. To navigate and thrive in this networked world,
we rely on scientic advances to help us manage this com-
plexity by enabling robust communication, cooperation,
and collaboration.
John Baez is a professor of mathematics at the University of California, River-
side. His email address is baez@math.ucr.edu.
Simon Cho is a senior research scientist at Two Six Technologies. His email
address is cho.simon.math@gmail.com.
Daniel Cicala is a lecturer in the Department of Mathematics and Physics at
the University of New Haven. His email address is dcicala@newhaven.edu.
Nina Otter is a lecturer in mathematical data science in the School of Math-
ematics at Queen Mary University of London. Her email address is n.otter
@qmul.ac.uk.
Valeria de Paiva is the principal research scientist at Topos Institute. Her email
address is valeria.depaiva@gmail.com.
For permission to reprint this article, please contact:
reprint-permission@ams.org.
DOI: https://doi.org/10.1090/noti2422
Within about the past decade, a growing number of re-
searchers have realized that the aspects of category theory
that make it useful in certain pure mathematical contexts
also make it useful for the study of the underlying struc-
ture of physical and conceptual systems. From this realiza-
tion, a new eld has emerged called Applied Category The-
ory (ACT). Some major themes currently found in the ACT
literature include compositionality, functorial semantics,
and implementing these structures into user-friendly soft-
ware. Indeed, engineers and scientists should benet from
the fruits of ACT, ideally without having to rst study cate-
gory theory which is why producing user-friendly software
is a north star of ACT research. In this note, we provide
a bird’s eye view of these major themes, describe a road
map to relevant literature, and highlight the essence and
intuition of the central ideas as well as the payoffs that a
category-theoretic approach can bring. Into this narrative,
we t a brief description of specic research projects to be
undertaken by participants of the 2022 Mathematical Re-
search Community in Applied Category Theory.
2. Compositionality
To a category theorist, it is not the mathematical objects,
but the morphisms between objects that are held to be fun-
damental. This viewpoint necessarily lifts composition to
the fore of mathematical operations. When considering
examples of a morphism, many may conjure functions be-
tween sets, homomorphisms between rings, or continuous
maps between spaces. These examples are certainly impor-
tant; however, morphisms can truly be anything satisfying
the axioms for a category. One main thread of research
in applied category theory is to model open systems by
292 NOTICES OF THE AMERICAN MATHEMATICAL SOCIETY VOLUME 69, NUMBER 2
Figure 1. Open Markov process.
Figure 2. Open SIR model as a Petri net.
arranging them as morphisms in some category. “Open”
here means that the systems are equipped with an interface
that can interact with other compatible systems.
2.1. Structured cospans. One method of encoding open
systems as morphisms is to consider them as “cospans” [3].
The idea is to create a category where we interpret each
object as a system of some sort, and then dene a cospan
to be an object with two morphisms into it,
that select which parts of serve as inputs and outputs.
Composition of cospans,
followed by
is given by a purely categorical construction known as a
pushout, which connects the outputs of to the inputs
of . In applied category theory we often need structured
cospans,
where the object lives in a different category from and
, related by a functor . For example, and could be
sets, and could be a graph.
The structured cospan approach has been applied to
chemical reaction networks, Markov processes (see Figure
1), and electrical circuits. Petri nets, typically found in
chemistry and computer science, are a graphical formal-
ism to describe distributed systems. These too can be real-
ized as structured cospans thus offering a way to categor-
ically build complex processes. Figure 2 shows an open
Petri net as a structured cospan encoding a simple model
of infectious disease. Here stands for a population of
“susceptible” people, stands for “infected,” and stands
for “resistant.”
It turns out that standard ways to manipulate a system—
for example, connecting outputs of one system to the in-
puts of another, turning an output into an input, con-
sidering multiple systems as a single system—are all real-
ized with purely category-theoretic operations. The pay-
off is that many different systems can be described in the
same language: category theory. With different systems on
equal footing, comparisons are more readily available. Rig-
orous, not simply heuristic, diagrammatic languages exist
to assist in reasoning about systems of various kinds, and
a structural analysis of systems may commence.
2.2. Open reaction networks. Reaction networks are a
widely used method of describing chemical reactions.
There is a standard method of turning a reaction network
into a collection of differential equations describing the
time evolution of the concentration of various chemicals
in solution. Starting in the 1970s, mathematical chemists
formulated a number of deep theorems [11] and conjec-
tures [1] saying how the qualitative behavior of these dif-
ferential equations depend on topological features of the
reaction network.
More recently, structured cospans have been used to
describe “open” reaction networks—where chemicals can
ow in and out—as morphisms in a category [4]. We can
build larger reaction networks by composing smaller open
ones, and the map sending an open reaction network to
its differential equation is a functor. In the 2022 MRC in
Applied Category Theory, participants will use this frame-
work to study the qualitative behavior of chemical reac-
tions.
2.3. Lenses. Lenses offer another method to connect sys-
tems together and are particularly useful to model a sce-
nario involving a bidirectional ow of information be-
tween connected systems. A helpful, if rough, approxi-
mation of a lens is two interacting systems, each encoded
as a set of states ,together with one map
that “sends information forward” and a second map
that “sends information backwards.” To il-
lustrate, imagine that is the set of behaviors of an individ-
ual named James and is the set of behaviors of the Cate-
gory Cafe, James’ favorite coffee house. The forward func-
tion captures how the Category Cafe behaves, , in
reaction to each of James’ behaviors, . For instance,
perhaps “James orders a coffee” maps to “an
employee pours a coffee.” The backwards function cap-
tures how each state of the cafe affects each of James’
behaviors . If “the cafe is busy,” then
might update “orders a coffee” to
“leaves the cafe,” hold “uses the restroom”
constant so , and update “sit and check
emails” to “stand in the corner and wait until
customers leave.”
FEBRUARY 2022 NOTICES OF THE AMERICAN MATHEMATICAL SOCIETY 293
While this toy example imparts the avor of a lens, it
does not impart the lens’ full majesty when the appropri-
ate rigor and generality is considered. Indeed, lenses are
so useful that people continue to rediscover them in seem-
ingly unconnected situations. Gödel’s Dialectica interpre-
tation, a model of intuitionistic arithmetic, offers an early
discovery of lenses, though without the term. de Paiva
placed Gödel’s logical framework into a category whose
morphisms are generalized lenses [13]. This Dialectica con-
struction has come to establish much of the current under-
standing about lenses. Contemporary lens applications in-
clude database theory [8], a structural perspective on func-
tional learning [6], domain theory [15], and open game
theory [10] with an emphasis on economic models. This
same structure appearing in so many places excited cate-
gory theorists who in turn began to study lenses on their
own terms, starting with the category of lenses in the cat-
egory of sets. The objects of this category are sets and the
morphisms are lenses, so a pair of func-
tions and are subject to several
compatibility laws, that is, commuting diagrams:
A composite of lenses
and
comprises the functions
and
respectively dened by
and
and are depicted in Figure 3 using a string diagram. This
category generalizes in various directions, for instance by
taking different permutations of the compatibility laws,
by taking lenses in various categories, or, repeatedly, by
replacing the Cartesian product with another monoidal
product.
Figure 3. Lens composition as a string diagram.
2.4. Dialectica interpretation. When combing the above-
cited literature about lenses, one would notice that there
are actually variations of lenses just as there are for any
mathematical object. In fact, one of the variants of the
lenses discussed in both [6] and [10] seems to be a certain
restriction of de Paiva’s Dialectica construction, although
it is not immediately obvious to what degree such a restric-
tion preserves the logical structure of the construction. In
the 2022 MRC for Applied Category Theory, participants
will construct a framework that claries in which precise
sense the concept of lens as embodied by the Dialectica
construction generalizes the variations of lenses discussed
above.
3. Functorial Semantics
We have two formal and rigorous methods of building sys-
tems from their constituent parts: structured cospans and
lenses. The categories we build from structured cospans or
from lenses offer a syntax that we can use to reason about
the structure of systems. However, we would also like to
understand their behavior. Given our interest in compos-
ite systems, a natural question to ponder is: how much
of a system’s behavior is explained by the behavior of its
component parts? To answer this question, we can borrow
ideas from one of category theory’s giants.
In his PhD thesis, William Lawvere introduced a
category-theoretic perspective on universal algebra called
functorial semantics. The idea is to encode the theory for
an algebraic object into a category. For example, the cate-
gory for the theory of a group will have its objects gener-
ated by taking all nite products of a single object , giving
objects
and so on. The morphisms of this category are gener-
ated, via composition and products, by the structure maps
, , and . The re-
sulting morphisms are then quotiented by equations be-
tween morphisms that describe the properties of identity,
294 NOTICES OF THE AMERICAN MATHEMATICAL SOCIETY VOLUME 69, NUMBER 2
invertibility, and associativity. This construction provides
a unique morphism for every possible way to turn a string
of group elements into a single element; for instance,
has a dedicated morphism of type
Note, there are no actual elements here, we are just us-
ing generalized symbols to describe the morphism. The
resulting category Groupis not a group; it is the syn-
tax for groups. This is directly in line with our categories
constructed using structured cospans or lenses to capture
the syntax of various systems. Then, once we have a syn-
tax, we can use a functor out of that syntax and into an-
other category to realize the semantics. For example, ev-
ery group is a functor Group to the category
of sets and set functions. Here is the semantics of
the group. By changing the semantics, we can obtain
the many avors of groups: each topological group is a
functor Group to the category of topological
spaces and continuous maps, each Lie group is a functor
Group into the category of differential mani-
folds and smooth maps.
Applied category theorists use this idea to study open
systems using two categories. The rst category has as mor-
phisms the open systems, for example encoded as struc-
tured cospans. This category serves as the syntax for the
system, governing how we can combine systems to make
larger, more complex systems. The second category cap-
tures the behavior of these systems. This category serves as
the semantics and is typically the category whose ob-
jects are sets and morphisms are binary relations, though
a category of stronger relations may be appropriate. Then
a functor assigns to each system
(a morphism in the syntax category), the relationship be-
tween behaviors on the system’s inputs and outputs. For
example, there is a functor from the category whose mor-
phisms are passive linear circuits to the category LinRel
whose objects are for each natural number and mor-
phisms are linear relations, that is, linear sub-
spaces of . This functor assigns to a passive linear
network
,
where comprises the tuples
that represent the
realizable potential-current pairs that can exist on each
port according to Kirchhoff’s Circuit Laws.
In general, these semantics-assigning functors capture
the external behavior of a system as a composite of the sys-
tem’s components. The generality of this approach favors
the structural perspective and, by using category theory as
a common language, allows for a more readily-made com-
parison for systems of different types. In an era of increas-
ing interdisciplinarity, the ability to translate knowledge
across disciplines is crucial. Applied category theory is one
approach towards building such a dictionary.
It is worth noting that functorial semantics as described
above does not capture any behavior that is emergent from
composing systems. Research is underway in this direction
by using so-called lax functors [7].
3.1. Social simplicial complexes. The power of functors
goes beyond their ability to describe the deconstruction
of systems into their syntax and semantics. They are a
powerful organizational tool that encompasses a stagger-
ingly large number of the most famous mathematical oper-
ations. Indeed, computing some free algebraic object on a
set, the fundamental group on a space, the homology and
cohomology of spaces, the tangent or cotangent bundle
of a smooth manifold are all functors. Even a space like a
sheaf or presheaf can be represented as a functor. By think-
ing about a space as a functor, the higher-dimensional fea-
tures can be studied using higher category theory, a per-
spective that offers new tools to classical subjects. In the
eld of Topological Data Analysis, functoriality of many
constructions is a key ingredient in the study of their ro-
bustness [5].
In the 2022 MRC, participants will study social systems
using functors and other category-theoretic tools. Many of
the methods currently used in network science were rst
developed by social network scientists, who use nodes to
represent agents of a social system, and (un)directed la-
beled edges to represent binary relations between agents
(see Figure 4).
Two of the main properties of social systems that so-
cial scientists are interested in studying are positions and
roles. For networks, positions are dened as equivalence
classes of nodes that are similar, while roles are equiva-
lence classes of compound relations [14]. Since the 1970s
a lot of research has been done to develop these concepts
in a rigorous way [9]. Otter and Porter developed meth-
ods to relate the analyses of roles and positions in social
networks, using a functorial formulation [12]. At the 2022
MRC, we intend to extend this functorial framework to ac-
count for higher-order interactions between social agents
by modeling social systems with simplicial complexes in-
stead of mere graphs.
FEBRUARY 2022 NOTICES OF THE AMERICAN MATHEMATICAL SOCIETY 295
mother mother
aunt
aunt
sibling
Figure 4. An example of social network modeling kinship
relationships.
4. Software Development
A goal of the ACT community is to bridge the gap be-
tween theorists using category-theoretic modeling tools
and those who want to use the models to say something
useful and true about the world. One can cross their n-
gers and hope that the “users” will simply take it upon
themselves to learn enough category theory to take advan-
tage of ACT-styled models. A more proactive approach
would be to build user-friendly (meaning, no category the-
ory knowledge required) tools. Such tools will likely take
the form of computer software with intuitive graphical in-
terfaces where the category theory is programmed under-
the-hood. A number of researchers are currently work-
ing on building such software tools, though this work is
very much in its infancy. One example includes Globu-
lar,1a proof assistant that allows one to perform higher-
dimensional calculations in categories via a graphical in-
terface. Structured cospans of Petri nets were implemented
in the software package Julia to develop an SIR model that
is compositional in the sense that various cities can each
have their own model that can be connected together to
form a composite SIR model [2]. Users can set parameters
and all the category theory remains underneath the hood.
Private enterprise is also entering the picture. The organi-
zation Statebox2is blending an ACT approach to Petri nets
together with blockchain technology to develop a technol-
ogy stack based on a visual programming language. In
addition, they have built a software engine for composi-
tional game-theoretic modeling, a nite state machine ora-
cle. The company Conexus3uses applied categorical meth-
ods for data integration.
The success of ACT as a discipline largely hinges on its
ability to be accessible and available to scientists and en-
gineers, meaning the building of software is central to the
ACT program.
1http://globular.science/
2https://statebox.org/
3https://conexus.com/
5. Conclusion
The ACT community is continuing to grow and is seek-
ing early-career researchers, programmers, scientists, and
engineers of all stripes to join us at the 2022 Mathemat-
ical Research Community. Those who enjoy a systems-
thinking and structural perspective will nd that category
theory provides a rigorous and robust framework for rea-
soning about systems, processes, and relationships. Exper-
tise in category theory is not required to join, just a desire
to learn.
References
[1] David F. Anderson, A proof of the global attractor conjecture
in the single linkage class case, SIAM J. Appl. Math. 71 (2011),
no. 4, 1487–1508, DOI 10.1137/11082631X. MR2835244
[2] A. Baas, J. Fairbanks, S. Libkind, and E. Patterson, Op-
eradic modeling of dynamical systems: Mathematics and com-
putation, arXiv:2105.12282, 2021.
[3] John C. Baez and Kenny Courser, Structured cospans, The-
ory Appl. Categ. 35 (2020), Paper No. 48, 1771–1822.
MR4170469
[4] John C. Baez and Blake S. Pollard, A compositional frame-
work for reaction networks, Rev. Math. Phys. 29 (2017),
no. 9, 1750028, 41, DOI 10.1142/S0129055X17500283.
MR3694082
[5] Gunnar Carlsson, Topology and data, Bull. Amer.
Math. Soc. (N.S.) 46 (2009), no. 2, 255–308, DOI
10.1090/S0273-0979-09-01249-X. MR2476414
[6] Brendan Fong, David Spivak, and Remy Tuy´eras, Back-
prop as functor: a compositional perspective on supervised learn-
ing, 2019 34th Annual ACM/IEEE Symposium on Logic
in Computer Science (LICS), IEEE, Piscataway, NJ, 2019,
pp. 1–13. MR4142439
[7] Brendan Fong and David I. Spivak, An invitation to
applied category theory:Seven sketches in compositional-
ity, Cambridge University Press, Cambridge, 2019, DOI
10.1017/9781108668804. MR3966447
[8] J. N. Foster, M. B. Greenwald, J. T. Moore, B. C. Pierce,
and A. Schmitt, Combinators for bidirectional tree transforma-
tions: A linguistic approach to the view-update problem, ACM
Transactions on Programming Languages and Systems 29
(2007), no. 3, 17-es.
[9] L. Freeman, The development of social network analysis, Em-
pirical Press, 2004.
[10] Neil Ghani, Jules Hedges, Viktor Winschel, and Philipp
Zahn, Compositional game theory, LICS ’18—33rd An-
nual ACM/IEEE Symposium on Logic in Computer
Science, ACM, New York, 2018, pp. 472–481, DOI
10.1145/3209108.3209165. MR3883754
[11] F. Horn and R. Jackson, General mass action kinetics,
Arch. Rational Mech. Anal. 47 (1972), 81–116, DOI
10.1007/BF00251225. MR400923
[12] N. Otter and M. A. Porter, A unied framework for equiva-
lences in social networks, arXiv:2006.10733, 2020.
296 NOTICES OF THE AMERICAN MATHEMATICAL SOCIETY VOLUME 69, NUMBER 2
[13] V. C. V. de Paiva, The Dialectica categories, Categories
in computer science and logic (Boulder, CO, 1987),
Contemp. Math., vol. 92, Amer. Math. Soc., Providence,
RI, 1989, pp. 47–62, DOI 10.1090/conm/092/1003194.
MR1003194
[14] S. Wasserman and K. Faust, Social network analysis, Cam-
bridge University Press, 1994.
[15] G. Winskel, Domain theory and interaction, British Com-
puter Science FACS (Formal Aspects of Computer Sci-
ence) Newsletter, British Computer Society. Available
at https://www.bcs.org/media/7577/facs-jul21
.pdf.
Credits
Figures 1 and 2 are courtesy of John Baez.
MathSciNet® is the authoritative gateway
to the scholarly literature of mathematics.
Containing information on more than 4
million articles and books, with direct links
to over 2.6 million articles in more than
1,800 journals. MathSciNet includes ex-
pert reviews, customizable author proles,
and citation information on articles, books,
journals, and authors.
MathSciNet’s extensive resources can help
you throughout your entire math career.
Use it to:
• Quickly get up to speed on a new topic
• Look up a researcher’s body of work
• Find an article or book and track its
reference list
• Research a math department to prepare
for a job interview or when applying to
graduate school
mathscinet.ams.org
How to Subscribe
Go to www.ams.org/mathsciprice to
learn more about MathSciNet,
including information about
subscription rates, joining a
consortium, and a 30-day free trial.
Credits: R. Hurt/Caltech-JPL
FEBRUARY 2022 NOTICES OF THE AMERICAN MATHEMATICAL SOCIETY 297