1 / 36

Lecture 2: Introduction to Category Theory

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/. Features of Interoperability. Complex mappings from user views to way data is held

titus
Download Presentation

Lecture 2: Introduction to Category Theory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. a b 1a: a a (identity arrow named 1a) f: b c (arrow named f)

  6. Categorial Axioms 1 • The identity arrow 1a 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 a b f 1b g b c g • Equations: 1b o f = f and g o 1b = 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. a a, b b, c c • 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 1a: 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 Y Z 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 <p,q> 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 c e 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 c e a Pos2 a d Order-preserving arrows: Pos2 Pos1; 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 h d a b c 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 homC(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 b emptyset 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: pi1: a x b x c a pi2: a x b x c b pi3: a x b x c c

  26. Product - Universal Mapping • Binary product example (U universal object) A x B pi1 d pi2 A U B f g Equations: f o pi1 = d = g o pi2

  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 pil f A XC B C pir g B • A, B are objects in relationship • C includes coproduct A+B, product AXB, link objects. • A XC B is product A X B in context C • Equational logic: f o pil = g o pir

  29. Pullbacks - More Arrows 1 A pil pi*l f Delta A XC B C pi*r pir g B

  30. Pullback - More Arrows 2 A pil pi*l f Coprod A XC B Delta C pi*r Prod pir g B

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

  32. Interpretation of Projection Arrows • pil: A XC B A left projection monic -- each A participates once in relation epic -- each A must participate in relation • pir: A XC B B right projection monic -- each B participates once in relation epic -- each B must participate in relation

  33. Coproducts (Sums) A+B il d ir A U B f g Equations il o f = d = ir o g U is universal object

  34. Restricted Coproduct • Pushout A f il C A +C B g ir 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 XC 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.

More Related