# is bko related to category theory

I don't know for sure, since I am a long, long way from being a mathematician. But by the wikipedia definition, it just might be the case.

Wikipedia gives this definition for a category and a functor:

```A category C consists of the following three mathematical entities:

A class ob(C), whose elements are called objects;
A class hom(C), whose elements are called morphisms or maps or arrows. Each morphism f has a source object a and target object b.
The expression f : a → b, would be verbally stated as "f is a morphism from a to b".
The expression hom(a, b) — alternatively expressed as homC(a, b), mor(a, b), or C(a, b) — denotes the hom-class of all morphisms from a to b.
A binary operation ∘, called composition of morphisms, such that for any three objects a, b, and c, we have hom(b, c) × hom(a, b) → hom(a, c). The composition of f : a → b and g : b → c is written as g ∘ f or gf,[4] governed by two axioms:
Associativity: If f : a → b, g : b → c and h : c → d then h ∘ (g ∘ f) = (h ∘ g) ∘ f, and
Identity: For every object x, there exists a morphism 1x : x → x called the identity morphism for x, such that for every morphism f : a → b, we have 1b ∘ f = f = f ∘ 1a.

Functors are structure-preserving maps between categories. They can be thought of as morphisms in the category of all (small) categories.

A (covariant) functor F from a category C to a category D, written F : C → D, consists of:

for each object x in C, an object F(x) in D; and
for each morphism f : x → y in C, a morphism F(f) : F(x) → F(y),

such that the following two properties hold:

For every object x in C, F(1x) = 1F(x);
For all morphisms f : x → y and g : y → z, F(g ∘ f) = F(g) ∘ F(f).
```

with the mapping:
```objects -> kets
morphisms -> operators
morphism composition -> operator composition
category -> sw file
functor -> code that maps one sw file to another, with the same network structure, but different ket and operator names.
```
noting that our operators naturally satisfy the associativity requirement, and it is easy to create identity morphisms.

So, a for example in BKO:
```f |a> => |b>
id-a |a> => |a>

g |b> => |c>
id-b |b> => |b>

h |c> => |d>
id-c |c> => |c>

id |*> #=> |_self>
```
And then a demonstration of operator composition:
```sa: f |a>
|b>

sa: f id-a |a>
|b>

sa: id-b f |a>
|b>

sa: g f |a>
|c>

sa: h g f |a>
|d>
```
Perhaps we should not be surprised by this correspondence (providing it is true). Why? Well the project is trying to demonstrate BKO is a general representation for knowledge, and that representation has a natural interpretation of being manipulating network state. Maths is a subset of human knowledge, so there must be a way to represent that in BKO. The question is how compact is that representation? I don't know. Consider group theory. And say we want to represent that in BKO. By what we just said, there must be a representation of that in terms of networks. But how big or how small is this network? I suspect it is on the smaller side. My hunch being that abstract things have a smaller network structure than concrete things. I say this because concrete things have all these links to specific examples, and their related networks. An abstract maths idea can exist on its own without this. And the other reason is the very definition of abstract mathematics. It is abstracting the essence from a series of examples with the same structure. The essence of a thing being smaller than the thing. Though all the in-brain/in-mathematician machinery to manipulate mathematical objects adds to the size of the network!

A thing to wonder is, what is the category theory equivalent of mapping a ket to a superposition, or to a superposition with coeffs other than 1? eg:
```f |x> => |a> + |b> + |c> + |d> + |e>
g |y> => 3.7|a> + |b> + 2.2218|c> + 13|e>
```
Though I don't want to tread too far into real mathematics, I'm not a mathematician and would make a fool of myself.

1) standard semantic web is somewhat close to a category too, with the mapping:
```objects -> URI's
morphisms -> URI's
category -> RDF file```
however, RDF, as far as I know, doesn't have morphism composition, or identity morphisms.

2) metaphors and analogies are approximately like functors. Though only approximate, in most cases, since analogies are rarely perfect. You can usually push them too far, to a point where the two systems have different properties.

Update: a demonstration of 3 ways that we have "commuting" operators:
```-- trivial, f is essentially the same as g:
f |a> => |b>
f |b> => |c>
g |a> => |b>
g |b> => |c>

-- now test:
sa: g f |a>
|c>

sa: f g |a>
|c>

-- this time, make use of float commutation:
f |a> => 0.71 |b>
f |b> => 0.71 |c>
g |a> => 3.5 |b>
g |b> => 3.5 |c>

-- now test:
sa: g f |a>
2.485|c>

sa: f g |a>
2.485|c>

-- finally, "g f" and "f g" use different pathways, but end at the same spot:
f |a> = |x>
f |y> => |b>
g |a> => |y>
g |x> => |b>

-- now test:
sa: g f |a>
|b>

sa: f g |a>
|b>
```

Home
previous: how well do you know x
next: ket arithmetic

updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org