Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal...

14
Universal Algebra, Algebraic Logic, and Databases

Transcript of Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal...

Page 1: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

Universal Algebra, Algebraic Logic, and Databases

Page 2: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

Mathematics and Its Applications

Managing Editor:

M. HAZEWINKEL

Centre for Mathematics and Computer Science, Amsterdam, The Netherlands

Volume 272

Page 3: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

Universal Algebra, Algebraic Logic, and Databases

by

B. Plotkin Hebrew University, Jerusalem, Israel

SPRINGER-SCIENCE+BUSINESS MEDIA, B.V.

Page 4: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

Library of Congress Cataloging-in-Publication Data

Plotkin. B. 1. (Boris Isaakovich) [ Un i ve r saI 'n a fa a 1 9 e b r a. a 1 9 e b rai c h e s k a fa log i k a iba z y dan n y k h .

Engl ishl Universal algebra. algebraic logic. and databases I by B.

Plotkin. p. cm. -- (Mathematics and its appl ications v. 272)

Includes bibliographical references and index. ISBN 978-94-010-4352-6 ISBN 978-94-011-0820-1 (eBook) DOI 10.1007/978-94-011-0820-1

1. Algebra. Universal. 2. Algebraic logic. 3. Data bases. 1. Title. II. Series: Mathematics and its applications (Kluwer Academic Publ ishers) ; v. 272. QA251.P6213 1994 005.74'01'512--dc2Q

ISBN 978-94-010-4352-6

This is an updated and revised translation of the original Russian work Universal Algebra, Algebraic Logic, and Databases, 1991 Nauka, Moscow, Translated by 1. Cirulis, A. Nenashev and V. Pototsky

Printed on acid-free paper

All Rights Reserved © 1994 Springer Science+Business Media Dordrecht Originally published by Kluwer Academic Publishers in 1994 Softcover reprint ofthe hardcover Ist edition

93-44246 CIP

No part of the material protected by this copyright notice may be reproduced or utilized in any form or by any means, electronic or mechanical, inc1uding photocopying, recording or by any information storage and retrieval system, without written permis sion from the copyright owner.

Page 5: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

Contents

PREFACE xiii

INTRODUCTION 1

o GENERAL VIEW ON OBJECTIVES AND CONTENTS OF THE BOOK 3 1 Preliminary information on databases. Examples . . . . " 3

1.1 Examples and suggestive considerations. . . . . . .. 3 1.2 Setting of main problems. The relational approach.

Application of algebra. . . . . . . . . . . 9 2 Further examples. Network model .... . . . 14

2.1 Other examples of relational databases. 14 2.2 Network databases. . . . 16 2.3 Axioms of states. . . . . 19

3 Contents of the book: a review 20 3.1 Notes to Part 1. .... 20 3.2 The content of Part 2. . 21 3.3 Part 3. The model of a database. 22

I UNIVERSAL ALGEBRA

1 SETS, ALGEBRAS, MODELS 1 Sets .............. .

1.1 Sets, subsets and mappings. 1.2 Multiplication of mappings. 1.3 Cartesian product of sets. . 1.4 Free sum of sets. . ...... . 1.5 Characteristic functions of sets. 1.6 Binary relations. . . . . . . . . 1. 7 Equivalences........... 1.8 Quotient sets. . . . . . . . . . . 1.9 Fundamental mapping theorem. 1.10 Cardinality of a set. . ..... .

v

27

29 29 29 30 30 32 32 33 33 34 34 34

Page 6: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

VI

2

3

CONTENTS

1.11 Fuzzy sets. ............ . Algebras and models . . . . . . . . . . . . 2.1 Algebraic operations and relations. 2.2 Algebras............... 2.3 Models and algebraic systems. 2.4 Homomorphisms between algebras and models.

35 36 36 36 37 37 38 39 39 40 40 40 41 42 42 42 44 44 45

2.5 Quotient algebras and models. 2.6 Homomorphism theorem ... 2.7 Sub algebras and submodels .. 2.8 Cartesian products. 2.9 Remak theorem. ... . . . . 2.10 Algebra of terms ....... . 2.11 Generators and defining relations. 2.12 Classes of algebras and models; their axioms. Many-sorted systems. ............ . 3.1 Set complexes. ....... . . . . . . 3.2 Many-sorted operations and relations. 3.3 Many-sorted algebras and models. 3.4 Algebras of many-sorted terms.

2 FUNDAMENTAL STRUCTURES 47 1 Definitions and examples. 47

1.1 Semigroups. . . . . . . . . . 47 1.2 Groups............ 48 1.3 Origins of groups and semigroups. 49 1.4 Quasigroups and loops. 49 1.5 Rings................. 50 1.6 Fields and skew-fields. . . . . . . . 51 1. 7 More examples ofrings and fields. The origins. 51 1.8 Linear spaces and modules. . . . . . . . 52 1.9 Associative linear algebras. ....... 54 1.10 Group algebras and semigroup algebras. 54 1.11 Other structures. . . . . . . 55

2 Homomorphisms. Free Algebras. . 56 2.1 Definition of a free algebra. 56 2.2 Semigroups. . 56 2.3 Groups............ 57 2.4 Rings............. 58 2.5 Linear spaces and modules. 59 2.6 Linear algebras. . . . . . . . 59

3 Some many-sorted structures . . . 60 3.1 Representations of groups and semigroups. 60 3.2 Linear representations. . . . . . . . 60 3.3 Automata.............. 61 3.4 Affine spaces and affine automata. 62

Page 7: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

CONTENTS

3 CATEGORIES 1 General information and examples

1.1 Definition of a category ... 1.2 Examples........... 1.3 Subcategories........ 1.4 Monomorphisms, epimorphisms and isomorphisms. 1.5 Duality......................... 1.6 Functors... '. . . . . . . . . . . . . . . . . . . . . 1. 7 Natural transformations of functors. Categories of

functors .......... . 1,8 Equivalence of categories. . . . . . . . . . . . . . . .

2 Some technical notions . . . . . . . . .. . . . . . . . . . . . 2.1 Universal objects.. ................. . 2.2 Direct and free products (products and coproducts). 2.3 Other examples of universal objects. 2.4 Tensor products of modules .. 2.5 Adjoint functors. . ...... , .. . 2.6 Cones, equalizers, and limits. . .. .

4 THE CATEGORY OF SETS. TOPOl. FUZZY SETS 1 Further general concepts. ............... .

1.1 Remarks on the category of sets. . , .... , . 1.2 Amalgams and coamalgams. Cartesian squares. 1.3 Completeness and co completeness. 1.4 Exponentiation ....... . 1.5 Cartesian closed categories.

2 Topoi, .... , ......... . 2.1 Subobjects.. ....... . 2.2 Elements. Names of arrows. 2.3 Subobject classifier. ..,. 2.4 Definition of a topos .... . 2.5 Power objects. . ..... . 2.6 General remarks on topoi. Well-pointed topoi. 2.7 Examples of topoi ................ . 2.8 Operations with subobjects. Heyting algebras. 2.9 The Heyting algebra of subobjects. Boolean topoi.

3 Fuzzy sets. Miscellany . . . . . . . . . . . 3.1 Fuzzy sets and fuzzy quotient sets, 3.2 The category of fuzzy sets. 3.3 The top os of fuzzy sets. . ..... 3.4 Remarks on the foundations. History ..

5 VARIETIES OF ALGEBRAS. AXIOMATIZABLE CLA-

Vll

65 65 65 66 67 67 69 69

71 73 73 73 74 76 77 79 83

85 85 85 86 90 90 93 94 94 95 96 99 99

101 102 106 107 108 108 110 111 113

SSES 115 1 Varieties., ..... ,.......... 115

1.1 Closed classes and free algebras. 115 1.2 Classes and identities. 118 1.3 Birkhoff theorem. . 120 1.4 Verbal functions. . , . 120

Page 8: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

Vlll CONTENTS

2

3

Some constructions .................... . 2.1 Free products in varieties ............. . 2.2 Amalgams...................... 2.3 Epimorphisms and monomorphisms in varieties. Axiomatic classes of algebras '" . . . . 3.1 General remarks .................. . 3.2 Reduced products. . . . . . . . . . . . . . . . . . 3.3 Quasivarieties and pseudovarieties ........ .

123 123 123 124 125 125 126 127

6 CATEGORY ALGEBRA AND ALGEBRAIC THEO-RIES 1 Clones, and clones of operations .

1.1 Clones of operations ... . 1.2 Abstract clones. . ... . 1.3 Clones and free algebras. . 1.4 Representations of clones and varieties.

2 Algebraic theories. . . . . . . . . . . . . . . . . 2.1 Clones and categories. . ........ . 2.2 Algebras as functors. . . . . . . . . . .. . 2.3 Algebraic theories and varieties of algebras. 2.4 Additional remarks. . ........... .

II ALGEBRAIC LOGIC

129 129 129 131 131 133 139 139 140 143 147

153

7 BOOLEAN ALGEBRAS AND PROPOSITIONAL CAL-CULUS 1 Boolean algebras. . . . . . . . . . . . . . . .

1.1 Boolean algebras, rings and lattices. 1.2 Homomorphisms, ideals and lattices. 1.3 }<ree Boolean algebras. . . . . . . . . 1.4 Finite Boolean algebras. . . . . . . .

