Abstract
We revise our former definition of graph operations and correspondingly adapt the construction of graph term algebras. As a first contribution to a prospective research field, Universal Graph Algebra, we generalize some basic concepts and results from algebras to graph algebras. To tackle this generalization task, we revise and reformulate traditional set-theoretic definitions, constructions and proofs in Universal Algebra by means of more category-theoretic concepts and constructions. In particular, we generalize the concept of generated subalgebra and prove that all monomorphic homomorphisms between graph algebras are regular. Derived graph operations are the other main topic. After an in-depth analysis of terms as representations of derived operations in traditional algebras, we identify three basic mechanisms to construct new graph operations out of given ones: parallel composition, instantiation, and sequential composition. As a counterpart of terms, we introduce graph operation expressions with a structure as close as possible to the structure of terms. We show that the three mechanisms allow us to construct, for any graph operation expression, a corresponding derived graph operation in any graph algebra.
1. Introduction
The paper is a relatively independent part of a broader long-term project to develop a proper foundation of diagrammatic specification formalisms and diagrammatic logics. The project is centered around and extends the concept of generalized sketches. We use the term “diagrammatic” as a synonym for “graph-based” in a very broad sense including arbitrary presheaf topoi.
One of the objectives of our project is to elevate traditional first-order logic to a wide range of arbitrary categories. In [1], we only addressed predicates and showed how to define corresponding first-order logics of statements in context without operations in arbitrary categories. The present paper is also meant to be a first step towards an abstract notion of an operation allowing us to define fully fledged first-order logics of statements in context, at least, in arbitrary topoi.
Generalized sketches have been developed in the 1990s independently by Michael Makkai, motivated by his work on an abstract formulation of completeness theorems in logic [2], and a group in Latvia around Zinovy Diskin, motivated by their work on data bases and data modeling [3,4,5]. Our concept of graph operation has its origins in the concept of sketch operation. Sketch operations do not appear in the work of Makkai, but they have been an integral part of Diskin’s pioneering work from the very beginning.
Graph operations (and their prospective generalizations) are vital in software engineering. Moreover, they provide a conceptual tool with many potential and useful applications in mathematics, logic, and computer science.
Software models are often diagrammatic structures. To keep software models comprehensible for humans, we should, however, avoid overloading them with auxiliary items and redundant information. Nonetheless, to formulate and integrate relevant constraints in software models, it is necessary to refer to items that are not present in a model but that can be derived, like the composition of references, for example. Graph operations are an appropriate tool to refer to and reason about those derivable items in diagrammatic artifacts.
Graph operations are also vital for the definition of query languages for diagrammatic data models, for example. The crucial idea is to formalize queries as derived graph operations built up from basic operations like the operations of Codd’s relational algebra, for example. The potential to formalize query languages for diagrammatic data models was one of Diskin’s main motivations to introduce sketch operations [4].
An example par excellence for the conceptual potential of graph operations in mathematics are categories. Categories can be described as graphs plus an identity and a composition operation. It is not common yet, but quite natural, to consider these operations as graph operations. The identity operation introduces, for each vertex in a graph, a loop, while the composition operation generates, for any two successive edges in a graph, a corresponding composite edge. Even statements like “we assume a category with chosen pullbacks”, for example, can be adequately made precise by means of corresponding graph operations. Ref. [6] seems to be the first paper outlining the potential of graph operations in category theory. Since categories are nowadays widely used in computer science, logic, mathematics, and physics, we will use them as our running example.
In traditional string-based formalisms and logics, terms are the standard tool used to represent and reason about “derivable data”. At the same time, terms give us an adequate tool at hand to represent derived operations, i.e., operations that can be built up from the basic operations in an algebra. Therefore, we generalized in [7] the construction of terms from traditional algebras to graph algebras. The construction of graph term algebras and their characterization as a free construction is the main result in [7]. Unfortunately, our expectation that graph terms would give us a universal and appropriate concept of derived graph operations and substitutions at hand was naive. We realized that the strong interconnection between the “representation of data” and the “representation of derived operations” breaks down in the case of graph operations.
After Section 2, where we list some basic notations, concepts, conventions, and results, the paper presents a further development of the theory of graph operations and graph algebras in two directions—model theory (including term algebras) and derived graph operations.
- Model theory:
- In [7], we coined the concept of graph algebra, introduced graph terms, and showed that graph term algebras are free graph algebras. There was, however, no model theory in the sense of traditional Universal Algebra. As a kind of “proof of concept”, we therefore generalize some basic model-theoretic concepts and results from traditional algebras to graph algebras. We concentrate on the concept of “generated subalgebra” and the related problem of characterizing monomorphic and epimorphic homomorphisms.To tackle this task, we make a substantial effort in Section 3 to revise and reformulate traditional set-theoretic definitions, constructions and proofs in Universal Algebra by means of more category-theoretic concepts and constructions. Relying on this reformulation, we can in Section 4 smoothly transfer concepts, definitions and results from traditional algebras to graph algebras. In particular, we prove that all monomorphic homomorphisms between graph algebras are regular.In [7], we adapted the original idea of sketch operations [4] and defined the arity of a graph operation as a single graph inclusion. This definition does not allow us, however, to consider projections as legal graph operations. To be closer to the traditional concept of operation in Universal Algebra, and to be able to define an appropriate concept of a derived graph operation, we therefore declare in this paper the arity of a graph operation as a span of graph inclusions. In Section 4.2, we clarify the relation between both versions and discuss to what extent they are equivalent.To prove that all monomorphic homomorphisms between graph algebras are regular, we also introduce partial graph algebras in Section 4.4. We define a so-called term completion procedure transforming partial graph algebras into total graph algebras. This procedure provides for each signature a free functor from the corresponding category of partial graph algebras to the corresponding category of graph algebras. The construction of graph term algebras turns out to be just a special case of this new procedure.
- Derived graph
- operations: To understand why the strong interconnection between “representation of data” and “representation of derived operations” breaks down in the case of graph operations and to find out how to define derived graph operations in an appropriate way, we include in the paper a more in-depth analysis of the concept term and discuss substitution calculi in general in Section 3.4.In Section 3.7, we recall the construction of syntactic Lawvere theories as it is described in [8], for example. In Section 5.1, we discuss finite product categories and elucidate that terms can be characterized as normal forms for finite product expressions; thus, Lawvere’s original slogan “composition is substitution” can be turned into the slogan “substitution is symbolic composition plus normalization”.Reviewing the relationship between finite products and tensor products, we identify copying in Section 5.2 as the cause of the problem. We argue that, in the case of graph operations, “copying of data”, as a computation of its own, has to be replaced by the “soldering” of input and (!) output ports of computations.In such a way, we end up in Section 5.3 with three mechanisms to construct new graph operations out of given ones: parallel composition, instantiation (“soldering” of input and output ports), and sequential composition.Finally, we introduce in Section 5.4 graph operation expressions with a structure as close as possible to the structure of terms. We define their semantics, i.e., the derived graph operations we have been looking for, by means of the three mechanisms of parallel composition, instantiation and sequential composition.
2. Notations and Preliminaries
denotes the collection of objects of a category and as the collection of morphisms of , respectively. is the collection of all morphisms from object A to object B in . If the category is clear from the context, we will often use the more compact notation instead of . We use the diagrammatic notation for the composition of morphisms and in . states that category is a subcategory of category . A category is small if the collection , and thus also the collection , is a set. is the category of all small categories. A category is locally small if is a set for all objects A and B in . denotes the category of all sets and all (total) maps. and are not small but locally small.
A (directed multi) graph is given by a collection of vertices, a collection of edges and maps , assigning to each edge its source and target vertex, respectively [9]. is the empty graph. A graph is small if and are sets. A graph homomorphism between two graphs and is a pair of maps , such that the following diagrams commute.
The identity graph homomorphism on a graph is the pair of identity maps and composition of graph homomorphisms and is performed componentwise, i.e., . is the category of all small graphs and all graph homomorphisms between them. The empty graph is the initial object in . For convenience and uniformity, we will often consider a set A as a graph without edges.The category comprising finite and small graphs as well as the underlying graphs of categories like , , and , for example, is denoted by , while is the category containing all the corresponding collections of vertices and edges, respectively. Correspondingly, we denote the category with all small categories and categories like , , and as objects by .
denotes the underlying graph of a category , i.e., we have and . Note that a functor is just a graph homomorphism also preserving identities and composition. In other words, the assignments , define a faithful forgetful functor . It is well known that there is a functor left-adjoint to assigning to any graph the corresponding path category .
In practical applications, it is often more convenient to work with interpretation categories instead of functor categories. An interpretation of a graph in a category , denoted by , is a graph homomorphism from to . A natural transformation between two interpretations and is a family , of morphism in such that for all edges in . All interpretations of in and all natural transformations between them constitute the interpretation category with composition as the vertical composition of natural transformations. (In [10], interpretations are called “models of in ” and the notation is used instead of . For our purposes, the more neutral and general term “interpretation” is more convenient). For any categories , the assignments define a full embedding of the traditional functor category into the interpretation category .
Obviously, the category is, by definition, isomorphic to the interpretation category with as the graph . On the other hand, the adjunction ensures that for any small graph the interpretation category is isomorphic to the functor category and thus a presheaf topos.
For any set I and any set A the set of all maps from I into A is a categorical product in with the family of projections defined by for all . If I is finite with n elements (indices), is therefore isomorphic to the n-ary Cartesian product of A. If we equip a finite set with a fixed total order , we can reuse the traditional tuple notation for elements in the Cartesian product to also represent the elements in : A map is represented by the tuple . In this paper, we will often describe a map by simply declaring , i.e., for all . If , we have , and we will consequently represent the only map by the empty tuple . For any finite set A we denote its cardinality by .
For any inclusion of sets, we denote by the corresponding inclusion map with for all . A graph is a subgraph of a graph , in symbols, if , and the inclusion maps and establish a graph homomorphism . is also called an inclusion graph homomorphism or graph inclusion, for short.
A partial map is given by a domain of definition and a total map from into B. The composition of two partial maps and is defined by
- and
- for all .
- We consider any (total) map as a partial map with .
3. Algebras and Term Algebras
Traditional expositions of Universal Algebra are based on finite Cartesian products. As a first step of a smooth transition from traditional algebras to graph algebras, we reformulate in this section some very basic concepts and results of Universal Algebra utilizing sets of maps instead of finite Cartesian products .
In parallel, we try to lift the traditional set-theoretic definitions, constructions and proofs in Universal Algebra to a more general and abstract level utilizing category-theoretic concepts and constructions. The objective is to pave the way from traditional operations and algebras via graph operations and graph algebras to operations and algebras in topoi.
3.1. Signatures, Algebras and Homomorphisms
To declare the arities of operation symbols, we use canonical finite indexing sets
For all , we assume to be equipped with a fixed total order ; thus, we can reuse the tuple notation to represent maps as discussed in Section 2.
Definition 3.1
(Signature). A signature is given by
- A setof operation symbols,
- A map assigning to each operation symbol as its arity a pair of finite sets with for some , and .
We say that is an n-ary operation symbol if . If for , and we also say that is a constant symbol.
Remark 3.1
(Sets as arities). There can be arbitrarily and finitely many disconnected inputs for an algebraic operation. We have decided to work with explicit sets of names for the “input positions”. In contrast to possibly multiple inputs, it is usually assumed that an algebraic operation has exactly one single output. For conformity reasons, we also introduce a name for the single output position. This brings us closer to graph algebras, where the single-output paradigm will be given up. The input as well as the output arity of a graph operation can be an arbitrary finite graph (see Definition 4.1).
Definition 3.2
(Algebra). Let Σ be a signature. A Σ-algebra is given by
- A set A, called the carrier of , and
- A familyof maps called operations.
We say thatis an n-ary operation if. If, we also say that is a constant operation, or simply a constant.
In the case where the signature has no constant symbols, the empty set constitutes a -algebra, called the empty Σ-algebra.
Now, we reformulate the traditional concept of homomorphism.
Definition 3.3
(Homomorphism). Let Σ be a signature. A -homomorphism between two Σ-algebras and is a map satisfying the following homomorphism condition
.
For any sets A, B and I each map induces a map and thus we can, more abstractly but equivalently, express the homomorphism condition (HC) with the requirement that the above right square of maps commutes. Note that, in the case of constant symbols with , the homomorphism condition turns into the equation if we apply our conventions in Section 2 concerning the tuple notation.Given any -algebra , the identity map on the carrier set induces an identity -homomorphism . Similarly, given any -homomorphisms , , the composition of the underlying maps induces a -homomorphism . This defines the category with all -algebras as objects and all -homomorphisms as morphisms.
Proposition 3.1
(Forgetful Functor). The assignments for Σ-algebras and for Σ-homomorphisms define a faithful forgetful functor
A characteristic for any incarnation of the concept algebra is that the corresponding categories of algebras inherit all limits from the respective underlying category. For the abstract concept of -algebra for an arbitrary functor , for example, the category of all -algebras inherits all limits from the category [11].
It is well-known that the category inherits all limits from the category . Following our methodological intention to lift things up to a more categorical element-free level, we demonstrate that the decision to work with sets of maps instead of Cartesian products enables us to give a pure categorical concise proof of this classical result. We intend to carry out all later constructions and argumentations within , and thus we restrict ourselves to small limits.
Theorem 3.1
(Limits). inherits any small limit from the category , i.e., the functor creates small limits. has therefore all small limits since does.
Proof.
Let be a small graph and be a diagram in where for all vertices v in . We have to show that any limit cone over the translated diagram induces a limit cone over in such that is a -algebra with L as its carrier.
To define the operations in , we note that for any operation symbol in and any map we obtain a commutative cone in with for all v in . Applying the respective operations to the maps gives us a new cone in with for all vertices v in . Now, for any edge in , we have that is a -homomorphism from to and thus, by the homomorphism condition and commutativity of , we have
which encapsulates that the cone is commutative. By the universal property of , there is a unique map which satisfies
for all v in . By defining , we ensure that each map induces a -homomorphism for all v in . Thus, we indeed obtain a commutative cone in .
It remains to show that is a limit cone, i.e., for any other commutative cone in , we have to show that there is a -homomorphism such that for all v in . Note that p induces a commutative cone in with for all v in . As is a limit cone over , there exists a unique map such that for all v in . We claim that extends to the desired -homomorphism by showing that
for any in and . By definition, is the unique map such that holds for all v in . Indeed, the map also satisfies this equality for all v in as
By the uniqueness of mediating morphisms. we obtain (5), which shows that is indeed a -homomorphism from . Moreover, it is the unique homomorphism such that and thus, is a limit cone. □
Remark 3.2
(Hom-sets). The proof of Theorem 3.1 is based on the convention in Section 2 that we consider as a shorthand notation for the collection (hom-set) of all morphisms in from I to A. is a set since is locally small. is isomorphic to a corresponding exponential object in , but this isomorphism does not play any role in this paper.
3.2. Subalgebras
As in the traditional approach, we can define subalgebras by means of set inclusions.
Definition 3.4
Here, is the corresponding inclusion map from A into B.
(Subalgebras). Let be a signature. A Σ-algebra is a -subalgebra of a Σ-algebra , in symbols, if and for all and the following diagram commutes:
Here, is the corresponding inclusion map from A into B.A comparison of Definitions 3.3 and 3.4 makes it, however, obvious that we also can simply describe -subalgebras as special kinds of -homomorphisms.
Corollary 3.1
(Subalgebras as Inclusion Homomorphisms). For Σ-algebras and such that , we have that is a Σ-subalgebra of if, and only if, the inclusion map establishes a Σ-homomorphism .
Since one of our objectives is to lift the traditional set-theoretic exposition of Universal Algebra to a more category-theoretic one, we will use, from now on, the concepts “-subalgebra” and “inclusion -homomorphism” interchangeably.
We know that the monomorphisms (epimorphisms) in are exactly the injective (surjective) maps, respectively. Any faithful functor reflects monomorphisms and epimorphisms. The forgetful functor is faithful, and thus, we obtain
Corollary 3.2
(Injective and surjective Homomorphisms). If the underlying map of a Σ-homomorphism is injective (surjective), then is a monomorphism (epimorphism) in .
In the traditional set-theoretic approach to Universal Algebra, a preferred tool to describe, construct and reason about subalgebras are subsets of the carrier which are closed with respect to applications of the operations in the algebra.
Definition 3.5
(Closedness). Let be a Σ-algebra. We say a subset is closed in if for all and the result of applying the operation in to the input factors through the inclusion map , i.e., there exists a map such that the following diagram commutes:
If is a -subalgebra of then the carrier A of is obviously closed with respect to all the operations in . On the other hand, the inclusion map is a monomorphism in . Therefore the map in Definition 3.5 is unique if it exists. In such a way, the assignments define a total operation from to if A is closed, and we obtain the following result.Proposition 3.2
(Subalgebra ≅ Closed Subset). There is a one-to-one correspondence between Σ-subalgebras of and closed subsets of .
Proposition 3.2 suggests that there may actually be no need for the auxiliary concept closed subset in a more category-theoretic approach. This conjecture is supported by the observation that we can reconstruct the standard result that closed subsets are closed with respect to intersection, reformulated in terms of inclusion homomorphisms, as a special case of Theorem 3.1. To see this, we have to realize that the intersection of subsets can be described as a special limit construction, namely multiple pullbacks, in .
Remark 3.3
(Multiple Pullbacks). Let I be a set and M be an I-indexed family of subsets of a set B. We can describe this situation witha diagram with as a small graph given by , , and δ defined by for all , and inclusion maps for all .
It is well known and straightforward to prove that the intersection together with the inclusion maps , and is a limit cone of the diagram in .
Limits of this shape are also called multiple pullbacks and they reflect monomorphisms: For any category , any diagram and any limit cone , all the morphisms , are monomorphisms in as as long as all the morphisms , exist.
Due to Remark 3.3, we can now replace and enhance the traditional statement
“If M is a family of closed subsets in , then its intersection is closed as well”
by the following corollary of Theorem 3.1.
Corollary 3.3
(Intersection of Subalgebras). For any set I, any Σ-algebra , and any diagram of Σ-subalgebras , of there is a unique Σ-subalgebra of with that is a Σ-subalgebra of for all .
Moreover, the inclusion Σ-homomorphisms , and constitutes a multiple pullback, i.e., a limit cone of the diagram in .
We also call the intersection of the I-indexed family of Σ-subalgebras of and may use the notations , or, simply, to denote .
Traditionally, the -subalgebra of a -algebra generated by a subset can be defined as the -subalgebra with the carrier constructed as the intersection of the following family of closed sets in :
Since the collection of all subsets of a set B is a set as well, this definition matches the pattern of Corollary 3.3. We only have to choose for I the set itself or any isomorphic set.
Using this sleight of hand, we can take full advantage of the universal property of the intersection of subalgebras in , as stated in Corollary 3.3, and lift up the concept “generated by a subset” to the concept “accessible via a map”.
Definition 3.6
(Subalgebra accessible via a Map). For any Σ-algebra and any map , let be the set of all Σ-subalgebras of such that f factors through the inclusion map , i.e., there exists a map such that .
We denote by the intersection of , according to Corollary 3.3. In particular, the carrier of is the intersection of sets. We call the -subalgebra of accessible (reachable) via f or the homomorphic image of A with respect to f.
In the case of inclusion maps , we also use the traditional notation instead of and also call the-subalgebra of generated by A.
Note that the map in Definition 3.6 is unique if it exists, since the inclusion map is a monomorphism in .
Corollary 3.4
(Homomorphic image includes Image). For any Σ-algebra and any map , we have for the (set-theoretic) image of A with respect to the map f.
Proof.
This follows immediately from the observation that for the set of all subsets Y of B such that f factors through the inclusion map and that due to the definition of and in Definition 3.6 and the definition of . □
Remark 3.4
(Well-powered). In category theory, the adjective well-powered is used for categories where for all objects A in the collection of all subobjects of A is a set.
Of course, we do have the traditional concept of generated algebra and corresponding results available.
Definition 3.7
(Accessible and Generated Algebras). Let be a Σ-algebra.
- 1.
- is accessible via a map if .
- 2.
- If is accessible via an inclusion map , i.e., if , we also say that is generated by A.
- 3.
- is said to be generated if it is generated by the empty set, i.e., accessible via the unique map from the initial object ∅ in to B.
Corollary 3.5.
A Σ-algebra is generated if, and only if, there are no proper Σ-subalgebras of .
Corollary 3.6.
If a signature Σ has no constant symbols, then the empty Σ-algebra is the only generated Σ-algebra.
The concept accessible via a map can be utilized to find a characterization of epimorphisms in . First, we observe that “accessible via a map” implies “epic”.
Lemma 3.1
(Accessible implies Epic). A Σ-homomorphism is an epimorphism in if is accessible via the underlying map , i.e., if .
Proof.
We consider arbitrary Σ-homomorphisms such that .
We know that the set together with the inclusion map is an equalizer of the maps in . According to Theorem 3.1, there is a unique Σ-algebra such that becomes an inclusion Σ-homomorphism , which is, moreover, the equalizer of the Σ-homomorphisms . Assumption ensures that there exists a unique map with . Due to the construction of in Definition 3.6, we have an inclusion Σ-homomorphism .
Accessibility of means , and thus we obtain, finally, . This means, however, that the equalizer of g and h is the identity on B thus, we have as required. □
To show that, on the other hand, epic implies accessible, we can take advantage of the following result.
Proposition 3.3
(Subalgebras are Regular Monos). For any Σ-subalgebra of a Σ-algebra there exists a Σ-algebra and parallel Σ-homomorphisms such that is the equalizer of g and h.
Proof.
Operations on C:
We now extend C to a Σ-algebra by defining for each in a corresponding operation . For any in , we do have four possible cases.
We construct the pushout of the span of inclusion maps (see the left diagram below). We set , , and . Since is injective, both maps are injective too, and, moreover, the pushout square is as well a pullback square. This ensures, especially, that is the equalizer of the maps in . The pushout property of the square provides a unique map such that
Operations on C:
We now extend C to a Σ-algebra by defining for each in a corresponding operation . For any in , we do have four possible cases.- Case 1
- factors through : There exists a map such that (see the right diagram above). is unique since is a monomorphism. We simply set

