# A Universal Approach to Refinement and Closure of Automata by Macros and OverloadingAcademic research paper on "Computer and information sciences" CC BY-NC-ND 0 0
Share paper
OECD Field of science
Keywords
{}

## Abstract of research paper on Computer and information sciences, author of scientific article — Andrew Solomon

Abstract Starting with the notion of a deterministic automaton, we formalize and explore the concepts of macros, operator overloading and refinement. The category of automata whose arrows are refinements is defined and two closure operators (idempotent monads) on this category are given. The first monad arises as an adjunction with the category of concrete monoids and corresponds to closure by macros, while the other monad comes from an adjunction with the category of graphs and corresponds to closure by overloading. This theory explicates a connection (also called the Catalan construction) between monoids and graphs. Directions for further research are suggested.

## Academic research paper on topic "A Universal Approach to Refinement and Closure of Automata by Macros and Overloading"

﻿Electronic Notes in Theoretical Computer Science 12 (1998)

URL: http://www.elsevier.nl/locate/entcs/volumel2.html 32 pages

A Universal Approach to Refinement and Closure of Automata by Macros and Overloading

Andrew Solomon

School of Mathematics and Statistics The University of Sydney NSW 2006, Australia

Abstract

Starting with the notion of a deterministic automaton, we formalize and explore the concepts of macros, operator overloading and refinement. The category of automata whose arrows are refinements is defined and two closure operators (idempotent monads) on this category are given. The first monad arises as an adjunction with the category of concrete monoids and corresponds to closure by macros, while the other monad comes from an adjunction with the category of graphs and corresponds to closure by overloading.

This theory explicates a connection (also called the Catalan construction) between monoids and graphs. Directions for further research are suggested.

1 Introduction

From the standpoint of computer science, the notions we discuss are those of macros, operator overloading and refinement in relation to deterministic automata. While these notions have received considerable attention in the computer science literature, to the best of the author's knowledge, they have not previously been construed in a universal setting.

Macros are the simplest of these concepts, and (perhaps as a result) appear to have received the least attention in the literature. In terms of programming languages and many software packages, a macro may be thought of as an instruction which is not primitive to the language, but is substituted (at runtime or compile-time) with a sequence of the language's primitive instructions. A formal treatment of macros in relation to the condition-action rules of a logic programming language appear in .

In the literature more serious consideration is given to the matter of operator overloading in programming languages with types. An overloaded operator in this context is one whose effect is dependent upon the type of the object to

Darondeau and Degano  and Eamanathan  study refinement of concurrent systems. Events in the unrefined system correspond to a sequence of events in the refined system, taking account of causal and dependence structures which relate events. The refinements of  are shown to compose. In , a special type of state transition system is defined which corresponds strongly to elementary net systems. The refinement of these objects is local state refinement, where each state can be decomposed into component states. This is the converse of our notion of abstraction (see Conclusion), Our own approach is similar to that of  where refinement is defined for deterministic automata, so that one does not have to concern oneself with dependence structures. The main difference between the present definition of refinement and that of  is that, due to the use of the existential quantifier in Definition 1,12, our refinements are not deterministic.

In this paper a category is defined whose objects are deterministic automata, and whose arrows are refinements. Along with this, two closure operators are constructed which correspond to macros and overloading. We note that the monadic constructions of this paper have a similar flavour to the work of  on relational completeness of a relational database.

Finally, it must be emphasized that this work is preliminary. Rather than presenting a complete theory which gives a neat account of the ideas discussed, our aim is to point out that there are interesting (and possibly useful) closure operators on, and morphisms between, automata. These are found by making universal their well-known connections with graphs (via the state graph) and concrete monoids (via the action monoid), and can be interpreted as phenomena encountered in the engineering of discrete systems. As such, the precise formulation appears to be not incapable of improvement, and the particular points which indicate this are identified in the text as avenues for further research.

This paper assumes that the reader is familiar with the formal treatment of concrete monoids given in the author's paper  which forms the first part of the present volume.

1.1 Basic definitions

An automaton is a triple (A, X, T) where A and X are sets, and T is a function AxI-i-I. In general, the set A is called the input alphabet and its elements are letters. The elements of X are referred to as states, while T is called the state transition function. By convention, we extend T to a (left) monoid action A* x X —X, where A* denotes the free monoid on A. Where no ambiguity can arise, we will sometimes denote T(w,-):X —X by w and refer to it as the action of w on X. The image of x E X under W will be denoted ui{x).

It is well known that examples of automata abound, particularly in the realm of digital computation. To reflect this intuition, an automaton (A, X, T) is said to have instruction set A and interpreter T, The state set X can be thought of as the set of all possible assignments of values to variables: for example, if our machine has variables x and y in N then X will be N x N. Continuing this analogy, a word w E A* may be referred to as a program.

Definition 1.1 Let 4>\X —X be any function. Say that the automaton (A, X, T) computes the function (j) under w if T(w, _) = (j). In this case, if the automaton is understood, for brevity we say that w computes <f>.

An endofunction ^ of a finite set X = {x\,x2, ■ ■ ■, xn}, will often be written

Recall  that a digraph or graph G with vertex set X is a subset of X x X. An edge of G is an element of G and (x,xf) E G will generally be written x —ï x'\ x is called the domain and x' the codomain or target. A path P in G is a sequence X0,x\,X2, ■ ■ ■ ,xk of vertices such that each pair (xi,xi+i) is an edge of G. The length |P| of the path P above is defined to be k. The path P may also be written a;0 —X\ —• • • xk. In the case k = 0 we refer to P as the trivial path at xq.

Definition 1.2 The state graph of an automaton (A, X, T) has vertex set X and an edge x —x' if there is an instruction a E A such that a(x) = x'.

The state graph reflects the "local structure" of an automaton — at any state x we know what other states we may get to by a single instruction, but not what states we can ultimately arrive at and not the way in which other states are affected by the actions of instructions on x.

Definition 1.3 Let a;0 be a state and w a program. If, for every suffix u of w, w(xq) = xq then define the observation Ob(w,xo) of w at xq to be the trivial path at x0. Otherwise define Ob(w,x0) to be the path xq —x\ —• • • —xk where w = ... vi and for each i > 1, xi £¿-1; xi = W(^j-i); and f°r all proper suffixes u of u(xi^i) = x^i. The following facts are immediate.

Proposition 1.4 (i) Ob(l,x0) = x0; (ii) for each instruction a, and state xq, \Ob(a,xo)\ < 1;

as the matrix

(iii) for each program w and state xq, Ob(w,xo) does not contain the path x —x for any x E X.

Definition 1.5 A program w is said to be simple if, for each x E X,\ Ob(w, x) \ < 1.

That is to say, a simple program causes at most one state change no matter what state the machine is in when the program is interpreted. Simple programs are of interest because they share property (ii) of Proposition 1,4 with instructions.

Example 1.6 Consider the automaton given by the following diagram.

Then the program ab is simple while ba is not, since Ob(ba, 1) = 1 —2 —3,

Definition 1.7 Let (A,X, T) be an automaton and 4>\X —X any function. If a is an instruction such that a = <f>, then say that a is a macro for <f>. If w is a simple program such that w = <f> then w is called a weak macro for <f>.

Notice that by this definition the empty program is not a macro for 1 v. however it is a weak macro for 1 V-

Definition 1.8 Let (A, X, T) be an automaton. If for every program w, there is a (weak) macro for w, then say that (A, X, T) is (weak) macro closed.

