My reading notes from the book.

Table of Contents

Note: All figures are taken from the book.

ch01: Introduction

ontology logs: ologs
  to give structure to the kinds of ideas that are often communicated in graphics
  it encompasses a database schema
category theory
  communication of ideas between different fields in mathematics
  different branches can be formalized into categories
  categories are connected by functors
transfer of proofs
  theorems proven in one category
  transferred through a functor to yield proofs in another category
functor is like
  conductor of mathematical truth
use in scientific models
  study of basic building blocks
  certain structures show up again and again
    vector spaces
    also hierarchies, daat models, self-similarity

1.1 A brief history of category theory

invented in early 40s by Samuel Eilenberg and Saunders Mac Lane
  to bridge topology and algebra
  there were already links (such as cohomology theory)
  but they compared different links with one another precisely
  first: extract fundamental nature of these two fields
    ideas fit to other mathematical disciplines as well
first use: clarifying lanugage for existing mathematical ideas
  1957 Grothendieck used it to build new mathematical fields: new cohomology theories
    that made insight into behavior of algebraic equations
Bull Lawvere: foundation for all mathematical thought
  19th century: foundation was set theory
  Lawvere showed category of sets is one category but not the center of mathematical universe
1980 Joachim Lambek: types and programs form a specific kind of category
  new semantics on how programs combine to create other programs
Eugenio Moggi: brought monads into programming
Daniel Kan, Andre Joyal
language of choice for algebra
main use: bridge

1.2 Intention of this book

applied mathematics is much smaller than 
  applicable mathematics
abstract conceps can be communicated to scientists
journals: substantial experties
  it is impossible to read a methods section and repeat the experiment
first goal: reusable methodologies can be formalized
  ct is incredibly efficient
    as a language for experimental design patterns
    researches has ability to think about models that is impossible without it
    forces a person to clarify her assumptions
  value: conceptual chaos is a major problem
    creativity demands clarity of thinking
      how pieces fit together

1.3 What is requested from the student

only way to learn mathematics: doing exercises

1.4 Category theory references

most books: for mathematicians or computer scientists

ch02 The Category of Sets

theory of sets
  invented as a foundation for all mathematics
  serves as a basis to build intuition about categories
this chapter
  sets, functions, commutative diagrams
category of sets: Set

2.1 Sets and functions

[a thing] is put into -> [a bin]

2.1.1 Sets

a set X: a collection of elements x ∈ X
  we can tell if x = x' or not
notation symbol ∅ denotes set with no elements, also {}
  N: natural numbers
  Z: natural numbers annd their negatives
if A and B are sets
  we say A is a subset of B, also A ⊆ B
    if every element of A is an element of B
for any set A
  ∅ ⊆ A and A ⊆ A
set-builder notation to denote subsets
  ex: set of even integers: {n ∈ Z| n is even}
  ex: set of integers greater than 2:
    {n ∈ Z | n > 2}
symbol ∃: there exists
  ex: set of even integers
    {n ∈ Z | n is even} = {n ∈ Z | ∃ m ∈ Z st 2m = n}
symbol ∃!: there exists a unique
symbol ∀: for all
colon equals notation ":=": define x to be y

2.1.2 Functions

if X and Y are sets
  then a function f from X to Y
  denoted f:X->Y
  is a mapping that sends each element x ∈ X to an element of Y denoted f(x) ∈ Y
  X: domain of function f
  Y: codomain of f
  given a function f: X -> Y
  we say: 
    X: a set of things
    Y: a set of bins
  function tells us in which bin to put each thing
    X is a set 
    X' ⊆ X is a subset
  consider function: X' -> X
    given by sending every element of X' to itself
    i:X'⊆ X
      i is the name of the associated function
image of f:
  given f:X->Y
  elements of Y that have at least one arrow pointing to them: are in the image of f
  im(f) := {y∈Y| ∃ x ∈ X st f(x) = y}
image of f is always a subset of its codomain
  im(f) ⊆ Y
    f: X -> Y
    g: Y -> Z
    ie: codomain of f is domain of g
  then: f and g are composable
    [X] f-> [Y] g-> [Z]
    composition of f and g
    g · f: X -> Z
image of set A:
  if A ⊆ X
    then: i: A -> X
  given f: X -> Y
    then: we can compose
      [A] i-> [X] f-> [Y]
      f · i: A -> Y
  image of this function is denoted
    f(A) := im(f·i)