- Case 2
- factors through : Analogous to Case 1.
- Case 3
- Overlapping of Case 1 and 2: There exist maps such that . Due to the pullback property of the square, there exists a unique such that . The homomorphism property of ensures and we obtain, finally, . That is, in the event of an overlapping, Case 1 and Case 2 define the same output . Note that there will always be an overlapping for constant symbols!
- Case 4
- factors neither through nor through : This can only happen if with . Utilizing the operations in to a maximal extent, Cases 1 and 2 define a partial map from to . However, since we restrict ourselves to total operations, we have to find an ad hoc totalization trick to turn into a total operation. Employing (7), we may decide to utilize the operations in to produce outputs in the left copy of B in . We set

The operations in are defined by (8) exactly in a way that the maps and become Σ-homomorphisms . Note that Case 4 has no relevance for the homomorphism property of and ! Theorem 3.1 ensures, finally, that the inclusion Σ-homomorphism is the equalizer of the Σ-homomorphisms . □
Regularity of entails that the concepts accessible and epic are equivalent.
Proposition 3.4
(Accessible ≅ Epic). For any Σ-homomorphism , it holds that is accessible via the underlying map ; i.e., in other words, is equal to the homomorphic image of with respect to f, if, and only if, is an epimorphism in .
Proof.
“Accessible implies epic” has been shown in Lemma 3.1. We now show that “epic implies accessible”: We consider an arbitrary Σ-subalgebra of such that there exists a map with . Due to Proposition 3.3, there exist Σ-homomorphisms such that is the equalizer of g and h. Due to the assumption , we obtain and thus since f is epic. This means, however, and, finally, due to the construction of in Definition 3.6. □
The axiom of choice is equivalent to the statement that all epimorphisms in the category are split; i.e., there exists a map such that . As a consequence, each homomorphism between -algebras maps closed subsets to closed subsets. In particular, we have
Lemma 3.2
(Closed Images). For any Σ-homomorphism , the (set-theoretic) image of the carrier A of is closed in . We denote by the unique Σ-subalgebra of with the carrier and call it the (set-theoretic) image of with respect to the -homomorphism f.
Lemma 3.2 is the last brick we need to conclude that the epic -homomorphisms are exactly the surjective ones.
Corollary 3.7
(Epic ≅ Surjective). For any Σ-homomorphism we have ; thus, is an epimorphism in if, and only if, the map is surjective.
Proof.
By Corollary 3.4 we have . Lemma 3.2 gives us the Σ-subalgebra of at hand and ensures due to the construction of in Definition 3.6. This gives us since two Σ-subalgebras of a Σ-algebra are equal if, and only if, they do have the same carrier. By Proposition 3.4 we obtain epic if, and only if, . , however, means that f is surjective. □
Remark 3.5
(Stepwise Generation of Closed Subsets). There is another, more constructive, way to construct the closed sets . We start with A and add all the elements from B that we can reach by successively applying the operations in to elements that have already been reached. A categorical analysis, formalization, and generalization of this stepwise iterative construction can be found in [12], for example.
3.3. Terms and Term Algebras
We define terms as strings of symbols. To distinguish terms from metalevel expressions, such as , we will use angle bracket symbols , instead of parentheses , to build terms. Moreover, we will use delimiter signs ⸢…⸣ to indicate that the expression between the delimiters is a string. So the delimiter signs ⸢…⸣ are not constituents of terms and we may just drop them if convenient. The following is a traditional inductive definition of terms similar to [13,14]:
Definition 3.8
(Terms). The set of all -terms over a set X of variables is the smallest set of strings of symbols such that
- Variables:
- , for all ;
- Constants:
- , for all with ;
- Operations:
- , for all with , and all maps in .
Note that the assignments , assigning to each variable the string consisting only of a single symbol denoting this variable, define an injective map : . Note, moreover, that in case , each operation symbol is reborn as the -term .
A term can be seen as a “tree-like computation scheme” and if we assign to variables certain values in an algebra, we can compute a value in this algebra following this computation scheme. Terms are constructed inductively, and thus we can also define this kind of evaluation of terms inductively.
Definition 3.9
(Evaluation of terms). For any set X of variables, any Σ-algebra and any map (called a variable assignment), we can inductively define a map :
- Variables:
- , for all ;
- Constants:
- , for all ;
- Operations:
- , for all .
All three cases in Definition 3.9 are disjoint and terms are only equal if, and only if, they are equal as strings and thus is uniquely defined.
There is no indication in Definitions 3.8 and 3.9 where the sets of -terms live and where the evaluation of -terms takes place. A very common and powerful practice in Universal Algebra is to internalize -terms as elements of carriers of -algebras and to encode term evaluation through -homomorphisms. First, we observe that the stepwise construction of terms in Definition 3.8 can be reflected by defining for each operation symbol in a corresponding (constructor) operation on :
Definition 3.10
(Term algebra). For a set X of variables, we define the term -algebra over X by
- Constants:
- , for all with , and
- Operations:
- , for all with , and all maps in .
Note that the term -algebra is generated by . This is implicitly ensured by the statement of being the smallest set satisfying the conditions in Definition 3.8. We say that the elements in are the generators of .
Second, we observe that the introduction of term -algebras allows us to encode the defining equations for the cases Constants and Operations in Definition 3.9 via the requirement that the map should establish a -homomorphism :
- Constants:
- , for all ;
- Operations:
- , for all where is the map in defined by .
The third case Variables in Definition 3.9 simply requires that the map is an extension of the map and thus the statement “Definition 3.9 defines uniquely” is transformed into the statement that the term -algebra is a -algebra freely generated by X.
Proposition 3.5 
(Term Algebras as Free Construction). Given a set X of variables, the Σ-term algebra has the following universal property: For any Σ-algebra and any map , there exists a unique Σ-homomorphism such that .

The universal property in Proposition 3.5 characterizes uniquely up to isomorphism and the case gives us an initial -algebra at hand.
Corollary 3.8.
is initial in the category .
It is a standard result for free constructions that the assignments and define a (free) functor that is left-adjoint to the forgetful functor (see [15]).