2 Propositional calculus and Boolean algebras . 2.1 Propositional calculus. . . . . . . . . . . 2.2 The Lindenbaum-Tarski algebra of propositional cal-

culus. . ........................ . 2.3 Consistence, compatibility and models ........ .

155 155 155 159 163 165 166 166

167 169

8 HALMOS ALGEBRAS AND PREDICATE CALCULUS 173 1

2

3

Halmos algebras .............. . 1.1 Quantifiers and quantifier algebras. . 1.2 Halmos algebras. . . . . . . . . . . . 1.3 Supports of elements. ....... . Halmos algebras of predicate calculus. . . . 2.1 Predicate calculus ........... . 2.2 Halmos algebra of predicate calculus .. Halmos equality algebras. Cylindric algebras 3.1 Equality in Halmos algebras. 3.2 Cylindric algebras. . ......... .

173 173 177 180 182 182 184 189 189 193

Page 9: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

CONTENTS IX

4 Homomorphisms and structure of Halmos algebras. Addi-tional remarks ................... 194 4.1 Homomorphisms, ideals and filters. . . . . 194 4.2 Simple algebras. Semisimplicity theorem. 196 4.3 Constants, terms and predicates. 197 4.4 Other remarks. . . . . . . . . . . . . . . . 199

9 SPECIALIZED HALMOS ALGEBRAS 201 1 Halmos algebras over a variety of universal algebras 201

