1 Introduction

A key tool in the algebraic theory of data structures is their specification by operations (constructors) and equations that they ought to satisfy. Hence, the study of models of equational specifications has been of long standing interest both in mathematics and computer science. The seminal result in this field is Birkhoff’s celebrated HSP theorem [7]. It states that a class of algebras over a signature \(\varSigma \) is a variety (i.e. closed under homomorphic images, subalgebras, and products) iff it is axiomatizable by equations \(s=t\) between \(\varSigma \)-terms. Birkhoff also introduced a complete deduction system for reasoning about equations.

In algebraic approaches to the semantics of programming languages and computational effects, it is often natural to study algebras whose underlying sets are equipped with additional computationally relevant structure and whose operations preserve that structure. An important line of research thus concerns extensions of Birkhoff’s theory of equational axiomatization beyond ordinary \(\varSigma \)-algebras. On the syntactic level, this requires to enrich Birkhoff’s notion of an equation in ways that reflect the extra structure. Let us mention a few examples:

  1. (1)

    Ordered algebras (given by a poset and monotone operations) and continuous algebras (given by a complete partial order and continuous operations) were identified by the ADJ group [14] as an important tool in denotational semantics. Subsequently, Bloom [8] and Adámek, Nelson, and Reiterman [2, 3] established ordered versions of the HSP theorem along with complete deduction systems. Here, the role of equations \(s=t\) is taken over by inequations \(s\le t\).

  2. (2)

    Quantitative algebras (given by an extended metric space and nonexpansive operations) naturally arise as semantic domains in the theory of probabilistic computation. In recent work, Mardare, Panangaden, and Plotkin [18, 19] presented an HSP theorem for quantitative algebras and a complete deduction system. In the quantitative setting, equations \(s=_\varepsilon t\) are equipped with a non-negative real number \(\varepsilon \), interpreted as “s and t have distance at most \(\varepsilon \)”.

  3. (3)

    Nominal algebras (given by a nominal set and equivariant operations) are used in the theory of name binding [24] and have proven useful for characterizing logics for data languages [9, 11]. Varieties of nominal algebras were studied by Gabbay [13] and Kurz and Petrişan [16]. Here, the appropriate syntactic concept involves equations \(s=t\) with constraints on the support of their variables.

  4. (4)

    Profinite algebras (given by a profinite topological space and continuous operations) play a central role in the algebraic theory of formal languages [22]. They serve as a technical tool in the investigation of pseudovarieties (i.e. classes of finite algebras closed under homomorphic images, subalgebras, and finite products). As shown by Reiterman [25] and Eilenberg and Schützenberger [12], pseudovarieties can be axiomatized by profinite equations (formed over free profinite algebras) or, equivalently, by sequences of ordinary equations \((s_i=t_i)_{i<\omega }\), interpreted as “all but finitely many of the equations \(s_i=t_i\) hold”.

The present paper proposes a general category theoretic framework that allows to study classes of algebras with extra structure in a systematic way. Our overall goal is to isolate the domain-specific part of any theory of equational axiomatization from its generic core. Our framework is parametric in the following data:

  • a category \(\mathscr {A}\) with a factorization system \((\mathcal {E},\mathcal {M})\);

  • a full subcategory \(\mathscr {A}_0\subseteq \mathscr {A}\);

  • a class \(\varLambda \) of cardinal numbers;

  • a class \(\mathscr {X}\subseteq \mathscr {A}\) of objects.

Here, \(\mathscr {A}\) is the category of algebras under consideration (e.g. ordered algebras, quantitative algebras, nominal algebras). Varieties are formed within \(\mathscr {A}_0\), and the cardinal numbers in \(\varLambda \) determine the arities of products under which the varieties are closed. Thus, the choice \(\mathscr {A}_0 = \) finite algebras and \(\varLambda =\) finite cardinals corresponds to pseudovarieties, and \(\mathscr {A}_0= \mathscr {A}\) and \(\varLambda \) = all cardinals to varieties. The crucial ingredient of our setting is the parameter \(\mathscr {X}\), which is the class of objects over which equations are formed; thus, typically, \(\mathscr {X}\) is chosen to be some class of freely generated algebras in \(\mathscr {A}\). Equations are modeled as \(\mathcal {E}\)-quotients \(e:X\twoheadrightarrow E\) (more generally, filters of such quotients) with domain \(X\in \mathscr {X}\).

The choice of \(\mathscr {X}\) reflects the desired expressivity of equations in a given setting. Furthermore, it determines the type of quotients under which equationally axiomatizable classes are closed. More precisely, in our general framework a variety is defined to be a subclass of \(\mathscr {A}_0\) closed under \(\mathcal {E}_\mathscr {X}\)-quotients, \(\mathcal {M}\)-subobjects, and \(\varLambda \)-products, where \(\mathcal {E}_\mathscr {X}\) is a subclass of \(\mathcal {E}\) derived from \(\mathscr {X}\). Due to its parametric nature, this concept of a variety is widely applicable and turns out to specialize to many interesting cases. The main result of our paper is the

General HSP Theorem

A subclass of \(\mathscr {A}_0\) forms a variety if and only if it is axiomatizable by equations.

In addition, we introduce a generic deduction system for equations, based on two simple proof rules (see Sect. 4), and establish a

General Completeness Theorem

The generic deduction system for equations is sound and complete.

The above two theorems can be seen as the generic building blocks of the model theory of algebras with structure. They form the common core of numerous Birkhoff-type results and give rise to a systematic recipe for deriving concrete HSP and completeness theorems in settings such as (1)–(4). In fact, all that needs to be done is to translate our abstract notion of equation and equational deduction, which involves (filters of) quotients, into an appropriate syntactic concept. This is the domain-specific task to fulfill, and usually amounts to identifying an “exactness” property for the category \(\mathscr {A}\). Subsequently, one can apply our general results to obtain HSP and completeness theorems for the type of algebras under consideration. Several instances of this approach are shown in Sect. 5. Omitted proofs and details for the examples can be found in [20].

Related work. Generic approaches to universal algebra have a long tradition in category theory. They aim to replace syntactic notions like terms and equations by suitable categorical abstractions, most prominently Lawvere theories and monads [4, 17]. Our present work draws much of its inspiration from the classical paper of Banaschewski and Herrlich [6] on HSP classes in \((\mathcal {E},\mathcal {M})\)-structured categories. These authors were the first to model equations as quotients \(e:X\twoheadrightarrow E\). However, their approach does not feature the parameter \(\mathscr {X}\) and assumes that equations are formed over \(\mathcal {E}\)-projective objects X. This limits the scope of their results to categories with enough projectives, a property that typically fails in categories of algebras with structure (including continuous, quantitative or nominal algebras). The identification of the parameter \(\mathscr {X}\) and of the derived parameter \(\mathcal {E}_\mathscr {X}\) as a key concept is thus a crucial step towards a categorical view of such structures.

Equational logics on the level of abstraction of Banaschewski and Herrlich’s work were studied by Roşu [26, 27] and Adámek, Hébert, and Sousa [1]. These authors work under assumptions on the category \(\mathscr {A}\) different from our framework, e.g. they require existence of pushouts. Hence, the proof rules and completeness results in loc. cit. are not directly comparable to our approach in Sect. 4.