3.4. Substitutions
The very appealing advantage of internalizing terms as elements of carriers of algebras, encoding term evaluations as homomorphisms and thus having the adjunction at hand, is that we obtain a fully fledged, well-defined, and well-behaved substitution calculus for free relying on general results in Category Theory. We insert an informal exposition of what we mean by a substitution calculus and what the expected features of such a calculus could be. The advantages of the “internal view of terms” will be discussed afterwards.
3.4.1. Substitution Calculi
The concept substitution is a kind of conceptual descendant of the concept of variable. A variable in an expression is a “free location” where we can put in expressions of a certain kind. The basic constituent of a substitution calculus is its specific way to describe a
In Universal Algebra, we can formalize substitutions as maps . For finite sets we may simply declare a substitution by listing the corresponding assignments .(1) Substitution (declaration), i.e., an assignment of expressions to variables.
The second constituent of a substitution calculus is the specific mechanism for
A common practice in Universal Algebra [14] is to denote the resulting term in of applying a finite substitution to a term t in by(2) Substitution application, i.e., the replacement of occurrences of variables in a given expression by the expressions assigned to the variables by a substitution.
An obvious, but not always trivial, requirement for substitution application is
In the case of terms, “well-formedness” simply means that we consider only those strings of symbols as terms that can be generated inductively by the three rules in Definition 3.8.(3) Preservation of well formedness; i.e., replacing variables in a well-formed expression by well-formed expressions should result in a well-formed expression.
Let us assume that we have three collections of expressions and two linkable substitutions. The first substitution replaces variables in expressions from the first collection with expressions from the second collection, and thus its application produces expressions in the second collection. Analogously, the second substitution replaces variables in expressions from the second collection by expressions from the third collection and its application results in expressions from the third collection. In this situation, we do have two possibilities to transform expressions from the first collection into expressions from the third collection. First, we can apply both substitutions successively. Second, we can compose both “small step” substitutions into a single “big step” substitution. That is, we apply the second substitution to all the expressions appearing in the definition of the first substitution and obtain a new substitution replacing variables in expressions from the first collection by expressions from the third collection. This puts another feature of substitution calculi on the agenda:
from X to .
The composition of the two linkable finite substitutions from to and from to results, for example, in the finite substitution(4) Composition of linkable substitutions.
Obviously, we would like that the application of the “big step” substitution always produces the same result as the successive application of the two linkable “small step” substitutions; i.e., for a substitution calculus, we require that
For the two linkable finite substitutions above, this requirement can be expressed by the equation(5) The composition of substitutions is compatible with substitution application.
The compatibility of the composition of substitutions with substitution application usually ensures another useful property:
(6) The composition of substitutions is associative.
These are the six syntactic features we claim to be the essential characteristics of a substitution calculus as such. If a substitution calculus is, however, part of a bigger logic formalism where semantic structures are also considered, we will have some additional features concerning the interplay of syntax and semantics.
In analogy to substitutions, we first have to choose a way to describe
In Universal Algebra, we work exclusively with variables ranging over elements in sets, and thus variable assignments can be defined as maps from a set of variables into the carrier set of a -algebra , as in Definition 3.9.(7) Variable assignments, i.e., assignments of semantic items to variables.
In analogy to the step from substitution (declaration) to substitution application, each variable assignment should induce a corresponding
Definition 3.9 presents, for example, an inductive definition of the evaluation of -terms into elements in the carrier A of a -algebra induced by a variable assignment .(8) evaluation of expressions, computing for each expression a unique semantic item or truth value.
Since variable assignments establish a bridge from syntax to semantics, there is no composition of variable assignments in a substitution calculus. We should, however, have
For both new kinds of composition, it is desirable to have(9) The composition of substitutions with variable assignments as well as The composition of variable assignments with homomorphisms.
Finally, it would be reasonable to require(10) Compatibility with respect to substitution application and/or evaluation.
(11) Associativity for the three new possible combinations of the four kinds of composition, i.e., substitution–substitution–assignment, substitution–assignment–homomorphism, and assignment–homomorphism–homomorphism.
3.4.2. Substitutions by Algebraic Extensions
We now discuss the specialties of the “internalization approach” in view of the informal concept of a substitution calculus outlined in the last subsection.
Features (7) and (8): Variable assignments are formalized as maps from a set of variables into the carrier set A of a -algebra and the corresponding unique term evaluations are inductively defined maps according to Definition 3.9.
Introducing term -algebras and realizing that the inductive definition of unique term evaluations can be described as unique algebraic extensions of variable assignments , as stated in Proposition 3.5, has three immediate consequences.
- Feature (1):
- Substitutions simply become a special case of variable assignments and
- Feature (2):
- Substitution applications appear as a special case of term evaluations, namely as algebraic extensions . Applying a substitution to a -term means nothing but to compute the -term . As mentioned before, it is also common to use instead of the more informative notation in (10) in the case of finite sets of variables.
- Feature (3):
- Preservation of well formedness is implicitly ensured by the fact that the structures we define in Definition 3.10 (Term algebra) are indeed -algebras.
Feature (9): The composition of a substitution with a variable assignment is the variable assignment , while Feature (10), i.e., the compatibility of substitution application and evaluation, is ensured by the uniqueness of algebraic extensions: (see the left diagram below).

Feature (4), composition of linkable substitutions, becomes a special case of Feature (9): The composition of a substitution and a substitution is the substitution . In this way, Feature (5), composition of substitutions is compatible with substitution application, becomes a special case of Feature (10): (see the right diagram above), and 12 spells out this equation for the finite case.
The remaining part of Features (9) and (10) is also ensured by Proposition 3.5: The composition of a variable assignment with a -homomorphism , for example, is the variable assignment and the uniqueness of algebraic extensions ensures compatibility: .
Finally, all the compatibilities together with the associativity of composition of maps also gives us the three kinds of associativity required by Feature (11). The proof of the associativity
for example, is simply given by the compatibility of substitution application and evaluation, as well as associativity of map composition: for arbitrary substitutions , and assignments .substitution; (substitution; assignment) = (substitution; substitution); assignment,
Remark 3.6
(No Internalization). Of course, there is no need to utilize internalization of terms and uniqueness of algebraic extensions to establish a fully fledged substitution calculus for Universal Algebra! Instead, we could just separately work out each of the necessary definitions and proofs based on the inductive definition of terms analogous to Definition 3.9 (Evaluation of Terms). Internalization simply saves us a lot of work if it comes to substitutions!
On the other hand, internalization is obviously not helpful in establishing substitution calculi for pure syntactic logic frameworks and/or for logic frameworks without operations. Also in logic frameworks, where some variables may range over logic formulas, the internalization of terms will be of restricted help.
As an example of a definition that is independent of Proposition 3.5, we give an explicit inductive definition of substitution application.
Definition 3.11
(Substitution Application). For any sets X, Y of variables and any substitution , we can inductively define a corresponding substitution application such that :
- Variables:
- , for all ;
- Constants:
- , for all ;
- Operations:
- , for all .
Remark 3.7
(Kleisli Category). The composition of substitutions defined above, together with as the identity substitution for every set X, gives us a category of substitutions. In more abstract categorical terms, this is exactly the Kleisli category of the adjunction , which is equivalent to the full subcategory of of all term Σ-algebras (see, for example, [15]).
3.5. Two Model-Theoretic Implications of the Existence of a Free Functor
Before we turn to our actual topic of “derived operations”, it is maybe worth rounding up our discussion of monomorphisms and epimorphisms in . We have already mentioned in Corollary 3.2 that injective -homomorphisms are monomorphisms in since the functor is faithful and therefore reflects monomorphisms. The first observation is that the existence of the free functor now provides the implication in the other direction, since right-adjoint functors preserve monomorphisms.
Lemma 3.3
(Monic implies Injective). For every monic Σ-homomorphism , the underlying map is a monomorphism in , i.e., injective.
Proof. 
We consider an arbitrary set X and arbitrary maps such that .

By the uniqueness of algebraic extensions, we have and (Feature (10), compatibility of substitution application and evaluation), and thus the assumption entails . This implies since is monic. By pre-composition with , we obtain as required. □
Second, the free functor helps to elucidate the intuition behind the choice of the adjectives “accessible”/“reachable” in Definition 3.6, namely that each element in can be accessed/reached by first applying the map f and then successively applying the operations in .
Lemma 3.4
(Accessible via Map ≅ Accessible via Extension). For any Σ-algebra and any map we have for the algebraic extension . In such a way, is accessible via if, and only if, is accessible via .
Proof.
Feature (10), compatibility of substitution application and evaluation, ensures for any Σ-subalgebras of that f factors through if, and only if, factors through . □
By Lemma 3.4, Proposition 3.4, and Corollary 3.7, we obtain the following equivalences.
Corollary 3.9.
For any Σ-algebra and any map , the following statements are equivalent:
- 1.
- is accessible via .
- 2.
- is accessible via .
- 3.
- is an epimorphism in .
- 4.
- is an epimorphism in , i.e., surjective.
3.6. Terms and Derived Operations
For any set X and any -algebra the evaluation of -terms over X in is actually a map from into A. In Definition 3.9, we fix an arbitrary element and define a corresponding map by varying inductively over . That is, we describe the map from into A through an -indexed family of maps . This kind of splitting is the basis for the internalization trick.
We can, however, also proceed the other way around. We can represent the map from into A via a -indexed family of maps from into A or . is the singleton used in Definition 3.1 to declare the output arity of operation symbols.
Definition 3.12
(Derived Operations). For any set X of variables, any Σ-algebra and any Σ-term , we define a corresponding derived operation , i.e., the map
We call the maps derived operations since they are built up from the basic operations in (compare Definition 3.14 below). Derived operations live on the same “external level” as the basic operations, i.e., outside of carrier sets of algebras. Terms represent those derived operations, and thus, it is opportune to also have a complementary external view on terms and consider them as syntactic entities living together with operation symbols on the same external level. In particular, we can consider terms as entities existing independent of and prior to algebras.
To support and validate the external view on terms, we should avoid the sleight of hand in Definition 3.12 and define derived operations, independent of Definition 3.9, simply by constructing new maps from given maps.
The only two constructions we need for this purpose are available in any category with finite products: the composition of maps (morphisms) and the tupling of maps (morphisms). Since we use non-traditional finite products , instead of traditional Cartesian products , to define domains and codomains of operations, it is probably worth it to spell out the corresponding version of tupling we will rely on.
Definition 3.13
(Tupling of Maps). For any family of maps with we can construct a map , defined by
For an empty family of maps, denotes the constant map assigning to all the only element in represented by the empty tuple .
Now, we are prepared to give an inductive definition of derived operations. The base cases are projection maps, represented by variables and constant maps. The induction step is implicitly divided into two steps: first tupling and then composition with a basic operation.
Definition 3.14
(Construction of Derived Operations). For any set X and any Σ-algebra we define inductively for all Σ-terms a corresponding derived operation as follows:
- Variables:
- for all , the (projection) map is defined by for all ;
- Constants:
- , for all ;
- Operations:
- , for all , .
3.7. Syntactic Lawvere Theories
As long as we restrict ourselves to finite sets of variables, syntactic Lawvere theories are the ultimate implementation of the external view on terms while also incorporating the internal view, as we will soon see. We will not give a fully detailed exposition but just enough to be prepared for the discussion and definition of derived graph operations in Section 5 (the interested reader may consult [8] for more details).
3.7.1. Construction of Lawvere Theories
Relying on the concept of -term and a substitution calculus, as discussed in the last section, we can define for any signature a syntactic category as follows:
- Objects:
- As objects, we choose canonical finite sets of variablesFor all , we assume to be equipped with a fixed total order ; thus, we can reuse the tuple notation to represent maps as discussed in Section 2.
- Morphisms:
- Morphisms are all tuples representing a substitution (declaration) .
- Identities:
- The identity on is the tuple representing the substitution .
- Composition:
- The composition of two tuples and is the tuple representing the substitution where is the application of the substitution according to Definition 3.11 (compare also (11)).
- Laws:
- Identity and associativity law are ensured by Feature (5), composition of substitutions is compatible with substitution application (compare also (12)).
3.7.2. Properties of Lawvere Theories
The category has all finite products. We describe binary products as follows:
- The product of two objects and is defined by with projections and .
- The tuple of two morphisms and in is given by
Remark 3.8
(Product versus Sum). The tentative reader has surely realized that is not the product but the sum of and in the category and that represents the cotuple of the two maps and in . However, by choosing the direction of morphisms in in accordance with the direction of their semantics, , indeed becomes the categorical product of and in . In other words, it is much more convenient for us to describe as a category with finite products instead of a category with finite sums. In this way, we avoid, especially, the needless use of opposite categories.
Nevertheless, the reader should keep in mind that syntactic entities are usually and most conveniently constructed by colimits in while the semantics as interpretation paradigm turns those colimits on the syntactic level into corresponding limits on the semantic level. We do have, for example, the exponential law with “” denoting this time the Cartesian product of sets.
The construction of syntactic Lawvere theories for signatures is a free construction on the “external meta-level”. More specifically, there is, for any signature an equivalence between the category and the category of all finite product-preserving functors from into : for every finite product preserving functor , there is a corresponding -algebra with carrier and operations defined for each n-ary operation symbol in by with the isomorphisms , provided by the assumption that preserves finite products, and the obvious isomorphism .
Conversely, for every -algebra the assignments , for all , and give rise to a unique finite limit preserving functor such that . This is ensured by Definitions 3.13 and 3.14.
Finally, comprises all finite term -algebras in the following sense: it is well-known that hom-functors preserve limits and thus, especially, finite products. In such a way, for all the hom-functor preserves finite limits. According to the above equivalence of categories and the Yoneda Lemma, the corresponding -algebra satisfies the universal property stated in Proposition 3.5. This means, however, nothing but the -algebras and being isomorphic.
4. Graph Algebras and Graph Term Algebras
Relying on the categorical reconstruction of concepts, the constructions and results of traditional Universal Algebra in Section 3, we present in this section a generalization of those concepts, constructions and results to graph algebras.
4.1. Graph Signatures, Graph Algebras, and Homomorphisms
We consider the composition of two morphisms in a category as a graph operation. The arity of a corresponding operation symbol could be declared in the following way.
Compared to traditional algebraic operations, we can presently infer some essential differences [7]:
- Two
- different kinds of input items. This is evident due to working with graphs that consist of both vertices and edges. Instead of a single set, we therefore declare a graph as the input arity.
- Arbitrarily
- many output items. A single output is assumed for algebraic operations, but graph operations can produce arbitrarily large finite graphs as output. Similar to the input, the output arity is chosen to be a graph.
- Output
- is often related to the input. In the case of the composition operation above, the relation between the two arity graphs and is clear from the labelling: the output edge has the same source and target as the input edges and , respectively. Instead of always requiring coherent labeling, we introduce a third arity graph , called the boundary of , to encompass the connection between input and output in a fitting way.
We summarize the previous discussion as the following definition.
Definition 4.1
(Graph signature). A graph signature is given by
- A set of operation symbols,
- A map assigning to each operation symbol in its arity span , i.e., a span of inclusion graph homomorphisms between finite graphs such that the sets and as well as the sets and are disjoint. The graphs , , and are referred to as the input arity, boundary arity, and output arity of , respectively.
If is the empty graph for , we also say that is a constant symbol. Note that in this case.
It is maybe worth mentioning that the disjointedness condition is equivalent to the condition that is the componentwise set intersection of the graphs and , i.e.,
Remark 4.1
(Arity Renamings). In contrast to traditional operations, we use explicit names to identify the input and output “positions” of a graph operation. Names can, however, be chosen arbitrarily, and we should be prepared to rename, if necessary, the arities of a graph operation.
An arity renaming ϱ from an arity span to another arity span is simply a triple of graph isomorphisms , , such that the following diagram commutes.

