# The underlying model of a morphism



$\newcommand{\M}{\mathcal{M}}\newcommand{\F}{\mathcal{F}}\newcommand{\E}{\mathcal{E}}\newcommand{\W}{\mathcal{W}}\newcommand{\oF}{\overline{\mathcal{F}}}\newcommand{\Q}{\mathcal{Q}}$
I've already talked about [generalised models](https://www.lesswrong.com/posts/nQxqSsHfexivsd6vB/generalised-models-as-a-category). The aim is not only to have a universal system for modelling any agent's mental model - universality is pretty easy to get - but a system where it's easy to recreate these mental models. And then analyse the [transition between models](https://www.lesswrong.com/posts/k54rgSg7GcjtXnMHX/model-splintering-moving-from-one-imperfect-model-to-another-1).

This post will show that if there is a morphism $r$ between two models (say, between ideal gas laws and models of atoms bouncing around), then there is an underlying model for that morphism.

Specifically, if $r$ is a morphism between $\M_0=(\F_0,Q_0)$ and $\M_1=(\F_1,Q_1)$, then there is a generalised model $\M_r$ defined from $r$. The features of this model are the combination of the features of the two models: $\F_0 \sqcup \F_1$, and there are natural morphisms $r_0$ and $r_1$ from this underlying model to $\M_0$ and $\M_1$:

![](https://www.dropbox.com/s/r74kqtfp5s8p8z0/underlying_model.png?raw=1)

Now, if $\W_0$ and $\W_1$ are the sets of possible worlds for $\M_0$ and $\M_1$, then $\W_0 \times \W_1$ is the set of possible worlds for $\M_r$. Then since $r$ is a relation between $\W_0$ and $\W_1$, it can be seen as subset of $\W_0 \times \W_1$. And the $Q_r$ is a probability distribution over this subset $r$.

What this means is that $Q_r$ measures how probability 'flows' from worlds in $\M_0$ to worlds in $\M_1$. If $(w_0,w_1)$ is an element of $r$, then $Q_r(w_0,w_1)$ measures how much probability is flowing from $w_0$ to $w_1$. The actual probability of $w_0$ is the sum of all probability flowing out of it; that of $w_1$, the sum of the probability flowing into it.

See for example this diagram, where the $Q_0$ probabilities are indicated in blue, those of $Q_r$ in black, and those of $Q_1$ in red. The probabilities $Q_0$ and $Q_1$ are the sum of the relevant probabilities $Q_r$ on the "edges" connecting to those points:

![](https://www.dropbox.com/s/o9sefwzngps5oyo/underlying.png?raw=1)

The distribution $Q_r$ is non-unique, though. The following two examples show situations with the same $Q_0$ and $Q_1$, but different $Q_r$:

![](https://www.dropbox.com/s/qfwq5308qxgv9p6/alternative_underlying.png?raw=1)

The rest of this post will be dedicated to prove the existence of the underlying model for the morphism $r$; it can be skipped if you aren't interested.

# Proof of underlying model

## Definitions

Previous [posts](https://www.lesswrong.com/posts/nQxqSsHfexivsd6vB/generalised-models-as-a-category) on generalised models defined them as triplets $\M = (\F,\E,Q)$, with $\F$ a set of features, $\W = 2^{\oF}$ the set of possible worlds for those features, $\E \subset \W$ a subset of environments, and $Q$ a probability distribution on $\E$.

But $\E$ was mainly superfluous, as $Q$ can be extended to a probability distribution on all of $\W$ just by setting it to be zero on $\W - \E$. Thus $\E$ was dropped from the definition.

The original definition allowed $Q$ to be a partial probability distribution, but here we'll assume it's a total probability distribution (though not necessarily normalised; $Q(\W)$ need not be $1$). The sets of features are assumed to be finite.

Then a morphism $r$ between generalised models $\M_0=(\F_0,Q_0)$ and $\M_1=(\F_1,Q_1)$ is a binary relation between $\W_0$ and $\W_1$, such that:

1. $Q_0(E_0) \leq Q_1(r(E_0))$,
2. $Q_1(E_1) \leq Q_0(r^{-1}(E_1))$.

We might extend the class of morphisms by defining relations that only obey the first inequality as "left-morphisms", and relations that only obey the second one as a "right-morphisms". Left-morphisms ensure probability isn't lost ($Q_1(\W_1) \geq Q_0(\W_0)$), right morphisms ensure probability isn't gained ($Q_0(\W_0) \geq Q_1(\W_1)$). Full morphisms, of course, ensure that probability isn't gained or lost ($Q_0(\W_0)=Q_1(\W_1)$).

Binary relations are not necessarily functions; functions are relations $r$ such that each $w_0$ in $\W_0$ is related to exactly one $w_1$ in $\W_1$.

## Statement of the theorem

Let $r$ be a morphism between $\M_0=(\F_0,Q_0)$ and $\M_1=(\F_1,Q_1)$. Then there exists a generalised model $\M_r=(\F_0\sqcup\F_1,Q_r)$, with natural function morphisms $r_0: \M_r \to \M_0$ and $r_1:\M_r\to M_1$.

The $Q_r$ is non-zero on a set contained in $r \subset \W_0\times\W_1 = 2^{\F_0}\times 2^{\F_1} = 2^{\F_0\sqcup \F_1}$. The $Q_r$ need not be uniquely defined, but the total measure of $Q_r$ is the same as $Q_0$ and $Q_1$:

$$Q_r(r) = Q_r(\W_0\times\W_1) = Q_0(\W_0) = Q_1(\W_1).$$

## Main proof

The function $r_0$ is just projection onto the first component: it sends $(w_0,w_1)$ to $w_0$. The functions $r_1$ conversely send $(w_0,w_1)$ to $w_1$.


Because $r_0$ and $r_1$ are functions, they can 'push-forward' any probability distribution $Q_r'$ on $\W_0\times\W_1$ to $\W_0$ and $\W_1$, respectively. This is given by: $r_0(Q_r')(w_0)= \sum_{w_1} Q_r(w_0,w_1)$, and similarly for $r_1(Q_r')$.

We aim to construct a $Q_r'$ such that $r_0(Q_r')=Q_0$ and $r_1(Q_r')=Q_1$; this will be our $Q_r$, and will make $r_0$ and $r_1$ into morphisms.

Define $Q'_r(w_0,w_1)$ to be zero if $(w_0,w_1)\notin r$, or $Q_0(w_0)=0$ or $Q_1(w_1)=0$. Thus we will ignore any elements of $\W_0$ and $\W_1$ of measure zero, and any element of $\W_0\times\W_1$ that is not in $r$.

Let $w_0\in \W_0$ be such that it is not related to any elements of $w_1$ by $r$. Then $Q_0(w_0) \leq Q_1(r(w_0)) = Q_1(\emptyset) = 0$. Thus any element of $\W_0$ with non-zero measure is related to some $w_1$ via $r$.

Then define a choice function $c$ that maps every element $w_0$ with $Q_0(w_0)>0$, to an element $w_1$ that it is related to by $r$. And define $Q_r'(w_0,c(w_0))=Q_0(w_0)$, and $Q_r'$ is zero on all other elements of $\W_0\times\W_1$.

Then $r_0(Q_r')(w_0)=\sum_{(w_0,w_1)} Q_r'(w_0,w_1) = Q_r'(w_0,c(w_0))= Q_0(w_0)$. Hence $r_0(Q_r')=Q_0$. Consequently, $Q_r'(\W_0\times\W_1)=Q_0(\W_0)$.

Define $\Q_0$ as the set of $Q_r'$, probability distributions on $r$ with $r_0(Q_r')=Q_0$. We've shown that $\Q_0$ is non-empty; moreover, any $Q_r' \in \Q_0$ has a total measure equal to $Q_0(\W_0) = q$. Since $Q_r'$ is defined on $r$, then it is contained in the set $[0,q]^r$.

The set $[0,q]^r$ is compact, and $r_0(Q_r')=Q_0$ is a closed condition, so $\Q_0$ is compact. The next section will prove that there is an element $Q_r'\in \Q_0$ with $r_1(Q_r')=Q_1$; that will complete the proof.

## Key lemmas


Define $L(Q_r') = |r_1(Q_r')-Q_1|_1 = \sum_{w_1\in\W_1} |r_1(Q_r')(w_1)-Q_1(w_1)|$. Now $L(Q_r')\geq 0$, and note that $L(Q_r') = 0$ is equivalent with $r_1(Q_r')=Q_1$.

Thus if $L$ takes the value $0$ on $\Q_0$, we've found the desired $Q_r$. We will show that this happens thanks to the following key lemma:

* Lemma 1: If there is a $Q_r'\in\Q_0$ with $L(Q_r') > 0$, then there exists a $Q_r''\in\Q_0$ with $L(Q_r'') < L(Q_r')$.

Now, since $\Q_0$ is compact and $L$ is continuous, it will attain its minimum $\mu$ on $\Q_0$. Then lemma 1 shows that $\mu=0$ (otherwise it wouldn't be a minimum).

Proof of Lemma 1:

Fix a $Q_r'$ with $L(Q_r')> 0$. Now $r_1(Q_r')(\W_1)=\sum_{(w_0,w_1)} Q_r'(w_0,w_1) = r_0(Q_r')(\W_0)=Q_0(\W_0)=Q_1(\W_1)$. So, since $L(Q_r') > 0$, there must exist a $w_1$ with $r_1(Q_r')(w_1) > Q_0(w_1)$.

By lemma 2 (see below), we'll show that there exists a path $\rho_n = w_1^0 w_0^1 w_1^1 w_0^2 \ldots w_0^n w_1^n$ with the following properties:

1. $w_1^0 = w_1$,
2. $(w_0^i w_1^i)$ and $(w_0^{i+1} w_1^i)$ are both elements of $r$,
3. the $Q_r'(w_0^{i+1} w_1^i)$ are all greater than $0$,
4. $w_1^n$ is such that $r_1(Q_r'(w_1^n)) < Q_1(w_1^n)$.

Then define $\epsilon>0$ to be the minimum of $\{r_1(Q_r')(w_1)-Q_1(w_1),$ $Q_r'(w_0^i w_1^i),$ $Q_1(w_1) - r_1(Q_r')(w_1^n)\}$.

We'll then define $Q_r''$ as $Q_r''(w_0^i w_1^i) = Q_r'(w_0^{i+1} w_1^i) - \epsilon$ (which is greater than $0$ by the definition of $\epsilon$), $Q_r''(w_0^i w_1^i) = Q_r'(w_0^i w_1^i) + \epsilon$, and $Q_r'' = Q_r$ otherwise.

Then notice that, apart from $w_1=w_1^0$ and $w_1^n$, $r_1(Q_r'')(w_0^i) =$ $\sum_{(w_0^i,w_1)\in r} Q_r''(w_0^i,w_1) =$ $r_1(Q_r'')(w_0^i) + \epsilon -\epsilon = r_1(Q_r'')(w_0^i)$. So $r(Q_r')$ and $r(Q_r'')$ differ only on $w_1$ and $w_1^n$; specifically

* $r(Q_r'')(w_1) = r(Q_r')(w_1) - \epsilon$,
* $r(Q_r'')(w_1^n) = r(Q_r')(w_1^n) + \epsilon$.

Since $r(Q_r'')(w_1) \geq Q_1(w_1) + \epsilon$ and $r(Q_r'') \leq Q_1(w_1^n) - \epsilon$, we have $L(Q_r'') = L(Q_r') - 2 \epsilon$. This proves Lemma 1.


* Lemma 2: There exists a path $\rho_n = w_1^0 w_0^1 w_1^1 w_0^2 \ldots w_0^n w_1^n$ with the following properties:
1. $w_1^0 = w_1$,
2. $(w_0^i w_1^i)$ and $(w_0^{i+1} w_1^i)$ are both elements of $r$,
3. the $Q_r'(w_0^{i+1} w_1^i)$ are all greater than $0$,
4. $w_1^n$ is such that $r_1(Q_r'(w_1^n)) < Q_1(w_1^n)$.

Proof of Lemma 2:

Let $W_1 \subset \W_1$ be the set of all elements of $\W_1$ that can be reached by paths $\rho_n$ (ie are $w_1^n$) that obey the first three properties above. Let $W_0 \subset \W_0$ be the set of all elements of $\W_1$ that are $w_0^n$ for some path $\rho_n$ that obey the first three properties above. Then clearly $W_1=r(W_0)$, by the second condition above (note that the third condition doesn't affect $(w_0^n w_1^n)$, which is only required to be in $r$).

Since $r$ is a morphism, $Q_0(W_0) \leq Q_1(W_1)$.

Note that if $Q_r'(w_0,w_1') > 0$ with $w_1' \in W_1$, then $w_0$ must be in $W_0$; this is because we could add $w_0w_1'$ as $w_0^{n+1} w_1^{n+1}$ to any path $\rho_n$ that reaches $w_1'$, getting a slightly longer path that goes via $w_0$ and thus puts it in $W_0$.

Consequently, $r_1(Q_r')(W_1) =$ $\sum_{(w_0',w_1') \in r, w_1'\in W_1} Q_r'(w_1')=$ $\sum_{(w_0',w_1') \in r, w_0'\in W_0} Q_r'(w_0')=$ $Q_0(W_0)$.

So $r_1(Q_r')(W_1) = Q_0(W_0) \leq Q_1(W_1)$. Since $W_1$ includes $w_1$ with $r_1(Q_r')(w_1) > Q_1(w_1)$, it also much include at least one $w''_1$ with $r_1(Q_r')(w_1'') < Q_1(w_1'')$.

The path $\rho_n$ that reaches this $w''_1$ will then satisfy the fourth condition of the lemma, proving it.