In the present paper, we model equations as filters of quotients rather than single quotients, which allows us to encompass several HSP theorems for finite algebras [12, 23, 25]. The first categorical generalization of such results was given by Adámek, Chen, Milius, and Urbat [10, 29] who considered algebras for a monad \(\mathbb {T}\) on an algebraic category and modeled equations as filters of finite quotients of free \(\mathbb {T}\)-algebras (equivalently, as profinite quotients of free profinite \(\mathbb {T}\)-algebras). This idea was generalized by Salamánca [28] to monads on concrete categories. However, again, this work only applies to categories with enough projectives.

2 Preliminaries

We start by recalling some notions from category theory. A factorization system \((\mathcal {E},\mathcal {M})\) in a category \(\mathscr {A}\) consists of two classes \(\mathcal {E},\mathcal {M}\) of morphisms in \(\mathscr {A}\) such that (1) both \(\mathcal {E}\) and \(\mathcal {M}\) contain all isomorphisms and are closed under composition, (2) every morphism f has a factorization \(f = m\cdot e\) with \(e\in \mathcal {E}\) and \(m\in \mathcal {M}\), and (3) the diagonal fill-in property holds: for every commutative square \(g\cdot e = m\cdot f\) with \(e\in \mathcal {E}\) and \(m\in \mathcal {M}\), there exists a unique d with \(m\cdot d = g\) and \(d\cdot e = f\). The morphisms m and e in (2) are unique up to isomorphism and are called the image and coimage of f, resp. The factorization system is proper if all morphisms in \(\mathcal {E}\) are epic and all morphisms in \(\mathcal {M}\) are monic. From now on, we will assume that \(\mathscr {A}\) is a category equipped with a proper factorization system \((\mathcal {E},\mathcal {M})\). Quotients and subobjects in \(\mathscr {A}\) are taken with respect to \(\mathcal {E}\) and \(\mathcal {M}\). That is, a quotient of an object X is represented by a morphism \(e:X \twoheadrightarrow E\) in \(\mathcal {E}\) and a subobject by a morphism \(m:M \rightarrowtail X\) in \(\mathcal {M}\). The quotients of X are ordered by \(e \le e'\) iff \(e'\) factorizes through e, i.e. there exists a morphism h with \(e' = h \cdot e\). Identifying quotients e and \(e'\) which are isomorphic (i.e. \(e\le e'\) and \(e'\le e\)), this makes the quotients of X a partially ordered class. Given a full subcategory \(\mathscr {A}_0 \subseteq \mathscr {A}\) we denote by the class of all quotients of X represented by \(\mathcal {E}\)-morphisms with codomain in \(\mathscr {A}_0\). The category \(\mathscr {A}\) is \(\mathcal {E}\)-co-wellpowered if for every object \(X\in \mathscr {A}\) there is only a set of quotients with domain X. In particular, is then a poset. Finally, an object \(X\in \mathscr {A}\) is called projective w.r.t. a morphism \(e:A\rightarrow B\) if for every \(h:X\rightarrow B\), there exists a morphism \(g:X\rightarrow A\) with \(h = e\cdot g\).

3 The Generalized Variety Theorem

In this section, we introduce our categorical notions of equation and variety, and derive the HSP theorem. Fix a category \(\mathscr {A}\) with a proper factorization system \((\mathcal {E}, \mathcal {M})\), a full subcategory \(\mathscr {A}_0 \subseteq \mathscr {A}\), a class \(\varLambda \) of cardinal numbers, and a class \(\mathscr {X}\subseteq \mathscr {A}\) of objects. An object of \(\mathscr {A}\) is called \(\mathscr {X}\)-generated if it is a quotient of some object in \(\mathscr {X}\). A key role will be played by the subclass \(\mathcal {E}_\mathscr {X}\subseteq \mathcal {E}\) defined by

$$ \mathcal {E}_\mathscr {X}= \{e\in \mathcal {E}\;:\; \text {every } X \in \mathscr {X}\text { is projective w.r.t. }e\}. $$

Note that \(\mathscr {X}\subseteq \mathscr {X}'\) implies \(\mathcal {E}_{\mathscr {X}'}\subseteq \mathcal {E}_\mathscr {X}\). The choice of \(\mathscr {X}\) is a trade-off between “having enough equations” (that is, \(\mathscr {X}\) needs to be rich enough to make equations sufficiently expressive) and “having enough projectives” (cf. (3) below).

Assumptions 3.1

Our data is required to satisfy the following properties:

  1. (1)

    \(\mathscr {A}\) has \(\varLambda \)-products, i.e. for every \(\lambda \in \varLambda \) and every family \((A_i)_{i < \lambda }\) of objects in \(\mathscr {A}\), the product \(\prod _{i< \lambda } A_i\) exists.

  2. (2)

    \(\mathscr {A}_0\) is closed under isomorphisms, \(\varLambda \)-products and \(\mathscr {X}\)-generated subobjects. The last statement means that for every subobject \(m:A \rightarrowtail B\) in \(\mathcal {M}\) where \(B\in \mathscr {A}_0\) and A is \(\mathscr {X}\)-generated, one has \(A \in \mathscr {A}_0\).

  3. (3)

    Every object of \(\mathscr {A}_0\) is an \(\mathcal {E}_\mathscr {X}\)-quotient of some object of \(\mathscr {X}\), that is, for every object \(A \in \mathscr {A}_0\) there exists some \(e:X \twoheadrightarrow A\) in \(\mathcal {E}_\mathscr {X}\) with domain \(X\in \mathscr {X}\).

Example 3.2