Remark 4.2
(Notational Conventions). For all finite graphs used in arity spans, we assume that the corresponding sets and are equipped with a fixed total order. Relying on our conventions in Section 2, this allows us to represent any graph homomorphism as a pair of tuples , , where , and () the image of the i-th (j-th) element in (), , . For any arity span , we assume that inherits the order from and , respectively.
We impose the disjointness condition in Definition 4.1 to syntactically distinguish between input items of a graph operation and the new output items produced by a graph operation. Another objective is to be able to later infer the arity of a “graph operation expression” based only on the expression itself and the arities of the operations symbols defined in the corresponding signature.
To achieve this goal, we will use “canonical arity spans” to describe the arities of operation symbols and graph operation expressions. In a canonical arity span, we use canonical sets of input vertices and of input edges with and . In the same way, we use canonical sets of output vertices and of output edges with and .
Example 4.1
(Signature for Categories). We define a signature with an operation symbol to denote operations composing two edges and an operation symbol to denote operations, assigning to vertices corresponding identity edges.
As per Definition 4.1, we extend the arity ofproposed in (14) to the span of graph homomorphisms shown in Figure 1 with a boundary graphconsisting of only two vertices,and. This encapsulates exactly the desired requirements for a composition operation with regards to sources and targets.
Figure 1.
Arity declaration for the operation symbol .
Analogously, the arity of , shown in Figure 2, encapsulates the requirements for an identity operation with regard to sources and targets.
Figure 2.
Arity declaration for the operation symbol .
is a locally small category, and we employ here the same exponential notation for hom-sets as we did for sets in Section 3. That is, for any graphs and , denotes the set of all graph homomorphisms from into .
Graph operations are maps, i.e., morphisms in ! Specifically, an operation on a graph should take as input a graph homomorphism in and return as output a graph homomorphism in . This procedure needs to respect the boundary, which is ensured by requiring the resulting square being commutative.
Definition 4.2
The maps inare referred to as graph operations.
(Graph Algebra). Let be a graph signature. A (graph) -algebra is given
- By a graph, called the carrier of , and
- By a familyof maps such that the following diagram commutes for allinand all graph homomorphisms.
In the specific case where is the empty graph , the set becomes a singleton, as there is exactly one graph homomorphism , represented by a pair of empty tuples . Thus, for any constant symbol in , with , the corresponding graph operation returns a subgraph of , i.e., it returns the image of under .
In the case where the signature has no constant symbols, the empty graph constitutes a -algebra, called the empty -algebra.
Example 4.2 
(Categories as Graph Algebras). We consider the graph signature in Example 4.1.

Obviously, any small categorygives rise to a-algebrawith the underlying graphofas carrier: the graph operationis defined by the single equationfor allwhere “” denotes the composition in. For the two vertices in, the images with respect toare always fixed due to the commutativity condition in Definition 4.2:and.
Not every-algebra, however, can be seen as a category, since it may fail to satisfy the identity and/or the associativity law. In [7], we presented some ideas concerning equations for graph algebras, but the development of a full equational calculus is a topic for future research.
Example 4.3
(Chosen Pullbacks). Graph algebras can serve as a conceptual tool to give a precise meaning to statements like “let be a category with chosen pullbacks”.
We define the arity of an operation symbolas the span of inclusion graph homomorphisms shown in Figure 3. To choose pullbacks for a small categorythen means nothing but to define a graph operationassigning to each cospanina corresponding pullback span.
Figure 3.
Arity declaration for the operation symbol .
Remark 4.3
(Built-in Projections). Given a “set of indices” I and a “carrier set” A, we do have a projection map at hand for any index , as described in Section 2.
Analogously, we obtain for a “graph of indices”and a “carrier graph”a projection mapfor any subgraphofby simple precomposition with the inclusion graph homomorphism:
In this way, we do have for any-algebraand any arity span(as in Definition 4.1) withexactly one map fromtosatisfying the commutativity condition for graph operations in Definition 4.2, namely the projection. In case, is simply the identity on.
We call these projections built-in since their semantics is completely determined by their arity! After the choice of the carrier of a graph algebra we do have these projections available independent of and prior to the choice of the semantics of the operation symbols .
A crucial methodological point is that we can use these built-in projections without being forced to include corresponding auxiliary operational symbols inand/or without any need to define their semantics when defining graph algebras. In the traditional approach, we are forced to do this because there is no concept of boundaries at all, or, in other words, all boundaries in our sense are by default empty in traditional Universal Algebra.
Our reformulation of the definition of homomorphisms for traditional algebras in Definition 3.3 applies analogously to graph algebras.
Definition 4.3
(Graph Algebra Homomorphism). Let be a graph signature. A -homomorphism between two -algebras and is a graph homomorphism satisfying the following homomorphism condition:

For any graphs , , and each graph homomorphism induces by postcomposition a map and thus we can, more abstractly but equivalently, express the homomorphism condition (HC) via the requirement that the above right square of maps commutes. Note that in the case of constant symbols , , the homomorphism condition turns into the equation if we apply our conventions in Section 2 and Remark 4.2 concerning the tuple notation.
Example 4.4
(Functors as Homomorphisms). In the case of -algebras as defined in Example 4.2, the homomorphism conditions for the operation symbols and , according to Definition 3.3, are nothing but the usual requirements for functors to be compatible with composition and identities, respectively.
-algebras and -homomorphisms together constitute a category : The composition of two -homomorphisms and is given by the composition of the underlying graph homomorphisms and . Lastly, the identity -homomorphism for any -algebra is given by the identity graph homomorphism .
Proposition 4.1
(Forgetful Functor). The assignments and define a faithful forgetful functor:
The homomorphism condition for -homorphisms between -algebras in Definition 3.3 has exactly the same structure as the homomorphism condition for -homomorphisms between graph -algebras in Definition 4.3. In such a way, the pure categorical proof of Theorem 3.1 can be directly transformed into a proof of the corresponding statement for graph algebras, and thus, we obtain the following theorem “for free”.
Theorem 4.1
(Limits of Graph Algebras). inherits any small limit from the category , i.e., the functor creates small limits. therefore has all small limits since does.
4.2. Comparison with the Old Definitions
Guided by the pioneering generalized sketch framework developed in the 1990s by a group around Zinovy Diskin [3,4,5], we introduced in [7] a different definition of graph signatures and graph algebras, respectively. Ref. [7] considers a graph inclusion as the arity of an operation symbol and defines an operation on a graph as a map from to , making the following triangle commute for any .
The need for projection operations, among other issues, advised us to introduce explicit output arities. At that point, we could have also chosen cospans to declare the arities of graph operations instead of the spans in Definition 4.1. The choice of spans has, however, many advantages that we will try to point at later in the paper.
In this subsection, we argue that the new variant and the old variant in [7] are semantically equivalent as either definition of arity, algebra, or homomorphism can be obtained from the other.
4.2.1. Comparison of Arity Declarations
For any arity span in Definition 4.1, we can simply construct a pushout to obtain the result arity
The pushout of the arities of the operation symbol is visualized in Figure 4.
Figure 4.
The pushout of arity declarations for the operation symbol .
Pushouts in (as in any topos) preserve monomorphisms, and, moreover, pushouts with a monomorphism involved are also pullbacks ([16], 13.3). Equation (15) ensures that we can choose the specific pushout , which makes the resulting into a graph inclusion, matching the definition in [7]. Note that implies .
Conversely, given a cospan of graph inclusions, we can construct the intersection , i.e., the componentwise intersection of the vertex and edge sets. This is well-defined as both and are subgraphs of the same graph . The resulting commutative square of inclusion graph homomorphisms is a pullback in where the span satisfies the condition in Definition 4.1. In the case where , the square is also a pushout!
Arities of graph operations are, however, defined in [7] by a single graph inclusion only. In this situation, we can construct a cospan of graph inclusion with the smallest subgraph of containing all vertices in and all edges in . By construction, we have . As for cospans, in general, is defined to be the graph . However, the crucial observation is that will always be a discrete graph, i.e., a graph without edges! Note that this construction is a special case of the construction of so-called initial pushouts in ([9], 6.1).
Since, for a pushout of arities, implies , this means, especially, that the original definition of arities of graph operations in [7] does not allow us to consider built-in projections (see Remark 4.3) as legal graph operations. This was one of the main reasons that we introduced spans of graph inclusions as arities in this paper.
In conclusion, the span and cospan version are inverse to each other (at least in ) while the original version in [7] is a special case of the cospan version, which is less expressive than the other two versions. All three variants give us, however, a pushout of arities and inclusion graph homomorphisms at hand.
4.2.2. Equivalence of Graph Operations
Given a pushout of arities, we consider an arbitrary input .
For any with , there exists, due to the pushout property, a unique with and . Conversely, for any with , we have, trivially, .The uniqueness of mediating morphisms ensures that the assignments and are inverse to each other. This observation ensures that there is a one-to-one correspondence between maps from to , satisfying commutativity condition (19), and maps from to , satisfying the commutativity condition in Definition 4.2.
4.2.3. Equivalence of Homomorphism Conditions
By extending the equivalence of graph operations, the equivalence of the respective homomorphism conditions can also be straightforwardly shown utilizing the uniqueness of mediating morphisms for the pushout of arities, as the interested reader may check.
Remark 4.4
(Graph of a Graph Operation). For any map , its graph is usually defined as the binary relation . Often, the story is even turned, and maps are introduced as those binary relations that are left-total and right-unique.
Given a pushout of arities and a graph operation, we could, analogously, consider the setas the graph of the graph operation. Utilizing the projections fromintoand, we could even lift up properties like left-total and right-unique to characterize those subsets of that correspond to graph operations.
This observation may be a basis for defining Skolemization in Logics of Statements in Context [1] once we have integrated operations into those logics.
also has another important role, which was probably one of the reasons that the original definition of sketch operations in [3,4,5] relied on graph inclusions.is the only place where the input items of a graph operation and the new items, created by the graph operation, can be related. In such a way, we have to useif we want to describe and specify properties of the output of a graph operation that depend on properties of the input.
Example 4.5
(Graph of Pullback Operation). Figure 5 shows the pushout of arity declarations for the operation symbol . Constructing the graph of pullback operations, as described in Example 3, considers for any chosen pullback the whole pullback square, and not just the pullback span.
Figure 5.
The pushout of arity declarations for the operation symbol .
Example 4.6
(Chosen (co)limits). In general, any chosen (co)limits of diagrams of a fixed shape in a category give rise to a corresponding graph operation on where the arity is simply given by all the vertices in while arity represents the shape of the corresponding (co)cones.
In such a way, the pushoutcombines the fixed shapeof diagrams with the shape of corresponding (co)cones, and thus, the elements in the graph of the corresponding graph operation onrepresent, at the same time, a diagram and a (co)cone for this diagram.
Remark 4.5
(Advantages of Spans of Arities). Starting with a span of arities as in Definition 4.1, we obtain a corresponding commutative square of arities via a simple pushout construction. That this square becomes, moreover, in any topos, a pullback is an essential side effect.
If we start, in contrast, with a cospan, we could construct a pullback to obtain a commutative square of arities. In the case of graphs (and probably in arbitrary pre-sheaf topoi), it is sufficient to require that the cospan of inclusion morphisms is jointly epic to make the pullback square simultaneously a pushout square. We are, however, not sure that this condition is sufficient for arbitrary topoi.
The tricky construction of initial pushouts for a single arity inclusion (and not a cospan!) may also generalize to arbitrary pre-sheaf topoi but probably not to arbitrary topoi.
The original definition of arities and graph operations in [7] turned out to not be appropriate to define derived graph operations. On one hand, projections are necessary to define an appropriate notion of derived graph operations. The original definition excludes, however, projections. On the other hand, the construction of instances of graph operations in Section 5.3.2, by means of epi-mono factorizations and pushouts, cannot equivalently be mimicked by means of the original definition. Even the universal property of initial pushouts is not helpful in establishing an equivalence.
4.3. Graph Subalgebras
The definitions and results for graph algebras presented in this subsection are new and not found in [7].
The effort we spent in Section 3 to lift up the traditional exposition of algebras to a more categorical one pays off now. We can directly transfer most of the definitions and results from algebras to graph algebras. The only difference is that the “ad hoc totalization trick” in the proof of Proposition 3.3 does not work in the case of graph algebras and that there is no axiom of choice in .
In contrast to Section 3, we do not distinguish between “subalgebras” and “inclusion homomorphisms”. We define “subalgebras” simply as “inclusions”.
Definition 4.4
(Graph Subalgebra). Let be a graph signature. A -algebra is a -subalgebra of a -algebra if and and the inclusion graph homomorphism establishes a -homomorphism .
We know that the monomorphisms (epimorphisms) in are exactly the injective (surjective) graph homomorphisms, respectively. Since the functor is faithful and faithful functors reflect monomorphisms and epimorphisms, we obtain
Corollary 4.1
(Injective and surjective Homomorphisms). If the underlying graph homomorphism of a -homomorphism is injective (surjective), then is a monomorphism (epimorphism) in .
The category has all small limits and colimits, and those are obtained by componentwise limits and colimits, respectively, in . This means, especially, that has all small multiple pullbacks (see Remark 3.3). Due to Theorem 4.1, we can define, in such a way, the intersection of graph subalgebras analogous to the intersection of subalgebras in Corollary 3.3.
Corollary 4.2
(Intersection of Graph Subalgebras). For any set I, any -algebra , and any diagram of -subalgebras , of there is a unique -subalgebra of with , i.e., and , that is a -subalgebra of for all .
Moreover, the inclusion-homomorphisms,andconstitute a multiple pullback, i.e., a limit cone of the diagram.
We callalso the intersection of the I-indexed familyof-subalgebras ofand may use the notations,or, simply,to denote.
The category is well powered; i.e., the collection of all graph subalgebras of a graph algebra is a set, and thus, we can define the concept “accessible via a graph homomorphism”.
Definition 4.5
(Graph Subalgebra accessible via a Graph Homomorphism). For any -algebra and any graph homomorphism , let be the set of all -subalgebras of such that factors through the inclusion graph homomorphism ; i.e., there exists a graph homomorphism such that .
We denote bythe intersection of, according to Corollary 4.2. In particular, the carrier ofis the intersectionof graphs. We callthe-subalgebra of accessible (reachable) via or the homomorphic image of with respect to .
In the case of inclusion graph homomorphisms, we also use the notationinstead ofand also callthe-subalgebra of generated by .
Note that the graph homomorphism in Definition 4.5 is unique, if it exists, since the inclusion graph homomorphism is a monomorphism in .
We can also transfer Corollary 3.4 to graph algebras since, for any graph homomorphism , the set-theoretic image of with respect to constitutes a subgraph of . Moreover, we have for the set of all subgraphs of .
Corollary 4.3
(Homomorphic image includes Image). For any -algebra and any graph homomorphism , we have for the set-theoretic image of with respect to .
Definition 4.6
(Accessible and Generated Graph Algebras). Let be a -algebra.
- 1.
- is accessible via a graph homomorphism if .
- 2.
- Ifis accessible via an inclusion graph homomorphism, i.e., if, we say also thatis generated by .
- 3.
- is said to be generated if it is generated by the empty graph, i.e., accessible via the unique graph homomorphism from the initial object in to .
Corollary 4.4.
A-algebrais generated if, and only if, there are no proper-subalgebras of.
Corollary 4.5.
If a signaturehas no constant symbols, then the empty-algebra is the only generated-algebra.
The concept accessible via a graph homomorphism can be utilized to find a characterization of epimorphisms in . First, we observe that “accessible” implies “epic”.
Lemma 4.1
(Accessible implies Epic). A -homomorphism is an epimorphism in if is accessible via the underlying graph homomorphism , i.e., if .
Proof.
We consider arbitrary -homomorphsms such that .
We know that the subgraph of with , together with the inclusion graph homomorphism is an equalizer of the graph homomorphisms in . According to Theorem 4.1, there is a unique -algebra such that becomes an inclusion -homomorphism , which is, moreover, the equalizer of the -homomorphisms .
The assumption ensures that there exists a unique graph homomorphism with . Due to the construction of in Definition 4.5, we have an inclusion -homomorphism .
The accessibility of means , and thus, we obtain, finally, . This means, however, that the equalizer of and in is the identity on and thus, we have as required. □
We can also show that graph subalgebras are regular monomorphisms. Unfortunately, the “ad hoc totalization trick”, used in the proof of Proposition 3.3, does not work for arbitrary graph operations, since we may have, in contrast to traditional operations, non-empty boundaries and a corresponding commutativity requirement for graph operations. The simplest example, where this trick fails, is an operation that simply outputs a chosen edge between two distinct nodes.
What we need is a more well-behaved procedure of transforming partial graph algebras into total graph algebras. We therefore develop in Section 4.4 a corresponding free construction called term completion.
Proposition 4.2
(Graph Subalgebras are Regular Monos). For any -subalgebra of a -algebra there exists a -algebra and parallel -homomorphisms such that is the equalizer of and in .
Proof.
Graph Operations on : We extend to a partial -algebra (see Definition 4.7) by defining for each in a corresponding partial graph operation according to Case 1, Case 2, and Case 3.
Utilizing the term completion construction and its characterization as a free construction, as presented in Section 4.4, we will sketch a proof modifying the proof of Proposition 3.3.
We construct the pushout of the span of inclusion graph homomorphisms (see the left diagram below). We set . Since is monic in both graph homomorphisms are monic too and, moreover, the pushout square is as a pullback square as well. This ensures, especially, that is the equalizer of the graph homomorphisms in .
Graph Operations on : We extend to a partial -algebra (see Definition 4.7) by defining for each in a corresponding partial graph operation according to Case 1, Case 2, and Case 3.The operations in are defined exactly in a way that the graph homomorphisms and become -homomorphisms , in the sense of Definition 4.8, and thus we obtain a commutative square in (see the middle diagram above).
Applying the functor , we transform this commutative square in into a commutative square in . Taking into account Corollary 4.6 and (23), we obtain the commutative diagram on the right above.
The underlying square of graph homomorphisms is again a pullback in since the inclusion graph homomorphism is monic in .
Theorem 4.1 ensures, finally, that the -homomorphism is the equalizer of the -homomorphisms . □
The regularity of entails that the concepts accessible and epic are equivalent.
Proposition 4.3
(Accessible ≅ Epic). For any -homomorphism , it holds that is accessible via the underlying graph homomorphism ; i.e., in other words, is equal to the homomorphic image of with respect to , if, and only if, is an epimorphism in .
Proof.
“Accessible implies epic” has been shown in Lemma 4.1. We show now that “epic implies accessible”: We consider an arbitrary -subalgebra of such that there exists a graph homomorphism with . Due to Proposition 4.2, there exist -homomorphisms such that is the equalizer of and . Due to the assumption , we obtain and thus , since is epic. This means, however, that and, finally, due to the construction of in Definition 4.5. □
The axiom of choice is not valid in . Therefore, the set-theoretic image of the carrier of a -algebra with respect to a - homomorphism is, in general, not closed with respect to operations in . As a consequence, not every epic -homomorphism needs to be surjective. We adapt the standard example of the composition of morphisms in categories.
Example 4.7 
(Epic ≇ Surjective). We consider a -homomorphism between two finite -algebras and , as depicted below.

