Scholarly article on topic 'Term Equational Systems and Logics'

Term Equational Systems and Logics Academic research paper on "Computer and information sciences"

Share paper
{"Equational systems" / "algebraic theories" / "free algebras" / "equational logic" / soundness / completeness / "Nominal Sets" / "Schanuel topos"}

Abstract of research paper on Computer and information sciences, author of scientific article — Marcelo Fiore, Chung-Kil Hur

Abstract We introduce an abstract general notion of system of equations between terms, called Term Equational System, and develop a sound logical deduction system, called Term Equational Logic, for equational reasoning. Further, we give an analysis of algebraic free constructions that together with an internal completeness result may be used to synthesise complete equational logics. Indeed, as an application, we synthesise a sound and complete nominal equational logic, called Synthetic Nominal Equational Logic, based on the category of Nominal Sets.

Academic research paper on topic "Term Equational Systems and Logics"

Available online at

W ScienceDirect

ELSEVIER Electronic Notes in Theoretical Computer Science 218 (2008) 171-192

Term Equational Systems and Logics

(Extended Abstract)

Marcelo Fiore1 Chung-Kil Hur2,3

Computer Laboratory University of Cambridge Cambridge, UK


We introduce an abstract general notion of system of equations between terms, called Term Equational System, and develop a sound logical deduction system, called Term Equational Logic, for equational reasoning. Further, we give an analysis of algebraic free constructions that together with an internal completeness result may be used to synthesise complete equational logics. Indeed, as an application, we synthesise a sound and complete nominal equational logic, called Synthetic Nominal Equational Logic, based on the category of Nominal Sets.

Keywords: Equational systems, algebraic theories, free algebras, equational logic, soundness, completeness, Nominal Sets, Schanuel topos.


Formal reasoning is fundamental in computer science, and frameworks for supporting it abound. Those that are most relevant to this work are equational logic [10] and algebraic theories [16] together with their extensions, e.g. to rewriting [18], higher-order [15,19], and nominal [8,4] settings. The common conceptual core of these frameworks consists of syntactic structure providing a notion of term together with a logical system of equational judgements. Ideally, this is further equipped with a model theory for which soundness and completeness hold. A main general aim of the paper is to formally articulate this scenario by means of a general and practical mathematical theory. Indeed, we provide a mathematical theory for the development of term equational systems and logics.

1 Email:

2 Email:

3 Research supported by a Samsung Scholarship from the Samsung Foundation of Culture.

1571-0661/$ - see front matter © 2008 Elsevier B.V. All rights reserved. doi:10.1016/j.entcs.2008.10.011

Our Term Equational System framework is given by a semantic universe together with an abstract notion of syntax on it. From it, the following are induced.

1. A notion of term in context, and therefore notions of equation and equational theory.

2. A model theory, providing a satisfaction relation between models and equational judgements.

3. A sound logical deduction system, called Term Equational Logic, for equational reasoning.

4. A construction of free algebras that, in certain important and common scenarios, provides a sound and complete system of equations that aids the development of a complete logic.

We outline the technical development of the paper introducing it here in restricted form so as to more easily convey the basic ideas and intuitions. The more general enriched universes of discourse considered in the paper (Definition 2.2) are indispensable to accommodate multi-sorted theories.