notation represents
    X be a set
    x ∈ X an element
  there is a function {😃 } -> X
    that sends 😃  → x
    this function represents x ∈ X
    x: {😃 } -> X
    X a set
    x ∈ X an element
    x:{😃 } -> X function representing it
  given f:X->Y
  what is f·x?
    function {😃 } -> Y
      that sends 😃  to f(x)
    it represents the element f(x)
  g·f(a) means g(f(a))
    do g to whatever results from doing f to a
  diagrammatic order:
    another way to write composition
    f;g: A -> C
      means: "do f, then do g"
  given an element a ∈ A
    represented by a:{😃 } -> A
    we have an element:
  let: X,Y sets
  set of functions X->Y
    denoted as: Hom_{Set}(X,Y)
    two functions f,g:X->Y are equal
      iff ∀ x ∈ X, f(x) = g(x)
  let A = {1,2,3}, B = {x,y}
  how many elements does Hom_{Set}(A,B) have?
identity function on X
  id_X: X -> X
  st ∀ x ∈ X, id_X(x) = x
definition isomorphism
  let X, Y be sets
  function f:X->Y is an isomorphism
    denoted [f:X] ≅-> [Y]
  if ∃ g:Y->X st.
    g·f = id_X and f·g = id_Y
  we also say
    f is invertible
    g is the inverse of f
    X and Y are isomorphic sets
    X ≅ Y
    one-to-one correspondence
  isomorphism between Nuc_{DNA} nucleotides in DNA and Nuc_{RNA} nucleotides in RNA
  boths sets have 4 elements
    so there are 24 different isomorphisms
    only one is useful in biology
  another isomorphism: Nuc_{DNA} ≅ {A,C,G,T} and Nuc_{RNA} ≅ {A,C,G,U}
    so we can use those letters as short form for nucleotides
  convenient isomorphism [Nuc_{DNA}] ≅-> [Nuc_{RNA}] is given by RNA transcription:
    A→U, C→G, G→C, T→A
  another isomorphism: [Nuc_{DNA}] ≅-> [Nuc_{DNA}] the matching in double helix, given by:
    A→T, C→G, G→C, T→A
  protein production:
    a function from the set of 3-nucleotide sequences to the set of amino acids
    it cannot be isomorphism because 
      4^3=64 triplets of RNA nucleotides
      but only 21 eukaryotic amino acids
  1. any set A is isomorphic to itself
  2. if A is isomorphic to B, then B is isomorphic to A
  3. if A ≅ B and B ≅ C, then A ≅ C
  even if two sets are isomorphic, they cannot be treated as the same
  to be treated as same,
    we need to have in hand a specified isomorphism
  find A st for any set X, there is an isomorphism of sets
    X ≅ Hom_{Set}(A,X)
  ∀ n ∈ N, define a set ṉ := {1,2,3,...,n}
  ṉ the numeral set of size n 
    2_ = {1,2}, 1_ = {1}, 0_ = ∅ 
  let A be any set
  function f:ṉ->A can be written as a length n sequence:
    f = (f(1),f(2),...f(n))
  called: sequence notation for f
  a. A = {a,b,c 2017-01-28}. 
    if f:10_->A is in sequence notation as (a,b,c,c,b,a,d,d,a,b)
    what is f(4)?
definition cardinality of finite sets
  A a set. n ∈ N 
  A has cardinality n
    |A| = n
  if there exists an isomorphism of sets A ≅ ṉ
  if A has cardinality n, then A is finite
  other wise A is infinite
  we write |A| ≥ ∞ 
  if there is an isomorphism of sets f:A->B
    then |A| = |B|

2.2 Commutative diagrams

  [A] f-> [B]
  [A] h-> [C]
  [B] g-> [C]
  we say:
    a diagram of sets if A,B,C is a set and each of f,g,h is a function
    this diagram commutes if g·f=h
    we refer to it as a commutative triangle of sets, or as a commutative diagram of sets
    function from DNA to RNA
    function from RNA to amino acids
  we say: translation from DNA to amino acids
    following commutative diagram is this fact:
      [DNA] -> [RNA]
      [RNA] -> [AA]
      [DNA] -> [AA]
  [A] f-> [B]
  [A] h-> [C]
  [B] g-> [D]
  [C] i-> [D]
  we say:
    diagram of sets if 
      each A,B,C,D is a set
      each f,g,h,i is a function
    this diagram commutes if
      g·f = i·h
      then we refer: commutative square of sets
      or commutative diagram of sets
  given a system S
  there are two mathematical approaches:
  either results in a prediction:
  diagram commutes = both approaches give the same result

2.3 Ologs

  serve as a bridge between mathematics and various conceptual landscapes
    [A| arginine] is-> [D| an amino acid found in dairy]
    [A] has -> [E| an electrically charged side chain]
    [D] is -> [X| an amino acid]
    [A] is -> [X]
    [E] is -> [R| a side chain]
    [X] has -> [R]
    [X] has -> [N| an amine group]
    [X] has -> [C| a carboxylic acid]

2.3.1 Types