is empty, whilehas exactly one elementgiven by the assignments,.andare in the set-theoretic image, while the result of applyingto, namely, is not.is not surjective but epic since.
4.4. Partial Graph Algebras and Their Term Completion
In practice, graph operations are often partial graph operations. The sketch operations introduced in [4,5], for example, can be seen as partial graph operations where the domain of definition is specified by diagrammatic predicates. Therefore, we have decided to also present in this paper the very basic definitions for partial graph algebras.
This decision was also influenced by the observation that we could prove Proposition 4.2 for arbitrary graph signatures based on a well-behaved completion procedure transforming partial (graph) algebras into total (graph) algebras. To our surprise, the construction of (graph) term algebras turns out to be just a special case of this new procedure.
Definition 4.7
The partial maps in are referred to as partial graph operations.
(Partial Graph algebra). A partial (graph) -algebra is a pair given
- By a graph, called the carrier of , and
- By a familyof partial maps such that the following diagram commutes for allinand all graph homomorphisms.
Be aware that constants can also be partial! For any constant symbol in , with , we do have exactly two possibilities, since is a singleton: Either , i.e., the constant is defined, or , i.e., the constant is not defined.
Definition 4.8
(Partial Graph Algebra Homomorphism). A -homomorphism between two partial -algebras and is a graph homomorphism satisfying the following homomorphism condition

In other words, the definedness of partial operations has to be preserved by a homomorphism but does not need to be reflected!
Partial graph -algebras and -homomorphisms between them constitute a category : The composition of two -homomorphisms and is given by the composition of the underlying graph homomorphisms and . The identity -homomorphism for any partial -algebra is given by the identity graph homomorphism . We consider graph -algebras as special partial -algebras and thus is a full subcategory of .
Proposition 4.4
(Forgetful Functor). The assignments and define a faithful forgetful functor
By introducing a fresh new element whenever an operation is not defined for a certain input, we can transform any partial (graph) algebra into a total (graph) algebra.
Remark 4.6
(Syntactic Representation of Inputs). In addition to our notational conventions in Section 2 and Remark 4.2, we will rely on the following syntactic representation of inputs of graph operations: For any graph and any in an input is represented by two strings, representing the vertices and the edges in , respectively, separated by the symbol “|”
where and . In the case , the only the input is represented, in such a way, by two separated empty sequences: .
Of course, we could work with any other syntactic representation as long as the following two important properties are satisfied: (1) Uniqueness, i.e., for allwe haveif, and only if,; (2)is indeed a representation, i.e., we are able to reconstruct fromthe corresponding graph homomorphismwith the help of the information aboutin the signature. In the case wherehas no isolated vertices, for example, we can uniquely represent anyby the stringonly!
Definition 4.9
(Term Completion). Let be a graph signature and be a partial -algebra. We define the -term completion of the graph with respect to the partial -algebra as the smallest graph satisfying the following three conditions:
- Generators:
- Constants:
- For all constantsin, such that, the graphcontains
- as a vertex, for each vertexin;
- as an edge, for each edgein, whereand
- Operations:
- For allinwithand anysuch that there is nowith,contains
- as a vertex, for each vertexin;
- as an edge, for each edgein, where
Obviously, we have
Remark 4.7
where the definition ofis spelled out, explicitly, in Definition 4.10. In light of this observation, one can look at the term notation as a means to solve two problems:
(Term Construction by Pushouts). The construction of -terms in Definition 4.9 can be organized as a successive application of term-construction steps starting with the graph : A term-construction step in the case Constants means that we construct, in parallel, for a constant symbol the terms for all vertices and edges in . Analogously, a term-construction step in the case Operations means that we construct for an operation symbol and an input , in parallel, the terms for all vertices and edges in . Each term-construction step extends an intermediate graph to a graph . This extension is, however, nothing but the construction of the following pushout:
where the definition ofis spelled out, explicitly, in Definition 4.10. In light of this observation, one can look at the term notation as a means to solve two problems:- 1.
- The term notation provides a uniform mechanism to create unique identifiers for the new graph items introduced by applying a non-deleting injective graph -transformation rule [9].
- 2.
- At the same time, the term notation encodes all the information necessary to uniquely identify the pushout that has been creating the new items.
The following term-completion construction is new and has never even been defined for traditional partial algebras. Utilizing the operations in to the greatest possible extent, we can straightforwardly extend to a total -algebra with carrier .
Definition 4.10
(Term-Completion Algebra). We can extend any partial -algebra to a total -algebra as follows:
- Constants:
- For all constantsin:
- Utilizing:
- Ifis defined, we simply reuse it:
- Completion:
- Ifis not defined, i.e.,we set
- for each vertexinand
- for each edgein.
- Operations:
- For allinwithand any:
- Utilizing:
- If there is awith, we reuse:
- Completion:
- If there is nowith, we set
The definitions ensure that the constructed pairs of maps are indeed graph homomorphisms and that the operations in satisfy the commutativity condition in Definition 4.2. Moreover, the cases “Utilizing ” are defined in such a way that we obtain
Corollary 4.6
(Embedding). For any partial -algebra , the inclusion graph homomorphism constitutes a -homomorphism in , and thus, due to (21), if is a total -algebra.
We can adapt and generalize the proof of Proposition 2 (Free graph algebras) in [7] to a proof that term completion is a free construction.
Proposition 4.5
(Term Completion as a Free Construction). For any partial -algebra , the total -algebra has the following universal property: for any total -algebra and any -homomorphism there exists a unique -homomorphism such that the defining condition is satisfied.

Proof.
We prove this by structural induction according to Definition 4.9 and Remark 4.7.
- Generators:
- In this base case, the defining condition forces for all and for all .
- Constants:
- In the second base case, we have, for all constants in :
- Utilizing:
- If is defined, the definition of operations in , the defining condition and the assumption that is a -homomorphism ensure that satisfies the homorphism condition for the constant :
- Completion:
- If is not defined, the definition of operations in and the required homomorphism condition for forces for each vertex inFor each edge in we obtain, analogously, .
- Operations:
- We have, for all in with and any ,
- Utilizing:
- If there is a with , then the definition of operations in , the defining condition and the assumption that is a -homomorphism ensure that satisfies the homomorphism condition for :
- Completion:
- If there is no with , the induction hypothesis is that is already defined on a subgraph and that . This ensures . In the induction step, we extend to the graph . The definition of operations in and the required homomorphism condition for forces for each vertex inFor each edge in we obtain, analogously, .
. □
The assignments and define, as usual for free constructions, a functor , and this functor is left-adjoint to the inclusion functor .
Due to Corollary 4.6 we even have , i.e., is a full reflective subcategory of . In particular, we have for any -homomorphism in
4.5. Graph Terms and Graph Term Algebras
Graph term algebras are just the special case of term-completion algebras where all the graph operations in are completely undefined, i.e., where everything is determined by the carrier only.
Definition 4.11
(Graph Term Algebras). Let be a graph and be the corresponding unique partial -algebra where all graph operations are completely undefined.
- Graph terms
- : We denote the graph, according to Definition 4.9, also byand call it the graph of all (graph) -terms on .
- Graph term algebra
- : We denote the term completion-algebra, due to Definition 4.10, also byand call it the-term graph algebra on .
Assigning to any graph the corresponding unique partial -algebra where all graph operations are completely undefined, defines a functor from to that is left-adjoint to the forgetful functor in Proposition 4.4. Combining this adjunction with the adjunction in (22) gives us the desired universal property of graph term algebras at hand.
Proposition 4.6
(Graph Term Algebra as a Free Construction). Given a graph , the -term graph algebra has the following universal property: For any total -algebra and any graph homomorphism , there exists a unique -homomorphism such that the defining condition is satisfied.