1.1 Axiomatics and examples. . . . . 201 1.2 General information. . . . . . . . . . . . 204 1.3 Equality in specialized algebras. .... 209

2 Halmos algebra over a free algebra of a variety 209 2.1 Supports of elements of a free algebra. . 209 2.2 Specialized algebra of formulas. . . . . . 212 2.3 Halmos algebra over the free algebra of a variety. 215

3 Modification ofthe scheme .......... 219 3.1 Changing the variety. ......... 219 3.2 The kernel of a passage to subvariety. 224 3.3 Additional remarks . . . . . . . . . . . 228

10 CONNECTIONS WITH MODEL THEORY 229 1 Existence of models .... 229

1.1 Preliminaries.... 229 1.2 The main theorem. . 232 1.3 Additional remarks . 234

2 Miscellany . . . . . . . . . . 238 2.1 Consistency, compatibility and completeness. 238 2.2 Certain applications of the model existence theorem. 240 2.3 Classes and filters. The knowledge base of a model. 241

11 THE CATEGORIAL APPROACH TO ALGEBRAIC LO-GIC 247 1 Relation algebras . . . . . . . . . . . . 247

1.1 Notes on quantifiers. . . . . . . 247 1.2 Definition of relation algebras. 250 1.3 Another approach. . . . . . . . 255

2 Relational algebras associated with Halmos algebras 258 2.1 The principal construction. 258 2.2 Algebras of relations. . 267 2.3 Additional remarks. . . . . 269

3 Generalizations........... 270 3.1 Generalized relational algebras. 270 3.2 Intuitionistic logic and models in toposes. 271

Page 10: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

x CONTENTS

III DATABASES - ALGEBRAIC ASPECTS 275

12 ALGEBRAIC MODEL OF A DATABASE 277 1 Universal databases ..... :-. . . . . . 277

1.1 Definition of a universal database. 277 1.2 Functor property. . . . . . . . . . . 279 1.3 Additional notes. . . . . . . . . . . 281

2 The model. . . . . . . . . . . . . . . . . . 284 2.1 Definition of a database. . . . . . . . . . . . . . 284 2.2 Homomorphisms and the category of databases. 288

3 Dynamic databases . . . . . . . . . 295 3.1 Preliminary notes. . . . . . 295 3.2 Dynamic Halmos algebras. 297 3.3 Dynamic databases. .... 298

4 Generalizations........... 301 4.1 Non-deterministic action.. ..... ....... 301 4.2 Databases based on cylindric and relational algebras. 302 4.3 Databases with fuzzy information. . . . . . . . . .. 303