type: an abstract concept
  represented as a box
    containing a singular indefinite noun phrase
      [a man]
      [an automobile]
      [a pair (a,w) where w is a woman and a is an automobile]
    each box represents a type of thing
    label on that box: each example of that class
      thus: [a man] is not a single man, but the set of men. each example of which is called [a man] Types with compound structures
compound structures: composed of smaller units
  [a man and a woman]
  [a food portion f and a child c such that c ate all of f]
good practice to declare variables in a compound type
    [a man and a woman]
    [a pair (m), where m is a man and w is a woman]
rules of good practice
  a type is presented as a text box
  text should
    begin with word "a"
    refer to a distinction made by the author
    refer to a distinction for which instances can be documented
    use common name for each instance
    declare all variables in compound structures
    [Steve] stands as a nickname for [a thing classified as Steve]
    [arginine] for [a molecule of arginine]

2.3.2 Aspects

aspect of a thing x
  a particular way in which x can be regarded
  a woman can be regarded as a person
    being a person is an aspect
    [a woman] is-> [a person]
  a molecule has a molecular mass
    having a molecular mass is an aspect
    [a molecule] has a molecular mass-> [a positive real number]
aspect: means function
  domain A: the thing we are measuring
  codomain B: set of possible answers of the measurement
  [a woman] is-> [a person]
  domain: set of women (3 billion elements)
  codomain: set of persons (6 bil elements)
  no woman points to two different people nor to zero people
    so this is a function
  [a molecule] has a molecular mass-> [a positive real number]
  domain: set of molecules
  codomain: positive real numbers
  for each molecule: there is a corresponding positive real number
  no molecule has two different masses, nor no mass Invalid aspects
to be valid: aspect must be a functional relationship
  [a person] has-> [a child]
  a person may have no children, or multiple children. hence not a function Reading aspects and paths as English phrases
each arrow (aspect) [X] f-> [Y]
  read by order: 
    ex: [a book] has as first author -> [a perso]
      a book has as first author a person
  [a book] has as author -> [a person]
    not valid
    because it is not functional
