184 27 35MB
German Pages 212 Year 1985
MATHEMATICAL MATHEMATISCHE RESEARCH FORSCHUNG
Structural I n d u c t i o n o n Partial A l g e b r a s
H. Reichel
Band 18 Akademie-Verlag • Berlin
In this series original contributions of mathematical research in all fields are contained, such as — research monographs — collections of papers to a single topic — reports on congresses of exceptional interest for mathematical research. This series is aimed at promoting quick information and communication between mathematicians of the various special branches.
In diese Reihe werden Originalbeiträge zu allen Gebieten der mathematischen Forschung aufgenommen wie — Forschungsmonographien — Sammlungen von Arbeiten zu einem speziellen Thema — Berichte von Tagungen, die für die mathematische Forschung besonders aktuell sind. Die Reihe soll die schnelle Information und gute Kommunikation zwischen den Mathematikern der verschiedenen Fachgebiete fördern.
Manuscripts in English and German comprising at least 100 pages and not more than 500 pages can be admitted to this series. With respect to a quick publication the manuscripts are reproduced photomechanically. Authors who are interested in this series please turn directly to the 'Akademie-Verlag . Here you will get more detailed information about the form of the manuscripts and the modalities of publication.
Manuskripte in englischer und deutscher Sprache, die mindestens 100 Seiten und nicht mehr als 500 Seiten umfassen, können in diese Reihe aufgenommen werden. Im Interesse einer schnellen Publikation werden die Manuskripte auf fotomechanischem Weg reproduziert. Autoren, die an der Veröffentlichung entsprechender Arbeiten in dieser Reihe interessiert sind, wenden sich bitte direkt an den Akademie-Verlag. Sie erhalten dort genauere Informationen über die Gestaltung der Manuskripte und die Modalitäten der Veröffentlichung.
H. Reichel Structural Induction on Partial Algebras
Mathematical Research • Mathematische Forschung Wissenschaftliche Beiträge herausgegeben von der Akademie der Wissenschaften der DDR Institut für Mathematik
Band 18 Structural Induction on Partial Algebras by
H. Reichel
Structural Induction on Partial Algebras Introduction toTheory and Application of Partial Algebras-Part II by Horst Reichel
Akademie-Verlag • Berlin 1984
Autor: Prof. Dr. Horst Reichel Technische Hochschule "Otto von Guericke" 3010 Magdeburg Boleslav-Bierut-Platz 5
Die Titel dieser Schriftenreihe werden vom Originalmanuskript der Autoren reproduziert.
ISSN 0138 - 3019
Erschienen im Akademie-Verlag, DDR-1086 Berlin, Leipziger Str. 3 (C) Akademie-Verlag Berlin 1984 Lizenznummer: 202 • 100/405/84 Printed in the German Democratic Republic Gesamtherstellung: VEB Kongreß- und Werbedruck, 9273 Oberlungwit Lektor: Dr. Reinhard Höppner Umschlag: Karl Salzbrunn LSV 1025 Bestellnummer: 763 363 0 (2182/18) 02600
P R E F A C E
O u r purpose in writing this book is a n Increasing use of partial algebras in computer science. W e hope to achieve this aim by the development of a special kind of partiality, the so-called equational
partiality,
as a sound mathematical basis for algebraic specifications using p a r tial operations and as one of several possible generalizations of the Universal Algebra to partial algebras. The book presents both the developed theory of equational
partiality
and its applications in algebraic specifications. The most Important concepts with respect to applications are the notions of a canon and of the recursive dependence within canons. The usefulness of partial
al-
gebras is proved by the fact that structural induction alone yields on partial algebras a complete formal calculus of abstract programs
on
abstract parameterized data types. The presentation of the complete theory o f ^ a r t l a l algebras is out of the range of this book. Therefore the author cooperates with Peter Burmeister in writing an "Introduction to Theory and Application of Partial Algebras" consisting of two p a r t s : Part I : "A Model Theoretic Approach to Partial Algebras" by Peter Burmeister , and Part II:"Structural Induction on Partial Algebras" by Horst Reichel. The content of the present book is the result of a long Joint work with Klaus Benecke, Ulrich L . Hupbach, and Heinz Kaphengst, a n d I am very thankful to these colleagues for that collaboration. I would also like to thank Rod Burstall and D o n Sannella for helpful discussions and suggestions during my Visiting Fellowship at' Edinburgh University made possible by a research grant of S E R C . Thanks are due to Wolfgang W e c h l e r for careful proof-reading end useful comments concerning the manuscript. Finally, I want to thank the Akademie-Verlag for friendly cooperation and quick
publication.
Magdeburg, October 1983
H.Reichel
S
C O N T E N T S
INTRODUCTION
9
1 . S P E C I F I C A T I O N OF A B S T R A C T DATA T Y P E S W I T H
PARTIAL
OPERATIONS 1.1. Abstract
13 data
types
- ADT's
1.2. Parameterized abstract 1 . 3 . The d e f i n i t i o n language
of
data
13 types
the-semantics
over a r b i t r a r y
- PADT's
of a
functional
P A D T ' s a s a complex example
2 . EQUATIONAL P A R T I A L I T Y 2.1. Set-theoretical
51 64
notions
65
2.2. Many-sorted algebras 2.3. Equationally
30
partial
67 heterogeneous
algebras
80
2.4. Hierarchy conditions
87
2.5. hep-varieties
97
and h e p - q u a s i - v a r i e t i e s
3 . P A R T I A L A L G E B R A S D E F I N E D BY GENERATORS AND R E L A T I O N S 3.1. Derivability
of
3 . 2 . Free p a r t i a l
algebras
3.3. Partial
quotient
elementary implications
homomorphisms
3.5. Relatively
free p a r t i a l
4 . CANONS -
126 136
algebras
146
I N I T I A L L Y RESTRICTING ALGEBRAIC THEORIES
4 . 1 . Canon model c l a s s e s 4 . 2 . C o m p u t a b i l i t y and d e f i n a b i l i t y abstract
data
types
4 . 3 . Canon morphisms
107 119
algebras
3 . 4 . Theorem of
106
158 159
on
parameterized 173 187
REFERENCES
196
T A B L E OF N O T A T I O N S
199
INDEX
202
7
INTRODUCTION
The main purpose of the book is the initiation of an increasing use of partial algebras in computer science. There are many reasons for the inadequate state of application of partial algebras. Probably, the bad reputation of the theory of partial algebras itself
causes that inad-
equate state. The theory of partial algebras was initiated for mathematical
rea-
sons more or less independently by 0 . Schmidt and his group and by 0. Slominski. In the years from 1965 to 1973 many important
results
were contributed by P . Burmeister, R. Kerkhoff, H. Hoft and V.S. Poythress. But this first and purely mathematical impulse did not initiate a continuously increasing development of the theory of partial algebras. The first results showed that a straightforward generalization of
the
theory of total algebras was not to be supposed. Many different generalizations of the concept of homomorphism, of substructure, and
of
validity of term equations were introduced, and it was not quite clear which of them would be the right ones. At this time there were not sufficiently many examples of partial algebras by means of which one could decide these questions. Meanwhile the extensively developed theory of small categories and to a greater extend the application of universal algebra in computer science act as motives for the development of the theory of partial algebras. In the present Part II of the 'Introduction to Theory Application of Partial Algebras'
we present a special theory of
and par-
tial algebras mainly oriented towards satisfying the requirements
of
applications of universal algebra in computer science and of the theory of small categories. The variety of possible generalizations of
the
theory of total algebras will be thoroughly discussed in Part I
' A
Model Theoretic Approach to Partial Algebras' by P. Burmeister. Next we try to explain the basic idea of the presented theory of 'EQUATIONAL PARTIALITY 1 . One reason for the frequent application of algebra in computer science is ths use of structural induction on free algebraic structures. Very often one has to define a mapping in a finite manner, where
M
is an infinite but finitely
f:M—» P
representable
set. A typical example of this problem is the definition of the semantics of a programming language. In this case the set all syntactically correct programs and
P
M
consists
of
is a set of state transfor-
mations of an abstract intarpreting machine. The finite representation of
M
is given by a phrase structure grammar.
9
A n application of structural Induction to define a function f: M
•
P
may be sketched in the following way: at first one has to
find a finite algebraic theory carrier set of an initial
T
said to be initial if for every fs A
— *
f: M — » •
B P
in such a w a y that
T-algebra
H
, where a
T-algebra
E
M
becomes
T-algebra
A
the is
exactly one homomorphism
exists. In the second step of the inductive definition of we have to define on the set
P
any
T-algebra
P
so
that the desired function is given by the uniquely determined homomorphism
f: M — •
T .
Intuitively a finite representation of an infinite set of a finite algebraic theory algebraic theory a finite set
&
T
T
M
by means
can be understood as follows: A finite
is given by a finite set
of operations and by
of axioms describing which combinations of the funda-
mental operations produce the same value. Among the fundamental operations the nullary operations have the function of atomic generating elements of
M , so that any element of
M
can be represented as
value of a finite combination of non-nullary operations applied
the to
atomic generating elements. If any two such combinations produce the same value then this must be a consequence of the axioms. In the simplest case the theory
T
can be chosen in such a way that the set
of axioms is empty. If we take the simplest non-trivial case, given by one atomic generating element, by one unary generating operation, and by an empty set of axioms, we get exactly Peano's axiomatization of natural numbers. Therefore, mathematical induction on natural numbers is a special case of structural
induction.
In the case of formal languages any production rule of a context free grammar, containing no non-terminal in its right hand side, can be Identified with a constant operation, or an atomic generating
element,
and any other production rule can be interpreted as a generating operation. The existence of different non-terminals corresponds in algebraic terms to different kinds of carrier sets, e.g. we have to use many-sorted or heterogeneous algebras. Combinations of generating
ope-
rations correspond to derivation trees. If the grammar is unambiguous the sets of derivable strings form a free heterogeneous algebra, so that the semantic meaning can be defined by structural induction. The definition of the algebra
B
, which is the range of the semantic
interpre-
tation itself, corresponds in the context of programming languages
to
a description of an interpreter by giving a semantic interpretation to every production rule. More detail in this direction can be found
in
the paper of Knuth (1968) or in a paper of Letitshevski (1968) and in the paper 'Initial Algebraic Semantics* of the ADO group (1975). H o w . ever, the syntactic structure of existing programming languages cannot be
10
completely described In an adequate w a y by context-free grammars.
In
general, most production rules are restricted by so-called context conditions. Algebraically we have to Interpret a production rule with
a
context condition as a partial operation with a necessary and sufficient domain condition. The same phenomenon can be observed in small categories. Small categories have exactly one partial operation, namely the partial composition of morphisms. A n d again, the partial binary operation is equipped with a necessary and sufficient domain condition. The product x«y
exists if and only if the target object of
source object of
x
is equal to the
y .
According to these observations in the theory of equationally partial algebras we equip each operator with a necessary and sufficient domain condition, which is given by a finite set of term equations. A total operator Is then an operator equipped with a trivial domain condition, for instance with the empty set of term equations. W e shall develop the theory of equationally partial structures in such a way that the notions and results of total algebras will be reproduced if every operator has a trivial domain condition. W e shall prove that a certain syntactic hierarchy condition for the domain conditions signatures (or of heterogeneous operator schemes) is necessary and sufficient for a nice and simple theory of equational partiality. W i t h approach we can describe the Inductive power of production rules of real programming The application of structural
this
context-restricted
languages.
Induction on partial algebras will
be demonstrated in Chapter one by specifications of several abstract data types and of parameterized abstract data types containing
partial
operations. W e present these applications of structural induction
on
partial algebras without any preceding theoretical explanations in order to show that those specifications are not significantly harder then specifications using total operations only. In the following three chapters we develop thoroughly the algebraic foundations of structural induction, of parameterized abstract data types with partial operations, and of functional enrichments of parameterized abstract data
types.
In Chapter two we develop the algebraic theory of equational partiality. The basic notions are hierarchical equationally partial signatures (hep-signatures), hep-signatures with elementary
implica-
tions as axioms, and finally hep-quasi-varieties as classes of models of hep-signatures with elementary implications. It will be shown that
11
due to the hierarchy condition of the eyetem of domain conditions the weakest concept of homomorphism between partial algebras 19 sufficient for the development of a sound theory of equationally partial algebras that for instance completely reflects the structural behaviour of small categories. In this respect Chapter two mainly contributes to the Universal Algebra of partial algebras. Chapter three develops the algebraic foundations of structural induction on partial algebras. It is mainly based on the existence of partial algebras that are freely generated by sets of generators and sets of defining relations on the generating elements. This concept, well-known in the theory of groups, is the algebraic key for a' powerful and flexible approach to structural induction which works as well for total algebras as for partial algebras. This concept can also be used for constructions of partial quotient algebras. The theorem of homomorphisms in Section 3.4 represents the most significant difference in the structural behaviour of total algebras and of equationally partial algebras . In, Chapter four we deal with classes of equationally partial algebras that are exlusively motivated by semantic problems of parameterized abstract data types and by functional enrichments of parameterized abstract data types. These model classes are defined by so-called CANON's , or by initially restricting algebraic theories. On the basis of this concept we define computable enrichments and definable enrichments of canons
and prove some necessary conditions for definable and
for computable enrichments of canons. In the last section we show how canons and canon morphisms can be used for the definition of the semantics of constructions that compose complex
specifications from simpler
ones. Finally we consider constructions like instantiations of parameterized abstract data types that preserve computable enrichments of canons.
12
CHAPTER
1
SPECIFICATIONS OF ABSTRACT DATA TYPES WITH PARTIAL OPERATIONS 1.1
Abstract Data Types
-
ADT's
In connection with investigations of modularity concepts of large software projects the understanding of the data type concept was essentially modified. W h e r e a s in programming languages like A L G O L 60, PL/1, and PASCAL a data type is considered to be a set, at least since
the
early seventies it seems to be generally accepted that data types are not just sets, but sets equipped with operations. For instance, if
we
deal with strings the following operations can be considered to be
rel-
evant: r
equal(String,String)
— B o o l
append(String, Character)
— S t r i n g
interlock(String,String)
— S t r i n g
contained(Character.String) length(String) empty
— •
—•>
Bool
Nat
— S t r i n g
Here we see that four different kinds of objects occur which are .characterized by the type names 'Bool', 'String 1 , 'Nat', and
'Characters',
respectively. This situation can algebraically be represented by 4-sorted algebra A
Bool
=
A
• ANat
=
"
(set
Characters = < a ' b ' c ^Characters
'
ar,
a
consisting of four carrier sets , namely natural numbers), •
and
A
string =
8et
of
d which consists of six fundamental
equalA: A s t r ± n g X A s t r l n g
—
appendA: A g t r i n g X A c h a r g c t e r s interlock: A s t r ± n g X A S t r i n g
a11
strings over
operations:
A0ool — -
Agtring Agtring
A
contained
X AStplng
lengthA: A s t r i n g
—
emptyA: {0}
AString
Depending on
: Acharacterg
on
— *
A
ABool
Nat
the choice of the actual alphabet, i.e. depending
the interpretation of the type name 'Characters', we would
different concrete data
get
types.
13
The example demonstrates that a concrete data type can be identified with a many-sorted algebra. But this understanding is not sufficient t«^ put into practice the suggestion of Hoare (1972) : "In the development of programs by stepwise refinement the programmer is encouraged to postpone the decision on representation of his data until after he has designed his algorithm and has expressed it as an abstract program operating on abstract data." The problem consists in finding a precise definition of an abstract data type and of an abstract program operating on an abstract data type. The fundamental idea in abstract data type specifications is the mathematical presentation of an abstract data type by a class of behaviourally equivalent many-sorted algebras. In the literature on abstract data types there are several different definitions of behavioural equivalence. Here we use the mathematically most simple version of equivalence which considers many-sorted algebras as behaviourally equivalent if they are isomorphic. In Chapter four
we will make precise the no-
tion of an abstract program operating on an abstract data
type.
However, there are many very different interpretations of the preceding scheme
(») which have nothing in common with the intended model
of strings over an alphabet. Although schemes of the form
(*)
are
used in the programming language ADA as specification part of a package it has no semantics. In
ADA the semantics of a package is given by the
implementation, or by the body of the package. This approach does
not
represent the behaviour of an abstract data type by the description of the properties of the available manipulation functions, but by giving a representant of the behavioural class defined in terms of
other ADA
packages and of the basic types and basic functions of A D A . A
disadvan-
tage of this approach can be illustrated by the following example. If the natural numbers w o u l d be represented by the special model of Roman numbers, i.e. I,11,111,IV,V,VI,...
, everybody sees the difficulties in
discovering the distrlbutlvlty law of addition and multiplication of natural numbers. Therefore we prefer axiomatic tools in descriptions of the external behaviour of abstract data types. Since our aim is the demonstration of the usefulness and
feasibility
of structural induction on partial algebras we will not explain the fundamentals of algebraic specifications of abstract data types. Readers who are not familiar with the basic ideas should consult the paper 'Introduction to Data Algebra* by S.N. Zllles in LNCS 86 (198o) or 'A Look at Algebraic Specifications' by the same author (see S . N . Z l l les (1981)) .
14
Coining back to the preceding example one can easily check that the intended interpretation satisfies the following properties expressed by the equations; length(empty) • 0 length(append(w,x))« length(w) + 1 interlock(w,empty) = w interlock(w,append(v,x)) where
w,v
" append(interlock(w,v),x)
are variables for strings and
x
is a variable for
characters. The next
interpretation of the scheme
(*) shows that the system
(mm) of equations is not strong enough to exclude all those interpretations which are not isomorphic to the intended interpretation. Let the interpretation B
B
" length B (f) = f(x) Q
equal (f.g) »
B
'
'»"ctions
with
B
strings. Evidently,
Nat ° ANat "
Characters
set
The interpretation
0
•
h(x) - f(x) • g(x), x 6 B c h a r a c t e r s f(x) f 0
iff
for x e B_. iff f(x) - 0 Characters overall xe B c h a r a c t e r s
T
iff
f(x)-8(x)
forali
F
iff
f(x)+g(x)
for some
x eBcharacters xe B c h a r a c t e r 8
represents multi-sets and does not
A
and
B
B
but not by
,
represent
are not isomorphic since there is
equation which is satisfied by append(append(w,x),y)
,
an
A , namely
= append(append(w,y),x).
This example indicates that we need an additional tool for excluding undesirable
interpretations.
This additional exclusion of interpretations will be done by the concept of
equations, if of (««) G
of axioms. Informally we can say
"initial satisfaction
an interpretation C
C
of
(*)
initially satisfies the set
that
(*»)
of
satisfies only those equations which are consequences
. W h e r e an equation
tj = t 2
of equations if every algebra
D
is called a consequence of a set satisfying
each equation
in
G
15
also satisfies
"
* Interpretation
B
shows that the equation
append(append(w,x),y) = append(append(w,y),x) is not a consequence of
(*•), so that
the set of equations given by
B
does not initially satisfy
(«•).
A s next we will make the concept of initial satisfaction
more pre-
c i s e . Readers wanting a more detailed explanation should look
into the
paper 'An Initial Algebra Approach to the Specification, Correctness, and Implementation of Abstract Data Types' of the ADO group ( see AD3
(1978)). In terms of universal algebra one can say that an algebra
scheme
(«)
initially satisfies
scheme
(•)
satisfying
fJ C
• D .
(••)
(««)» iff for every
C
algebra
of D
of
there is exactly one homomorphism
Obviously any two algebras are isomorphic if they ini-
tially satisfy
(**) . This shows that initial satisfaction
fits for
specifications of isomorphism classes or in other words for definitions of abstract data types. But, it was shown by Bergstra and Meyer (1983) that there are very simple abstract data types that are not specifiable by finite sets of equations. They show that the set of all finite subsets of natural numbers with the cardinality function may serve as such a counterexample. A finite specification of that data type requires conditional equations of the form «1 "
r
e
l
n "
r
n
— *
« - r .
A s next we introduce the syntactic form for writing
specifications
of abstract data types by means of a simplified version of strings. STRING
is definition sorts
Nat, String, Characters
oprn
zero
> Nat
succ(Nat)
*• Nat
a,b,...,y,z
— •
Characters
append(String .Characters) length(String) axioms
w,v:Strlng,
• String
• Nat
x:Characters
length(empty) = zero length(append(w,x)) = succ(length(w)) interlock(w,empty) = w interlock(w,append(v,x))=append(interlock(w,v),x) end STRING
16
The key-word definition indicates initial satisfaction for the following axioms. After the key-word sorts the new sort names follow which correspond to the specified data types. After the key-word oprn the sequence of fundamental operators follow, where in brackets, following the operator name, the number, the ordering and the required sorts of the arguments of that operator are declared by an n-tuple of sort names. The sort name after the arrow declares the result sort. This notation is intentionally similiar to function declarations in programming languages. This implies that in the preceding specification 'zero —*• Nat* denotes a constant of type 'Nat',i.e. an operator without any arguments that produces an object of type 'Nat', and that append(String, Characters)
•
String
denotes an operator which needs two arguments, the first is of sort 'String' and the second of sort 'Characters', and the resulting value is again of sort 'String'. a,b,...,y,z —»Characters declares a set of constant operators with the names a,b,...,y,z all of type 'Characters'. After the key-word axioms the declaration of the variables follows that are used in the following axioms. In the preceding specification each axiom is an equation. A verification of the specification STRING would require the proof initiality of the interpretation which is suggested by the chosen names of sorts and of operators.
of
The next example illustrates the use of conditional equations by a specification of the set of natural numbers, of the set of all finite subsets of natural numbers equipped with the cardinality function. CARDINALITY is definition sorts oprn
Nat, Sets, Bool zero — • Nat succ(Nat)
— *
true, false eq(Nat.Nat) 0 • Sets Sets U {Nat}
Nat *• Bool »• Bool Sets
card(Sets) »• Nat N a t e Sets • Bool axioms x,y: Nat, m: Sets eq(x,x) = true eq(x.y) = eq(y.x) eq(zero,succ(x)) = false oq(x.y) = eq(succ(x),succ(y))
17
(m U {x}) U {x}
-
(m U {x}) U Rseq
Nat
Rseq
*• Bool
add(x:Nat,r:Rseq iff x £ r) axioms
x,y: Nat,
Rseq
r: Rseq
x $ nil if x ^ r
then
y £ a d d ( x , r ) • eq(x,y)
end EXAMPLE1 In the specification
EXAMPLE1 the specification
NAT
is used as
prerequisite. In this w a y complex specifications can be written by stepwise enrichments of presupposed
specifications.
Of course, this example could also be specified with a total adding operator. In this case we w o u l d have to add a new axiom that guarantees that the addition of a natural number does not change the sequence if
x£ r
then
n
contained in the sequence
r
r , i.e.
add(x,r) » r
A n o t h e r w a y of making the adding operator to a total one would be the use of a so-called error value, as it was suggested by Goguen The resulting specification EXAMPLE2
is
NAT
(197^,
is then:
with definition
sorts
Rseq
oprn
nil error
•
Rseq >
Rseq
19
add(Nat,Rseq) axioms
x,y: Nat,
Reeq
r: Rseq
x IN
x • 0 and equal.
with
while(l) = while(2) = ... = while(x) = ...
Since there is no axiom that implies the equality of
while(l)
. with
any natural number, the initiality of the enrichment by definition in WHILE*
causes the creation of 8 new object of sort
a new object contradicts meter of
WHILE*
M .
The creation of
the persistency so that not each actual para-
can be extended to a model of
We hope that the similarity of the axioms in
WHILE*. WHILE
with the ordi-
nary explanation of the semantics of a while-statement has been observed. We interpret this similarity as a justification of the introduced calculus of functional enrichments of PADT's. Before we will deal with the actualization of formal parameters of an initial canon we specify a further example for which the class of actual parameters is of greater interest than in the previous specifications . The object of the specification is some kind of an inhomogeneous storage. For this inhomogeneous storage besides the sets of addresses and values a set of types and some additional functions may be given that associate with each address and with each value an object of sort 'TyDe'. In addition the equality of addresses may be given. This system of sets and functions is considered as a parameter of the inhomogeneous storage. O n the basis of that parameter we define the set of all states of the storage and we define
store- , read- , and
operations. For these operations we assume that a value stored by an address
a
only if
a
and
x
x
remove-
can be
are both of the same type.
Evidently, one can only read a value by an address, if before under that address any value has been stored. These requirements imply
that
both operations become partial ones. The remove-operation will be spe-. cified as a total operation that will not change the state of the
43
storage if we try to remove an information by an address under which before no value has been stored. STORAGE
¿s
BOOL
with
requirement
sorts
Address, Value, Type
oprn
a-tvpe(Address)
Type
v-type (Value)
equal(Address.Address) axioms
'
• Type •>
Bool
a.aj.ag! Address
equal(a,a) = true if
e q u a l ( a 1 ( a 2 ) = true
then
aj = a^
with definition sorts
Storage
oprn'
initiate
»
Storage
written(Address,Storage)
»
Bool
store(Storage,a :Address,x:Value iff
a-type(a) = v-type(x) )
—r-Storage
read(a sAddress ,s tS'orage iff
written(a.s) = true )
remove(Address»Storage) axioms
Address,
Value
Storage
s: Storage,
x,y: Value
written(a.initiate) = false if writtenfaj,s) = false, a - t y p e ( a 2 ) = v-type(x) writtenfa^storeis.Bg.x))
then
= equal(a1#a2)
if a-type(a)=v-type(x), a-type(a)=v-type( y)
then
store(store(s,a,x) ,e,y) = store(s,a,y) if a-type(aj)=v-type(x), a - t y p e ( a 2 ) = v-type (y)
f_l _f_i
then
store(store(s,a^,x),a2,y)=store(store(s,a2,y),a1#x) if a-type(a) = v-type(x)
then
remove(a,store(s,a,x)) = s
fi
if written(a.s) = false then
remove(a.s) = s
if a-type(a)=v-type(x)
read(store(s,a,x)) = x
then
end STORAGE In this specification explicit
domain conditions within the declara-
tion of the partial operators are used as distinct from the initial canon
WHILE
. Therefore we payed attention that no additional domain
conditions are caused by the axioms. By means of the actualization of the parameter part one can derive different kinds of storages. It is important that actual parameters themselves may be PADT's .
44
PADT's. This possibility enables stepwise refinements of
In the following the abstrect storage will be actualized by setting the disjoint union of the sets of integers, truth values, and strings over an arbitrary alphabet for the parameter sort
'Value'. The parame-
ter sort 'Address' will be actualized by a set of strings overs a p o s sibly different alphabet, and we will finally set the two-element {static,dynamic} functions
for the parameter sort
'a-type'
and
'v-type'
set
'Type'. Therefore the attribute
associate with each address and
each value one of these both attributes. This actualization uses another parameterized abstract data type as actual parameter so that by further actualizations both the set of characters of the strings that form the addresses and the set of characters that form a part of t£e values may by actualized. To achieve the sketched actualization we specify at fi rst the actual parameter. PARAMETER1
¿s
NAT
with
requirement
sorts
Character
oprn
c-eq(Character,Character)
axioms
-
Bool
x,y: Character
c-eq(x,x) = true if
c-eq(x,y)=true
then
x=y
with definition sorts oprn
String nil
»
String
append(String.Character)
»
s-eq(String,String) axioms
x,y: Character,
String
Bool u,v: String
s-eq(u,u) = true s-eq(u,v) = s-eq(v,u) s-eq(u,append(u,x)) = false s-eq(append(u,x),append(v,y))
= (s-eq(u,v)
c-eq(x.y))
with definition sorts oprn
Union, Kind static, dynamic
•
b-inj(Bool) n-inj (Nat.)
axioms
Kind
Union •
Union
s-inj(String)
»
Union
u-attr(Union)
•
Kind
x: Bool, y: Nat, v: String
u-attr(b-inj(x)) = static u-attr(n-inj(y)) = static u-attr(s-inj(v)) = dynamic end PARAMETERl
45
For an actualization of the parameter sort 'Character' in the initial canon
PARAMETER1
Initial canon PARAMETER2
_is
BOOL
sorts oprn
we define a special set of characters by
the
PARAMETER2. with definition
A a,b,c
»
A
2-eq(A,A) axioms
•
Bool
x: A
2-eq(x,x) = true 2-eg(a,b) » 2-eq(a,c) = 2-eq(b,a) = 2-eq(b,c) = 2-eq(c.a) = * 2-eq(c,b) » false end PARAMETER2 A f t e r the specification of a as actual parameters afterwards
PAOT
and an
ADT
that will be used
we introduce the last operation
for
the construction of an initial canon. This construction in called 'Mpdlficatlon'. The general syntactic scheme of a modification is the following: is
adlf led [ by
(+)
end such (i) ( Ü )
(ill)
for
s:
for
s;
for
6*
for
6"
(t2 J
according
X
that: S*..
, ,s are sort names of the initial canon
6*,.. ..6 1
and """
are operators of the initial canon S_ "j
for
sorts
operators of (iv)
1'
' t 2 :
u
2
u
i —
•
T h e e
r0
—
v
, where B
o • u , g: u
—e—» u
be
s u l t of the composition is 2
*
The looping construction requires three arguments, p: u f: "
ui#
, can
o »
Bool,
and corresponds to the well-known con-
struction 'while
p
do
f
else
g' : u
o » u
.
51
The arguments of the looping construction have to satisfy the following conditions. The input tuples of all three arguments are of equal type, given by
u , the output sequence of
given by
'Bool', and the output sequences of
to the common input sequence of
p
is the sequence of length one f
and
g
are equal
p.f.g •
The branching construction corresponds to another well-known construction of programming languages, namely to
where
'if p
then
p: u
o
g
else
- Bool,
f
g: u
—o
» v,
guments. Again it is required that
f: u
p,f,g
o > v
are the ar-
have equal input sequences,
and that the sequence of length one 'Bool' is the output sequence of p .But now we require only that
f and
g
have equal output
which may be different from the common input sequence of
sequences p ,f , g .
The source tupling is applicable to any finite sequence of tuplefunctions tl,
u
— e —
t2: u
—
v
tns u
2
—
with a common input sequence. The result is the tuple f
n):
u
v
where the output sequence v
the output sequences
1
'
,,,v
v
r
function
2 '"''v n
i 2'*'vn
v
—
v
1 v
i» 2'"
: u
' B
Bool
Operators =
, target =
A
B
),
B = target ,
{ t r u e , f a l s e } , A g o r t s « = sorts( B
A A A A A and nil , app , length , concat , and val empty sequence of sort names of
B
)*,
are interpreted as the
, as the appending of a sort name
to a given sequence of sort names, as the length of sequences of sort names, as the concatenation of sequences of sort names, and as the selection of
the i-th component of a sequence,
respectively.
57
The interpretation of the remaining sorts
F
and
F*
remaining operators is the kernel of the definition of We start with the definitions of the sets
i
Ap
A
the
Apm
:
A
(B,_t: w
o • u)
| such that
B
is an enrichment by
definition B ,on andAB 1_t: is a w-term oftuple J w
o
and
and of
semantics.
A F « = { ( B , t* J w
o •
UjjCUjiX.. ,#u r )
enrichment by definition of M _t : w B
o »
uj#...#ur
with
o » u
, and
B
with
| such that
w,u e sorts(B )* B
is an
, and
is a w-term tuple sequence on w,u1,...,ur€
sorts(B ) } .
The interpretations of the operators 'in','out','in*' are naturally defined by A
a
in (B,Jr: w
o «• u) = w ,
A
o u t ( B , _t: w
o »
u) = u
,
A
( i n * ) ( B , tf J w — e - » Since the sort
F*
. .#u r ) = w .
represents only an auxiliary construction of
special sequences of w-term tuples the interpretation of the operators 'first' and 'add' is naturally given by f i r s t A ( B , t: w where
w
o •
u
o »
u) =
t*: w
o -
u)
is interpreted as w-term tuple sequence of length
one, and a d d A ( ( B 1 , tj: w - e — with ® 2 ' - 2 :
= such that
u ^ . . .#u p ), ( B 2 , t s w - » — > w
° *
length(_t*) = length(t*)+1,
1 £ i ^ r = length(t*),
u)) =
and
,t|(i) = I*(i)
for
t*(r+l) = t .
The most interesting part of the definition of the semantics is the interpretation of the operators
"base",'compose','prj'loop','branch*,
'away', and 'tuple' since these operators represent the constructions of
tuple-functions.
Semantics of
'base":
For each operator B
58
we define
6: w
o - S
in the signature of the initial canon
base A (5) = ( B , 6 : w
S)
where the operator is considered as a term over B , and that term is considered as a w-term tuple of one component. Semantics of
'compose':
The elements
(Bj,^:
— e - ^ - U j ) , ( B j , t 2 : v»2
o - u 2 ) of A p are A in the domain of the partial composition ,compose , if and only if
Uj = Wg . In that case we set compose A ( ( B j , t^ : w x
o >
u^)
a ( B ^ with B 2 . t: Wj with
t(i) = [l 2 (i)T (t^) [.^(^(Ii)-'
w
for u
l
t,2(i) :
o »
u2(i)
o •
2
u2)) =
u2)
1 *i^length(u2),
where
( i )
denotes the term that results from simultaneous substitution of
o ,»
^ 2 (i).: u^
^(j)
for each
j
o »
u2(i)
by the
for the J-th variable in with
1
J, ^ length (Uj) .
We demonstrate this composition of w-term tuples by a simple example Let
= (g.c.d: Nat X Nat — N a t ,
Jt2 = (less: Nat X Nat — • l.c.m: N a t X N a t — * be term tuples on
Nat)
and
with
_t2
Nat,
Nat)
NAT with BOOL. The composition of
yields a term tuple triple
plus: Nat X Nat — p -
Bool, times: Nat X Nat — p -
NatXNat
Bool X Nat X Nat
( y ^ y g . y j ) £ {true, false } X »1 X U
^
that produces
for each pair (x,y) E H
a X
»
in such a w a y that yj = g.c.d(x.y) t 3 : w w) A be given arguments of the partial operation 'loop ' contained in the domain of that partial operation. Then the intended semantics the substitution of the parameter sort by the sequence p(M)
o » w
o »
M
requires
in the intial canon
WHILE
w e sorts( B )* , and of the parameter operators
Bool , f(M)
o •
w, _tj : w
o > w
M, g(M)
o » M
by
tj : w
o -
Bool,
respectively.
This kind of modification requires a slight generalization of the modification of initial canons as defined up to now. On the left-hand side of a modification list we permit now sequences of sort names and w-term tuples of the modified canon. With this generalization we are able to define l o o p A ( ( B l t tjsw — B o o l ) , ( B 2 , _t2:w - e - » w) . ( B j , _t 3 :w — e - » w) ) = = (WHILE modified by ( B x wi.th B w
for
2
with B ^ )
according
M
for
P
t 2 for
f
for
g
end , w h i l e : M
o »
M )
If the semantics of the loop-construction should be given by the following flowchart, then this change in the semantics of the loopconstruction can easily be realized by the use of a corresponding tial canon
LOOP
defined in the
ini-
following.
61
The kernel of the changed definition of the semantics is the specification of the initial canon LOOP
is
BOOL
LOOP.
with requirement
sorts
M
oprn
p(M)
o •
f (M)
—
g(M)
Bool M M
with definition oprn
loop(M)
axioms
o - M
x: M
if
p(f(x)) = false then
iL
P(f(x)) = true, loop(g(f(x))) - loop(g(f(x)))
loop(x) = f(x)
loop(x) = loop(g(f(x)))
then
fi
end LOOP Using this specification we define l o o p A ( ( B l f tjsw
Bool) , ( B 2 , tz-.\N - « — w ) , ( B 3 , t 3 :w - e — w) ) =
= (LOOP modified by ( B t with E ^ with B , ) according w for M for
lz Semantics of
P
for
f
for
g
end , loop: w
o » w )
'branch':
The semantics of the branch-construction will be defined in the same way as the semantics of the loop-construction. Evidently, we have
to
use another initial canon. We start with the specification of the initial canon
BRANCH.
BRANCH
BOOL
¿s
with requirement
sorts
P,M
oprn
p(P)
o m Bool
f(P)
M
g(P) - e —
M
with definition oprn
branch(P)
axioms
end
62
—e—-
M
x: P
if
P(x) = true, f(x) = f(x) then
If
p(x) = false, g(x) = g(x) then
BRANCH
branch(x) = f(x) branch(x) = g(x)
Using this specification w e define b r a n c h A ( (IBj, B l t tjiw ^ :w — e — Bool) Bool). , ( B g i, .tgiw — e — u ) , ( B 3 , _ t 3 : w ( BRANCH modified by ( B t with B ^ with B ^ ) w u
¿2 ¿3
for
P
for
M
for for
P f
for
9
end , branch: P
—*-»-u))
according
o »
M )
The preceding semantics of the branching does not assume the applicability of both a l t e r n a t i v e s . Therefore, a further conceivable tics of the branching could be given by the following
is
BOOL
sorts
requirement
P,M
oprn
with
with
seman-
specification
p(P)
o »
Bool
f(P)
M
g(P)
M
definition
oprn
branch*(P)
axioms
o »
M
x: P
if p(x)=false, f(x)=f(x), g(x)=g(x) then if p(x)=true, f(x)=f(x), g(x)=g(x) then
branch*(x)=g(x) branch*(x)=f(x)
end The initial canon
BRANCH*
presumes the applicability of both alterna-
tives and of the branching condition as sufficient domain condition of
,
branch*(P)
ment in
• o » M ' , and due to the initiality of the last
BRANCH*
The homomorphism algebra
A
is
enrich-
this condition is also a necessary domain condition. f: 1 ( 2 )
» A
uniquely
not surjective, i.e. not
is the meaning of an abstract
any
defined by the semantic ( B , t: w
o -
u)
tuple-function.
Finally w e repeat that it is not the aim of this section to introduce a functional language and to contribute to the research work on functional programming, rather than to demonstrate the applicability of structural induction even if the generating constructions are not defined for all arguments, and to use for this demonstration a non-triviaL example.
63
CHAPTER EQUATIONAL
2 PARTIALITY
Whereas in the first chapter it is shown that there are strong motivations for the development of a theory of equationally partial manysorted algebras, the following chapter develops the algebraic basis of the preceding use of structural induction on partial algebras. A c c o r ding to that aim the following two chapters are a contribution to the universal algebra of partial algebraic
structures.
The existence of different sorts of elements in all examples of Chapter one is algebraically reflected by the U9e of many-sorted algebras (or heterogeneous algebras as they are called by Birkhoff
and
Lipson (1970)). However, the use of many-sorted algebras causes some notational difficulties. These notational problems could be considerably reduced if we were to use the mathematical language of category theory, but this language is a very abstract one and the uses of abstraction to achieve generality are not the same as in other branches of math-ematics and computer science. The theory of categories is a very useful and powerful tool in the hands of a well-trained
mathematician.
Because most mathematicians and specialists in computer science are not familiar with the basic concepts of category theory, we will not use this tool here. Readers who are interested in category theory should consult the famous book
' Categories for the working mathematician'
by
MacLane (1971) or a recent paper of Goguen and Burstall (1983) . In the following we will use the traditional language of sets,
functions,
operations, relations, and so on. We deal mostly with S-index and functions between S-indexed families of sets, where
S-
families
represents
the set of different sorts of objects. To overcome the notational problems of many-sorted algebras we introduce in the first section the underlying set-theoretical
notions
and concepts. In the second section we Introduce the concepts of total many-sorted algebras, of partial many-sorted algebras, of homomorphisms and of so-called existence equations. The third section is devoted to defining the concept of equational partiality and equationally partial algebras. The fourth section deals with hierarchy conditions for both systems of domain conditions of operators and sets of axioms. It is proved that hierarchical systems of domain conditions are necessary and sufficient for the definition of substructures by the requirement that the inclusion forms a homomorphism. This implies that for this
64
theory only one concept of homomorphlsm is necessary to yield a' nice theory of structure. On the basis of the results of the fourth section we introduce in the last section of this chapter hierarchical equationally partial varieties, briefly hep-varieties, and hep-quasl-varieties. The class of small categories turns out to be a typical example of a hep-variety.
2.1
Set-theoretical Notions
A s usual w e denote eeta by capital letters, elements and functions by small letters. For finite sets the elements which belong to the set can also be given within brecee. Let
S
be a n y finite set. A n S—Indexed family
sets will briefly be called and family an A
f - (fg: A s — B
S - f u n c t i o n or and
any
B
are
seS
9
|
S-set.
seS)
A • (A
| s€S)
Correspondingly, an
of
S-indexed
of functions will briefly be
called
S - m a p p i n g . If it is evident from context that
S - s e t s , we denote an S-function by
the set
A
and thNe mapping
S
the 8-component of the
S-set
A
f : A 8
and of the
fi A «• B
9
8
S-mapplng
*
both
B .
For
will be called f: A
B
respectively. Let main x
fs A A
of
• B
g: B
denoted by
f: A » C
a n y element of the do-
fgs A
> B
will be denoted by
xf£ B .
If addi-
is a further mapping, the composition will be • C , sometimes also by
application of the composition to any xfgec
xeA
» B . The element that is assigned to the element
by the function
tionally
be a n y function and
ft A
o r by
xeA
fog: A
- C .
The
is then denoted by
(xf)geC
if we want to stress the successive application of
f
and
g . This
notation is compatible both with the diagrammatic and the applicative order of the composition. W e hope that readers will not be confused irritated by the use of
xf
instead of
f(x) .
Very often w e have to deal with sets of variables taking values an
S-set
or
in
A » (A g | s e S ) . In this case the particular s-component in
w h i c h each variable we define an
xeX
can take on values must be fixed. Accordingly
S-sorted system of variables as a mapping
Now, any
xeX
v: X
S
can take on values in
in an
S-set
A • (A8 | s e S )
v: X
» S .
o n l y . A n assignment of is therefore given by a
65
function
ouch that
x£6Axv
for each
xeX.
Ay
denotes the set of all assign-
ments of the S-sorted system of variables
vs X
» S
In the
S-set
A - (A9 | s e s) . Let v: X
any
V
A
The mapping
B
v —
v
fv: A v
assignment
* Bv
af^eB^
» S
S-function and
S-function to a function
x(afv) - ( * £ ) f x v 6 B x v
by setting
the
be any
S-sorted system of variables, then we can extend in a
natural w a y the
vj X
• B g | 8 6 S)
f - (f 8 s A a » S
S-set
f: A
every
xiX, a e A
y
transforms any assignment
of the same
in the
S-function
for
.
££
A
to
v
an
S-sorted system of variables
B • (Bs | s e S )
by pointwise application of
- B .
For the sake of simpler formulae we allow the subscript to be omitted from the functions
f :A 8
• B
8
,f : A
8
V
s
and
- B
V
v
V
respectively« if this subscript can easily be derived from context. M n«W
'-{0,1,2,...} we set
of variables string
w •
s
denotes the set of natural numbers, and for
[n] - { l , 2 , . . . , n } w : [n]
• S
is2***sn
where
and
[0] -
can obviously be identified with the s^ • lw
string will be denoted as usual by systems of variables of the form
for every
A s [0]
of all finite strings of elements of
For a n y string
ws [n]
"
w : [n'J
S
ie[n].The S . s"
empty
denotes the set
S , e.g. the set of all S-sorted
of all non-empty strings of elements of
A » (A g | s e S )
any
A finite sorted system
»
S . S+
denotes the set
S .
an assignment
£€A
in an
w
S-set
will also be denoted by
£ » (aj,a 2 ,... ,a n )
with
» la
for every
ie[n]
as ordered n-tuples are usually denoted. According to that convention A^
can be Identified with the Cartesian product , i.e. A
w " Alw
X
A
2W
x
•••
x
A
nw '
W e recall that for the empty string sists of ons element for every
S-set
7 : [o]
» S
A » (A^ | s € S )
the set
A-,
clusion of the empty set into the union of the s-components of the
66
con-
which is the in-
S-set* If ft A
Therefore we can set w : [n]
»
M
"
S
fi A ^ — A binary
an
{0}* A •
| seS)
is an
S-set,
is a n y function, and if w e use the notation
M
A ^ , then the value associated to
w i l l be denoted by
S-relation
S - i n d e x e d family
every
a»
la a string,
to denote elements of by
A
s e S . An
S-equlvalence in
q
in an
{> •
A
S-set
A • (As | s e S )
such that
in an
S-set
if the binary relation
valence relation for every and symmetric for every
s e S , i . e . If
^ A
8 £
is given by
«
X A8
for
Is refered to ae A
x
8
*8
an
i» an equi-
is reflexive, transitive
s€S .
Finally we will point out an important effect. be a sorted
(alt...,an)
( a l t . . . , a )f .
| s €S)
S-relation* (>
(a 4 ,...,a ) i n
system of variables and
that at least one variable exists no assignment of
x€X
v: X
Let
A • (A^ | s e S )
exists with • S
in
A
v: X an
»- S
S-set so
A x v - 0 . Thsn such that
there
Ay « 0
.
This effect causes the theory of many-sorted algebras to differ seriously from the theory of homogeneous algebras, especially with
respect
to the 'equational theory' of many-sorted algebras.
2.2
Many-sorted A l g e b r a s
Before we deal with partial algebras we Introduce the basic notions of total many-sorted Definition 2.2.1 £
A
algebras. s i g n a t u r e
- (S,
f o r any
2-algebra
e£S,
S-inclusion
B£S, Obviously,
«very
i o r
i s an
B . An
A
S-subset
S - c a r r i e r of a 6 :w
as
underlying
A ^ B
of
the
2-subalgebra
if
a€A B — w t h e a p p l i c a t i o n of 6 to £ y i e l d s an element of A , I.e. A ie B c l o s e d w i t h r e s p e c t to t h e a p p l i c a t i o n of fundamental o p e r a t i o n s of t o arguments t a k e n from
, where
S - s e t of a
with
» s . and f o r e v e r y
A.
F o r t h e sake of completeness we summarize h e r e some well-known
facts
o f t h e t h e o r y o f t o t a l many-sorted a l g e b r a e w i t h o u t p r o o f . P r o o f s more d e t a i l s can be found i n the book of Lugowski (1976) o r i n paper of B i r k h o f f (2.2.6)
Let
set-image
and L i p s o n
A,BeALGt(2)« Af? B
of
the
gebra o f
B ,
i m a g e
, denoted by
According to ( 2 . 2 . 6 ) r e p r e s e n t a t i o n s of (2.2.7)
F o r any
equivalence
(1970). B
®r
anV
S-set
which w i l l
S-homomorphism
A
i s an
t h e { B , E , c j - s e t of o r t h o g r a p h i c a l l y
A 8 £
S-indexed f a m i l y
X A^ , a € S ,
r e l a t i o n , 6 t w —• s ,
kerf
Be Q
for every
i € [ n ] , where
£-homomorphism
» (kerf J
seS)
ker f 8 - { ( * , y ) i A
s
i s a congruence r e l a t i o n i n
74
h o m o m o r p h i c
correct
f o r m a l e x p r e s s i o n s i s a c a r r i e r of a s u b a l g e b r a o f
relatione
F o r any
the
I
holds f o r every
(2.2.8)
B
2-subal-
.
c o n g r u e n c e (1^,1^) 6
f: A
S - c a r r i e r of a
be c e l l e d t h e Af
and
the
^ •
is called
in
A
fs A
B
p8 x.^gA^
with'
• S . the
of
a
If
and f o r e v e r y w: f n ]
seS)
0.
S-indexed
• family
with
X A8 A .
| * f e - yf 8 }
. seS . I
(2.2.9) Theorem of Howomorphlanis Let be given £-homomorphlsms f: B — A , gs 8 » C , so that Bs » C g is eurjective for every s e S , briefly g: B - C surjective. Then there exists a 2-homoraorphlem h: C • A with f « g°h If and only if k s r g ^ Q k e r f ^ for every sort name s e S .
1« •
The homomorphlsm theorem can be applied to the problem described above if we take B • T ( 2 , v ) , for A the semantic algebra, for C the homomorphic image T ( 2 » v ) i of ij T ( S , v ) » 0 ,i.e. the eubalgebra of orthographically correct representations of formal expressions, and if we assume that f: T ( £ , v ) — • > A is the extension of any assignment A , and that g: T(.2?#v) » i® the restriction of i: T ( S « v ) • 0 to its homomorphic image. The condition that equal representations imply equal meaning guarantees then by (2.2.9) the existence of a homomorphiem h: T ( 2 , v ) i A which defines the meaning for every orthographically correct representation . The logical structure of a compiler can be reconstructed from this algebraic definition of semantics by h: T(^J,v)i » A . The aim of syntacic analysis is to decide whether a given string is an orthographically correct representation of a formal expression and if so to construct the corresponding internal representation. Sometimes even the postfix polish notation is used as the internal form of formal expressions. The second part of a compiler, the semantic interpretation, corresponds to a description of the semantic algebra in terms of the machine or assembler language of the target computer. The main point of this description is the definition of the fundamental operations of A by suitable programs. Now that this example is complete we shall make a closer study of the relations between T ( ^ , v ) and partial S - algebras for a general signature S and any S-sorted system of variables vt X » S . Definition 2.2.10. For any signature S p a r t i a l
» (S, : {xg - k^) - { g.k} op(defcomp) »{source, target} op(def id ) - 0 . Definition 2.4.1. An ep-slgnature 0 « ( S » ( d e f 5 I Be. £2)) is said to be h i e r a r c h i c a l If every sequence of not necessarily palrwise distinct operators 50. with
»
' "*
€ op(def 6 i )
for every
there is a natural number
n
16*1
with
terminates, or In other words,
op(def£> n ) • 0 .
Hierarchical ep-signstures will be called for short.
h e p - s i g n a t u r e s •
Clearly, for the ep-signature 6 Q we can build an infinite sequence for every operator fiTe£?e .namely 6,6,6,... becauee {? € op(def 6 ), o so that is not a hierarchical ep-eignature. For the ep-signature we can construct the infinite sequence f> 9• f> 9> •••< f> g> • • • because fe op(def g ) hierarchlcal. As mentioned above
and
g eop(def f ) , so that
8^
is also not
IS hierarchical since any appropriate ss-
quence of operators has at most the length two for op(def id ) • op(def source ) » op(def target ) • 0 and op(def comp ) « (source, target} .
87
The Importance of the concept of hep-signatures becomes evident
by
virtue of the following theorem. Theorem 2.4,2. 8-algebras (i)
6
For any ep-slgnature
A, B
6 » (Z,(d»f6 I 6^X2))
and
the following conditions are equivalent:
Is hierarchical;
(ii)
Every bijective homomorphlsm
f: A
- B
(111)
Every injectlve homomorphlsm
f: A — »
is an isomorphism;
B
reflects solutions
» B
reflects solutions
of existence equatione; (iv)
Every injectlve homomorphlsm
fs A
of domain conditions. Before proving Theorem 2.4.2 that a homomorphlsm
f: A
we will make more precise the notion
• B
reflects solutions of existence equa-
tions and of sets of existence equations respectively. Let
(v: t^Stg )
and
(v:G)
be any existence equation and any set
of existence equations respectively. A homomorphlsm flects solutions of
(v: tjStg ) or of
(vsG)
f: A
» B
re-
if for every assignment
«€ Av !
f
v
£ B
(v:
tlIt2)
£fv68(vsG)
iM
iMplie8
P110«
¿€A(v:
or
tlSt2)
1cA(V:G) •
Proof of Theorem 2.4.2: First we prove that
(iv)
implies
(il). Therefors let
f: A — »
B
be a bijective homomorphlsm. Then there exlste the inverse S-mapping f" 1 - ( f"1, B e — We have to show that j) £ B j ^ g
and
f" 1
As |
.68).
is a homomorphlsm. Let be
£ • b f" 1 e A^ . Because of
according to (iv) that £ • — * w l t A d e f 6 • momorphlsm f: A — » B yields b 6 B f _81
—
- —b fW_ 1 6 A
1 bff8ff 8 8a
—
This proves that
B
6T € Si
88
l n J®ctlvity of the ho-
» A
= a— 6 A f 8 - -b f "WX 6 A f o 8. ie a homomorphlsm.
Second we show Indirectly that For that purpose we define
w — » 8 ,
because
= -b 6 0 . a f 5B — W f :
Se,Q,6:
a f^ • b € B d e f S
(1) Q
Is a consequence of
(ii) .
®8 the set of ell those operators
for which there Is a non-terminating sequence
with
5 1 + 1 e op(dof
)
If w e assume that
6
and
F*
F* - F s - { 0 }
determined total dom 6
= Fw
e*
for every
seS.
F
is the uniquely
e-algebra, e.g. for every
6 €-£2
The fundamental operations of dom b
= 0 .
-algebras in Ssction 2.3 we define two 8-algebras
with
F
i - 0,1,2
is not hierarchical, then
Analogously to the F
for
f f" = 1
F*
with
6 tw — »
e .
are given by
for every
6 « Q \ Q . , where
for every
6€
6 :w
—
s
.
The S-function e . ( e 8 s F* with
e8 - I d ^ j
» Fa | e£S )
for every
se S
is a bijective homomorphism
F
e* * — — F . however it is not an isomorphism. This contradiction to (ii) can only be reeolved if - 0 , which means that 0 is hierarchical. It is not hard to show that If
def 6
• ( w : 0 ) , where
e-algebra, so that for -feAdef& -
f
w
e
B
-€A(w:
"
A
Now
w *
for
( w s tjStg ) t St
)
for
S.€\
**e
ever
Y
Y
holds provided •
with
a89U,ne
ever
(iv)
6 : w
s, a f^ €
then
(lil)
Brfef g
Bdef 5
- 8
(w:
1
St
2
for every
obviously
def 6T + ( w : 0 ) , a g A w t
is true.
and
) ^ def 6 , so that by
(iii)
(w: t j S t g J e d e f Ç . This means
which is what we have to show. Next we turn to the implication (iv) — ( i i i ) . By a simple induction one can prove that (iv) implies the following slightly generalized condition (iv)* Every injective homomorphism of
def t
for any term
f: A
» B
The proof goes like the proof of Corollary 2.3.5. with f' A
vs X
• S
» B ^ —
f
"v 6
This implies
reflects solutions
t e T ( £ J , u ) 8 , u: Y
be any exietence equation,
» S . Let
a gAy
(vs t j § t 2 ) and
any injective homomorphism with B
(v: - '
v
tl
St2)
€ B
d
.
f v
' £f
v
eB
d - f
and
a f y t®
- a f y x\
89
Condition t®.
t|
(iv)* together with the definition of the term functions yield
S ^ d e f V Since
f: A
• » B
—
€ A
def tg'
*A , • eeS
t
•V a V •
is the eort name with
The lnjectivlty of tj£
l(a»v) " ^ i V
is a homomorphlsm we obtain by
f
where
8nd
f :
(2.3.4)
•
tlft2 ST(2,v)8 .
— • » Bs
• t 2 £ , so that
'
yielde
a tj • a t*
or in other words
* £ A ( v : tjSt,, ) ' We conclude the proof of Theorem 2.4.2 by showing that (1) implies (iv) . This is the main part of the proof. The presupposed hierarchy of 6 allows us to prove (iv) by the following principle of induction: Let be a poset (partially ordered set) In which svery descending chain is finite. Let P contains all minimal elements of | 6"' £ 5 , 6 * + 6 } if { 6" '
in the carrier of an equoid
• Q^ , q 2 « A
» Q2
be an isomorphism h: Qj m Q2 with morphlems are unique up to isomorphism.
A
natural
exist, then there
q2 - q ^ h
must
, so natural homo-
This notion of a natural homomorphiam Is derived from categorical structure theory, eee MacLane (1971), and it coincides with the notion of the natural homomorphlsm nat (3 t A
» A/^
of a congruence relation in a total algebra associating with every its congruence class [aj^ - a (nat (> ) . element a e A Here we mention only that a natural homomorphlsm between equoids is in general not a surjective S-function. The problems of existence and of construction of quotient equoids will be treated in Section 3.3. The problame arise from the fact that by set-theoretic factorizations new solutions of domain conditions may be created in such a way that the value of the fundamental operation for this new eolution cannot be reduced to any repreeentatlve of a congruence claas. To illustrate thie we return to the e C A T - e q u o i d A as defined above. If we chooee the S-relation ^ given by ?ObJ " {( 2 .3)} •
?Mor - { ( e 2 ' e 3 > >
then what we just described happens.
2.5
hep-Varletles and hep-Quasi-Varietles
Until now we have only generalized the concept of a signature, and we have not yet any meane available to deecrlbe such properties of operators of sets of operators as associativity, commutatlvlty, or dlstributlvlty. As mentioned in Section 2.2 no kind of validity of term
equations
is known which is sufficient for describing the basic properties of the set of operations for small categorlea. Therefore we need other means.
97
which have not a l o w e r e x p r e s s i v e n e s s than e x i s t e n c e Oust a s
f o r s i g n a t u r e s we u s e t h e t h e o r y o f
to discover
suitable
small categories,
means. L e t
which says
A
A
comp (comp ( x , y ) , z ) holds,
provided
are a l l
c a n be f o r m a l i z e d i n
the
Definition An
2.5.1.
is
G
- comp ( x . c o m p compA(y,z), defined.
following
of
(v:
The e l e m e n t a r y A
G
g i v e n by a n
of
exl8tence
G
• H ) K
~
A
(vs
s ' x s )
be a n y
variables
signature.
of
v: X — —
S ,
by an e x i s t e n c e
the,elementary
equations
(v:G)
( v s G —-•» ' 1 * * 2 *
tjStg )
G
, the
the
equation
implication, p r e m i s e
h o l d s
in a
partial
' by
• tjStg )
.
• H ) S - s o r t e d system of
.
We draw a t t e n t i o n
to
iff
the f a c t
We i l l u s t r a t e
where a
•
A
(ws0)
A
A Aw
-
- S
and by
A A
, denoted
two
( V J H )
by
.
•
i m p l i c a t i o n s c a n c a u s e demands
by means o f
the hep-signature
SCAT
implication0
with
satisfies
£
( V S G )
comp(comp(l,2),3)
ws[3j —-»{ObJ.Mor} SCAT-equoid
vs X
Z-algebra
that
this
t o w h i c h we a d d t h e e l e m e n t a r y (ws 0
variables
(vs G ) , (vs H ) .
holds I n a p a r t i a l
, ( V S G
applicability.
98
equation
implication.
existence equations
A
If
conditional
i m p l i c a t i o n
s e t s of (vs
, and
i m p l i c a t i o n
be d e n o t e d b r i e f l y
(vs Is
equation
If
A H> ( v : An
the
compA(compA(x,y),z)
2? - ( S , * s Q
Implication
(v:G)
This w i l l
x,y,z
of
(y,z))
T h i s k i n d of
S - e o r t e d system of
set
the elementary
A
A
guide
law
way.
c o n c l u s i o n
t h e
-algebra
the a s s o c i a t i v i t y
the elementary i m p l i c a t i o n ,
and b y a f i n i t e of
have. aa a
• tjStg )
g i v e n by a f i n i t e
d o m a i n
equations
categories
f o r a n y morphisms A
e l e m e n t a r y (vs
S
Let
us c o n s i d e r
that
compA(x,y),
compA(x,conipA(y,z))
snail
lwthis
8
comp(l,comp(2,3))) 2w
-
3w -
Mor.
elementary i m p l i c a t i o n ,
then
A(wscomp(comp(l,2),3)-comp(1,comp(2,3)))
of
holds, so that every assignment a e A Is a solution of the sxlstence " e "" equation (w: comp(comp(l,2),3)»comp(l,comp(2,3))) . This means that A A comp (x,y) is defined for every (x,y)e A M o r X A M o r . Thus, coop is a total binary multiplication. Consequently, we have used the wrong implication to give the associativity law of small categories. The class of small catsgories is given by those fying the following set < ^ C A T iXCAT -
of elementary implications:
(v: f — - source(ld(e))S e ) ,(vs 0 — (v: ff
6 C A T - e q u o i d s satis-
target(id(e))8 e ) .
• comp(ld(source(x)) ,x) « x ) ,
(vs {target(x) = source(y)}-—Psource(x)>sourc(comp(x,y)) ), (v: { t a r g e t ( x ) a s o u r c s ( y ) } — » target(y)-target(comp(x.y)) ) , (v: £ target(x )«>80urce(y), target(y)«source(z) j • comp(comp(x,y),z)"Comp(x,comp(y,z)) ) where
v: {e,x,y,z} — { O b j ,Mor}
with
ev
• ObJ
and
x v • y v • z v = Mor . The total unary operators source(Mor) — • Obj , target(Mor) — Obj associate with every morphlsm x € A M o r i t 8 8 0 _ c ° H a c ' source object 80urce A (x)e , and target object target A (x)e A 0 |,j • The unary total operator id(Obj) — » Mor associates with evsry object e£A it8 80 called ha8 Obj " identity morphlsm i d A ( e ) 6 A M o r » according to the first two elementary implications, the given object e as its sourcs and target object. For any morphlsm x ^ A M o r t'10 ™orphisms id A (source A (x)) 6 A M ( j r and le^Jtarge^fx)) £ A M { j r are called the left identity and right identity of x respectively. Their properties are given by the third and fourth elementary implications. The equatlonally partial binary operator comp(x: Mor.y: Mor Iff target(x)»80urce(y) ) associates with any ordsrsd pair of morphisms morphlsm
A
comp (x,y)6 A M o p
the source object of A
condition. If
(x,y) e ^ q , .x ^Mor
provided ths target object of
y , i.e.
comp (x,y)
» Mor
iff (x,y)
x
8
equals
is a solution of the domain
is defined, then its sourcs object equals
ths source object of the first factor, according to ths fifth slemenA tary Implication, and target objects of comp (x,y) and the second factor are equal, according to the sixth elementary Implication. The last elementary implication is the correct form of the associativity law of the partial binary composition. A typical example of a email category can be obtained if one takee A
Obj *
M
a n y
eet
8et
®»
^or "
the
8at
of
811
functions fs X — »
Y
99
with
X , Y € M . The fundamental operations of the email category are
then given by i d ^ X ) - Id x « X — •
X
A
for every
eource (fi X — » Y ) - X , every comp
A
(f: X
x e M » AobJ ,
A
target (fs X — •
Y)
- Y
for
• Y )6A M o f . , and
is the composition of functions«
It is not the aim of this book to give an introduction to the theory of cetegorles, although the author completely agrees with Burstall and Goguen who consider this theory as very useful for computer scientists, see Goguen, Burstall (1983). As the example of small categoriee shows, interesting classee of equoids can be described by a hep-signature 8 with a set (v: target(id(source(x))) = aource(x)) the implication (v: 0 — - target(id(source(x))) £ source(x) ) should be a consequence of a suitable set of minimal axlom8. Indeed, this Implication is a consequence of { I f we replace e by source(x) . In the same way one can see that (v: 0 — » is a consequence of
target(x) = source(id(target(x))) ) {a^} » where
def(v: comp(x v id(target(x)))«x ) • (v: target(x) 2 « aource(id(target(x))) ). Finally def(v: comp(x,comp(y,z))»comp(comp(x,y),z) ) »(v: { target(x)«source(comp(x,y) , target(comp(x,y)) • 2 source(z)} ) holds, so that (vs { target(x)'eource(y) , target(y)§eource(z)} — — » ^target(x)>source(comp(y,z)), terget(comp(x,y))» -source(z)} ) has to be a consequence of the remaining axioms. It is not hard to see that this implication is a consequence of {a 5 ,Sg} . Therefore, the partial order Is given by Sj < a 4 , a 2 < a 3 , a g < a 7 , a & < a 7 , and the condition of a stable est of axioms is satisfied. The importance of the concept of stabls sete of axioms stems from the following theorem.
102
Theorem 2,5.3. Let
0
be any ep-algnature, ej
and
a 6 domtj/ldomt*
because
A
If we assume
s£S
A
stjf at2
a«}'. + 4 * 5 %
with
tj.tg £ T ( 2 , v ) s . Then
A h— (v: G — •
def(tj2t 2 ) ) .
, the lnjectlvity of
• % t ; - atjf8 + at^fe - £fvt®
For
a £ A , _v (v:G)
B
yields
•
Since f: A » B is not only an lnjective homomorphism, this Inequality causes
On the other hand
f: A — »
B t— (v: G — »
t
S-function but also a
.
j " t 2 ) holds because
B )— (X .
this leads to
afv6B(v.6)
tjitjj)
•
But this contradicts + a v !
•
and hence A
— *1
A
-*.X2
Is true for every
S € A ( v . g ) . This mesne
A (—• (v: G >
«
—
^
*
and the proof le finished.
I
The following corollary shows how the concept of stable sets of axioms is related to the well-behaviour of homomorphiems between (©«-(vt
^ tS
t
i)
2
and
.
From (X t— ( v * v B s G* — *
H"t)andat-
(X t— ( W v " s G* — •
tjT-
f o l l o w s by means of Consequently,
for every
G" S G
with
vVfvtG
1 1
)
2
—
tjtS
t2 t ) .
T)
EDIII. (vs
f i n i t e S - s o r t e d subsystem finite
t
(vs H * t
,
tgT)
v * s X*
v« F*( # , G , v ) / = 9 for every s £ S , and denote the elements of F ( # , G , v ) .i.e. the equivalence classes, by (3.2.2.b) [t.Gj-{(r,G)
| Ci f- (vs G
n-tuples of elements of ing way: (3.2.2.C)
F(£?,G,v)
•tSr)}. will be abbreviated in the follow-
[I.GJ - ([lt,G],[2t.G],...,[nt,G]) €F(«-,G,v) w where
w s f n j — S
and
,t€T(2J»v)w«
Additionally to the S-set F(££,G,v) we define an -indexed family of fundamental operations in the following way: If 6-fP.fiT: w — s. w: [n] — * • S then the domain of the fundamental operation 6F(£?,G,v) Is defined by
(3.2.2.d)
d o m f f F ( « ' G ' v ) . {ft,G}| t £ T ( S , v ) w a
120
h - (v: G —
and g
i5
T(2.v)
}
|
6F(#»G.V)
And- the application of (3.2.2.e)
[lfG]6F(tf.G.v)
„
i8
defined by
[l5T(tt.v)tGj
#
The independence of the definitions(3.2.2.d) and (3.2.2.e) from the choice of representativee results immediately from the generalized substitution rule (3.1.5). Before proving that
F(¿?,G,v) is an
# - a l g e b r a freely generated by
( v : G ) we give another important property of Theorem 3.2.3. Let equations, where
(wsH ) Y
y€Y, (X t —
. given by
is a solution of (vs G
P r o o f . The case
ws Y
» S
be any eet of existence
may be Infinite. A n assignment
f £F(^,G,v)w every
with
F(C?,G,v).
•
yf»
(ws H )
[yt.G] in
,
teTiS.v)^
for
F(tf,G,v) if and only if
Ht: ) .
( w : H ) » ( w : 0 ) is trivial because
a
(vs G
rtS
t t )} ,
. [tt.G]
t € T( £ .u) , u : Z
S .
Consequently, we obtain a
(v: G
•
tj
t § tjT ) ,
(vs G
t 2 t S t 2 T ) , and
[tji.G] = [ t 2 7 . G ] for
f >[t,G]£F(ff1G,v)(||!H) #
For every
t - (v: G
tj t 1 t 2 T )
(w: tjitg ) £ ( w s H ). iZ h -
(vs G — •
, and so
This is identical with
hT ) .
121
For the proof of the converse direction we assume (X
I— (v: G
H t )
or a H- (v: G — • for every
t^t 2 t 2 1 )
(w: tj'tg ) e(w: H ) .
As s result of this assumption and Corollary 3.1.4 (v: G —
a y -
t 1 l 2 tjj: ) ,
t j . 6 t2 t )
h- (v: G —
(X
follow, and so we obtain 6
[t.Gj € d o m t ^ ' ^ n d o m t ^ * '
' ^
and
[i.e]eF(a.e.v)(lItiit2, for every
(ws tj8t 2 ) £ (w:H ), i.e.
f - [!.G]eF(tf,G.v)(wsH) .
I
Theorem 3.2.4. For every set of elementary implications set of existence equations F(C?»G,v) is an
(v: G ) , v: X
¿? -algebra freely generated by
Proof. First of all we prove that fore let (w: H and
•
t
i"t2 )
_f 6. F( (X ,G,v) ^ (J ( - (vi G
where
¿eT(2,v)w
In addition,
F(£?,G,v)
wlth
Y
#
and every
» S , the partial algebra
"" S
(v: G ) .
ie an be
an
y
(X -algebra. Thereaxlom
j . According to Theorem 3.2.3
of
this means
• H t ) with
_f = [l» G ] •
¿it— (w: H — »
^ holds as a consequence of (3.1.3),
so that Corollary 3.1.8 yields (X\—
(ws G — •
tj^i t 2 l ) .
A further application of (3.2.3) leads to f - [t.ej6F(a.G.v)(witi2t2) Consequently,
F(£?,G,v)
•
satisfies every axiom of
(X .
Next we show that the assignment e£F(#,G,v)v
.given by
is a solution of ( v s G ) For
ieT(2J,v)v
with
e • [i,G] and
122
in
x e - [x,G]
for every
x£X,
F(£?,G,v) .
xi" x G « gT .
for every
xeX
the following holds
This implies Ci I— (vs G — • G ) so that Theorem 3.2.3 yields eg F(C?,G.v) (v}G J . Finally we assume that A is any solution. According to (3.2.2.b)
£?-algsbra and
£eA(vtG)
an
Y
(X h— (v: G — tSt ) holds for every [t ,G] e F( (X ,G,v) , and by Theorem 3.1.9 we obtain A
(vsG) g
A
(vst.St) *
Hence, for every define the homomorphism
A a edon t , and so we can
It follows that
a* j F(#,G.v) —
A
by [ t , G ] a # - a t A for every [t,G] e F( £f,G,v) . It 4remains to show that this defines rsally a homomorphism with £av • — • For every
x6X,
xea* Now let and
6€
- (xs) a* , with
- [x,G] a* - a x A
6 : w
- xa .
• e , w: [ n]
» S
, be any operator
[t.G]€dom6F . On account of (3.2.2.d) thia implies ct »— (vs G — •
t e r T ( z ' v ) S ter T (S.v)
and therefore (Lt.Gle^^'6'^)»^
-
[t6T(S.v)>Gj8#
.
.(tffTiS.vijA.
- (a(lt)A a ( n t ) A ) 5 A - (ta*)ffA. £ This proves that a : F(££,G,v) — * A is a homomorphism with the required property. Since the S-set X* » (X* | s € S ) given by X* - {[x,G] | xv-s } is a generating S-set of F(#.G,v) , the assignment extended to a homomorphism in at most one way.
aeAv
can be •
By means of the prsceding results it is easy to prove the completeness of ¿?-derlvabllity. Theorem 3.2.5. For any two sets of exlstsnce equations (X I- (vs G
(vs G ) , (vs H ),
H)
123
A
holds If and only If Proof.
(V.G) —
Since Theorem 3.1#9
A
(v:H)
18
true
for
ever
Y
#-algebra
A.
represents the necessity, we have only to
prove the sufficiency. A
/ (V
.ui I V in )
18
true
* o r every
(X-algebra, then we obtain for
F ( # , G . v ) the relation
For
1 6T(2IV)v
with
xi » x
for every
x£X ,
[i.G]eF(tf,G,v)(v:H) holds, if and only if
(X I— (vs G Since
i -
Id
x(2
[i.G]
Hi ) .
v)
an (w: {target(x)2 8 ource(y) , z 8 comp(x.y)}) . If we consider the set of existence equations (w: Gj) = ( w:{target(x)§source(y) , source(x)8source(z) , target(x)Starget(z)} ) then
F(£fp A T ,G 3 ,w) can be represented by the following diagram:
The small category, represented by the following diagram • source(y) target(x)
source(x)
target(y) source(z)
comp(comp(x,y),z)
I^jt
tar
9»t(z)
can be described by (w: G 4 ) • (ws{target{x)2source(y) , target(y)-80urce(z)}). Finally,
F(£?* AT ,0,w)
describes the following small category:
source(x)o-
•otarget(x)
source(y)o-
•otarget(.y)
80urce(z)o-
»otarget(z)
We see that free
¿?* AT -algebras ,i.e.
¿i"*AT-algebrae freely gene-
rated by an empty set of existence equations est,
They coincide
(v:0),ere of no inter-
with small categories of isolated morphlems.
125
3*3
Partial quotient algebras
At the end of Section 2.4 we eald that the conetructlon of quotient algebras by means of congruence relatione cannot be generalized In a straightforward way from total algebras to equolde. We demonetrete this assertion by small catsgorles.
to
For this rsason we conelder again the email category A isomorphic " i t h v s i x , y i — » { O b j . M o r } and x v » y v - Mor.
The two-sorted relation e
e
?ObJ " { ( » > l
(>
eeA
with
objJ
U
t (target(x).source(y))}
and
?Mor - { < " . • > I n , e A M o r ) is a congruence relation. I.e. q Is a two-sorted equivalence relation and the carrier of a subequoid of A X A . However, the algebraic structurs of A cannot be carried over canonically to the two-sorted quotient set A/g , given by ( A /«?>„ or - {
C * v m
9
}
( A / R ) o b J - {[source(x)]
[target(x)] ^ • [source(y)]^,
[targetiy)]^} . Only the unary total operations source A : A ^ can be carried over to
—
AQbj A/p
,
target A : A M o r —
A
obj
by
source^^f^x]^) • [source(x)l^ , target A / ?([x]^) - [target(x)]^ - [eource(y)J ? - source A / ?([y]^) target A / ?([y] ? ) - [target(y)] ? . But now there is a non-trivial solution of the domain condition of the binary composition, namely ([x]^,[y]^) , end there is no congruence class that could represent the value of the composition compA/?([xl?,[^) . This fact could cause the conjecture that no quotient S*AT-algebra A/(> exists. But, this conjecture is caused only by lack of success of en elementwise construction. On the other hand the homomorphism f: A — » B as dsfined In Section 2.4 Is natural for .
126
In the following wo show that for every many-sorted relation q , for every aet of elementary implications (X , and for every (Z -algebra A a homomorphlem ft A • B between & -algebras exists which is natural for ^ . To begin with, we return to the preceding example of the homonorphlsm f: A m B natural for (> as defined in Section 2.4 on the pages 94 and 95. We recall that A is isomorphic to F ( , v ) and B is isomorphic to F
(#£ A T t{ t a r g« t (*) S 8 °"rcs(y)},v) •
We can aee that up to isomorphism B is constructed from A by adding the ordered pairs of £ , considered as existence equetione, to ths set of existence equations which describes A . In this construction no missing elements annoy, becauss [comp(x,y),(v:{target(x)Ssource(y)})J exists in Fitf^T.itargstfxjSsourcefyjj-.v) due to # * A T b— (v: { tsrget(x)2source(y)} — c o m p ( x , y ) S c o m p ( x , y ) ). In order to investigate the general construction of quotient & -algebrae, we show first that every (X -algebra A is isomorphic to an algebra F(££,G,v) where ( v : G ) can be derived canonlcally from A . Let (X be any set of elementary Implications and A any gebra of type 2 » ( S , ( * : Q — » S* X S ) . Then we define:
(X -al-
X A - {(a.s) | a e s , a i A j ; V
A
:X
S
A
a
WITH
wlth
• A e (Va)
(8'8)VA • a
8
( » )
•
8
a
f o r 8V8l for ever
y
"y
(a,s) I *e t ( S . v a ) 9 , a £ S , a - e A t A } .
is a solution of
(v A , G A ) in
A , and the unique extension
to e homomorphlem •A
: f
(^'gA'vA) —
A
is an isomorphism, i.e. (3.3.1)
127
This representation shows that we do not restrict the generality if we deal only with ¿^-algebras of ths form F(£?,G,v). Obviously, there are many different sets of existence equations which deecribe ons and the sane C( -algebra. In general it is recursively undecidable whether F(£T,G,v) and F(£f,H,w) are isomorphic, even in the case that ( v : 6 ) , ( w : H ) are finite sets of existence equations on finite S-sorted systems of variables« Now we can start with the construction of a natural homomorphism f : F(tf.G.v) — F(tf.H.w) for every S-sorted relation (> in F ( # , G , v ) . For every binary S-relatlon in F(£?,G,v) we define the so-called associated set of exletence equations (v:G ) by (3.3.2) (vsG p ) - { (vs t 1 S t 2 ) | ( [tj.G] , [t 2 ,G]) ses} . Theorem 3.3.3. For every the homomorphism fsF(ii.G.v) —
S-sorted binary relation
£
in
F(£?,G,v)
F( £?,GUG ? ,v)
with [t ,G] f • [t.GUG^] is natural for Proof.
for every
[t, G] e F( £?,G,v)
^ .
First we show that the previously defined S-function f:F(tf,G,v) —
F(6t,GUG?,v)
is a homomorphism. Let every
ee f(#»g»v)(v.q) c£ -algebra
B
th
e universal solution of
and every solution
exactly one homomorphism b*:F(#,G,v) - —
B
with
ebj
b£B, — tv
;
(v:G) , I.e. for there exists
» b.
The assignment • _1 e F( (X ,G U G^ t v) v with x_l» [x,GU G J for every x e X is a solution of (v: G ) in F( (X ,G U G ,v) because of G £ G U G^ and Theorem 3.2.3. The given S-function fsF(#,G,v)
»
F((7,GUG?,v)
is then the unique extension of the solution to a homomorphism. It remains to prove that f:F(tf,G,v) • F(6?,GU G^,v) satisfies condition (2) of Definition 2.4.8.
128
l6F(t?,GUG^,v)|v.Gj
If
B
with
is any
-algebra and
[tj,G] g g
g: F ( # , G , v ) — »
- [t 2 ,G] g 9
for svsry
thsn the assignment
e g v e Bv
g : F( ¿f ,G, v) — »
is ths unique extension of
morphism. phism
B
Since
_e g y £
B
is a solution of
(V'GUG
h: F(£?,GUG^,v)
•
f-h : F( (I.G.v)
—
B
B
t
)
lere
^
with
is a homomorphism
( [ t ^ G ] , [t2,G] ) £
.8 e S ,
(v:GUG^)
in
e gy £ Bv
B
and
to a homo-
exists exactly one homomor-
lhy- sgy
.
By that
B
is a homomorphism with e(f h ) y If
(efy) h y = 1 h y -
h': F ( i 2 , G U G ^ t v ) — •
B
egy
and
g - f-h
.
is a further homomorphism
with
f-h*«g
thsn
IK
-(*
f
v>
h
;
-
£(fvh;) a
£(f'h")v " 1 9 v
- l h
v
and so h - h' .
•
Theorem 3.3.3 shows that ths preceding construction of the natural homomorphism
fs-A
• B
between
for constructions of quotisnt
( ^ ' ^ - a l g e b r a s is representstive
(X-algebras.
A s nsxt w s are concerned with a second useful construction, the so-callsd
p u s h o u t - c o n s t r u c t i o n
theory of categories. Lst f: A between
B ,
forms a (i) (ii)
g: A — »
C
C( - a l g e b r a s with common domain f*s C — •
Q .
g*: B — •
p u s h o u t f-g* = g . f
#
of
hs Q — •
Q'
Q
f:A
• B , g: A
f's C — »
Q ' , g": B — •
with
g * h - g* f: A
Q uniquelyupto
and •
f*.h - f
if
Q'
with
B , g: A — »
. C
determine the
isomorphism.
Before we w i l l give a general construction of we show
» C
thsre exists exactly one homomorphism
Evidently, the homomorphisms 'pushout-#-algebra
A . A couple of homomorphisms
;
for every coupls f*g' = g.f•
, taken from the
be givsn homomorphisms
pushout-¿{-algebras
that the pushout gsnsralizes the construction of sums
coproducts of
£?-algebras. This construction
or
corresponds to the con-
struction of ths frss sum of groups in ths cass of goneral
(Z-algebras.
129
The construction of sums can be derived from the more general pushout construction by means of so-called initial Definition 3.3.4. Let ft -algebra •X
A
'ZC e ALG(£?)
be any class of
i n i t i a l
is called
¿^-algebras. OC -algebras.
with respect to
An
the class
. or initial Of-algebra , If (i) (li)
A £ K. j For every B 6 b: A — » 8 .
there exists exactly one homomorphlsm I
Corollary 3.3.5. For every set of elementary implications Ct -algebra
F(#,0,a)
Proof. Let
B
la initial with respect to
ft
the
A L G ((X).
be any ¿T-algebra. Then there exists exactly one aesign-
ment of the empty etring
» S
0
in the carrier of the ¿^-algebra
B , namely the inclusion of ths empty set into ment is the only solution of exactly one homomorphlsm We point out that
(¿>0)
in
b:
B . This unique assign-
B , so that by Theorem 3.2.4 — »
B
exists.
I
F(ft.,0,?l) may be the empty algebra or that some
of its carrier sets may be empty. For instance,
is the empty category. Now let
a:
— A ,
b: F(ft,ft,A) — •
B
be homomor-
phisms between ¿^-algebras. According to (3.3.5) these homomorphisms are uniquely determined by g: 3 — *
C
A , B € ALG(£?) . I f
are homomorphisms between
main, then in any case
the compositions
coincide with the unique homomorphlsm A n element-free description of phisms
I: A — »
A+B
,
of homomorphisms f: A — » homomorphlsm
hsA + B
A +B
C , g: B — • -
C
a»f
with
and
b«g are equal and
c: F((X.,0,'h)
the sum
J: B — »
f: A — » C ,
¿f-algebras with common codo-
A+B
» C .
is given by homomor-
such that for each pair C
there exists exactly one
i*h • f
and
J«h • g .
If we now consider the puehout of the uniquely determined homomorphisms a:
— » A ,
JL
a': B — • > Q , ere isomorphic.
b:
—*>
B
given by the homomorphisms
M
b :A — »
Q
, than
the
¿T-algebras
Q
and
A+B
Therefore the construction of the sum of £? -algebras
is a special case of the conetruction of a pushout of homomorphisms bstween (Z-algebras.
130
Now we describe the general pushout construction. For this purpose we introduce a notatlonal convention. If fs Fitf.Gj.Vj) — is a homomorphism denotes any
and
with Then
[*»Gj]
an
Y element of
F(«,G2,v2) .
9: Ftit.Gj.Vj) —
F(£*,G 3 ,V 3 )
S , v2s Y —
f*s F(0:.G 3 ,v 3 )
S
form a pushout for 2
+V
3
S
f
y u z
, Vj» Z — -
• F( 0;.G.v 2 >v 3 )
9*: F ( ^ . G 2 . V 2 ) —
V
tf
Let be given homomorphisms
fi F f t f . G ^ V j ) —
Vj : X — •
FtCX^G^.v^) , then
f » ® ! ] * " [* *»G2l •
terra with
Corollary 3.3.6.
F(tf,G 2 .v 2 )
and
Y r\ Z - ff .
and
F( £?,G,v 2 + V 3 )
and
g , where
s
~ ~
S
with
x(v 2 +v 3 ) - x v 2 x(v 2 +v 3 ) • x v 3
if
xeY
if
and
x€Z,
and where G - G2 U G 3 U {(v2+v3: x f S * g ) | The homomorphisms
f'
and
g'
xex}.
are defined by
[t,G2]g
#
- ft,G]
for every
[t.G 2 ]
F(6*,G 2 ,y 2 )
[t.G3]f
#
- [t.G]
for every
[t,G 3 ]
F(tffG3.v3).
£
and
M
Proof. f r and g* are homomorphlsme according to the same reasoning as in the proof of Theorem 3.3.3. So it remains to show that f.g* a gof* and that Let
M
fr
and
g
M
form a pushout for
¿ € Fi^.Gj.Vj)^
If we can prove
,q j
l(f.g*V
V
1
- l(g f*)
holds for every
and
g .
denote the universal solution. V
1
then
according to condition (2) of Definition [x f,G] • [xg,Sj
f
f.g # - g f*. follows
3.2.1
x £ X , since
( v 2 + v 3 : x f I x g ) C (V 2 +Vjs G)
for every
x€X.
This yields *(I(f'9*)) • (xl)(f.g # ) - ( [ x . G j f ) g*. and so
[xf,G2]g#-
- [x f.G] - [xg,G] - x(l(g.f*)),
131
l(f.g*) - l(g«f*)
and
f.g* - gif* .
Now let g': F(0t,G 2 ,v 2 ) — •
B
f's F(tt,G 3 ,v 3 ) —
B
be homomorphisms with B£ALG(£?:) and Then there Is exactly one assignment —€
B
v +v 2
with 3
f»g* • g»f* .
yj>- y(ig') z b = z(J.f')
for every for every
yeY and zi Z ,
where F
1 e F( (X .G^.Vg) (y^jG^) •
^'G3'V3>(V3:G3)
are the universal solutions, respectively. Because of
G 2 £ g , Gj & G , v 2 ^
interpret
G^
and
G3
v
2+v3 •
and
v
3 ^ v2+v3
as sete of existence equations on
*e v
2
+v
can
3 '
8n
t^ does not depend on
yeY
B J> t 2 does not depend
the following holde:
bt®
- (¿g") t B - ( l t ^ ' ^ ' ^
1
) g- - [tj.Gjg« - (x f) g' -
- x(f.g') - x ( g . f ) - [t 2 .G 3 ] f' - b t\ . This means "
6 B
(v 2 +V 3 SG) '
Consequently, there is sxactly one homomorphlstn h: F ( « . G , v 2 + v 3 )
B
with
k h ^
}
-b
.
where k£F(i*tG.v2+v3)(v2+V3:G) denotes the universal solution. If
k + v 2 , l< |v 3 ,
b*v2,
b to the S-sorted subsystems it follows
132
denote the restrictions of v2
and
v3
of
v2+v3;
Jt
and
respectively,
• k
Vj ,
lg'.kv2,
if'» b W
J (
lg'.
b*v2
and additionally J, f * h - ( k i v 3 ) h - ( k h ) v 3 .
biVj.^g'
l g ' h - ( k l v 2 ) h - (k h) V j . b t V j . i f ' , and eo f*»h - f
and
g*»h - g' .
I
Since the pushout construction is not 90 familiar outside the theory of catsgories
we illustrate this construction by some examples.
Furthermore, this construction will be used extensively in Chapter 4 for the construction of complex specifications of abstract data typea of simpler o n e s . First we remark that the pushout construction encloses the of substructures' . Evidently, the sst-theoretic union of bras is in general not the carrier of an A U B
of
(X-subalgebras
stand the smallest
A
and
B
-subalgebra of
Therefore, the union of
- s u b a l g e b r a . By the union
of an C
'union
eource(x 3 ),
target(x 2 )Starget(x 3 ),
target(x 1 )§source(x2)} ) >
and
for i=1 2 3. *i 9 * x i « » The small category can be graphically described as follows:
According to Section 3.4 the homomorphism g: A - C is natural for its kernel. Since B and C are not isomorphic and kerf • k e r g , the homomorphism f: A » B cannot be natural for its kernel. Let f: A » B be any homomorphism between small categories qj : A — • > Qj may be natural for kerf , so that a functor h
l!
* B
with
and
f » qjohj
exists. Qj
is Isomorphic to the homomorphic image
(A f)
If and only if
hj: Qj » B is injective. One can prove generally that Qj and (A f) are not isomorphic iff there are morphisms x,y,z A M with A A A a x ji source (x), y + source (y), z > source (z), target (x) ¡i source(y), and If
z ^ , o r - c o m p B ( x ^ o r . y f„ o r ) • hj: Qj
» B is not injective there is a non-trivial homomorphism
q 2 s Qj — • which is natural for
Q2 kerhj
and there is a homomorphism
137
hg i Q 2
• B
hj • q 2 o h 2 *
with
One can prove additionally that ( h 2>ObJ " ( Q 2 ) O b j
B
Obj
la always Injective, and ao In there are no morphiems x,y,z having the propertie8 described above with respect to hj: Qj — B . Thi8 implies that h 2 : Q 2 — » B becomes Injective for both aorte Obj , Mor and that the homomorphlc image (A f) becomes isomorphic to Og . These considerations show that the homomorphlc image (A f) of a homomorphism between small categorise can be reconstructed by one or by two factorizations Qj or Q 2 , respectively. This existence of Iterated quotients motivates the following definition. Definition 3.4.1. Let 6 be any hep-signature and (X any set of elementary Implications. A finite or countable sequence
( (fi. I
l e I
)•
of homomorphisms between (X -equolds is called a c h a i n of i t e r a t e d q u o t i e n t s of f s A — » B , where A,B€ALG(C?), if (1)
f • fj
(2)
q ^ Q4
(3)
qA
and
fj » q-j»'^!
» ^i+i
i9
Is natural for
not
an
ker f t
f°r every
iel ;
isomorphism for every for every
i€I
iei .
If I « [n], then the natural number n la called the l e n g t h of the chain of iterated quotlente of f: A — » B . If alternatively I » 14 , then we say that the chain of iterated quotients has infinite length, • With this notion the theorem of homomorphism of total algebras can be formulated as follows: Evsry chain of iterated quotients of a homomorphism between total algeSrae is of length one. The preceding considerations show that every chain of iterated quotients of a homomorphism between small categories is at moat of length two (see Reichel (1969)). According to the following theorem the length of chains of itsrated quotients is not bounded in the general case. Theorem 3.4.2. There are chains of iterated quotients of homomorphisms between equolds of infinite length. Proof : Theorem 3.4.2 will be proved by constructing an infinite chain of iterated quotients. According to that let us consider the
138
hep-signature 6
la
aorte oprn
end
N ,P n — » N a(N) — • N o(P) — . » N r(x sN Iff x 8 - n ) — •
and let ua take the 8-equoids The 9-equoid A -Is given by A,, - {(O.x) | x e W } n
A
,
A
and
B .
Ap - 0 .
- (0,0) ,
(O.x) ® A • (O.x+l) for every A A , dom an » dom r - 0 . The 8-equoid B„ • n
P
0
B
B
x e 3N . and
may be defined ae followsi
» X
H
,
Bp -
U ,
- (0,0) ,
(x,y) a 8 • (0,0) xi
for every
Q
(x,y)e B N ,
• (x+1,0) for every x € B p , B B dom r • B N and (x,y) r • x for every
One can see easily that one homomor'phlsm f: A
•
A
Is an Initial
(x,y)e B N .
6-equoid, so that exactly
B
exists, which is given by (O.x) f N fp: 0
—
-(0,0)
for every
(0,x)£AN,
Bp .
Therefore,the kernel of
f: A
(kerf)N
- AN X An
(ker f) p
- ApXAp .
» B ie given by
and
By virtue of the construction of natural homomorphisms. according to Theorem 3.3.3, we obtain the first quotient ( V n
q^: A
" t (0.0>.(1.0),(l.l).... # (l t x)....
» Q 1 by setting: | x€*l},
(Qjip - { 0 } . n< Q l> - (0,0) , (0.0) s { Q l } - (0,0) , (1.x) s ( Q l ) - (l.x+l) On
(Q
for every
x
,
l l ' . (1,0) ,
139
don>r(Ql'-
(0,0)
and
(0,0) r ^ l * - 0 .
The u n i q u e l y d e t e r m i n e d homomorphiem f 2 s Qj — ^
B
with
f • fj
-
i s g i v e n by (J.O) ( f 2 ) N
-
(J.O)
for
(l,x) (f2)N
-
(0,0)
for every
0(f2)p
k
(J.x) J»
(A
x € K
with
-
o
r
k
2
~
x ^ 1 ,
and
by
(k,0),(k,l)
(Ak)p - { o , l , . . . , k - l } n
f
( ' ^ k »
(Afc)N - { ( 0 , 0 ) , ( 1 , 0 )
}
.
- 0 .
I n d u c t i v e l y we d e f i n e
(A
J-O.l
(k,x),...
|
xe»},
,
(0,0) *(0,0)
e(V -
(k,x+l)
k ' • (J+1,0)
dom r ( A k }
if
for
x-0 if
and
J£k-1
k-J ,
J-0,1
x£W k-1 ,
- {(0,0),(l,0),....(k-l,0)}
( J »0)
-
J
for
,
,
J-0,1,.. .,k-l .
The u n i q u e l y determined homomorphism f k . Qk —
B
I s g i v e n by (J.O) ( f k ) N -
(J.O)
for
(k,x)(fk)N-
(0,0)
for every
xe»
J (fk)P
for
J-0,1,...,k-l
,
-
J
J-0,1,...,k
, with
x t 0 ,
and the homomorphism Q
Q
k —'"
which i s n a t u r a l f o r
k+1 ker f k
i s d e f i n e d by
(J.0)(qk)N
-(J.O)
for
(k,x) (qk)N
-
for every
J (qk)p
-
J
(0.0) for
J-0,l,...,k,
J-0,1,....k-l
x € W with
x / 0 ,
.
T h i s e x p l i c i t l y d e f i n e d i n f i n i t e c h a i n of i t e r a t e d q u o t i e n t s of a homomorphism f : A - 3 p r o v e s Theorem 3 . 4 . 2 .
140
N o w w e a r e l o o k i n g Into s i g n i f i c a n t relatione b e t w e e n the m a x i m a l c h a i n of I t e r a t e d q u o t i e n t s of a h o n o m o r p h l e m honomorphlc image
f: A
• B
F o r this r e a s o n w e c o n s i d e r the h o m o m o r p h l c image B
of Proof 3 . 4 . 2 .
(Af)„ - {(x.O) | x € W } , (Af)
the
(A f) .
m o m o r p h l s m fs A — •
so that
and
(A f)
p - H ,
is a n i n f i n i t e s u b e q u o i d , w h e r e a s the
image c o n s i s t s of o n e e l e m e n t , n a m e l y w i t h i n c r e a s i n g index
k
the
of the h o -
W e eee that
kth
set-theoretic
(0,0) . F u r t h e r m o r e w e see
i t e r a t e d quotient
and m o r e s i m i l a r to the h o m o m o r p h l c i m a g e . H e n c e , the q u e s t i o n a r i s e s . C a n the h o m o m o r p h l c image
( A f)
Q^
that
becomee
more
following
of a h o m o m o r p h i s m
be
c o n s i d e r e d a s the limit of the m a x i m a l c h a i n of i t e r a t e d q u o t i e n t s of f: A — »
B ?
In both c a s e s of total a l g e b r a s a n d small c a t e g o r i e s , w h e r e the m a x i mal
c h a i n s of i t s r a t e d q u o t i e n t s a r e of finite l e n g t h , this
question
c a n bs a n s w e r e d p o e i t i v e l y , b e c a u s e w e c a n e v i d e n t l y d e f i n e that
the
last quotient of a finite c h a i n of i t s r a t e d q u o t i e n t s is the limit of this c h e i n . But w h a t is the limit of a n i n f i n i t e c h a i n of i t e r a t e d q u o t i e n t s ? T h e following d e f i n i t i o n of the limit of a c o u n t a b l e c h a i n of P h i 8
"8
f
A
f
l L. A
1 ^ ^
f
2 S*. A
2 ^ ^
3
f
f
„ 1
L.
3 ^ ^
„
•••
mor-
n_
n
• • •
Is d e r i v e d from the t h e o r y of c a t e g o r i e s , w h e r e It c o r r e s p o n d s to the c o l i m l t o t the c h a i n . D e f i n i t i o n 3 . 4 . 3 . Let implications, ( f
i ' Ai
A
a c o u n t a b l e c h a i n of l i m i t (1)
be a h e p - s i g n a t u r e ,
a set of
elementary
i+1
I
1
¿?-equolds.
An
¿?-equoid
L
is c a l l e d
a
of this c h a i n , if there a r e c a n o n i c a l q
(2)
0
and
i!
A
i
L
^
morphisms
*ith
for e v e r y f a m i l y of ^
9
i
s A
i —
8
)
B
w l t h
with
f
iocli+i
f o r
every
i 6 >1 , e n d
homomorphisms
there is e x a c t l y o n e h: L — •
"
9
i "
f
i'9 i + l
f o r
ever
Y
homomorphism
gA - q »h
for e v e r y
1 e J4 .
|
141
Intuitively, condition (1) requires that L is an upper bound and condition (2) implies that L is a least upper bound of the chain. Additionally, condition (2) guaranteee that a limit of a chain is unique up to isomorphism. If we allow in Definition 3.4.3
finite chains
( f
A i8 A i — i+1 I i e M ) and modify conditions (1) and (2) for finite index sets, then every finite chain f 1L. A f2o f„ A n . 1 * 2 ^ ^ ' ' • ^ ^ n+1 has a limit, namely L • An+1 where the canonical homomorphisms q^: A t — L for it[n+lj A
are defined by q
n+l " V
q
i "
f
Id
An+1 '
f
l
+
of
r for
1° "'i+l
f
"
n • "n-1 " f n-l' f n •
n-l°fn ' i ' e -
1 6
W
•
As next we are concerned with the existence of limits of infinite chains . Corollary 3.4.4. Let
6
be a hep-eignature and
(X any set of elemen-
tary Implications. For every infinite chain ( flS A
±
—
Ai+1 I l e w )
of homomorphisms between (X -equoids there exists a limit which is unique up to Isomorphism.
L£ALG(e,#)
Proof. According to general-theorems on colimits in categories (see MacLane (1971) ) Corollary 3.4.4 would be an immediate consequence of Theorem 3.3.3 and Corollary 3.3.6. But we will give here an explicit construction o-f L . If S the set
is ths set of sort names of L* - {(x,J) | J i W ,
For every ordered pair morphism f
142
i.j' A i — -
A
b
v
eeS
x €(AJ)e} .
(i,j)£AIXl ) G/K where K is the commutator of G . With respect to partial algebrae we can also speak of a small category freely generated by a directed graph. This construction can be implemented by the 80-called category of finite paths over a directed graph (see Hasse.Michler (1966) ). From Definition 3.5.5 it follows immediately that a T^-equold F freely generated by a Tj-equoid B according s Tj » T2 is determined uniquely up to isomorphism. By means of the calculus introduced in Section 3.2 we can prove that for every theory-morphism *
Bf*
B = B £# ©
and
there is e x a c t l y one f«g
#
homomorphism
—
B
M
with
M
(f ® g ) £
«
according
f . T h i s p r o v e s that
: Tg
A
is f r e e l y g e n e r a t e d b y
A£
» T .
A s next w e p r o v e c o n d i t i o n (1) of D e f i n i t i o n 4 . 3 . 1 . Let be g i v e n BeALG(T2,A2). £;
(T0>
Then
such that
C £ ALGITJ, A J )
B e c a u s e of B © C
6 ALG(T,
C £