Preprint
Article

Graph Algebras and Derived Graph Operations

Altmetrics

Downloads

153

Views

59

Comments

0

A peer-reviewed article of this preprint also exists.

This version is not peer-reviewed

Submitted:

12 May 2023

Posted:

17 May 2023

You are already at the latest version

Alerts
Abstract
We revise the definition of graph operations in [WDK2018] and adapt correspondingly 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. Especially, we generalize the concept 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.
Keywords: 
Subject: Computer Science and Mathematics  -   Logic

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 lift up traditional first-order logic to a wide range of arbitrary categories. In [2] 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 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 90s independently by Michael Makkai, motivated by his work on an abstract formulation of Completeness Theorems in Logic [3], and a group in Latvia around Zinovy Diskin, motivated by their work on data bases and data modeling [4,5,6]. Our concept of graph operation has its seeds in the concept of sketch operation. Sketch operations do not appear in the work of Makkai, while 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, logics, and computer science.
Software models are often diagrammatic structures. To keep software models comprehensible for humans, we should, however, avoid to overload 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 [5].
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. [7] 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 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 [1] 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 [1]. Unfortunately, our expectation that graph terms will give us a universal and appropriate concept of derived graph operations and substitutions at hand, vanished. We realized that the strong interconnection between “representation of data” and “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 [1] 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 generalize therefore some basic model-theoretic concepts and results from traditional algebras to graph algebras. We concentrate on the concept “generated subalgebra” and the related problem of characterizing monomorphic and epimorphic homomorphisms, respectively.
To tackle this task, we make some 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. Especially, we prove that all monomorphic homomorphisms between graph algebras are regular.
In [1] we adapted the original idea of sketch operations [5] 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 derived graph operation, we declare therefore 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 in Section 4.4 partial graph algebras. 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 in Section 3.4 substitution calculi in general.
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 in Section 5.2 copying as the cause of the problem. We argue that, in case of graph operations, “copying of data”, as a computation of its own, has to be replaced by “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 parallel composition, instantiation and sequential composition.
We complete the paper with some remarks concerning Operations in Topoi in Section 6, a discussion of Related Work in Section 7, and concluding remarks in Section 8.

2. Notations and Preliminaries

C O b j denotes the collection of objects of a category C and C M o r the collection of morphisms of C , respectively. C ( A , B ) is the collection of all morphisms from object A to object B in C . If the category C is clear from the context, we will often use the more compact notation B A instead of C ( A , B ) . We use the diagrammatic notation f ; g : A C for the composition of morphisms f : A B and g : B C in C . C D states that category C is a subcategory of category D . A category C is small if the collection C M o r , and thus also the collection C O b j , is a set. Cat is the category of all small categories. A category C is locally small if C ( A , B ) is a set for all objects A and B in C . Set denotes the category of all sets and all (total) maps. Cat and Set are not small but locally small.
A (directed multi) graph  G = ( G V , G E , s c G , t g G ) is given by a collection G V of vertices, a collection G E of edges and maps s c G : G E G V , t g G : G E G V assigning to each edge its source and target vertex, respectively [9]. 0 = ( , , i d , i d ) is the empty graph. A graph G is small if G V and G E are sets. A graph homomorphism  φ : G H between two graphs G = ( G V , G E , s c G , t g G ) and H = ( H V , H E , s c H , t g H ) is a pair ( φ V , φ E ) of maps φ V : G V H V , φ E : G E H E such that the following diagrams commute.
Preprints 73551 i001
The identity graph homomorphism  i d G on a graph G is the pair ( i d G V , i d G E ) of identity maps and composition of graph homomorphisms φ : G H and ψ : H K is done componentwise, i.e φ ; ψ : = ( φ V ; ψ V , φ E ; ψ E ) . Graph is the category of all small graphs and all graph homomorphims between them. The empty graph is the initial object in Graph . For convenience and uniformity reasons, we will often consider a set A as a graph without edges.
The category comprising as well finite and small graphs as the underlying graphs of categories like Cat , Set , and Graph , for example, is denoted by GRAPH , while SET 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 Cat , Set , and Graph as objects by CAT .
g r ( C ) denotes the underlying graph of a category C , i.e., we have gr ( C ) V : = C O b j and gr ( C ) E : = C M o r . Note, that a functor F : C D is just a graph homomorphism F : g r ( C ) g r ( D ) preserving also identities and composition. In other words: The assignments C g r ( C ) , ( F : C D ) ( F : g r ( C ) g r ( D ) ) define a faithful forgetful functor Gr : Cat Graph . It is well-known that there is a functor Pth : Graph Cat left-adjoint to Gr assigning to any graph G the corresponging path category P ( G ) .
In practical applications, it is often more convenient to work with interpretation categories instead of functor categories. An interpretation of a graph G in a category C , denoted by φ : G C , is a graph homomorphism φ from G to g r ( C ) . A natural transformation μ : φ ψ between two interpretations φ : G C and ψ : G C is a family μ v : φ V ( v ) ψ V ( v ) , v G V of morphism in C such that φ E ( f ) ; μ u = μ v ; ψ E ( f ) for all edges f : v u in G . All interpretations of G in C and all natural transformations between them constitute the interpretation category  [ G C ] with composition the vertical composition of natural transformations. (In [10] interpretations φ : G C are called “models of G in C ” and the notation Mod ( G , C ) is used instead of [ G C ] . For our purposes the more neutral and general term “interpretation” is more convenient.) For any categories C , D the assignments ( F : C D ) ( F : g r ( C ) g r ( D ) ) define a full embedding of the traditional functor category [ C D ] into the interpretation category [ g r ( C ) D ] .
Obviously, the category Graph is, by definition, isomorphic to the interpretation category [ MG Set ] with MG the graph Preprints 73551 i037. On the other side, the adjunction Pth Gr ensures that for any small graph G the interpretation category [ G C ] is isomorphic to the functor category [ P ( G ) C ] and thus a presheaf topos.
For any set I and any set A the set A I = { a : I A } of all maps from I into A is a categorical product in Set with the family ( π i : A I A i I ) of projections defined by π i ( a ) : = a ( i ) for all a A I . If I is finite with n elements (indices), A I is therefore isomorphic to the n-ary Cartesian product A n of A. In case, we equip a finite set I n = { i 1 , i 2 , , i n } with a fixed total order i 1 < i 2 < < i n , we can reuse the traditional tuple notation for elements in the Cartesian product A n to represent also the elements in A I n : A map a : I n A is represented by the tuple ( a ( i 1 ) , a ( i 2 ) , , a ( i n ) ) . In the paper, we will often describe a map a : I n A by simply declaring a = ( a 1 , a 2 , , a n ) , i.e., a ( i j ) = a j for all 1 j n . In case n = 0 , i.e., I 0 = , we will consequently represent the only map a : I 0 A by the empty tuple ( ) . For any finite set A we denote its cardinality by | A | .
For any inclusion A B of sets we denote by ι A , B : A B the corresponding inclusion map with ι A , B ( a ) = a for all a A . A graph G is a subgraph of a graph H , G H in symbols, if G V H V , G E H E and the inclusion maps ι G V , H V : G V H V and ι G E , H E : G E H E establish a graph homomorphism ι G , H = ( ι G V , H V , ι G E , H E ) : G H . ι G , H is also called an inclusion graph homomorphism or graph inclusion, shortly.
A partial map  f : A B is given by a domain of definition d o m ( f ) A and a total map from d o m ( f ) into B. The composition f ; g : A C of two partial maps f : A B and g : B C is defined by
  • d o m ( f ; g ) : = { x A x d o m ( f ) , f ( x ) d o m ( g ) } and
  • f ; g ( a ) : = g ( f ( a ) ) for all a d o m ( f ; g ) .
We consider any (total) map f : A B as a partial map f : A B with d o m ( f ) = A

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 A I instead of finite Cartesian products A n .
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
I 0 = , I n : = { i 1 , i 2 , , i n } for   all n 1 and O = { o } .
For all n 2 we assume I n to be equipped with a fixed total order i 1 < i 2 < < i n thus we can reuse the tuple notation to represent maps a : I n A as discussed in Section 2.
Definition 1
(Signature). A signature Σ = ( O P , a r ) is given by
  • a set O P ofoperation symbols,
  • a map a r assigning to each operation symbol op as its arity a pair a r ( op ) = ( I op , O op ) of finite sets with I op = I n for some n N , and O op = O = { o } .
We say that op O P is ann-ary operation symbol if I op = I n . If I c = I 0 for c O P , we say also that c is aconstant symbol.
Remark 1
(Sets as Arities). There can be arbitrary many finite separeted inputs for an algebraic operation. We decide 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 introduce also a name for the single output position. This brings us closer to graph algebras where the single-output paradigm will be given up. As well the input as the output arity of a graph operation can be an arbitrary finite graph (see Definition 15).
Definition 2
(Algebra). Let Σ be a signature. A Σ-algebra A = ( A , O P A ) given by
  • a set A, called the carrier of A , and
  • a family O P A = ( op A : A I op A O op op O P ) of maps called o p e r a t i o n s .
We say that op A is ann-ary operation if I op = I n . If I c = I 0 , we say also that c A is a constant operation, or simply aconstant.
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
(Homomorphism). Let Σ be a signature. A Σ -homomorphism h : A B between two Σ-algebras A and B is a map h : A B satisfying the following homomorphism condition
( HC ) op A ( a ) ; h = op B ( a ; h ) for all op O P and all a A I op
Preprints 73551 i002
For any sets A, B, I each map h : A B induces a map _ ; h : A I B I thus we can, more abstractly but equivalently, express the homomorphism condition (HC) by the requirement that the above right square of maps commutes. Note, that in case of constant symbols c O P , I c = I 0 the homomorphism condition turns into the equation op A ( ) ; h = op B ( ) if we apply our conventions in Section 2 concerning the tuple notation.
Given any Σ -algebra A , the identity map on the carrier set i d A : A A induces an identity Σ -homomorphism i d A : A A . Similarly, given any Σ -homomorphisms f : A B , g : B C , the composition f ; g : A C of the underlying maps induces a Σ -homomorphism f ; g : A C . This defines the category Alg ( Σ ) with all Σ -algebras as objects and all Σ -homomorphisms as morphisms.
Proposition 1
(Forgetful Functor). The assignments A A and ( f : A B ) ( f : A B ) define a faithful forgetful functor
U Σ : Alg ( Σ ) Set .
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 F -algebra for an arbitrary functor F : C C , for example, the category of all F -algebras inherits all limits from the category C [11].
It is well-known that the category Alg ( Σ ) inherits all limits from the category Set . 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 A I instead of Cartesian products A n enables us to give a pure categorical concise proof of this classical result. Since we want to do all later constructions and argumentations within Set , we restrict ourselves to small limits.
Theorem 1
(Limits). Alg ( Σ ) inherits any small limit from the category Set , i.e., the functor U Σ : Alg ( Σ ) Set reflects small limits. Alg ( Σ ) has therefore all small limits since Set does.
Proof. 
Let J be a small graph and δ : J Alg ( Σ ) be a diagram in Alg ( Σ ) where δ v = A v = ( A v , O P A v ) for all vertices v in J V . We have to show that any limit cone π : L δ ; U Σ over the translated diagram δ ; U Σ : J Set induces a limit cone π : L δ over δ in Alg ( Σ ) such that L is a Σ -algebra with L as its carrier.
To define the operations in L , we note that for any operation symbol op in O P and any map l : I op L we get a commutative cone l ; π : I op δ ; U Σ in Set with ( l ; π ) v : = l ; π v : I op A v for all v in J V . Applying the respective operations op A v to the maps l ; π v gives us a new cone op δ ( l ; π ) : O op δ ; U Σ in Set with op δ ( l ; π ) v : = op A v ( l ; π v ) : O op A v for all vertices v in J V . Now, for any edge e : v w in J E , we have that δ e : δ v δ w is a Σ -homomorphism from A v to A w and thus, by the homomorphism condition and commutativity of π : L δ ; U Σ we have
op A v ( l ; π v ) ; δ e = op A w ( l ; π v ; δ e ) = op A w ( l ; π w )
which encapsulates that the cone op δ ( l ; π ) : O op δ ; U Σ is commutative. By the universal property of π , there is a unique map k : O op L which satisfies
k ; π v = op A v ( l ; π v )
for all v in J V . By defining op L ( l ) : = k , we ensure that each map π v : L A v induces a Σ -homomorphism π v : L A v for all v in J v . Thus, we get indeed a commutative cone π : L δ in Alg ( Σ ) .
It remains to show that π : L δ is a limit cone, i.e. for any other commutative cone p : X δ in Alg ( Σ ) , we have to show that there is a Σ -homomorphism κ : X L such that κ ; π v = p v for all v in J V . Note that p induces a commutative cone p ; U Σ : X δ ; U Σ in Set with ( p ; U Σ ) v : = p v : X A v for all v in J V . As π is a limit cone over δ ; U Σ , there exists a unique map κ : X L such that κ ; π v = p v for all v in J V . We claim that κ extends to the desired Σ -homomorphism, by showing that
op X ( x ) ; κ = op L ( x ; κ )
for any op in O P and x : I op X . By definition, op L ( x ; κ ) is the unique map such that op L ( x ; κ ) ; π v = op A v ( x ; κ ; π v ) holds for all v in J V . Indeed, the map op X ( x ) ; κ : O op X also satisfies this equality for all v in J V as
op X ( x ) ; κ ; π v = op X ( x ) ; p v = op A v ( x ; p v ) = op A v ( x ; κ ; π v ) .
By uniqueness of mediating morphisms we get (5), which shows that κ : X L is indeed a Σ -homomorphism from κ : X L . Moreover, it is the unique homomorphism such that κ ; π v = p v and thus, π : L δ is a limit cone. □
Remark 2
(Hom-sets). The proof of Theorem 1 is based on the convention in Section 2 that we consider A I as a shorthand notation for the collection (hom-set) Set ( I , A ) of all morphisms in Set from I to A. Set ( I , A ) is a set since Set is locally small. Set ( I , A ) is isomorphic to a corresponding exponential object in Set , but this isomorphism does not play any role in the paper.

