Solving equations is computing pre-images
$$f^{-1}(y) = \left\{(x) \in X: f(x) = y \right\}$$
$$ f: X \longrightarrow Y $$
Rules
Fuck math. Let me say that a set $X$ is just a type X in C.
A composition law on $X$ is just a function $f$:
$$ \begin{align*} f: X \times X &\longrightarrow X\\ (x_0, x_1) &\longmapsto f(x_0, x_1) \end{align*} $$
The above is mathematical notation for what in C would be:
X foo(X x0, X x1);
Say $(X, f)$ and $(Y, g)$ are two set+compostion law pair.
Let $\phi$ a function $$\phi:X\longrightarrow Y$$ that would be
Y phi(X x);
We say that $\phi$ is a morphism if $$\phi(f(x0, x1)) = g(\phi(x0), \phi(x1))$$
X foo (X x0, X x1);
Y bar (Y y0, Y y1);
Y phi (X x);
/*
* Then, if phi is a morphism:
* phi(foo(x0, x1)) == bar(phi(x0), phi(x1))
*
*/
Total functions
A function is total if the output is well defined for all possible inputs. For composition laws, that is:
$$\forall x_0, x_1 \in X, f(x0, x1) \in X$$
In C we may want to use the errno for that:
errno = 0;
X x = foo(x0, x1);
// If foo is total: errno == 0 is always true;
Associativity
A composition law $f$ is associative if
$$f(f(x0, x1), x2) = f(x0, f(x1, x2))$$
foo(x0, foo(x1, x2)) == foo(x0, foo(x1, x2))
Identity
A right-identity is an element $e_r \in (X,f)$ such that
$$ f(x,e_r) = x; $$
A left-identity is an element $e_\ell \in (X,f)$ such that
$$ f(e_\ell, x) = x; $$
Division
A left-division, $a \setminus b$ is an elemnt $x \in X$ such that
$$ f(b, x) = a; $$
A right-division, $a / b$ is an element $x \in X$ such that
$$ f(x, b) = a; $$
Groups
A composition law $\star$ on a set $X$ is just a function
``
| Object \ Composition | Total | Associative | Identity | Divisible |
|---|---|---|---|---|
| Partial magma | 0 | 0 | 0 | 0 |
| Magma | 1 | 0 | 0 | 0 |
| Semigroupoid | 0 | 1 | 0 | 0 |
| Semigroup | 1 | 1 | 0 | 0 |
| ??? | 0 | 0 | 1 | 0 |
| Unital magma | 1 | 0 | 1 | 0 |
| Small category | 0 | 1 | 1 | 0 |
| Monoid | 1 | 1 | 1 | 0 |
| ??? | 0 | 0 | 0 | 1 |
| Quasigroup | 1 | 0 | 0 | 1 |
| ??? | 0 | 1 | 0 | 1 |
| Associ quasigroup | 1 | 1 | 0 | 1 |
| ??? | 0 | 0 | 1 | 1 |
| Loop | 1 | 0 | 1 | 1 |
| Groupoid | 0 | 1 | 1 | 1 |
| Group | 1 | 1 | 1 | 1 |
A group is a pair $(G, \star)$, where:
- $G$ is a set
- $\star$ is a composition law on $G$
That means
is such that
Examples
- $(\mathbb{Z}, +)$
$$(X,f,g)$$
$$g(x_0, f(x_1, x_2)) = f(g(x_0, x_1), g(x_0, x_2))$$
$$g(f(x_0, x_1), x_2) = f(g(x_0, x_2), g(x_1, x_2))$$