1.1.2. Categorical Algebra

Due to Lawvere [8], one can construct for any specification (Σ, *E*) with *E* a set of Σ-equations a category FP(Σ,*E*) with finite products such that the category of all (Σ, *E*)-algebras is equivalent to the category of all product preserving functors from FP(Σ,*E*) into Set. Analogously, one can construct for any specification (Σ, *CE*) with *CE* a set of conditional Σ-equations a category FL(Σ,*CE*) with finite limits such that the category of all (Σ, *CE*)-algebras is equivalent to the category of all finite limit preserving functors from FL(Σ,*CE*) into Set.

In [9], we generalized this result to many-sorted signatures and partial algebras. We showed how to construct for any specification (Σ, *CEE*), with Σ a many-sorted signature and *CEE* a set of conditional existence Σ-equations, a category FL(Σ,*CEE*) with finite limits such that the category of all partial (Σ, *CEE*)-algebras is equivalent to the category of all limit preserving functors from FL(Σ,*CEE*) into the functor category Set*<sup>S</sup>* with *S* the corresponding discrete category, i.e., set, of sorts declared in Σ.

The construction of those syntactic categories starts by introducing objects that correspond to declarations of finite sets of variables. After adding for each operation symbol in Σ a morphism between the appropriate objects, one continues by constructing new morphisms and an equivalence relation between morphisms. In case of finite product categories FP(Σ,*E*), no other objects are generated while in case of the finite limit categories FL(Σ,*CE*) and FL(Σ,*CEE*), resp., we have to introduce new objects (*X*, *R*) representing the set of "solutions" of the set *R* of (existential) Σ-equations on *X*, i.e., a corresponding equalizer. Triggered by this example and supported by later experiences, especially with diagrammatic specification techniques, we vote for:

> Requirement 3: Define variables prior to operation and predicate symbols and use variables to define the arities of operations and predicates.

In [9], we specified finite limit categories as partial Σ*FL*-algebras (with Σ*FL* a signature declaring two sorts Ob, Mor and operations like source, target, composition, product, equalizer, subobject, ...) satisfying a corresponding set *CEEFL* of conditional existence equations. The category FL(Σ,*CEE*) was then constructed as the freely generated partial (Σ*FL*, *CEEFL*)-algebra F(Σ*FL*, *CEEFL*, *OP* + *CEE*, *R*) with *OP* + *CEE* declaring one variable of sort Mor for each operation symbol in Σ and one variable of sort Mor for each conditional existence equation in *CEE*. *R* describes source and target of the variables in *OP* + *CEE* as well as the subobject property of the variables in *CEE*.

Thus, what we did is to reuse the formalism of partial algebras and conditional existence equations on the higher conceptual level of formalisms to coin a (meta) specification of the specification formalism "finite limits". In the process, we downgraded operations and conditional equations, playing the leading part in Section 1.1.1, to simple variables (generators). It seems quite natural to require a similar flexibility from our conceptual framework:

Objective 1: The framework should enable us to describe and to work with specification formalisms on different conceptual levels in a uniform way.

#### 1.1.3. Sketches in Category Theory

Categories are graphs equipped with identities and composition; thus, a string-based formalism like algebraic specifications, for example, may be not always the most adequate tool to describe and reason about categorical structures.

In the 1960s, Charles Ehresmann invented a graph-based specification formalism–the so-called sketches. Later sketches were promoted for applications in computer science by Barr and Wells [10] and applied to data modeling problems by Johnson and Rosebrugh [11] (see [12] for a survey).

A sketch S = (*G*, *D*, *L*, *K*) consists of a graph *G* and sets *D*, *L* and *K* of diagrams in *G*. In Category Theory, a diagram in a graph *G* of shape *I* is a graph homomorphism *δ* : *I* → *G*. A model M of a sketch S in a category C is a graph homomorphism from *G* to the underlying graph of C that takes every diagram in *D* to a commutative diagram, every diagram in *L* to a limit diagram and every diagram in *K* to a colimit diagram [10].

We use in this paper the term "diagrammatic" as a synonym for "graph-based" in a broad sense. We consider, for example, any functor (presheaf) F : C → Set with C a small category as a "graph-based" structure. Sketches give us a diagrammatic pendant to algebraic specifications at hand and are, at the same time, more expressive. Equational specifications can be equivalently described by finite product sketches, i.e., sketches where *K* is empty and *L* contains only finite product diagrams, while algebraic specification with conditional equations can be transformed into equivalent finite limit sketches with *K* empty and *L* containing only finite limit diagrams.

Analogous to Section 1.1.2, we can construct for any finite product sketch S = (*G*, *D*, *L*), for example, a corresponding finite product category freely generated by S. The methodologically important observation is that the items in the graph *G* now play the role of "variables (generators)" while the diagrams in *D* and *L* are the "defining relations".
