Non-formal introduction - just some motivational examples

## Peano axioms

See Peano axioms for details. I will give simplified explanation:

- $N=0$ - zero is a natural number
- $N+1$ - is a natural number

So solution of this equation: $N=N+1|0$ forms all natural numbers.

**Solution** in this case can refer to (either):

- minimal solution
- unique solution
- maximal solution

**Result**: $N={0,1,2…}$

## Kleene closure

Classically denoted as $a_{∗}$. But also can be written in form of Chomsky rules:

- $S→ϵ$
- $S→S⋅a$

So solution of this equation: $S=S⋅a|ϵ$ forms language for Kleene closure $a_{∗}$.

**Result**: $S={ε,a,aa…}$ e.g. empty string, string “a”, string “aa” etc.

## ADT list

Type signature for linked list in terms of ADT

```
List(T) = T * List(T) + 1
```

Or the same in terms of TypeScript:

**Result**: $List(T)={1,T,T∗T…}$ e.g. empty list, list with one item of type T, list with two items of type T, etc.

## Conclusion

As we can see it’s all the same principles, but symbols are a bit different

Numbers | Languages | Types | Sets |
---|---|---|---|

+ | | | + | $∪$ |

* | $⋅$ | * | $×$ |

0 | $∅$ | $∅$ | ${}$ |

1 | $ϵ$ | 1, null, $()$ | ${ε}$ |

- Algebra allows to describe “structures”
- Algebra can be applied to different areas. I skipped all details, but there are formal definitions which allow to specify exactly how operations behave, which allows to find exact correspondence between different system
- List is a graph (DAG), which brings us to idea that we can use algebra to specify graphs

Related subjects:

- Algebraic graphs
- Combinatorial species
- Algebraic property graphs
- Categorical query language

See also: