# Subagents of Cartesian Frames

Here, we introduce and discuss the concept of a subagent in the [Cartesian Frames](https://www.lesswrong.com/posts/BSpdshJWGAW6TuNzZ/introduction-to-cartesian-frames) paradigm.

Note that in this post, as in much of the sequence, we are generally working up to [biextensional equivalence](https://www.lesswrong.com/posts/pWruFSY7494vnucCE/biextensional-equivalence). In the discussion, when we informally say that a frame has some property or is some object, what we'll generally mean is that this is true of its biextensional equivalence class.

1\. Definitions of Subagent
---------------------------

**1.1. Categorical Definition**

**Definition:** Let $C$ and $D$ be Cartesian frames over $W$. We say that $C$'s agent is a subagent of $D$'s agent, written $C\triangleleft D$, if for every morphism $\phi:C\rightarrow\bot$ there exists a pair of morphisms $\phi_0:C\rightarrow D$ and $\phi_1:D\rightarrow\bot$ such that $\phi=\phi_1\circ\phi_0$.

Colloquially, we say that every morphism from $C$ to $\bot$ factors through $D$. As a shorthand for "$C$'s agent is a subagent of $D$'s agent," we will just say "$C$ is a subagent of $D$."

At a glance, it probably isn't clear what this definition has to do with subagents. We'll first talk philosophically about what we mean by "subagent", and then give an alternate definition that will make the connection more clear.

When I say "subagent," I am actually generalizing over two different relationships that may not immediately seem like they belong together.

First, there is the relationship between the component and the whole. One football player is a subagent of the entire football team.

Second, there is the relationship between an agent before and after making a precommitment or a choice. When I precommit not to take a certain action, I am effectively replacing myself with a weaker agent that has fewer options. The new agent with the commitment is a subagent of the original agent.

These are the two notions I am trying to capture with the word "subagent". I am making the philosophical claim that we should think of them primarily as one concept, and am partially backing up this claim by pointing to the simplicity of the above definition. In a future post, we will discuss the formal differences between these two kinds of subagent, but I think it is best to view them as two special cases of the one simple concept.

(My early drafts of the "[Embedded Agency](https://www.lesswrong.com/s/Rm6oQRJJmhGCcLvxh)" sequence used the word "subagent" in the title for both the [Subsystem Alignment](https://www.lesswrong.com/posts/ChierESmenTtCQqZy/subsystem-alignment) and [Robust Delegation](https://www.lesswrong.com/s/Rm6oQRJJmhGCcLvxh/p/iTpLAaPamcKyjmbFC) sections.)

**1.2. Currying Definition**

**Definition:** Let $C$ and $D$ be Cartesian frames over $W$. We say that $C\triangleleft D$ if there exists a Cartesian frame $Z$ over $\mbox{Agent}(D)$ such that $C\simeq D^\circ(Z)$.

Assume for this discussion that we only care about frames up to biextensional equivalence. In effect, the above definition is saying that "$C$ is a subagent of $D$" means "$C$'s agent is playing a game, $Z$, where the stakes are to help decide what $D$'s agent does." (And this game may or may not have multiple players, and may or may not fully cover all the options of $D$'s agent.)

Letting $C=(A,E,\cdot)$ and $D=(B,F,\star)$, it turns out (as we will see later) that we can explicitly construct $Z$. $Z=(A,X,\diamond)$, where $X$ is the set of all morphisms from $C$ to $D$, and $\diamond:A\times X\rightarrow B$ is given by $a\diamond(g,h)=g(a)$.

We will later prove the categorical and currying definitions equivalent, but let's first interpret this definition using examples.

$Z$ is a Cartesian frame whose agent is the agent of $C$ and whose world is the agent of $D$. This seems like the kind thing we would have when $C$ is a subagent of $D$.

Thinking about the football example: We have the football player $A$ as the agent in a Cartesian frame $C$ over the world $W$. We also have the football team $B$ as the agent in a Cartesian frame $D$ over the same world $W$.

$Z$ is a Cartesian frame *over the football team*; and the agent of this frame is again the football player $A$. $X$, the environment of $Z$, represents the rest of the football team: the player's effect on the team as a whole (here treated as the player's world) is a function of what the player chooses and what the rest of the team chooses. We can think of $Z$ as representing a  "zoomed-in" picture of $A$ interacting with its local environment (the team), while $C$ represents a "zoomed-out" picture of $A$ interacting with its teammates *and* the larger world (rival teams, referees, etc.).

$D^\circ(Z)=(A,X\times F,\bullet)$, so $E$ is equivalent to $X\times F$, which is saying that the environment for the football player in its original frame ($C$) is equivalent to the Cartesian product of the rest of the team $X$ with the *team's* environment $F$.

Thinking about the precommitment example: $C$ has made a precommitment, so there is an inclusion morphism $\iota:A\rightarrow B$, which shows that $C$'s agent's options are a subset of $D\mbox{'s}$ agent's options. $Z$ is just $\mbox{CF}^*(\{\iota\})$, so $X=\{\iota\}$ is a singleton. $D^\circ(Z)=(A,X\times F,\bullet)$, so $E$ is equivalent to $X\times F=F$, so here $A$ is a subset of $B$ and $E$ is equivalent to $F$.

Although the word "precommitment" suggests a specific (temporal, deliberative) interpretation, formally, precommitment just looks like deleting rows from a matrix (up to biextensional equivalence), which can represent a variety of other situations.

A Cartesian frame $Z=(A,X,\diamond)$ over $B$ is like a nondeterministic function from $A$ to $B$, where $X$ represents the the nondeterministic bits. When changing our frame from $(B,F,\star)$ to $(A,E,\cdot)\simeq (A,X\times F,\bullet)$, we are identifying with $A$ and externalizing the nondeterministic bits $X$ into the environment.

**1.3. Covering Definition**

The categorical definition is optimized for elegance, while the currying definition is optimized to be easy to understand in terms of agency. We have a third definition, the covering definition, which is optimized for ease of use.

**Definition.** Let $C=(A,E,\cdot)$ and $D=(B,F,\star)$ be Cartesian frames over $W$. We say that $C\triangleleft D$ if for all $e\in E$, there exists an $f\in F$ and a $(g,h):C\rightarrow D$ such that $e=h(f)$.

We call this the covering definition because the morphisms from $C$ to $D$ cover the set $E$.

2\. Equivalence of Definitions
------------------------------

**2.1. Equivalence of Categorical and Covering Definitions**

The equivalence of the categorical and covering definitions follows directly from the fact that the morphisms from $C$ to $\bot$ are exactly the elements of $\mbox{Env}(C)$.

**Claim:** The categorical and covering definitions of subagent are equivalent.

**Proof:** Let $C=(A,E,\cdot)$ and let $D=(B,F,\star)$. First, observe that the morphisms from $C$ to $\bot$ correspond exactly to the elements of $E$. For each $e\in E$, it is easy to see that $(g,h):C\rightarrow (W,\{j\},\diamond)$, given by $h(j)=e$ and $g(a)=a\cdot e$, is a morphism, and every morphism is uniquely defined by $h(j)$, so there are no other morphisms. Let $\phi_e$ denote the morphisms with $h(j)=e$.

Similarly, the morphisms from $D$ to $\bot$ correspond to the elements of $F$. Let $\psi_f$ denote the morphisms corresponding to $f\in F$.

Thus, the categorical definition can be rewritten to say that for every morphism $\phi_e:C\rightarrow \bot$, there exist morphisms $(g,h):C\rightarrow D$ and $\psi_f:D\rightarrow \bot$, such that $\phi_e=\psi_f\circ (g,h)$. However, $\psi_f\circ (g,h):C\rightarrow(W,\{j\},\diamond)$ sends $j$ to $h(f)$, and so equals $\phi_e$ if and only if $e=h(f)$. Thus the categorical definition is equivalent to the covering definition. $\square$

**2.2. Equivalence of Covering and Currying Definitions**

**Claim:** The covering definition of subagent implies the currying definition of subagent.

**Proof:** Let $C=(A,E,\cdot)$ and $D=(B,F,\star)$ be Cartesian frames over $W$. Assume that $C\triangleleft D$ according to the covering definition.

Let $X$ be the set of all morphisms from $C$ to $D$, and let $Z=(A,X,\diamond)$ be a Cartesian frame over $B$, with $\diamond$ given by $a\diamond(g,h)=g(a)$. We have that $D^\circ(Z)=(A,X\times F,\bullet)$, with

$$
\begin{equation} \begin{split} a\bullet ((g,h),f) & =(a\diamond(g,h))\star f \ & =g(a)\star f \end{split} \end{equation}
$$

for all $a\in A$, $(g,h)\in X$, and $f\in F$.

To show that $C\simeq D^\circ(Z)$, we need to construct morphisms $g_0,h_0:C\rightarrow D^\circ(Z)$ and $g_1,h_1:D^\circ(Z)\rightarrow C$ which compose to something homotopic to the identity in both orders.

We will let $g_0$ and $g_1$ be the identity on $A$, and we let $h_0:X\times F\rightarrow E$ be given by $h_0((g,h),f)=h(f)$. Finally, we let $h_1(e)=((g,h),f)$ such that $h(f)=e$. We can always choose such a $(g,h)\in X$ and $f\in F$ by the covering definition of subagent.

We have that $(g_0,h_0)$ is a morphism, since

$$
\begin{equation} \begin{split} g_0(a)\bullet((g,h),f) & =a\bullet ((g,h),f) \ & =g(a)\star f \ & =a\cdot h(f) \ & =a\cdot h_0((g,h),f). \end{split} \end{equation}
$$

Similarly, we have that $(g_1,h_1)$ is a morphism since $h_1(e)=((g,h),f)$, where $h(f)=e$, so

$$
\begin{equation} \begin{split} g_1(a)\cdot e & = a\cdot e \ & =a\cdot h(f) \ & =g(a)\star f \ & =a\bullet ((g,h),f) \ & =a\bullet h_1(e). \end{split} \end{equation}
$$

It is clear that $(g_0,h_0)$ and $(g_1,h_1)$ compose to something homotopic to the identity in both orders, since $g_0$ and $g_1$ are the identity on $A$. Thus, $C\simeq D^\circ(Z)$. $\square$

**Claim:** The currying definition of subagent implies the covering definition of subagent.

**Proof:** Let $C=(A,E,\cdot)$ and $D=(B,F,\star)$ be Cartesian frames over $W$. Let $Z=(Y,X,\diamond)$ be a Cartesian frame over $B$, and let $C\simeq D^\circ(Z)$. Our goal is to show that for every $e\in E$, there exists a $(g,h):C\rightarrow D$ and $f\in F$ such that $e=h(f)$. We will start with the special case where $C=D^\circ(Z)$.

We have that $D^\circ(Z)=(Y,X\times F,\bullet)$, where $y\bullet (x,f)=(y\diamond x)\star f$. First, note that for every $x\in X$, there exists a morphism $(g_x,h_x):D^\circ(Z)\rightarrow D$ given by $g_x(y)=y \diamond x$, and $h_x(f)=(x,f)$. To see that this is a morphism, observe that

$$
\begin{equation} \begin{split} g_x(y)\star f & =(y \diamond x)\star f \ & =y\bullet (x,f) \ & =f\bullet h_x(f) \end{split} \end{equation}
$$

for all $y\in Y$ and $f\in F$.

To show that $D^\circ(Z)\triangleleft D$ according to the covering definition, we need that for all $(x,f)\in X\times F$, there exists an $f^\prime\in F$ and a $(g,h):D^\circ(Z)\rightarrow D$ such that $h(f^\prime)=(x,f)$. Indeed we can take $(g,h)=(g_x,h_x)$ and $f^\prime=f$.

Now, we move to the case where $C\simeq D^\circ(Z)$, but $C\neq D^\circ(Z)$. It suffices to show that under the covering definition of subagent, if $C_0\triangleleft D$, and $C_1\simeq C_0$, then $C_1\triangleleft D$.

Let $C_i=(A_i,E_i,\cdot_i)$, and let $(g_0,h_0):C_0\rightarrow C_1$ and $(g_1,h_1):C_1\rightarrow C_0$ compose to something homotopic to the identity in both orders. Assume that $C_0\triangleleft D$. To show that $C_1\triangleleft D$, let the possible environment $e\in E_1$ be arbitrary.

$h_0(e)\in E_0$, so there exists an $f\in F$ and $(g,h):C_0\rightarrow D$ such that $h(f)=h_0(e)$. Consider the morphism $(g^\prime,h^\prime):C_1\rightarrow D$, where $g^\prime=g\circ g_1$, and $h^\prime(f)=e$ and $h^\prime(f^\prime)=(h_1\circ h)(f^\prime)$ on all $f^\prime\neq f$. To see that this is a morphism, observe that for all $a\in A_1$, we have

$$
\begin{equation} \begin{split} g^\prime(a)\star f & =g(g_1(a))\star f \ & =a\cdot_1 h_1(h(f)) \ & =a\cdot_1h_1(h_0(e)) \ & =a\cdot_1 e \ & =a\cdot_1 h^\prime(f), \end{split} \end{equation}
$$

while for $f^\prime\in F$, $f^\prime\neq f$, we have

$$
\begin{equation} \begin{split} g^\prime(a)\star f^\prime & =g(g_1(a))\star f^\prime \ & =a\cdot_1 h_1(h(f^\prime)) \ & =a\cdot_1 h^\prime(f^\prime). \end{split} \end{equation}
$$

Now, notice that for our arbitrary $e\in E_1$, $(g^\prime,h^\prime):C_1\rightarrow D$ and $f\in F$ satisfy $h^\prime(f)=e$, so $C_1\triangleleft D$ according to the to the covering definition.

Thus, whenever $C\simeq D^\circ(Z)$, we have $C\triangleleft D$ according to the covering definition, so the currying definition implies the covering definition of subagent. $\square$

3\. Mutual Subagents
--------------------

The subagent relation is both transitive and reflexive. Surprisingly, this relation is not anti-symmetric, even up to biextensional equivalence.

**Claim:** $\triangleleft$ is reflexive. Further, if $C\simeq D$, then $C\triangleleft D$.

**Proof:** Let $C=(A,E,\cdot)$ and $D=(B,F,\cdot)$ be Cartesian Frames over $W$, with $C\simeq D$. Consider the Cartesian frame $Z$ over $B$ given by $Z=(B,\{x\},\diamond)$, where $b\diamond x=b$. Observe that $D\cong D^\circ(Z)$. Thus $C\simeq D^\circ(Z)$, so $C\triangleleft D$, according to the currying definition. $\square$

**Claim:** $\triangleleft$ is transitive.

**Proof:** We will use the categorical definition. Let $C_0\triangleleft C_1$ and $C_1\triangleleft C_2$. Given a morphism, $\phi_0:C_0\rightarrow \bot$, since $C_0\triangleleft C_1$, we know that $\phi_0=\phi_1\circ \phi_2$ with $\phi_1:C_1\rightarrow \bot$ and $\phi_2:C_0\rightarrow C_1$. Further, since $C_1\triangleleft C_2$, we know that $\phi_1=\phi_3\circ\phi_4$ with $\phi_3:C_2\rightarrow \bot$ and $\phi_4:C_1\rightarrow C_2$. Thus,

$$
\begin{equation} \begin{split} \phi_0 & =(\phi_3\circ\phi_4)\circ\phi_2 \ & =\phi_3\circ(\phi_4\circ\phi_2), \end{split} \end{equation}
$$

with $\phi_3:C_2\rightarrow \bot$ and $\phi_4\circ\phi_2:C_0\rightarrow C_2$, so $C_0\triangleleft C_2$. $\square$

As a corollary, we have that subagents are well-defined up to biextensional equivalence.

**Corollary:** If $C_0\simeq C_1$, $D_0\simeq D_1$, and $C_0\triangleleft D_0$, then $C_1\triangleleft D_1$.

**Proof:** $C_1\triangleleft C_0\triangleleft D_0\triangleleft D_1$. $\square$

Sometimes, there are Cartesian frames $C \not\simeq D$ with $C\triangleleft D$ and $D\triangleleft C$. We can use this fact to define a third equivalence relation on Cartesian frames over $W$, weaker than both $\cong$ and $\simeq$.

**Definition:** For Cartesian frames $C$ and $D$ over $W$, we say $C\bowtie D$ if $C\triangleleft D$ and $D\triangleleft C$.

**Claim:** $\bowtie$ is an equivalence relation.

**Proof:** Reflexivity and transitivity follow from reflexivity and transitivity of $\triangleleft$. Symmetry is trivial. $\square$

This equivalence relation is less natural than $\cong$ and $\simeq$, and is not as important. We discuss it mainly to emphasize that two frames can be mutual subagents without being biextensionally equivalent.

**Claim:** $\bowtie$ is strictly weaker than $\simeq$, which is strictly weaker than $\cong$.

**Proof:** We already know that $\simeq$ is weaker than $\cong$. To see that $\bowtie$ is weaker than $\simeq$, observe that if $C\simeq D$, then $C\triangleleft D$ and $D\triangleleft C$, so $C\bowtie D$.

To see that $\simeq$ is *strictly* weaker than $\cong$, observe that $\top\oplus\top\simeq \top$ (both have empty environment and nonempty agent), but $\top\oplus \top \not\cong \top$ (the agents have different size).

To see that $\bowtie$ is strictly weaker than $\simeq$, observe that $\top\bowtie\mbox{null}$ (vacuous by covering definition), but $\top\not\simeq \mbox{null}$ (there are no morphisms from $\mbox{null}$ to $\top$). $\square$

I do not have a simple description of exactly when $C\bowtie D$, but there are more cases than just the trivial ones like $C\simeq D$ and vacuous cases like $\top\bowtie \mbox{null}$. As a quick example:

$\begin{pmatrix}x \ y\end{pmatrix}\bowtie \begin{pmatrix}x & x\ y &y\\x&y\end{pmatrix}$.

To visualize this, imagine an agent that is given the choice between cake and pie. This agent can be viewed as a team consisting of two subagents, Alice and Bob, with Alice as the leader.

Alice has three choices. She can choose cake, she can choose pie, or she can delegate the decision to Bob. We represent this with a matrix where Bob is in Alice's environment, and the third row represents Alice letting the environment make the call:

$\begin{pmatrix}x & x\ y&y\\x&y\end{pmatrix}$.

If we instead treat Alice-and-Bob as a single superagent, then their interaction across the agent-environment boundary becomes agent-internal deliberation, and their functional relationship to possible worlds just becomes a matter of "What does the group decide?". Thus, Alice is a subagent of the Alice-and-Bob team:

$\begin{pmatrix}x & x\ y&y\\x&y\end{pmatrix} \triangleleft \begin{pmatrix}x \ y\end{pmatrix}$.

However, Alice also has the ability to commit to not delegating to Bob. This produces a future version of Alice that doesn't choose the third row. This new agent is a precommitment-style subagent of the original Alice, but using biextensional collapse, we can also see that this new agent is equivalent to the smaller matrix. Thus:

$\begin{pmatrix}x \ y\end{pmatrix}\simeq \begin{pmatrix}x&x \ y&y\end{pmatrix}\triangleleft\begin{pmatrix}x & x\ y &y\\x&y\end{pmatrix}$.

It is also easy to verify formally that these are mutual subagents using the covering definition of subagent.

I'm reminded here of the introduction and deletion of mixed strategies in game theory. The third row of Alice's frame is a mix of the first two rows, so we can think of Bob as being analogous to a random bit that the environment cannot see. I informally conjecture that for finite Cartesian frames, $C\bowtie D$ if and only if you can pass between $C$ and $D$ by doing something akin to deleting and introducing mixed strategies for the agent.

However, this informal conjecture is not true for infinite Cartesian frames:

$\begin{pmatrix}z&x&z&z&z&\cdots\\z&y&z&z&z&\cdots\\z&z&x&z&z&\cdots\\z&z&y&z&z&\cdots\\z&z&z&x&z&\cdots\\z&z&z&y&z&\cdots\\z&z&z&z&x&\cdots\\z&z&z&z&y&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&\ddots\end{pmatrix}\bowtie \begin{pmatrix}z&y&z&z&z&\cdots\\z&z&x&z&z&\cdots\\z&z&y&z&z&\cdots\\z&z&z&x&z&\cdots\\z&z&z&y&z&\cdots\\z&z&z&z&x&\cdots\\z&z&z&z&y&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&\ddots\end{pmatrix}$.

We can see that these frames are mutual subagents by noting that one can transition back and forth by repeatedly committing not to take the top row.

I do not know of any examples of $\bowtie$ that look qualitatively different from those discussed here, but I do not have a good understanding of exactly what the equivalence classes look like.

4\. Universal Subagents and Superagents
---------------------------------------

We can view $\top$ as a universal subagent and $\bot$ as a universal superagent.

**Claim:** $\top\triangleleft C\triangleleft\bot$ for all Cartesian frames $C$.

**Proof:** We use the categorical definition. That $\top\triangleleft C$ is vacuous, since there is no morphism from $\top$ to $\bot$. That $C\triangleleft \bot$ is also trivial, since any $\phi:C\triangleleft \bot$ is equal to $\phi\circ \mbox{id}_\bot$. $\square$

Since $\mbox{null}\bowtie \top$, we also have $\mbox{null}\triangleleft C$ for all $C$.

We also have a that $\bot_S$ is a superagent of all Cartesian frames with image in $S$.

**Claim:** $C\triangleleft\bot_S$ if and only if $\mbox{Image}(C)\subseteq S$.

**Proof:** Let $C=(A,E,\cdot)$, and let $\bot_S=(S,\{f\}, \star)$, with $s\star f=s$.

First, assume $\mbox{Image}(C)\subseteq S$. We will use the covering definition. Given an $e\in E$, let $(g,h):C\rightarrow\bot_S$ be given by $g(a)=a\cdot e$ and $h(f)=e$. We have that $g$ is well-defined because $\mbox{Image}(C)\subseteq S$, and $(g,h)$ is a morphism because for all $a\in A$, 

$$
\begin{equation} \begin{split} a\cdot h(f) & =a\cdot e \ & =g(a) \ & =g(a)\star f. \end{split} \end{equation}
$$

Thus, there is a morphism $(g,h):C\rightarrow\bot_S$ and an element $f\in\{f\}$ such that $h(f)=e$ for an arbitrary $e\in E$, so $C\triangleleft\bot_S$.

Conversely, assume $\mbox{Image}(C)\not\subseteq S$, so let $a\in A$ and $e\in E$ be such that $a\cdot e\not\in S$. If we assume for contradiction that $C\triangleleft \bot_S$, then by the covering definition, there must be a morphism $(g,h):C\rightarrow \bot_S$ such that $h(f)=e$. But then we have that

$$
\begin{equation} \begin{split} a\cdot e & =a\cdot h(f) \ & =g(a)\star f \ & =g(a) \end{split} \end{equation}
$$

must be both inside and outside of $S$, a contradiction. $\square$

**Convention:** We will usually write $C\triangleleft\bot_S$ instead of $\mbox{Image}(C)\subseteq S$, as it is shorter.

**Corollary:** $S\in\mbox{Obs}(C)$ if and only if $C\simeq C_0\&C_1$ for some $C_0\triangleleft \bot_S$ and $C_1\triangleleft\bot_{W\backslash S}$.

**Proof:** This is just rewriting our definition of observables from "[Controllables and Observables, Revisited](https://www.lesswrong.com/posts/z3S2xnoDYfohrQQoe/controllables-and-observables-revisited#2__Observables)." $\square$

In the coming posts, we will introduce multiplicative operations on Cartesian frames, and use these to distinguish between additive and multiplicative subagents and superagents.