Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 2: Introduction to Category Theory Nick Rossiter, Computing Science, Newcastle University, England

Similar presentations


Presentation on theme: "Lecture 2: Introduction to Category Theory Nick Rossiter, Computing Science, Newcastle University, England"— Presentation transcript:

1 Lecture 2: Introduction to Category Theory Nick Rossiter, Computing Science, Newcastle University, England B.N.Rossiter@newcastle.ac.uk http://www.cs.ncl.ac.uk/people/b.n.rossiter/

2 Features of Interoperability Complex mappings from user views to way data is held Need to handle data, metadata and metameta data Need to make semantic transformations

3 Category Theory? Need relations to represent mappings between levels Multi-level construction (higher-order) Category theory seems appropriate: - categories for basic structures - functors relate categories - natural transformations relate functors

4 Origins of Category Theory 1940s Sammy Eilenberg 1960s Fred Lawvere 1970s Saunders Mac Lane 1990s Mike Barr & Charles Wells Peter Freyd Various views: “Multi level Graph Theory” “Multi level Functional Programming” “Multi level Type Theory”

5 Basic Constructions The Category: Collection of arrows which may be named: (name:) source target e.g. ab 1 a : a a (identity arrow named 1 a ) f: b c (arrow named f)

6 Categorial Axioms 1 The identity arrow 1 a identifies an object a Arrows are composable if the source of one forms the target of the other: a b, b c has composite a c Composition is associative: f: a b, g: b c, h: c d f o (g o (h)) equiv ((f) o g) o h

7 Categorial Axioms 2 Identity arrows may be used for the operation of composition: e.g. f: a b, g: b c f ab f 1 b g bc g Equations: 1 b o f = f and g o 1 b = g

8 Types of Category Categories are named in bold font. A number of universal basic types have been developed for: Sets Ordered constructions on sets Products Relationships (and many others)

9 Discrete Categories Every arrow is an identity arrow e.g. aa, bb, cc Discrete categories are sets (without functions)

10 Simple Categories 0,1 0 empty category -- no objects, no arrows 1 (discrete) category with one object and one identity arrow e.g. a 1 a : a a

11 Simple Categories 2 2 Category with two objects and one arrow which is not an identity e.g. a, b a b

12 Category Set Set The objects are sets The arrows are total functions between the sets e.g. Sets X, Y, Z Total functions a:X Y, b:Y Z

13 Category Set (commuting diagram) Represented as category XYZ in the universal category of Set X a c YZ b Diagram is said to commute if c = b o a Equational logic to accompany diagrams

14 Category Preorder A set of objects p,q,r,… A collection of arrows such that: each arrow represents an ordering There is no more than one arrow between any two objects p q is the ordered pair for which p <= q

15 Preorder construction Satisfies categorical axioms: identity p p (for each object) composition p <= q <= r implies p <= r through transitivity Example of preorder: (may be symmetric) b d ce a

16 Preorder Applications May be cyclic Occur naturally as rich data structures in information systems e.g. object-oriented In some approaches e.g. relational, preorders are converted to an equivalent collection of partial orders Normalization techniques

17 Partial Orders - Category Pos Collection of partial-order objects with order-preserving arrows between them As preorder but with asymmetric axiom: if p<=q and q<=p then p=q is implied Objects b Pos1 d ce a Pos2a d Order-preserving arrows: Pos2Pos1; Pos1 Pos2

18 Pos Applications Derived from Preorder by Functor (see later) to convert symmetric structures to asymmetric ones Basis of logic Ordering by projection, inclusion Inheritance and aggregation paths Basic data structuring with constraints (keys) Relationship representation

19 Types of Arrow - Monic Monic: m a b f g d If m o f = m o g implies f=g, then m is monic. Left-cancellable. One path. Injective in sets. 1:1 relationship.

20 Types of Arrow - Epic Epic hd abc e If d o h = e o h implies d=e then h is epic. Right-cancellable. Onto. Surjective in sets. Mandatory relation.

21 Isomorphisms A mapping that is both monic and epic in the category Set is isomorphic. In other types of categories, this cannot always be assumed to hold.

22 Collections of Arrows - Hom Sets Sometimes useful to think of the collection of arrows between two objects Termed a hom set Written hom C (a,b) to represent all arrows between objects a and b in the category C. Emerge as results of queries on information systems

23 Types of Object - Initial An initial object in a category has precisely one arrow from it to every other object. b a c d a is initial object in this category Bottom in partial orders; identifiers or keys in databases;

24 Types of Object - Terminal A terminal object in category has precisely one arrow onto it from every other object a bemptyset c emptyset is terminal object top in partial orders; base supertype in inheritance partial orders

25 Category with Products A category has finite products if in addition to objects, say, a,b,c, it has: a product object a x b x c projections: pi 1 : a x b x c a pi 2 : a x b x c b pi 3 : a x b x c c

26 Product - Universal Mapping Binary product example (U universal object) A x B pi 1 dpi 2 A UB f g Equations: f o pi 1 = d = g o pi 2

27 Relationships -- Pullbacks Notion of subproduct Relation of two objects in context of a third Restriction of universal product Pullback of one arrow over another

28 Pullback Diagram for f over g - Basic Arrows A pi l f A X C BC pi r g B A, B are objects in relationship C includes coproduct A+B, product AXB, link objects. A X C B is product A X B in context C Equational logic: f o pi l = g o pi r

29 Pullbacks - More Arrows 1 A pi l pi* l f Delta A X C BC pi* r pi r g B

30 Pullback - More Arrows 2 A pi l pi* l f Coprod A X C BDeltaC pi* r Prod pi r g B

31 Interpretation of Objects, Arrows A X C B relation A to B over C Delta: C A X C B Mapping from link object to relation Coprod: A X C BC (exists) Mapping from relation to coproduct in C Prod: A X C BC(for all) Mapping from relation to product in C

32 Interpretation of Projection Arrows pi l : A X C BA left projection monic -- each A participates once in relation epic -- each A must participate in relation pi r : A X C BB right projection monic -- each B participates once in relation epic -- each B must participate in relation

33 Coproducts (Sums) A+B i l di r AUB f g Equations i l o f = d = i r o g U is universal object

34 Restricted Coproduct Pushout A f i l C A + C B g i r B Restriction over object C

35 Limits Both Pullbacks and Pushouts are examples of Limits. They are restricted products/coproducts A + C B is colimit A X C B is limit

36 Further Reading Categories for the Working Mathematician Mac Lane, Saunders 2nd edition Springer-Verlag 1998. Category Theory for Computing Science Barr, Michael & Wells, Charles 1st edition (later editions are available) Prentice-Hall 1990.


Download ppt "Lecture 2: Introduction to Category Theory Nick Rossiter, Computing Science, Newcastle University, England"

Similar presentations


Ads by Google