It might be worth mentioning that Proposition 4.6 also enables us to straightforwardly transfer Lemmas 3.3 and 3.4 in Section 3.5 to the graph algebra setting.
The definition of graph term algebras and their characterization as a free construction is the main result in [7]. We claimed, “The Kleisli category of the new adjunction provides an appropriate substitution calculus.” However, as time passed, we realized that this claim is not fully true.
- Substition Calculus:
- Graph term algebras manifest the “internalization approach” in the case of graph algebras. Relying on Proposition 4.6, we can indeed obtain a fully fledged substitution calculus, meeting the requirements formulated in Section 3.4.1. Based on the idea that a substitution (declaration) is now given by a graph homomorphism and that a variable assignment is a graph homomorphism for a -algebra , we can simply transfer all the discussions, definitions and results from Section 3.4.2 to graph algebras. We will spare the reader this copy–paste exercise.
- No appropriate concept of Derived Operation:
- In traditional Universal Algebra, we do have a one-to-one correspondence between the “internal view” of terms as elements of free algebras and the “external view” of terms as an appropriate representation of derived operations (compare Definitions 3.12 and 3.14). It took us a while to realize that this one-to-one correspondence breaks down when it comes to graph algebras and even longer to understand the reasons. We discuss and address this problem in the next section.
5. Derived Graph Operations
We now discuss the reasons why graph terms, in our opinion, do not provide a fully adequate and appropriate concept of derived graph operation. First, each graph term, interpreted as an operation in a given graph algebra, will only produce isolated single vertices or single edges (without the source or target, respectively). What we do need, however, are graphs as outputs of derived graph operations! This flaw could be repaired by considering not single graph terms but subgraphs of graphs of graph terms.
Lemma 5.1
(Operations by Subgraphs). For a given graph , any subgraph defines a span of graph inclusions with . Moreover, we obtain for all graphs a map defined by for all and satisfying the commutativity requirement for graph operations in Definition 4.2.
However, this solution is not quite satisfactory. Each item in is given by a separate term expression, and the different term expressions may represent, in general, different “computation schemes”. What we want and need, especially in practical applications, is a single graph operation expression built up from variables and the symbols in such that the corresponding derived operation for a -algebra produces, for any input, all (!) output items simultaneously with the same computation. Moreover, we would like to be able to define the semantics of these graph operation expressions, i.e., the corresponding derived graph operations in -algebras, independently of graph term algebras and in a comparably easy, well-structured inductive way as we did for terms in Definition 3.14.
Unfortunately, traditional terms do not provide a fully appropriate blueprint to define such graph operation expressions. In Definition 3.8, terms are constructed using the following steps: The two basic steps, Variables and Constants, and the induction step Operations, which is implicitly split into two steps—(1) Tupling and (2) Symbolic Sequential Composition of a tuple with an operation symbol. This splitting becomes apparent in Definition 3.14 (Construction of Derived Operations).
In the case of graph operations, the step Variables turns into a step (Built-in) Projections. Besides this, there is nothing wrong with any of the steps except the step Tupling.
Example 5.1
(Composition of four Edges). To illustrate the problems with tupling, we consider the composition of four edges. We are interested in a “graph operation expression” built up of three copies of the operation symbol , as defined in Example 4.1. The input arity of the expression should be the graph and the output arity should be the graph 5 with representing the composition of the four edges in the input arity.
An obvious idea is that in a first step, two parallel applications of produce the graph with representing the composition of the edges , and representing the composition of the edges , , respectively. In a second final step, the third application of should then produce the edge .
If we describe the first step by a tuple, we will not obtain as the output arity but only a pair of separated edges. This pair of edges, however, does not match the input arity of and thus the second step can not be performed.
One could argue that we can repair this flaw a posteriori by “gluing” the two separated graphs on the overlapping part, i.e., on the vertex in the example. This construction, however, would be rather complicated and pathological, as it would consist of a mixture of colimit and limit constructions. In the next subsections, we will propose a more systematic and well-behaved mechanism based on a priori “soldering”.
5.1. Reconstruction of Syntactic Lawvere Theories
In this section, we analyze the construction of syntactic Lawvere theories in more detail to better understand the “nature of tupling” and to find a way to solve the problems with tupling pointed at in Example 5.1.
In Section 3.7, we defined syntactic Lawvere categories , relying on a given concept of term and a corresponding substitution calculus. Moreover, we have seen that a syntactic Lawvere category can be characterized as a finite product category freely generated by a signature . Following this observation, we will now turn the story and reconstruct the concept of term by means of the language of finite products and a corresponding axiomatization of finite products.
5.1.1. Categories with Finite Products
We start with a standard definition of finite products. A category has finite products if, and only if, the following ingredients are present:
- has an empty product (terminal object) , i.e., for any object A in there is a morphism such that
- For any family , of objects, there is an object together with projections , such that
- For any object B and any family , of morphisms, there is a morphism withMoreover, we have and .
- Finally, for all morphisms , the following equation holds
5.1.2. Categories Based on Finite Product Expressions
To reconstruct syntactic Lawvere categories, we define, in a first step, reflexive graphs with finite product expressions as edges and an associative composition. A finite product expression (or fp-expression for short) is a string of symbols built up of variable symbols, operation symbols, and angle bracket symbols to denote tupling, the semicolon symbol “” to denote symbolic composition, and the auxiliary comma symbol “” to separate substrings.
In the second step, we generate from fp-expression graphs finite product categories with equivalence classes of fp-expressions as morphisms.
We will only outline the definitions, constructions and results. One possibility to do it completely formally and precisely is to reuse, for example, the well-developed theory of specifications of partial algebras with conditional existence equations [17,18] and to construct the finite product categories as “partial quotient term algebras” freely generated by signatures (compare [19]).
First, we define for any signature a reflexive graph with an associative composition as follows:
- Objects:
- As objects, we choose the same canonical finite sets of variables as for
- Morphisms:
- Morphisms are all finite product expressions inductively defined as follows
- Symbolic Projections:
- is an fp-expression for all , .
- Constant and Operation Symbols:
- with is an fp-expression if is an n-ary operation symbol in .
- Empty Symbolic Tuples:
- is an fp-expression for all .
- Non-empty Symbolic Tuples:
- is an fp-expression for all , and all families , of fp-expressions.
- Symbolic Sequential Composition:
- is an fp-expression for all and all fp-expressions , .
- Symbolic Identities:
- is the identity on for all and is the identity on .
Remark 5.1
(Computation Diagrams). Inspired by logic circuit diagrams, term graphs [20], and string diagrams [21], we will use informal computation diagrams to visualize the computations represented by fp-expressions. A computation diagram consists of “computation units”, “(data-flow) edges”, and input and output “ports”.
Each n-ary operation symbol is seen as a “computation unit” with n input ports and a single output port. Variable symbols appear, however, in two different roles: as “ports”, i.e., as elements of the objects , and as “computation units”, i.e., as identifiers for projections. To distinguish these two roles, we simply denote ports by i instead of . As a “computation unit”, a variable simply copies values from a single input port to an arbitrary finite number of output ports.
Example 5.2
Equations (24)–(26) do not enforce that the unary symbolic tuple is equivalent to the fp-expression even if both fp-expressions represent “essentially” the same computation and are therefore depicted by the same computation diagram!
(Finite Product Expressions). Let be a signature with two binary operation symbols, “+” and “*”. Both fp-expressions and are equivalent, according to the Equations (24)–(26), and represent simple “tree-like” computation diagrams as depicted below. The picture below also visualizes the effect of symbolic composition.
Equations (24)–(26) do not enforce that the unary symbolic tuple is equivalent to the fp-expression even if both fp-expressions represent “essentially” the same computation and are therefore depicted by the same computation diagram!The first fp-expressions represent the addition of two numbers. We can, of course, derive expressions representing the doubling of a number as the expression , for example. The picture below shows how the corresponding dag-like computation diagram is obtained by composing a “copying unit” with a computation unit.

More generally, fp-expressions allow us to represent arbitrary “sharing of sub-computations”. The fp-expression , for example, represents the square of the sum of two numbers. The corresponding dag-like computation diagram is depicted below

Relying on the identity and associativity law as well as the axioms of finite products, according to the Equations (24)–(26), we generate a family of equivalence relations in for all that is compatible with symbolic composition and symbolic tupling. We construct the corresponding equivalence classes of fp-expressions and define composition, identity and tupling operations on these equivalence classes in the usual way by representatives. What we obtain, finally, is a finite product category with equivalence classes of symbolic tuples as morphisms.
Adapting the recipe from Definition 3.14, we can obviously translate every -term into an fp-expression .
Definition 5.1
(Translation of Terms into Finite Product Expressions). For any set , , we inductively define for all -terms a corresponding finite product expression as follows:
- Variables:
- , for all, .
- Constants:
- , for all.
- Operations:
- , for all, .
We call all the fp-expressions , obtained by Definition 5.1, fp-expressions in normal form. Correspondingly, all the fp-expressions are called symbolic tuples in normal form. We use the term “normal form” since they are in normal form with respect to a rewrite system [14] consisting of the rewriting rules given by the Equations (24)–(26) read from the left to the right.
Example 5.3 
(Finite Product Expressions-Normal Forms). From the five fp-expressions in Example 5.2, the two expressions and are fp-expressions in normal form, while is a symbolic tuple in normal form.
None of the rules (24)– (26) can be applied to ⸢+⸣! However, applying these rules, we can transfer the fp-expression , which is the symbolic composition of a symbolic tuple in normal form with an fp-expression in normal form, into normal form:
The picture below shows the result of this transformation into normal form for the relevant sub-expression .

The general effect of normalization is that all “value copying” is moved to the beginning, while we have to “clone computations units” to get rid of “value copying” happening elsewhere.
The crucial observation is that every equivalence class of symbolic tuples, constituting a morphism in , contains exactly one symbolic tuple in normal form! Based on this observation, it can be shown that the category is isomorphic to the syntactic Lawvere category .
5.1.3. Substitutions Revisited
Since every equivalence class of symbolic tuples in contains exactly one symbolic tuple in normal form, we can define a corresponding representation category with morphisms all symbolic tuples in normal form.
However, the symbolic composition of a symbolic tuple in normal form with an fp-expression in normal form or a symbolic tuple in normal form does not, in general, result in an fp-expression in normal form or a symbolic tuple in normal form, respectively. We have to normalize this composite fp-expression to define composition in .
The rules, given by the Equations (24)–(26), are not sufficient to transform any fp-expression into its normal form. They are, however, sufficient to compute the normal form of all symbolic compositions of a symbolic tuple in normal form with an fp-expression in normal form and thus, due to Equation (26), all symbolic compositions of symbolic tuples in normal form! We described an example of a normalization of a symbolic composition of a symbolic tuple in normal form with an fp-expression in normal form in Example 5.3.
We now have a chain of isomorphisms between categories . The morphisms in are tuples of terms representing substitution declarations, while composition is nothing but substitution application. The tuples of terms in are transformed into symbolic tuples in normal form in , while composition in is given by symbolic composition plus normalization. So, in light of substitution calculi, as discussed in Section 3.4.1, we obtain the following correspondence of concepts: “substitution declaration” ≅ “symbolic tuple in normal form”. Moreover, Lawvere’s original slogan “composition is substitution” turns into the slogan
This perception may open a path to develop, in the future, an appropriate substitution calculus for derived graph operations.substitution application ≅ symbolic composition plus normalization.
5.2. Analysis of Finite Product Expressions
After transforming the syntactic Lawvere category into the isomorphic categories and , we are now able to attack the problems, pointed at in Example 5.1, by analyzing in more detail finite product expressions.
5.2.1. Finite Products vs. Tensor Products
It is well-known that finite products also give us tensor products at hand [21]. We will use the term parallel composition of morphisms instead of tensor product of morphisms, and we will use the bar symbol “|” instead of “⊗” to denote parallel composition of morphisms. The picture below visualizes the parallel composition of the fp-expression with itself.

Conversely, tensor products together with copying, allow us to define finite products [21]. In our present setting, copying is represented by symbolic tuples of symbolic projections, and thus each non-empty symbolic tuple can equivalently be described by a symbolic composition of a symbolic tuple of symbolic projections with a parallel composition of expressions. The picture below shows the result of this transformation for the fp-expression , discussed in Example 5.3. To exemplify that we do not always have , we also show the result for the variant .