For the purpose of this introduction, thus, we consider a symmetric monoidal closed category (C, I, <8>, [—, =]) as universe of discourse and a monad T = (T, n, on it, equipped with a strength t, as notion of syntax. For C G C, the object TC G C intuitively represents terms with variables in C .A global term corresponds thus to a map I —> TC. More generally, however, as it is well-known from categorical logic (see e.g. [17]), one should consider generalised terms of the form A —> TC. For these, the pair (A, C) provides a notion of arity, with C being the co-variant arity of the term and A the contravariant arity. Intuitively, one may think of generalised terms of arity (A, C) as an A-parameterised family of terms with variables in C. A notion of generalised equation between terms of the same arity, denoted as t = t', and hence of generalised theory, is thus induced. (See Section 2.)

A natural model theory arises. As expected, models for the monad are given by Eilenberg-Moore algebras. The interpretation of a generalised term t : A —> TC in such a model (X, s : TX —> X) is a map

[t](A>) : [C, X] ® A > X ,

intuitively evaluating the A-parameterised family of terms t according to the algebra structure (X, s) with respect to assignments in X for the variables in C. Formally, the interpretation map [t](xs) is given by the composite

[C, X] ® A ) [C, X] ® TC T[C'X1'C) T([C, X] ® CTX^X.

Consequently, a model (X, s) is said to satisfy the equation t = t' : A —> TC whenever [t](X'S) = [t'](X,s) : [C,X] ® A—>X. (Again see Section 2.)

Based on the model theory, a sound equational logic, called Term Equational Logic, is introduced. The logic has the rules Ref, Sym, Trans of equivalence relations; the rule Axiom stating that the equations of a theory are derivable; the rule Subst stating that substitution is a congruence; the rule Ext stating that an operation

of context extension is a congruence; and the rule LocChar expressing the local character of entailment (see e.g. [17]). (See Section 3.)

In the presence of free models for a given generalised theory, we show an internal soundness and completeness result: A generalised equation is satisfied by all models of a generalised theory iff it is satisfied in a particular free model (see Section 4). This, in view of an explicit construction of free models (see [6,7] and Section 1), may be used to synthesise a sound and complete deduction system which, in turn, may suggest how to extend the aforementioned equational logic to make it complete, and allow the use of equational term rewriting as an alternative for establishing equational judgements.

Overall, thus, we advocate the following general methodology for developing term equational systems and logics.

1. Select a universe of discourse C and consider within it a notion of signature such that every signature £ gives rise to a strong monad T^ = (T^,T,n, on C.

We do not insist on an a priori prescription for the definition of signature, but rather consider it as being domain specific. Of course, standard notions of signature (e.g., as they arise in the context of (enriched) algebraic theories [14,20]) may be considered. However, one may also need to go beyond them—see [5].

2. Select a class of arities (A, C) and give a syntactic description of the generalised terms A —> T^C. This yields a syntactic notion of equational theory with an associated model theory arising from that of Term Equational Systems.

We are ultimately interested in the existence of free algebras for the signature £ satisfying the equations of a theory. In cocomplete universes of discourse, these may be constructed according to the theory of free constructions of [6], e.g. by considering functors T^ that preserve colimits of A-chains and equations with A-compact arities (see Definition 2.13) for some limit ordinal A.

For applications to finitary theories, however, one need only examine the case A = w; even under the further conditions that T^ preserves epimorphisms and the arities of equations are projective (see Definition 2.13). This guarantees a simple inductive construction of free algebras, well-suited to the extraction of explicit descriptions.

3. Synthesise a deduction system for equational reasoning on syntactic terms with rules arising as syntactic counterparts of the rules from the Term Equational Logic associated to the underlying Term Equational System. By construction, thus, soundness will be guaranteed.

The analysis of the rule Subst will typically involve the consideration of a syntactic substitution operation corresponding to the Kleisli composition of generalised terms.

4. In view of the internal completeness result, analyse the construction of free algebras so as to either establish the completeness of the synthesised equational logic, or get insight into how to extend it to make it complete.

This methodology in the universe of Sets with £ a finitary signature, Ts the induced term monad, and theories with equations of arity (1,C), for C a finite set of variables, leads to equational logic. In fact, the instantiation of our framework for Term Equational Systems and Logics in universes of Sorted Sets (see Examples 2.6, 2.11, and 3.2) essentially yields the framework of equational theories and logics for monads on categories of Sorted Sets of Climent and Soliveres [3].

In Section 5, as a substantial case study providing evidence for the practicality of the mathematical theory, the above methodology is applied within the universe of Nominal Sets (which is equivalent to the Schanuel topos). In this development, terms are generated from signatures of nominal sets of finitary operators together with meta-variables carrying nominal-variables; the context of meta-variables arises as the covariant arity of a term, whilst the context of nominal-variables as its con-travariant arity. The equational theories thus arising naturally specify nominal algebraic structures (as e.g. that of «^-equivalence of A-terms). For these, a sound deduction system for equational reasoning is synthesised and, furthermore, shown to be complete. Our nominal equational logic is logically equivalent to those recently introduced by Gabbay and Mathijssen [8], and Clouston and Pitts [4]. (We note that a similar development can be carried out in the universe Set\ for I the category of finite sets of names and injections between them, and that this leads to the Binding Equational Logic of Hamana [11, Section 4].)

In a subsequent paper, we will also apply the methodology in the context of second-order abstract syntax as developed in [5] to synthesise an equational logic for second-order algebraic theories.

Our mathematical theory generalises to incorporate rewriting modulo equations. However, we do not dwell on this here.

1 Equational systems and free algebras

Equational systems. We recall the notion of equational system introduced by the authors [6].

Definition 1.1 (Algebra) A E-algebra (X,s) for an endofunctor £ on a category C is given by an object X e C, called the carrier, together with a morphism s : EX —> X in C, called the structure map. Homomorphisms from a E-algebra (X, s) to another one (Y, t) are morphisms h : X —>Y such that h o s = t o Eh.

The category E-Alg has objects given by E-algebras and morphisms given by homomorphisms. The forgetful functor Us : E-Alg —> C maps E-algebras to their carrier objects.

Definition 1.2 (Functorial term) A functorial signature E on a category C is an endofunctor on it. A functorial term T in a functorial context r for the functorial signature E on C, denoted C : E > r h T, is given by an endofunctor r on C and a functor T : E-Alg —> T-Alg such that Ur o T = Us.

Definition 1.3 (Equational system) An Equational System (ES)

S =(C : £ > r h L = R)

consists of a category C together with a pair of functorial terms C : £ > r h L and C : £ > r h R, referred to as a functorial equation.

Definition 1.4 (ES algebra) For an ES S = (C : £ > r h L = R), an S-algebra (X, s) is a £-algebra satisfying the equation; that is, such that L(X, s) = R(X, s) : TX^X.

The category S-Alg is the full subcategory of £-Alg consisting of S-algebras, and the forgetful functor Us : S-Alg —> C maps S-algebras to their carrier objects.

Example 1.5 Every monad T = (T, n,^) on a category C with binary coproducts has an associated ES defined as T = (C : T > r h L = R) where TX = X + T2X and L(X, s) = [idx, s o Ts], R(X, s) = [s o nx, s o ^x]. The category T-Alg is (isomorphic to) the category of Eilenberg-Moore algebras CT.

For more examples of ESs and their categories of algebras see Sections 2 and 5.

Free algebras. We outline a basic theory for the inductive construction of free algebras, see [6,7].

Definition 1.6 An ES S = (C : £ > r h L = R) is said to be A-finitary, for A a limit ordinal, if the category C is cocomplete, and both the functors £ and r preserve colimits of A-chains. Such an ES is said to be A-inductive if furthermore both functors £ and r preserve epimorphisms.

As it is customary, we refer to the above notions in the case of the ordinal u simply as finitary and inductive.

Theorem 1.7 ([6,7]) Let S be an ES. If S is A-finitary then the forgetful functor S-Alg —> C has a left adjoint.

Consider an inductive ES S = (C : £ > r h L = R). Since the forgetful functor Us decomposes as S-Alg cjs—> £-Alg-uE->C, its left adjoint can be described in two stages as the composition of a left adjoint to Us followed by a left adjoint to

The inductive construction of a left adjoint to Us, or equivalently that of free £-algebras, is well-known (see e.g. [1,2]). The free £-algebra (TX, tx) on an object X G C and the universal map nx : X —> TX are constructed as follows. The object TX is a colimit of the u-chain { fn : Xn —> Xn+1 }n>0 inductively defined by setting X0 = 0 to be initial and Xn+1 = X + £(Xn), for all for n > 0; and letting fo = u be the unique map and fn+1 = X + £(fn), for all n > 0. Since the functor X + £(-) preserves colimits of u-chains, the object X + £(TX) is a colimit of the u-chain { fn : Xn—> Xn+1 }n>1. The map [nx, Tx] is the unique mediating map as


X + £0 -X±5U X + £(X + £0) ...... X + £(TX)

|| 3! [nx,tx(1)

X + £0-X±5UX + £(X + £0) ............TX colim

The intuition behind this construction of TX, in which £ represents a signature and X an object of variables, is that of taking the union of the sequence of objects Xn of terms of depth at most n built from the operators in £ and the variables in X.

To give a left adjoint to Js, we construct a free S-algebra (X, s) on a £-algebra (X, s) and a universal homomorphism q : (X, s)—^ (X, s) as in the diagram (2) below. The intuition behind the construction of Xi in there is that of quotienting X according to the equation L = R. For n > 1, the construction of Xn+1 from Xn is intuitively quotienting the object Xn by congruence rules. Therefore, the construction of free ES algebras formalises that of quotienting by equations and congruence rules.




More precisely, the map q0 is the coequaliser of the parallel pair L(X, s),R(X, s). The map s0 is set to be q0 0 s and the maps qi and s^ for i > 1, are inductively defined by letting Xi+i with qi and si be a pushout of si-i and E(qi_i). The carrier object XX is given as a colimit of the w-chain { qi }i>0, and the structure map s as the unique mediating map from the colimit EXT, induced by the assumption that E preserves colimits of w-chains. The universal homomorphism q : (X, s) —> (XT, s) is the component q : X —> X of the colimiting cone. Using that E preserves epi-morphisms, one can inductively show that each qi and E(qi) are epimorphisms, and thus that so is q. Furthermore, we have q : (X, L(X, s)) —> (X, L(X,s)) and q : (X, R(X, s^) —> (XX, R(xX, s)) in r-Alg, and since q coequalises L(X, s),R(X, s) it follows that rq equalises L(X, s),R(XX, s). Hence, as Tq is an epimorphism, L(X, s) = R(xX, s) and (xX, s) is an S-algebra. (Note that the overall argument does not rely on r preserving colimits of w-chains.)

Thus we see that the requirement in inductive ESs that E and r preserve epi-morphisms plays a central role in allowing the construction of free algebras by the simple inductive process in (2). Further interest in this preservation property resides in the results below.

Definition 1.8 For ESs Si = (C : E > ri h Li = Ri), i = 1,2, where C has binary coproducts, the ES §i&§2 is defined as (C : E > (ri + r2) h [Li,L2] = [^1,^2]).

Proposition 1.9 Let Si = (C : E > ri h Li = Ri), for i = 1, 2, be X-inductive

ESs. For F H Us : £-Alg C and Fz H Js, : Si-Alg <—> £-Alg, for i = 1,2, the £-algebra F2F1FX is a free (S1&S2)-algebra on X.

Corollary 1.10 For a A-inductive ESS = (C : T > r h L = R) and a monad T = (T, n, on C, the free S-algebra (TX,/tx) on the T-algebra (TX,^x) is a free (S&T)-algebra on X.

2 Term Equational Systems

We introduce a more concrete, yet abstract, notion of equational system, called Term Equational System (TES).

Enriched universes. The notion of TES (Definition 2.5) is given in the context of certain enriched universes of discourse (Definition 2.2). So as to place these within the theory of enriched categories, we need recall the following.

For a V-category C, with V monoidal closed, the notions of tensors V <g) A and powers [V, B] for V G V and A, B G C, also referred to in the literature as copowers and cotensors, respectively arise from isomorphisms

C(V ® A, B) = V[V, C(A, B)] = C(A, [V, B]) in V

for which the former is V-natural in B and the latter V-natural in A, where V[—, =] denotes the internal hom-functor of V (see [13] for details). Further, in the important and quite common case in which V is symmetric monoidal closed, a V-category C with tensors and powers can be equivalently presented as an ordinary category C0 equipped with a V-action (—) ® (=) : V x C0 —> C0 such that the functors (—) <g) C : V —> C0 and V <g) (—) : C0 —> C0 have right adjoints for all C G C0 and V G V (see [12] for details).

Remark 2.1 For clarity, and as a notational convention, we will henceforth highlight V-enriched structures by underlining them. Corresponding structures that are not underlined will denote ordinary categorical notions. Thus, for instance, for a V-category C, its underlying ordinary category is denoted C.

Definition 2.2 (Enriched universe) An enriched universe (V,C) is given by asymmetric monoidal closed category V and a V-category C with tensors and powers.

As a basic example of enriched universe, note that every symmetric monoidal closed category V gives rise to the enriched universe (V, V). Another class of examples is obtained from a family of enriched universes { (V, CJ }iei for a small set I when V has /-indexed products; as (V, niei Ci) is an enriched universe. (This construction is needed for specifying /-sorted TESs.)

Term Equational Systems. A Term Equational System (TES) consists of a theory of equations between terms.

Definition 2.3 (Generalised term) For an endofunctor T on a category C and objects A, C G C, a generalised term of type T with arity (A, C) is a morphism A ->• TC in C.

Definition 2.4 (Generalised theory) A pair of generalised terms t = t' : A —> TC is called a generalised equation. A generalised theory of type T is a set of generalised equations consisting of generalised terms of type T.

Definition 2.5 (Term Equational System) A Term Equational System (TES) S = (V,C,T, A) is given by an enriched universe (V,C), a V-monad T = (T,n,^) on C, and a generalised theory A of type T in C.

Example 2.6 As a basic example, we show how multi-sorted equational theories [10,3] arise as TESs.

Recall that an S-sorted signature E, for S a set of sorts, is specified by a family of sets of operators { E(ct, s) }o-es*,ses, where the elements of E(si... sn, s) stand for operators of arity si,..., sn —> s. Recall further that an S-sorted equational theory on such a signature is given by a set of tuples (r h t = t' : s) for r a context of S-sorted variables and t, t' terms of sort s built from the operators in E and variables in r.

Every S-sorted signature E induces the signature endofunctor Fs on Sets given as follows:

(FeX)(s) =* E(a, s) x nieW X(X e Sets, s G S) .

The forgetful functor Fs-Alg —> Sets is monadic, and the induced monad Ts on Sets abstractly embodies the notions of terms, variables, and substitution for the signature E.

Moreover, multi-sorted equational theories on an S-sorted signature E are in bijective correspondence with TESs (Set, Sets,Ts, A) for which the equations in A have arity (As, Cr), for s an S-sort and r an S-sorted context, where As(t) = { () | s = t} and Cp(t) = { x | (x : t) G r }.

The V-monad T = (T,n,^) of a TES is typically given, and henceforth considered, in the equivalent form of a strong monad (T, t, n, on C with strength

tv,c : V <8> TC ^ T(V ® C) : V x C ->• C.

Strong monads for TESs commonly arise as free monads on strong endofunctors as in the proposition below.

Proposition 2.7 For V symmetric monoidal closed, let C be a V-category with tensors and powers. Further, for an endofunctor F on C with strength tv,c : V <g) FC F(V <g) C), assume that the forgetful functor F-Alg —> C has a left adjoint and let T = (T, n, be the induced monad on C.

Then, T becomes a strong monad, with the components of the strength t given by the unique maps such that

V <8> FTC TV,TC > F(V ® TC) Ftv,c ) FT(V ® C)

V <8> TC

3! t v,c

nv «C

V <8) C

where (TX, ) is a free F-algebra on X


>T(V ® C)

Model theory. The model theory of TESs is developed.

Let S = (V, C, T, A) be a TES. Every generalised term t : A —> TC in C induces a functorial term |t] : T-Alg —> (C(C, —) <g) A)0-Alg over C, mapping s : TX —»X to the composite