3.2. Subalgebras

As in the traditional approach, we can define subalgebras by means of set inclusions.
Definition 4
(Subalgebras). Let Σ = ( O P , a r ) be a signature. A Σ-algebra A = ( A , O P A ) is a Σ -subalgebra of a Σ-algebra B = ( B , O P B ) , A B in symbols, if A B and for all op O P and a : I op A the following diagram commutes:
Preprints 73551 i003
Here ι A , B : A B is the corresponding inclusion map from A into B.
A comparison of Definition 3 and Definition 4 makes, however, obvious that we can also simply describe Σ -subalgebras as special kinds of Σ -homomorphisms.
Corollary 1
(Subalgebras as Inclusion Homomorphisms). For Σ-algebras A and B such that A B we have that A is a Σ-subalgebra of B if, and only if, the inclusion map ι A , B : A B establishes a Σ-homomorphism ι A , B : A B .
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 Set are exactly the injective (surjective) maps, respectively. Any faithful functor reflects monomorphisms and epimorphisms. The forgetful functor U Σ : Alg ( Σ ) Set is faithful thus we obtain
Corollary 2
(Injective and surjective Homomorphisms). If the underlying map f : A B of a Σ-homomorphism f : A B is injective (surjective) then f : A B is a monomorphism (epimorphism) in Alg ( Σ ) .
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 w.r.t. to applications of the operations in the algebra.
Definition 5
(Closedness). Let B = ( B , O P B ) be a Σ-algebra. We say a subset A B isclosed in B if for all op O P and a : I op A the result op B ( a ; ι A , B ) : O op B of applying the operation op B in B to the input a ; ι A , B : I op B factors through the inclusion map ι A , B : A B , i.e., there exists a map r a : O op B such that the following diagram commutes:
Preprints 73551 i004
If A is a Σ -subalgebra of B then the carrier A of A is obviously closed w.r.t. all the operations in B . On the other side, the inclusion map ι A , B : A B is a monomorphism in Set . Therefore the map r a : O op B in Definition 5 is unique if it exists. In such a way, the assignments a r a define a total operation from A I op to A O op if A is closed, and we obtain the following result.
Proposition 2
(Subalgebra ≅ Closed Subset). There is a one-to-one correspondence between Σ-subalgebras of B and closed subsets of B .
Proposition 2 suggests that there may be actually 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 w.r.t. intersection, reformulated in terms of inclusion homomorphisms, as a special case of Theorem 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 Set .
Remark 3
(Multiple Pullbacks). Let I be a set and M be an I-indexed family ( A i B i I ) of subsets of a set B. We can describe this situation by a diagram δ : MP ( I ) Set with MP ( I ) a small graph given by MP ( I ) V : = I { * } , MP ( I ) E : = { e i : i * i I } , and δ defined by δ i : = A i for all i I , δ * : = B and inclusion maps δ e i : = ι A i , B : A i B for all i I .
It is well-known and straightforward to prove that the intersection M : = i I A i together with the inclusion maps ι M , A i : M A i , i I and ι M , B = ι M , A i ; ι A i , B : M B is a limit cone of the diagram δ : MP ( I ) Set in Set .
Limits of this shape are also calledmultiple pullbacks and they reflect monomorphisms: For any category C , any diagram δ : MP ( I ) C and any limit cone p : L δ all the morphisms p i : L δ i , i I are monomorphisms in C as as long as all the morphisms δ e i : δ i δ * , i I are.
Due to Remark 3 we can now replace and enhance the traditional statement
“If M is a family of closed subsets in B , then its intersection M is closed as well”
by the following corollary of Theorem 1.
Corollary 3
(Intersection of Subalgebras). For any set I, any Σ-algebra B , and any diagram δ : MP ( I ) Alg ( Σ ) of Σ-subalgebras δ e i = ι A i , B : A i B , i I of B there is a unique Σ-subalgebra L = ( L , O P L ) of B with L = i I A i that is a Σ-subalgebra of A i for all i I .
Moreover, the inclusion Σ-homomorphisms ι L , A i : L A i , i I and ι L , B : L B constitute a multiple pullback, i.e., a limit cone of the diagram δ : MP ( I ) Alg ( Σ ) in Alg ( Σ ) .
We call L = ( L , O P L ) also the intersection of the I-indexed family M = ( A i i I ) of Σ-subalgebras of B and may use the notations M , i I A i or, simply, A i to denote L .
Traditionally, the Σ -subalgebra R ( A , B ) of a Σ -algebra B generated by a subset A B can be defined as the Σ -subalgebra with the carrier R ( A , B ) constructed as the intersection of the following family of closed sets in B :
R ( A , B ) : = { X B X closed in B and A X } .
Since, the collection of all subsets of a set B is a set as well, this definition matches the pattern of Corollary 3. We only have to choose for I the set { X B X closed in B and A X } 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 Alg ( Σ ) , as stated in Corollary 3, and lift up the concept “generated by a subset” to the concept “accessible via a map”.
Definition 6
(Subalgebra accessible via a Map). For any Σ-algebra B and any map f : A B let M be the set of all Σ-subalgebras X of B such that f factors through the inclusion map ι X , B : X B , i.e., there exists a map f X : A X such that f X ; ι X , B = f .
We denote by R ( f , B ) the intersection of M , according to Corollary 3. Especially, the carrier of R ( f , B ) is the intersection R ( f , B ) : = { X X M } of sets. We call R ( f , B ) the Σ -subalgebra of B accessible (reachable) via for thehomomorphic image of A w.r.t. f.
In case of inclusion maps f = ι A , B : A B we also use the traditional notation R ( A , B ) instead of R ( ι A , B , B ) and also call R ( A , B ) the Σ -subalgebra of B generated by A.
Note, that the map f X : A X in Definition 6 is unique, if it exists, since the inclusion map ι X , B : X B is a monomorphism in Set .
Corollary 4
(Homomorphic image includes Image). For any Σ-algebra B and any map f : A B we have f ( A ) R ( f , B ) for the(set-theoretic) image f ( A ) : = { f ( a ) a A } of A w.r.t. the map f.
Proof. 
Follows immediately from the observation that f ( A ) = { Y Y N } for the set N of all subsets Y of B such that f factors through the inclusion map ι Y , B : Y B and that { X X M } N due to the definition of M and R ( f , B ) in Definition 6 and the definition of N . □
Remark 4
(Well-powered). In category theory the adjective well-powered is used for categories C where for all objects A in C 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 7
(Accessible and Generated Algebras). Let B be a Σ-algebra.
  • B isaccessible via a map f : A B if R ( f , B ) = B .
  • If B is accessible via an inclusion map ι A , B : A B , i.e., if R ( A , B ) = R ( ι A , B , B ) = B , we say also that B isgenerated by A.
  • B is said to be generated if it is generated by the empty set, i.e., accessible via the unique map ι , B : B from the initial object ∅ in Set to B.
