wangbinyq / personal-wiki

2 stars 0 forks source link

Category Theory #21

Open wangbinyq opened 6 years ago

wangbinyq commented 6 years ago

https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/

Category: The Essence of Composition

A category consists of objects and arrows that go between them. But the essence of a category is composition. f . g = \x -> f(g(x))

Their surface area has to increase slower than their volume. An object in category theory is an abstract nebulous entity. All you can ever know about it is how it relates to other object — how it connects with them using arrows.

Types and Functions

Types Are About Composability.

Set

Types are sets of values. The great thing is that there is a category of sets, which is called Set. In Set, objects are sets and morphisms (arrows) are functions. In Haskell, every type have one special value called the bottom (undefined), It deals halting problem. Functions that may return bottom are called partial, as opposed to total functions, which return valid results for every possible argument.

Hask

Because of the bottom, you’ll see the category of Haskell types and functions referred to as Hask rather than Set.

operational semantics: a formalized idealized interpreter denotational semantics: mathematical interpretation

Pure and Dirty Functions

Categories Great and Small

Zero categories: with zero objects and zero morphisms. Free category: any directed graph by adding more arrows. 1. identity arrow, 2. composition arrow. Preorder category: there is at most one morphism going from any object a to any object b.

A set of morphisms from object a to object b in a category C is called a hom-set and is written as C(a, b) .

Monoid as Set

A monoid is defined as a set with a associative binary operation and an unit element.

Monoid as Category

A monoid is a single object category.