• Nenhum resultado encontrado

A coalgebraic approach to fuzzy automata

N/A
N/A
Protected

Academic year: 2019

Share "A coalgebraic approach to fuzzy automata"

Copied!
112
0
0

Texto

(1)

Ricardo Jorge Pratas Guilherme

Licenciado em Matemática

A coalgebraic approach to fuzzy automata

Dissertação para obtenção do Grau de Mestre em

Matemática e Aplicações - Álgebra, Lógica e Computação

Orientador: Prof. Doutor Luís Fernando Lopes Monteiro, Profes-sor Catedrático (aposentado), Faculdade de Ciências e Tecnologia da Universidade Nova de Lisboa

Co-orientador: Prof. Doutor António José Mesquita da Cunha Machado Malheiro, Professor Auxiliar, Faculdade de Ciências e Tecnologia da Universidade Nova de Lisboa

Júri

Presidente: Prof. Doutor Vitor Hugo Bento Dias Fernandes Arguente: Prof. Doutor Paulo Alexandre Carreira Mateus

(2)
(3)

A coalgebraic approach to fuzzy automata

Copyright © Ricardo Jorge Pratas Guilherme, Faculdade de Ciências e Tecnologia, Uni-versidade NOVA de Lisboa.

A Faculdade de Ciências e Tecnologia e a Universidade NOVA de Lisboa têm o direito, perpétuo e sem limites geográficos, de arquivar e publicar esta dissertação através de exemplares impressos reproduzidos em papel ou de forma digital, ou por qualquer outro meio conhecido ou que venha a ser inventado, e de a divulgar através de repositórios científicos e de admitir a sua cópia e distribuição com objetivos educacionais ou de inves-tigação, não comerciais, desde que seja dado crédito ao autor e editor.

Este documento foi gerado utilizando o processador (pdf)LATEX, com base no template “unlthesis” [1] desenvolvido no Dep. Informática da FCT-NOVA [2].

(4)
(5)

A c k n o w l e d g e m e n t s

I would like to thank my thesis advisor Prof. Luís Monteiro. His knowledge and patience were key to introduce me to the Coalgebra Theory. His support and guidance helped me throughout the research and writing of this thesis. I would like to express my sincere gratitude for being my supervisor in the research project QAIS(see below), where the research for this thesis has been done.

I would also like to thank my thesis co-advisor Prof. António Malheiro. His sugges-tions and encouragement helped me throughtout the process of structuring and writing this thesis. His successive reviews of the writing allowed me to submit a better thesis.

I would also like to thank Prof. João Nuno Gonçalves Faria Martins. His mentoring on Category Theory was very important in the research and the writing of this thesis. Whenever I needed help, Prof. João Martins was available either in his office or by email.

Unfortunately, for bureaucratic reasons, Prof. João Martins could not be accounted as co-advisor, although he acted as one.

I would also like to thank the Departamento de Matemática da Faculdade de Ciências e Tecnologia da Universidade Nova de Lisboa. In particular, I would like to acknowledge all the professors who taught me making my last seven years in this department wonderfull.

Finally, I must thank my parents and my sister. Their unfailing support makes my life easier allowing me to focus on what is really important.

(6)
(7)

A b s t r a c t

In this thesis, we make a coalgebraic description of fuzzy automata allowing their inte-gration in much general context. Thus, results obtained indivudually to fuzzy automata end up to be consequence of their coalgebraic description. In particular, a coalgebraic definition of the fuzzy language recognized by a fuzzy automaton is obtained. And, by defining a monad for fuzzy sets, a functor that describes a determinization process via a generalization of the powerset construction is obtained.

(8)
(9)

R e s u m o

Nesta tese, faz-se uma abordagem co-algébrica aos autómatos vagos, permitindo a sua integração num contexto mais geral. Deste modo, resultados obtidos especificamente para autómatos vagos são consequência da descrição co-algébrica elaborada. É obtida uma definição co-algébrica da linguagem vaga reconhecida por autómatos vagos e, com a definição de uma mónada para os conjuntos vagos, é obtido um functor que descreve um processo de determinização para os autómato vagos.

(10)
(11)

C o n t e n t s

1 Introduction 1

2 Categories 3

2.1 Basics on categories . . . 3

2.1.1 Products . . . 4

2.1.2 Coproducts . . . 6

2.1.3 Pullbacks. . . 7

2.1.4 Pushouts . . . 12

2.2 Monads and Kleisli triples . . . 14

2.3 Algebras for a monad . . . 19

2.3.1 Generalizing morphism extension to the algebras of a monad . . . 21

2.3.2 Functor liftings to the Eilenberg-Moore category of a monad . . . 22

3 Coalgebras 27 3.1 The category of coalgebras . . . 27

3.2 Final coalgebras . . . 34

3.3 Determinization . . . 37

4 Fuzzy sets 45 4.1 Residuated lattices. . . 45

4.1.1 K-modules . . . 50

4.2 Fuzzy sets. . . 55

4.2.1 Fuzzy relations . . . 57

4.2.2 TheK-module of fuzzy sets . . . 59

4.3 A monad for fuzzy sets . . . 61

4.3.1 Z-algebras areK-modules . . . . 62

5 Fuzzy automata 71 5.1 Coalgebras for fuzzy automata . . . 71

5.1.1 Crisp-deterministic fuzzy automata . . . 74

5.2 Fuzzy languages . . . 76

5.3 A final coalgebra for crisp-deterministic fuzzy automata . . . 77

(12)

5.4.1 Recognizing fuzzy languages . . . 85

5.5 Bisimulations for fuzzy automata . . . 90

5.5.1 Quotient fuzzy automata . . . 92

(13)

C

h

a

p

t

e

r

1

I n t r o d u c t i o n

In Computer Science, an adequate algebraic formalization for general discrete algebraic systems, in addition accommodating the a) classical notions of automata, b) formal lan-guages and computatibily, c) computation models for programming lanlan-guages semantics, has proven to be a difficult task. Recently this diculty was overcome by using the theory

of coalgebras.

From a categorical point of view the notion of a coalgebra is dual to that of an alge-bra. The axioms of coalgebras are exactly dual to the axioms of algebras of a functor in Category Theory. Thus, the Theory of Coalgebras is a subject in the Category Theory.