Corollary 5.
A Σ-algebra B is generated if, and only if, there are no proper Σ-subalgebras of B .
Corollary 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 Alg ( Σ ) . First, we observe that “accessible via a map” implies “epic”.
Lemma 1
(Accessible implies Epic). A Σ-homomorphism f : A B is an epimorphism in Alg ( Σ ) if B is accessible via the underlying map f : A B , i.e., if B = R ( f , B ) .
Proof. 
We consider arbitrary Σ-homomorphisms g , h : B C such that f ; g = f ; h .
We know that the set X = { b B g ( b ) = h ( b ) } B together with the inclusion map ι X , B : X B is an equalizer of the maps g , h : B C in Set . According to 1, there is a unique Σ-algebra X = ( X , O P X ) such that ι X , B : X B becomes an inclusion Σ-homomorphism ι X , B : X B which is, moreover, the equalizer of the Σ-homomorphisms g , h : B C . Assumption f ; g = f ; h ensures that there exists a unique map f X : A X with f X ; ι X , B = f . Due to the construction of R ( f , B ) in Definition 6, we have an inclusion Σ-homomorphism ι R ( f , B ) , X : R ( f , B ) X . Accessibility of B means B = R ( f , B ) thus we get, finally, X = B . This means, however, that the equalizer of g and h is the identity on B thus we have g = h as required. □
To show that, on the other side, epic implies accessible we can take advantage of the following result.
Proposition 3
(Subalgebras are Regular Monos). For any Σ-subalgebra ι A , B : A B of a Σ-algebra B there exists a Σ-algebra C and parallel Σ-homomorphisms g , h : B C such that ι A , B : A B is the equalizer of g and h.
Proof. 
We construct the pushout of the span Preprints 73551 i039 of inclusion maps (see the left diagram below). We set C : = B + A B , g : = κ 1 , and h : = κ 2 . Since ι A , B is injective both maps κ 1 , κ 2 : B B + A B are injective too and, moreover, the pushout square is as well a pullback square. This ensures, especially, that ι A , B : A B is the equalizer of the maps κ 1 , κ 2 : B B + A B in Set . The pushout property of the square provides a unique map k : B + A B B such that
κ 1 ; k = κ 2 ; k = i d B
Preprints 73551 i005
Operations on C: We extend now C to a Σ-algebra C = ( C , O P C ) by defining for each op in O P a corresponding operation op C : ( B + A B ) I op ( B + A B ) O op . For any c : I op B + A B in ( B + A B ) I op we do have four possible cases.
Case 1 
c factors through κ 1 : There exists a map b 1 : I op B such that b 1 ; κ 1 = c (see the right diagram above). b 1 is unique since κ 1 is a monomorphism. We simply set
op C ( c ) = op C ( b 1 ; κ 1 ) : = op B ( b 1 ) ; κ 1
Preprints 73551 i006
Case 2 
c factors through κ 2 : Analogously to Case 1.
Case 3 
Overlapping of Case 1 and 2: There exist maps b 1 , b 2 : I op B such that b 1 ; κ 1 = c = b 2 ; κ 1 . Due to the pullback property of the square there exists a unique a : I op A such that b 1 = a ; ι A , B = b 2 . The homomorphism property of ι A , B ensures op B ( b 1 ) = op B ( a ; ι A , B ) = op B ( b 2 ) = op A ( a ) ; ι A , B thus we get, finally, op B ( b 1 ) ; κ 1 = op A ( a ) ; ι A , B ; κ 1 = op A ( a ) ; ι A , B ; κ 2 = op B ( b 2 ) ; κ 2 . That is, in the event of an overlapping, Case 1 and Case 2 define the same output op C ( c ) = op B ( b 1 ) ; κ 1 = op B ( b 2 ) ; κ 2 . Note, that there will always be an overlapping for constant symbols!
Case 4 
c factors neither through κ 1 nor through κ 2 : This can only happen if I op = I n with n 2 . Utilizing the operations in B to a maximal extent, Cases 1 and 2 define a partial map from ( B + A B ) I op to ( B + A B ) O op . However, since we restrict ourselves to total operations, we have to find an ad hoc totalization trick to turn op C into a total operation. Employing (7), we may decide to utilize the operations in B to produce outputs in the left copy of B in B + A B . We set
op C ( c ) : = op B ( c ; k ) ; κ 1
Preprints 73551 i007
The operations in C are defined by (8) exactly in a way that the maps κ 1 and κ 2 become Σ-homomorphisms κ 1 , κ 2 : B C . Note, that Case 4 has no relevance for the homomorphism property of κ 1 and κ 2 ! Theorem 1 ensures, finally, that the inclusion Σ-homomorphism ι A , B : A B is the equalizer of the Σ-homomorphisms κ 1 , κ 2 : B C . □
Regularity of Alg ( Σ ) entails that the concepts accessible and epic are equivalent.
Proposition 4
(Accessible ≅ Epic). For any Σ-homomorphism f : A B it holds that B is accessible via the underlying map f : A B , i.e., in other words B is equal to the homomorphic image R ( f , B ) of A w.r.t. f, if, and only if, f : A B is an epimorphism in Alg ( Σ ) .
Proof. 
“Accessible implies epic” has been shown in Lemma 1. We show now “epic implies accessible”: We consider an arbitrary Σ-subalgebra X of B such that there exists a map f X : A X with f X ; ι X , B = f . Due to Proposition 3 there exist Σ-homomorphisms g , h : B C such that ι X , B : X B is the equalizer of g and h. Due to the assumption f X ; ι X , B = f , we get f ; g = f ; h and thus g = h since f is epic. This means, however, X = B and, finally, R ( f , B ) = B due to the construction of R ( f , B ) in Definition 6. □
The axiom of choice is equivalent to the statement that all epimorphisms f : A B in the category Set are split, i.e., there exists a map g : B A such that g ; f = i d B . As a consequence each homomorphism between Σ -algebras maps closed subsets to closed subsets. Especially, we have
Lemma 2
(Closed Images). For any Σ-homomorphism f : A B the (set-theoretic) image f ( A ) B of the carrier A of A is closed in B . We denote by f ( A ) the unique Σ-subalgebra of B with carrier f ( A ) and call it the(set-theoretic) image of A w.r.t. the Σ -homomorphism f.
Lemma 2 is the last brick we need to conclude that the epic Σ -homomorphisms are exactly the surjective one.
Corollary 7
(Epic ≅ Surjective). For any Σ-homomorphism f : A B we have f ( A ) = R ( f , B ) thus f : A B is an epimorphism in Alg ( Σ ) if, and only if, the map f : A B is surjective.
Proof. 
By Corollary 4 we have f ( A ) R ( f , B ) . Lemma 2 gives us the Σ-subalgebra f ( A ) of B at hand and ensures f ( A ) R ( f , B ) due to the construction of R ( f , B ) in Definition 6. This gives us f ( A ) = R ( f , B ) since two Σ-subalgebras of a Σ-algebra B are equal if, and only if, they do have the same carrier. By Proposition 4 we get f : A B epic if, and only if, B = f ( A ) = R ( f , B ) . B = f ( A ) , however, means that f is surjective. □
Remark 5
(Stepwise Generation of Closed Subsets). There is another, more constructive, way to construct the closed sets R ( A , B ) . We start with A and add all the elements from B that we can reach by applying successively the operations in B 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 o p A ( a 1 , , a n ) , we will use angle bracket symbols " " , " " , instead of parenthesis " ( " , " ) " , 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 8
(Terms). The set T Σ ( X ) of all Σ -terms over a set X of variables is the smallest set of strings of symbols such that
Variables: 
x T Σ ( X ) , for all x X ;
Constants: 
c T Σ ( X ) , for all c O P with I c = I 0 ;
Operations: 
op t 1 , , t n T Σ ( X ) , for all op O P with I op = I n , n 1 and all maps t = ( t 1 , , t n ) in T Σ ( X ) I n .
Note that the assignments x x , assigning to each variable the string consisting only of a single symbol denoting this variable, define an injective map η X : X T Σ ( X ) . Note, moreover, that in case X = I n = { i 1 , i 2 , , i n } each operation symbol op O P is reborn as the Σ -term op i 1 , , i n T Σ ( I n ) .
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 thus we can define this kind of evaluation of terms also inductively.
Definition 9
(Evaluation of terms). For any set X of variables, any Σ-algebra A = ( A , O P A ) and any map α : X A (called a variable assignment ) we can define inductively a map α * : T Σ ( X ) A :
Variables: 
α * ( x ) : = α ( x ) , for all x T Σ ( X ) ;
Constants: 
α * ( c ) : = c A ( ) ( o ) , for all c T Σ ( X ) ;
Operations: 
α * ( op t 1 , , t n ) : = op A ( α * ( t 1 ) , , α * ( t n ) ) ( o ) , for all op t 1 , , t n T Σ ( X ) .
All three cases in Definition 9 are disjoint and terms are only equal if, and only if, they are equal as strings thus α * is uniquely defined.
There is no indication in Definition 8 and Definition 9, respectively, where the sets T Σ ( X ) 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 by Σ -homomorphisms: First, we observe that the stepwise construction of terms in Definition 8 can be reflected by defining for each operation symbol in O P a corresponding (constructor) operation on T Σ ( X ) :
Definition 10
(Term algebra). For a set X of variables we define the term Σ -algebra over X T Σ ( X ) = ( T Σ ( X ) , O P T Σ ( X ) ) by
Constants: 
c T Σ ( X ) ( ) ( o ) : = c , for all c O P with I c = I 0 , and
Operations: 
op T Σ ( X ) ( t ) ( o ) : = op t 1 , , t n , for all op O P with I op = I n , n 1 and all maps t = ( t 1 , , t n ) in T Σ ( X ) I n .
Note that the term Σ -algebra T Σ ( X ) is generated by η X ( X ) T Σ ( X ) . This is implicitly ensured by the statement of T Σ ( X ) being the smallest set satisfying the conditions in Definition 8. We say that the elements in η X ( X ) are the generators of T Σ ( X ) .
Second, we observe that the introduction of term Σ -algebras T Σ ( X ) allows us to encode the defining equations for the cases Constants and Operations in Definition 9 by the requirement that the map α * : T Σ ( X ) A should establish a Σ -homomorphism α * : T Σ ( X ) A :
Constants: 
α * ( c ) = α * ( c T Σ ( X ) ( ) ( o ) ) = ( c T Σ ( X ) ( ) ; α * ) ( o ) = c A ( ) ( o ) , for all c T Σ ( X ) ;
Operations: 
α * ( op t 1 , , t n ) = α * ( op T Σ ( X ) ( t ) ( o ) ) = ( op T Σ ( X ) ( t ) ; α * ) ( o ) = op A ( t ; α * ) ( o ) = op A ( α * ( t 1 ) , , α * ( t n ) ) ( o ) , for all op t 1 , , t n T Σ ( X ) where t is the map in T Σ ( X ) I n defined by t = ( t 1 , , t n ) .
The third case Variables in Definition 9 simply requires that the map α * : T Σ ( X ) A is an extension of the map α : X A thus the statement “Definition 9 defines α * : T Σ ( X ) A uniquely” is transformed into the statement that the term Σ -algebra T Σ ( X ) is a Σ -algebra freely generated by X.
Proposition 5
(Term Algebras as Free Construction). Given a set X of variables, the Σ-term algebra T Σ ( X ) has the following universal property: For any Σ-algebra A = ( A , O P A ) and any map α : X A there exists a unique Σ-homomorphism α * : T Σ ( X ) A such that η X ; α * = α .
Preprints 73551 i008
The universal property in Proposition 5 characterizes T Σ ( X ) uniquely up to isomorphism and the case X = gives us initial Σ -algebras at hand.
Corollary 8.
T Σ ( ) is initial in the category Alg ( Σ ) .
It is a standard result for free constructions that the assignments X T Σ ( X ) and ( f : X Y ) ( ( f ; η Y ) * : T Σ ( X ) T Σ ( Y ) ) define a (free) functor F Σ : Set Alg ( Σ ) that is left-adjoint to the forgetful functor U Σ (see [15]).
Preprints 73551 i009

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 F Σ U Σ at hand, is that we get a fully fledged, well-defined and well-behaved substitution calculus for free relying on general results in Category Theory. We insert an informal exposition 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 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
(1)
substitution (declaration), i.e., an assignment of expressions to variables.
In Universal Algebra, we can formalize substitutions as maps σ : X T Σ ( Y ) . For finite sets X = { x 1 , , x n } we may simply declare a substitution by listing the corresponding assignments { x 1 t 1 , , x n t n } .
The second constituent of a substitution calculus is the specific mechanism for
(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.
A common practice in Universal Algebra [14] is to denote the resulting term in T Σ ( Y ) of applying a finite substitution { x 1 t 1 , , x n t n } to a term t in T Σ ( X ) by
t [ x 1 / t 1 , , x n / t n ] .
An obvious, but not always trivial, requirement for substitution application is
(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.
In case of terms, “well-formedness” simply means that we consider only those strings of symbols as terms which can be generated inductively by the three rules in Definition 8.
Lets assume we have three collections of expressions and two linkable substitutions. The first substitution replaces variables in expressions from the first collection by expressions from the second collection 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:
(4)
composition of linkable substitutions.
The composition of the two linkable finite substitutions { x 1 t 1 , , x n t n } from X = { x 1 , , x n } to T Σ ( Y ) and { y 1 r 1 , , y m r m } from Y = { y 1 , , y m } to T Σ ( Z ) results, for example, in the finite substitution
{ x 1 t 1 [ y 1 / r 1 , , y m / r m ] , , x n t n [ y 1 / r 1 , , y m / r m ] }
from X to T Σ ( Z ) .
Obviously, we would like that the application of the “big step” substitution produces always the same result as the successive application of the two linkable “small step” substitutions, i.e., for a substitution calculus we require that
(5)
composition of substitutions is compatible with substitution application.
For the two linkable finite substitutions above this requirement can be expressed by the equation
t [ x 1 / t 1 [ y 1 / r 1 , , y m / r m ] , , x n / t n [ y 1 / r 1 , , y m / r m ] ] = ( t [ x 1 / t 1 , , x n / t n ] ) [ y 1 / r 1 , , y m / r m ]
Compatibility of composition of substitutions with substitution application ensures usually another useful property:
(6)
composition of substitutions is associative.
These are the six syntactic features we would 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 also semantic structures are considered, we will have some additional features concerning the interplay of syntax and semantics.
In analogy to substitutions, we have first to choose a way to describe
(7)
variable assignments, i.e., assignments of semantic items to variables.
In Universal Algebra, we work exclusively with variables ranging over elements in sets thus variable assignments can be defined as maps α : X A from a set of variables into the carrier set of a Σ -algebra A , as we have done in Definition 9.
In analogy to the step from substitution (declaration) to substitution application, each variable assignment should induce a corresponding
(8)
evaluation of expressions, computing for each expression a unique semantic item or truth value, respectively.
Definition 9 presents, for example, an inductive definition of the evaluation α * : T Σ ( X ) A of Σ -terms into elements in the carrier A of a Σ -algebra A induced by a variable assignment α : X A .
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
(9)
composition of substitutions with variable assignments as well as composition of variable assignments with homomorphisms.
For both new kinds of composition it is desirable to have
(10)
compatibility w.r.t. substitution application and/or evaluation, respectively.
Finally, it would be reasonable to require
(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, respectively.

3.4.2. Substitutions by Algebraic Extensions

We discuss now the specialties of the “internalization approach” in view of the informal concept of a substitution calculus outlined in the last subsection.
Features (7) & (8): Variable assignments are formalized as maps α : X A from a set of variables into the carrier set A of a Σ -algebra A and the corresponding unique term evaluations are inductively defined maps α * : T Σ ( X ) A according to Definition 9.
Introducing term Σ -algebras and realizing that the inductive definition of unique term evaluations can be described as unique algebraic extensions α * : T Σ ( X ) A of variable assignments α : X A , as stated in Proposition 5, has three immediate consequences.
Feature (1):
Substitutions σ : X T Σ ( Y ) become simply a special case of variable assignments and
Feature (2):
Substitution applications appear as a special case of term evaluations namely as algebraic extensions σ * : T Σ ( X ) T Σ ( Y ) . Applying a substitution σ : X T Σ ( Y ) to a Σ -term t T Σ ( X ) means nothing but to compute the Σ -term σ * ( t ) T Σ ( Y ) . As mentioned before, it is common to use instead of σ * ( t ) also the more informative notation in (10) in 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 10 (Term algebra), are indeed Σ -algebras.
Feature (9): The composition of a substitution σ : X T Σ ( Y ) with a variable assignment α : Y A , is the variable assignment σ ; α * : X A 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).
Preprints 73551 i010
Feature (4) composition of linkable substitutions becomes a special case of feature (9): The composition of a substitution σ : X T Σ ( Y ) and a substitution δ : Y T Σ ( Z ) is the substitution σ ; δ * : X T Σ ( Z ) . In such a way, Feature (5) composition of substitutions is compatible with substitution application becomes a special case of feature (10): σ * ; δ * = ( σ ; δ * ) * (see the right diagram above). Equation 12 is spelling out this equation for the finite case.
Also the remaining part of feature (9) and (10), respectively, is ensured by Proposition 5: The composition of a variable assignment α : X A with a Σ -homomorphism h : A B , for example, is the variable assignment α ; h : X B and the uniqueness of algebraic extensions ensures compatibility: α * ; h = ( α ; h ) * .
Finally, all the compatibilities together with the associativity of composition of maps gives us also the three kinds of associativity required by feature (11). The proof of the associativity
substitution; (substitution; assignment) = (substitution; substitution); assignment,
for example, is simply given by compatibility of substitution application and evaluation as well as associativity of map composition: σ ; ( δ ; β * ) * = σ ; ( δ * ; β * ) = ( σ ; δ * ) ; β * for arbitrary substitutions σ : X T Σ ( Y ) , δ : Y T Σ ( Z ) and assigments β : Z A .
Remark 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 work out separately each of the necessary definitions and proofs based on the inductive definition of terms analogously to Definition 9 (Evaluation of Terms). Internalization simply saves us a lot of work if it comes to substitutions!
On the other side, 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, internalization of terms will be of restricted help.
As an example of a definition that is independent of Proposition 5, we give an explicit inductive definition of substitution application.
Definition 11
(Substitution Application). For any sets X, Y of variables and any substitution δ : X T Σ ( Y ) we can define inductively a corresponding substitution application δ * : T Σ ( X ) T Σ ( Y ) such that η X ; δ * = δ :
Variables: 
δ * ( x ) : = δ ( x ) , for all x T Σ ( X ) ;
Constants: 
δ * ( c ) : = c , for all c T Σ ( X ) ;
Operations: 
δ * ( op t 1 , , t n ) : = op δ * ( t 1 ) , , δ * ( t n ) , for all op t 1 , , t n T Σ ( X ) .
Remark 7
(Kleisli Category). The composition of substitutions defined above, together with η X 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 F Σ U Σ , which is equivalent to the full subcategory of Alg ( Σ ) 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 “derived operations”, it is maybe worth to round up our discussion of monomorphisms and epimorphisms in Alg ( Σ ) . We mentioned already in Corollary 2 that injective Σ -homomorphisms are monomorphisms in Alg ( Σ ) since the functor U Σ : Alg ( Σ ) Set is faithful and reflects therefore monomorphisms. The first observation is that the existence of the free functor F Σ : Set Alg ( Σ ) now provides the implication in the other direction.
Lemma 3
(Monic implies Injective). For every monic Σ-homomorphism f : A B the underlying map f : A B is a monomorphism in Set , i.e., injective.
Proof. 
We consider an arbitrary set X and arbitrary maps g , h : X A such that g ; f = h ; f .
Preprints 73551 i011
By uniqueness of algebraic extensions we have g * ; f = ( g ; f ) * and h * ; f = ( h ; f ) * (feature (10) compatibility of substitution application and evaluation) thus the assumption entails g * ; f = ( g ; f ) * = ( h ; f ) * = h * ; f . f : A B monic implies g * = h * and by pre-composition with η X we obtain g = η X ; g * = η X ; h * = h as required. □
Second, the free functor helps to elucidate the intuition behind the choice of the adjectives “accessible”/“reachable” in Definition 6, namely that each element in R ( f , B ) can be accessed/reached by first applying the map f and then applying successively the operations in B .
Lemma 4
(Accessible via Map ≅ Accessible via Extension). For any Σ-algebra B and any map f : A B we have R ( f , B ) = R ( f * , B ) for the algebraic extension f * : T Σ ( A ) B . In such a way, B is accessible via f : A B if, and only if, B is accessible via f * : T Σ ( A ) B .
Proof. 
Feature (10) compatibility of substitution application and evaluation ensures for any Σ-subalgebras X of B that f factors through ι X , B : X B if, and only if, f * factors through ι X , B : X B . □
By Lemma 4, Proposition 4, and Corollary 7 we obtain the following equivalences.
Corollary 9.
For any Σ-algebra B and any map f : A B the following statements are equivalent
  • B is accessible via f : A B .
  • B is accessible via f * : T Σ ( A ) B .
  • f * : T Σ ( A ) B is an epimorphisms in Alg ( Σ ) .
  • f * : T Σ ( A ) B is an epimorphism in Set , i.e., surjective.

3.6. Terms and Derived Operations

For any set X and any Σ -algebra A the evaluation of Σ -terms over X in A is actually a map from T Σ ( X ) × A X into A. In Definition 9 we fix an arbitrary element α A X and define a corresponding map α * : T Σ ( X ) A by varying inductively over T Σ ( X ) . That is, we describe the map from T Σ ( X ) × A X into A by an A X -indexed family of maps α * : T Σ ( X ) A . 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 T Σ ( X ) × A X into A by a T Σ ( X ) -indexed family of maps from A X into A or A O . O = { o } is the singleton used in Definition 1 to declare the output arity of operation symbols.
Definition 12
(Derived Operations). For any set X of variables, any Σ-algebra A and any Σ-term t T Σ ( X ) we define a corresponding derived operation , i.e., the map
t A : A X A O w i t h t A ( α ) ( o ) : = α * ( t ) f o r a l l α A X .
We call the maps t A derived operations since they are built up from the basic operations in O P A (compare Definition 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, 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. Especially, 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 12 and define derived operations, independent of Definition 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: Composition of maps (morphisms) and tupling of maps (morphisms). Since we use non-traditional finite products A I , instead of traditional Cartesian products A n , to define domains and codomains of operations, it is probably worth to spell out the corresponding version of tupling we will rely on.
Definition 13
(Tupling of Maps). For any family of maps f j : A X A O with 1 n , 1 j n we can construct a map f 1 , , f n : A X A I n , I n : = { i 1 , i 2 , , i n } defined by
f 1 , , f n ( α ) ( i j ) : = f j ( α ) ( o ) f o r a l l α A X a n d a l l 1 j n .
For an empty family of maps, : A X A I 0 denotes the constant map assigning to all α A X the only element in A I 0 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 14
(Construction of Derived Operations). For any set X and any Σ-algebra A we define inductively for all Σ-terms t T Σ ( X ) a corresponding derived operation t A : A X A O as follows
Variables: 
for all x T Σ ( X ) the (projection) map x A : A X A O is defined by x A ( α ) ( o ) : = π x ( α ) = α ( x ) for all α A X ;
Constants: 
c A : = ; c A , for all c T Σ ( X ) ;
Operations: 
op t 1 , , t n A : = t 1 A , , t n A ; op A , for all op t 1 , , t n T Σ ( X ) , n 1 .

3.7. Syntactic Lawvere Theories

As long as we restrict 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 see soon. 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 Σ = ( O P , a r ) a syntactic category L ( Σ ) as follows:
Objects: 
As objects we chose canonical finite sets of variables
X 0 = and X n : = { x 1 n , x 2 n , , x n n } for   all n N with n 1 .
For all n 2 we assume X n to be equipped with a fixed total order x 1 n < x 2 n < < x n n thus we can reuse the tuple notation to represent maps as discussed in Section 2.
Morphisms: 
Morphisms are all tuples ( t 1 , , t n ) : X m X n representing a substitution (declaration) t : X n T Σ ( X m ) .
Identities: 
The identity on X n is the tuple ( x 1 n , , x n n ) : X n X n representing the substitution η X n : X n T Σ ( X n ) .
Composition: 
The composition of two tuples ( r 1 , , r m ) : X k X m and ( t 1 , , t n ) : X m X n is the tuple ( r * ( t 1 ) , , r * ( t n ) ) : X k X n representing the substitution t ; r * : X n T Σ ( X k ) where r * : T Σ ( X m ) T Σ ( X k ) is the application of the substitution r : X m T Σ ( X k ) according to Definition 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 L ( Σ ) has all finite products. We describe binary products:
  • The product of two objects X n and X m is defined by X n × X m : = X n + m with projections π 1 : = ( x 1 n + m , , x n n + m ) : X n + m X n and π 2 : = ( x n + 1 n + m , , x n + m n + m ) : X n + m X m .
  • The tuple of two morphisms ( t 1 , , t n ) : X k X n and ( r 1 , , r m ) : X k X m in L ( Σ ) is given by
( t 1 , , t n ) , ( r 1 , , r m ) : = ( t 1 , , t n , r 1 , , r m ) : X k X n + m
.
Remark 8
(Product versus Sum). The tentative reader has surely realized that X n + m is not the product but the sum of X n and X m in the category Set and that ( t 1 , , t n , r 1 , , r m ) represents the cotuple [ t , r ] : X n + m T Σ ( X k ) of the two maps t : X n T Σ ( X k ) and r : X m T Σ ( X k ) in Set . However, by choosing the direction of the morphisms in L ( Σ ) in accordance with the direction of there semantics t 1 A , , t n A : A X k A X n , X n + m becomes indeed the categorical product of X n and X m in L ( Σ ) . In other words, for us it is much more convenient to describe L ( Σ ) 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 Set 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 A X n + m A X n × A X m with “ _ × _ ” denoting this time the Cartesian product of sets.
The construction of syntactic Lawvere theories L ( Σ ) for signatures Σ is a free construction on the “external meta-level”. More specific, there is for any signature Σ an equivalence between the category Alg ( Σ ) and the category of all finite product preserving functors from L ( Σ ) into Set : For every finite product preserving functor H : L ( Σ ) Set there is a corresponding Σ -algebra U ( H ) with carrier H ( X 1 ) and operations defined for each n-ary operation symbol in O P by op U ( H ) : = b n ; H ( ( op x 1 n , , x n n ) ) ; b with the isomorphisms b n : H ( X 1 ) I n H ( X n ) , provided by the assumption that H preserves finite products, and the obvious isomorphism b : H ( X 1 ) H ( X 1 ) O .
Conversely, for every Σ -algebra A the assignments X 1 A , X n A I n for all n 2 , and ( t 1 , , t n ) t 1 A , , t n A give rise to a unique finite limit preserving functor FP ( A ) : L ( Σ ) Set such that U ( FP ( A ) ) = A . This is ensured by Definition 13 and Definition 14.
Finally, L ( Σ ) 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 n N the hom-functor L ( Σ ) ( X n , _ ) : L ( Σ ) Set preserves finite limits. According to the above equivalence of categories and the Yoneda Lemma, the corresponding Σ -algebra U ( L ( Σ ) ( X n , _ ) ) satisfies the universal property stated in Proposition 5. This means, however, nothing but the Σ -algebras U ( L ( Σ ) ( X n , _ ) ) and T Σ ( X n ) being isomorphic.

4. Graph Algebras and Graph Term Algebras

Relying on the categorical reconstruction of concepts, 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 comp could be declared in the following way.
Preprints 73551 i040
Compared to traditional algebraic operations we can presently infer some essential differences [1]:
Two different kinds of input items. 
This is evident due to working with graphs which consists of both vertices and edges. Instead of a single set, we declare therefore a graph as the input arity.
Arbitrary 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 comp above, the relation between the two arity graphs I comp and O comp is clear from the labelling: the output edge ’ o e 1 ’ has the same source and target as the input edges ’ i e 1 ’ and ’ i e 2 ’, respectively. Instead of always requiring coherent labelling, we introduce a third arity graph B comp , called the boundary of comp , to encompass the connection between input and output in a fitting way.
We summarise the previous discussion as the following definition.
Definition 15
(Graph signature). A graph signature Γ = ( O P , a r ) is given by
  • a set O P of operation symbols,
  • a map a r assigning to each operation symbol op in O P its arity span, i.e., a span a r ( op ) = I op l op B op r op O op of inclusion graph homomorphisms between finite graphs such that the sets ( O op ) V ( B op ) V and ( I op ) V as well as the sets ( O op ) E ( B op ) E and ( I op ) E are disjoint. The graphs I op , B op , O op are referred to as theinput arity,boundary arity, and output arity of op , respectively.
If I c is the empty graph 0 for c O P , we also say that c is a constant symbol. Note, that also B c = 0 in this case.
It is maybe worth to mention that the disjointedness condition is equivalent to the condition that B op is the componentwise set intersection of the graphs I op and O op , i.e.
( B op ) V = ( I op ) V ( O op ) V and ( B op ) E = ( I op ) E ( O op ) E .
Remark 9
(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 arbitrary and we should be prepared to rename, if necessary, the arities of a graph operation.
An arity renaming ϱ from an arity span I l B r O to another arity span I l B r O is simply a triple of graph isomorphisms ϱ I : I I , ϱ B : B op B , ϱ O : O O such that the following diagram commutes
Preprints 73551 i012
Remark 10
(Notational Conventions). For all finite graphs J , used in arity spans, we assume that the corresponding sets J V and J E are equipped with a fixed total order. Relying on our conventions in Section 2, this allows us to represent any graph homomorphism b = ( b V , b E ) : J G as a pair of tuples b V = ( b v 1 , , b v n ) , b E = ( b e 1 , , b e m ) where n = | J V | , m = | J E | and b v i ( b e j ) the image of the i-th (j-th) element in J V ( J E ), 1 i n , 1 j m . For any arity span I l B r O we assume that B inherits the order from I and O , respectively.
We impose the disjointness condition in Definition 15 to distinguish syntatctically between input items of a graph operation and the new output items produced by a graph operation. Another objective is to be able to infer later the arity of a “graph operation expression” only based 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, respectively. In a canonical arity span we use canonical sets I V = { i v 1 , , i v n I } of input vertices and I E = { i e 1 , , i e m I } of input edges, respectively, with n I = | I V | and m I = | I E | . In the same way, we use canonical sets O V B V = { o v 1 , , o v n O } of output vertices and O E B E = { o e 1 , , o e m O } of output edges, respectively, with n O = | O V B V | and m O = | O E B E | .
Example 1
(Signature for Categories). We define a signature Γ c a t with an operation symbol comp to denote operations composing two edges and an operation symbol id to denote operations assigning to vertices corresponding identity edges.
As per Definition 15, we extend the arity of comp proposed in (14) to the span of graph homomorphisms shown in Figure 1 with a boundary graph B comp consisting of only two vertices, i v 1 and i v 3 . This encapsulates exactly the desired requirements for a composition operation with regards to sources and targets.
Analogously, the arity of id , shown in Figure 2, encapsulates the requirements for an identity operation with regards to sources and targets.
Graph 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 G and H , G H denotes the set Graph ( H , G ) of all graph homomorphisms from H into G .
Graph operations are maps, i.e., morphisms in Set ! Specifically, an operation op G on a graph G should take as input a graph homomorphism in G I op and return as output a graph homomorphism in G O op . This procedure needs to respect the boundary which is ensured by requiring the resulting square being commutative.
Definition 16
(Graph Algebra). Let Γ = ( O P , a r ) be a graph signature. A(graph) Γ -algebra G = ( G , O P G ) is given
  • by a graph G , called the carrier of G , and
  • a family O P G = ( op G : G I op G O op | op O P ) of maps such that the following diagram commutes for all op in O P and all graph homomorphisms b G I op .
Preprints 73551 i013
The maps in O P G are referred to asgraph operations.
The specific case where I op is the empty graph 0 , the set G I op becomes a singleton as there is exactly one graph homomorphism 0 G : 0 G , represented by a pair of empty tuples 0 G = ( ( ) , ( ) ) . Thus, for any constant symbol c in O P , with I c = 0 , the corresponding graph operation c G returns a subgraph of G , i.e., it returns the image of O c under c G ( 0 G ) .
In the case where the signature Γ has no constant symbols, the empty graph constitutes a Γ -algebra, called the empty Γ-algebra.
Example 2
(Categories as Graph Algebras). We consider the graph signature Γ c a t in 1.
Preprints 73551 i014
Obviously, any small category C gives rise to a Γ c a t -algebra C = ( g r ( C ) , O P C ) with the underlying graph g r ( C ) of C as carrier: The graph operation comp C : g r ( C ) I comp g r ( C ) O comp is defined by the single equation ( comp C ( b ) ) E ( o e 1 ) : = b E ( i e 1 ) ; C b E ( i e 2 ) for all b g r ( C ) I comp where “ _ ; C _ ” denotes the composition in C . For the two vertices in O comp the images w.r.t. comp C ( b ) are always fixed due to the commutativity condition in Definition 16: ( comp C ( b ) ) V ( i v 1 ) = b V ( i v 1 ) and ( comp C ( b ) ) V ( i v 2 ) = b V ( i v 2 ) .
Not every Γ c a t -algebra, however, can be seen as a category since it may fail to satisfy the identity and/or the associativity law. In [1] we presented some ideas concerning equations for graph algebras but the development of a full equational calculus is a topic of future research.
Example 3
(Chosen Pullbacks). Graph algebras can serve as a conceptual tool to give a precise meaning to statements like “let C be a category with chosen pullbacks”.
We define the arity of an operation symbol pb as the span of inclusion graph homomorphisms given in Figure 3. To choose pullbacks for a small category C means then nothing but to define a graph operation pb C : g r ( C ) I pb g r ( C ) O pb assigning to each cospan b : I pb g r ( C ) in C a corresponding pullback span pb C : O pb g r ( C ) .
Remark 11
(Built-in Projections). Given a “set of indices” I and a “carrier set” A, we do have a projection map π i : A I A at hand for any index i I , as described in Section 2.
Analougously, we obtain for a “graph of indices” H and a “carrier graph” G a projection map π K H for any subgraph K of H by simple pre-composition with the inclusion graph homomorphism ι K , H : K H :
π K H : G H G K i s d e f i n e d b y π K H ( b ) : = ι K , H ; b f o r a l l b G H .
In such a way, we do have for any Γ-algebra G = ( G , O P G ) and any arity span I l B = r   O (as in Definition 15) with B = O exactly one map from G I to G O satisfying the commutativity condition for graph operations in Definition 16, namely the projection π O I : G I G O . In case I = B = O , π I I : G I G I is simply the identity on G I .
We call those projections built-in since their semantics is completely determined by their arity! After the choice of the carrier G of a graph algebra G we do have these projections available independent of and prior to the choice of the semantics op G of the operation symbols op O P .
A crucial methodological point is that we can use these built-in projections without being forced to include corresponding auxiliary operational symbols in O P and/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 idea of boundaries at all or, in other words, all boundaries in our sense are per default empty in traditional Universal Algebra.
Our reformulation of the definition of homomorphisms for traditional algebras in Definition 3 applies analogously to graph algebras.
Definition 17
(Graph Algebra Homomorphism). Let Γ be a graph signature. A Γ -homomorphism φ : G H between two Γ-algebras G = ( G , O P G ) and H = ( H , O P H ) is a graph homomorphism φ : G H satisfying the following homomorphism condition
( HC ) op G ( b ) ; φ = op H ( b ; φ ) f o r a l l op O P a n d a l l b G I op .
Preprints 73551 i015
For any graphs G , H , J each graph homomorphism φ : G H induces by post-composition a map _ ; φ : G J H J thus we can, more abstractly but equivalently, express the homomorphism condition (HC) by the requirement that the above right square of maps commutes. Note, that in case of constant symbols c O P , I c = 0 the homomorphism condition turns into the equation op G ( ( ) , ( ) ) ; φ = op H ( ( ) , ( ) ) if we apply our conventions in Section 2 and and Remark 10 concerning the tuple notation.
Example 4
(Functors as Homomorphisms). In case of Γ c a t -algebras as defined in Example 2, the homomorphism conditions for the operation symbols comp and id , according to Definition 3, are nothing but the usual requirements for functors to be compatible with composition and identities, respectively.
Graph Γ -algebras and Γ -homomorphisms together constitute a category Alg ( Γ ) : Composition φ ; ψ : G K of two Γ -homomorphisms φ : G H and ψ : H K is given by the composition φ ; ψ of the underlying graph homomorphisms φ : G H and ψ : H K . Lastly, the identity Γ -homomorphism i d G : G G for any Γ -algebra G is given by the identity graph homomorphism i d G : G G .
Proposition 6
(Forgetful Functor). The assignments G G and ( φ : G H ) ( φ : G H ) define a faithful forgetful functor
U Γ : Alg ( Γ ) Graph .
The homomorphism condition for Σ -homorphisms between Σ -algebras in Definition 3 has exactly the same structure as the homomorphism condition for Γ -homomorphisms between graph Γ -algebras in Definition 17. In such a way, the pure categorical proof of Theorem 1 can be directly transformed into a proof of the corresponding statement for graph algebras thus we get the following theorem “for free”.
Theorem 2
(Limits of Graph Algebras). Alg ( Γ ) inherits any small limit from the category Graph , i.e., the functor U Γ : Alg ( Γ ) Graph reflects small limits. Alg ( Γ ) has therefore all small limits since Graph does.

4.2. Comparison with the old definitions

Guided by the pioneering generalized sketch framework developed in the 90s by a group around Zinovy Diskin [4,5,6], we introduced in [1] a different definition of graph signatures and graph algebras, respectively. [1] considers a graph inclusion i op : I op R op as the arity of an operation symbol op and defines an operation op G on a graph G as a map from G I op to G R op making the following triangle commute for any b : I op G .
Preprints 73551 i016
The need for projection operations, among other issues, advised us to introduce explicit output arities. At that point, we could have also chosen cospans I op R op O op to declare the arities of graph operations instead of the spans in Definition 15. The choice of spans has, however, many advantages that we will try to point at later in the paper.
In this subsection we discuss that the new variant and the old variant in [1] are semantically equivalent as either definition of arity, algebra, or homomorphism, respectively, can be obtained from the other.

4.2.1. Comparison of Arity Declarations

For any arity span I op l op B op r op O op in Definition 15 we can simply construct a pushout to obtain the result arity R op
Preprints 73551 i017
The pushout of the arities of the operation symbol comp is visualized in Figure 4.
Pushouts in Graph (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 R op = I op O op , which makes the resulting i op into a graph inclusion, matching the definition in [1]. Note, that B op = O op implies I op = R op .
Conversely, given a cospan I op i op R op o op O op of graph inclusions, we can construct the intersection B op = I op O op , i.e., the componentwise intersection of the vertex and edge sets. This is well-defined as both I op and O op are subgraphs of the same graph R op . The resulting commutative square of inclusion graph homomorphisms is a pullback in Graph where the span I op l op B op r op O op satisfies the condition in Definition 15. In the case where R op = I op O op , the square is also a pushout!
Arities of graph operations are, however, defined in [1] by a single graph inclusion i op : I op R op only. In this situation, we can construct a cospan I op i op R op o op O op of graph inclusion with O op the smallest subgraph of R op containing all vertices in ( R op ) V \ ( I op ) V and all edges in ( R op ) E \ ( I op ) E . By construction, we have R op = I op O op . As for cospans, in general, B op is defined to be the graph I op O op . However, the crucial observation is that B op 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 Graph ([9], 6.1).
Since for a pushout of arities B op = O op implies I op = R op , this means, especially, that the original definition of arities of graph operations in [1] does not allow us to consider built-in projections (see Remark 11) 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 Graph ) while the original version in [1] 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 b : I op G .
Preprints 73551 i018
For any o : O op G with r op ; o = l op ; b there exists, due to the pushout property, a unique r o : R op G with i op ; r o = b and o op ; r o = o . Conversely, for any r : R op G with i op ; r = b we have trivially l op ; b = r op ; ( o op ; r ) .
The uniqueness of mediating morphisms ensures that the assignments o r o and r o op ; r are inverse to each other. This observation ensures that there is a one-to-one correspondence between maps from G I op to G R op satisfying commutativity condition (19) and maps from G I op to G O op satisfying the commutativity condition in Definition 16.

4.2.3. Equivalence of homomorphism conditions

Extending the equivalence of graph operations, also the equivalence of the respective homomorphism conditions can be shown straightforwardly utilizing the uniqueness of mediating morphisms for the pushout of arities, as the interest reader may check.
Remark 12
(Graph of a Graph Operation). For any map f : A B its graph is usually defined as the binary relation { ( a , f ( a ) ) a A } A × B . Often the story is even turned and maps are introduced as those binary relations f A × B which are left-total andright-unique.
Given a pushout of arities and a graph operation op G : G I op G O op we could, anologously, consider the set { r op G ( b ) b G I op } G R op as the graph of the graph operation op G . Utilizing the projections from G R op into G I op and G O op , respectively, we could even lift up properties likeleft-total and right-unique to characterize those subsets of G R op that correspond to graph operations.
This observation may be a basis to define Skolemization in Logics of Statements in Context [2] once we have integrated operations into those logics.
R op has also another important role which was probably one of the reasons that the original definition of sketch operations in [4,5,6] relies on graph inclusions i op : I op R op . R op 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 use R op if we want to describe and specify properties of the output of a graph operation that depend on properties of the input.
Example 5
(Graph of Pullback Operation). Figure 5 shows the pushout of arity declarations for the operation symbol pb . 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.
Example 6
(Chosen In general, any chosen (co)limits of diagrams of a fixed shape I in a category C give rise to a corresponding graph operation on g r ( C ) where arity B is simply given by all the vertices in I while arity O represents the shape of the corresponding (co)cones.
In such a way, the pushout R combines the fixed shape I of diagrams with the shape of corresponding (co)cones thus the elements in the graph of the corresponding graph operation on g r ( C ) represent, at the same time, a diagram and a (co)cone for this diagram.
Remark 13
(Advantages of Spans of Arities). Starting with a span of arities as in Definition 15 we get a corresponding commutative square of arities by a simple pushout construction. That this square becomes, moreover, in any topos a pullback is a necessary side effect.
If we start, in contrast, with a cospan we could construct a pullback to get 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 [1] turned out to be not appropriate to define derived graph operations. On one side, projections are necessary to define an appropriate notion of derived graph operations. The original definition excludes, however, projections. On the other side, our later construction of derived operations, by means of epi-mono factorizations and pushouts, can not be equivalently mimicked by means of the original definition. Even the universal property of initial pushouts is not of help in establishing an equivalence.

4.3. Graph Subalgebras

The definitions and results for graph algebras, presented in this subsection, are new and can not be found in [1].
The effort, we spent in Section 3, to lift up the traditional exposition of algebras to a more categorical one, pays now off. 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 3 does not work in case of graph algebras and that there is no axiom of choice in Graph .
In contrast to Section 3, we do not distinguish between “subalgebras” and “inclusion homomorphisms”. We define “subalgebras” simply as “inclusions”.
Definition 18
(Graph Subalgebra). Let Γ = ( O P , a r ) be a graph signature. A Γ-algebra G = ( G , O P G ) is a Γ -subalgebra of a Γ-algebra H = ( H , O P H ) if G H and and the inclusion graph homomorphism ι G , H = ( ι G V , H V , ι G E , H E ) : G H establishes a Γ-homomorphism ι G , H : G H .
We know that the monomorphisms (epimorphisms) in Graph are exactly the injective (surjective) graph homomorphisms, respectively. Faithful functors reflect monomorphisms and epimorphisms. The forgetful functor U Γ : Alg ( Γ ) Graph is faithful thus we obtain
Corollary 10
(Injective and surjective Homomorphisms). If the underlying graph homomorphism φ : G H of a Γ-homomorphism φ : G H is injective (surjective) then φ : G H is a monomorphism (epimorphism) in Alg ( Γ ) .
The category Graph has all small limits and colimits and those are obtained by componentwise limits and colimits, respectively, in Set . This means, especially, that Graph has all small multiple pullbacks (see Remark 3). Due to Theorem 2 we can define, in such a way, the intersection of graph subalgebras analogously to the intersection of subalgebras in Corollary 3.
Corollary 11
(Intersection of Graph Subalgebras). For any set I, any Γ-algebra H , and any diagram δ : MP ( I ) Alg ( Γ ) of Γ-subalgebras δ e i = ι G i , H : G i H , i I of H there is a unique Γ-subalgebra L = ( L , O P L ) of H with L = i I G i , i.e., L V = i I ( G i ) V and L E = i I ( G i ) E , that is a Γ-subalgebra of G i for all i I .
Moreover, the inclusion Γ-homomorphisms ι L , G i : L G i , i I and ι L , H : L H constitute a multiple pullback, i.e., a limit cone of the diagram δ : MP ( I ) Alg ( Γ ) .
We call L = ( L , O P L ) also the intersection of the I-indexed family M = ( G i i I ) of Γ-subalgebras of H and may use the notations M , i I G i or, simply, G i to denote L .
The category Graph is well-powered, i.e., the collection of all graph subalgebras of a graph algebra is a set, thus we can define a concept “accessible via a graph homomorphism”.
Definition 19
(Graph Subalgebra accessible via a Graph Homomorphism). For any Γ-algebra H and any graph homomorphism φ : G H let M be the set of all Γ-subalgebras X of H such that φ factors through the inclusion graph homomorphism ι X , H : X H , i.e., there exists a graph homomorphism φ X : G X such that φ X ; ι X , H = φ .
We denote by R ( φ , H ) the intersection of M , according to Corollary 11. Especially, the carrier of R ( φ , H ) is the intersection R ( φ , H ) : = { X X M } of graphs. We call R ( φ , H ) the Γ -subalgebra of H accessible (reachable) via φ or thehomomorphic image of G w.r.t. φ .
In case of inclusion graph homomorphisms φ = ι G , H : G H we use also the notation R ( G , H ) instead of R ( ι G , H , H ) and call R ( G , H ) also the Γ -subalgebra of H generated by G .
Note, that the graph homomorphism φ X : G X in Definition 19 is unique, if it exists, since the inclusion graph homomorphism ι X , B : X H is a monomorphism in Graph .
We can also transfer Corollary 4 to graph algebras since for any graph homomorphism φ : G H the set-theoretic image φ ( G ) of G w.r.t. φ constitutes a subgraph of H . Moreover, we have φ ( G ) = { Y Y N } for the set N of all subgraphs Y of H .
Corollary 12
(Homomorphic image includes Image). For any Γ-algebra H and any graph homomorphism φ : G H we have φ ( G ) R ( φ , H ) for the set-theoretic image φ ( G ) of G w.r.t. φ.
Definition 20
(Accessible and Generated Graph Algebras). Let H be a Γ-algebra.
  • H isaccessible via a graph homomorphism φ : G H if R ( φ , H ) = H .
  • If H is accessible via an inclusion graph homomorphism ι G , H : G H , i.e., if R ( G , H ) = R ( ι G , H , H ) = H , we say also that H isgenerated by G .
  • H is said to be generated if it is generated by the empty graph, i.e., accessible via the unique graph homomorphism ι 0 , H : 0 H from the initial object 0 in Graph to H .
Corollary 13.
A Γ-algebra H is generated if, and only if, there are no proper Γ-subalgebras of H .
Corollary 14.
If a signature Γ has 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 Alg ( Γ ) . First, we observe that “accessible” implies “epic”.
Lemma 5
(Accessible implies Epic). A Γ-homomorphism φ : G H is an epimorphism in Alg ( Γ ) if H is accessible via the underlying graph homomorphism φ : G H , i.e., if H = R ( φ , H ) .
Proof. 
We consider arbitrary Γ-homomorphsms ψ , ϕ : H K such that φ ; ψ = φ ; ϕ .
We know that the subgraph X of H with X V = { v H V ψ V ( v ) = ϕ V ( v ) } H V , X E = { e H E ψ E ( e ) = ϕ E ( e ) } H E together with the inclusion graph homomorphism ι X , H : X H is an equalizer of the graph homomorphisms ψ , ϕ : H K in Graph . According to Theorem 2, there is a unique Γ-algebra X = ( X , O P X ) such that ι X , H : X H becomes an inclusion Γ-homomorphism ι X , H : X H which is, moreover, the equalizer of the Γ-homomorphisms ψ , ϕ : H K .
Assumption φ ; ψ = φ ; ϕ ensures that there exists a unique graph homomorphism φ X : G X with φ X ; ι X , H = φ . Due to the construction of R ( φ , H ) in Definition 19, we have an inclusion Γ-homomorphism ι R ( φ , H ) , X : R ( φ , H ) X . Accessibility of H means H = R ( φ , H ) thus we get, finally, X = H . This means, however, that the equalizer of ψ and ϕ in Graph is the identity on H 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, 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 develop therefore in Section 4.4 a corresponding free construction called term completion.
Proposition 7
(Graph Subalgebras are Regular Monos). For any Γ-subalgebra ι G , H : G H of a Γ-algebra H there exists a Γ-algebra K and parallel Γ-homomorphisms ψ , ϕ : H K such that ι G , H : G H is the equalizer of ψ and ϕ in Alg ( Γ ) .
Proof. 
Utilizing th term completion construction and its characterization as a free construction, as presented in Section 4.4, we will sketch a proof varying the proof of Proposition 3.
We construct the pushout of the span H ι G , H G ι G , H H of inclusion graph homomorphisms (see the left diagram below). We set K : = H + G H . Since ι G , H is monic in Graph both graph homomorphisms κ 1 , κ 2 : H K are monic too and, moreover, the pushout square is as well a pullback square. This ensures, especially, that ι G , H : G H is the equalizer of the graph homomorphisms κ 1 , κ 2 : H K in Graph .
Preprints 73551 i038
Graph Operations on K : We extend K to a partial Γ-algebra K = ( K , O P K ) (see Definition 21) by defining for each op in O P a corresponding partial graph operation op K : K I op K O op according to Case 1, Case 2 and Case 3.
The operations in K are defined exactly in a way that the graph homomorphisms κ 1 and κ 2 become Γ-homomorphisms κ 1 , κ 2 : H K , in the sense of Definition 22, thus we obtain a commutative square in PAlg (see the middle diagram above).
Applying the functor TC Γ : PAlg ( Γ ) Alg ( Γ ) we transform this commutative square in PAlg ( Γ ) into a commutative square in Alg ( Γ ) . Taking into account Corollary 15 and (23) we get the commutative diagram on the right above.
The underlying square of graph homomorphisms is again a pullback in Graph since the inclusion graph homomorphism ι K , T Γ ( K ) : K T Γ ( K ) is monic in Graph .
Theorem 2 ensures, finally, that the Γ-homomorphism ι G , H : G H is the equalizer of the Γ-homomorphisms κ 1 ; ι K , T Γ ( K ) , κ 2 ; ι K , T Γ ( K ) : H T Γ ( K ) . □
Regularity of Alg ( Γ ) entails that the concepts accessible and epic are equivalent.
Proposition 8
(Accessible ≅ Epic). For any Γ-homomorphism φ : G H it holds that H is accessible via the underlying graph homomorphism φ : G H , i.e., in other words H is equal to the homomorphic image R ( φ , H ) of G w.r.t. φ, if, and only if, φ : G H is an epimorphism in Alg ( Γ ) .
Proof. 
“Accessible implies epic” has been shown in 5. We show now “epic implies accessible”: We consider an arbitrary Γ-subalgebra X of H such that there exists a graph homomorphism φ X : G X with φ X ; ι X , B = φ . Due to Proposition 7 there exist Γ-homomorphisms ψ , ϕ : H C such that ι X , H : X H is the equalizer of ψ and ϕ. Due to the assumption φ X ; ι X , H = φ , we get φ ; ψ = φ ; ϕ and thus ψ = ϕ since φ is epic. This means, however, X = H and, finally, R ( φ , H ) = H due to the construction of R ( φ , H ) in Definition 19. □
The axiom of choice is not valid in Graph . Therefore, the set-theoretic image φ ( G ) of the carrier G of a Γ -algebra G w.r.t. a Γ - homomorphism φ : G H is, in general, not closed w.r.t. operations in H . As a consequence, not every epic Γ -homomorphism needs to be surjective. We adapt the standard example of the composition of morphisms in categories.
Example 7
(Epic ≇ Surjective). We consider a Γ c a t -homomorphism φ : G H between two finite Γ c a t -algebras G and H , as depicted below.
Preprints 73551 i019
G I comp is empty while H I comp has exactly one element b given by the assignments f α , g β . α and β are in the set-theoretic image φ ( G ) while the result of applying comp G to b , namely γ = comp G ( b ) ( o e 1 ) , is not. φ : G H is not surjective but epic since H = R ( φ , H ) .

4.4. Partial Graph Algebras and their Term Completion

In practice, graph operations are often partial graph operations. The sketch operations introduced in [5,6], for example, can be seen as partial graph operations where the domain of definition is specified by diagrammatic predicates. Therefore we decided to present in this paper also the very basic definitions for partial graph algebras.
This decision was also triggered by the observation that we could prove Proposition 7 for arbitrary graph signatures based on a well-behaved completion procedure transforming partial (graph) algebras into total (graph) algebras. To our little surprise the construction of (graph) term algebras turns out to be just a special case of this new procedure.
Definition 21
(Partial Graph algebra). Apartial (graph) Γ -algebra G is a pair ( G , O P G ) given
  • by a graph G , called the carrier of G , and
  • a family O P G = ( op G : G I op G O op | op O P ) of partial maps such that the following diagram commutes for all op in O P and all graph homomorphisms b d o m ( G I op ) .
Preprints 73551 i020
The partial maps in O P G are referred to aspartial graph operations.
Be aware that also constants can be partial! For any constant symbol c in O P , with I c = 0 , we do have exactly two possibilities since G I c is a singleton: Either, d o m ( c G ) = G I op , i.e., the constant is defined, or d o m ( c G ) = , i.e., the constant is not defined.
Definition 22
(Partial Graph Algebra Homomorphism). A Γ -homomorphism φ : G H between two partial Γ-algebras G = ( G , O P G ) and H = ( H , O P H ) is a graph homomorphism φ : G H satisfying the following homomorphism condition
( HCP ) b ; φ d o m ( H I op ) a n d op G ( b ) ; φ = op H ( b ; φ ) f o r a l l op O P a n d a l l b d o m ( G I op ) .
Preprints 73551 i021
In other words, 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 PAlg ( Γ ) : Composition φ ; ψ : G K of two Γ -homomorphisms φ : G H and ψ : H K is given by the composition φ ; ψ of the underlying graph homomorphisms φ : G H and ψ : H K . The identity Γ -homomorphism i d G : G G for any partial Γ -algebra G is given by the identity graph homomorphism i d G : G G . We consider graph Γ -algebras as special partial Γ -algebras thus Alg ( Γ ) is a full subcategory of PAlg ( Γ ) .
Proposition 9
(Forgetful Functor). The assignments G G and ( φ : G H ) ( φ : G H ) define a faithful forgetful functor
U Γ P : PAlg ( Γ ) Graph .
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 14
(Syntactic Representaion of Inputs). In addition to our notational conventions in Section 2 and Remark 10 we will rely on the following syntactic representation of inputs of graph operations: For any graph G and any op in O P an input b = ( b V , b E ) G I op is represented by two strings, representing the vertices and the edges in G , respectively, separated by the symbol “|”
s y n ( b ) : = b v 1 , , b v n op b e 1 , , b e m op
where n op = | ( I op ) V | and m op = | ( I op ) E | . In case I op = 0 , the only input 0 G = ( ( ) , ( ) ) : 0 G is represented, in such a way, by two separated empty sequences: s y n ( 0 G ) = | .
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 all b 1 , b 2 G I op we have s y n ( b 1 ) = s y n ( b 2 ) if, and only if, b 1 = b 2 . (2) s y n ( b ) is indeed a representation, i.e. we are able to reconstruct from s y n ( b ) the corresponding graph homomorphism b = ( b V , b E ) G I op with help of the information about I op in the signature Γ. In case I op has no isolated vertices, for example, we can represent uniquely any b G I op by the string b e 1 , , b e m op only!
Definition 23
(Term Completion). Let Γ = ( O P , a r ) be a graph signature and K = ( K , O P K ) be a partial Γ-algebra. We define the Γ -term completion T Γ ( K ) of the graph K w.r.t. the partial Γ-algebra K as the smallest graph satisfying the following three conditions:
Generators: 
K T Γ ( K )
Constants: 
For all constants c in O P , such that d o m ( c K ) = the graph T Γ ( K ) contains
  • c o v | as a vertex, for each vertex o v in O c ;
  • c o e | as an edge, for each edge o e in O c ,
    where s c T Γ ( K ) ( c o e | ) : = c s c O c ( o e ) | and t g T Γ ( K ) ( c o e | ) : = c t g O c ( o e ) |
Operations: 
For all op in O P with I op 0 and any t T Γ ( K ) I op such that there is no b d o m ( op K ) K I op with t = b ; ι K , T Γ ( K ) , T Γ ( K ) contains
  • op o v s y n ( t ) as a vertex, for each vertex o v in ( O op ) V ( B op ) V ;
  • op o e s y n ( t ) as an edge, for each edge o e in ( O op ) E ( B op ) E , where
    s c T Γ ( K ) ( op o e s y n ( t ) ) : = t V ( s c O op ( o e ) ) i f s c O op ( o e ) ( B op ) V op s c O op ( o e ) s y n ( t ) i f s c O op ( o e ) ( O op ) V ( B op ) V
    t g T Γ ( K ) ( op o e s y n ( t ) ) : = t V ( t g O op ( o e ) ) i f t g O op ( o e ) ( B op ) V op t g O op ( o e ) s y n ( t ) i f t g O op ( o e ) ( O op ) V ( B op ) V
Obviously, we have
T Γ ( K ) = K for all total Γ - algebras K = ( K , O P K ) .
Remark 15
(Term Construction by Pushouts). The construction of Γ-terms in Definition 23 can be organized as a successive application of term construction steps: A term construction step in the case Constants means that we construct, in parallel, for a constant symbol c the terms for all vertices and edges in O c . Analogously, a term construction step in the case Operations means that we construct for an operation symbol op and an input t , in parallel, the terms for all vertices and edges in O op B op . We start with the graph K and each term construction step extends a given graph T to a graph T . This extension is, however, nothing but the construction of the following pushout
Preprints 73551 i022
where the definition of op T Γ ( K ) ( t ) is spelled out, explicitly, in Definition 24. In the light of this observation, one can look at the term notation as a means to solve two problems:
  • 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.
  • At the same time, the term notation encodes all the information necessary to identify uniquely the pushout that has been creating the new items.
The following term completion construction is new and has even never been defined even for traditional partial algebras. Utilizing the operations in K to the greatest possible extend, we can straightforwardly extend K to a total Γ -algebra with carrier T Γ ( K ) .
Definition 24
(Term Completion Algebra). We can extend any partial Γ-algebra K = ( K , O P K ) to a total Γ-algebra T Γ ( K ) = ( T Γ ( K ) , O P T Γ ( K ) ) as follows:
Constants: 
For all constants c in O P :
Utilizing K :
If c K is defined, we simply reuse it:
c T Γ ( K ) ( 0 T Γ ( K ) ) = c T Γ ( K ) ( 0 K ; ι K , T Γ ( K ) ) : = c K ( 0 K ) ; ι K , T Γ ( K )
Completion: 
If c K is not defined, i.e., d o m ( c K ) = we set
  • ( c T Γ ( K ) ( 0 T Γ ( K ) ) ) V ( o v ) : = c o v | for each vertex o v in O c and
  • ( c T Γ ( K ) ( 0 T Γ ( K ) ) ) E ( o e ) : = c o e | for each edge o e in O c .
Operations: 
For all op in O P with I op 0 and any t T Γ ( K ) I op :
Utilizing K :
If there is a b d o m ( op K ) K I op with t = b ; ι K , T Γ ( K ) , we reuse op K :
op T Γ ( K ) ( t ) = op T Γ ( K ) ( b ; ι K , T Γ ( K ) ) : = op K ( b ) ; ι K , T Γ ( K )
Completion: 
If there is no b d o m ( op K ) K I op with t = b ; ι K , T Γ ( K ) , we set
( op T Γ ( K ) ( t ) ) V ( o v ) : = t V ( o v ) i f o v ( B op ) V op o v s y n ( t ) i f o v ( O op ) V ( B op ) V
( op T Γ ( K ) ( t ) ) E ( o e ) : = t E ( o e ) i f o e ( B op ) E op o e s y n ( t ) i f o e ( O op ) E ( B op ) E .
The definitions ensure that the constructed pairs op T Γ ( K ) ( t ) of maps are indeed graph homomorphisms and that the operations in T Γ ( K ) satisfy the commutativity condition in Definition 16. Moreover, the cases “Utilizing K ” are defined in such a way that we get
Corollary 15
(Embedding). For any partial Γ-algebra K = ( K , O P K ) the inclusion graph homomorphism ι K , T Γ ( K ) : K T Γ ( K ) constitutes a Γ-homomorphism ι K , T Γ ( K ) : K T Γ ( K ) in PAlg ( Γ ) thus, due to (21), T Γ ( K ) = K if K is a total Γ-algebra.
We can adapt and generalize the proof of Proposition 2 (Free graph algebras) in [1] to a proof that term completion is a free construction.
Proposition 10
(Term Completion as Free Construction). For any partial Γ-algebra K = ( K , O P K ) , the total Γ-algebra T Γ ( K ) = ( T Γ ( K ) , O P T Γ ( K ) ) has the following universal property: For any total Γ-algebra G = ( G , O P G ) and any Γ-homomorphism φ : K G there exists a unique Γ-homomorphism φ * : T Γ ( K ) G such that the defining condition ι K , T Γ ( K ) ; φ * = φ is satisfied.
Preprints 73551 i023
Proof. 
We prove by structural induction according to Definition 23 and Remark 15.
Generators: 
In this basic case the defining condition forces φ V * ( k v ) = φ V ( k v ) for all k v K V and φ E * ( k v ) = φ E ( k e ) for all k e K E .
Constants: 
In the second basic case we have for all constants c in O P :
Utilizing K :
If c K is defined, the definition of operations in T Γ ( K ) , the defining condition and the assumption that φ is a Γ-homomorphism ensure that φ * satisfies the homorphism condition for the constant c :
c T Γ ( K ) ( 0 T Γ ( K ) ) ; φ * = c K ( 0 K ) ; ι K , T Γ ( K ) ; φ * = c K ( 0 K ) ; φ = c G ( 0 K ; φ ) = c G ( 0 K ; ι K , T Γ ( K ) ; φ * ) = c G ( 0 T Γ ( K ) ; φ * )
Completion: 
If c K is not defined, the definition of operations in T Γ ( K ) and the required homomorphism condition for φ * forces for each vertex o v in O c
φ V * ( c o v | ) = φ V * ( c T Γ ( K ) ( 0 T Γ ( K ) ) ) V ( o v ) = c T Γ ( K ) ( 0 T Γ ( K ) ) ; φ * V ( o v ) = ( c G ( 0 T Γ ( K ) ; φ * ) ) V ( o v ) = ( c G ( 0 G ) ) V ( o v ) .
For each edge o e in O c we get, analogously, φ E * ( c o e ) = ( c G ( 0 G ) ) E ( o e ) .
Operations: 
We have for all op in O P with I op 0 and any t T Γ ( K ) I op :
Utilizing K :
If there is a b d o m ( op K ) K I op with t = b ; ι K , T Γ ( K ) , the definition of operations in T Γ ( K ) , the defining condition and the assumption that φ is a Γ-homomorphism ensure that φ * satisfies the homomorphism condition for t :
op T Γ ( K ) ( t ) ; φ * = op K ( b ) ; ι K , T Γ ( K ) ; φ * = op K ( b ) ; φ = op G ( b ; φ ) = op G ( b ; ι K , T Γ ( K ) ; φ * ) = op G ( t ; φ * )
Completion: 
If there is no b d o m ( op K ) K I op with t = b ; ι K , T Γ ( K ) , the induction hypothesis is that φ * is already defined on a subgraph T T Γ ( K ) and that t ( I op ) T . This ensures t ; φ * G I op . In the induction step we extend φ * to the graph T T Γ ( K ) . The definition of operations in T Γ ( K ) and the required homomorphism condition for φ * forces for each vertex o v in ( O op ) V ( B op ) V
φ V * ( op o v s y n ( t ) ) = φ V * ( op T Γ ( K ) ( t ) ) V ( o v ) = op T Γ ( K ) ( t ) ; φ * V ( o v ) = ( op G ( t ; φ * ) ) V ( o v ) .
For each edge o e in ( O op ) E ( B op ) E we get, analogously, φ E * ( op o e s y n ( t ) ) = ( op G ( t ; φ * ) ) E ( o e ) .
The assignments K T Γ ( K ) and ( ψ : L K ) ( ( ψ ; ι K , T Γ ( K ) ) * : T Γ ( L ) T Γ ( K ) ) define, as usual for free constructions, a functor TC Γ : PAlg ( Γ ) Alg ( Γ ) , and this functor is left-adjoint to the inclusion functor I : Alg ( Γ ) PAlg ( Γ ) .
Preprints 73551 i024
Due to Corollary 15 we even have I ; TC Γ = i d Alg ( Γ ) , i.e., Alg ( Γ ) is a full reflective subcategory of PAlg ( Γ ) . Especially, we have for any Γ -homomorphism ψ : L K in PAlg ( Γ )
TC Γ ( ψ ) = ( ψ ; ι K , T Γ ( K ) ) * = ψ ; ι K , T Γ ( K ) if L is a total Γ - algebra .

4.5. Graph Terms and Graph Term Algebras

Graph term algebras are just the special case of term completion algebras T Γ ( K ) where all the graph operations in K are completely undefined, i.e., where everything is determined by the carrier only.
Definition 25
(Graph Term Algebras). Let X be a graph and X = ( X , O P X ) be the corresponding unique partial Γ-algebra where all graph operations are completely undefined.
Graph terms 
We denote the graph T Γ ( X ) , according to Definition 23, also by T Γ ( X ) and call it thegraph of all (graph) Γ -terms on X .
Graph term algebra 
We denote the term completion Γ-algebra T Γ ( X ) , according to Definition 24, also by T Γ ( X ) = ( T Γ ( X ) , O P T Γ ( X ) ) and call it the Γ -term graph algebra on X .
Assigning to any graph X the corresponding unique partial Γ -algebra X = ( X , O P X ) where all graph operations are completely undefined, defines a functor from Graph to PAlg ( Γ ) that is left-adjoint to the forgetful functor U Γ P : PAlg ( Γ ) Graph in Proposition 9. Combining this adjunction with the adjunction in (22) gives us the desired universal property of graph term algebras at hand.
Proposition 11
(Graph Term Algebra as Free Construction). Given a graph X the Γ-term graph algebra T Γ ( X ) has the following universal property: For any total Γ-algebra G = ( G , O P G ) and any graph homomorphism φ : X G there exists a unique Γ-homomorphism φ * : T Γ ( X ) G such that the defining condition ι X , T Γ ( X ) ; φ * = φ is satisfied.
Preprints 73551 i025
It might be worth to mention that Proposition 11 enables us to also transfer Lemma 3 and Lemma 4 in Section 3.5 straightforwardly to the graph algebra setting.
The definition of graph term algebras and their characterization as a free construction is the main result in [1]. We claimed: “The Kleisli category of the new adjunction provides an appropriate substitution calculus.” However, time passed and we realized that this claim is only true with some reservations.
Substition Calculus: 
Graph term algebras manifest the “internalization approach” in the case of graph algebras. Relying on Proposition 11, we can indeed obtain a fully fledge 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 σ : X T Γ ( Y ) and that a variable assignment is a graph homomorphism α : X G for a Γ -algebra G = ( G , O P G ) , we can simply transfer all the discussion, 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 Definition 12 and Definition 14). It took us a while to understand that and why this one-to-one correspondence breaks down if it comes to graph algebras. We discuss and address this problem in the next section.

5. Derived Graph Operations

We now discuss the reasons why graph terms are, in our opinion, not providing 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 source and 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 6
(Operations by Subgraphs). For a given graph X , any subgraph O T Γ ( X ) defines a span X l O B O o O O of graph inclusions with B O : = X O . Moreover, we obtain for all graphs G a map δ O G : G X G O defined by δ O G ( b ) : = ι O , T Γ ( X ) ; b * for all b G X and satisfying the commutativity requirement for graph operations in 16.
However, this solution is also not quite satisfactory. Each item in O 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 O P such that the corresponding derived operation for a Γ -algebra produces, in parallel, for any input all (!) output items simultaneously by the same computation. Moreover, we would like to be able to define the semantics of those graph operation expressions, i.e., the corresponding derived graph operations in Γ -algebras, independent of graph term algebras and in a comparably easy, well-structured inductive way as we did it for terms in Definition 14.
Unfortunately, traditional terms are not providing a fully appropriate blueprint to define such graph operation expressions. In Definition 8 terms are constructed by 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 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 8
(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 comp , as defined in Example 1. The input arity of the expression should be the graph i v 1 i e 1 i v 2 i e 2 i v 3 i e 3 i v 4 i e 4 i v 5 and the output arity should be the graph i v 1 o e i v 5 with o e representing the composition of the four edges in the input arity.
An obvious idea is that in a first step two parallel applications of comp produce the graph i v 1 o e 1 i v 3 o e 2 i v 5 with o e 1 representing the composition of the edges i e 1 , i e 2 and o e 2 representing the composition of the edges i e 3 , i e 4 , respectively. In a second final step, the third application of comp should produce then the edge i v 1 o e i v 5.
If we describe the first step by a tuple we will not get i v 1 o e 1 i v 3 o e 2 i v 5 as output arity but only a pair i v 1 o e 1 i v 3 , i v 3 o e 2 i v 5 of separated edges. This pair of edges, however, does not match the input arity of comp 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 i v 3 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 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 8.
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 syntactic Lawvere categories can be characterized as finite product categories 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 C has finite products if, and only if, the following ingredients are present:
  • C has an empty product (terminal object) 1 , i.e., for any object A in C there is a morphism : A 1 such that
    g ; = : B 1 for all morphisms g : B A .
  • For any family A 1 , , A n , n 1 of objects there is an object A 1 × × A n together with projections π i : A 1 × × A n A i , 1 i n such that
  • for any object B and any family f i : B A i , 1 i n of morphisms there is a morphism f 1 , , f n : B A 1 × × A n with
    f 1 , , f n ; π i = f i for all 1 i n .
    Moreover, we have i d 1 = and i d A 1 × × A n = π 1 , , π n .
  • Finally, for all morphisms g : C B the following equation holds
    g ; f 1 , , f n = g ; f 1 , , g ; f n .

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, angle bracket symbols " " , " " to denote tupling, the semicolon symbol “ ; ” to denote symbolic composition and the auxiliary comma symbol “ , ” to separate substrings.
In a second step, we generate out of 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 formal and precise 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 Σ = ( O P , a r ) a reflexive graph FP ( Σ ) with an associative composition as follows:
Objects: 
As objects we choose the same canonical finite sets of variables as for L ( Σ )
X 0 = and X n : = { x 1 n , x 2 n , , x n n } for all n N with n 1 .
Morphisms: 
Morphisms are all finite product expressions defined inductively as follows
Symbolic Projections: 
x i n : X n X 1 is an fp-expression for all n 1 , 1 i n .
Constant and Operation Symbols: 
o p : X n X 1 with n N is an fp-expression if op is an n-ary operation symbol in O P .
Empty Symbolic Tuples: 
: X n X 0 is an fp-expression for all n N .
Non-empty Symbolic Tuples: 
e x 1 , , e x n : X m X n is an fp-expression for all m 0 , n 1 and all families e x i : X m X 1 , 1 i n of fp-expressions.
Symbolic Sequential Composition: 
e x 1 ; e x 2 : X n X m is an fp-expression for all n , k , m N and all fp-expressions e x 1 : X n X k , e x 2 : X k X m .
Symbolic Identities: 
x 1 n , , x n n : X n X n is the identity on X n for all n 1 and : X 0 X 0 is the identity on X 0 .
Remark 16
(Computation Diagrams). Inspired by logic circuit diagrams, term graphs [20], andstring 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 X n , and as “computation units”, i.e., as identifiers for projections. To distinguish these two roles we simply denote ports by i instead of x i n . As a “computation unit”, a variable simply copies values from a single input port to an arbitrary finite number of output ports.
Example 9
(Finite Product Expressions). Let Σ be a signature with two binary operation symbols “+” and “*”. Both fp-expressions + : X 2 X 1 and x 1 2 , x 2 2 ; + : X 2 X 1 are equivalent, according to the equations (24) – (26), and represent simple “tree-like” computation diagrams as depicted below. The picture below visualizes also the effect of symbolic composition.
Preprints 73551 i026
The equations (24) – (26) do not enforce that the unary symbolic tuple x 1 2 , x 2 2 ; + : X 2 X 1 is equivalent to the fp-expression x 1 2 , x 2 2 ; + : X 2 X 1 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 x 1 1 , x 1 1 ; + : X 1 X 1 , for example. The picture below shows how the corresponding dag-like computation diagram is obtained by composing a “copying unit” with a computation unit.
Preprints 73551 i027
More generally, fp-expressions allow us to represent arbitrary “sharing of sub-computations”. The fp-expression x 1 2 , x 2 2 ; + ; x 1 1 , x 1 1 ; * : X 2 X 1 , for example, represents the square of the sum of two numbers. The corresponding dag-like computation diagram is depicted below
Preprints 73551 i028
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 FP ( Σ ) ( X n , X m ) for all n , m N 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 FP ( Σ ) with equivalence classes of symbolic tuples as morphisms.
Adapting the recipe from Definition 14, we can obviously translate every Σ -term t T Σ ( X n ) into an fp-expression p e ( t ) .
Definition 26
(Translation of Terms into Finite Product Expressions). For any set X n , n N we define inductively for all Σ-terms t T Σ ( X n ) a corresponding finite product expression p e ( t ) : X n X 1 as follows
Variables: 
p e ( x i n ) : = x i n , for all n 1 , 1 i n .
Constants: 
p e ( c ) : = ; c , for all c T Σ ( X n ) ;
Operations: 
p e ( op t 1 , , t n ) : = p e ( t 1 ) , , p e ( t n ) ; op , for all op t 1 , , t n T Σ ( X n ) , n 1 .
We call all the fp-expressions p e ( t ) , obtained by Definition 26, fp-expressions in normal form. Correspondingly, all the fp-expressions p e ( t 1 ) , , p e ( t n ) are called symbolic tuples in normal form. We use the term “normal form” since they are in normal form w.r.t. a rewrite system consisting of the rewriting rules given by the equations (24) – (26) read from the left to the right [14].
Example 10
(Finite Product Expressions - Normal Forms). From the five fp-expressions in 9 the two expressions x 1 2 , x 2 2 ; + and x 1 1 , x 1 1 ; + are fp-expressions in normal form while x 1 2 , x 2 2 ; + 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 x 1 2 , x 2 2 ; + ; x 1 1 , x 1 1 ; * : X 2 X 1 , that is the symbolic composition of a symbolic tuple in normal form with an fp-expression in normal form, into normal form:
x 1 2 , x 2 2 ; + ; x 1 1 , x 1 1 ; * x 1 2 , x 2 2 ; + ; x 1 1 , x 1 2 , x 2 2 ; + ; x 1 1 ; * ( ) x 1 2 , x 2 2 ; + , x 1 2 , x 2 2 ; + ; * ( )
The picture below shows the result of this transformation into normal form for the relevant sub-expression x 1 2 , x 2 2 ; + ; x 1 1 , x 1 1 .
Preprints 73551 i029
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 FP ( Σ ) , contains exactly one symbolic tuple in normal form! Based on this observation it can be shown that the category FP ( Σ ) is isomorphic to the syntactic Lawvere category L ( Σ ) .

5.1.3. Substitutions Revisited

Since every equivalence class of symbolic tuples in FP ( Σ ) contains exactly one symbolic tuple in normal form, we can define a corresponding representation category FP nf ( Σ ) with morphisms all symbolic tuples in normal form.
However, symbolic composition of a symbolic tuple in normal form with an fp-expression in normal formal or a symbolic tuple in normal form does not result, in general, 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 FP nf ( Σ ) .
The rules, given by the equations (24) – (26), are not sufficient to transform any fp-expression in 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 formal and thus, due to equation (26), of 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 formal in Example 10.
We do have now a chain of isomorphisms between categories L ( Σ ) FP ( Σ ) FP nf ( Σ ) . The morphisms in L ( Σ ) are tuples of terms representing substitution declarations while composition is nothing but substitution application. The tuples of terms in L ( Σ ) are transformed into symbolic tuples in normal form in FP nf ( Σ ) while composition in FP nf ( Σ ) is given by symbolic composition plus normalization. So, in the light of substitution calculi, as discussed in Section 3.4.1, we get the following correspondence of concepts: “substitution declaration” ≅ “symbolic tuple in normal form”. Moreover, Lawvere’s original slogan “composition is substitution” turns into the slogan
substitution application ≅ symbolic composition plus normalization.
This perception may open a path to develop, once in the future, an appropriate substitution calculus for derived graph operations!?

5.2. Analysis of Finite Product Expressions

After we transformed the syntactic Lawvere category L ( Σ ) into the isomorphic categories FP ( Σ ) and FP nf ( Σ ) , we can now attack the problems, pointed at in Example 8, by analyzing in more detail finite product expressions.

5.2.1. Finite Products vs. Tensor Products

It is well-known that finite products give us also 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 + : X 2 X 1 with itself.
Preprints 73551 i030
The other way around, 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 thus each non-empty symbolic tuple e x 1 , , e x n can be equivalently described by a symbolic composition c o p y ; ( e x 1 | | e x n ) of a symbolic tuple c o p y of symbolic projections with a parallel composition ( e x 1 | | e x n ) of expressions. The picture below shows the result of this transformation for the fp-expression x 1 2 , x 2 2 ; + , x 1 2 , x 2 2 ; + , discussed in Example 10. To exemplify that we do not have always e x i = e x i , we show also the result for the variant x 1 3 , x 2 3 ; + , x 2 3 , x 3 3 ; + .
Preprints 73551 i031
In conclusion, in case of traditional operations tupling can be equivalently replaced by parallel composition plus copying. There are no problems concerning parallel composition of graph operations thus the problem with tupling can be, finally, encircled to be a problem with copying. We have to replace, eventually, 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 e x : X n X m with a symbolic tuple c o p y : X k X n of symbolic projections? We construct out of a computation diagram with n input ports and m output ports a new computation diagram with 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 c o p y : X k X n of symbolic projections encodes a map c : X n X k between ports (!). If c is not surjective, the construction adds each element in X k c ( X n ) as a “dummy input port”. In addition, each original input port x X n is soldered with all other input ports x X n with c ( x ) = c ( x ) to a single input port in X k . Relying on our conventions in Section 2 concerning the notation of maps, we will use a new type of expression [ c ] ( e x ) to denote the new operation from X k to X m defined by the newly constructed computation diagram and call it the instance of e x w.r.t. c . The left picture in Figure 6 visualizes the construction of [ 1 , 2 , 1 , 2 ] ( + | + ) .
In the case of computation units and non-injective, surjective maps c : X n X k , we could even interpret the construction of [ c ] ( e x ) as the construction of a new computation unit computing, for example, the square of a number (see the right picture in Figure 6).
In case of traditional operations, soldering of input ports has no effect on output ports since the boundaries are empty! In 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 8 as we will demonstrate in the next 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, respectively.

5.3.1. Parallel Composition

Given a graph G and a family ω i : G I i G O i , 1 i k , k 2 of graph operations with arity spans a r i = I i l i B i r i O i we can construct a new graph operation
ω : = ω 1 + + ω k : G I G O with arity a r = a r 1 + + a r k = I l B r O ,
called the parallel composition of ω 1 , , ω k , where the arity graphs are given by sums of graphs I = I 1 + + I k , B = B 1 + + B k , O = O 1 + + O k and the inclusion graph homomorphims are sums of graph homomorphisms l = l 1 + + l k , r = r 1 + + r k .
The sum I = I 1 + + I k comes along with a family κ i I : I i I , 1 i k of injections and for any b G I the uniqueness of mediating morphisms entails the equation
b = [ κ 1 I ; b , , κ k I ; b ] : I G .
Applying the given operations ω i : G I i G O i , 1 i k we obtain a family ω i ( κ i I ; b ) : O i G of graph homomorphisms satisfying the commutativity requirement for graph operations in Definition 16:
l i ; κ i I ; b = r i ; ω i ( κ i I ; b ) for all 1 i k .
We define the result of applying ω = ω 1 + + ω k to an input b G I as the unique cotuple of the single results
ω ( b ) = ( ω 1 + + ω k ) ( b ) : = [ ω 1 ( κ 1 I ; b ) , , ω k ( κ k I ; b ) ] : O G .
The algebraic laws of cotuples and sums ensure that the commutativity requirement for graph operations is satisfied:
r ; ω ( b ) = ( r 1 + + r k ) ; [ ω 1 ( κ 1 I ; b ) , , ω k ( κ k I ; b ) ] ( def . of r and ( 30 ) ) = [ r 1 ; ω 1 ( κ 1 I ; b ) , , r k ; ω k ( κ k I ; b ) ] = [ l 1 ; κ 1 I ; b , , l k ; κ k I ; b ] ( 29 ) = ( l 1 + + l k ) ; [ κ 1 I ; b , , κ k I ; b ] = l ; b ( def . of l and ( 28 ) )
Remark 17
(Parallel Composition - Index Shifting). In case that all the arity spans a r i = I i l i B i r i O i are canonical arity spans, in the sense of Remark 10, we can construct the arity a r = a r 1 + + a r k = I l B r O also as a canonical arity span.
We construct the sums of sets I V = ( I 1 ) V + + ( I k ) V and I E = ( I 1 ) E + + ( I k ) E , respectively, utilizing the technique of “index shifting” we used in SubSection 3.7.2 to define finite products in Lawvere theories. The sum B = B 1 + + B k of boundary graphs can be chosen to be a corresponding subgraph of I = I 1 + + I k . Finally, we can construct a sum O = O 1 + + O k with O V = B V ( O V B V ) and O E = B E ( O E B E ) , respectively, where both sums of sets O V B V : = ( O 1 ) V ( B 1 ) V + + ( O k ) V ( B k ) V and O E B E : = ( O 1 ) E ( B 1 ) E + + ( O k ) E ( B k ) E 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 11
(Parallel Composition). We consider a Γ c a t -algebra C = ( g r ( C ) , O P C ) given by a category C as described in Example 2. The upper part of Figure 7 is the same as the upper part of Figure 14 and shows the arity a r ( c o m p ) + a r ( c o m p ) of the parallel composition comp C + comp C of the composition operation in C with itself.
Analogously, the upper part of Figure 8 shows the arity of the parallel composition comp C + π I I of the composition operation in C with the built-in projection (identity map) π I I : G I G I , as defined in Remark 11, where I is the canonical input arity graph i v 1 i e 1 i v 2. (The notations for “graph operation expressions”, like ( comp | comp ) and ( comp | ( I , I ) ) , will be defined in Section 5.4.)

5.3.2. Instantiation

Given a graph G and a graph operation ω : G I G O with arity I l B r O , we can construct for any finite graph I and any graph homomorphism φ : I I a new graph operation
ω / φ : = : G I G O with arity a r / φ = I l B r O ,
called the instance of ω w.r.t. φ, where B : = φ ( B ) I and O is constructed as a pushout of the span B φ B B r O with B O s