if it is obvious, you can drop labels on arrows
    [A| a pair (x,y) where x and y are integers] x -> [B| an integer]
    [A] y -> [B'| an integer]
  label x is as a nickname for the full name "yields as the value of x"
opt: use "which" before each arrow label Converting nonfunctional relationships to aspects
  [a person] owns -> [a car]
  valid form:
    [A| a pair (p,c), where p is a person, c is a car, and p owns c] p -> [a person]
    [A] c -> [a car]

2.3.3 Facts

fact: path equivalences in an olog
  this is what makes category theory so powerful
path in an olog: head-to-tail sequence of arrows
  number of arrows: length of the path
  B0: source
  Bn: target
two paths are equivalent:
  triangle in olog commutes
    A -> B -> C
    A -> C
  commutative diagrams
    [A| a person] has as parents -> [B| a pair (w,m), w: woman, m: man]
    [B] yields as w -> [C| a woman]
    [A] has as mother -> [C]
notation: a diagram commutes:
  A[f,g] ≅ A[h,i]
    starting from A, 
      doing f, then g
      is equivalent to
      doing h, then i
  [A| a DNA sequence] is transcribed to -> [B| an RNA sequence]
  [B] is translated to -> [C| a protein]
  [A] codes for -> [C]
  [a child] has -> [a mother]
  [a mother] is -> [a person]
  [a child] is -> [a person]
  this triangle doesn't commute
  if they would, we would say: "a child and its mother are the same person"
  [a person] has as father -> [a man]
  [a man] lives in -> [a city]
  [a person] lives in -> [a city]
  noncommuting diagram A formula for writing facts as English
paths: P, Q
  consider olog
    [A|a person]
    [B| an address]
    [C| a city]
    [A] has -> [B]
    [B] is in -> [C]
    [A] lives in -> [C]
  to put this diagram commutes into English:
    two paths:
      F="a person has an address which is in a city"
      G="a person lives in a city"
      source of both: s="a person"
      target of both: t="a city"
      given x, a person, consider the following.
      We know that x is a person,
      who has an address, which is in a city,
      that we call P(x).
      We also know that x is a person,
      who lives in a city
      that we call Q(x).
      Fact: Whenever x is a person, we will have P(x) = Q(x).
    more concisely:
      A person x has an address, which is in a city, and this is the city x lives in.
  paths: P,Q
    P: [a0=s] f1-> [a1] f2-> [a2] ... fm -> [am=t]
    Q: [b0=s] g1-> [b1] g2-> [b2] ... gm -> [bm=t]
  every part l (ie. every box and every arrow) has an English phrase
    denoted: <<l>>
  englished as:
    Given x,<<s>> consider the following.
    We know that x is <<s>>,
    which <<f1>><<a1>>, which <<f2>><<a2>>,..., which <<fm>><<t>>,
    that we call P(x).
    We also know that x is <<s>>,
    which <<g1>><<b1>>, which <<g2>><<b2>>,..., which <<gm>><<t>>,
    that we call Q(x).
    Fact: Whenever x is <<s>>, we will have P(x)=Q(x).
    [OLP| an operational landline phone]
    [N| a phone number]
    [C| an area code]
    [P| a physical phone]
    [R| a region]
    [OLP] is assigned -> [N]
    [N] has -> [C]
    [C] corresponds to -> [R]
    [OLP] is -> [P]
    [P] is currently located in -> [R]
  short form:
    [OLP] is assigned -> [N] has -> [C] corresponds to -> [R]
    [OLP] is -> [P] is currently located in -> [R] Images
  set of mothers is the image of the "has as mother" function
    [P|a person]
    [P'|a person]
    [M|a mother]
    [P] has as mother -> [P']
    [P] has -> [M] is -> [P']

ch03: Fundamental Considerations in Set

3.1 Products and coproducts

3.1.1 Products

  product of X and Y
    denoted X ⨯ Y 
    is set of ordered pairs (x,y), x ∈ X and y ∈ Y
  X ⨯ Y = {(x,y)| x ∈ X, y ∈ Y}
there are two natural projection functions:
  π1: X ⨯ Y -> X
  π2: X ⨯ Y -> Y
    [X⨯Y] π1 -> [X]
    [X⨯Y] π2 -> [Y]
    +: Z ⨯ Z -> Z addition function
    ·: Z ⨯ Z -> Z multiplication function Universal property for products

  for f:A->X and g:A->Y
  ∃ a unique function A -> X ⨯ Y
  st the following diagram commutes:
    [X ⨯ Y] π1 -> [X]
    [X ⨯ Y] π2 -> [Y]
    [A] f -> [X]
    [A] g -> [Y]
    [A] <f,g> -> [X ⨯ Y] 
  we say:
    this function is induced by f and g
      <f,g>: A -> X ⨯ Y
      <f,g>(a) = (f(a),g(a))
    that is:
      π1 · <f,g> = f
      π2 · <f,g> = g
      <f,g> is the only function for which this is so
  for every set A there is some relationship between the following three sets:
    there is an isomorphism
    Hom_{Set}(A,X⨯Y) ≅ -> Hom_{Set}(A,X) ⨯ Hom_{Set}(A,Y)
    height function: from set P of people to Z of integers
    name function: from P to S of strings
    so, we have 
      an element of Hom_{Set}(P,Z) and 
      an element of Hom_{Set}(P,S) 
    from this we get an element of:
      Hom_{Set}(P,Z) ⨯ Hom_{Set}(P,S)
    ie: two pieces of information combined
      we pack height and name into a single datum
        ie. an element of Z ⨯ S
    π1: X ⨯ Y -> X
    π2: X ⨯ Y -> Y
    p1: Y ⨯ X -> Y
    p2: Y ⨯ X -> X
  construct swap map:
    s: X ⨯ Y -> Y ⨯ X
    write s in terms of π, p, ·, <, >
    s = <π2,π1> Ologging products

3.1.2 Coproducts

  coproduct of X and Y 
  denoted X ▄ Y
  is defined as disjoint union of X and Y
    ie. the set for which an element is either from X or Y
  two natural inclusion functions:
    i1: X -> X ▄ Y
    i2: Y -> X ▄ Y
  coproduct of X := {a,b,c} and Y := {1,2}
    X ▄ Y ≅ {a,b,c,1,2}
coproduct of X and itself
  X ▄ X ≅ {a1,b1,c1,a2,b2,c2}
names of the elements in X ▄ Y are not important
  inclusion maps i1,i2 are important
  which ensure we know where each element is from
ex Airplane seats
  X: an economy-class seat in an airplane
  Y: a first-class seat in an airplane
  X▄Y: a seat in an airplane
  [X] is -> [X▄Y]
  [Y] is -> [X▄Y]
  coproduct is inheritance is-a relationship
  product is join table
  is [a phone] is coproduct of [a cell phone] and [a landline phone]?
    if there is no phone other than a cell phone and landline phone, yes. if not, no
ex disjoint union of dots
  /Users/mertnuhoglu/Dropbox/public/img/ss-26.png Universal property for coproducts

  the following diagram commutes:
    X i1 -> X ▄ Y
    Y i2 -> X ▄ Y
    X f -> A
    Y g -> A
    X ▄ Y {f g -> A
  this function is induced by f and g
  ie. we have
    {f g · i1 = f
    {f g · i2 = g
  any time behavior is determined by cases, there is a coproduct involved
why two-line symbol {
  because this is case notation