13 EQUIVALENCE AND REORGANIZATION OF DATABA-SES 305 1 More about homomorphisms ............. 305

1.1 Replacement of a scheme. . . . . . . . . . . . 305 1.2 Canonical decomposition of homomorphism. . 309 1.3 Additional comments. . . 311

2 Equivalence and reconstruction . . . 311 2.1 Basic information. . . . . . . 311 2.2 Equivalence of databases. . . 312 2.3 Reorganization of a database. 313 2.4 Modification of axioms. " . 315 2.5 Reconstruction of scheme. . . 316

3 Functional dependencies of relations 319 3.1 Structure of functional dependences. 319 3.2 Modification of the attribute set. . . . 321 3.3 Axioms and functional dependencies. . 322

4 Changing states. Storage and cleaning. . 323 4.1 Preliminary remarks. . . . . . . . 323 4.2 Relations and partial multimaps. . . 324 4.3 Storage................. 325 4.4 Cleaning................ 325 4.5 Interaction of cleaning and storage. . 327

14 SYMMETRIES OF RELATIONS AND GALOIS THEORY OF DATABASES 329 1 The Galois theory of relational algebras. Preliminaries 330

1.1 Automorphisms of a relational algebra. 330 1.2 Galois connection. . . . . . . . . 334 1.3 Basic results. . . . . . . . . . . . 335

2 Proofs in the pure Halmos algebra case. . . . . 336

Page 11: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

CONTENTS

2.1 Proof of the first theorem .... 2.2 Proof of the second theorem. .

3 The general case. Some consequences. 3.1 Preliminary remarks. . . 3.2 Proofs of the theorems. . 3.3 Some corollaries. . .... .

4 Galois theory of databases. ... . 4.1 Symmetries of states. 4.2 Galois theory of databases.. . 4.3 The automorphism group of a database. 4.4 Axioms and symmetry of relations ....

Xl

336 340 344 344 346 348 353 353 356 358 362

15 CONSTRUCTIONS IN DATABASE THEORY 365 1 Constructions not changing the scheme . 365

1.1 Generalobservations...... 365 1.2 Product of relational algebras. 367 1.3 Products of databases. . . . . 369 1.4 Join of databases. ...... 372

2 Constructions modifying the scheme . 373 2.1 Product and join.. . . . . . . . 373 2.2 Wreath product of models. .. 377 2.3 Cascade connections and wreath products of databa-

ses. . . . . . . . . . .. . .... . 2.4 Other constructions. . ...... . 2.5 Decomposition ........... .

3 Supplement . . . . . . . . . . . . . . . . . 3.1 Remarks on objects in databases .. 3.2 Networks of databases .....

16 DISCUSSION AND CONCLUSION 1 Outcome and problems. . . .

1.1 Some results. . .... 1.2 Problems........

2 Problems of implementation . 2.1 Preliminary notes. . . 2.2 Constructive algebras. . . 2.3 On constructive databases. 2.4 Additional notes. . . . . .

3 History and sources. Discussion . 3.1 Universal algebra. 3.2 Algebraic logic. 3.3 Databases.

BIBLIOGRAPHY

INDEX

379 380 384 387 387 387

389 389 389 391 400 400 402 406 412 416 416 418 419

423

434

Page 12: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

PREFACE

Modern algebra, which not long ago seemed to be a science divorced from real life, now has numerous applications. Many fine algebraic structures are endowed with meaningful contents. Now and then practice suggests new and unexpected structures enriching algebra. This does not mean that algebra has become merely a tool for applications. Quite the contrary, it significantly benefits from the new connections.

The present book is devoted to some algebraic aspects of the theory of databases. It consists of three parts. The first part contains information about universal algebra, algebraic logic is the subject of the second part, and the third one deals with databases. The algebraic material of the flI'St two parts serves the common purpose of applying algebra to databases.

The book is intended for use by mathematicians, and mainly by algebraists, who realize the necessity to unite theory and practice. It is also addressed to programmers, engineers and all potential users of mathematics who want to construct their models with the help of algebra and logic. Nowadays, the majority of professional mathematicians work in close cooperation with representatives of applied sciences and even industrial technology. It is neces­sary to develop an ability to see mathematics in different particular situations. One of the tasks of this book is to promote the acquisition of such skills.