In conclusion, in the case of traditional operations, tupling can equivalently be replaced by parallel composition plus copying. There are no problems concerning parallel composition of graph operations, and thus the problem with tupling can finally be shown to be a problem with copying. We have to eventually replace copying by another mechanism that does not cause problems!
5.2.2. Copying vs. Soldering
How can we explain, in terms of computation diagrams, the effect of pre-composing an expression with a symbolic tuple of symbolic projections? We construct out of a computation diagram with n input ports and m output ports a new computation diagram with k input ports and the same m output ports.
To explain this construction, we have to leave the pure world of expressions and remember that a symbolic tuple of symbolic projections encodes a map between ports. If is not surjective, the construction adds each element in as a “dummy input port”. In addition, each original input port is soldered with all other input ports with to a single input port in . Relying on our conventions in Section 2 concerning the notation of maps, we will use a new type of expression to denote the new operation from to defined by the newly constructed computation diagram and call it the instance of with respect to . The left picture in Figure 6 visualizes the construction of .
Figure 6.
Instances of computation diagrams.
In the case of computation units and non-injective, surjective maps , we could even interpret the construction of as the construction of a new computation unit computing, for example, the square of a number (see the right picture in Figure 6).
In the case of traditional operations, the soldering of input ports has no effect on output ports since the boundaries are empty! In the case of graph operations, however, soldering of input ports may cause soldering of items in the boundary and thus, potentially, also of output ports. This is exactly the mechanism we have been looking for to solve the problems with tupling exemplified in Example 5.1, as we will demonstrate in Section 5.3.
5.3. Three Mechanisms to Construct New Graph Operations
Our analysis in the last subsection suggests that we should try to define “derived graph operations” by means of three basic constructions on graph operations—parallel composition, instantiation, and sequential composition.
5.3.1. Parallel Composition
Given a graph and a family , , of graph operations with arity spans , we can construct a new graph operation
called the parallel composition of , where the arity graphs are given by sums of graphs , , and the inclusion graph homomorphims are sums of graph homomorphisms , .
The sum comes along with a family , of injections and for any the uniqueness of mediating morphisms entails the equation
By applying the given operations , , we obtain a family of graph homomorphisms satisfying the commutativity requirement for graph operations in Definition 4.2:
We define the result of applying to an input as the unique cotuple of the single results
The algebraic laws of cotuples and sums ensure that the commutativity requirement for graph operations is satisfied:
Remark 5.2
(Parallel Composition - Index Shifting). In the case that all the arity spans are canonical arity spans, in the sense of Remark 4.2, we can also construct the arity as a canonical arity span.
We construct the sums of sets and utilizing the technique of “index shifting” we used in Section 3.7.2 to define finite products in Lawvere theories. The sum of boundary graphs can be chosen to be a corresponding subgraph of . Finally, we can construct a sum with and where both sums of sets and are again constructed by means of “index shifting”.
The technique of “index shifting” allows us to define sums of canonical arities in such a way that the formation of these sums becomes associative. This means, especially, that there is no need to work with “nested parallel compositions”.
Example 5.4
(Parallel Composition). We consider a -algebra given by a category as described in Example 4.2. The upper part of Figure 14 is the same as the upper part of Figure 7 and shows the arity of the parallel composition of the composition operation in with itself.
Figure 7.
Parallel application of two composition operations on successive pairs of arrows.
Analogously, the upper part of Figure 8 shows the arity of the parallel composition of the composition operation in with the built-in projection (identity map) , as defined in Remark 4.3, where is the canonical input arity graph 2 (the notations for “graph operation expressions”, like and , will be defined in Section 5.4).
Figure 8.
Parallel application of a composition operation and an identity map on arrows.
5.3.2. Instantiation
Given a graph and a graph operation with arity , we can construct for any finite graph and any graph homomorphism a graph operation
called the instance of with respect to , where and is constructed as a pushout of the span with such that and are disjoint as depicted in the picture below. For any input , we can apply the given graph operation to and obtain a result such that . Since by construction, we obtain and thus the pushout property of the right square entails the existence of a unique such that and .

It is probably worth mentioning that it is sufficient to require that . is an epimorphism by construction such that also becomes an epimorphism since pushouts preserve epimorphisms. Therefore, is uniquely determined by the requirement . Moreover, this requirement also implies since is an epimorphism. In other words, factors uniquely through and thus the term “instance” is indeed appropriate.
For any input ,. we define . This ensures, especially, the required commutativity .
Remark 5.3
(Instantiation—Canonical Arities). For a canonical arity span and a canonical input arity graph , we have that and are disjoint. In such a way, we can simply define and such that becomes a canonical arity span as well.
Example 5.5
(Instances of the Composition Operation). There are four different instances of the composition operation in a -algebra as described in Example 4.2.
The lower part of Figure 9 visualizes the arity of the instance of , giving us the composition of two loops at hand. The arity of the most specialized instance of , namely the composition of a loop with itself, is shown in the lower part of Figure 10.
Figure 9.
Composition of two loops.
Figure 10.
Composition of a loop with itself.
Example 5.6
(Tupling versus Soldering). The lower part of Figure 7 visualizes the arity of the instance of the parallel composition in Example 5.4. It shows that instantiation indeed provides the “soldering effect” we need to solve the problems with “tupling” as exemplified in Example 5.1! The output arity of the graph operation consists of two successive arrows; thus, we can indeed compose it with (see Example 5.7).
Analogously, the lower part of Figure 8 visualizes the arity of the instance of the parallel composition in Example 5.4. This example shows that we also need “soldering” to describe the composition of three arrows by means of “derived graph operations”.
Remark 5.4
(Transfer of Items). Note that is not required to be surjective! The items in have no influence on the output produced by and are ignored. Specifically, they do not appear in and thus not in either.
Any transfer of items from the input to the output has to be performed explicitly! If we need to transfer, in addition, also items from to the output, we have first to construct a parallel composition of with appropriate built-in projections before we define a corresponding extended that also comprises the items in we wish to transfer. An example for such a “need of transfer” is the successive composition of three arrows (compare Figure 8).
Corollary 5.1
(Instantiation). Let a graph and a graph operation with a canonical arity span be given. For any canonical input arity graphs , and any graph homomorphisms , , we have
Proof.
This follows immediately from the fact that and the fact that the composition of two pushouts is also a pushout. The choice of canonical arities ensures, especially, that and , by construction. □
Hypothesis 5.1
(Parallel Composition and Instantiation). It should not be a problem to prove a more general result about the interplay of parallel composition and instantiation.
We consider a graph and a family , , of graph operations with canonical arity spans together with a family , of homomorphisms where all the values are canonical input arity graphs. For any graph homomorphism with a canonical input arity graph, we have
5.3.3. Sequential Composition
At first glance, it should not be a problem to sequentially compose two graph operations with arity and with arity . We simply require and define, as usual, composition through successive application, for all , while the arity of the sequential composition is given by a standard pullback based composition of spans (see the picture below).
There are, however, at least two problems with this naive proposal: - For canonical arity spans and , we can have an equality only if is a built-in projection.
- There are two kinds of output items produced via the sequential composition of two graph operations. First, the output items produced by . Second, the output items produced by and implicitly transferred by , i.e., the items in . In other words, the resulting arity will not satisfy the disjointness condition in Definition 4.1 if is non-empty!
Since we intend to define graph operation expressions with canonical arity spans only, we consider canonical arity spans and . To solve the first problem, we introduce sequential composition via arity renaming, i.e., instead of , we assume a graph isomorphism and define a graph operation with arity where is isomorphic to and constructed by means of in such a way that becomes a canonical arity span. This also solves the second problem.
We now describe the rather involved step-wise construction of the canonical arity of the graph operation obtained by the sequential composition of two given graph operations and via a graph isomorphism . The reader can follow the construction in Figure 11.
Figure 11.
Sequential composition via a graph isomorphism .
- We obtain an epi-mono factorization of by constructing the image of with respect to . The resulting restriction of becomes an isomorphism since is an isomorphism.
- The boundary arity of can now be constructed by simple intersection (pullback): and .
- To be able to define as an extension of such that consists of canonical sets of output vertices and output edges, according to Remark 4.2, we first have to reindex the output vertices/edges in . We construct a graph , isomorphic to with and , where and for and .
- We can define an isomorphism that is the identity on such that, in addition, restricted to is an order-preserving map from to while restricted to is an order-preserving map from to . The construction ensures that becomes an inclusion graph homomorphism .
- We construct via a pushout of the span with where is constructed by “index shifting” and where is also constructed by “index shifting”.
- The construction ensures and that becomes an isomorphism. We set and obtain a canonical arity span as required.
After the arity of the graph operation has been constructed, we can straightforwardly define through the successive application of the given graph operations plus two intermediate arity-based isomorphic transformations:
The commutativity condition in Definition 4.2 is trivially satisfied since the diagram in Figure 11 is commutative by construction and definition.
Example 5.7
(Composition of four and three arrows). The output arity of the graph operation in Example 5.6 is the graph (see Figure 7) while the input arity of the graph operation is the graph . In such a way, both graph operations can be composed via the arity renaming defined by the assignments . The resulting graph operation with the canonical arity span shown in Figure 12 describes then the way of composing four successive arrows discussed in Example 5.1.
Figure 12.
Arity of the composition of four arrows.
Analogously, the output arity of the graph operation in Example 5.6 is the graph (see Figure 8), while the input arity of the graph operation is the graph . In such a way, both graph operations can be composed via the arity renaming defined by the assignments . The resulting graph operation with the canonical arity span shown in Figure 13 describes then the way of composing three successive arrows in a -algebra that corresponds to the left-hand side of the associativity law for the composition of morphisms in categories
With the obvious changes, we can also construct a graph operation with the same canonical arity span but representing the right-hand side of the associativity law.
Figure 13.
Arity of the composition of three arrows.
Hypothesis 5.2 


(Associativity of Sequential Composition). We consider three graph operations with two arity renamings as depicted below.

What kind of associativity can we gain? Constructing, first, the composition , we transfer the diagram of arities above into the diagram

This means, that we can sequentially compose and via . We obtain a graph operation with input arity and output arity .
In contrast, we cannot compose and via since the output arity of is and not as required. Fortunately, we can bridge the gap using (see Figure 11 and the diagram below) and construct the sequential composition with input arity and output arity .

