340 likes | 420 Views
Categories and Computer Science. http://cis.k.hosei.ac.jp/~yukita/. What is category theory?. Algebra of functions Composition is the principal operation on functions Abstract structure Collection of objects Collection of arrows between them
E N D
Categories and Computer Science http://cis.k.hosei.ac.jp/~yukita/
What is category theory? • Algebra of functions • Composition is the principal operation on functions • Abstract structure • Collection of objects • Collection of arrows between them • Invented by S. Eilenberg and S. Mac Lane in 1945 • originated from algebraic topology • influence on • Algebraic geometry A. Grothendieck • Logic F.W. Lawvere • Computer science
How does category theory appear in Computer Science? • Construction of functions out of a given set of simple functions • using various operations on functions such as: • composition and repeated composition • An important aspect of CS • Dynamical systems • having states which vary over time • Computing is concerned with machines • An algebra of functions which really does not consist of functions • Programs and languages are formal things that specify actual functions • Syntactical side of CS
Topics we choose • Grammars and Languages • Data types • Boolean algebra • Circuit theory • Flow charts • Imperative programming • Specification • Lambda calculus
Note. The notion of category is axiomatically defined and formal. The objects of a category need not be actual sets and the arrows need not be actual functions. As is usual with axiomatic definitions this allows great flexibility. CS note. An object of a category does not necessarily have methods such as union, intersection, Cartesian producs, etc.
f 1A A B 1B
Ex 1. Sets: The category of sets Note. If you are unfamiliar with the notions of sets and functions, you should consult with some elementary textbooks on set theory. Can you clearly tell the differences between surjection, injection, and bijection?
Small examples We should check if all the axioms are satisfied in these examples.
Ex. 7 The category of power set 2X {0,1,2} • The subsets of X = {0,1,2} is the set of objects. • The arrows are inclusions. • In the figure, identities are omitted. {0,1} {0,2} {1,2} {0} {1} {2}
Presenting a category by its generators and relations • Generators • All of the objects • Some of the arrows • Relations • Some equations between composites of given arrows
Ex. 16. A category of words * * * * * * a * ・・・・ *
Def. Free monoid • A category with one object and several arrows with no relations is called a monoid. • The set of arrows is call the alphabet of the monoid. • Languages are subsets of a free monoid. • We usually think of a language as a set of well-formed sentences with respect to some grammar.
Def. Directed graphs • A (directed) graph is a set of objects and a set of arrows, each with a prescribed domain object and codomain object. • There’s no composition. This is the difference between graphs and categories.
Ex. 18. A Regular Language 9 9 ・・ ・・ 1 1 0 0 + _
Ex. 23.Setsfinite and BoolAlgfinite Highly advanced topic
{0,1,2} {2} {1} {0} {0,1} {0,2} {1,2} {0} {1} {2} {1,2} {0,2} {0,1} {0,1,2}
Remark • In any category, • given any two objects in the diagram, say P and Q, any composite of arrows from P to Q yields the same result. • We then say that the diagram commutes.