BM Category Theory : Motivation and Philosophy

Object-Oriented  has 2 weaknesses for Concurrency and Parallel programming : 

  1. Hidden Mutating States; 
  2. Data Sharing.

Category Theory (CT): a higher abstraction of all different Math structures : Set , Logic, Computing math, Algebra… =>

\boxed {\text {CT reveals the way how our brain works by analysing, reasoning about structures !}}

Our brain works by:  1) Abstraction 2) Composition 3) Identity (to identify)

What is a Category ? 
1) Abstraction:

  •  Objects
  • Morphism (Arrow)

2) Composition: Associative 
3) Identity

Notes: 

  • Small  Category with “Set” as object. 
  • Large Category without Set as object.
  • Morphism is a Set : “Hom” Set.


Example in Programming
:

  • Object : Types Set
  • Morphism : Function “Sin” converts degree to R: \sin \frac {\pi}{2} = 1

Note: We just look at the Category “Types Set” from external Macroview, “forget ” what it contains, we only know the “composition” (Arrows) between the Category “Type Set”, also “forget” what these Arrows (sin,cosin, tgt, etc) actually are, we only study these arrows’ behavior (Associativity).

2.1 : Function of Set, Morphism of Category

Set: A function is 

  • Surjective (greek: epic / epimorphism 满射),
  • Injective (greek : monic / monomorphism 单射)

Category:  [Surjective]

g 。f = h 。f
=> g = h (Right Cancellation )

2.2 Monomorphism 

f 。g = f 。h
=> g = h
(Left cancellation)

\boxed { \text {Epimorphism + Monomorphism =? Isomorphism }}

NOT Necessary !! Reason ( click here): 

In Haskell, 2 foundation Types: Void, Unit

Void = False
Unit ( ) = True

Functions : absurd, unit
absurd :: Void -> a (a = anything)
unit :: a -> ()

[to be continued 3.1 ….]

Advertisements

One thought on “BM Category Theory : Motivation and Philosophy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s