Fuzzy automata are a type of transition system, where sets and relations are fuzzy. Sev-eral transition systems are already studied from a coalgebraic point of view (e.g. [Rut00;

(14)
(15)

C

h

a

p

t

e

r

2

Ca t e g o r i e s

In this chapter, we present some basic definitions in Category Theory. We assume that the foundations of the theory are known, such as the definitions of category and functor. See [Adá+90;ML98] for a full introduction.

In Section2.1, we introduce most of the notation that will be used in the rest of the thesis, we also present some basic results that will be useful further. In Section2.2, we construct a one-to-one correspondence between monads and Kleisli triples allowing us to use either of the concepts depending on the context. Finally, in Section2.3, we present the category of the algebras of a monad and then show how morphism can be extend and functors can be lifted to this category.

2.1

Basics on categories

LetCbe a category, we denote the classes of its objects and morphisms by Ob(C) and Mor(C), respectively. For simplicity, we writeX ∈C forX ∈Ob(C) andf inCfor f ∈ Mor(C). Unless specified beforehand, X, Y andZ are arbitrary objects in (a context

category)C. We denote byC(X, Y) the set of morphisms fromX toY, i.e. with domain

X and codomainY, inC, and adopt the arrow notationf :XY orX −→f Y to denote f ∈C(X, Y). Also, we denote the indentity morphism onX by idX, and given morphisms

f : XY and g : YZ, we write gf for their composition (from X to Z). The

notationXY means thatXis isomorphic toY, i.e. there are morphismsf :XY and

f−1:YX such thatf−1◦f = idX andff−1= idY.

(16)

inductively

T0= IdC and Tn+1=T Tn, n∈N,

where IdCis the identity functor onCandN={0,1,2, . . .}is the set of natural numbers. We consider Set to be the category with objects all sets, morphisms all functions between them and the usual function composition. For setsXandY, instead ofSet(X, Y), we writeYXto denote the set of all functions fromXtoY. We also consider that a number n∈Nmay represent a set with exactlynelements, namely 1 ={∗}and 2 ={0,1}. Note that

X Y means that there is a bijection fromX toY.

Finally, when we consider a family (ai)i∈I, unless said otherwise, it is a set-indexed family, i.e. Iis a set. A family (fi:XiYi)i∈I denotes a family of morphisms (fi)i∈I such thatfi:XiYi, for eachiI.

2.1.1 Products

Definition 2.1. LetX andY be objects in a category C. A productofX andY is a pair

(P,(pX, pY)) consisting of an objectP ∈Cand morphismspX :PX andpY :PY in C(called theprojections), such that for any objectQ∈Cand morphismsqX:QXand

qY:QY inC, there exists a unique morphismh:QPwhich makes the diagram

Q

X P Y

qX qY

pX pY

h

commute, i.e. qX=pXhandqY =pYh. Since a product (when exists) is unique up to isomorphism, we denoteP byX×Y andhbyhqX, qYi.

In general, aproductof a family (Xi)i∈I of objects inC, indexed by a setI, is a pair (Qi∈IXi,(pi)i∈I), where Qi∈IXi ∈ C and (pj : Qi∈IXiXj)j∈I, such that for any object

Q∈C and family of morphisms (qi :QXi)iI inC, there exists a unique morphism hqiii∈I :Q→Qi∈IXisatisfyingqj=pj◦ hqiii∈I, for eachjI.

LetX andY be objects in a categoryCand assume that their product (X×Y ,(pX, pY)) exists. Ifh: QX×Y is a morphism inC, then his unambiguously determined by qX=pXh:QX andqY=pYh:QY, sinceh=hqX, qYi. Therefore, any morphism from an objectQ∈Cto a productX×Y will be usually described by its composition with

the projections.

Given objectsX, X, Y , Y′, for which products (X×Y ,(pX, pY)) and (X′×Y,(pX, pY′))

exist, and morphismsf :XX′ andg:YY′in a categoryC, we definef ×g:X×Y

(17)

2 . 1 . BA S I C S O N CAT E G O R I E S

X×Y

X Y

X′×Y

XY′,

pX pY

f ×g

f g

pXpY

and sof ×g=hfpX, gpYi.

InSet, a product of any setsX andY exists and it corresponds (up to bijection) to the

cartesian product

X×Y ={(x, y)|xX, yY},

with the respective projections

pX(x, y) =x and pY(x, y) =y, (x, y)∈X×Y .

Given functionsqX:QX andqY :QY, we have that

hqX, qYi(z) = (qX(z), qY(z)), zQ.

And, for any functionsf :XX′ andg:YY′, we have that

(f ×g)(x, y) = (f(x), g(y)), (x, y)∈X×Y .

Note that, for setsX,Y andZ,

ZX×Y(ZY)X.

The process that maps a functionf :X×YZ to a function fc :XZY, such that

fc(x)(y) = f(x, y) (withxX andyY), is called currying1. On the other hand, the inverse process which maps a functionf :XZY to a functionfu:X×YZ, such that

fu(x, y) =f(x)(y) (with (x, y)∈X×Y), is calleduncurrying. For the sake of simplicity, we drop the subscript letters (c andu) lettingf denote both functions, where the context identifies which is being used.

Finally, the product of a family of sets (Xi)i∈I, indexed by a setI, is again the (general) cartesian product

Y

i∈I

Xi={(xi)i∈I |xiXifor eachiI}

together with the projections (pj :Qi∈IXiXj)jI wherepj(xi)iI =xj. For a family of functions (qi:QXi)i∈I, we havehqiii∈I(z) = (qi(z))i∈I, for allzQ.

(18)

2.1.2 Coproducts

Definition 2.2. LetX andY be objects in a categoryC. AcoproductofX andY is a pair

(K,(kX, kY)) consisting of an objectK ∈Cand morphismskX :XK andkY :YK in C(called thecoprojections), such that for any objectL∈Cand morphismslX:XLand

lY :YL, there exists a unique morphismh:KLwhich makes the diagram

X K Y

L kX

lX

kY

lY

h

commute, i.e.lX=hkXandlY=hkY. Since a coproduct (when exists) is unique up to isomorphism, we denoteK byX+Y andhby [lX, lY].

In general, acoproductof a family (Xi)i∈I of objects inC, indexed by a setI, is a pair (Pi∈IXi,(ki)i∈I), where Pi∈IXi ∈ C and (kj : Xj → Pi∈IXi)j∈I, such that for any object

L ∈ C and family of morphisms (li :XiL)i∈I in C, there exists a unique morphism [li]i∈I :Pi∈IXiLsatisfyinglj= [li]i∈Ikj, for eachjI.

We remark that coproducts could be defined as the dual of products. In that case, (K,(kX, kY)) is a coproduct ofX andY in a categoryCif it is a product ofX andY in the opposite categoryCop[Adá+90, Definition 3.5]. Also, the following notes are dual to the ones done for products.

LetXandY be objects in a categoryCand assume that their coproduct (X+Y ,(kX, kY)) exists. If h: X+YL is a morphism in C, thenh is unambiguously determined by

lX =hkX:XL andlY =hkY :YL, since h= [lX, lY]. Therefore, any morphism from a coproductX+Y to an objectL∈Cwill be usually described by its composition with the coprojections.

Given objectsX, X, Y , Y′, for which coproducts (X+Y ,(kX, kY)) and (X′+Y,(kX, kY′))

exist, and morphismsf :XX′ andg:YY′in a categoryC, we definef +g:X+Y

X′+Y′to be the only morphism that makes commutative the following diagram

X+Y

X Y

X′+Y

XY′,

kX kY

f +g

f g

kXkY

and sof +g= [kX′◦f , kY′◦g].

InSet, a coproduct of any setsX andY exists and it corresponds (up to bijection) to the disjoint union

(19)

2 . 1 . BA S I C S O N CAT E G O R I E S

with the respective coprojections (also known ascanonical injections)

kX(x) = (x,1) and kY(y) = (y,2), xX, yY .

Given functionslX:XLandlY :YL, we have that

[lX, lY](z, i) =

        

lX(z) ifzX, i= 1

lY(z) ifzY , i= 2,

(z, i)∈X+Y .

And, for any functionsf :XX′ andg:YY′, we have that

(f +g)(z, i) =         

(f(z), i) ifzX, i= 1

(g(z), i) ifzY , i= 2,

(z, i)∈X+Y .

In general, the coproduct of a family of sets (Xi)iI, indexed by a setI, is again the (general) disjoint union

X

i∈I

Xi=

[

i∈I

(Xi× {i}) ={(x, i)|xXi, iI}

together with the coprojections (kj :Xj →Pi∈IXi)j∈I wherekj(x) = (x, j). For a family of function (li:XiL)i∈I, we have [li]i∈I(x, j) =lj(x), for all (x, j)∈Pi∈IXi.

2.1.3 Pullbacks

Definition 2.3. Letf :XZandg:YZbe morphisms with the same codomain in a categoryC. Apullbackoff andgis a pair (P,(pX, pY)) consisting of an objectP ∈Cand morphismspX:PX andpY :PY inCsuch that the diagram

P X

Y Z

pX

pY f

g

commutes, i.e.fpX=gpY, and for any objectP′ ∈Cand morphismspX:P′→Xand

pY′ :P′→Y withfpX=gpY, there exists a unique morphismh:P′→Pwhich makes

the diagram

P

P X

Y Z

pX

pY f

g pX

(20)

commute, i.e. pX′ =pXhandpY =pYh. If we do not requirehto be unique (for each object and morphisms), then (P,(pX, pY)) is called aweak pullback.

Letf : XZ and g : YZ be morphisms in a category C. We remark that if (P,(pX, pY)) and (P,(pX, pY)) are pullbacks off and g, then there is an isomorphism

h:P′ →P withpX′ =pXhandpY′ =pYh, and so a pullback (when exists) is unique up to isomorphism. Although this does not apply to weak pullbacks, we still have the following result.

Theorem 2.4. Let(P,(pX, pY))be a weak pullback of morphismsf :XZandg:YZin a categoryC. A pair(W ,(wX, wY)), whereW ∈C,wX :WX andwY :WY, is a weak pullback off andgif, and only if,fwX=gwYand there ish:PW such thatpX=wXh andpY =wYh, i.e. the following diagram is commutative

P

W X

Y Z.

wX

wY f

g pX

pY

h

Proof. Assume that (W ,(wX, wY)) is a weak pullback off andg. In particular,fwX=

gwY. Since (P,(pX, pY)) is a weak pullback,fpX =gpY. Thus, there ish:PW which makes the diagram

P

W X

Y Z

wX

wY f

g pX

pY

h

commute, i.e.pX=wXhandpY =wYh, due to (W ,(wX, wY)) be a weak pullback off

andg.

Conversely, suppose thatfwX=gwY, and leth:PW be such thatpX=wXh

(21)

2 . 1 . BA S I C S O N CAT E G O R I E S

P

P

W X

Y Z

wX

wY f

g pX

pY

pX

pY h

h

commute, since (P,(pX, pY)) is a weak pullback. Therefore, (W ,(wX, wY)) is a weak pull-back off andg.

InSet, a pullback of any functionsf :XZ andg :YZ exists. For instance, a

pullback off :XZandg:YZis the set

P={(x, y)∈X×Y |f(x) =g(y)}

together with the projections (restricted toP)pX:PX andpY :PY defined by

pX(x, y) =x and pY(x, y) =y, (x, y)∈P.

Since any other pullback off andgis bijective to (P,(pX, pY)), we will use it by default.

Example 2.5. InSet, letf :XY be a function. A pullback off with itself is formed by

ker(f) ={(x, y)∈X×X|f(x) =f(y)},

the kernel off, and the projections (restricted to ker(f))p1: ker(f)→X andp2: ker(f)→

X where

p1(x, y) =x and p2(x, y) =y, (x, y)∈ker(f).

Definition 2.6. LetCandDbe categories, and letf andgbe morphisms with common

codomain inC. A functorF:C→Dis said topreserve (weak) pullbacks off andgprovided that for every (weak) pullback (P,(pX, pY)) off andginC, (F(P),(F(pX), F(pY))) is a (weak) pullback ofF(f) andF(g) inD.

IfF:C→Dpreserves (weak) pullbacks of any two morphisms with common codomain inC, thenF is said topreserve (weak) pullbacks.

Note that ifF :C→DandG: D→E are functors that preserve (weak) pullbacks, then their compositionGF:C→Ealso preserves (weak) pullbacks.

(22)

Theorem 2.7. LetF :C→D be a functor between categoriesCandD, and letf :XZ

andg :YZ be morphisms inC. If there is a weak pullback(P,(pX, pY))off andg such that (F(P),(F(pX), F(pY))) is a weak pullback ofF(f) andF(g) inD, then F preserves weak pullbacks off andg.

Proof. Suppose (P,(pX, pY)) is a weak pullback off andgsuch that (F(P),(F(pX), F(pY))) is a weak pullback ofF(f) andF(g). Let (W ,(wX, wY)) be any weak pullback off andg, then there ish:PW which makes the diagram

P

W X

Y Z

wX

wY f

g pX

pY

h

commute, by Theorem2.4. Thus, the following diagram is also comutative

F(P)

F(W) F(X)

F(Y) F(Z), F(wX)

F(wY) F(f)

F(g) F(pX)

F(pY)

F(h)

and so (F(W),(F(wX), F(wY))) is a weak pullback ofF(f) andF(g), by Theorem2.4. There-fore,Fpreserves weak pullbacks off andg.

As we have already seen, inSetthere are pullbacks of any two functions with common codomain. By Theorems2.4and2.7, to prove that a functorF:Set→Setpreserves weak pullbacks, it is sufficient to show that for any functionsf :X Zandg:Y Zthere is

h:P′ →F(P) which makes the diagram

P

F(P) F(X)

F(Y) F(Z)

F(pX)

F(pY) F(f)

F(g) pF(X)

pF(Y)

(23)

2 . 1 . BA S I C S O N CAT E G O R I E S

commute, where (P,(pX, pY)) is a pullback off andg, and (P,(pF(X), pF(Y))) is a pullback

ofF(f) andF(g).

Example 2.8. (i) LetA be a set. Consider the functorF = (−)A:Set→Setwhich maps a setX to the setXAof all functions fromAtoX, and maps each functionf :YZ to

fA=f ◦(−) :YAZA, where

fA(h) =fh, hYA.

Given functionsf :XZandg:YZ, let (P,(pX, pY)) be their pullback, where

P={(x, y)∈X×Y |f(x) =g(y)},

andpXandpYare the projections (restricted toP). Also, let (P,(pXA, pYA)) be the pullback

offAandgA, where

P′ ={(h, k)∈XA×YA|fA(h) =gA(k)}={(h, k)∈XA×YA|fh=gk},

and pXA and pYA are the projections (restricted to P′). Note that, if (h, k) ∈ P′, then

(h(a), k(a))∈P, for anyaA. Definei:P′ →PAwhich maps each (h, k)∈P′ toi(h, k) :A

P defined by

i(h, k)(a) = (h(a), k(a)), aA.

Thus, the diagram

P

PA XA

YA ZA

pAX

pYA fA

gA pXA

pYA

i

commutes, which implies that (PA,(pXA, pYA)) is a weak pullback, by Theorem2.4.

Conse-quently,Fpreserves weak pullbacks, by Theorem2.7.

(ii) LetBbe a set. Consider the functorF=B×(−) :Set→Setwhich maps each set

X toB×X and each functionf to idB×f. Given functionsf :XZandg:YZ, let (P,(pX, pY)) be their pullback (as defined in (i)). Also, let (P,(pB×X, pB×Y)) be the pullback of idB×f and idB×g, where

(24)

andpB×X andpB×Y are the projections (restricted toP′). Note that ((b, x),(b, y))∈P′ if, and only if,b=b′ and (x, y)∈P. Defineh:P′→B×P by

h((b, x),(b, y)) = (b,(x, y)), ((b, x),(b, y))∈P.

Thus, the diagram

P

B×P B×X

B×Y B×Z

idB×pX

idB×pY idB×f

idB×g pB×X

pB×Y

h

commutes. By Theorems2.4and2.7, we have thatFpreserves weak pullbacks. Moreover, since h is a bijection, (B×P,(idB×pX,idB×pY)) is a pullback of idB×f and idB×g, and thereforeFpreserves pullbacks.

(iii) By composing the functors of the previous examples, we have that the functor

B×(−)A:Set→Setalso preserves weak pullbacks, for any setsAandB.

2.1.4 Pushouts

Definition 2.9. Letf :ZX andg:ZY be morphisms with the same domain in a

categoryC. Apushoutoff andgis a pair (V ,(vX, vY)) consisting of an objectV ∈Cand morphismsvX:XV andvY :YV inC, such that the diagram

Z X

Y V

f

g vX

vY

commutes, i.e.vXf =vYg, and for any objectV′∈Cand morphismsvX′ :XV′ and

vY:YV′withvX′ ◦f =vY′ ◦g, there exists a unique morphismh:VV′which makes

(25)

2 . 1 . BA S I C S O N CAT E G O R I E S

Z X

Y V

Vf

g vX

vY

vX

vY

h

commute, i.e. vX′ =hvXandvY′ =hvY.

Observe that a pushout is the dual notion of a pullback. However, inSet, the con-struction of a pushout requires a little more work than the concon-struction of pullbacks.

InSet, the pushout of functionsf :ZX andg:ZY exists and may be obtained

as follows. Consider the coproduct (X+Y ,(kX, kY)) ofXandY, and letR⊆(X+Y)×(X+Y) be the smallest equivalence relation onX+Y such that (kX(f(z)), kY(g(z)))∈R, for allzZ, i.e. ifSis an equivalence relation onX+Y containing all pairs (kX(f(z)), kY(g(z))),zZ, thenRS. SinceRis an equivalence relation onX+Y, denote theR-equivalence class

ofaX+Y by [a]Rand denote by (X+Y)/Rthe quotient set ofX+Y byR, i.e. the set of allR-equivalence classes. Defineq:X+Y→(X+Y)/Rthe quotient function which maps

eachaX+Y to itsR-equivalence class [a]R. Thus, we have a diagram

Z X

Y X+Y

(X+Y)/R f

g kX

kY q

whereqkXf =qkYg. Also, ifV is a set, andvX : XV andvY : YV are functions for whichvXf =vYg, then ker[vX, vY] is an equivalence relation onX+Y

that contains all pairs (kX(f(z)), kY(g(z))), zZ, which implies R⊆ker[vX, vY], and so there is a function [vX, vY]/R: (X+Y)/RV defined by

([vX, vY]/R)([a]R) = [vX, vY](a), a∈(X+Y)/R,

(26)

Z X

Y (X+Y)/R

V f

g qkX

qkY

vX

vY

[vX, vY]/R

commute. Moreover, [vX, vY]/Ris the unique function that makes such diagram commute, since ifh: (X+Y)/RV is such thathqkX=vXandhqkY=vY, then

hq= [hqkX, hqkY] = [vX, vY] = ([vX, vY]/R)◦q,

and so h= [vX, vY]/R becauseq is surjective. Therefore, ((X+Y)/R,(qkX, qkY)) is a pushout off andg.

2.2

Monads and Kleisli triples

LetF, G:C→D be functors between two categoriesCandD. Anatural transformation

η fromF toG, denoted byη : FG orF −→η G, is a class of morphisms (ηX :F(X)→

G(X))X∈C inD, indexed by the objects ofC, such that for any objectsX, Y ∈Cand mor-phismf :XY inCthe following diagram

F(X)

F(Y)

G(X)

G(Y) F(f)

ηX

ηY

G(f)

commutes, i.e. ηYF(f) =G(f)◦ηX. Note that a natural transformation can also be regarded as a functionη: Ob(C)→Mor(D) withX 7→(ηX:F(X)→G(X)) satisfying the previous property.

Definition 2.10. A monad(T , η, µ) on a categoryCconsists of a functorT :C→Cand two natural transformations η : IdC →T (called the unit) andµ : T2 →T (called the multiplication), such that the diagrams

T3(X) T2(X)

T2(X) T(X)

T(X) T2(X) T(X)

T(X)

T(µX)

µT(X) µX

µX

ηT(X)

idT(X)

T(ηX)

idT(X)

(27)

2 . 2 . M O N A D S A N D K L E I S L I T R I P L E S

commute, i.e. µXT(µX) =µXµT(X)(theassociative law),µXηT(X)= idT(X)(theleft unit

law) andµXT(ηX) = idT(X)(theright unit law), for eachX ∈C.

For simplicity, we represent a monad by its functor, when its unit and its multiplica-tion are clear from the context.

In the following example, we present a monad onSet, namely the powerset monad, that will be used through the rest of the text.

Example 2.11. Consider the powerset functorP:SetSetthat maps each setX to the

set of all its subsets

P(X) ={S|SX},

and maps each functionf :YZtoP(f) :P(Y)P(Z) defined by

P(f)(S) ={f(s)|sS}, SP(Y).

For each setX, defineηX:X →P(X) by

ηX(x) ={x}, xX,

and defineµX:P(P(X))P(X) by

µX(W) = [ S∈W

S, W ∈P(P(X)).

Letη= (ηX)X∈Set andµ= (µX)X∈Set. Then, (P, η, µ) is a monad onSetcalled thepowerset

monad.

Let (T , η, µ) be a monad on a categoryC. For a morphismf : XT(Y) in C, with

X, Y ∈C, define

f =µYT(f) :T(X)→T(Y).

Note that

ηX=µXT(ηX) = idT(X),

by the right unit law, for eachX ∈C. Also, for a morphismf :XT(Y), the diagram

X T(Y)

T(X) T2(Y) T(Y) f

ηX ηT(Y)

T(f)

idT(Y)

(28)

commutes, becauseηis a natural transformation from IdCtoT and by the left unit law, and so

fηX=µYT(f)◦ηX=f .

Finally, given morphismsf :XT(Y) andg:YT(Z), the diagram

T(X) T2(Y) T3(Z) T2(Z)

T(Y) T2(Z) T(Z)

T(f) T2(g) T(µZ)

µY µT(Z) µZ

T(g) µZ

commutes, becauseµis a natural transformation fromT2toT and by the associative law, and thus

gf =µZT(µZ)◦T2(g)◦T(f) =µZT(g)◦µYT(f) =gf .

From the previous construction, we have seen how to obtain a so-called Kleisli triple from a monad.

Definition 2.12. AKleisli triple(T , η, ) on a categoryCconsists of a functionT : Ob(C)→ Ob(C), a family of morphismsη= (ηX :XT(X))X∈C in C, indexed by the objects of C, and an extension operation that for each morphism f : XT(Y) in Cassigns a morphismf :T(X)→T(Y) inC, such that the following properties hold

(K1) ηX= idT(X),

(K2) fηX=f, and (K3) gf =gf,

for any morphismsf :XT(Y) andg:YT(Z) and objectsX, Y , Z∈C.

Observe that properties (K2) and (K3) are equivalent to say that both diagrams

X T(X)

T(Y)

T(X) T(Y)

T(Z) ηX

f f

f

gf

g

commute, for any morphismsf :XT(Y) andg:YT(Z).

Let (T , η, ) be a Kleisli triple on a categoryC. For each morphismf :XY inC, define

(29)

2 . 2 . M O N A D S A N D K L E I S L I T R I P L E S

For eachX∈C, we have that

T(idX) =ηX= idT(X),

by (K1), and for each morphismsf :XY andg:YZinC, we have that

T(g)◦T(f) =ηZgηYf

by (K3)

= ηZgηYf

by (K2)

= ηZgf =T(gf).

Therefore,T is a functor onC. By (K2), the diagram

X T(X)

Y T(Y)

ηX

f T(f) =ηYf

ηY

commutes, for any morphismf :XY. Hence,ηis a natural transformation from IdC toT. For eachX∈C, define

µX= idT(X):T2(X)→T(X).

Observe that

µYT2(f) = idT(Y)◦ηT(Y)◦ηYf

= idT(Y)◦ηT(Y)◦ηYf by (K3) = idT(Y)◦ηYf by (K2) =ηYf ◦idT(X)

=ηYf ◦idT(X) by (K3)

=T(f)◦µX,

and so the diagram

T2(X) T(X)

T2(Y) T(Y)

µX

T2(f) T(f)

(30)

commutes, for any morphismf :XY inC. Thus,µ= (µX)X∈Cis a natural transforma-tion fromT2toT. Finally, for eachX∈C, we have

µXT(µX) = idT(X)◦ηT(X)◦idT(X)

= idT(X)◦ηT(X)◦idT(X) by (K3)

= idT(X)◦idT(X) by (K2)

= idT(X)◦idT2(X)

= idT(X)◦idT2(X) by (K3) =µXµT(X)

(the associative law),

µXηT(X)= idT(X)◦ηT(X)by (K2)= idT(X)

(the left unit law), and

µXT(ηX) = idT(X)◦ηT(X)◦ηX

by (K3)

= idT(X)◦ηT(X)◦ηX

by (K2)

= ηX

by (K1)

= idT(X)

(the right unit law), implying that the diagrams

T3(X) T2(X)

T2(X) T(X)

T(X) T2(X) T(X)

T(X)

T(µX)

µT(X) µX

µX

ηT(X)

idT(X)

T(ηX)

idT(X)

µX

commute. Therefore, (T , η, µ) is a monad onC.

At first, we have seen how to construct a Kleisli triple from a monad and now we have seen how to construct a monad from a Kleisli triple (cf. [Man76]). It is easy to check that if we start with a monad, construct a Kleisli triple and obtain a monad from the Kleisli triple, then the monad we obtained is exactly the monad we began with. Also, if we start with a Kleisli triple, obtain a monad and construct a Kleisli triple from the monad, then the resulting Kleisli triple is the same that we began with. Thus, we have proven the following result.

Theorem 2.13. LetCbe a category.

(i) Given a monad(T , η, µ)onC, for each morphismf :XT(Y)inCdefinef :T(X)→

T(Y)byf =µYT(f). Then(T , η, )is a Kleisli triple onC.

(31)

2 . 3 . A L G E B R A S F O R A M O N A D

Moreover, (i) and (ii) are inverse of each other.

To conclude this section, we describe the morphism extension for the powerset monad presented in Example2.11.

Example 2.14. Consider the powerset monadP. For a functionf :X P(Y), we have

thatf :P(X)P(Y) is defined by

f(S) =[

x∈S

f(x),

for eachS∈P(X).

2.3

Algebras for a monad

Definition 2.15. Let (T , η, µ) be a monad on a categoryC.

(i) Analgebra ofT, or simply aT-algebra, is a pair (X, h) consisting of an objectX∈C and a morphismh:T(X)→X inC, which makes both diagrams

T2(X) T(X)

T(X) X

X T(X)

X T(h)

µX h

h

ηX

idX h

commute, i.e. hT(h) =hµXandhηX= idX. Also,Xis called thecarrier of theT-algebra andαis called theT-algebra structure.

(ii) Ahomomorphism ofT-algebrasf : (X, h)→(X, h′) is a morphismf :XX′ inC for which the diagram

T(X) T(X′)

X X

T(f)

h h

f

commutes, i.e. h′◦T(f) =fh.

(iii) The class of allT-algebras together with their homomorphisms and composition

as inCform a category known as the Eilenberg-Moore category ofT, denoted byEM(T).

Theforgetful functorU:EM(T)Cmaps eachT-algebra (X, h) to its carrierXand maps

(32)

In general, the algebras of a monad need not to be (isomorphic to) algebras in the usual sense of Universal Algebra [BS81]. Although every variety, regarded as a category, is isomorphic to the Eilenberg-Moore category of some monad [ML98, Theorem §VI.8.1]. The following example, which will be important throughout the text, describes the Eilenberg-Moore category of the powerset monad introduced in Example2.11.

Example 2.16. Consider the powerset monadP. For a setX and a functionh:P(X)X,

we have that (X, h) is aP-algebra if, and only if,

h([

S∈W

S) =h({h(S)|SW}) and h({x}) =x,

for any W ∈P(P(X)) andxX. Let (X, h) be aP-algebra. SinceP(X) is nonempty and

h:P(X)X, thenX is nonempty. Define a binary operationonX (calledjoin) by

xy=h({x, y}), x, yX,

and let≤be a partial order relation onXdefined by

xy ⇐⇒ xy=y, x, yX.

Then, (X,∨) is ajoin-semilattice(cf. [Grä11]). Moreover, the supremum, or the least upper bound, of any subset ofX exists and is given by

_

S=h(S), SX,

i.e. (X,∨) has arbitrary joins. And so (X,∨) is acomplete join-semilattice.

Also, a homomorphism ofP-algebrasf : (X, h)(X, h′) is a homomorphism of the

resulting complete join-semilatticesf : (X,∨)→(X,∨′), since

f(_S) =f(h(S)) =h′(P(f)(S)) =h′({f(x)|xS}) =_

x∈S

f(x)

for anySX.

Conversely, for a complete join-semilattice (X,∨), defineh:P(X)Xby

h(S) =_S, S∈P(X).

Then, (X, h) is a P-algebra. Also, a homomorphism of complete join-semilattices f :

(X,∨)→(X,∨′) is a homomorphism of the resultingP-algebrasf : (X, h)(X, h′),

be-cause

f(h(S)) =f(_S) =_

x∈S

f(x) =_′P(f)(S) =h′(P(f)(S))

for anyS∈P(X).

Therefore,EM(P) is isomorphic to the category of complete join-semilattices and their

homomorphisms.

(33)

2 . 3 . A L G E B R A S F O R A M O N A D

2.3.1 Generalizing morphism extension to the algebras of a monad

Let (T , η, µ) be a monad on a categoryC. For any object X ∈ C, by the associative law and left unit law in Definition2.10, (X, µX) is aT-algebra called thefreeT-algebra overX. As in Universal Algebra [BS81, Proposition II.§10.10], the freeT-algebra over an object X ∈Calso has anuniversal property[Man76, see 1.4.12], which we now present.

For instance, given a morphismf :XT(Y) inC, the diagram

T2(X) T3(Y) T2(Y)

T(X) T2(Y) T(Y)

T2(f)

µX

T(µY)

µT(Y) µY

T(f) µY

commutes, and so the extensionf =µYT(f) :T(X)→T(Y) off is a homomorphism of

T-algebras from (T(X), µX) to (T(Y), µY). The morphism extension can be generalized toT-algebras as follows.

Letf :XY be a morphism inCand let (Y , h) be aT-algebra. Define

fh=hT(f) :T(X)→Y .

Sinceµ:T2→T is a natural transformation and (Y , h) is aT-algebra, the diagram

T2(X) T2(Y) T(Y)

T(X) T(Y) Y

T2(f)

µX

T(h)

µY h

T(f) h

commutes, and thenhT(fh) =fhµX, which implies thatfh is a homomorphism of

T-algebras from (T(X), µX) to (Y , h). Also, the diagram

X Y

T(X) T(Y) Y

f

ηX ηY idY

T(f) h

(34)

Theorem 2.17. Let(T , η, µ) be a monad on a category C. Given a T-algebra (Y , h) and a morphism f :XY inC, fh =hT(f) :T(X)→Y inCis the unique homomorphism of

T-algebras from(T(X), µX)to(Y , h)such thatf =fhηX.

Proof. Let (Y , h) be a T-algebra and f : XY a morphism in C. As we saw above,

fh=hT(h) is a homomorphism ofT-algebras from (T(X), µX) to (Y , h) andf =fhηX. If g : (T(X), µX) →(Y , h) is a homomorphism of T-algebras withf =gηX, and since

µXT(ηX) = idT(X)by the right unit law in Definition2.10, then the diagram

T(X) T2(X) T(Y)

T(X) Y

T(ηX)

idT(X)

T(g)

µX h

g

commutes, henceg=hT(g)◦T(ηX) =hT(gηX) =hT(f) =fh.

Whenhis clear from the context, we write simplyf instead offh.

In the following example, we present the function extension for the algebras of the powerset monadP, see Example2.11.

Example 2.18. Given a setX, aP-algebra (Y , h) and a functionf :XY, thenf :P(X)

Y is defined by

f(S) =h({f(x)|xS}), S∈P(X),

and thusf is the unique homomorphism ofP-algebras from (X, µX) to (Y , h) such that

f({x}) =f(x), for allxX.

In other words, by Example2.16, considerP-algebras as complete join-semilattices.

Then, for a set X, the free P-algebra over X is in correspondence with (P(X),∪), the

complete join-semilattice of all subsets ofX together with set union. And for a complete

join-semilattice (Y ,∨) and a functionf :XY,f :P(X)Y is defined by

f(S) =_ x∈S

f(x), S∈P(X).

In particular,f is the unique homomorphism of complete join-semilattices from (P(X),∪)

to (Y ,∨) such thatf({x}) =f(x), for allxX.

2.3.2 Functor liftings to the Eilenberg-Moore category of a monad

(35)

2 . 3 . A L G E B R A S F O R A M O N A D

Definition 2.19. Let (T , η, µ) be a monad on a categoryC, and consider the forgetful functorU:EM(T)C. Given a functorF :CC, alifting ofF toEM(T) is a functor

b

F:EM(T)EM(T) such thar the diagram

EM(T) EM(T)

C C

b F

U U

F

commutes, i.e. UbF=FU.

Let (T , η, µ) be a monad on a categoryC, and letF:C→Cbe a functor with a lifting

b

F :EM(T)EM(T) toEM(T). For aT-algebra (X, h), observe thatF(X) is the carrier of

theT-algebrabF(X, h), and for a homomorphism ofT-algebrasf : (X, h)→(X, h′),F(f) is

a homomorphism ofT-algebras frombF(X, h)→bF(X, h′). In particular, for each objectX∈ C, there exists a morphismhX:T FT(X)→FT(X) inCsuch that (FT(X), hX) =bF(T(X), µX), and thushXηFT(X)= idFT(X)andhXT(hX) =hXµX. DefineρX=hXT F(ηX) :T F(X)→

FT(X) inC, for eachX ∈C. Letρ= (ρX)X∈C.

For any morphismf :XY inC, sinceT(f) is a homomorphism ofT-algebras from

(T(X), µX) to (T(Y), µY), thenFT(f) is a homomorphism ofT-algebras from (FT(X), hX) to (FT(Y), hY), and since η is a natural transformation from IdC toT, we have that the following diagram

T F(X) T FT(X) FT(X)

T F(Y) T FT(Y) FT(Y)

T F(ηX)

T F(f)

hX

T FT(f) FT(f)

T F(ηY) hY

commutes, which impliesFT(f)◦ρX=ρYT F(f). Hence,ρis a natural transformation fromT FtoFT.

Also, for anyX∈C, the diagram

F(X) FT(X)

T F(X) T FT(X) FT(X)

F(ηX)

ηF(X) ηFT(X) idFT(X)

T F(ηX) hX

commutes, because η is a natural transformation from IdC toT and (FT(X), hX) is a

(36)

Finally, for anyX ∈C, the diagram

T2F(X) T2FT(X) T FT(X)

T F(X) T FT(X) FT(X)

T2F(ηX)

µF(X)

T(hX)

µFT(X) hX

T F(ηX) hX

commutes, because µ is a natural transformation fromT2 toT and (FT(X), hX) is aT -algebra, and sohXT(ρX) =ρXµF(X). Also, sinceµXis a homomorphism ofT-algebras from (T2(X), µT(X)) to (T(X), µX), by the associative law (Definition2.10), thenF(µX) is a homomorphism ofT-algebras from (FT2(X), hT(X)) to (FT(X), hX), and sinceµXηT(X)= idT(X)by the left unit law (Definition2.10), the diagram

T FT(X) T FT2(X) FT2(X)

T FT(X) FT(X)

T F(ηT(X))

idT FT(X)=T F(idT(X))

hT(X)

T F(µX) F(µX)

hX

commutes, that isF(µX)◦ρT(X)=hX. Therefore, the diagram

T2F(X) T FT(X) FT2(X)

T F(X) FT(X)

T(ρX)

µF(X)

ρT(X)

hX

F(µX)

ρX

commutes, i.e. F(µX)◦ρT(X)◦T(ρX) =ρXµF(X), for every objectX∈C.

The previous results shows thatρis a distributive law ofT overF.

Definition 2.20. Let (T , η, µ) be a monad on a categoryC, and letF:C→Cbe a functor on the same category. Adistributive lawofT overFis a natural transformationρ:T FFT

such that the following diagrams

F(X) T F(X)

FT(X)

T2F(X) T FT(X) FT2(X)

T F(X) FT(X)

ηF(X)

F(ηX)

ρX

T(ρX)

µF(X)

ρT(X)

F(µX)

(37)

2 . 3 . A L G E B R A S F O R A M O N A D

commute, i.e. ρXηF(X)=F(ηX) andF(µX)◦ρT(X)◦T(ρX) =ρXµF(X), for allX∈C.

Let (T , η, µ) be a monad on a categoryCandF:C→Cbe a functor such that there is a distributive lawρ:T FFT. Given aT-algebra (X, h), observe that both diagrams

T2F(X) T FT(X) T F(X)

FT2(X) FT(X)

T F(X) FT(X) F(X)

F(X) T F(X)

FT(X) F(X) T(ρX)

µF(X)

T F(h)

ρT(X) ρX

FT(h)

F(µX) F(h)

ρX F(h)

ηF(X)

idF(X) F

(ηX)

ρX

F(h)

commute, and soT(F(h)◦ρX)◦(F(h)◦ρX) =µF(X)◦(F(h)◦ρX) and (F(h)◦ρX)◦ηF(X)= idF(X).

Hence, (F(X), F(h)◦ρX) is aT-algebra.

Also, for any homomorphism ofT-algebrasf : (X, h)→(X, h′), the diagram

T F(X) FT(X) F(X)

T F(X′) FT(X′) F(X′) ρX

T F(f)

F(h)

FT(f) F(f)

ρXF(h′)

commutes, and thus F(f) is a homomorphism ofT-algebras from (F(X), F(h)◦ρX) to (F(X′), F(h′)◦ρX′).

Therefore, we can defineFb:EM(T)EM(T), a lifting ofF toEM(T), bybF(X, h) =

(F(X), F(h)◦ρX), for eachT-algebra (X, h), andbF(f) =F(f), for each homomorphism of

T-algebras.

Finally, for any objectX∈C, note thatbF(T(X), µX) = (FT(X), F(µX)◦ρT(X)) and since

the diagram

T F(X) FT(X)

T FT(X) FT2(X) FT(X)

ρX

T F(ηX) FT(ηX)

idFT(X)=F(idT(X))

ρT(X) F(µX)

(38)

Theorem 2.21. Let(T , η, µ)be a monad on a categoryC, and letF:C→Cbe a functor on the same category.

(i) Given a liftingbF:EM(T)EM(T)ofF toEM(T), defineρX=hXT F(ηX) :T F(X)

FT(X), wherehX :T FT(X)→FT(X)is such that(FT(X), hX) =Fb(T(X), µX), for each

X ∈C. Then,ρ= (ρX)X∈Cis a distributive law ofT overF.

(ii) Given a distributive law ρ : T FFT of T over F, define Fb: EM(T) EM(T) by

b

F(X, h) = (F(X), F(h)◦ρX), for eachT-algebra(X, h), andbF(f) =F(f)for each homomor-phism ofT-algebrasf. Then,bFis a lifting ofFtoEM(T).

Moreover, (i) and (ii) are inverse of each other.

At last, we present a lifting of the functor 2×(−)Ato the Eilenberg-Moore category of the powerset monad.

Example 2.22. Consider the powerset monadP, see Example2.11, and the functorD=

2×(−)A:SetSet, see Example2.8(iii), where 2 ={0,1}andAis a nonempty set. Given aP-algebra (X, h), defineh1:P(2×XA)2 by

h1(S) = max{z|(z, f)∈S}, S∈P(2×XA),

and defineh2:P(2×XA)→XAby

h2(S)(a) =h({f(a)|(z, f)∈S}), aA, S∈P(2×XA),

and then we have aP-algebra (2×XA,hh1, h2i). Moreover, we have a liftingDb:EM(P) EM(P) ofDtoEM(P) defined byDb(X, h) = (2×XA,hh1, h2i), whereh1andh2are defined as

above for eachP-algebra (X, h), andDb(f) = id2×fAfor each homomorphism ofP-algebras

f.

In other words, if we considerP-algebras as complete join-semilattices (Example2.16),

we have that 2 ={0,1} is a complete join-semilattice where 0<1. For a complete

join-semilattice (X,∨), we obtain another complete join-semilattice onXAwhere join is defined pointwise. And thus,D(X) = 2×XA, being the product of two complete join-semilattices,

is a complete join-semilattice with join defined pairwise. Also, given a homomorphism of complete join-semilatticesf :XX′, then id2×fAis a homomorphism of the resulting

complete join-semilattices 2×XAand 2×(X′)A.

By Theorem2.21,Dbis in correspondence with a distributive lawρ:PDDP, where

ρX=hρ1,X, ρ2,Xi:P(2×XA)→2×(P(X))Ais defined by

ρ1,X(S) = max{z|(z, f)∈S}, S∈P(2×XA),

and

ρ2,X(S)(a) ={f(a)|(z, f)∈S}, aA, S∈P(2×XA)

(39)

C

h

a

p

t

e

r

3

C o a l g e b r a s

In this chapter, we introduce the notion of a coalgebra of a functor. We generalize some results of Universal Coalgebra (see [Rut00]) to coalgebras of a functor on an arbitrary category, instead of using functors on the category of sets. See also [Adá05;Jac12].

Throughout this chapter, we illustrate the main definition and theorems in exam-ples using deterministic and nondeterministic automata. In theses examexam-ples, we obtain well-known results from a coalgebraic point of view. See [Eil74;How91] for a classical in-troduction to the Theory of Automata. Moreover, in Chapter5, we will see these examples as concrete case of a general theory.

3.1

The category of coalgebras

In this section, we study some basic results in the category of coalgebras of a functor. The notion of a coalgebra of a functor comes from the duality with the notion of an algebra of a functor (see [JR11]).

Definition 3.1. LetF:C→Cbe a functor on a categoryC.

(i) Acoalgebra of F, or simply anF-coalgebra, is a pair (X, α) consisting of an object X ∈Cand a morphismα:XF(X) inC. Also,Fis called thetypeof the coalgebra,X is

called thecarrier of theF-coalgebra, orstate space, andαis called theF-coalgebra structure or thetransition structure.

Referências

Documentos relacionados

The Rifian groundwaters are inhabited by a relatively rich stygobiontic fauna including a number of taxa related to the ancient Mesozoic history of the Rifian

Enquanto professora de História da Educação no curso de Pedagogia da Uniouro, percebi que a produção de uma linha de tempo e a produção de um vídeo sobre esta linha de

Os resultados apontaram a ocorrência de quatro movimentos formadores de grande importância para a construção de saberes profissionais: observações do espaço escolar (fatores

Neste sentido, para contextualizarmos e compreendermos o funcionamento normativo-legal dos estabelecimentos do ensino secundário de STP e também conhecer as atividades e as

Porém, partindo de Heidegger, Dreyfus indicou a falha do cognitivismo ao apontar que a relação primordial do organismo em seu meio não se dá via representações: “em nossa

Outras diferen¸cas se encontram no fato dele n˜ ao utilizar uma cˆ amera para realizar o reconhecimento facial do usu´ ario, do dispositivo em desenvolvimento neste trabalho realizar

Por contraste, existem ainda alguns estudos que verificaram melhores resultados dos homens perante estímulos de faces masculinas, apesar de não terem sido replicados (Ellis,

The context of the present study is the development of systematic conservation planning and ecosystem-based management practices in the context of small islands, ensuring