# User:Michiexile/MATH198/Lecture 1

### From HaskellWiki

Michiexile (Talk | contribs) m (User:Michiexile/SU09 Lecture 1 moved to User:Michiexile/MATH198/Lecture 1) |
Michiexile (Talk | contribs) |
||

Line 2: | Line 2: | ||

==Introduction== | ==Introduction== | ||

− | Why this course? What will we cover? What do we require? | + | ===Why this course?=== |

+ | |||

+ | An introduction to Haskell will usually come with pointers toward Category Theory as a useful tool, though not with much more than the mention of the subject. This course is intended to fill that gap, and provide an introduction to Category Theory that ties into Haskell and functional programming as a source of examples and applications. | ||

+ | |||

+ | ===What will we cover?=== | ||

+ | |||

+ | The definition of categories, special objects and morphisms, functors, natural transformation, (co-)limits and special cases of these, adjunctions, freeness and presentations as categorical constructs, monads and Kleisli arrows, recursion with categorical constructs. | ||

+ | |||

+ | Maybe, just maybe, if we have enough time, we'll finish with looking at the definition of a topos, and how this encodes logic internal to a category. Applications to fuzzy sets. | ||

+ | |||

+ | ===What do we require?=== | ||

==Category== | ==Category== | ||

+ | |||

+ | ===Graphs and paths=== | ||

A ''graph'' is a collection <math>G_0</math> of ''vertices'' and a collection <math>G_1</math> of ''arrows''. The structure of the graph is captured in the existence of two functions, that we shall call ''source'' and ''target'', both going from <math>G_1</math> to <math>G_1</math>. In other words, each arrow has a source and a target. | A ''graph'' is a collection <math>G_0</math> of ''vertices'' and a collection <math>G_1</math> of ''arrows''. The structure of the graph is captured in the existence of two functions, that we shall call ''source'' and ''target'', both going from <math>G_1</math> to <math>G_1</math>. In other words, each arrow has a source and a target. | ||

We denote by ''[v,w]'' the collection of arrows with source ''v'' and target ''w''. | We denote by ''[v,w]'' the collection of arrows with source ''v'' and target ''w''. | ||

+ | |||

+ | We extend the notation, and denote by <math>G_i</math> the collection of all paths of length ''i''. Such a path is a sequence <math>f_1,\dots,f_i</math> of arrows, such that for each ''j'', <math>target(f_{j-1}) = source(f_j)</math>. | ||

+ | |||

+ | ===Definition of a ''category''=== | ||

A ''category'' is a graph with some special structure: | A ''category'' is a graph with some special structure: |

## Revision as of 14:24, 3 September 2009

## Contents |

## 1 Welcome, administrativia

## 2 Introduction

### 2.1 Why this course?

An introduction to Haskell will usually come with pointers toward Category Theory as a useful tool, though not with much more than the mention of the subject. This course is intended to fill that gap, and provide an introduction to Category Theory that ties into Haskell and functional programming as a source of examples and applications.

### 2.2 What will we cover?

The definition of categories, special objects and morphisms, functors, natural transformation, (co-)limits and special cases of these, adjunctions, freeness and presentations as categorical constructs, monads and Kleisli arrows, recursion with categorical constructs.

Maybe, just maybe, if we have enough time, we'll finish with looking at the definition of a topos, and how this encodes logic internal to a category. Applications to fuzzy sets.

### 2.3 What do we require?

## 3 Category

### 3.1 Graphs and paths

A *graph* is a collection *G*_{0} of *vertices* and a collection *G*_{1} of *arrows*. The structure of the graph is captured in the existence of two functions, that we shall call *source* and *target*, both going from *G*_{1} to *G*_{1}. In other words, each arrow has a source and a target.

We denote by *[v,w]* the collection of arrows with source *v* and target *w*.

We extend the notation, and denote by *G*_{i} the collection of all paths of length *i*. Such a path is a sequence of arrows, such that for each *j*, *t**a**r**g**e**t*(*f*_{j − 1}) = *s**o**u**r**c**e*(*f*_{j}).

### 3.2 Definition of a *category*

A *category* is a graph with some special structure:

- Each
*[v,w]*is a set and equipped with a composition operation . In other words, any two arrows, such that the target of one is the source of the other, can be composed to give a new arrow with target and source from the ones left out.

We write if .

=>

- The composition of arrows is associative.
- Each vertex
*v*has a dedicated arrow 1_{v}with source and target*v*, called the identity arrow. - Each identity arrow is a left- and right-identity for the composition operation.

The composition of with is denoted by . A mnemonic here is that you write things so associativity looks right. Hence, *(gf)(x) = g(f(x))*. This will make more sense once we get around to *generalized elements* later on.

### 3.3 Examples

- The empty category with no vertices and no arrows.
- The category
*1*with a single vertex and only its identity arrow. - The category
*2*with two objects, their identity arrows and the arrow . - For vertices take vector spaces. For arrows, take linear maps. This is a category, the identity arrow is just the identity map
*f*(*x*) =*x*and composition is just function composition. - For vertices take finite sets. For arrows, take functions.
- For vertices take logical propositions. For arrows take proofs in propositional logic. The identity arrow is the empty proof:
*P*proves*P*without an actual proof. And if you can prove*P*using*Q*and then*R*using*P*, then this composes to a proof of*R*using*Q*. - For vertices, take data types. For arrows take (computable) functions. This forms a category, in which we can discuss an abstraction that mirrors most of Haskell. There are issues making Haskell not quite a category on its own, but we get close enough to draw helpful conclusions and analogies.
- Suppose
*P*is a set equipped with a partial ordering relation*<*. Then we can form a category out of this set with elements for vertices and with a single element in*[v,w]*if and only if*v<w*. Then the transitivity and reflexivity of partial orderings show that this forms a category.

Some language we want settled:

A category is *concrete* if it is like the vector spaces and the sets among the examples - the collection of all sets-with-specific-additional-structure equipped with all functions-respecting-that-structure. We require already that *[v,w]* is always a set.

A category is *small* if the collection of all vertices, too, is a set.