Throughout this section, we will use the following three running examples to illustrate our concepts. For further applications, see Sect. 5.

  1. (1)

    Classical \(\varSigma \)-algebras. The setting of Birkhoff’s seminal work [7] in general algebra is that of algebras for a signature. Recall that a (finitary) signature is a set \(\varSigma \) of operation symbols each with a prescribed finite arity, and a \(\varSigma \)-algebra is a set A equipped with operations \(\sigma :A^n \rightarrow A\) for each n-ary \(\sigma \in \varSigma \). A morphism of \(\varSigma \)-algebras (or a \(\varSigma \)-homomorphism) is a map preserving all \(\varSigma \)-operations. The forgetful functor from the category \(\mathbf {Alg(}\varSigma \mathbf {)}\) of \(\varSigma \)-algebras and \(\varSigma \)-homomorphisms to \(\mathbf {Set}\) has a left adjoint assigning to each set X the free \(\varSigma \)-algebra \(T_\varSigma X\), carried by the set of all \(\varSigma \)-terms in variables from X. To treat Birkhoff’s results in our categorical setting, we choose the following parameters:

    • \(\mathscr {A}= \mathscr {A}_0 = \mathbf {Alg(}\varSigma \mathbf {)}\);

    • \((\mathcal {E},\mathcal {M})\) = (surjective morphisms, injective morphisms);

    • \(\varLambda \) = all cardinal numbers;

    • \(\mathscr {X}\) = all free \(\varSigma \)-algebras \(T_\varSigma X\) with \(X\in \mathbf {Set}\).

    One easily verifies that \(\mathcal {E}_\mathscr {X}\) consists of all surjective morphisms, that is, \(\mathcal {E}_\mathscr {X}= \mathcal {E}\).

  2. (2)

    Finite \(\varSigma \)-algebras. Eilenberg and Schützenberger [12] considered classes of finite \(\varSigma \)-algebras, where \(\varSigma \) is assumed to be a signature with only finitely many operation symbols. In our framework, this amounts to choosing

    • \(\mathscr {A}=\mathbf {Alg(}\varSigma \mathbf {)}\) and \(\mathscr {A}_0 = \mathbf {Alg}_\mathsf {f}(\varSigma )\), the full subcategory of finite \(\varSigma \)-algebras;

    • \((\mathcal {E},\mathcal {M})\) = (surjective morphisms, injective morphisms);

    • \(\varLambda \) = all finite cardinal numbers;

    • \(\mathscr {X}\) = all free \(\varSigma \)-algebras \(T_\varSigma X\) with \(X\in \mathbf {Set}_\mathsf {f}\).

    As in (1), the class \(\mathcal {E}_\mathscr {X}\) consists of all surjective morphisms.

  3. (3)

    Quantitative \(\varSigma \)-algebras. In recent work, Mardare, Panangaden, and Plotkin [18, 19] extended Birkhoff’s theory to algebras endowed with a metric. Recall that an extended metric space is a set A with a map \(d_A:A\times A\rightarrow [0,\infty ]\) (assigning to any two points a possibly infinite distance), subject to the axioms (i) \(d_A(a,b)=0\) iff \(a=b\), (ii) \(d_A(a,b)=d_A(b,a)\), and (iii) \(d_A(a,c)\le d_A(a,b)+d_A(b,c)\) for all \(a,b,c\in A\). A map \(h:A\rightarrow B\) between extended metric spaces is nonexpansive if \(d_B(h(a),h(a'))\le d_A(a,a')\) for \(a,a'\in A\). Let \(\mathbf {Met}_\infty \) denote the category of extended metric spaces and nonexpansive maps. Fix a, not necessarily finitary, signature \(\varSigma \), that is, the arity of an operation symbol \(\sigma \in \varSigma \) is any cardinal number. A quantitative \(\varSigma \)-algebra is a \(\varSigma \)-algebra A endowed with an extended metric \(d_A\) such that all \(\varSigma \)-operations \(\sigma :A^n\rightarrow A\) are nonexpansive. Here, the product \(A^n\) is equipped with the \(\sup \)-metric \(d_{A^n}((a_i)_{i<n}, (b_i)_{i<n}) = \sup _{i<n} d_A(a_i,b_i)\). The forgetful functor from the category \(\mathbf {QAlg}(\varSigma )\) of quantitative \(\varSigma \)-algebras and nonexpansive \(\varSigma \)-homomorphisms to \(\mathbf {Met}_\infty \) has a left adjoint assigning to each space X the free quantitative \(\varSigma \)-algebra \(T_\varSigma X\). The latter is carried by the set of all \(\varSigma \)-terms (equivalently, well-founded \(\varSigma \)-trees) over X, with metric inherited from X as follows: if s and t are \(\varSigma \)-terms of the same shape, i.e. they differ only in the variables, their distance is the supremum of the distances of the variables in corresponding positions of s and t; otherwise, it is \(\infty \).

    We aim to derive the HSP theorem for quantitative algebras proved by Mardare et al. as an instance of our general results. The theorem is parametric in a regular cardinal number \(c>1\). In the following, an extended metric space is called c-clustered if it is a coproduct of spaces of size \(<c\). Note that coproducts in \(\mathbf {Met}_\infty \) are formed on the level of underlying sets. Choose the parameters

    • \(\mathscr {A}= \mathscr {A}_0 = \mathbf {QAlg}(\varSigma )\);

    • \((\mathcal {E},\mathcal {M})\) given by morphisms carried by surjections and subspaces, resp.;

    • \(\varLambda \) = all cardinal numbers;

    • \(\mathscr {X}\) = all free algebras \(T_\varSigma X\) with \(X\in \mathbf {Met}_\infty \) a c-clustered space.

    One can verify that a quotient \(e:A\twoheadrightarrow B\) belongs to \(\mathcal {E}_\mathscr {X}\) if and only if for each subset \(B_0\subseteq B\) of cardinality \(<c\) there exists a subset \(A_0\subseteq A\) such that \(e[A_0]=B_0\) and the restriction \(e:A_0\rightarrow B_0\) is isometric (that is, \(d_B(e(a),e(a')) = d_A(a,a')\) for \(a,a'\in A_0\)). Following the terminology of Mardare et al., such a quotient is called c-reflexive. Note that for \(c=2\) every quotient is c-reflexive, so \(\mathcal {E}_\mathscr {X}= \mathcal {E}\). If c is infinite, \(\mathcal {E}_\mathscr {X}\) is a proper subclass of \(\mathcal {E}\).

Definition 3.3

An equation over \(X\in \mathscr {X}\) is a class that is

  1. (1)

    \(\varLambda \)-codirected: every subset \(F\subseteq \mathscr {T}_X\) with \(|F|\in \varLambda \) has a lower bound in F;

  2. (2)

    closed under \(\mathcal {E}_\mathscr {X}\)-quotients: for every \(e:X\twoheadrightarrow E\) in \(\mathscr {T}_X\) and \(q:E\twoheadrightarrow E'\) in \(\mathcal {E}_\mathscr {X}\) with \(E'\in \mathscr {A}_0\), one has \(q\cdot e\in \mathscr {T}_X\).

An object \(A\in \mathscr {A}\) satisfies the equation \(\mathscr {T}_X\) if every morphism \(h:X\rightarrow A\) factorizes through some \(e\in \mathscr {T}_X\). In this case, we write

$$ A \models \mathscr {T}_X. $$

Remark 3.4

In many of our applications, one can simplify the above definition and replace classes of quotients by single quotients. Specifically, if \(\mathscr {A}\) is \(\mathcal {E}\)-co-wellpowered (so that every equation is a set, not a class) and \(\varLambda \) = all cardinal numbers, then every equation contains a least element \(e_X:X\twoheadrightarrow E_X\), viz. the lower bound of all elements in \(\mathscr {T}_X\). Then an object A satisfies \(\mathscr {T}_X\) iff it satisfies \(e_X\), in the sense that every morphism \(h:X\rightarrow A\) factorizes through \(e_X\). Therefore, in this case, one may equivalently define an equation to be a morphism \(e_X:X\twoheadrightarrow E_X\) with \(X\in \mathscr {X}\). This is the concept of equation investigated by Banaschewski and Herrlich [6].

Example 3.5

In our running examples, we obtain the following concepts:

  1. (1)

    Classical \(\varSigma \)-algebras. By Remark 3.4, an equation corresponds to a quotient \(e_X:T_\varSigma X\twoheadrightarrow E_X\) in \(\mathbf {Alg(}\varSigma \mathbf {)}\), where X is a set of variables.

  2. (2)

    Finite \(\varSigma \)-algebras. An equation \(\mathscr {T}_X\) over a finite set X is precisely a filter (i.e. a codirected and upwards closed subset) in the poset .

  3. (3)

    Quantitative \(\varSigma \)-algebras. By Remark 3.4, an equation can be presented as a quotient \(e_X:T_\varSigma X\twoheadrightarrow E_X\) in \(\mathbf {QAlg}(\varSigma )\), where X is a c-clustered space.

We shall demonstrate in Sect. 5 how to interpret the above abstract notions of equations, i.e. (filters of) quotients of free algebras, in terms of concrete syntax.

Definition 3.6

A variety is a full subcategory \(\mathcal {V}\subseteq \mathscr {A}_0\) closed under \(\mathcal {E}_\mathscr {X}\)-quotients, subobjects, and \(\varLambda \)-products. More precisely,

  1. (1)

    for every \(\mathcal {E}_\mathscr {X}\)-quotient \(e: A\twoheadrightarrow B\) in \(\mathscr {A}_0\) with \(A \in \mathcal {V}\) one has \(B\in \mathcal {V}\),

  2. (2)

    for every \(\mathcal {M}\)-morphism \(m: A \rightarrowtail B\) in \(\mathscr {A}_0\) with \(B \in \mathcal {V}\) one has \(A \in \mathcal {V}\), and

  3. (3)

    for every family of objects \(A_i\) (\(i<\lambda \)) in \(\mathcal {V}\) with \(\lambda \in \varLambda \) one has \(\prod _{i<\lambda } A_i \in \mathcal {V}\).

Example 3.7

In our examples, we obtain the following notions of varieties:

  1. (1)

    Classical \(\varSigma \)-algebras. A variety of \(\varSigma \)-algebras is a class of \(\varSigma \)-algebras closed under quotient algebras, subalgebras, and products. This is Birkhoff’s original concept [7].

  2. (2)

    Finite \(\varSigma \)-algebras. A pseudovariety of \(\varSigma \)-algebras is a class of finite \(\varSigma \)-algebras closed under quotient algebras, subalgebras, and finite products. This concept was studied by Eilenberg and Schützenberger [12].

  3. (3)

    Quantitative \(\varSigma \)-algebras. For any regular cardinal number \(c>1\), a c-variety of quantitative \(\varSigma \)-algebras is a class of quantitative \(\varSigma \)-algebras closed under c-reflexive quotients, subalgebras, and products. This notion of a variety was introduced by Mardare et al. [19].

Construction 3.8

Given a class \(\mathbb {E}\) of equations, put

$$ \mathcal {V}(\mathbb {E}) = \{A\in \mathscr {A}_0 : A \models \mathscr {T}_X \text { for each } \mathscr {T}_X \in \mathbb {E}\}. $$

A subclass \(\mathcal {V}\subseteq \mathscr {A}_0\) is called equationally presentable if \(\mathcal {V}=\mathcal {V}(\mathbb {E})\) for some \(\mathbb {E}\).

We aim to show that varieties coincide with the equationally presentable classes (see Theorem 3.16 below). The “easy” part of the correspondence is established by the following lemma, which is proved by a straightforward verification.

Lemma 3.9

For every class \(\mathbb {E}\) of equations, \(\mathcal {V}(\mathbb {E})\) is a variety.

As a technical tool for establishing the general HSP theorem and the corresponding sound and complete equational logic, we introduce the following concept:

Definition 3.10

An equational theory is a family of equations

with the following two properties (illustrated by the diagrams below):

  1. (1)

    Substitution invariance. For every morphism \(h:X\rightarrow Y\) with \(X,Y\in \mathscr {X}\) and every \(e_Y:Y\twoheadrightarrow E_Y\) in \(\mathscr {T}_Y\), the coimage \(e_X:X\twoheadrightarrow E_X\) of \(e_Y\cdot h\) lies in \(\mathscr {T}_X\).

  2. (2)

    \(\mathcal {E}_\mathscr {X}\)-completeness. For every \(Y\in \mathscr {X}\) and every quotient \(e:Y\twoheadrightarrow E_Y\) in \(\mathscr {T}_Y\), there exists an \(X\in \mathscr {X}\) and a quotient \(e_X:X\twoheadrightarrow E_X\) in \(\mathscr {T}_X\cap \mathcal {E}_\mathscr {X}\) with \(E_X=E_Y\).

Remark 3.11

In many settings, the slightly technical concept of an equational theory can be simplified. First, note that \(\mathcal {E}_\mathscr {X}\)-completeness is trivially satisfied whenever \(\mathcal {E}_\mathscr {X}=\mathcal {E}\). If, additionally, every equation contains a least element (e.g. in the setting of Remark 3.4), an equational theory corresponds exactly to a family of quotients \((e_X:X\twoheadrightarrow E_X)_{X\in \mathscr {X}}\) such that \(E_X\in \mathscr {A}_0\) for all \(X\in \mathscr {X}\), and for every \(h:X\rightarrow Y\) with \(X,Y\in \mathscr {X}\) the morphism \(e_Y\cdot h\) factorizes through \(e_X\).

Example 3.12

(Classical \(\varSigma \)-algebras). Recall that a congruence on a \(\varSigma \)-algebra A is an equivalence relation \(\mathord {\equiv }\subseteq A\times A\) that forms a subalgebra of \(A\times A\). It is well-known that there is an isomorphism of complete lattices

$$\begin{aligned} \text {quotient algebras of }A \quad \cong \quad \text {congruences on } A \end{aligned}$$
(3.1)

assigning to a quotient \(e:A\twoheadrightarrow B\) its kernel, given by \(a\equiv _e a'\) iff \(e(a)= e(a')\). Consequently, in the setting of Example 3.2(1), an equational theory – presented as a family of single quotients as in Remark 3.11 – corresponds precisely to a family of congruences \((\mathord {\equiv _X}\subseteq T_\varSigma X\times T_\varSigma X)_{X\in \mathbf {Set}}\) closed under substitution, that is, for every \(s,t\in T_\varSigma X\) and every morphism \(h:T_\varSigma X\rightarrow T_\varSigma Y\) in \(\mathbf {Alg(}\varSigma \mathbf {)}\),

$$ s\equiv _X t \quad \text {implies}\quad h(s)\equiv _Y h(t). $$

We saw in Lemma 3.9 that every class of equations, so in particular every equational theory \(\mathscr {T}\), yields a variety \(\mathcal {V}(\mathscr {T})\) consisting of all objects of \(\mathscr {A}_0\) that satisfy every equation in \(\mathscr {T}\). Conversely, to every variety one can associate an equational theory as follows:

Construction 3.13

Given a variety \(\mathcal {V}\), form the family of equations

where \(\mathscr {T}_X\) consists of all quotients \(e_X:X\twoheadrightarrow E_X\) with codomain \(E_X\in \mathcal {V}\).

Lemma 3.14

For every variety \(\mathcal {V}\), the family \(\mathscr {T}(\mathcal {V})\) is an equational theory.

We are ready to state the first main result of our paper, the HSP Theorem. Given two equations \(\mathscr {T}_X\) and \(\mathscr {T}_X'\) over \(X\in \mathscr {X}\), we put \(\mathscr {T}_X\le \mathscr {T}_X'\) if every quotient in \(\mathscr {T}_X'\) factorizes through some quotient in \(\mathscr {T}_X\). Theories form a poset with respect to the order \(\mathscr {T}\le \mathscr {T}'\) iff \(\mathscr {T}_X\le \mathscr {T}_X'\) for all \(X\in \mathscr {X}\). Similarly, varieties form a poset (in fact, a complete lattice) ordered by inclusion.

Theorem 3.15

(HSP Theorem). The complete lattices of equational theories and varieties are dually isomorphic. The isomorphism is given by

$$ \mathcal {V}\mapsto \mathscr {T}(\mathcal {V})\quad \text {and}\quad \mathscr {T}\mapsto \mathcal {V}(\mathscr {T}). $$

One can recast the HSP Theorem into a more familiar form, using equations in lieu of equational theories:

Theorem 3.16

(HSP Theorem, equational version). A class \(\mathcal {V}\subseteq \mathscr {A}_0\) is equationally presentable if and only if it forms a variety.

Proof

By Lemma 3.9, every equationally presentable class \(\mathcal {V}(\mathbb {E})\) is a variety. Conversely, for every variety \(\mathcal {V}\) one has \(\mathcal {V}=\mathcal {V}(\mathscr {T}(\mathcal {V}))\) by Theorem 3.15, so \(\mathcal {V}\) is presented by the equations \(\mathbb {E}= \{\mathscr {T}_X: X\in \mathscr {X}\}\) where \(\mathscr {T} = \mathscr {T}(\mathcal {V})\).    \(\square \)

4 Equational Logic

The correspondence between theories and varieties gives rise to the second main result of our paper, a generic sound and complete deduction system for reasoning about equations. The corresponding semantic concept is the following:

Definition 4.1

An equation semantically entails the equation if every \(\mathscr {A}_0\)-object satisfying \(\mathscr {T}_X\) also satisfies \(\mathscr {T}_Y'\) (that is, if \(\mathcal {V}(\mathscr {T}_X)\subseteq \mathcal {V}(\mathscr {T}_Y)\)). In this case, we write \(\mathscr {T}_X\models \mathscr {T}_Y'\).

The key to our proof system is a categorical formulation of term substitution:

Definition 4.2

Let be an equation over \(X\in \mathscr {X}\). The substitution closure of \(\mathscr {T}_X\) is the smallest theory \(\overline{\mathscr {T}}= (\overline{\mathscr {T}}_Y)_{Y\in \mathscr {X}}\) such that \(\mathscr {T}_X\le \overline{\mathscr {T}}_X\).

The substitution closure of an equation can be computed as follows:

Lemma 4.3

For every equation one has \(\overline{\mathscr {T}}= \mathscr {T}(\mathcal {V}(\mathscr {T}_X))\).

The deduction system for semantic entailment consists of two proof rules:

figure a

Given equations \(\mathscr {T}_X\) and \(\mathscr {T}_Y'\) over X and Y, respectively, we write \(\mathscr {T}_X\vdash \mathscr {T}_Y'\) if \(\mathscr {T}_Y'\) arises from \(\mathscr {T}_X\) by a finite chain of applications of the above rules.

Theorem 4.4

(Completeness Theorem). The deduction system for semantic entailment is sound and complete: for every pair of equations \(\mathscr {T}_X\) and \(\mathscr {T}_Y'\),

$$ \mathscr {T}_X\models \mathscr {T}_Y' \quad \text {iff}\quad \mathscr {T}_X \vdash \mathscr {T}_Y'. $$

5 Applications

In this section, we present some of the applications of our categorical results (see [20] for full details). Transferring the general HSP theorem of Sect. 3 into a concrete setting requires to perform the following four-step procedure:

  • Step 1. Instantiate the parameters \(\mathscr {A}\), \((\mathcal {E},\mathcal {M})\), \(\mathscr {A}_0\), \(\varLambda \) and \(\mathscr {X}\) of our categorical framework, and characterize the quotients in \(\mathcal {E}_\mathscr {X}\).

  • Step 2. Establish an exactness property for the category \(\mathscr {A}\), i.e. a correspondence between quotients \(e:A\twoheadrightarrow B\) in \(\mathscr {A}\) and suitable relations between elements of A.

  • Step 3. Infer a suitable syntactic notion of equation, and prove it to be expressively equivalent to the categorical notion of equation given by Definition 3.3.

  • Step 4. Invoke Theorem 3.15 to deduce an HSP theorem.

The details of Steps 2 and 3 are application-specific, but typically straightforward. In each case, the bulk of the usual work required for establishing the HSP theorem is moved to our general categorical results and thus comes for free.

Similarly, to obtain a complete deduction system in a concrete application, it suffices to phrase the two proof rules of our generic equational logic in syntactic terms, using the correspondence of quotients and relations from Step 2; then Theorem 4.4 gives the completeness result.

5.1 Classical \(\varSigma \)-Algebras

The classical Birkhoff theorem emerges from our general results as follows.

  • Step 1. Choose the parameters of Example 3.2(1), and recall that \(\mathcal {E}_\mathscr {X}= \mathcal {E}\).

  • Step 2. The exactness property of \(\mathbf {Alg(}\varSigma \mathbf {)}\) is given by the correspondence (3.1).

  • Step 3. Recall from Example 3.5(1) that equations can be presented as single quotients \(e:T_\varSigma X\twoheadrightarrow E_X\). The exactness property (3.1) leads to the following classical syntactic concept: a term equation over a set X of variables is a pair \((s,t)\in T_\varSigma X\times T_\varSigma X\), denoted as \(s=t\). It is satisfied by a \(\varSigma \)-algebra A if for every map \(h:X\rightarrow A\) we have \({h}^\sharp (s) = {h}^\sharp (t)\). Here, \({h}^\sharp :T_\varSigma X\rightarrow A\) denotes the unique extension of h to a \(\varSigma \)-homomorphism. Equations and term equations are expressively equivalent in the following sense:

    1. (1)

      For every equation \(e:T_\varSigma X\twoheadrightarrow E_X\), the kernel \(\mathord {\equiv _e}\subseteq T_\varSigma X\times T_\varSigma X\) is a set of term equations equivalent to e, that is, a \(\varSigma \)-algebra satisfies the equation e iff it satisfies all term equations in \(\equiv _e\). This follows immediately from (3.1).

    2. (2)

      Conversely, given a term equation \((s,t)\in T_\varSigma X\times T_\varSigma X\), form the smallest congruence \(\equiv \) on \(T_\varSigma X\) with \(s\equiv t\) (viz. the intersection of all such congruences) and let \(e:T_\varSigma X\twoheadrightarrow E_X\) be the corresponding quotient. Then a \(\varSigma \)-algebra satisfies \(s=t\) iff it satisfies e. Again, this is a consequence of (3.1).

  • Step 4. From Theorem 3.16 and Example 3.7(1), we deduce the classical

Theorem 5.1

(Birkhoff [7]). A class of \(\varSigma \)-algebras is a variety (i.e. closed under quotients, subalgebras, products) iff it is axiomatizable by term equations.

Similarly, one can obtain Birkhoff’s complete deduction system for term equations as an instance of Theorem 4.4; see [20, Section B.1] for details.

5.2 Finite \(\varSigma \)-Algebras

Next, we derive Eilenberg and Schützenberger’s equational characterization of pseudovarieties of algebras over a finite signature \(\varSigma \) using our four-step plan:

  • Step 1. Choose the parameters of Example 3.2(2), and recall that \(\mathcal {E}_\mathscr {X}=\mathcal {E}\).

  • Step 2. The exactness property of \(\mathbf {Alg(}\varSigma \mathbf {)}\) is given by (3.1).

  • Step 3. By Example 3.2(2), an equational theory is given by a family of filters (\(n<\omega \)). The corresponding syntactic concept involves sequences \((s_i=t_i)_{i<\omega }\) of term equations. We say that a finite \(\varSigma \)-algebra A eventually satisfies such a sequence if there exists \(i_0<\omega \) such that A satisfies all equations \(s_i=t_i\) with \(i\ge i_0\). Equational theories and sequences of term equations are expressively equivalent:

    1. (1)

      Let \(\mathscr {T}=(\mathscr {T}_n)_{n<\omega }\) be a theory. Since \(\varSigma \) is a finite signature, for each finite quotient \(e:T_\varSigma n\twoheadrightarrow E\) the kernel \(\equiv _e\) is a finitely generated congruence [12, Prop. 2]. Consequently, for each \(n<\omega \) the algebra \(T_\varSigma n\) has only countably many finite quotients. In particular, the codirected poset \(\mathscr {T}_n\) is countable, so it contains an \(\omega ^\mathsf {op}\)-chain \(e_0^n \ge e_1^n\ge e_2^n\ge \cdots \) that is cofinal, i.e., each \(e\in \mathscr {T}_n\) is above some \(e_i^n\). The \(e_i^n\) can be chosen in such a way that, for each \(m> n\) and \(q:m\rightarrow n\), the morphism \(e_i^n\cdot T_\varSigma q\) factorizes through \(e_i^m\). For each \(n<\omega \), choose a finite subset \(W_n\subseteq T_\varSigma n\times T_\varSigma n\) generating the kernel of \(e_n^n\). Let \((s_i=t_i)_{i<\omega }\) be a sequence of term equations where \((s_i,t_i)\) ranges over \(\bigcup _{n<\omega } W_n\). One can verify that a finite \(\varSigma \)-algebra lies in \(\mathcal {V}(\mathscr {T})\) iff it eventually satisfies \((s_i=t_i)_{i<\omega }\).

    2. (2)

      Conversely, given a sequence of term equations \((s_i=t_i)_{i<\omega }\) with \((s_i,t_i)\in T_\varSigma m_i\times T_\varSigma m_i\), form the theory \(\mathscr {T}=(\mathscr {T}_n)_{n<\omega }\) where \(\mathscr {T}_n\) consists of all finite quotients \(e:T_\varSigma n\twoheadrightarrow E\) with the following property:

      $$ \exists i_0<\omega :\forall i\ge i_0:\forall (g:T_\varSigma {m_i}\rightarrow T_\varSigma n): e\cdot g(s_i)=e\cdot g(t_i). $$

      Then a finite \(\varSigma \)-algebra eventually satisfies \((s_i=t_i)_{i<\omega }\) iff it lies in \(\mathcal {V}(\mathscr {T})\).

  • Step 4. The theory version of our HSP theorem (Theorem 3.16) now implies:

Theorem 5.2

(Eilenberg-Schützenberger [12]). A class of finite \(\varSigma \)-algebras is a pseudovariety (i.e. closed under quotients, subalgebras, and finite products) iff it is axiomatizable by a sequence of term equations.

In an alternative characterization of pseudovarieties due to Reiterman [25], where the restriction to finite signatures \(\varSigma \) can be dropped, sequences of term equations are replaced by the topological concept of a profinite equation. This result can also be derived from our general HSP theorem, see [20, Section B.4].

5.3 Quantitative Algebras

In this section, we derive an HSP theorem for quantitative algebras.

  • Step 1. Choose the parameters of Example 3.2(3). Recall that we work with fixed regular cardinal \(c>1\) and that \(\mathcal {E}_\mathscr {X}\) consists of all c-reflexive quotients.

  • Step 2. To state the exactness property of \(\mathbf {QAlg}(\varSigma )\), recall that an (extended) pseudometric on a set A is a map \(p:A\times A\rightarrow [0,\infty ]\) satisfying all axioms of an extended metric except possibly the implication \(p(a,b)=0\Rightarrow a=b\). Given a quantitative \(\varSigma \)-algebra A, a pseudometric p on A is called a congruence if (i) \(p(a,a')\le d_A(a,a')\) for all \(a,a'\in A\), and (ii) every \(\varSigma \)-operation \(\sigma :A^n\rightarrow A\) (\(\sigma \in \varSigma \)) is nonexpansive w.r.t. p. Congruences are ordered by \(p\le q\) iff \(p(a,a')\le q(a,a')\) for all \(a,a'\in A\). There is a dual isomorphism of complete lattices

    $$\begin{aligned} \text {quotient algebras of } A \quad \cong \quad \text {congruences on } A \end{aligned}$$
    (5.1)

    mapping \(e:A\twoheadrightarrow B\) to the congruence \(p_e\) on A given by \(p_e(a,b)=d_B(e(a),e(b))\).

  • Step 3. By Example 3.5(3), equations can be presented as single quotients \(e:T_\varSigma X\twoheadrightarrow E\), where X is a c-clustered space. The exactness property (5.1) suggests to replace equations by the following syntactic concept. A c-clustered equation over the set X of variables is an expression

    $$\begin{aligned} x_i=_{\varepsilon _i} y_i\;(i\in I)\; \vdash \; s=_\varepsilon t \end{aligned}$$
    (5.2)

    where (i) I is a set, (ii) \(x_i,y_i\in X\) for all \(i\in I\), (iii) s and t are \(\varSigma \)-terms over X, (iv) \(\varepsilon _i,\varepsilon \in [0,\infty ]\), and (v) the equivalence relation on X generated by the pairs \((x_i,y_i)\) (\(i\in I\)) has all equivalence classes of cardinality \(<c\). In other words, the set of variables can be partitioned into subsets of size \(<c\) such that only relations between variables in the same subset appear on the left-hand side of (5.2). A quantitative \(\varSigma \)-algebra A satisfies (5.2) if for every map \(h:X\rightarrow A\) with \(d_A(h(x_i),h(y_i))\le \varepsilon _i\) for all \(i\in I\), one has \(d_A({h}^\sharp (s),{h}^\sharp (t))\le \varepsilon \). Here \({h}^\sharp :T_\varSigma X\rightarrow A\) denotes the unique \(\varSigma \)-homomorphism extending h.

    Equations and c-clustered equations are expressively equivalent:

    1. (1)

      Let X be a c-clustered space, i.e. \(X=\coprod _{j\in J} X_j\) with \(|X_j|<c\). Every equation \(e:T_\varSigma X\twoheadrightarrow E\) induces a set of c-clustered equations over X given by

      $$\begin{aligned} x=_{\varepsilon _{x,y}} y\;(j\in J,\, x,y\in X_j) \;\vdash \; s=_{\varepsilon _{s,t}} t\quad (s,t \in T_\varSigma X), \end{aligned}$$
      (5.3)

      with \(\varepsilon _{x,y} = d_X(x,y)\) and \(\varepsilon _{s,t}=d_E(e(s),e(t))\). It is not difficult to show that e and (5.3) are equivalent: an algebra satisfies e iff it satisfies all equations (5.3).

    2. (2)

      Conversely, to every c-clustered equation (5.2) over a set X of variables, we associate an equation in two steps:

      • Let p the largest pseudometric on X with \(p(x_i,y_i)\le \varepsilon _i\) for all i (that is, the pointwise supremum of all such pseudometrics). Form the corresponding quotient \(e_p:X\twoheadrightarrow X_p\), see (5.1). It is easy to see that \(X_p\) is c-clustered.

      • Let q be the largest congruence on \(T_\varSigma (X_p)\) with \(q(T_\varSigma e_p(s), T_\varSigma e_p(t))\le \varepsilon \) (that is, the pointwise supremum of all such congruences). Form the corresponding quotient \(e_q:T_\varSigma (X_p)\twoheadrightarrow E_q\).

      A routine verification shows that (5.2) and \(e_q\) are expressively equivalent, i.e. satisfied by the same quantitative \(\varSigma \)-algebras.

  • Step 4. From Theorem 3.16 and Example 3.7(3), we deduce the following

Theorem 5.3

(Quantitative HSP Theorem). A class of quantitative \(\varSigma \)-algebras is a c-variety (i.e. closed under c-reflexive quotients, subalgebras, and products) iff it is axiomatizable by c-clustered equations.

The above theorem generalizes a recent result of Mardare, Panangaden, and Plotkin [19] who considered only signatures \(\varSigma \) with operations of finite or countably infinite arity and cardinal numbers \(c\le \aleph _1\). Theorem 5.3 holds without any restrictions on \(\varSigma \) and c. In addition to the quantitative HSP theorem, one can also derive the completeness of quantitative equational logic [18] from our general completeness theorem, see [20, Section B.5] for details.

5.4 Nominal Algebras

In this section, we derive an HSP theorem for algebras in the category \(\mathbf {Nom}\) of nominal sets and equivariant maps; see Pitts [24] for the required terminology. We denote by \(\mathbb {A}\) the countably infinite set of atoms, by \(\mathrm {Perm}(\mathbb {A})\) the group of finite permutations of \(\mathbb {A}\), and by \(\mathsf {supp}_X(x)\) the least support of an element x of a nominal set X. Recall that X is strong if, for all \(x\in X\) and \(\pi \in \mathrm {Perm}(\mathbb {A})\),

A supported set is a set X equipped with a map \(\mathsf {supp}_X:X\rightarrow \mathcal {P}_f(\mathbb {A})\). A morphism \(f:X \rightarrow Y\) of supported sets is a function with \(\mathsf {supp}_Y(f(x))\subseteq \mathsf {supp}_X(x)\) for all \(x\in X\). Every nominal set X is a supported set w.r.t. its least-support map \(\mathsf {supp}_X\). The following lemma, whose first part is a reformulation of [21, Prop. 5.10], gives a useful description of strong nominal sets in terms of supported sets.

Lemma 5.4

The forgetful functor from \(\mathbf {Nom}\) to \(\mathbf {SuppSet}\) has a left adjoint \(F:\mathbf {SuppSet}\rightarrow \mathbf {Nom}\). The nominal sets of the form FY (\(Y\in \mathbf {SuppSet}\)) are up to isomorphism exactly the strong nominal sets.

Fix a finitary signature \(\varSigma \). A nominal \(\varSigma \)-algebra is a \(\varSigma \)-algebra A carrying the structure of a nominal set such that all \(\varSigma \)-operations \(\sigma :A^n\rightarrow A\) are equivariant. The forgetful functor from the category \(\mathbf {NomAlg}(\varSigma )\) of nominal \(\varSigma \)-algebras and equivariant \(\varSigma \)-homomorphisms to \(\mathbf {Nom}\) has a left adjoint assigning to each nominal set X the free nominal \(\varSigma \)-algebra \(T_\varSigma X\), carried by the set of \(\varSigma \)-terms and with group action inherited from X. To derive a nominal HSP theorem from our general categorical results, we proceed as follows.

  • Step 1. Choose the parameters of our setting as follows:

    • \(\mathscr {A}= \mathscr {A}_0 = \mathbf {NomAlg}(\varSigma )\);

    • \((\mathcal {E},\mathcal {M})\) = (surjective morphisms, injective morphisms);

    • \(\varLambda \) = all cardinal numbers;

    • \(\mathscr {X}= \{T_\varSigma X\;:\; X \text { is a strong nominal set}\}\).

    One can show that a quotient \(e:A\twoheadrightarrow B\) belongs to \(\mathcal {E}_\mathscr {X}\) iff it is support-reflecting: for every \(b\in B\) there exists \(a\in A\) with \(e(a)=b\) and \(\mathsf {supp}_A(a)=\mathsf {supp}_B(b)\).

  • Step 2. A nominal congruence on a nominal \(\varSigma \)-algebra A is a \(\varSigma \)-algebra congruence \(\mathord {\equiv }\subseteq A\times A\) that forms an equivariant subset of \(A\times A\). In analogy to (3.1), there is an isomorphism of complete lattices

    $$\begin{aligned} \text {quotient algebras of } A \quad \cong \quad \text {nominal congruences on } A. \end{aligned}$$
    (5.4)
  • Step 3. By Remark 3.4, an equation can be presented as a single quotient \(e:T_\varSigma X\twoheadrightarrow E\), where X is a strong nominal set. Equations can be described by syntactic means as follows. A nominal \(\varSigma \)-term over a set Y of variables is an element of \(T_\varSigma (\mathrm {Perm}(\mathbb {A})\times Y)\). Every map \(h:Y\rightarrow A\) into a nominal \(\varSigma \)-algebra A extends to the \(\varSigma \)-homomorphism

    $$ \hat{h} = (T_\varSigma (\mathrm {Perm}(\mathbb {A})\times Y) \xrightarrow {T_\varSigma (\mathrm {Perm}(\mathbb {A})\times h)} T_\varSigma (\mathrm {Perm}(\mathbb {A})\times A) \xrightarrow {T_\varSigma (\mathord {-}\cdot \mathord {-})} T_\varSigma A \xrightarrow {{ id }^\sharp } A) $$

    where \({ id }^\sharp \) is the unique \(\varSigma \)-homomorphism extending the identity map \(id:A\rightarrow A\). A nominal equation over Y is an expression of the form

    $$\begin{aligned} \mathsf {supp}_Y\vdash s=t, \end{aligned}$$
    (5.5)

    where \(\mathsf {supp}_Y:Y\rightarrow \mathcal {P}_f(\mathbb {A})\) is a function and s and t are nominal \(\varSigma \)-terms over Y. A nominal \(\varSigma \)-algebra A satisfies the equation \(\mathsf {supp}_Y\vdash s=t\) if for every map \(h:Y\rightarrow A\) with \(\mathsf {supp}_A(h(y))\subseteq \mathsf {supp}_Y(y)\) for all \(y\in Y\) one has \(\hat{h}(s)=\hat{h}(t)\). Equations and nominal equations are expressively equivalent:

    1. (1)

      Given an equation \(e:T_\varSigma X\twoheadrightarrow E\) with X a strong nominal set, choose a supported set Y with \(X=FY\), and denote by \(\eta _Y:Y\rightarrow FY\) the universal map (see Lemma 5.4). Form the nominal equations over Y given by

      $$\begin{aligned} \mathsf {supp}_Y\vdash s=t \quad ( s,t\in T_\varSigma (\mathrm {Perm}(\mathbb {A})\times Y)\text { and } e\cdot T_\varSigma m(s) = e\cdot T_\varSigma m(t)) \end{aligned}$$
      (5.6)

      where m is the composite \(\mathrm {Perm}(\mathbb {A})\times Y \xrightarrow {\mathrm {Perm}(\mathbb {A})\times \eta _Y} \mathrm {Perm}(\mathbb {A})\times X \xrightarrow {\mathord {-}\cdot \mathord {-}} X\). It is not difficult to see that a nominal \(\varSigma \)-algebra satisfies e iff it satisfies (5.6).

    2. (2)

      Conversely, given a nominal equation (5.5) over the set Y, let \(X = FY\) and form the nominal congruence on \(T_\varSigma X\) generated by the pair \((T_\varSigma m(s),T_\varSigma m(t))\), with m defined as above. Let \(e:T_\varSigma X\twoheadrightarrow E\) be the corresponding quotient, see (5.4). One can show that a nominal \(\varSigma \)-algebra satisfies e iff it satisfies (5.5).

  • Step 4. We thus deduce the following result as an instance of Theorem 3.16:

Theorem 5.5

(Kurz and Petrişan [16]). A class of nominal \(\varSigma \)-algebras is a variety (i.e. closed under support-reflecting quotients, subalgebras, and products) iff it is axiomatizable by nominal equations.

For brevity and simplicity, in this section we restricted ourselves to algebras for a signature. Kurz and Petrişan proved a more general HSP theorem for algebras over an endofunctor on \(\mathbf {Nom}\) with a suitable finitary presentation. This extra generality allows to incorporate, for instance, algebras for binding signatures.

5.5 Further Applications

Let us briefly mention some additional instances of our framework, all of which are given a detailed treatment in the full arXiv paper [20].

Ordered Algebras. Bloom [8] proved an HSP theorem for \(\varSigma \)-algebras in the category of posets: a class of such algebras is closed under homomorphic images, subalgebras, and products, iff it is axiomatizable by inequations \(s\le t\) between \(\varSigma \)-terms. This result can be derived much like the unordered case in Sect. 5.1.

Continuous Algebras. A more intricate ordered version of Birkhoff’s theorem concerns continuous algebras, i.e. \(\varSigma \)-algebras with an \(\omega \)-cpo structure on their underlying set and continuous \(\varSigma \)-operations. Adámek, Nelson, and Reiterman [3] proved that a class of continuous algebras is closed under homomorphic images, subalgebras, and products, iff it axiomatizable by inequations between terms with formal suprema (e.g. \(\sigma (x)\le \vee _{i<\omega }\, c_i\)). This result again emerges as an instance of our general HSP theorem. A somewhat curious feature of this application is that the appropriate factorization system \((\mathcal {E},\mathcal {M})\) takes as \(\mathcal {E}\) the class of dense morphisms, i.e. morphisms of \(\mathcal {E}\) are not necessarily surjective. However, one has \(\mathcal {E}_\mathscr {X}\) = surjections, so homomorphic images are formed in the usual sense.

Abstract HSP Theorems. Our results subsume several existing categorical generalizations of Birkhoff’s theorem. For instance, Theorem 3.15 yields Manes’ [17] correspondence between quotient monads \(\mathbb {T}\twoheadrightarrow \mathbb {T}'\) and varieties of \(\mathbb {T}\)-algebras for any monad \(\mathbb {T}\) on \(\mathbf {Set}\). Similarly, Banaschewski and Herrlich’s [6] HSP theorem for objects in categories with enough projectives is a special case of Theorem 3.16.

6 Conclusions and Future Work

We have presented a categorical approach to the model theory of algebras with additional structure. Our framework applies to a broad range of different settings and greatly simplifies the derivation of HSP-type theorems and completeness results for equational deduction systems, as the generic part of such derivations now comes for free using our Theorems 3.15, 3.16 and 4.4. There remain a number of interesting directions and open questions for future work.

As shown in Sect. 5, the key to arrive at a syntactic notion of equation lies in identifying a correspondence between quotients and suitable relations, which we informally coined “exactness”. The similarity of these correspondences in our applications suggests that there should be a (possibly enriched) notion of exact category that covers our examples; cf. Kurz and Velebil’s [15] 2-categorical view of ordered algebras. This would allow to move more work to the generic theory.

Theorem 4.4 can be used to recover several known sound and complete equational logics, but it also applies to settings where no such logic is known, for instance, a logic of profinite equations (however, cf. recent work of Almeida and Klíma [5]). In each case, the challenge is to translate our two abstract proof rules into concrete syntax, which requires the identification of a syntactic equivalent of the two properties of an equational theory. While substitution invariance always translates into a syntactic substitution rule in a straightforward manner, \(\mathcal {E}_\mathscr {X}\)-completeness does not appear to have an obvious syntactic counterpart. In most of the cases where a concrete equational logic is known, this issue is obfuscated by the fact that one has \(\mathcal {E}_\mathscr {X}=\mathcal {E}\), so \(\mathcal {E}_\mathscr {X}\)-completeness becomes a trivial property. Finding a syntactic account of \(\mathcal {E}_\mathscr {X}\)-completeness remains an open problem. One notable case where \(\mathcal {E}_\mathscr {X}\ne \mathcal {E}\) is the one of nominal algebras. Gabbay’s work [13] does provide an HSP theorem and a sound and complete equational logic in a setting slightly different from Sect. 5.4, and it should be interesting to see whether this can be obtained as an instance of our framework.

Finally, in previous work [29] we have introduced the notion of a profinite theory (a special case of the equational theories in the present paper) and shown how the dual concept can be used to derive Eilenberg-type correspondences between varieties of languages and pseudovarieties of finite algebras. Our present results pave the way to an extension of this method to new settings, such as nominal sets. Indeed, a simple modification of the parameters in Sect. 5.4 yields a new HSP theorem for orbit-finite nominal \(\varSigma \)-algebras. We expect that a dualization of this result in the spirit of loc. cit. leads to a correspondence between varieties of data languages and varieties of orbit-finite nominal monoids, an important step towards an algebraic theory of data languages.