Example 1.9 Consider the automata A and B in the diagram below: A is weak macro closed while B is macro closed. To see this, it is sufficient to notice that in A the programs ab and ba are both weak macros for the

(l23A\

function defined bv while the instruction c in B is a macro for

y 2 2 4 4 J

the same function. This is sufficient because the only functions computed by either automaton are those corresponding to the programs 1, o, b and ab. The automaton B is a refinement (see Definition 1,12 below) of A.

For any automaton (A, X, T), a subset W C X x A is said to be a function specifier if the projection kX'-W —X is injective. We use this terminology because such a subset determines a function W: X —X by

_ I a(x) if (x, a) E W

W(x) = I K J K J

I x otherwise.

Function specifiers provide a way of'gluing' together the effects of instructions.

Example 1.10 Suppose (A, X, T) is an automaton where X = GUQ, where G is the set of elements of some group, and Q is the set of rational numbers. Let i\ E A be an instruction such that r(ii,g) = gfor all states g in G. Let /•_> E .1 be such that T(i2,q) = —q, for all q E Q. (The action of i\ on elements of Q and the action i2 on elements of G can be arbitrary.) Putting W = {(h,g) | g E G} U {(¿2, q) \ q E Q} defines a function W which computes the inverse of an element regardless of whether it is in G or Q,

As mentioned in the introduction, this subsumes the usual notion of operator overloading, where the effect of an operator depends on the type of the object upon which it acts.

If, for every function specifier W C X x A, there is an instruction a E A such that a = W then say (A, X, T) is overloading closed. If, for every function specifier W, there is a simple program v such that v = W, say that (A, X, T) is weakly overloading closed.

Example 1.11 A simple, though tedious, calculation shows that of the automata below, A is weakly overloading closed, while B an overloading closed refinement of the A. For example, given the function specifier W\ = {(1,6), (2, a), (3, a)} with respect to A, Wi is computed by the simple program 1 (the empty word) in A, while it is computed by the instruction i in B.

Let W2 = {(1, a), (2, b), (3, b)} be another function specifier with respect to A. Then W2 is computed by the simple program ab in A, while it is computed by the instruction c of B.

1.3 Refinement

Definition 1.12 Let (A,X, T) and (B,Y, A) be automata, A refinement of (A, X, T) into (B,Y, A) is an injection <f>: X —Y such that, for all a E A, there is some w E B+, with <f>a = w<f) and for each x E X, there is some 0 < kx < \w| such that if v is a suffix of w:

(i) < kx and v((f){x)) E Im((f) together imply that v(<t>{x)) = <j>(x);

(ii) > kx and v(<t>{x)) E Im((f) together imply that v((f){x)) = (f>(a(x)). We also call the program w a refinement of the instruction a under <f>.

Example 1.13 Let denote the set of positive natural numbers. Define an automaton by: A = {s}; X = N+ xN+; and (n, m,)) = (m, n). So we can think of s as "swap". Define another automaton by: B = {axz,ayx,azy,cz}; Y = N x N x N; and

A(axz, (m, n,p)) = (m, n, m) ("assign z:=x") A(ayx, (m, n,p)) = (n, n,p) ("assign x:=v") A(azy, (m, n,p)) = (m,,p,p) ("assign y:=z") A(cz, (m,, n,p)) = (m, n, 0) ("clear z")

The map ip: X —y Y defined by ip(m, n) = (m, n, 0) is easily seen to be a refinement, for given the instruction s E A, the word czazyayxaxz is a refinement of s, giving the observation

Ob(czazyayxaxz, (m, n, 0)) = (m, n, 0) —y (m, n, m) —y (n, n, m) —y (n, m, m) —y (n, m, 0),

This example shows that a refinement </> of an automaton A into an automaton B can be thought of as a way of building the automaton A from the automaton B. The image of 4> is a subset of the states of B which represent the states of A, while a refinement wa of an instruction a of A is a way of 'implementing' the instruction a in the automaton B. Considering only the states in the image of (j> acted upon only by refinements of instructions of A, the automaton B appears to behave in exactly the same manner as the automaton A.

Theorem 1.14 Let o: (.1. .V.!') (II. V. A) and if) : (II. V. A) (C, Z, A) be refinements. Then the map ip<f)\ X —Z is a refinement.

Proof. Certainly ip(f> is an injection. Fix a E A. Let u = b[... bi E B+ be a refinement of a under <f>. For each b E B let Wb E C+ be a refinement of b under if). Thus

ip(f)a = ipu(f) = ipbt... b\<j> = Wb, ... w^tpij).

Set w = Wbt .. ■Wb1. We claim that w is a refinement of a under ip<f>. It is only necessary to show that for all x E X there is some 0 < kx < such that if v is a suffix of w then

< kx and v(xp(j)(x)) E Im(i/)(f)) =\$- v(xp(j)(x)) = tp(j>(x)

M ^ kx and v(xp(j)(x)) E Im(i/)(f)) =\$- v(xp(j)(x)) = xp(j)(a(x)).

Fix some x E X. Since u is a refinement of o, there is some 0 < N < |u| such that if s is a suffix of u then

|s| < N and s(4>(x)) E Im((f) =>■ s(<f>(x)) = <t>(x)

|s| > N and s(4>(x)) E Im((f) =>■ s(<f>(x)) = <f>(a(x)).

Set y = />y i ■ ■ ■ bi4>(x). Since WbN is a refinement of bx. there is some 0 <

M < I WbN I such that if t is a suffix of wn then

\t\ < M and t(i/j(y)) E Im(ip<f>)

t(ip(y)) = ij)(y) and y E Im((f>) (by injeetivitv of ip)

=> = and y = <t>{x)

(by (2) since 6jv-i ... bi is a suffix of u of length < N)

=> t(Hy)) =

and similarly

\t\> M and t(ip(y)) E Im(ip(f>)

. Wb, for some

Let v be a suffix of w. We prove the first part of (1),

Suppose |îj| < kx and v(xp(j)(x)) E Im(xp(j)). Then v = v'wbp p < N and suffix v' of Wbp+1. Observe that

vip(<f>(x)) = v'(whp ...whl (ip<f>(x)))

= x))).

If p = N — 1 then v'(ij)(y)) = vip((f>(x)) E Im(ip(f>) and |î/| < M bv the définition of kx, so, bv (3),

v(xp(j)(x)) = xp(j)(x), as required. Suppose that p < N — 1, Then

v^(x))=v'^(bp...bl(<P(x))))

ip(bp...bi(<l>(x))) or

ip{bp+1.. .bi(<p(x))) (since Wbp+1 is a refinement of bp+1) ■■ 4>(<l>(x))

since, by injeetivitv of tp, bp ... bi(<j>(x)) or 6p+1,,, bi(<j>(x)) respectively lie in Im((f>) and therefore equal <t>(x) by (2) and the fact that p,p + 1 < N. This

completes the proof of the first part of (1), The second part of (1) is proved similarly, completing the proof of the theorem, □

Example 1.15 The diagram below depicts an instructive example of composition of refinements, A refinement of a under (j) is b2bi while a refinement of bi under i/j is c2c\ and a refinement of b2 under i/j is C4C3, Thus, by the construction in the proof of Theorem 1,14, C4C3C2C1 is a refinement of a under

As a corollary of Theorem 1,14, we have the following

Definition 1.16 The category Ant, has automata as objects and refinements as arrows.

Notice that our notion of refinement is close to that of , however it differs in that, where we have the existential quantifier (we stipulate the existence of a word w and integers kx),  have a particular word in the target alphabet assigned to each letter in the domain alphabet.

Theorem 1.17 Let (A, X, T) and (B,Y, A) be automata. Then (A, X, T) and (B, Y, A) are isomorphic in A lit, if and only if there is a Set isomorphism (j)\ X —y Y such that

(a) for each a E A there is a simple program w E B+ which computes (paq!>_1; and

(b) for each b E B there is a simple program w E A+ which computes 4>^lb(f>.

Proof. Let <f>: (A, X, T) (B, Y, A) be an isomorphism. Certainly <f>: X Y is a bijection. For each a E A there is some w E B+ such that 4>a = w<f) and for each x E X, there is some 0 < kx < \w\ such that if v is a suffix of w then:

(i) \v\ < kx implies that v((j>(x)) = 4>{x)]

(ii) > kx implies that v((f>(x)) = (f>(a(x)).

But this implies that w is a simple program which computes o?7o 1. Similarly, for every b E B there is a simple program in A+ which computes (fb

Conversely, suppose that the condition of the theorem holds. Then for all a E A there exists a simple program w E B+ which computes 4>a(f)^1, so that w(j> = 4>a and \Ob(w, <f>(x))\ < 1 for each x E X, so that 4> is trivially seen to be a refinement. Similarly, is a refinement. Then <p and are mutual inverses in A lit,, so <f>: (A, X, T) —(B, Y, A) is an isomorphism, □

Proposition 1.18 A scholium of the above proof is that under an isomorphism, every refinement of a letter is a simple program.

Remark 1.19 The resulting notion of automaton isomorphism is therefore not as strong as the notion arising from the usual definition of automaton morphism (see ,) or the refinements of , In both of these cases, an isomorphism <f>: (A, X, T) (B,Y, A) is a pair of isomorphisms <pa'-A B and (f>set- X Y such that for each a E A, A(^Q(o))^set = <^Setr(o),

Whilst our definition of automaton morphism gives rise to a weaker notion of isomorphism, it has the advantages that (i) the action monoid and state graph constructions (described below) are functorial and produce an adjunction; and (ii) the isomorphism classes, loosely speaking, correspond to classes of automata with the same set of processes, when these processes are regarded as asynchronous. The author suspects that a bieategorv-theoretie approach may allow one to have the stronger notion of automaton isomorphism whilst retaining a similar "adjunction". To decide whether such a formulation of the present work is viable and reflects the intuition we are trying to capture is an avenue for further research. See Subsection 5,1 for further details.

Any concepts from category theory which are not defined here may be found in , The following definitions are from the same source.

Definition 1.20 A monad T = (T, -q, ¡j) in a category X consists of a functor T: X ^ X together with two natural transformations rj: lx —T and fj,: T2 ^ T which make the following diagrams commute:

By way of explanation of notation, given the following diagrams of functors

and natural transformations:

the first diagram defines a natural transformation T/j,: TS —TS' given by Tfj,(x) = T(fj,x): T(Sx) —T(S'x) while the second diagram defines the natural transformation /j,T: ST —S'T given by fj,T(x) = [j,tx: S(Tx) —S'(Tx). It is noted in  that every adjunction

gives rise to a monad (GF, r], ¡jl) in the category X, where rj: 1 v GF is the unit of the adjunction and ¡jl = GeF: (GF)2 GF where e is the counit of the adjunction. Conversely, every monad is shown to give rise to a canonical adjunction.

If a monad is idempotent (i.e. T2 = T), then it is often called a closure operator.

In this paper we find two adjunctions, one between Ant, and the category Conc(Set) (defined in ) of transformation monoids. The other is between Ant, and a category Graph of graphs, as in the following diagram.

Act St

Conc(Set)

In the above diagram, Act is the action monoid construction of  reflecting the global effects of programs, and St is the state graph construction (see Definition 1,2) which reflects the behaviour of single instructions with regard to a particular state. The monad M is the composite of Act with its right adjoint. It is idempotent and gives, for each automaton, a macro closed one. The monad O is the composite of St with its right adjoint, and is again an

idempotent monad which gives the overloading closure of an automaton. In  we also have the definition of an algebra for a monad:

Definition 1.21 If (T,rj,n) is a monad in X, a T-algebra (x,h) is a pair, consisting of an object x E X (the underlying object of the algebra) and an arrow h:Tx —y x of X (called the structure map of the algebra) which makes the following diagrams commute.

By way of example, given the well known adjunction between the categories of groups and abelian groups (see )

Grp _L Ab

where Q quotients a group by the identity xy = yx and i is the natural inclusion, the algebras of the monad are simply the abelian groups, and the algebra map is the identity from G = Q(G) —G.

In general, an adjunction Q H i with Q: X —A such that Qi = 1 and such that i is faithful and injeetive on objects defines A as a reflective subcategory of X, and the monad iQ is called a reflection. The monads on Ant, which we construct in the sequel will be of this type.

2 Macro Closure

In the sequel, the reader is assumed to be familiar with the category Conc(Set) defined in . In this section, we construct a monad M which gives, for every automaton A, a macro closed automaton M(A). This monad arises from an adjunction between the categories Ant, and Conc(Set),

A well known monoid associated with an automaton is the action monoid of the automaton , ,

Definition 2.1 The action monoid Act(A, X,T) of the automaton (A,X, T) is the monoid of endomorphisms of A consisting of the maps w, where w E A*.

Equivalentlv, the action monoid is the faithful monoid representation T of A*I inherited from the action defined by T, where u v if r(u, _) =

T(v,-). Write [u]x for the equivalence class of u.

We make Act into a functor as follows. Suppose f: (A, X, T) —(B, Y, A) is a refinement. Let i: A ^ B* be a function which assigns to each a E A a refinement i(a) E B* of a under /, Extend j to a homomorphism A* —B*.

Let K be the quotient of A* by the congruence defined by u ~ v if A(i(u), _) = A(i(v), _) and let [u] denote the element of K containing u. Then define a representation —Set by ^([m]) = r(u, _). If [u] = [w] then

for each x E X, A(i(u), f(x)) = A(i(v), f(x)) which implies that f(T(u, x)) = f(T(v,x)) by definition of i. Injeetivitv of / gives r(u, a;) = r(w,a;) so that ^([m]) = ^([w]), thus is well-defined. Clearly is homomorphic. Note, however, that is not necessarily faithful.

Define i: K —B*/ (where B*/ is the abstract monoid of the action monoid of (B, Y, A)) by [u] [i(u)]y. Now

[u] = [v]^A(i(u),.)=A(i(v),.)

so that i is well-defined and injeetive (it is obviously homomorphic). Moreover

f^x[u](x)) = f(T(u,x))

= A(i(u),f(x)) (since i(u) is a refinement of u) = A(i[u])(f(x))

On the other hand, define (j>: K —A*/ by [u] [u]x. To see that <p is a well-defined quotient map, simply notice that:

[u] = [v]^A(i(u),.)=A(i(v),.)

=>A(i(u),f(-)) = A(i(v),f(-))

=> [u]x = [v]x-

Clearly (j> is surjective. Moreover, \I/([u]) = r(u, _) = r([u]x) = so

commutes. Pasting diagrams (4) and (5) along makes / into an arrow

Act{A,X,T) Act(B, Y, A)

in Cone (Set), Therefore

Theorem 2.2 Defining Act (A, X, T) to be the action monoid of (A, X, T) and Act (/) = / makes Act into a functor. □

In the other direction, define the full automaton Full(Mx) of a transformation monoid M \ to be (\M\,X, T) where \M\ denotes the set of elements of M and T : \M\ xl-}l is defined by T(m,x) = Mx(m)(x). If/: Mx NY is an arrow of Conc(Set) then there is a commuting diagram as follows in Cat for some monoid P where (j> is surjective and i is injective,

For each m E \M\, let n = i(p)

Let (\N\,Y, A) be the automaton Full(NY) for some p such that <f>(p) = rn. Then

/r (m,-) = fMx(m) = fMx(<P(p)) = f*x(p) = NY(i(p))f = A(n,/(_))

and further, for each x E X, putting kx = 1, the only suffix of the letter n of length less than kx is the empty word, and the only suffix of length > kx is n, so that / is a refinement from Full(Mx) to Full(NY). Thus, setting Full(f) = / gives a functor Conc(Set) Aut,

2.1 The adjunction between the categories of monoids and automata Theorem 2.3 Act is left adjoint to Full.

Proof. By [8, p.81, Theorem 2] it is sufficient to show that there is a natural transformation rj: 1 Aut —FullAct such that for each transformation monoid Nx and each arrow f\ A—Full(Nx) of A lit,, there is a unique arrow g: Act(A) —Nx such that the following diagram commutes,

FullAct(A) -

Full(g)

Full(Nx)

For any object A = {A, X, T) of Aut, define t]A: (A, X, T) -t FullAct(A, A, T) to be the function 1 V- To see that this is an arrow, for each a E A choose wa E \A*/ |+ to be the letter [o]. That 1 v satisfies the definition of a refinement is then immediate. Let B = (B, Y, A) be any other automaton. Then naturalitv of r] is clear from the following diagram,

va = 1a_ ,4 -FullAct(A)

FullAct(g) = g

Vb = ly

FullAct(B)

Setting g = Act(f): Act(A) ^ ActFull(Nx) and noting that Act Full = lconc(Set) implies that as functions, g = f and Diagram (6) commutes, □

As noted in Subsection 1,4, setting M = FullAct: Aut Aut makes M into a monad in Aut, Furthermore, since ActFull = lconc(Set), the counit of the adjunction is the identity, so that the arrow fj, of Definition 1,20 is also the identity natural transformation M ^ M.

Theorem 2.4 For any automaton A, M(A) is macro closed.

Proof. Put (A, X, f) = M(A, X, T) and let w = % ... ak E A*. Then

f(w,_) = f(oi,_)...f(ofc,_)

: r(ui, _)... r(uk, _) (where [ui T(ui.. .Ufc,_)

:f([lil .. .uk],~)

Oj, for some Ui E A*)

where [ui... Uk] is a single letter of A. Thus (A, X, f) is macro closed, □

Theorem 2.5 Let A = (A, X, T) be an automaton and write M(A) = (A, X, f). The following are equivalent:

(1) A is isomorphic to M(A);

(2) (A, h) is an M-algebra, for some h : M(A) —A;

(3) A is weak macro closed.

Proof. (1) =>■ (3) Let the function <f> : X X describe an isomorphism M(A) A. Let ir E .1* be any word. Write w = oi.. ,ak. Since (j> is an isomorphism, for each o« there is some di E A which is a refinement of o« under Thus i) = di(fr1. Let r = d\ ... a), and let a E A be a macro for v, which exists by the previous theorem. Then by the fact that (j> is an isomorphism and Proposition 1.18, there is some t E A* a refinement of a which is a simple program satisfying lo = on. Thus t = 4>a4>^1 = «fnl^1 = 4>{(t)^lw4>)(t)^1 = was required, showing that A is weak macro closed.

(3) =>■ (2) Suppose that A is weak macro closed. It is enough to show that lx is the state function for a morphism from M(A) to A. for then setting h = 1 v makes the diagrams of Definition 1.21 commute.

For each a E A there is a program w E A* such that f(o,_) = T(w,-). Since A is weak macro complete, there is a simple program va E A* such that r(wa,_) = T(w,-) = f(o, _). The existence of va E A* for each a E A shows that lx is a refinement.

(2) (1) If (.4, h) is an algebra, the following diagram commutes:

rl(A,X,V) = 1a'

(.4, X, r)

(.4, X, r)

(.4, X, T)

which implies that the state function which defines h is lx■ Thus we have that hrj is the identity on A and rjh is the identity on M(A), showing that A is isomorphic to M(A). □

Remark 2.6 That the preceding development depends in no way on the state sets being of any particular cardinality means that we have also found an adjunction between the subcategory Conc(Set)f of concrete monoids of transformations of finite sets and the subcategory Ant,/ of automata whose state sets are finite. The overloading monad (defined in the next section) will only apply to A lit,/.

In this section we construct the monad for overloading closure by finding a right adjoint to the state graph functor. As mentioned at the conclusion of the previous section, this operator only applies to Ant,/. In this particular setting, Theorem 3,7 shows that we are unable to obtain a right adjoint to the state graph functor when the sets of vertices of the graphs are not finite.

In order to define functors for the state graph (St) and its right adjoint, the Catalan construction (C), we begin by describing the category Graph of graphs.

As noted in the introduction, a graph Gx is a subset of the set X x X. A morphism Gx —HY of graphs (which we also call a refinement;) is an injection (j> of A into Y such that if there is an edge X\ —x2 in Gx then there is a path from (j)(xi) to (j)(x2) in HY which does not pass through the image of <f>, that is to say, there is a path

4>(xi) = 2/i —> 2/2 —>----> Vk = <f>(x2)

such that 0 < i < k implies yi £ Im((f).

Proposition 3.1 If 4>: Gx —HY and ip: HY —y Kz are refinements, then the composite function ijxp-.X —y Z is also a refinement from Gx to Kz-

Proof. Since ij)(f) is an injection, it only remains to show that if X\ —x2 is an edge of Gx, then there is a path from ip<f>(xi) to ip<f>(x2) which does not pass through the image of ip<f). By assumption, there is a path, say 4>(xi) = yi — y2 —^ • • • —^ 2/fc = <f>(x2) in Hy which does not pass through Im((f). For each edge yi —y yi+1 there is a path ip(yi) = ^ —>••••—>• Zm{ = ip(yi+1) not passing through the image of ip. Concatenating these paths, there is a path

(7) Mixx) = ii)(yi) = zi1} zi1] ----ii)(y2) ^----ii)(yk) = ii)<P(x2)

in Kz. Now let z be a vertex on this path which is not one of the endpoints. If : ^ ^(llj) for any j then since ip is a refinement, z ^ Im(ip), therefore z ^ Im(ip(f>). Suppose on the other hand that z = ip(yj) with 1 < j < k then yj ^ Im(<f>). Since ip is injeetive ip(yj) ^ Im(ip(f>). Thus the path (7) does not pass through the image of ip<f). □

The category Graph is then defined to have graphs for objects and refinements for morphisms. It is an easy exercise to verify that the isomorphisms in Graph coincide with the usual definition of graph isomorphism, to wit, Gx and HY are isomorphic precisely when there is an bijection <f>: X Y such that x —y x' if and only if <f>(x) <t>(x').

We now show that the state graph construction on an automaton, which we described in the introduction, becomes a functor from A lit, to Graph, If (A, X, T) is an automaton, denote its state graph by St(A,X,T).

Proposition 3.2 Let <f>: (A, X, T) (B,Y, A) be a refinement of automata.

Then the function <f>: X —Y which it comprises is a refinement of graphs from St(A, X, T) to St(B,Y,A).

Proof. Let x —x' be an edge of St(A, X, T), Then there is some a E A with r(o, a;) = x'. By definition of an arrow of A lit,, there is a word w E B* with A(w, <f>(x)) = 4>(x') and 0 < kx < \w| such that if v is a suffix of w

< kx and A(v, 4>{x)) E Im((f) =>■ A(v, 4>{x)) = <t>(x) > kx and A(v,4>(x)) E Im((f) =>■ A(v, 4>{x)) = 4>(x')

Let w = u2uui where |ui| < kx and |ui| is maximal such that A(ui, <j>(x)) E Im((f) and |m| is minimal so that A(uui, <j>(x)) E Im((f). Then A(ui,4>(x)) = 4>(x), A(uui,(f>(x)) = 4>(x') and for all suffixes v of u, A(v,<f>(x)) £ Im((f). Then writing u = bk-i-.-bi and Zi = A(6j_i... bi, <j>(x)), we have a path 4>{x) = zi • • • zk = 4>(x') in St(B, Y, A) which does not pass

through Im((j)). □

Thus, setting St(4>) = 4> makes St into a functor from Ant, to Graph. 3.1 The Catalan automaton of a graph

Let Gx be a graph (which is a subset of X x X). A subset S C Gx (which may be regarded as a subset of the edges of Gx) is said to be functional if the domain function 50: S X is injeetive. To explain the terminology, a functional subset S of the edges of Gx determines an endofunction of X, given by:

_ I x' if x —x' is an element of S S: .r i—Y <

I x otherwise.

Let E denote the set (alphabet) whose elements are precisely the set {S C Gx | S is functional}. Let £ act on X by the action of each of its letters given above. Call this action T. Then the automaton (E,X, T) is called the Catalan automaton of Gx (the justification for this name is given in ) and is denoted C(GX)- This automaton has a universal property in the sense that, given any automaton (A,X, A) with state graph Gx, for each letter a E A there is a letter a E £ such that T(o, _) = A(o, _).

Let Graph/- denote the full subcategory of Graph whose objects are finite graphs. The following theorem makes the Catalan construction functorial.

Theorem 3.3 Refinements of finite graphs are also refinements of their respective Catalan automata. Thus C becomes a functor from Graph/- to Aut/ by setting C((j>) = <f> for any graph refinement (j).

Proof. Let Gx and HY be finite graphs and set C(Gx) = (-4, X, T) and C(HY) = (B,Y, A). Let <f>\ X —Y be a refinement from Gx to HY. The theorem is proved by showing that (j> is also an automaton refinement from

C(GX) to C(HY).

Fix a E A. For each x E X we fix a path Px in HY as follows. By the definition of the Catalan construction, for each x E X, either x = a(x), in which case we set Px equal to the trivial path at 4>(x), or x 7^ a(x) and there is an edge x a(x) in Gx, yielding a path Px in Hy

4>{x) = y(ox) ^ y{x) = m*))

for some positive integer kx and distinct vertices y[x\ ,,,, y[xJ such that Px does not pass through Im((f>).

We inductively define a sequence of words v0 = 1; vjt = bjVj^i, with bjt E B U {1}, for i > 1, such that

(a) for all x,x' E X, if x 7^ x' then U^t((i>(x)) = vl((t){x')) implies ^(^(x)) = (t>(ax) = (j){ax');

(b) for all x E X, Ob(vi, 4>{x)) is a beginning (which includes the possibility of being the whole) of Px,

(c) if i > 1 and vi<j) 7^ 4>a then there is some x E X such that vi((f>(x)) 7^ v~l((j)(x)).

Conditions (b) and (c) and the finiteness of the graph HY will guarantee that = 4>a for some n, and since none of the observations pass through Im((f>), vn will be a refinement of a under (j>, proving the theorem.

Clearly (a) and (c) hold vacuously and (b) holds trivially for i = 0, which starts an induction. Suppose (a), (b) and (c) hold for some given i > 0, The following exhaust all possibilities:

(1) There is some x E X such that vi(4>(x)) = y^ for some j < kx, and vi(4>(x')) ^ or Vi(<f>(x')) = 4>(ax') for all x! E X.

(2) Case (1) doesn't hold and for each x EX either

(a) vi((f>(x)) = (f>(ax); or

(b) vi(<t>(x)) = y^ for some j < kx, and Ui(4>(x')) = ^ <f>(ax' for some x' E X.

Suppose that (1) holds and put bi+1 = {y^ —y We prove that (a)

holds with i replaced by i + 1, Let xi,x2 E X and suppose that X\ ^ x2 and U^{((t){xi)) = Vi+i{4>{x2)). Without loss of generality we may suppose that X\ 7^ x. If vi(4>(x)) = vl((t>(x 1)) then, by (a), vi(4>(x)) = <f>(ax) 7^ a contradiction. Hence vl((t)(x)) 7^ Vj,(<f>(x 1)). If also x2 7^ x then, by the same reasoning, vi((f>(x)) 7^ Ul((f>(x2)), so that, by the definition of bi,

vi(<j)(x 1)) = v~^l((j)(xi)) =v-^l((j)(x 2)) = vi(<j)(x 2)), whence, by (a),

v^i{<j){xi)) = vi{<i){x 1)) = 4>(ax 1) = 4>(ax 2).

I f ./■•_) = .r then

v~i(<f>(x 1)) = ^¿+i(<^i)) = Vi+i(<f>(x)) = Vj+V

whence, by (1), vi((f>(x\)) = <f>(ax 1), which forces j + 1 = kx because Px does not pass through Im((f>), and so

Wi(Hxi)) = Vj+i = <i>(axi) = </>(ax2).

This completes the proof that (a) holds with i replaced by i + 1,

We now prove that (b) holds with i replaced by ¿ + 1, Let x' E X. If x' = x then Ob(vi+i, (f>(x)) is the path

4>\x) = y0 ^----> y) ^ y)+i

which is a beginning of Px. Suppose that x' ^ x. If Vi(4>(x')) = then

Vi(4>(x')) = Vi(4>(x)), so, by (a), Vi(4>(x)) = 4>(ax) ^ y] , a contradiction.

Hence vï(4>(x')) ^ yf'\, so Ob(v{+i, 4>(x')) = Ob(vi,4>(x')) since b{+i(vi(4>(x')) = vï(<j>(x')). This completes the proof that (b) holds with i replaced by i + 1,

That (c) holds with i replaced by i — 1 is immediate because U^((f>(x)) = yj+i # yf = vï(4>(x)). This completes the inductive step under the supposition that (1) holds.

Suppose that (2) holds. If (i) holds for all x E X then vi<j) = 4>a and we put bi+1 = 1, so that the inductive step follows trivially. Suppose then that (ii) holds for some x E X. Certainly then (i) fails for x', and, since (1) does not hold, (ii) must hold for x'. Repeating yields a sequence

X0 — X y X — X y X2 — (^X ^ ^ « « «

such that, by the condition in (ii),

V~i(4>(Xq)) V~i((j)(x 1)) v~i((j)(x2)) • • • is a path in Hy. By finiteness of Gx,

X fi — X ffi for some m > n. But vertices of PXn are distinct, so m, ^ n + 1, Hence m, > n + 1, Choosing m, as small as possible we may suppose that xn, xn+i,,,,, xm-i are distinct. Put

bi+l = {V~i(<j)(Xn)) Vï{<l>{Xn+l)),Vï{<l>{Xn+l)) v~i{4>{xn+2)), ■ ■ ■ ,

Vj,(<i>(xm,-1)) Vï(<l>(Xn))}-We prove that (a) holds with i replaced by i + 1, Let y,z E X and suppose that y ^ z and vï]~{(j){y)) = Vi+i(4>(z)). Suppose first that y ^ {xn,..., xm-i}. If v~i{<i>{y)) = Wi((t)(xi)) for some I E {n,...,m- 1} then, by (a), ~vl((t){xi)) = <j>(axi), which contradicts that a;/ satisfies (ii). Hence vi(<t>(y)) £ {Ul(<f)(xn)),... ,ûï(^(a;m_i))} and so, by the definition of 6i+1, WniHv)) v~i{<j){y)). If z = xi for some I E {n,..., m — 1} then

Vi((j)(xl+i)) =Vi+i((j)(X[))

(by the definition of bi+1)

= Vi+i(<f>(y)) = v~i(<f>(y))

£ {vi((j)(xn)),... ,Wi(<j>(xm-1))},

which is a contradiction. Hence, z ^ {xn,... ,xrn-i} and so, by the reasoning above applied to y, U^((f>(z)) = vl((t){z)). Thus Vj,(<f>(y)) = vi(4>(z)) so that, by (a), Wn(<l>(y)) = «¿OK*/)) = ^(oy) = <l>(az).

Suppose now that y E ,,,, xm_i}, If z ^ {xn,..., xm-i} then we get a contradiction as before. Hence without loss of generality we may suppose that y = xs and z = xt where n<s<i<m — 1. But then

vi(<j)(xs+1)) = v^i(<j)(xs)) = Vi+i{<i>{xt)) = Wi{<t>{xt+1)).

But xs+i 7^ xt+1, so by (a),

v~i((j)(xs+i)) = 4>{axs+1),

contradicting that xs+i satisfies (ii). This completes the proof that (a) holds when i is replaced by i + 1,

We prove that (b) holds with i replaced by i + 1, Let z E X. If z E {xn,..., xm-i} then (j)(z)) is the path

m = yiz) yiz) j,^

for some j < kz, which is a beginning of Pz. Suppose that z ^ {xn,..., xrn-i}. If vi((f>(z)) = vi((f>(xi)) for some I E {n,..., m, — 1} then, by (a), vl(<j>(xi)) = 4>(axi), contradicting that xi satisfies (ii). Hence Ob(vi+\, 4>(z)) = Ob(vi, <j>(z)), completing the proof that (b) holds with i replaced by i + 1,

That (c) holds with i replaced by / — 1 is immediate because Ui^[((f>(x0)) = Ul(4>(xi)) 7^ vl(<j>(x0)). This completes the inductive step under the supposition that (2) holds. Thus the theorem is proved, □

3.2 The adjunction between the categories of graphs and automata Denote by Stf the restriction of St to Ant,/.

Theorem 3.4 The state graph functor Stf is left adjoint to the functor C.

Proof. As in the proof of Theorem 2,3 it is sufficient to show that there is a natural transformation r/: 1 Aut/ —CStf such that for each graph Gx and each arrow (f)\A^r C(Gx) of A lit,/ there is a unique arrow ip: Stf(A) —Gx

such that the following triangle commutes,

CStj(A) --

For each object A = (A, X, T) of Ant,/, put CStf(A) = (A, X, f) and define rix- (A, X, T) —CStf(A, X, T) to be 1 v- noting that for each a E A the letter a E A which has the same action as o, is a refinement of a under 1 v. The following diagram shows that this definition makes r] into a natural transformation,

rlA = 1a-

A -^ CStf(A)

CStf('ip) =tp

m = iv

CStf(B)

Since StfC = 1

Graphr

we may put ip = Stf(<f>): Stf(A) StfC(Gx)

then the diagram (8) commutes as required.

Gx and

Theorem 3.5 Let O = CStf, the monad in Aut/ defined by the above adjunction. Then for all finite automata A, the automaton 0(A) is overloading closed.

Proof. Put (A, X, r) = 0(A, X, r) and let W C JxAbea function specifier. By definition, for each (x, a) E W, either x = a(x) or there is an edge x — a(x) in Stf(A,X,T) so that there is a letter b E A defined by the edges {x a(x) | (x, a) E W and x ^ a(x)} and, as required, for each (x, a) E W, r (6, x) = T(o, x). □

Theorem 3.6 Let A = (A, X, T) and write 0(A) = (A, X, f). The following are equivalent:

(1) A is isomorphic to 0(A);

(2) (A, h) is an O-algebra for some h: 0(A) —A; and

Proof. (1) (3) Let <f>: 0(A) ^ A be the isomorphism. The proof depends on the fact that for each a E A there is a letter a E A which is a refinement of a under To see this, let a E A. Then there is some wa E A* which is

a refinement of a under But since (j> is an isomorphism, Proposition 1,18 implies that wa is simple. In particular, for each x E X such that x ^ r(o, a;) there is a letter cx of wa such that T(cx, 4>^l(x)) = </>_1T(a, x). Let Fa = {(cx, 4>^l{x)) i G I,i ^ r(o, x)} which is clearly a function specifier. Let a E A be a letter such that f(o) = Fa which exists because 0(A) is overloading closed. Then for each x E X, f(o, (f)^l(x)) = f(cx, 4>^l(x)) = </>_1T(a, x). Therefore a is the required single letter refinement of a under

Let F^ CI x A be a function specifier and let F C X x A be defined by

F = x), a) I (x, a) E F and a is a single letter refinement of a under q

Since 0(^4) is overloading closed, let o E A be a letter such that o = F and let t be a refinement of o under <f>. Then by Proposition 1,18, t is a simple program and t = ooo 1 = <f>F<ii)_1. Now for each x E X, of-'o '(./•) = oao '(./•) = a(x) where (x, a) E F and a is a refinement of a under qi>_1. Thus, t = F and t is a simple program which computes F, showing that A is weakly overloading closed,

(3) (2) and (2) (1) follow in the same manner as in the proof of Theorem 2,5, □

3.3 A remark on finiteness

As noted in Remark 2,6 the monad O is only a closure operator on the subcategory A lit,/ of Ant, whose objects have finite state sets. We show that

Theorem 3.7 There is no functor Graph Ant, which is right adjoint to St and such that SM = 1 GraphIn other words, if there is a closure operator on Ant, (including infinite state automata) which factors through St then the closure of an automaton will have a different state graph to the original automaton.

Proof. Let A be the automaton pictured below 12 3 n

V 2' 3' and let the graph G be as shown below,

1 2 3.....n

V 2' 3'.....n'

Let / be the arrow in Graph from St(A) to G given by n n and n' n' for each natural number n.

Suppose there is a right adjoint H to St such that St.'ti = lGraph- Then there is a bijeetion between the hom-sets Graph(St(A), G) and Aut(*4, In

particular, the existence of / implies that there is an arrow g-.A—t in A lit,. Refer to the states of A and (other than *) whose labels

are unprimed as "top states" and those whose labels are primed as "bottom states". Then

Lemma 3.8 If there is a refinement g\A—> then g maps top states to top states and bottom states to bottom states.

Proof. Let n be a top state of A. Suppose that g(n) is a bottom state of Then there is a path g(n) to g(n') and g(n) ^ g(n') by injeetivitv of g. But this is impossible as there are no paths out of bottom states.

Suppose g(n) = *. Then g(n') is a bottom state of If m, ^ n is

another top state of A, then since g(m) can be neither a bottom state nor *, g(m) must be a top state, while g(m') must be a bottom state. But then the path from g(m) to g(m') passes through g(n) = *, contradicting that g is a refinement. Thus, if n is a top state, then g(n) is a top state. A similar argument shows that bottom states are mapped to bottom states. □

Having constrained any refinement A —in this way, we show that there are none. Suppose there were a word w = bi... bk which is a refinement of a under g. Then there are infinitely many states m, of the top row of for which w(m) ^ m, namely (by the lemma above) the states g(n) where n is a top state of A. Denote by Xjt the set {n a top state of A \ bi+i... bkg(n) ^ g(n)}. Then X0 D Xi D • • • D Xk = 0. Since X0 is infinite, and Xk is finite, there is some 0 < i < k such that Xi+i is finite while Xjt is infinite. Fix this i and let I = Xi\Xi+i. Then for each n e I. bi+i... bkg(n) = *, which makes it impossible that wg(n) = g(n') for all n e I. since for distinct elements ni,n2 of /, g(n[) g(n'2). Thus, g is not a refinement. □

4 Interaction of the Closure Monads

The monads M and O both act on the category of finite automata. In this section we show that if an automaton is (perhaps weakly) macro closed, then

its overloading closure is macro closed. However, the property of being overloading closed is shown not to be stable under macro closure. In other words, every time a macro is written, more function specifiers come into existence which may specify new actions on the state set.

At first glance, this would appear to suggest that an efficient way of writing programs would be to write all macros first and then write overloaded operators in terms of these macros. In practice however, one often finds that overloading operators first enables the programmer to get away with writing fewer macros. This apparent contradiction could be explained by the fact that in larger systems which require complex input to perform tasks, the system designer does not require the system to be anywhere near closed with respect to either macros or overloading.

On the other hand, we conjecture that "simple" devices in which every input is a single instruction, and in which every action on the state set is produced by a combination of "elementary instructions" admit the following engineering principle:

When designing a "simple" automaton out of "elementary instructions," describe the overloaded operators in terms of macros in the elementary instructions.

We beg the reader to indulge the author by permitting us to leave the terms "simple" and "elementary instruction" undefined. Whether these terms are meaningful is an open question, but we offer the following example in defence of their use.

Example 4.1 [One Dollar Drink Machine] Using our engineering principle we construct an automaton describing the function of a vending machine which accepts one dollar and gives no change, returning a coin if it takes the total of inserted money over a dollar. The denominations accepted are 10c, 20c, 50c and \$1,

Let A be the automaton with state set X = {0,1,,,,, 9}, and alphabet {a} where for each x E X,

a(x) = x + 1 (mod 10),

Then a is the sole "elementary instruction" in this example.

The alphabet of the macro closure M(A) of A consists of the letters {o0, oi,,,,, o9} where for each x E X, j E {0,..., 9},

7Tj(x) = x + j (mod 10),

We are now able to construct a sub-automaton of OM(A) which corresponds to the drink machine as follows. Put C = {InsWc, Jns2oc, Ins^, Ins\$i} where:

Itisiqc is the function specifier {(x,ai) \ x E A};

Ins2oc is the function specifier {(x,a2) | 0 < x < 8}; IriSfiQc is the function specifier {(x,o5) | 0 < x < 5}; and Ins% 1 is the function specifier 0,

Then the sub-automaton of OM(A) with instruction set C can be endowed with output by specifying that every state transition entering 0 produce a drink, and every state transition from a nonzero state to itself causes the coin which was inserted to fall through. This clearly describes the operation of a one-dollar drink machine with no change.

Theorem 4.2 If(A,X,T) is weakly macro closed, then 0(A, X, T) is macro closed.

Proof. Suppose (A, X, T) is weak macro closed. Put (A, X, f) = 0(A, X, T), Let w E A*. Since (A, X, T) is weakly macro closed, St(A, X, T)(= St(A, X, f)) is transitive and reflexive, so there is an edge x —r(w,a;),for each x e X. By overloading closedness of 0(A,X, T) there is a letter a E A whose action is that of w, proving that (A, X, f) is macro closed, □

Proof. Consider the automaton A shown below.

If M(A) were weakly overloading closed, there would be a word w in the letters of M(A) such that w is the function defined by

11—y :'> 2 2 :'> 1—y :'>

But all the letters of M(A,X,T) act in an order-preserving, non-decreasing way on the total order 1 < 2 < 3, Since the set of maps which are order-preserving and non-decreasing is closed under composition (see ), there is no word w which has the action described above, □

5 Conclusion

Much remains to be done in order to make this a comprehensive theory of the matters it touches upon. In this section we indicate which parts could be developed further (or perhaps better) and connections with other areas which need to be understood.

The most obvious (and perhaps most difficult) task is to formalize and seriously evaluate our so called "engineering principle" for "simple" devices.

It might be considered unfortunate that there is no overloading closure on A lit, factoring through the state graph as there is on Ant,/. Since the Catalan construction is perfectly sensible for arbitrary graphs it may be that a better definition of automaton morphism will make the Catalan construction functo-rial on Graph, Preliminary investigations suggest that this is the case. The proposed morphisms are simpler to axiomatize and would account for the phenomena of abstraction and implementation as well as refinement, however this appears to necessitate a transition to bicategories and bieategorv morphisms which only preserve composition in a weak sense.

Initially, this work arose from investigating the Catalan monoid of a graph, that is, the action monoid of the Catalan automaton of the graph. The connections of this construction with other topics in the theory of transformation monoids on graphs is discussed fully in , An avenue for further reseach would be to investigate the way in which the structure of a graph determines the algebraic properties of its Catalan monoid. Partial results have been obtained by the author as follows. It is easy to see that the functor C: Graph/ —y A lit,/ is the direct limit of the sequence (C„)„> o of functors, where Cn(Gx) has letters which are functional subsets of the edges of Gx of size at most n. The classes of graphs Gx for which the monoid ActC\{Gx) is /¿-trivial, L-trivial, aperiodic, and regular, have all been determined,

5.1 Postscript: a research proposal

In this section we propose a different solution to the problem of formalizing the relationship between automata, graphs and monoids dictated by the action monoid, state graph and Catalan constructions. This approach attempts to make the morphisms between automata into a stronger relationship (in the sense of Remark 1,19) and at the same time, more general (taking account of the phenomena of abstraction and implementation as well as refinement) and as a consequence, there are many details which the author has not had time to check. As such, all the statements of this section are conjectural and this

section is to be regarded as a research proposal.

The following material assumes that the reader is conversant with the theories of categories and bicategories, and in particular, with the various types of bieategorv morphisms. The tenacious nonspecialist may, however, refer to  and  for the necessary definitions.

The starting point of our considerations are the two categories Reps(Set) and Reps*(Set), Reps(Set) is introduced in  while Reps*(Set) is a subcategory of the "supereomma category" introduced in , To be precise, Reps(Set) has as objects the functors V M —Set where M is a monoid and its object lands on X in Set, The arrows from Tx to Ay: N —Set of Reps(Set) are pairs (<f>, rf) where <f>: M ^ N is a homomorphism and r/: X —Y is a natural transformation as in the following diagram,

m ---- A"

On the other hand, Reps*(Set) has the same objects, but its arrows ((/>, r]):Tx — AY are as in the following diagram,

For any category C, Div(C) is defined to be the sub-bieategorv of Span(C) whose arrows X —Y are of the form

X 4- Z^Y

where i is monic and / is a strong epi, (Further details are given in ),

There are two sub-bicategories of Div(Reps(Set)) of significance to us. The first is the bieategorv Impl which is the full sub-bicategorv of Div(Reps(Set)) whose objects are all representations of free monoids. These objects are to be interpreted as automata. With regard to the arrows:

(1) If the monic leg is the identity, we call the arrow an abstraction where the states of the domain are the elements of a partition of the set of states of the codomain, (See  and  for a software engineering perspective on the notion of abstraction),

(2) If the epic leg is the identity, it is refinement (analogous to the notion with the same name in the main part of the paper),

(3) Isomorphisms are the usual notion of automaton isomorphism (see Remark 1,19) while the 2-eells of this bieategorv are yet to be understood,

(4) In general, the arrows are the divisions of Nehaniv , , We call them implementations, Nehaniv refers to them as emulations. The following example justifies our nomenclature.

Example 5.1 [Swap revisited] Consider the following arrow of Impl,

^■n2 ^^ )>■ B'-i

Let A be the the set {s} where s(a, b) = (b, a). Let B = {axy, ayx, axz, azx, ayz, azy} with actions a^(a, b, c) = (a, a, c) and so on. Then let M be the (not necessarily free) submonoid generated by the word w = azyayxaxz in B*. Let i be the natural inclusion, while ^set is (jix,Tiy) which simply 'forgets' the third coordinate, and ^on is the homomorphic extension of the map taking w to s.

This corresponds quite closely with what a programmer does when implementing the function 'swap'. First, the dummy variable is introduced, by passing to B№ then the instruction is decomposed into elemtarv instructions in B (this is the refinement i), and then the dummy variable is thrown away when the function returns (the abstraction 4>).

The other significant sub-bieategorv of Div(Reps(Set)) is the one whose objects are all the faithful representations (that is, transformation monoids). Call this bieategorv ActMon for 'action monoids',

(5) There is a bieategorv homomorphism Act: Impl —ActMon which takes an automaton to its action monoid,

(6) There is a (lax) bieategorv morphism Full: ActMon —Impl whose object function takes a transformation monoid to its full automaton (defined in Section 2),

(7) There is a weak "adjoint" relationship between the morphisms Act and Full in the following sense: in category theory, that two functors F\ A—y B and G : B —y A are adjoint means that there is a bijection between the hom sets (Fa, b) and (a, Gb) for all objects a of A, and objects b of B.

Our 'weak adjunction' says that there is a functor

\mp\(A, Full(My)) ActMon(Act(A),MY)

and if A is irredundant (no two instructions have the same action) then there is a functor

ActMon(Act(A),MY) \mp\(A,Full(My)). 29

While this is far from an isomorphism of hom categories, it has a similar form to the adjunction, and indicates the same kind of "universal" property as the Full construction in the main part of this paper.

Now to the relationship between graphs and automata. Let Grph denote the category of graphs and graph morphisms. The objects of this category are not the graphs defined in the main part of this paper. In the graphs of this category every vertex has an identity edge and there may be parallel edges. Formally, the objects are pairs (O, E) together with three functions do, d\ \ E —O and id: O —E. The morphisms o: II ^ K are pairs of functions 4>o- Oh —Ok and (j>eEh EK such that

(i) i),<>,.; = <j)0di for i E {0,1};

(ii) djid = 1 o for i E {0,1}; and

(iii) <f>Eid= id<f>o-

Denote by StateGrph the sub-bieategorv of Div(Grph) defined by:

(a) Its arrows G H —K are such that for each edge x -4- in G and for each y E <j)^l{x), there is some // in II such that 4>e(t) = ol, where <j) is the epic leg,

(b) The 2-eells are ideals, i.e. i: H > —Hi is an ideal, if for each l(x) of Hi, there is some x in H2 with i(a) = 7,

(8) There is a homomorphism Impl —StateGrph whose object function is the state graph construction. In contrast with our earlier definition, there is an edge x —y for every instruction which maps x to y.

In the other direction we need to formalize the Catalan construction for the graphs of Grph, rather than Graph whose objects are relations. Let G = (E,O,d0,d 1) be a graph. Then define by

£(G) = {f-.O^E\d0f = id0} the set of sections of d0. Then S(G) has an action on O given by

7 = dif.

Define C(G) to be the automaton (£(G), 0,~) as above. Our first guess would be that there is a lax morphism C: StateGrph —Impl, however, we have that:

(9) The C construction is the object function of a lax morphism from StateGrph to Impl*.

Here Impl* has the same objects and arrows as Impl but its 2-eells are arrows of Reps*(Set) (instead of arrows of Reps(Set) ) such that the resulting diagrams commute in Mon and Set separately,

A further avenue for research would be to find an abstract definition for a structure which could encompass both Impl and Impl* — perhaps a "double

bicategory", which has two hom-categories for every pair of objects.

Acknowledgement

Firstly, the author thanks his supervisor David Easdown who provided both encouragement and constructive criticism in the development of these ideas, and also corrected a serious mistake in the proof of Theorem 3,3, Influential have also been conversations with Norman Foo, Giulio Katis and Gordon Monro,

References

 Benabou, J., 'Introduction to bicategories', Lecture Notes in Mathematics 47, (Springer-Verlag, Berlin, 1967).

 Castagna, G., G. Ghelli and G. Longo, Calculus for overloaded functions with subtyping, Proceedings of the 1992 ACM conference on Lisp and Functional Programming, San Francisco, 182-192.

 Chen, K., P. Hudak, M. Odersky, Parametric type classes, Proceedings of the 1992 ACM conference on Lisp and Functional Programming, San Francisco, 170-181.

 Darondeau, P., P. Degano, Refinement of actions in event structures and causal trees, Theoretical Computer Science, 118, no. 1, pp.21-48, 1993.

 Ehrig, H. et. al., 'Universal theory of automata', Teubner Studienbücher, Stuttgart, 1974.

 Eilenberg, S., 'Automata, languages and machines', Academic Press (1974-76).

 Harary, F., 'Graph theory', Addison Wesley (1969).

 MacLane, S.,'Categories for the working mathematician', Springer-Verlag, (1971).

 Martinez-Mascarua, C. and P. E. Caines, COCOLOG macro languages and macro actions for logic control, Proceedings of the 1995 Canadian Conference on Electrical and Computer Engineering, IEEE, Piscataway, NJ, (USA), vol. 2, pp. 817-818.

 Nehaniv, C. L., From relation to emulation: the covering lemma for transformation semigroups, Journal of Pure and Applied Algebra 107 (1996), 75-87.

 Nielsen, M., Elementary transition system,s and refinement, Acta Informatica, 29, no.6-7, pp.555-579, 1992.

 Ramanathan, G., Refinement of events in the development of real-time distributed systems, Theoretical Computer Science, 133, no. 2, pp.341-359, 1994.

 Roseburgh, R., R. J. Wood, Relational databases and indexed categories, Canadian Mathematical Society, Conference Proceeding vol. 13, 1992.

 Sabadini, N., S. Vigna, and R.F.C. Walters, A notion of refinement for automata, Proceedings, AMAST '93, pp 327-334.

 Salomaa, A., 'The theory of automata', Pergamon (1969).

 Solomon, A., Catalan monoids, monoids of local endomorphisms and their presentations, Semigroup Forum 53 (1996), 351-368.

 Solomon, A., A notion of division for concrete monoids, Electronic Notes in Theoretical Computer Science 12 (1998).

 Turski, W., and T. S. E. Maibaum, 'The specification of computer programs', Addison-Wesley, 1987.

 Zeigler, B. P., 'Theory of modelling', Wiley, 1976.