The book has an introductory chapter in which the formulation of problems is enlightened by the help of examples, and the corresponding role of algebra is explained. The first two chapters of Part 1 treat standard algebraic notions. However, there is a nonstandard element of consideration even here: all these notions are treated from the viewpoint of many-sorted algebra. This is necessary for databases and other goals. Topoi and algebraic theories are also considered in the flI'St part. These chapters serve the purpose of giving the reader access to the possible applications of new ideas in algebra. They are needed also because they provide a natural way to the definition of databases with fuzzy information. Part 2 deals with different approaches to the algebraization of predicate calculus. This material is intended to be used chiefly for databases; however, pure algebraic applications are also discussed.

The concern of Part 3 is the algebraic model of a database which was developed by the author and studied in the Riga algebraic seminar. Here, the

xiii

Page 13: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

xiv PREFACE

dalabase is considered as a certain algebraic structure. The model, represented as an algebraic structure, brings us closer to understanding the nature of databases, and at the same time enables us to solve various problems of database theory on an abstract level. Such a model should not be cumbersome. It is important that in each particular case, the database looks like a natural organism with its in­dividual peculiarities.

Real dalabases require their operations to be implementable on computers. This presupposes that databases are to be supplied with specialized software. This peculiarity leads to a special consideration of constructive databases. The idea of studying constructive mathematical structures has already long been conceived in mathematics. The constructive mathematical analysis exists alongside mathematical analysis. However, the latter has given rise to the former.

In dalabase theory, events developed in another way. From the very beginning up to now, problems of programming occupy the forefront, and the theory is often considered as a part of the theory of programming. This has resulted in ignoring many other problems. By now the theory of databases is in the process of being formed into a big applied science associated with a rich variety of good mathematics. Ideally, models of databases should be considered together with the potentials of programming. Such a conjunction manifests itself, among other things, in the necessity to refine the corresponding models in accordance with software constraints.

Problems of implementation are not considered as a special subject in this book: this is an extensive area in itself. Some attention is paid to it in the final chapter dealing with the history and sources of the subject matter, and including also a problem review of the theory of dalabases as well as a comparison of different approaches.

Next we point out that this is not a textbook on databases. Its contents reflects a particular point of the algebraist's view of databases. This book has been conceived as a manual or, probably, a textbook of applied universal algebra. Many scientists carry out research on the application of univeral algebra and the theory of categories to the problems of computer science. It seemed attractive to reflect this trend in the science, and this volume was originally intended also to consider the algebraic aspects of automata theory and some problems of the theory of programming related to the idea of a data type. However, all this would increase the volume of the book, and we have restricted ourselves to databases. As for the algebraical material itself, this can be applied not only to dalabases. For example, some information on topoi may be useful for specialists in artificial intelligence., The variety of subjects under consideration, having the nature of applications, is emphasized by the list of references which, however, cannot claim to be complete.

This book is written in the spirit of the ideas developed by A.I. Maltsev,

Page 14: Universal Algebra, Algebraic Logic, and Databases - Springer978-94-011-0820-1/1.pdf · Universal Algebra, Algebraic Logic, and Databases by B. Plotkin Hebrew University, Jerusalem,

PREFACE xv

G. Birkhoff, A. Tarsky, A.G. Kurosh, P. Halmos, V.M. Glushkov, and other classics. Anatoly Ivanovich MaItsev always attached a considerable significance to the applications of algebra, its relations with computer technique, physics and other sciences, stimulating new trends in algebra.

In conclusion, I would like to point out that the work on this book has taken about five years. The material of the book was used by me for undergraduate and graduate courses and talks at conferences. Remarks both of mathematicians and engineers were taken into account. I obtained significant help from S.N. Boyko, J. Cirulis, Z.B. Diskin, TL Plotkin a, N.D. Volkov. The main work in preparing the manuscript for publication was done by E.B. Plotkin and TL Plotkina. My wife showed great patience. R.S. Lipyansky, E.S. Maftsir, A.S. Peklis, S.M. Rosenberg, L.A. Simonyyan and V.E. Sustavova also took part in the preparation of the manuscript. I am greatful to all of them.

I wish to thank also E.M. Beniaminov, L.A. Bokut, Ju.L. Ershov, S.S. Goncharov, V.A. Gorbunov, E.B Katsov, A.V. Mikhalev, AL Shmelkin" M.Sh. Tsalenko and A.V. Yakovlev whom lowe a debt of gratitude for critical and useful discussions. I express my gratitude to V.V. Donchenko, the editor, who read the book with great attention.

At last, in this edition I would like to thank very much J. Cirulis, who undertook the main work of translation and preparing for publication the English version of the text. I am also grateful to A. Nenashev and V. Pototsky for translating several chapters of the book.