C(C,X) ® A

C (C,X)®i

(C,X) <8> TC

tc (c,x),c

>T(C(C,X) ® C) TX^X ^C (TC, TX) C (A, X).

which is the transpose of C(C, X) -

The functorial interpretation of terms induces a model-theoretic notion of equality between generalised terms for algebras. We formalise it by introducing a satisfaction relation: for a T-algebra (X, s),

(X, s) |= u = v : A TC iff |u] (X, s) = [v](X, s) : C(C, X) ® A X .

More generally, for a set of T-algebras A, we set A == u = v iff (X, s) == u = v for all (X, s) G A.

It is an important fact that the algebras satisfying an equation are closed under powers. Indeed, every algebra structure s : TX —> X induces an algebra structure sv on [V, X] given by the transpose of the composite

V ® T[V, X] TV'[V'X1) T(V ® [V, X]) TX—^X and we have the following result.

Lemma 2.8 For (X, s) a T-algebra, (X, s) == u = v iff ([V,X],sv) == u = v for all V G V.

Definition 2.9 (TES algebra) An S-algebra for a TES S = (V, C, T, A) is an Eilenberg-Moore algebra (X, s) for the monad T satisfying the equations in A; that is, such that (X, s) == u = v for all (u = v) G A.

The category S-Alg is the full subcategory of the category of Eilenberg-Moore algebras CT consisting of the S-algebras. We thus have the following situation

>T -Alg

The following remark indicates why, in general, a single equation is not sufficient for the specification of categories of TES algebras.

Proposition 2.10 Assume that C has I-indexed coproducts for a small set I. For (X, s) a T-algebra, if (X, s) |= ti = ti : Ai —> TQ for all i G I then (X, s) |= t = t' for

LU/ A,


T( UieZ Ci)

On the other hand, the converse need not hold.

Example 2.11 Let S(e,a) be the TES associated to an equational theory A on an S-sorted signature £ as in Example 2.6.

The functorial term induced by a map As —> Ts(Cp) in Sets, or equivalently a term t of sort s in context r, maps a T^-algebra (X, s), or equivalently an F^-algebra (X, s*), to a map

h t : s](XiS*) : SetS(Cr,X) ® As —>■ X in SetS

where, for S G Set and P G SetS, the tensor S <8> P G SetS is given pointwise by setting (S <g) P)(t) = S x P(t) for all t G S. Thus, to give (3) is equivalent to give a single function

[r h t : s](xiS.) : ntes Set(Cr(t),X(t)) X(s) . The explicit description of this function is given by the following inductive definition.

• For (x : s) G r,

[r h x : s] (X,s*) (P) = Ps(x) .

• For f : si,...,sn—> s in £,

[r h f (ti,...,tn) : s](x,a*)(p) = s*([r h ti : si](X>s»)(p),..., [r h t„ : sj^*) (p)) where s* denotes the f-component of the structure map s*. It follows that S(s,A)-Alg is (isomorphic to) the category of (£, A)-algebras.