We are convinced that one can prove and an associativity law like , but we leave this as a topic for future research.
Remark 5.5
(Constructions and Built-in Projections). For any graph the collection of all built-in projections , as described in Remark 4.3, is closed with respect to any of the three constructions—parallel composition, instantiation, or sequential composition. That is, applying any of these constructions only to built-in projections will result in a built-in projection.
We made some effort to define the arity spans of resulting graph operations in such a way that the result of applying any of the three constructions to graph operations with canonical arity spans has a canonical arity span as well.
In such a way, the sub-collection of all built-in projections with as a finite canonical input arity also becomes closed with respect to any of the three constructions. This fact may cause some redundancy when defining “graph operation expressions” and corresponding “derived graph operations”. We will, however, try to avoid unnecessary redundancy.
5.4. Graph Operation Expressions and Derived Graph Operations
Now, we finally have everything at hand to define graph operation expressions and their semantics, i.e., the derived graph operations we have been looking for. We define graph operation expressions with canonical arities and with a structure as close as possible to the structure of terms. Instead of “terms” we have “single expressions”, while “multi expressions” correspond to “tuples of terms”.
Definition 5.2
(Graph Operation Expressions). For any graph signature , we define inductively the set of all (graph operation) -expressions with canonical arity spans.
- Projections:
- with arity span for any finite canonical input arity graph and any subgraph .is called a projection expression.
- Constants:
- with arity for any constant symbol and any finite canonical input arity graph .Moreover,with arity for any non-empty subgraph .Both expressions and are declared as single -expressions.
- Operations:
- for any operation symbol , any finite canonical input arity graph , and any graph homomorphism where the arity is constructed as an instance of the arity by means of and a pushout as in (31).Moreover, for any non-empty subgraph such that is non-empty with arity .Both expressions and are called basic -expressions and are declared as single -expressions.
- Multi expressions:
- for any family , , of single -expressions or projection expressions with, at least, one single -expression. The arity is constructed as described in Remark 5.2.Moreover, for any finite canonical input arity graph , and any graph homomorphism with arity constructed as an instance of the arity by means of and a pushout as performed in (31).Both expressions and are declared as multi -expressions.
- Symbolic composition:
- for any single or multi -expression with arity , any basic -expression with arity , and any graph isomorphism .is declared as a single -expressions.
Remark 5.6
(Notational Convention: Trivial Instances). In case of trivial instances, we will just drop the corresponding substring “”.
- Constants:
- In the case , we will just write instead of and instead of .
- Operations:
- In the case , we will just write instead of and instead of .
Since we utilize sequential composition via arity renaming, we could even require to be a non-isomorphism in the cases Operations and Multi expressions.
Example 5.8
(Graph Operation Expressions). The graph operation in Example 5.6 is represented by the -expression . By Symbolic composition, we obtain then the -expression representing the graph operation in Example 5.7.
The graph operation in Example 5.7 is represented by the -expression while corresponds to the -expression . Both -expressions share the same canonical arity span shown in Figure 13, and thus, we can express the associativity law (33) for the composition of morphisms in categories by an equation between -expressions:
In (34), we do have a twofold-syntactic and semantic equality between graph operation expressions: equal arity and equal semantics. A future equational calculus for graph operation expressions should, however, also reflect arity renamings, as defined in Remark 4.1, and deal with semantic equality of graph operation expressions “up to arity renamings”.
Generalizing the examples of the correspondence between graph operation expressions and graph operations in Example 5.8 and relying on the inductive definition of graph operation expressions in Definition 5.2, we now define “derived graph operations” as those graph operations that can be represented by graph operation expressions.
Definition 5.3
(Derived Graph Operations). Let be a graph signature and a -algebra. For all -expressions with , we can inductively define a map satisfying the commutativity condition in (16). is called the derived graph operation in represented by .
- Projections:
- , according to (17), for all .
- Constants:
- for all .for all.
- Operations:
- , according to Section 5.3.2, for all .for all.
- Multi expressions:
- , according to Section 5.3.1, for all ., according to Section 5.3.1 and Section 5.3.2, for all .
- Symbolic composition:
- , according to Section 5.3.3, for all .
Hypothesis 5.3
(Substitutions Revisited). In light of the discussion in Section 5.1.3, it may be possible to develop in the future a substitution calculus for graph operation expressions along the following lines: A substitution is given by a single- or multi--expression with arity . The substitution can be applied to a -expression with arity if there is a graph isomorphism . Substitution application is then carried out in two steps: (1) We build the expression through symbolic composition. If is not a basic -expression, this expression will not be a -expression in the sense of Definition 5.2! (2) We transform the expression into an equivalent -expression in the sense of Definition 5.2.
To illustrate this idea, we outline for the graph signature an example of an equivalence between a symbolic-composition expression , which is not a -expression in the sense of Definition 5.2, and a -expression .
To begin with a feasible visualization, we consider the -expression where and the arity are described in Figure 14.
Figure 14.
Parallel application of two composition operations on overlapping pairs of arrows.
The sample substitution is given by the extended -expression
with arity depicted in Figure 15. is the canonical input arity graph . The input arity of extends the input arity of by the arrows while extends by the assignments .
Figure 15.
Arity of the -expression .
As a -expression, we consider with arity shown in Figure 16. is given by the assignments .
Figure 16.
Arity of the -expression .
By means of the isomorphism that is the identity on nodes, we can build the following symbolic-composition expression that is not a -expression
Using the two -expressions in (34), we can, however, construct a -expression given by
All four expressions share the same canonical input arity graph in Figure 14, and is defined as the cotuple .
and do have the same arity and are equivalent, that is, for all -algebras we have .
Hypothesis 5.4
(Operations by Subgraphs). At the beginning of this section we discussed that any subgraph of a graph of graph terms defines a graph operation (see Lemma 5.1). A reasonable question is to what extent this method of defining graph operations can be simulated by means of “graph operation expressions” and “derived graph operations”. We claim that it is possible to inductively prove a statement like the following:
For any finite canonical input arity graph and any finite subgraph , there exist a graph operation expression with input arity and an output arity isomorphic to such that for all -algebras , we have (up to arity renaming) for the graph operation defined in Lemma 5.1.
There are two essential means that should allow us to prove such a statement:
- 1.
- By means of the restriction expressions and , we can simulate the “pseudo operation symbols” , , , and their semantics by choosing to be the single output vertex or the single output edge (together with its source and target).
- 2.
- Once we have been able to represent all the single vertices and edges in a subgraph by corresponding graph operation expressions, we can combine them into one graph operation expression using the trick used in Conjecture 5.3 to define the graph operation expression . All the single output arities will be soldered together resulting in a graph isomorphic to .
6. Operations in Topoi
When we started to write the paper, we intended to round it up with a longer section to summarize the results and findings, and to lift them up to a more abstract level.
On the way, we discovered, however, too many new things and results, which we simply had to investigate and include in the paper, and thus it became a bit too long and overloaded. Therefore, we reserve a detailed categorical analysis of the results and findings of the paper and the development of a general theory of operations in topoi as a topic of future research. We already spent, however, some essential effort to revise traditional concepts and results, and to lift them up to a more categorical level; thus, we want to include, at least, some few remarks concerning this topic.
We are quite sure that all (!) the definitions, constructions, and results, including term algebras and the result that subalgebras are regular monic, can be generalized to presheaf topoi (-sets) with as a simple category in the sense of [22]. Simple categories are a special class of “finite categories with no cycles of non-identity morphisms” and play a role in the foundation of Homotopy Type Theory.
There is no problem defining signatures and algebras in arbitrary topoi, analogous to graph signatures and graph algebras. However, terms and term algebras will, in general, not be available. One of the main outcomes of the paper is that there is no need for term algebras to define derived operations. It is sufficient to define “operation expressions” and their semantics, and this can be performed in arbitrary topoi, as long as we drop the request that operation expressions should be represented “syntactically”!
We hope that even a prospective substitution calculus for graph operation expressions (along the ideas in Conjecture 5.3) can be generalized to operation expressions in arbitrary topoi.
7. Related Work
The work presented in this paper has its origins in the pioneering work on generalized sketches of a group around Zinovy Diskin in the 1990s [3,4,5]. The concept of sketch operation in [4] was the starting point for the joint paper [7] on graph operations and free graph algebras. As discussed in Section 4.2, it turned out, however, that the original definition of arities and graph operations in [7] was not appropriate to define graph operation expressions representing derived graph operations in analogy to the role of terms as representations of derived operations in traditional Universal Algebra.
Close to finalizing the paper and by a chain of accidents, we found out about a paper on graph operations (only available in French!) [6] from Albert Burroni, a former PhD student of Charles Ehresmann. The ambition of [6] is very much in accordance with the intentions behind our paper. Graph operations are also defined as maps from to . There are, however, essential conceptual and technical differences between both papers:
- Input and output arity graphs are not described with concrete syntactic identifiers but are implicitly considered as being given by “equivalence up to arity renaming”.
- There are no boundaries and thus no systematic treatment of “preservation conditions” as we formalized them by means of the commutativity condition in (16).
- In the examples, preservation conditions are expressed by means of ad hoc equations between vertices and/or edges, respectively.
- There is no explicit notion of “derived graph operation”, and the issue of “graph operation expressions” is not addressed at all.
- Derived graph operations, in our sense, appear only implicitly when properties of graph operations are described by means of equations between vertices and/or edges.
- Apart from that, Ref. [6] demonstrates the usefulness and appropriateness of graph operations in category theory, and in particular, it seems to be worth investigating the relation between Chapter 2 and the first-order sketches introduced in [1].
Thanks to the referees for drawing our attention to [23,24]. This is a work that should have been cited in [25] as an excellent underpinning of the claim that fibered structures provide an appropriate “technological space” where logical deduction can take place. We add here some comments on the relationship between the present paper and [23,24]:
- There are no graph operations but only plain algebraic operations in [23,24].
- However, the authors do not follow the tradition in Universal and Categorical Algebra of defining algebras as “indexed structures” [26] where sort symbols are interpreted by sets and operation symbols by maps from finite Cartesian products of sets into sets. Instead, they describe algebras as “fibred structures” utilizing so-called “m-graphs”.
- In [23,24], the authors consider many-sorted algebraic signatures, while we restrict ourselves in the paper and in the following discussion to unsorted algebraic signatures .
- m-graphs can encode the “graphs” of operations in traditional “indexed -algebras”. That is, each element of the graph of an n-ary operation in an “indexed -algebra” can be represented by a designated m-edge e with source and target .
- The discussion in Remark 4.4 concerning “graphs of graph operations” also applies to graphs of algebraic operations. There are no boundaries in the case of algebraic operations, and thus we have for each n-ary operation symbol in the signature . Remark 4.4 proposes to represent the elements in by maps with for all and . Due to the notational conventions in Section 2, we would, however, denote those mappings simply by -tuples .
- The set of all pairs with in and for an “indexed -algebra” constitutes the disjoint union of the graphs of all operations in and can obviously serve as the set E of m-edges of an “m-graph encoding” of the “indexed -algebra” . The carrier set A of is thereby the set of vertexes of the m-graph encoding of .
- For many-sorted signatures we can construct m-graph encodings of “indexed -algebras” that are fully analogous.
- It is obvious that the m-graph encodings of terminal “indexed -algebras”, where each sort in a many-sorted signature is interpreted by a singleton, exactly correspond to the m-graphs serving as signatures in [23,24]. Thus, there is indeed a unique m-graph homomorphism from the m-graph encoding of any “indexed -algebra” into the corresponding signature in the sense of [23,24].
- The “syntactic Lawvere theories” in our paper appear in [23,24] as finite product categories freely generated by m-graphs.
Since we use parallel and sequential composition of maps to define derived graph operations, there is of course a certain overlap with monoidal categories, term graphs [20] and string diagrams [21]. However, our approach to derived graph operations essentially deviates from traditional monoidal categories and string diagrams:
- Traditional monoidal categories and string diagrams only deal with single isolated items as the input and output of operations.
- This manifests itself in the absence of boundaries.
- The essential difference is that the presence of boundaries forces us to replace “internal copying of items in diagrams” with “soldering of input and output ports of diagrams”, i.e., by constructing instances of diagrams as a whole.
It is an interesting and open question to what extent it might be useful and feasible to define categories with (equivalence classes of) graph operation expressions as morphisms. A more exotic question would be if those hypothetical categories can be characterized and axiomatized in analogy to the different kinds of monoidal categories and string diagrams.
8. Conclusions
One of the roles of terms in Universal Algebra is to represent derived operations, i.e., operations that can be built up from the basic operations in an algebra. Relying on a revised version of graph operations, we defined graph operation expressions as a counterpart to terms. We identified three basic mechanisms to construct new graph operations out of given ones: parallel composition, instantiation and sequential composition. These mechanisms allowed us to construct for all graph operation expressions a corresponding derived graph operation in any graph algebra.
In another direction, we made a first step toward “Universal Graph Algebra”; i.e., we generalized some basic model-theoretic concepts and results from algebras to graph algebras. In particular, we generalized the concept generated subalgebra and proved that all monomorphic homomorphisms between graph algebras are regular.
We made an overall and essential effort to present definitions, concepts, constructions, results, and proofs in a more categorical way such that it can be straightforwardly lifted to the level of topoi in the future.
Besides the missing proofs of the conjectures, there are many open ends and many things that could or should be carried out. In particular, an equational calculus for graph operations relying on the equality of graphs (and not of single vertices and/or edges) is very much demanded. Such a calculus is also expected to provide a basis to define an equivalence relation for graph operation expressions and, in turn, for a semantic-preserving rewriting of graph operation expressions.
Author Contributions
Writing—original draft, U.W. and T.T.T.; Writing-review and editing, U.W. and T.T.T.; Supervision, U.W. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Acknowledgments
We want to thank the guest editor of this special volume for encouraging us to write this paper and the anonymous referees for their helpful suggestions.
Conflicts of Interest
The authors declare no conflict of interest.
References
- Wolter, U. Logics of Statements in Context—Category Independent Basics. Mathematics 2022, 10, 1085. [Google Scholar] [CrossRef] [Scilit]
- Makkai, M. Generalized Sketches as a Framework for Completeness Theorems. J. Pure Appl. Algebra 1997, 115, 49–79, 179–212, 214–274. [Google Scholar]
- Cadish, B.; Diskin, Z. Heterogeneous View Integration via Sketches and Equations. In Proceedings of the ISMIS, Zakopane, Poland, 9–13 June 1996; Volume 1079, pp. 603–612. [Google Scholar]
- Diskin, Z. Databases as Diagram Algebras: Specifying Queries and Views Via the Graph-Based Logic of Sketches; Technical Report 9602; Frame Inform Systems: Riga, Latvia, 1996. [Google Scholar]
- Diskin, Z.; Kadish, B. A Graphical Yet Formalized Framework for Specifying View Systems. In Proceedings of the First East-European Symposium on Advances in Databases and Information Systems, Nevsky Dialect, St. Petersburg, Russia, 2–5 September 1997; pp. 123–132. [Google Scholar]
- Burroni, A. Algèbres graphiques (sur un concept de dimension dans les langages formels). Cah. Topol. Géom. Différ. Catég. 1981, 22, 249–265. [Google Scholar]
- Wolter, U.; Diskin, Z.; König, H. Graph Operations and Free Graph Algebras. In Graph Transformation, Specifications, and Nets: In Memory of Hartmut Ehrig; Heckel, R., Taentzer, G., Eds.; Springer: Berlin/Heidelberg, Germany, 2018; pp. 313–331. [Google Scholar] [CrossRef] [Scilit]
- Poigné, A. Algebra categorically. In Category Theory and Computer Programming; Pitt, D., Abramsky, S., Poigné, A., Rydeheard, D., Eds.; Springer: Berlin/Heidelberg, Germany, 1986; pp. 76–102. [Google Scholar] [CrossRef] [Scilit]
- Ehrig, H.; Ehrig, K.; Prange, U.; Taentzer, G. Fundamentals of Algebraic Graph Transformation; Monographs in Theoretical Computer Science; An EATCS Series; Springer: Berlin/Heidelberg, Germany, 2006. [Google Scholar] [CrossRef] [Scilit]
- Barr, M.; Wells, C. Category Theory for Computing Science; Series in Computer Science; Prentice Hall International: London, UK, 1990. [Google Scholar]
- Pierce, B.C. Basic Category Theory for Computer Scientists; The MIT Press: Cambridge, MA, USA; London, UK, 1991. [Google Scholar]
- Wolter, U. Cogenerated Quotient Coalgebras; Technical Report Report No 299; Department of Informatics, University of Bergen: Bergen, Norway, 2005. [Google Scholar]
- Ehrig, H.; Mahr, B. Fundamentals of Algebraic Specification 1: Equations and Initial Semantics; EATCS Monographs on Theoretical Computer Science 6; Springer: Berlin/Heidelberg, Germany, 1985. [Google Scholar]
- Wechler, W. Universal Algebra for Computer Scientists; Monographs in Theoretical Computer Science; An EATCS Series; Springer: Berlin/Heidelberg, Germany, 1992; Volume 25, p. 339. [Google Scholar] [CrossRef] [Scilit]
- MacLane, S. Categories for the Working Mathematician; Graduate Texts in Mathematics Volume 5; Springer: New York, NY, USA, 1978; pp. xii+318. [Google Scholar]
- Goldblatt, R. Topoi: The Categorial Analysis of Logic; Dover Publications: New York, NY, USA, 1984. [Google Scholar]
- Reichel, H. Initial Computability, Algebraic Specifications, and Partial Algebras; Oxford University Press: Oxford, UK, 1987. [Google Scholar]
- Wolter, U. An Algebraic Approach to Deduction in Equational Partial Horn Theories. J. Inf. Process. Cybern. EIK 1990, 27, 85–128. [Google Scholar]
- Claßen, I.; Große-Rhode, M.; Wolter, U. Categorical concepts for parameterized partial specifications. Math. Struct. Comput. Sci. 1995, 5, 153–188. [Google Scholar] [CrossRef] [Scilit]
- Corradini, A.; Gadducci, F. An Algebraic Presentation of Term Graphs, via GS-Monoidal Categories. Appl. Categ. Struct. 1999, 7, 299–331. [Google Scholar] [CrossRef] [Scilit]
- Selinger, P. A Survey of Graphical Languages for Monoidal Categories. In New Structures for Physics; Coecke, B., Ed.; Springer: Berlin/Heidelberg, Germany, 2011; pp. 289–355. [Google Scholar] [CrossRef] [Scilit]
- Makkai, M. First Order Logic with Dependent Sorts, with Applications to Category Theory. Available online: https://www.math.mcgill.ca/makkai/folds/foldsinpdf/FOLDS.pdf (accessed on 10 September 2023).
- Sernadas, A.; Sernadas, C.; Rasga, J.; Coniglio, M. A Graph-theoretic Account of Logics. J. Log. Comput. 2009, 19, 1281–1320. [Google Scholar] [CrossRef] [Scilit]
- Sernadas, A.; Sernadas, C.; Rasga, J.; Coniglio, M. On Graph-theoretic Fibring of Logics. J. Log. Comput. 2009, 19, 1321–1357. [Google Scholar] [CrossRef] [Scilit]
- Wolter, U.; Martini, A.; Häusler, E. Indexed and fibered structures for partial and total correctness assertions. Math. Struct. Comput. Sci. 2022, 32, 1145–1175. [Google Scholar] [CrossRef] [Scilit]
- Wolter, U. Indexed vs. fibred structures—A field report. Rom. J. Pure Appl. Math. 2020, 66, 813–830. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).