Remark 2.12 We note that the model theory of TESs can be easily recast in the framework of ESs. Indeed, for C with small coproducts, every TES S = (V, C, T, A) induces an ES S = (C : T > h L = R such that (S &T)-Alg = S-Alg, where

rA(X) = U(t= t':A^TC)eA C(C,X) ® A L(X,s) = [ [t] (X, s) ](t ^ t,)eA , R(X, s) = [ [t'] (X, s) ](t ^ ^

Furthermore, when the strong monad T arises as the free monad on a strong endofunctor F (as in Proposition 2.7), the TES S induces a simpler ES S with S-Alg = S-Alg. Indeed, S = (C : F > h L = R, where

L(X, s*) = [ [t] (X, s) ](t^ e)eA , R(X, s*) = [ [t'](X, s) ](t ^t,)eA for (X, s) the T-algebra corresponding to the F-algebra (X, s*).

Definition 2.13 Let (V, C) be an enriched universe. A pair of objects (A, C) in C is respectively said to be A-compact, for A a limit ordinal, and projective if the endofunctor (C(C, —) <g) A)0 on C respectively preserves colimits of A-chains and epimorphisms.

Proposition 2.14 Let S = (V, C, T, A) be a TES. If the category C is cocomplete, the endofunctor T on C preserves colimits of A-chains (and epimorphisms), and every arity of an equation in A is A-compact (and projective), then the ES S &T is A-finitary (A-inductive).

Thus, the theory of Section 1 may be applied to TESs. 3 Term Equational Logic

We introduce a sound deduction system for reasoning about equality between generalised terms in the context of TESs.

For a TES S = (V, C, T, A), we consider equality judgements of the form

Ah u = v : A —!>TC

where u, v are generalised terms of arity (A, C) in C. The associated Term Equational Logic (TEL) consists of the following rules.

• Equality rules.

Ref —;--Ah u = v t Ah u = v Ah v = w

Ref A h u = u Sym Ah u = v Trans-A h u = w-


(u = v) G A

Ah u = v Congruence of substitution.

Ah u1 = v1 : A —► TB Ah u2 = v2 : B ->• TC

Subst ■

Ah u1[u2] = v1[v2] : A —>TC

where w1 [w2] denotes the Kleisli composite A-^rTB^^T(TC)-^^tTC . Congruence of tensor extension.

E ._Ah u = v : A —> TC_(v G v )

A h {V)u = : y (g. A ->■ T(y <g. C) 1 ;

where (V)w denotes the composite V <g> A V ® TC-^^r T(V ® C). Local character.

Ah u o ei = v o ei : Ai —> TC (i G I) , .

LocChar-A\-u = v A->TC-"6i 'ieJ Jointly ePV

Remark 3.1 One can also consider the following theory-dependent rule: A h T(e) o u = T(e) o v : A TD

Ah u = v : A —>TC

(e : C —> D S-extendable)

where e : C D in C is S-extendable iff C(e, X) : C(D, X) C(C, X) in V is an epimorphism for all S-algebra carriers X.

However, we know of no concrete example where this rule is of real significance.

Example 3.2 The TEL associated to the TES of a multi-sorted equational theory (see Example 2.6) conservatively extends its multi-sorted equational logic [10]. Note for instance that the usual congruence rule for substitution is derivable from the TEL rules Subst and LocChar. Details are left to the interested reader (see also [3]).

The soundness of TEL is the following result.

Theorem 3.3 (External soundness) For a TES S = (V, C, T, A),

Ah u = v implies S-Alg j= u = v .

Interestingly, the soundness of the congruence rule for tensor extension essentially amounts to Lemma 2.8.

4 Internal completeness

One cannot expect to obtain an external completeness result at the level of generality of the previous section. However, in the presence of free constructions, an internal completeness result does hold. Its importance in relationship to external completeness is illustrated in the application of the following section.

Let S = (V, C, T, A) be a TESJor which the forgetful functor S-Alg_—> C has a left adjoint C S-Alg : X h-> (TX, ax : TTX TX), and let T = (T, n, At) be the associated monad on C. Then, the embedding S-Alg c—> CT induces a strict monad morphism q : T T, with each component qx : TX —> TX given by the unique homomorphism (TX,ax ) —(TTX, ax) extending rjx : X—>TX along nx : X —I TX.

Lemma 4.1 The monad T has a strength r induced from t, with components ry,x given by the unique map such that

V ® TTX"

V ® TX"

~ T (tvx ) ~

T(V ® TX) — > TTh( V ® X)

3! tV>X

°V 0X

T(V ® X)

V ®)7X

V ® X

and making q : T T a map of strengths in the sense that

V ® TX V^qX ) V ® TX

T (V ® X TT(V ® X)

The equivalence of the first two statements below is a form of strong completeness; it states that an equation is satisfied by all models iff it is satisfied in a freely generated, hence somewhat syntactic, one.

Theorem 4.2 (Internal soundness and completeness) For a TES S such that the forgetful functor S-Alg —> C has a left adjoint, the following are equivalent:

(i) S-Alg |= u = v : A TC

(ii) (TC, ctc) |= u = v : A TC

(iii) qc o u = qc o v : A —> TC

Proof. (i) (ii) Vacuously.

(ii) (iii) Because, for u : A TC in C and hc : I C(C, TC) in V the transpose of I ® C = C nc > TC in C, we have that

A ^ I ® A "c ) C(C, TTC) ® A

M(tc,vc )

(iii) (i) Because, for all (X, s) £ S-Alg, we have

C(C, X) ® TC C(C'X)^qc > C(C, X) ® TC

TC (C,X),C

T (C(C, X) ® C)

qC (C,X)®C


-^t(x (c, x ) ® c )

where s' denotes the unique homomorphism (TX, ax) —> (X, s) extending idx along

hx : X ->• TX. □

Importantly for applications, we remark that when a TES is represented by an inductive ES, the strong-monad morphism q : T T has an inductive description. For instance, for a TES S = (V, C, T, A) with C cocomplete, T arising as a free monad on a strong endofunctor F that preserves colimits of w-chains and epimorphisms, and A with equations of compact and projective arity, the ES § (see Remark 2.12) is inductive and the quotient map qx : TX—»TX is inductively constructed as follows:

»F (TX)

^TX colin

where (TX, ax) and (TX, ax) are the F-algebras respectively corresponding to the T-algebras (TX,ax) and (TX, ax), and where q0 is the universal map that coequalises every pair |u](TX,Ax) and [v](TX, ax) with (u = v) £ A.

5 Synthetic Nominal Equational Logic

We recall the basic structure of the category Nom of Nominal Sets [9, Section 6] (which is equivalent to the Schanuel topos [17, Section III.9]) and present it as an enriched universe.

On Nom we consider a class of TESs which we call NESs (Nominal Equational Systems). A syntactic notion of nominal theory arises, and its model theory is derived from that of NESs. An equational logic, called SNEL (Synthetic Nominal Equational Logic), for nominal theories is synthesised from the TEL associated to NESs. The logic SNEL is sound by construction, and we establish its completeness by means of the internal completeness result through an analysis of the inductive construction of free algebras.

Gabbay and Mathijssen [8], on the one hand, and Clouston and Pitts [4], on the other, have recently introduced sound and complete equational deduction systems for nominal algebraic structures. These logics are logically equivalent to our SNEL. However, our novel top-down development—from general mathematical theory to concrete application—leads to new syntax and proof of completeness.

Nominal sets. For a fixed countably infinite set A of atoms, the group So (A) of finite permutations of atoms consists of the bijections on A that fix all but finitely many elements of A. A 60(A)-action X = (| X | , ■) consists of a set | X | equipped with an action (—) ■ (=) : S0(A) x | X | —> | X | satisfying idA ■ x = x and n' ■ (n ■ x) = (n'n) ■ x for all x £ | X | and n,n' £ S0(A). S0(A)-actions form a category with morphisms X —>Y given by equivariant functions; that is, functions f : | X | | Y | such that f (n ■ x) = n ■ (fx) for all n £ 60(A) and x £ | X |.

For a 60(A)-action X, a finite subset S of A is said to support x £ X if for all atoms a, a' £ S, we have that (a a') ■ x = x, where the transposition (a a') is

the bijection that swaps a and a', and fixes all other atoms. A nominal set is a So (A)-action in which every element has finite support. As an example, the set of atoms A becomes the nominal set of atoms A when equipped with the evaluation action n ■ a = n(a). The category Nom is the full subcategory of the category of S0 (A)-actions consisting of nominal sets.

The supports of an element of a nominal set are closed under intersection, and we write suppx(x), or simply supp(x), for the intersection of the supports of x in the nominal set X. For elements x and y of two, possibly distinct, nominal sets X and Y, we write x # y whenever suppx(x) and suppy(y) are disjoint. Thus, for a £ A and x £ X, a # x stands for a £ suppx(x); that is, a is fresh for x.

The category Nom is complete and cocomplete. In particular, for a family of nominal sets { Xi }ie/, the coproduct ie/ Xi is given by | Uiej Xi | = Uiei I Xi | with action n ■ ii(x) = ii (n ■ x); whilst the product nie/ Xi, for finite I, is given by | nie/ Xi | = nie/ I Xi | with action n ■ (xi)ie/ = (n ■ xi)ie/. Further, Nom carries a symmetric monoidal structure (I, #). The unit I is the singleton set consisting of the empty tuple equipped with the unique action. The separating tensor X # Y is the nominal subset of X x Y with underlying set given by { (x,y) £ |X |x|Y | | x # y }. As usual, we write X#n for X # ... # X (n times). For instance, A#n consists of n-tuples of distinct atoms equipped with the pointwise action. Note that X#0 is I.

Henceforth, we write an, or simply a when n is clear from the context, as a shorthand for a tuple ai,...,an of distinct atoms. A multi transposition (an bn) denotes a fixed bijection on A satisfying (an bn)(ai) = bi, for i = 1,...,n, and (an bn)(c) = c for c £ {an} U {bn}.

The separating tensor # is closed and the corresponding internal-hom functor is denoted [—, =]. In particular, the functor [A#n, —] provides a notion of atom multi abstraction. For a nominal set X, the nominal set [A#n,X] has underlying set given by the quotient set |A#n x X|/~ determined by the a-equivalence relation « defined as (a,x) « (b,x') iff there exists a fresh c £ A#n (i.e., a tuple satisfying c # a,x, b,x') such that (a c) ■ x = (b c) ■ x'. We write (a) x for the equivalence class [(a,x)]~. Note that supp((an) x) is supp(x)\{an}.

Thus, the structure ((Nom, I, #),Nom) is an enriched universe.

We now urge the reader to read the remaining of the section in the context of the methodology for developing term equational systems and logics presented in the Introduction.

Nominal Equational Systems. A nominal signature £ is given by a family of nominal sets { £(n) }neN, each of which consists of operators of arity n. To each such signature, we associate the endofunctor on Nom defined by F^(X) = UneN £(n) x Xn with strength tx,y : FE(X)# Y ->■ FE(X # Y) for X, Y £ Nom given by

TX,y (ln(o,xi,...,xn),y) = In (o, (xi,y),..., (xn,y)) for n £ N, o £ £(n),x1,...,xn £ X, y £ Y.

Nominal Equational Systems (NESs) are of the form (Nom, Nom, Ts, A) where Te is the free monad on Fe (with strength defined as in Proposition 2.7) and where every term in A has an arity of the form (A#n, ^A#ni) for n,^, ni,...,n £ N. It follows that NESs satisfy all the conditions in Proposition 2.14 and hence induce inductive ESs.

Nominal syntax. We proceed to analyse the syntactic structure underlying NESs. To this end, first note that, since the functor Fe preserves colimits of w-chains and the category Nom is cocomplete, the free monad Te on Fe is constructed as in (1). Thus, we have the following inductive definition of TeX:

t £ TeX ::= x (x £ X)

| o ti ...tfc (o £ E(fc),ti,..,tfc £ TEX)

with action given by n ■ x = n -x x and n ■ (o t1 ... t^) = (n ■ o) (n ■ t1)... (n ■ tk).

More generally, we need to consider generalised terms A# n —> Ui=i A# ni. From the bijections

{t : A# TE(U-=1 A# n) }

= {t : [A#n,TE(U-=1 A#n)] } = {t £ [A#n,TE (U-=1 A#n)] | supp(t) = 0} = {(a) t £ [A# n ,Te ( 0^=1 A# n)] | supp(t) C {a}} it follows that every such generalised term can be described by pairs

(a,t) £ A#n x Te(0-=1 A#n) with supp(t) C {a } (5)

via the abstraction quotient map A#n x Te(0^=1 A#n) —» [A#n,TE(0f=1 A#n)] and the above bijections.

We thus obtain a representation of generalised terms of arity (A#n, ¿=1 A#ni) as syntactic open terms built up from I variables respectively of valence n1,...,n^ in the context of n atoms. It is therefore convenient to introduce a syntactic notion of context that reflects this structure. To this end, fix a countably infinite set V of variables and define a context [a]V as consisting of an atom context given by a tuple of distinct atoms a and a variable context given by a valence function V from a finite subset |V| C V of variables to N. Every context [a]V determines the arity (A#|a|,y) with y = 0xe|V| A#V(x).

The open terms t in context [a]V, for which we use the notation [a]V h t, corresponding to the descriptions (5) are thus given by the following rules:

[a]V h x(b) (x(b) £ V and {b} C {a})

[a]V h ti (1 < i < k) ( , N r

[ ][ ]Vh o(t ~ ~ ) o £ £(k) and supp(o) C {a} I a IV h o ti

where we write x(b) for the element ix(b) of h and, when convenient, further abbreviate x() as x. The generalised term of arity (A#I al,Vh) associated to the open term [a]V h t is denoted T([a]V h t). Hence, T([a]V h t)(b) = (a b) ■ t.

Nominal theories. A nominal theory consists of a nominal signature and a set of equations of the form [a]V h t = t' where [a]V h t and [a]V h t' are open terms. We give the canonical example.

Example 5.1 (cf. [8,4]) The nominal signature £a for the untyped A-calculus is given by the nominal sets of operators £a(0) = {Va | a £ A}, £a(1) = {La | a £ A}, £a(2) = {A} with action n ■ Va = V^(a), n ■ La = Ln(a), n ■ A = A. The nominal theory Sa for a^h-equivalence of untyped A-terms consists of the following equations:

(a) [a, 6]{ x : 1 } h La x(a) = Lb x(6)

(&) [a]{ x : 0,y : 1 }h A (La x) y(a) = x

(0V) [a]{ x : 1 } h A (La Va) x(a) = x(a)

(fo) [a, 6] { x : 2,y : 1 } h A (La (Lb x(a, 6))) y(a) = Lb (A (La x(a, 6)) y(a)) [a]{x : 1,y : 1,z : 1 }

h A (La (A x(a) y(a))) z(a) = A (A (La x(a)) z(a)) (A (La y(a)) z(a)) (&) [a, 6] { x : 1 } h A (La x(a)) Vb = x(6) (h) [a]{ x : 0 }h La (A x Va) = x

where a variable context V with | V | = { x1 ,...,x^ } and V (xi) = ni (i = 1,...,^) is denoted { x1 : n1,...,x^ : n }.

Model theory. Every nominal theory S = (£, A) induces the NES h = (Nom,Nom, Ts, A), with

A = { T([a]V h t) = T([a] V h t') | ([a]V h t = t') £ A } ,

that provides its model theory. This we now spell out in elementary terms. Every open term [a]V h t has an interpretation as a functorial term

[[a]V h t] : F^-Alg —> FMv-Alg ,

where F[a]V(X) = A#I a| # nye |V |[A#V(y),X], given as follows. For (X,£) £ FE-Alg and (b, ((cy) Sy| v | ) £ F[a]vX,

[[a]V h x(c)](x,?) (b ((cy) sy= (cx (a b) ■ c) ■ sx [[a]V h o t1... tfe](x>?) (b, ((cy) sy)y) = &(o',t1,...,tk) where : £(k) x Xk —> X is the k-component of the structure map £ and where o' = (a b) ■ o , ti = [[a]V h tj^b, ((cy) sy)y) .

[a]V h

[a]V h t = t' [a]V h t' = t'

— (b # t,t')

[a]V h t = t'

[a, b]Vh t[x(cx)^ x(cx, b)]xe|V| = t'[x(cx) ^ x(cœ, &)]xe|V| where |V<b>| = |V| with Vxe|V| V<b>(x) = V(x) + |b|

[a]U h t = t' { [bxU(x)]V h sx = sX W|

Fig. 1. Rules of SNEL.

Then, for an FE-algebra (X, £) and a judgement [a]V h t = t' the satisfaction relation (X, £) = ([a]V h t = t') holds whenever

An S-algebra is an F^-algebra satisfying the equations in A. The category S-Alg is the full subcategory of F^-Alg consisting of S-algebras.

Example 5.2 For the nominal theory of Example 5.1, an Sx-algebra has a carrier X e Nom with structure maps [V1 : A X, [L] : A x X X, [A] : X x X X satisfying the equations of the theory. For instance, according to the equation (a) we have that

The initial S^-algebra given by the construction (4) on the initial term algebra Tea 0 has as carrier the nominal set of «^-equivalence classes of A-terms with the appropriate action.

Synthetic Nominal Equational Logic. We now introduce SNEL (Synthetic Nominal Equational Logic) for equational reasoning with nominal theories S = (£, A) according to the above model theory. The logic deals with judgements [a]V h t = t' for open terms [a]V h t and [a]V h t', and is described in Figure 1. The operation of substitution used therein maps open terms

[[a] V h tJ(X>Ç) = |[a]V h t'l(X>Ç) : F[a]yX ^ X .

[LJ(a, (ca) ■ x) = [LJ(b, (c b) ■ x) for all (a, b, (c) x) G A # A #[A,X]

and according to the equation (n) we have that

[LJ(a, [AJ(x, [VJa)) = x for all (a,x) G A#X .

M. Fiore, C.-K. Hur /Electronic Notes in Theoretical Computer Science 218 (2008) 171-192 189

[a]U h t , { [byU(y), c]V h sy }ye|U| with a # c to the open term

[a, c]V h t[y(by)

^ sy]ye|U|

defined as follows:

(x(b)) [y(by ) ^ sy]ye|U| = (bx b) ■ sx

(o t1 ...tfe )[y(by ^ sy ]ye|u | = o (t1 [y(by W sy ]ye|U |) ...(tk [y(by W sy]ye|U |).

Note that the definition of substitution models that of parameterised Kleisli composition, in that

T([a, c]V h t[y(by)» sy]y,|u|) = T([a]U h t)<c) [[T([byU(y), c]V h sy)]y€|u|] where T ([a]U h t)<c) is the composite

i I, T([a]Uht)#Alcl ~ | | tuaic| ~ | | ,—r,,

A|a|#A|c|-—-—->Te(U)#A|c|-!-► TE(U #A|c|) = TE(EU)) .

The logic SNEL is sound because it has actually been induced from the TEL for the NES S. Indeed, if the judgement [a]V h t = t' is derivable in SNEL then the judgement A h T([a]V h t) = T([a]V h t') is derivable in TEL. More precisely, the rule Elim arises from the TEL rule LocChar with respect to the epimorphic projection map A#(|a| + |b) A#| a|; the rule Intro arises from the TEL rule Ext extended with A#|b|; and the rule Subst arises from the TEL rule Subst together with the rule LocChar with respect to the jointly epi family of maps {: A# U(x) —> U }xe|u|.

Remark 5.3 Since the category of sets embeds in that of nominal sets, every classical equational theory is a nominal theory and for them SNEL restricted to contexts with empty atom context and variables of valence zero reduces to classical equa-tional logic.

Completeness. Consider a nominal theory S = (£, A). Since, for the associated NES § = (Nom,Nom,TE, A), the monad TE is free on the endofunctor FE and

the induced ES § (see Remark 2.12) is inductive, the free S-algebra monad T§ exists and the quotient monad morphism qx : TEX TgX is constructed as in (4).

By the internal completeness result, we have that the satisfaction relation S-Alg == ([a]V h t = t') is equivalent to qe o T([a]V h t) = qe o T([a]V h t') : A#|a| —> Ts(V§). Moreover, by the equivariance of T([a]V h t) and T([a]V h t'), this is further equivalent to q^ (t) = q^ (t') in Tg("§).

The construction of the nominal set Tg§ and the map q^ as in (4) is as follows:

Ref"- Sym" t —" t T „ t —" t t —" t"

Ref t —" t Sym t/ —» t Trans"-jt—^-


([a"]U h t = f) G A

((a" b") ■ t) {(cx) —1 ((an b") ■ ^ {(cx) Sx}x where b" # (cx) Sx G [A#U(x),TE/ for all x G |U|

ti —"-1 t' (1 < i < k) , , Congn oti...tki —U.rt. <n>2oGE(k»

t —n-1 t/ / \

Inc" tt——w / (n > 2)

Fig. 2. Rules for .

FETEy ^^ Fe Y1 Fe Y2-»----» Fe (Ts/)

Yo = TeV/-—» Y1-qi—» Y2-»----» TSV/ colim

Since the forgetful functor | — | : Nom —> Set creates colimits, we have the following explicit description of the above construction.

The nominal set Yn (n > 1 ) has underlying set |Yn| = |TeV/with action n ■ [tj~n = [n ■ tj~n for —" the equivalence relation given by the rules in Figure 2. The instantiation operation used in Axiom1 is given by:

(y(c)) {(Cx) Sx}x = (Cy c) ■ Sy ,

(o t1 ... tfc) {(Cx) Sx}x = o (t1{(Cx) Sx}x) . .. (tfc{(c x) sx}x) .

The map q0 sends t to [t]~i, and the map qn (n > 1) sends [t]~n to [t]~n+i.

The nominal set T§y, being the colimit of the w-chain (Y")n>o, is given by |Tsy| = |Te"Kwith action n ■ [t]^ = [n ■ t]^ where —w is the equivalence relation generated by the relation — of Figure 3.

Since the map q^e : TeV^—> T§y sends t to [t]^, we have that the satisfaction relation S-Alg = ([a]V h t = t/) holds iff t —w t/. Furthermore, since for ([a"]U h t = f) G A and b" # (cx) Sx G [A#U(x),TeV/] for all x G |U|, the judgement

[d] V h ((a" b") ■ t) {(cx) Sx}x = ((a" b") ■ t/) {(cx) Sx}x

with { d } D b" uUx supp(sx) \{cx} is derivable in SNEL, it follows that, for all [a]V h t and [a]V h t/, if t —w t/ in TeVZ then [a]V h t = t/ is derivable in SNEL. Hence, SNEL is complete.

([an]U h t = t') e A

((an ■ t) {<cx> « ((an ■ {(¿x) Sx}x where bn # (cx> Sx G [A#U(x),TEï/j for all x G |U|

Fig. 3. Rules for

We conclude with two corollaries of completeness.

(i) Since [a]V h t = t' is derivable in SNEL iff q^ (t) = q^(t') and the map q^ is equivariant, the rule

is admissible in SNEL.

(ii) Since [a]V h t = t' is derivable in SNEL iff there exist t = t0,...,t ,...,tn = t' in Te§ such that t^ « ti+1 or ti+1 « t^ for all 0 < i < n, one may use equational term rewriting to establish nominal equational judgements.


We are grateful to Steve Lack for advice on enriched category theory.


[1] Adamek, J., Free algebras and automata realizations in the language of categories, Comment. Math.

Univ. Carolin. 15 (1974), pp. 589-602. [2] Adamek, J. and V. Trnkova, "Automata and Algebras in Categories," Kluwer Academic Publishers,

[3] Climent Vidal, J. and J. Soliveres Tur, The completeness theorem for monads in categories of sorted sets, Houston Journal of Mathematics 31 (2005), pp. 103—129.

[4] Clouston, R. and A. Pitts, Nominal equational logic, Electronic Notes in Theoretical Computer Science 172 (2007), pp. 223-257.

[5] Fiore, M., Second-order and dependently-sorted abstract syntax, in: Symposium on Logic in Computer Science (LICS'08), IEEE (2008).

[6] Fiore, M. and C.-K. Hur, Equational systems and free constructions, in: International Colloquium on Automata, Languages and Programming (ICALP'07), Lecture Notes in Computer Science 4596 (2007), pp. 607-618.

[7] Fiore, M. and C.-K. Hur, On the construction of free algebras for equational systems (2008), preprint.

[8] Gabbay, M. J. and A. Mathijssen, A formal calculus for informal equality with binding, in: Workshop on Logic, Language, Information and Computation (WoLLIC'07) (2007).

[an]V h t = t

[bn]V h (an bn) ■ t = (an bn) ■ t

[9] Gabbay, M. J. and A. Pitts, A new approach to abstract syntax involving binders, in: Symposium on Logic in Computer Science (LICS'99) (1999), pp. 214-224.

10] Goguen, J. and J. Meseguer, Completeness of many-sorted equational logic, Houston Journal of Mathematics 11 (1985), pp. 307-334.

11] Hamana, M., Term rewriting with variable binding: An initial algebra approach, in: Symposium on Principles and Practice of Declarative Programming (PPDP'03) (2003).

12] Janelidze, G. and G. M. Kelly, A note on actions of a monoidal category, Theory and Applications of

Categories 9 (2001), pp. 61-91.

13] Kelly, G. M., "Basic concepts of enriched category theory," Cambridge University Press, 1982. (Republished in Reprints in Theory and Applications of Categories, No. 10 (2005) pp. 1-136.)

14] Kelly, G. M. and A. J. Power, Adjunctions whose counits are coequalizers, and presentations of finitary enriched monads, Journal of Pure and Applied Algebra 89 (1993), pp. 163-179.

15] Klop, J. W., "Combinatory Reduction Systems," Ph.D. thesis, Mathematical Centre Tracts 127, CWI, Amsterdam (1980).

16] Lawvere, F. W., "Functorial Semantics of Algebraic Theories," Ph.D. thesis, Columbia University (1963). (Republished in Reprints in Theory and Applications of Categories, No. 5 (2004) pp. 1-121.)

17] Mac Lane, S. and I. Moerdijk, "Sheaves in Geometry and Logic," Springer-Verlag, 1992.

18] Marti-Oliet, N. and J. Meseguer, Rewriting logic: Roadmap and bibliography, Theoretical Computer Science 285 (2002), pp. 121-154.

19] Nipkow, T., Higher-order critical pairs, in: Symposium on Logic in Computer Science (LICS'91), IEEE (1991).

20] Robinson, E., Variations on algebra: Monadicity and generalisations of equational theories, Formal Aspects of Computing 13 (2002), pp. 308-326.