It looks like you're new here. If you want to get involved, click one of these buttons!

- All Categories 2.4K
- Chat 502
- Study Groups 21
- Petri Nets 9
- Epidemiology 4
- Leaf Modeling 2
- Review Sections 9
- MIT 2020: Programming with Categories 51
- MIT 2020: Lectures 20
- MIT 2020: Exercises 25
- Baez ACT 2019: Online Course 339
- Baez ACT 2019: Lectures 79
- Baez ACT 2019: Exercises 149
- Baez ACT 2019: Chat 50
- UCR ACT Seminar 4
- General 75
- Azimuth Code Project 110
- Statistical methods 4
- Drafts 10
- Math Syntax Demos 15
- Wiki - Latest Changes 3
- Strategy 113
- Azimuth Project 1.1K
- - Spam 1
- News and Information 148
- Azimuth Blog 149
- - Conventions and Policies 21
- - Questions 43
- Azimuth Wiki 718

Options

Last time we took a peek at a 'co-design diagram':

This describes a big complicated feasibility relation built from smaller ones - the little boxes - in various ways. Now let me start explaining those various ways!

First of all, remember that a **feasibility relation** \(\Phi \colon X \nrightarrow Y \) from a preorder \(X\) to a preorder \(Y\) is monotone function

$$ \Phi \colon X^{\text{op}} \times Y \to \lbrace \text{true}, \text{false} \rbrace . $$ In collaborative design we interpret \(\Phi(x,y) = \text{true}\) to mean "we can meet the requirements \(x\) given the resources \(y\)". In a codesign diagram we can draw \(\Phi\) as a box with one wire coming in at left labelled \(X\), and one wire going out at right labelled \(Y\):

Here are a few easy examples:

**Puzzle 204.** Suppose you are trying to buy a plane ticket, and the cheapest available ticket is $500. Describe this using a feasibility relation \(\Phi : \textbf{Bool} \nrightarrow [0,\infty) \) where we make \( [0,\infty) \), the set of nonnegative real numbers, into a poset with its usual ordering \(\le\).

**Puzzle 205.** Suppose you are trying to buy either one or two loaves of bread - or perhaps none. Suppose bread costs $2 per loaf. Describe this using a feasibility relation \(\Psi : \lbrace 0,1,2\rbrace \nrightarrow [0,\infty) \). Here we make \( {0,1,2}\) into a poset with its usual ordering.

**Puzzle 206.** Suppose you are trying to feed hungry children with the loaves of bread you bought in the previous puzzle, and you can feed at most three children with each loaf of bread. Describe this using a feasibility relation \(\Phi : \mathbb{N} \nrightarrow \lbrace 0,1,2\rbrace \). Here \(\mathbb{N}\) is the set of natural numbers \( \lbrace 0,1,2,3,\dots \rbrace \) with its usual ordering.

Second, remember from Lecture 58 that we can compose feasibility relations \(\Phi \colon X \nrightarrow Y\) and \(\Psi \colon Y \nrightarrow Z\) to get a feasibility relation \(\Psi \Phi \colon X \nrightarrow Z\). We draw this as follows:

The box on the outside helps us think of \(\Psi\Phi\) as a single thing, but we could also leave it out.

The idea in codesign is that this describes two systems or processes stuck together, with the second providing the resources required for the first. Let's look at an easy example:

**Puzzle 207.** Suppose you buy loaves of bread and then use them to feed hungry children. Compose the feasibility relation \(\Psi : {0,1,2} \nrightarrow [0,\infty) \) from Puzzle 205 and the feasibility relation \(\Phi : \mathbb{N} \nrightarrow \lbrace 0,1,2\rbrace \) from Puzzle 206 to get a feasibility relation \(\Psi \Phi : \mathbb{N} \nrightarrow [0,\infty) \) describing how many children you can feed for a certain amount of money (given the fact that you plan to buy at most two loaves).

Third, if we have a bunch of preorders \(X_1, \dots, X_m \) and \(Y_1, \dots, Y_n\), their products \(X_1 \times \cdots \times X_m\) and \(Y_1 \times \cdots \times Y_n \) are also preorders, so we can talk about a feasibility relation

$$ \Phi \colon X_1 \times \cdots \times X_m \nrightarrow Y_1 \times \cdots \times Y_n $$ We draw this as a box with a bunch of wires going in and a bunch going out, as follows:

The idea in codesign is that this describes a situation where a bunch of resources \(Y_1, \dots, Y_n\) are needed to meet a bunch of requirements \(X_1, \dots, X_m\).

**Puzzle 208.** Suppose you some slices of bread, some slices of cheese and some slices of ham. You are trying to make sandwiches. You can make a cheese sandwich with two slices of bread and one slice of cheese. You can make a ham sandwich with two slices of bread and one slice of ham. There is a feasibility relation \(\Theta : \mathbb{N} \times \mathbb{N} \nrightarrow \mathbb{N} \times \mathbb{N} \times \mathbb{N} \) where \(\Theta(m,n,i,j,k) = \text{true}\) if you can make \(m\) cheese sandwiches and \(n\) ham sandwiches from \(i\) slices of bread, \(j\) slices of cheese and \(k\) slices of ham.

Fourth, if we have feasibility relations \(\Phi \colon X \nrightarrow Y\) and \(\Psi \colon X' \nrightarrow Y'\), we can define a new feasibility relation

$$ \Phi \otimes \Psi \colon X \times X' \nrightarrow Y \times Y' $$ given by

$$ (\Phi \otimes \Psi)((x,x'),(y,y')) = \Phi(x,y) \wedge \Psi(x',y') $$
We call this way of combining feasibility relations **tensoring**, and we draw \(\Phi \otimes \Psi\) as follows:

This describes a situation where we can meet the requirements \((x,x')\) given resources \( (y,y') \) iff we can meet requirement \(x\) given \(x'\) *and* meet requirement \(y\) given \(y'\).

Here is a very simple example:

**Puzzle 209.** Suppose you are trying to fry some eggs and also toast some slices of bread. Describe each process separately as a feasibility relation from \(\mathbb{N}\) to \(\mathbb{N}\) and then tensor these relations. What is the result?

**Puzzle 210.** Show that \(\Phi \otimes \Psi\) is really a feasibility relation if \(\Phi\) and \(\Psi\) are feasibility relations.

**Puzzle 211.** What general mathematical result is Puzzle 209 an example of?

**Puzzle 212.** We can get a feasibility relation by taking either the companion or the conjoint of a monotone map, thanks to the ideas in the puzzles of Lecture 65. Which of the feasibility relations in this lecture's puzzles are companions or conjoints?

## Comments

This is a feasibility relation \(\Phi\), where \(\texttt{false}\) maps to everything less than $500, and \(\texttt{true}\) maps to everything greater than or equal to $500, ie if you can buy a ticket, then you have at least $500. Since this is required to only be a feasibility relation and not a monotone map, this is a perfectly reasonable thing to do.

`>**Puzzle 204.** Suppose you are trying to buy a plane ticket, and the cheapest available ticket is $500. Describe this using a feasibility relation \\(\Phi : \textbf{Bool} \nrightarrow [0,\infty) \\) where we make \\( [0,\infty) \\), the set of nonnegative real numbers, into a poset with its usual ordering \\(\le\\). This is a feasibility relation \\(\Phi\\), where \\(\texttt{false}\\) maps to everything less than $500, and \\(\texttt{true}\\) maps to everything greater than or equal to $500, ie if you can buy a ticket, then you have at least $500. Since this is required to only be a feasibility relation and not a monotone map, this is a perfectly reasonable thing to do.`

Keith - that's interesting, and you're on the right track. You're also the only person so far who had the guts to try these puzzles, and I don't think I should keep cranking out lectures until people solve these puzzles.

But please clarify what you mean by saying

You're making it sound like a feasibility relation is a 'multi-valued function' where \(\texttt{false}\) can map to lots of different things. That's a really cool way of talking, which we may be able to make sense of if we work a little - but that's not what we defined a feasibility relation to be.

We defined a feasibility relation \(\Phi \colon \textbf{Bool} \to [0,\infty) \) to be a monotone function

$$ \Phi \colon \textbf{Bool}^{\text{op}} \times [0,\infty) \to \textbf{Bool} .$$ So, I'd be happiest if you said what \(\Phi(x,y)\) equals for each \(x \in \textbf{Bool}^{\text{op}} \) and \(y \in [0,\infty) \). Then we could stare at that and see if it defines a monotone function.

`Keith - that's interesting, and you're on the right track. You're also the only person so far who had the guts to try these puzzles, and I don't think I should keep cranking out lectures until people solve these puzzles. But please clarify what you mean by saying > \\(\texttt{false}\\) maps to everything less than $500 You're making it sound like a feasibility relation is a 'multi-valued function' where \\(\texttt{false}\\) can map to lots of different things. That's a really cool way of talking, which we may be able to make sense of if we work a little - but that's not what we defined a feasibility relation to be. We defined a feasibility relation \\(\Phi \colon \textbf{Bool} \to [0,\infty) \\) to be a monotone function \[ \Phi \colon \textbf{Bool}^{\text{op}} \times [0,\infty) \to \textbf{Bool} .\] So, I'd be happiest if you said what \\(\Phi(x,y)\\) equals for each \\(x \in \textbf{Bool}^{\text{op}} \\) and \\(y \in [0,\infty) \\\). Then we could stare at that and see if it defines a monotone function.`

It doesn't, but it does a relation, and a relation is the same thing as a multi* valued function.

`It doesn't, but it does a relation, and a relation is the same thing as a multi* valued function. * including zero.`

Christopher: I was asking Keith to define

$$ \Phi \colon \textbf{Bool}^{\text{op}} \times [0,\infty) \to \textbf{Bool} $$ and check that

thisis a monotone function.But yeah, we are not looking for a monotone function \(\Phi \colon \textbf{Bool} \to [0,\infty) \). A monotone function \( \Phi \colon \textbf{Bool}^{\text{op}} \times [0,\infty) \to \textbf{Bool} \) is the same as a relation from \(\textbf{Bool}\) to \([0,\infty)\) that obeys certain properties:

If \(\Phi(x,y) = \text{true}\) and \(x' \le x\) then \(\Phi(x',y) = \text{true}\).

If \(\Phi(x,y) = \text{true}\) and \(y \le y'\) then \(\Phi(x,y') = \text{true}\).

`Christopher: I was asking Keith to define \[ \Phi \colon \textbf{Bool}^{\text{op}} \times [0,\infty) \to \textbf{Bool} \] and check that _this_ is a monotone function. But yeah, we are not looking for a monotone function \\(\Phi \colon \textbf{Bool} \to [0,\infty) \\). A monotone function \\( \Phi \colon \textbf{Bool}^{\text{op}} \times [0,\infty) \to \textbf{Bool} \\) is the same as a relation from \\(\textbf{Bool}\\) to \\([0,\infty)\\) that obeys certain properties: 1. If \\(\Phi(x,y) = \text{true}\\) and \\(x' \le x\\) then \\(\Phi(x',y) = \text{true}\\). 2. If \\(\Phi(x,y) = \text{true}\\) and \\(y \le y'\\) then \\(\Phi(x,y') = \text{true}\\).`

Puzzle 204.I would define \(\Phi\) as follows:$$ \Phi(\texttt{false}, y) = \texttt{true}, \mbox{ for all } y \in [0,\infty). $$

$$ \Phi(\texttt{true}, y) = \begin{cases} \texttt{true} &\mbox{if } 500 \le y \\ \texttt{false} & \mbox{otherwise.}\end{cases} $$

`**Puzzle 204.** I would define \\(\Phi\\) as follows: - If there are no requirements then the feasibility relation is satisfied no matter how much money we have: \[ \Phi(\texttt{false}, y) = \texttt{true}, \mbox{ for all } y \in [0,\infty). \] - If the requirement is to buy a ticket then we need at least $500 to satisfy the feasibility relation: \[ \Phi(\texttt{true}, y) = \begin{cases} \texttt{true} &\mbox{if } 500 \le y \\\\ \texttt{false} & \mbox{otherwise.}\end{cases} \]`

Puzzle 204/Puzzle 212. I think we can define \(\Phi\) to be thecompanionof \(F\) where \(\texttt{false} \mapsto 0\) and \(\texttt{true} \mapsto 500\)`**Puzzle 204**/**Puzzle 212**. I think we can define \\(\Phi\\) to be the *companion* of \\(F\\) where \\(\texttt{false} \mapsto 0\\) and \\(\texttt{true} \mapsto 500\\)`

Puzzle 205/Puzzle 212: For this problem, let \(\Phi\) be the companion of \(n \mapsto 2 n\)`**Puzzle 205**/**Puzzle 212**: For this problem, let \\(\Phi\\) be the companion of \\(n \mapsto 2 n\\)`

Dan Oneata - yes, the second relation is the one I was shooting for:

You can buy a ticket with \($500\) or more, but not less.

`Dan Oneata - yes, the second relation is the one I was shooting for: > \[ \Phi(\texttt{true}, y) = \begin{cases} \texttt{true} &\mbox{if } 500 \le y \\\\ \texttt{false} & \mbox{otherwise.}\end{cases} \] You can buy a ticket with \\(\$500\\) or more, but not less.`

Matthew wrote:

Really? Huh, maybe so! It seemed so obvious to me that this feasibility relation was the

conjointof a function. Are both of us right? Neither? Just one of us?`Matthew wrote: >**Puzzle 204**/**Puzzle 212**. I think we can define \\(\Phi\\) to be the *companion* of \\(F\\) where \\(\texttt{false} \mapsto 0\\) and \\(\texttt{true} \mapsto 500\\). Really? Huh, maybe so! It seemed so obvious to me that this feasibility relation was the *conjoint* of a function. Are both of us right? Neither? Just one of us?`

John Baez wrote:

Let me try to justify myself and we can see where I'm going off the rails.

In Lecture 65, you wrote approximately:

In this case \(\mathcal{X} = \mathbf{Bool}\) and \(\mathcal{Y} = [0,\infty)\). So let \(F\) map \(\mathtt{false} \mapsto 0\) and \(\mathtt{true} \mapsto 500\). Then \(\hat{F}(x,y) = F(x) \leq y\).

But \(\hat{F}\) is the same as Dan Oneata's answer! Let's check that. First let \(x = \mathtt{false}\):

$$ \begin{align} \hat{F}(\mathtt{false},y) & = F(\mathtt{false}) \leq y \\ & = 0 \leq y \\ & = \mathtt{true} \end{align} $$ So \(\hat{F}(\mathtt{false},y) = \mathtt{true} \text{, for all } y \in [0,\infty)\) ✔

Next, consider:

$$ \begin{align} \hat{F}(\mathtt{true},y) & = F(\mathtt{true}) \leq y \\ & = 500 \leq y \end{align} $$ If \(500 \leq y\), then \(\hat{F}(\mathtt{true},y)\) is \(\mathtt{true}\). Otherwise, \(\hat{F}(\mathtt{true},y)\) is \(\mathtt{false}\).

But that's just the same as saying \(\hat{F}(\texttt{true}, y) = \begin{cases} \texttt{true} &\mbox{if } 500 \le y \\ \texttt{false} & \mbox{otherwise.}\end{cases}\) ✔

Hopefully I haven't misunderstood how companions are defined...

`John Baez wrote: > Really? Huh, maybe so! It seemed so obvious to me that this feasibility relation was the *conjoint* of a function. Are both of us right? Neither? Just one of us? Let me try to justify myself and we can see where I'm going off the rails. In Lecture 65, you wrote approximately: > Any \\(\mathcal{V}\\)-enriched functor \\(F: \mathcal{X} \to \mathcal{Y}\\) gives a \\(\mathcal{V}\\)-enriched profunctor > > \[ \hat{F} \colon \mathcal{X} \nrightarrow \mathcal{Y} \] > > defined by > > \[ \hat{F} (x,y) = \mathcal{Y}(F(x), y ) .\] > > \\(\hat{F} \colon \mathcal{X} \nrightarrow \mathcal{Y}\\) is called the **companion** of \\(F\\). In this case \\(\mathcal{X} = \mathbf{Bool}\\) and \\(\mathcal{Y} = [0,\infty)\\). So let \\(F\\) map \\(\mathtt{false} \mapsto 0\\) and \\(\mathtt{true} \mapsto 500\\). Then \\(\hat{F}(x,y) = F(x) \leq y\\). But \\(\hat{F}\\) is the same as Dan Oneata's answer! Let's check that. First let \\(x = \mathtt{false}\\): \[ \begin{align} \hat{F}(\mathtt{false},y) & = F(\mathtt{false}) \leq y \\\\ & = 0 \leq y \\\\ & = \mathtt{true} \end{align} \] So \\(\hat{F}(\mathtt{false},y) = \mathtt{true} \text{, for all } y \in [0,\infty)\\) ✔ Next, consider: \[ \begin{align} \hat{F}(\mathtt{true},y) & = F(\mathtt{true}) \leq y \\\\ & = 500 \leq y \end{align} \] If \\(500 \leq y\\), then \\(\hat{F}(\mathtt{true},y)\\) is \\(\mathtt{true}\\). Otherwise, \\(\hat{F}(\mathtt{true},y)\\) is \\(\mathtt{false}\\). But that's just the same as saying \\(\hat{F}(\texttt{true}, y) = \begin{cases} \texttt{true} &\mbox{if } 500 \le y \\\\ \texttt{false} & \mbox{otherwise.}\end{cases}\\) ✔ Hopefully I haven't misunderstood how companions are defined...`

We can define

$$ \Psi \colon \{0,1,2\} \times [0,\infty) \to \textbf{Bool} $$ as follows

$$ \Psi(x, y) = \begin{cases} \texttt{false} & \mbox{if } (x = 1 \mbox{ and } y \le 2) \mbox{ or } (x = 2 \mbox{ and } y \le 4) \\ \texttt{true} & \mbox{otherwise.} \end{cases} $$ We can represent the mapping \(\Psi\) graphically – the red color denotes \(\texttt{false}\) and green denotes \(\texttt{true}\):

I think that the visual representation shows that the mapping is monotone.

`> **Puzzle 205.** Suppose you are trying to buy either one or two loaves of bread - or perhaps none. Suppose bread costs $2 per loaf. Describe this using a feasibility relation \\(\Phi : \lbrace 0,1,2\rbrace \nrightarrow [0,\infty) \\). Here we make \\( \{0,1,2\}\\) into a poset with its usual ordering. We can define \[ \Psi \colon \\{0,1,2\\} \times [0,\infty) \to \textbf{Bool} \] as follows \[ \Psi(x, y) = \begin{cases} \texttt{false} & \mbox{if } (x = 1 \mbox{ and } y \le 2) \mbox{ or } (x = 2 \mbox{ and } y \le 4) \\\\ \texttt{true} & \mbox{otherwise.} \end{cases} \] We can represent the mapping \\(\Psi\\) graphically – the red color denotes \\(\texttt{false}\\) and green denotes \\(\texttt{true}\\): ![Plot of psi](https://doneata.bitbucket.io/applied-category-theory/puzzle-205.png) I think that the visual representation shows that the mapping is monotone.`

@John A few typos in the lecture:

A couple of feasbility relations use the wrong type of arrow: in the introduction, \(\Phi \colon X \to Y \) should be \(\Phi \colon X \nrightarrow Y\); in puzzle 207, \(\Psi \Phi : \mathbb{N} \to [0,\infty) \) should be \(\Psi \Phi : \mathbb{N} \nrightarrow [0,\infty) \).

In the definition of tensoring \(\Phi'\) should be \(\Psi\).

In puzzle 207, I think the feasability relations compose the other way around, that is, it should have been \(\Phi \Psi : \mathbb{N} \nrightarrow [0,\infty) \).

`@John A few typos in the lecture: 1. A couple of feasbility relations use the wrong type of arrow: in the introduction, \\(\Phi \colon X \to Y \\) should be \\(\Phi \colon X \nrightarrow Y\\); in puzzle 207, \\(\Psi \Phi : \mathbb{N} \to [0,\infty) \\) should be \\(\Psi \Phi : \mathbb{N} \nrightarrow [0,\infty) \\). 2. In the definition of tensoring \\(\Phi'\\) should be \\(\Psi\\). 3. In puzzle 207, I think the feasability relations compose the other way around, that is, it should have been \\(\Phi \Psi : \mathbb{N} \nrightarrow [0,\infty) \\).`

Matthew: okay, thanks for going through all that - I think you're right! But I think this particular feasibility relation \( \Phi : \mathbf{Bool} \nrightarrow [0,\infty) \) is also the conjoint of the monotone function

$$ G : [0,\infty) \to \mathbf{Bool} $$ given by

$$ G(y) = \begin{cases} \texttt{true} &\mbox{if } y \ge 500 \\ \texttt{false} & \mbox{otherwise.}\end{cases} $$ Let's see: the conjoint of \(G\) is defined by

$$ \check{G}(x,y) = \mathbf{Bool}(x, G(y)) .$$ so it evaluates as \(\texttt{true}\) iff \(x \le G(y)\).

Two cases here:

\(y \ge 500\). In this case \(G(y) = \texttt{true}\) so we have \(x \le G(y) \) for all \(x \in \mathbf{Bool}\). Thus, in this case \(\check{G}(x,y) = \texttt{true}\) for all \(x\).

\(y \lt 500 \). In this case \(G(y) = \texttt{false}\) so we have \(x \le G(y) \) iff \(x = \texttt{false}\). Thus, in this case \(\check{G}(x,y) = \texttt{true}\) only for \(x = \texttt{false}\).

In short, \(\check{G}(x,y) = \texttt{true}\) iff either \(y \ge 500\) or \(x = \texttt{false}\).

Or in the English: the feasible situations are precisely those where you either have more than $500, or you don't buy a ticket!

So yes, I think we were both right. I think this feasibility relation is both a companion and a conjoint!

Somehow the conjoint seems more intuitive to me: from the amount of money you have, I can determine whether or not you can buy a ticket.

The companion approach is more mysterious to me: from whether or not you can buy a ticket, I cannot determine how much money you have!

Nonetheless you were able to dream up a monotone function from truth values to amounts of money, whose companion gives the desired feasibility relation. Interesting!

`Matthew: okay, thanks for going through all that - I think you're right! But I think this particular feasibility relation \\( \Phi : \mathbf{Bool} \nrightarrow [0,\infty) \\) is also the conjoint of the monotone function \[ G : [0,\infty) \to \mathbf{Bool} \] given by \[ G(y) = \begin{cases} \texttt{true} &\mbox{if } y \ge 500 \\\\ \texttt{false} & \mbox{otherwise.}\end{cases} \] Let's see: the conjoint of \\(G\\) is defined by \[ \check{G}(x,y) = \mathbf{Bool}(x, G(y)) .\] so it evaluates as \\(\texttt{true}\\) iff \\(x \le G(y)\\). Two cases here: * \\(y \ge 500\\). In this case \\(G(y) = \texttt{true}\\) so we have \\(x \le G(y) \\) for all \\(x \in \mathbf{Bool}\\). Thus, in this case \\(\check{G}(x,y) = \texttt{true}\\) for all \\(x\\). * \\(y \lt 500 \\). In this case \\(G(y) = \texttt{false}\\) so we have \\(x \le G(y) \\) iff \\(x = \texttt{false}\\). Thus, in this case \\(\check{G}(x,y) = \texttt{true}\\) only for \\(x = \texttt{false}\\). In short, \\(\check{G}(x,y) = \texttt{true}\\) iff either \\(y \ge 500\\) or \\(x = \texttt{false}\\). Or in the English: the feasible situations are precisely those where you either have more than $500, or you don't buy a ticket! So yes, I think we were both right. I think this feasibility relation is both a companion and a conjoint! Somehow the conjoint seems more intuitive to me: from the amount of money you have, I can determine whether or not you can buy a ticket. The companion approach is more mysterious to me: from whether or not you can buy a ticket, I cannot determine how much money you have! Nonetheless you were able to dream up a monotone function from truth values to amounts of money, whose companion gives the desired feasibility relation. Interesting!`

So this is what I learned from all that.

A function is a special kind of relation. So, when you get a feasibility relation from a monotone function \(F: X \to Y\) by taking its companion, you might be fooled into thinking this relation is just that function thought of as a relation in the usual way. But it's not: the usual way gives the relation \(f(x) = y \), but here we're getting the relation \(f(x) \le y\).

That should have been obvious - but my mental image of which feasibility relations arise as companions was a bit off.

I think one of the feasibility relations in my puzzles is neither a companion nor a conjoint. Maybe I'm confused. But does someone see which one I mean?

`So this is what I learned from all that. A function is a special kind of relation. So, when you get a feasibility relation from a monotone function \\(F: X \to Y\\) by taking its companion, you might be fooled into thinking this relation is just that function thought of as a relation in the usual way. But it's not: the usual way gives the relation \\(f(x) = y \\), but here we're getting the relation \\(f(x) \le y\\). That should have been obvious - but my mental image of which feasibility relations arise as companions was a bit off. I think one of the feasibility relations in my puzzles is neither a companion nor a conjoint. Maybe I'm confused. But does someone see which one I mean?`

Thanks for catching all those typos, Dan!

Ugh - yes! But since I'd just been talking about \(\Psi\Phi\) in a general abstract situation, I want my example to be about a feasibility relation called \(\Psi\Phi\) . So I'm going to switch the names \(\Phi\) and \(\Psi\) in puzzles 205 and 206.

Sorry! Things are already confusing enough, given that this feasibility relation

is called \(\Psi\Phi\). That's because when we apply first a function \(f\) and then a function \(g\), we usually call the composite \(g f\) or \(g \circ f\).

`Thanks for catching all those typos, Dan! > 3. In puzzle 207, I think the feasibility relations compose the other way around, that is, it should have been \\(\Phi \Psi : \mathbb{N} \nrightarrow [0,\infty) \\). Ugh - yes! But since I'd just been talking about \\(\Psi\Phi\\) in a general abstract situation, I want my example to be about a feasibility relation called \\(\Psi\Phi\\) . So I'm going to switch the names \\(\Phi\\) and \\(\Psi\\) in puzzles 205 and 206. Sorry! Things are already confusing enough, given that this feasibility relation <center><img src = "http://math.ucr.edu/home/baez/mathematical/7_sketches/codesign_diagram_composition.png"></center> is called \\(\Psi\Phi\\). That's because when we apply first a function \\(f\\) and then a function \\(g\\), we usually call the composite \\(g f\\) or \\(g \circ f\\).`

Dan wrote in comment 11

Wouldn't we be able to buy one bread when y=2 and buy two bread when y=4?

`Dan wrote in [comment 11](https://forum.azimuthproject.org/discussion/comment/20339/#Comment_20339) >\[ \Psi(x, y) = \begin{cases} \texttt{false} & \mbox{if } (x = 1 \mbox{ and } y \le 2) \mbox{ or } (x = 2 \mbox{ and } y \le 4) \\\\ \texttt{true} & \mbox{otherwise.} \end{cases} \] Wouldn't we be able to buy one bread when y=2 and buy two bread when y=4?`

John:

I think you have a typo in post #13. You mean \(\check{G}\) not \(\hat{G}\), right?

You said in Lecture 65 that \(\hat{F}\) is the

companionof \(F\) while \(\check{F}\) is theconjointof \(F\).Let me try to motivate my reasoning. I was thinking of \(\mathbf{Bool}\) as the set \(\lbrace 0, 1\rbrace\). So I figured "0 tickets costs $0" and "1 ticket costs $500", hence the mapping.

This is also my idea behind the companion for

Puzzle 205.We can also find the conjoint for Puzzle 205. Let \(F : \lbrace 0, 1, 2 \rbrace \to [0,\infty)\) such that \(n \mapsto 2 n\). Using the theorem you had us prove in Lecture 65 that \(\hat{F} = \check{G} \iff F \dashv G\), we just need to find the right adjoint of \(F\) to find the conjoint.

But then \(G: [0,\infty) \to \lbrace 0, 1, 2 \rbrace\) is \(r \mapsto \min (2, \lfloor r / 2 \rfloor)\). I think in this case the conjoint is harder to see, but maybe that's me.

`John: I think you have a typo in post #13. You mean \\(\check{G}\\) not \\(\hat{G}\\), right? You said in Lecture 65 that \\(\hat{F}\\) is the **companion** of \\(F\\) while \\(\check{F}\\) is the **conjoint** of \\(F\\). > The companion approach is more mysterious to me: from whether or not you can buy a ticket, I cannot determine how much money you have! Let me try to motivate my reasoning. I was thinking of \\(\mathbf{Bool}\\) as the set \\(\lbrace 0, 1\rbrace\\). So I figured "0 tickets costs $0" and "1 ticket costs $500", hence the mapping. This is also my idea behind the companion for **Puzzle 205**. We can also find the conjoint for Puzzle 205. Let \\(F : \lbrace 0, 1, 2 \rbrace \to [0,\infty)\\) such that \\(n \mapsto 2 n\\). Using the theorem you had us prove in Lecture 65 that \\(\hat{F} = \check{G} \iff F \dashv G\\), we just need to find the right adjoint of \\(F\\) to find the conjoint. But then \\(G: [0,\infty) \to \lbrace 0, 1, 2 \rbrace\\) is \\(r \mapsto \min (2, \lfloor r / 2 \rfloor)\\). I think in this case the conjoint is harder to see, but maybe that's me.`

$$ \Psi(x, y) = \begin{cases} \texttt{true} & \mbox{if } (x \leq 0 \mbox{ and } y = 0) \mbox{ or } (x \leq 3 \mbox{ and } y = 1) \mbox{ or } (x \leq 6 \mbox{ and } y = 2) \\ \texttt{false} & \mbox{otherwise.} \end{cases} $$

`>**Puzzle 206.** Suppose you are trying to feed hungry children with the loaves of bread you bought in the previous puzzle, and you can feed at most three children with each loaf of bread. Describe this using a feasibility relation \\(\Phi : \mathbb{N} \nrightarrow \lbrace 0,1,2\rbrace \\). Here \\(\mathbb{N}\\) is the set of natural numbers \\( \lbrace 0,1,2,3,\dots \rbrace \\) with its usual ordering. \[ \Psi(x, y) = \begin{cases} \texttt{true} & \mbox{if } (x \leq 0 \mbox{ and } y = 0) \mbox{ or } (x \leq 3 \mbox{ and } y = 1) \mbox{ or } (x \leq 6 \mbox{ and } y = 2) \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \]`

$$ \Psi(x, y) = \begin{cases} \texttt{true} & \mbox{if } (x \leq 0 \mbox{ and } 0 \leq y ) \mbox{ or } (x \leq 3 \mbox{ and } 2 \leq y) \mbox{ or } (x \leq 6 \mbox{ and } 4 \leq y) \\ \texttt{false} & \mbox{otherwise.} \end{cases} $$

`>**Puzzle 207.** Suppose you buy loaves of bread and then use them to feed hungry children. Compose the feasibility relation \\(\Psi : \{0,1,2\} \nrightarrow [0,\infty) \\) from Puzzle 205 and the feasibility relation \\(\Phi : \mathbb{N} \nrightarrow \lbrace 0,1,2\rbrace \\) from Puzzle 206 to get a feasibility relation \\(\Psi \Phi : \mathbb{N} \nrightarrow [0,\infty) \\) describing how many children you can feed for a certain amount of money (given the fact that you plan to buy at most two loaves). \[ \Psi(x, y) = \begin{cases} \texttt{true} & \mbox{if } (x \leq 0 \mbox{ and } 0 \leq y ) \mbox{ or } (x \leq 3 \mbox{ and } 2 \leq y) \mbox{ or } (x \leq 6 \mbox{ and } 4 \leq y) \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \]`

$$ \Theta(m,n,i,j,k) = \begin{cases} \texttt{true} & \mbox{if } m \leq j \mbox{ and } n \leq k \mbox{ and } m+n \leq 4i \\ \texttt{false} & \mbox{otherwise.} \end{cases} $$

`>**Puzzle 208.** Suppose you some slices of bread, some slices of cheese and some slices of ham. You are trying to make sandwiches. You can make a cheese sandwich with two slices of bread and one slice of cheese. You can make a ham sandwich with two slices of bread and one slice of ham. There is a feasibility relation \\(\Theta : \mathbb{N} \times \mathbb{N} \nrightarrow \mathbb{N} \times \mathbb{N} \times \mathbb{N} \\) where \\(\Theta(m,n,i,j,k) = \text{true}\\) if you can make \\(m\\) cheese sandwiches and \\(n\\) ham sandwiches from \\(i\\) slices of bread, \\(j\\) slices of cheese and \\(k\\) slices of ham. \[ \Theta(m,n,i,j,k) = \begin{cases} \texttt{true} & \mbox{if } m \leq j \mbox{ and } n \leq k \mbox{ and } m+n \leq 4i \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \]`

The exact requirements of frying and toasting is vague... but I think this is what we were supposed to do?

Define \(\Phi(x,x’)\) to be feasibility for frying where you get one fried egg (x) from one egg (x’). Similarly define \(\Psi(y,y’)\) to be feasibility for toasting where you get one toast (y) from one slice of bread (y’).Then :

$$ \Phi(x,x') = \begin{cases} \texttt{true} & \mbox{if } x \leq x' \\ \texttt{false} & \mbox{otherwise.} \end{cases} $$ $$ \Psi(y,y') = \begin{cases} \texttt{true} & \mbox{if } y \leq y' \\ \texttt{false} & \mbox{otherwise.} \end{cases} $$ $$ (\Phi \otimes \Psi)((x,y),(x',y')) = \begin{cases} \texttt{true} & \mbox{if } (x \leq x') \mbox{ and } (y \leq y') \\ \texttt{false} & \mbox{otherwise.} \end{cases} $$

This is just the monoidal preorder law.

`>**Puzzle 209.** Suppose you are trying to fry some eggs and also toast some slices of bread. Describe each process separately as a feasibility relation from \\(\mathbb{N}\\) to \\(\mathbb{N}\\) and then tensor these relations. What is the result? The exact requirements of frying and toasting is vague... but I think this is what we were supposed to do? Define \\(\Phi(x,x’)\\) to be feasibility for frying where you get one fried egg (x) from one egg (x’). Similarly define \\(\Psi(y,y’)\\) to be feasibility for toasting where you get one toast (y) from one slice of bread (y’).Then : \[ \Phi(x,x') = \begin{cases} \texttt{true} & \mbox{if } x \leq x' \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] \[ \Psi(y,y') = \begin{cases} \texttt{true} & \mbox{if } y \leq y' \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] \[ (\Phi \otimes \Psi)((x,y),(x',y')) = \begin{cases} \texttt{true} & \mbox{if } (x \leq x') \mbox{ and } (y \leq y') \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] >**Puzzle 211.** What general mathematical result is Puzzle 209 an example of? This is just the monoidal preorder law.`

So we need to prove : $$ \text{ if } (x_1',x_2') \le_X (x_1,x_2) \text{ and } (y_1,y_2) \le_Y (y_1',y_2')', \text{ then } (\Phi \otimes \Psi)((x_1,x_2),(y_1,y_2)) \text{ implies } (\Phi \otimes \Psi)((x_1',x_2'),(y_1',y_2')) $$ Using monoidal preorder law and reordering, the left side can be written as: $$(x_1' \le_X x_1 \text{ and } y_1 \le_Y y_1') \text{ and } (x_2' \le_X x_2 \text{ and } y_2 \le_Y y_2')$$ Using the definition of tensoring, we can write the right side as: $$ \Phi(x_1,y_1) \wedge \Psi(x_2,y_2) \text{ implies } \Phi(x_1',y_1') \wedge \Psi(x_2',y_2') $$ Which is the same as : $$ \Phi(x_1,y_1) \text{ implies } \Phi(x_1',y_1') \wedge \Psi(x_2,y_2) \text{ implies } \Psi(x_2',y_2') $$ Collecting common terms from both sides: $$ (\text{if } x_1' \le_X x_1 \text{ and } y_1 \le_Y y_1', \text{ then } \Phi(x_1,y_1) \text{ implies } \Phi(x_1',y_1')) \wedge (\text{ if } x_2' \le_X x_2 \text{ and } y_2 \le_Y y_2', \text{ then } \Psi(x_2,y_2) \text{ implies } \Psi(x_2',y_2')) $$ This is true since \(\Phi\) and \(\Psi\) are feasibility relations:

$$ \text{ if } x_1' \le_X x_1 \text{ and } y_1 \le_Y y_1', \text{ then } \Phi(x_1,y_1) \text{ implies } \Phi(x_1',y_1') $$ $$ \text{ if } x_2' \le_X x_2 \text{ and } y_2 \le_Y y_2', \text{ then } \Psi(x_2,y_2) \text{ implies } \Psi(x_2',y_2') $$

`>**Puzzle 210.** Show that \\(\Phi \otimes \Psi\\) is really a feasibility relation if \\(\Phi\\) and \\(\Psi\\) are feasibility relations. So we need to prove : \[ \text{ if } (x_1',x_2') \le_X (x_1,x_2) \text{ and } (y_1,y_2) \le_Y (y_1',y_2')', \text{ then } (\Phi \otimes \Psi)((x_1,x_2),(y_1,y_2)) \text{ implies } (\Phi \otimes \Psi)((x_1',x_2'),(y_1',y_2')) \] Using monoidal preorder law and reordering, the left side can be written as: \[(x_1' \le_X x_1 \text{ and } y_1 \le_Y y_1') \text{ and } (x_2' \le_X x_2 \text{ and } y_2 \le_Y y_2')\] Using the definition of tensoring, we can write the right side as: \[ \Phi(x_1,y_1) \wedge \Psi(x_2,y_2) \text{ implies } \Phi(x_1',y_1') \wedge \Psi(x_2',y_2') \] Which is the same as : \[ \Phi(x_1,y_1) \text{ implies } \Phi(x_1',y_1') \wedge \Psi(x_2,y_2) \text{ implies } \Psi(x_2',y_2') \] Collecting common terms from both sides: \[ (\text{if } x_1' \le_X x_1 \text{ and } y_1 \le_Y y_1', \text{ then } \Phi(x_1,y_1) \text{ implies } \Phi(x_1',y_1')) \wedge (\text{ if } x_2' \le_X x_2 \text{ and } y_2 \le_Y y_2', \text{ then } \Psi(x_2,y_2) \text{ implies } \Psi(x_2',y_2')) \] This is true since \\(\Phi\\) and \\(\Psi\\) are feasibility relations: \[ \text{ if } x_1' \le_X x_1 \text{ and } y_1 \le_Y y_1', \text{ then } \Phi(x_1,y_1) \text{ implies } \Phi(x_1',y_1') \] \[ \text{ if } x_2' \le_X x_2 \text{ and } y_2 \le_Y y_2', \text{ then } \Psi(x_2,y_2) \text{ implies } \Psi(x_2',y_2') \]`

Matthew wrote:

Right, sorry. I've gone back and fixed that - I hope Simon doesn't get upset.

Right. I always mix up "vee" and "wedge" when typing in LaTeX, and apparently I mix up "hat" and "check" too. I seem to do bad at all these arbitrary binary conventions.

`Matthew wrote: > John: > I think you have a typo in post #13. You mean \\(\check{G}\\) not \\(\hat{G}\\), right? Right, sorry. I've gone back and fixed that - I hope Simon doesn't get upset. <img src = "http://math.ucr.edu/home/baez/emoticons/tongue2.gif"> > You said in Lecture 65 that \\(\hat{F}\\) is the **companion** of \\(F\\) while \\(\check{F}\\) is the **conjoint** of \\(F\\). Right. I always mix up "vee" and "wedge" when typing in LaTeX, and apparently I mix up "hat" and "check" too. I seem to do bad at all these arbitrary binary conventions.`

Dan proposed the following solution to Puzzle 205 in comment #11

Nice picture! That's a good way to visualize what's going on. As you say, the monotonicity becomes visible.

I think Michael's suggested correction is right:

but luckily, this doesn't affect the picture!

`Dan proposed the following solution to Puzzle 205 in [comment #11](https://forum.azimuthproject.org/discussion/comment/20339/#Comment_20339) >\[ \Psi(x, y) = \begin{cases} \texttt{false} & \mbox{if } (x = 1 \mbox{ and } y \le 2) \mbox{ or } (x = 2 \mbox{ and } y \le 4) \\\\ \texttt{true} & \mbox{otherwise.} \end{cases} \] > <center><img src = "https://doneata.bitbucket.io/applied-category-theory/puzzle-205.png"></center> Nice picture! That's a good way to visualize what's going on. As you say, the monotonicity becomes visible. I think Michael's suggested correction is right: >\[ \Psi(x, y) = \begin{cases} \texttt{false} & \mbox{if } (x = 1 \mbox{ and } y \lt 2) \mbox{ or } (x = 2 \mbox{ and } y \lt 4) \\\\ \texttt{true} & \mbox{otherwise.} \end{cases} \] but luckily, this doesn't affect the picture!`

Michael wrote:

Yes - I wanted to make people think a little. If you have some number \(x\) of eggs, and you want fried eggs, you can get at most \(x\) fried eggs. Similarly with toasting slices of bread. I wanted people to translate these well-known facts into feasibility relations.

Right! And now we tensor them together...

Right!

Okay, on to the next puzzle.

Michael wrote:

Hmm. First of all, the monoidal preorder law isn't a "result", it's just part of a definition. In a monoidal preorder we must have

$$ x \le x' \text{ and } y \le y \text{ implies } x \otimes x' \le y \otimes y' $$ \(\textbf{Bool}\) is a monoidal preorder, and the monoidal preorder law for \(\textbf{Bool}\) says

$$ x \le x' \text{ and } y \le y \text{ implies } x \wedge x' \le y \wedge y' $$ I believe this law is the key to solving Puzzle 210:

But Puzzle 209 is about something more specific.

So, let me give some hints.

In Puzzle 209 the feasibility relation we're calling \(\Phi\) is just any old feasibility relation from \(\mathbb{N}\) to \(\mathbb{N}\): it's a very famous one, with a name! Similarly for \(\Psi\)... and similarly for \(\Phi \otimes \Psi\). So the answer to Puzzle 209 is a special case of a general result - a result I haven't stated yet. I'm trying to get people to guess this result based on this particular example.

`> **Puzzle 209.** Suppose you are trying to fry some eggs and also toast some slices of bread. Describe each process separately as a feasibility relation from \\(\mathbb{N}\\) to \\(\mathbb{N}\\) and then tensor these relations. What is the result? Michael wrote: > The exact requirements of frying and toasting is vague... Yes - I wanted to make people think a little. If you have some number \\(x\\) of eggs, and you want fried eggs, you can get at most \\(x\\) fried eggs. Similarly with toasting slices of bread. I wanted people to translate these well-known facts into feasibility relations. > Define \\(\Phi(x,x’)\\) to be feasibility for frying where you get one fried egg (x) from one egg (x’). Similarly define \\(\Psi(y,y’)\\) to be feasibility for toasting where you get one toast (y) from one slice of bread (y’).Then : > \[ \Phi(x,x') = \begin{cases} \texttt{true} & \mbox{if } x \leq x' \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] > \[ \Psi(y,y') = \begin{cases} \texttt{true} & \mbox{if } y \leq y' \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] Right! And now we tensor them together... > \[ (\Phi \otimes \Psi)((x,y),(x',y')) = \begin{cases} \texttt{true} & \mbox{if } (x \leq x') \mbox{ and } (y \leq y') \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] Right! Okay, on to the next puzzle. > **Puzzle 211.** What general mathematical result is Puzzle 209 an example of? Michael wrote: > This is just the monoidal preorder law. Hmm. First of all, the monoidal preorder law isn't a "result", it's just part of a definition. In a monoidal preorder we must have \[ x \le x' \text{ and } y \le y \text{ implies } x \otimes x' \le y \otimes y' \] \\(\textbf{Bool}\\) is a monoidal preorder, and the monoidal preorder law for \\(\textbf{Bool}\\) says \[ x \le x' \text{ and } y \le y \text{ implies } x \wedge x' \le y \wedge y' \] I believe this law is the key to solving Puzzle 210: > **Puzzle 210.** Show that \\(\Phi \otimes \Psi\\) is really a feasibility relation if \\(\Phi\\) and \\(\Psi\\) are feasibility relations. But Puzzle 209 is about something more specific. So, let me give some hints. In Puzzle 209 the feasibility relation we're calling \\(\Phi\\) is just any old feasibility relation from \\(\mathbb{N}\\) to \\(\mathbb{N}\\): it's a very famous one, with a name! Similarly for \\(\Psi\\)... and similarly for \\(\Phi \otimes \Psi\\). So the answer to Puzzle 209 is a special case of a general result - a result I haven't stated yet. I'm trying to get people to guess this result based on this particular example.`

I've lost enough marks in school to know that this is

technicallyincorrect since \(x\) is in units of \(\text{bread}\) and \(y\) is in units of $.This is like saying, "an electron will jump to a new orbital, before decaying back down and emitting a photon, but only if it has been given

1.2of energy."Without the units, this doesn't make sense.

The answer with units is,

$$ \Psi(x, y) = \begin{cases} \texttt{false} & \mbox{if } (x = 1 \text{ bread} \mbox{ and } y \lt \$ 2) \mbox{ or } (x = 2 \text{ bread} \mbox{ and } y \lt \$ 4) \\ \texttt{true} & \mbox{otherwise.} \end{cases} $$

`I've lost enough marks in school to know that this is *technically* incorrect since \\(x\\) is in units of \\(\text{bread}\\) and \\(y\\) is in units of $. This is like saying, "an electron will jump to a new orbital, before decaying back down and emitting a photon, but only if it has been given *1.2* of energy." Without the units, this doesn't make sense. The answer with units is, \[ \Psi(x, y) = \begin{cases} \texttt{false} & \mbox{if } (x = 1 \text{ bread} \mbox{ and } y \lt \$ 2) \mbox{ or } (x = 2 \text{ bread} \mbox{ and } y \lt \$ 4) \\\\ \texttt{true} & \mbox{otherwise.} \end{cases} \]`

Half the people who go into math instead of physics do so in order to avoid worrying about units.

If we want to be persnickety about this, I actually think Michael's original formula was correct given my statement of the problem. After all, I said \(\Psi\) was a feasibility relation from \(\lbrace{0,1,2\rbrace}\) to \(\mathbb{N}\). So, for \(\Psi(x,y)\) to make sense we need \(x \in \lbrace0,1,2\rbrace \). So it's possible to have \(x = 1\), but not possible to have \(x = 1 \text{ bread}\).

However, you could argue that in my problem I should have used the set \(\lbrace 0 \text{ bread}, 1 \text{ bread}, 2 \text{ bread}\rbrace \), not the set \(\lbrace{0,1,2\rbrace}\).

That's fine; I wouldn't argue with that. In applications, sets of numbers are 'typed'. That is, the set \(\lbrace 0 \text{ bread}, 1 \text{ bread}, 2 \text{ bread}\rbrace \) is not equal to \(\lbrace 0 \text{ dollar}, 1 \text{ dollar}, 2 \text{ dollar} \rbrace \), just isomorphic. I'm just too lazy to include units in all my sets of numbers. This amounts to treating various isomorphic sets as equal.

`Half the people who go into math instead of physics do so in order to avoid worrying about units. <img src = "http://math.ucr.edu/home/baez/emoticons/tongue2.gif"> If we want to be persnickety about this, I actually think Michael's original formula was correct given my statement of the problem. After all, I said \\(\Psi\\) was a feasibility relation from \\(\lbrace{0,1,2\rbrace}\\) to \\(\mathbb{N}\\). So, for \\(\Psi(x,y)\\) to make sense we need \\(x \in \lbrace0,1,2\rbrace \\). So it's possible to have \\(x = 1\\), but not possible to have \\(x = 1 \text{ bread}\\). However, you could argue that in my problem I should have used the set \\(\lbrace 0 \text{ bread}, 1 \text{ bread}, 2 \text{ bread}\rbrace \\), not the set \\(\lbrace{0,1,2\rbrace}\\). That's fine; I wouldn't argue with that. In applications, sets of numbers are 'typed'. That is, the set \\(\lbrace 0 \text{ bread}, 1 \text{ bread}, 2 \text{ bread}\rbrace \\) is not equal to \\(\lbrace 0 \text{ dollar}, 1 \text{ dollar}, 2 \text{ dollar} \rbrace \\), just isomorphic. I'm just too lazy to include units in all my sets of numbers. This amounts to treating various isomorphic sets as equal.`

Keith wrote in comment #1:

I wrote:

Christopher wrote approximately:

Right: that's the clarification I was wanting from Keith. We can think of relations in at least 3 ways:

A relation \(R: X \nrightarrow Y \) between sets is a subset \( R \subseteq X \times Y \).

A relation \(R: X \nrightarrow Y \) between sets is a function \( R \colon X \times Y \to \textbf{Bool} \).

A relation \(R: X \nrightarrow Y \) between sets is a function \( R \colon X \to P(Y) \) where \(P(Y)\) is the power set of \(Y\).

We've been using the first two outlooks a lot, but the third lets us think of a relation as a multivalued function from \(X\) to \(Y\), i.e. a function that maps each element of \(X\) to a

subsetof \(Y \). This is the outlook that Keith was taking!We can get from outlook 2 to outlook 3 as follows.

Functions \(f: A \times B \to C\) correspond in a one-to-one way with functions \(\hat{f} : A \to C^B\), where \(C^B\) is the set of functions from \(B\) to \(C\). Computer scientists call this correspondence

currying. It goes like this:$$ \hat{f}(a)(b) = f(a,b) .$$ So, functions

$$ f: X \times Y \to \textbf{Bool} $$ correspond in a one-to-one way with functions

$$ \hat{f} : X \to \textbf{Bool}^Y .$$ But \(\textbf{Bool}^Y\) is just the power set of \(Y \)!

It's interesting to see how this plays out when we think about

feasibilityrelations.Puzzle.Suppose \(X\) and \(Y\) are preorders. Can we reinterpret a feasibility relation, namely a monotone function$$ \Phi : X^{\text{op}} \times Y \to \textbf{Bool} , $$ as a monotone function

$$ \hat{\Phi} : X^{\text{op}} \to \textbf{Bool}^{\textbf{X}} $$ or perhaps slightly better

$$ \tilde{\Phi} : Y \to \textbf{Bool}^{\textbf{X}^{\text{op}}} ? $$ The first problem here is figuring out what's an exponential of preorders!

`Keith wrote in comment #1: > \\(\texttt{false}\\) maps to everything less than $500 I wrote: > [...] please clarify what you mean by saying > > \\(\texttt{false}\\) maps to everything less than $500 > You're making it sound like a feasibility relation is a 'multi-valued function' where \\(\texttt{false}\\) can map to lots of different things. That's a really cool way of talking, which we may be able to make sense of if we work a little - but that's not what we defined a feasibility relation to be. Christopher wrote approximately: > a relation is the same thing as a multivalued function (where 'multi' includes zero). Right: that's the clarification I was wanting from Keith. We can think of relations in at least 3 ways: 1. A relation \\(R: X \nrightarrow Y \\) between sets is a subset \\( R \subseteq X \times Y \\). 2. A relation \\(R: X \nrightarrow Y \\) between sets is a function \\( R \colon X \times Y \to \textbf{Bool} \\). 3. A relation \\(R: X \nrightarrow Y \\) between sets is a function \\( R \colon X \to P(Y) \\) where \\(P(Y)\\) is the power set of \\(Y\\). We've been using the first two outlooks a lot, but the third lets us think of a relation as a multivalued function from \\(X\\) to \\(Y\\), i.e. a function that maps each element of \\(X\\) to a _subset_ of \\(Y \\). This is the outlook that Keith was taking! We can get from outlook 2 to outlook 3 as follows. Functions \\(f: A \times B \to C\\) correspond in a one-to-one way with functions \\(\hat{f} : A \to C^B\\), where \\(C^B\\) is the set of functions from \\(B\\) to \\(C\\). Computer scientists call this correspondence **currying**. It goes like this: \[ \hat{f}(a)(b) = f(a,b) .\] So, functions \[ f: X \times Y \to \textbf{Bool} \] correspond in a one-to-one way with functions \[ \hat{f} : X \to \textbf{Bool}^Y .\] But \\(\textbf{Bool}^Y\\) is just the power set of \\(Y \\)! It's interesting to see how this plays out when we think about _feasibility_ relations. **Puzzle.** Suppose \\(X\\) and \\(Y\\) are preorders. Can we reinterpret a feasibility relation, namely a monotone function \[ \Phi : X^{\text{op}} \times Y \to \textbf{Bool} , \] as a monotone function \[ \hat{\Phi} : X^{\text{op}} \to \textbf{Bool}^{\textbf{X}} \] or perhaps slightly better \[ \tilde{\Phi} : Y \to \textbf{Bool}^{\textbf{X}^{\text{op}}} ? \] The first problem here is figuring out what's an exponential of preorders!`

This companion and conjoint business is confusing but from what I've been able to put together, its basically the two ways of creating a feasibility relation from a monotone function? It seems to be related to whether the feasibility relation is based on "at most" or "at least" or both or none? This is still very distant to me and I think I need more examples to get some intuition. Has anyone worked the answers to this puzzle?

`>**Puzzle 212.** We can get a feasibility relation by taking either the companion or the conjoint of a monotone map, thanks to the ideas in the puzzles of [Lecture 65](https://forum.azimuthproject.org/discussion/2299/lecture-65-chapter-4-collaborative-design/p1). Which of the feasibility relations in this lecture's puzzles are companions or conjoints? This companion and conjoint business is confusing but from what I've been able to put together, its basically the two ways of creating a feasibility relation from a monotone function? It seems to be related to whether the feasibility relation is based on "at most" or "at least" or both or none? This is still very distant to me and I think I need more examples to get some intuition. Has anyone worked the answers to this puzzle?`

Matthew wrote:

Sorry this is probably a newbie question but why is \(\mathcal{Y}(F(x), y )\) of type \(\mathbf{Bool}\) ? Shouldn't it be just an arrow?

`Matthew wrote: > Any \\(\mathcal{V}\\)-enriched functor \\(F: \mathcal{X} \to \mathcal{Y}\\) gives a \\(\mathcal{V}\\)-enriched profunctor > > \[ \hat{F} \colon \mathcal{X} \nrightarrow \mathcal{Y} \] > > defined by > > \[ \hat{F} (x,y) = \mathcal{Y}(F(x), y ) .\] > > \\(\hat{F} \colon \mathcal{X} \nrightarrow \mathcal{Y}\\) is called the **companion** of \\(F\\). >In this case \\(\mathcal{X} = \mathbf{Bool}\\) and \\(\mathcal{Y} = [0,\infty)\\). So let \\(F\\) map \\(\mathtt{false} \mapsto 0\\) and \\(\mathtt{true} \mapsto 500\\). Then \\(\hat{F}(x,y) = F(x) \leq y\\). >So \\(\hat{F}(\mathtt{false},y) = \mathtt{true} \text{, for all } y \in [0,\infty)\\) ✔ Sorry this is probably a newbie question but why is \\(\mathcal{Y}(F(x), y )\\) of type \\(\mathbf{Bool}\\) ? Shouldn't it be just an arrow?`

Someone please answer Michael's questions! They're a good test of understanding.

`Someone please answer Michael's questions! They're a good test of understanding.`

The short answer: is because partial orders are \(\mathbf{Bool}\)-categories, and a monotone function is exactly the same as a functor between \(\mathbf{Bool}\)-categories .

The long answer: For

Puzzle 204, we want to define a feasibility relation \(\Phi : \mathbf{Bool} \nrightarrow [0,\infty)\).If we have a monotone function \(F: \mathcal{X} \to \mathcal{Y} \), its companion \(\hat{F} : \mathcal{X} \to \mathcal{Y} \) is defined by \(\hat{F}(x,y) = \mathcal{Y}(F(x),y)\).

So if we want \(\Phi = \hat{F}\) for some \(F\), we need a monotone function \(F: \mathbf{Bool} \to [0,\infty)\).

Perhaps what is confusing is that we are using some shorthand here.

\(\mathbf{Bool}\) is shorthand for "the bounded total order \((\lbrace \mathtt{false}, \mathtt{true}\rbrace, \leq, \mathtt{false})\) where \(\mathtt{false} \le \mathtt{true}\)." Perhaps most confusingly, we are taking \(\mathbf{Bool}\) here to be a \(\mathbf{Bool}\)-enriched category. In particular, as a \(\mathbf{Bool}\)-enriched category \(\mathbf{Bool}(x,y) = x \leq y\).

Moreover \([0,\infty)\) is shorthand "the lower-bounded total order \(([0,\infty), \leq, 0)\) where under the conventional ordering from analysis class". Once again we have a \(\mathbf{Bool}\)-enriched category on our hands, since all partial orders are bool-enriched categories. In particular, as a \(\mathbf{Bool}\)-enriched category \([0,\infty)(x,y) = x \leq y\).

So finding a map \(F: \mathbf{Bool} \to [0,\infty)\), but we know price goes up with quantity so I just list out the price of things.

John's answer is the right adjoint of my answer (if this isn't obvious, perhaps we can check this).

`> Sorry this is probably a newbie question but why is \\(\mathcal{Y}(F(x), y )\\) of type \\(\mathbf{Bool}\\) ? The short answer: is because partial orders are \\(\mathbf{Bool}\\)-categories, and a monotone function is exactly the same as a functor between \\(\mathbf{Bool}\\)-categories . The long answer: For **Puzzle 204**, we want to define a feasibility relation \\(\Phi : \mathbf{Bool} \nrightarrow [0,\infty)\\). If we have a monotone function \\(F: \mathcal{X} \to \mathcal{Y} \\), its companion \\(\hat{F} : \mathcal{X} \to \mathcal{Y} \\) is defined by \\(\hat{F}(x,y) = \mathcal{Y}(F(x),y)\\). So if we want \\(\Phi = \hat{F}\\) for some \\(F\\), we need a monotone function \\(F: \mathbf{Bool} \to [0,\infty)\\). Perhaps what is confusing is that we are using some shorthand here. \\(\mathbf{Bool}\\) is shorthand for "the bounded total order \\((\lbrace \mathtt{false}, \mathtt{true}\rbrace, \leq, \mathtt{false})\\) where \\(\mathtt{false} \le \mathtt{true}\\)." Perhaps most confusingly, we are taking \\(\mathbf{Bool}\\) here to be a \\(\mathbf{Bool}\\)-enriched category. In particular, as a \\(\mathbf{Bool}\\)-enriched category \\(\mathbf{Bool}(x,y) = x \leq y\\). Moreover \\([0,\infty)\\) is shorthand "the lower-bounded total order \\(([0,\infty), \leq, 0)\\) where under the conventional ordering from analysis class". Once again we have a \\(\mathbf{Bool}\\)-enriched category on our hands, since all partial orders are bool-enriched categories. In particular, as a \\(\mathbf{Bool}\\)-enriched category \\([0,\infty)(x,y) = x \leq y\\). So finding a map \\(F: \mathbf{Bool} \to [0,\infty)\\), but we know price goes up with quantity so I just list out the price of things. John's answer is the right adjoint of my answer (if this isn't obvious, perhaps we can check this).`

These are of type \(\mathbf{Bool}\) because a \(\mathbf{Bool}\)-profunctor \(\Phi : X \nrightarrow Y\) is the same as a functor \(\overline{\Phi} : X^{op} \times Y \to \mathbf{Bool}\).

`These are of type \\(\mathbf{Bool}\\) because a \\(\mathbf{Bool}\\)-profunctor \\(\Phi : X \nrightarrow Y\\) is the same as a functor \\(\overline{\Phi} : X^{op} \times Y \to \mathbf{Bool}\\).`

Can we give the \(\mathbf{Bool}\)-companion as a natural transformation:

\[ \alpha_⤴ := \begin{matrix} & & \hat{F} & & \\ & X & \nrightarrow & Y & \\ F & \downarrow & & \downarrow & Id_Y\\ & Y & \rightarrow & Y & \\ & & \leq_Y & & \end{matrix}\quad ? \]

Edit: From what I understand from here, we should also have another natural transformation for the companion. I believe,

\[ \alpha_↱ := \begin{matrix} & & \leq_X & & \\ & X & \rightarrow & X & \\ Id_X & \downarrow & & \downarrow & F\\ & X & \nrightarrow & Y. & \\ & & \hat{F} & & \end{matrix} \]

`Can we give the \\(\mathbf{Bool}\\)-companion as a natural transformation: \\[ \alpha\_⤴ := \begin{matrix} & & \hat{F} & & \\\\ & X & \nrightarrow & Y & \\\\ F & \downarrow & & \downarrow & Id\_Y\\\\ & Y & \rightarrow & Y & \\\\ & & \leq\_Y & & \end{matrix}\quad ? \\] Edit: From what I understand from [here](https://golem.ph.utexas.edu/category/2017/08/a_graphical_calculus_for_proar.html), we should also have another natural transformation for the companion. I believe, \\[ \alpha\_↱ := \begin{matrix} & & \leq\_X & & \\\\ & X & \rightarrow & X & \\\\ Id\_X & \downarrow & & \downarrow & F\\\\ & X & \nrightarrow & Y. & \\\\ & & \hat{F} & & \end{matrix} \\]`

Matthew wrote :

Doh. We learned this... sorry forgot that preorders are just \(\mathbf{Bool}\)-categories. I think I've been learning too much in short period of time LOL. Thanks for the kind answer.

`Matthew wrote : >The short answer: is because partial orders are \\(\mathbf{Bool}\\)-categories, and a monotone function is exactly the same as a functor between \\(\mathbf{Bool}\\)-categories . Doh. We learned this... sorry forgot that preorders are just \\(\mathbf{Bool}\\)-categories. I think I've been learning too much in short period of time LOL. Thanks for the kind answer.`

Hey Michael,

Maybe we can find a few companions and conjoints together? I already tried to find a few.

John mentioned that one of the problems has

neithera conjoint nor a companion, so finding that one and proving it doesn't have any is going to be hard.I can see a conjoint that gives rise to your answer.

The companion, if it exists at all, is less intuitive. If it doesn't exist do you see how we'd go about proving it doesn't?

`Hey Michael, > This companion and conjoint business is confusing but from what I've been able to put together, its basically the two ways of creating a feasibility relation from a monotone function? It seems to be related to whether the feasibility relation is based on "at most" or "at least" or both or none? This is still very distant to me and I think I need more examples to get some intuition. Has anyone worked the answers to this puzzle? Maybe we can find a few companions and conjoints together? I already tried to find a few. John mentioned that one of the problems has *neither* a conjoint nor a companion, so finding that one and proving it doesn't have any is going to be hard. > >**Puzzle 206.** Suppose you are trying to feed hungry children with the loaves of bread you bought in the previous puzzle, and you can feed at most three children with each loaf of bread. Describe this using a feasibility relation \\(\Phi : \mathbb{N} \nrightarrow \lbrace 0,1,2\rbrace \\). Here \\(\mathbb{N}\\) is the set of natural numbers \\( \lbrace 0,1,2,3,\dots \rbrace \\) with its usual ordering. > > \[ \Psi(x, y) = \begin{cases} \texttt{true} & \mbox{if } (x \leq 0 \mbox{ and } y = 0) \mbox{ or } (x \leq 3 \mbox{ and } y = 1) \mbox{ or } (x \leq 6 \mbox{ and } y = 2) \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] I can see a conjoint that gives rise to your answer. The companion, if it exists at all, is less intuitive. If it doesn't exist do you see how we'd go about proving it doesn't?`

They are the identity morphisms for their respective objects in the category of feasibility relations. Perhaps the general result you mean is that the tensor of identities gives the identity for the tensor of the objects.

`> But Puzzle 209 is about something more specific. > So, let me give some hints. > In Puzzle 209 the feasibility relation we're calling \\(\Phi\\) is just any old feasibility relation from \\(\mathbb{N}\\) to \\(\mathbb{N}\\): it's a very famous one, with a name! Similarly for \\(\Psi\\)... and similarly for \\(\Phi \otimes \Psi\\). So the answer to Puzzle 209 is a special case of a general result - a result I haven't stated yet. I'm trying to get people to guess this result based on this particular example. They are the identity morphisms for their respective objects in the category of feasibility relations. Perhaps the general result you mean is that the tensor of identities gives the identity for the tensor of the objects.`

Yoav - yes, you're right!

In Puzzle 209, \(\Phi, \Psi \colon \mathbf{N} \to \mathbf{N}\) are both the identity feasibility relation, and we are tensoring them and getting the identity feasibility relation from \(\mathbb{N} \times \mathbb{N}\) to itself.

If anyone doesn't see why these guys are identities, they can look at Lecture 64, where I proved this:

A feasibility relation is just a \(\textbf{Bool}\)-enriched profunctor, so we can water down the above Lemma to this special case:

Watered-Down Lemma.For an preorder \(X\), the monotone function \( \mathrm{hom} \colon X^{\text{op}} \times X \to \mathbf{Bool} \), defined by$$ \mathrm{hom}(x,x') = \begin{cases} \texttt{true} & \mbox{if } x \le x' \\ \texttt{false} & \mbox{otherwise.} \end{cases} $$ corresponds to a feasibility relation

$$ 1_{\mathcal{X}} \colon X \nrightarrow X $$ that serves as an identity for composition.

In Lecture 67 we'll see another use for the 'hom-functor': it not only gives identities, it gives something called the 'cup'.

`Yoav - yes, you're right! In Puzzle 209, \\(\Phi, \Psi \colon \mathbf{N} \to \mathbf{N}\\) are both the identity feasibility relation, and we are tensoring them and getting the identity feasibility relation from \\(\mathbb{N} \times \mathbb{N}\\) to itself. If anyone doesn't see why these guys are identities, they can look at [Lecture 64](https://forum.azimuthproject.org/discussion/2298/lecture-64-chapter-4-the-category-of-enriched-profunctors#latest), where I proved this: > **Lemma.** For any \\(\mathcal{V}\\)-enriched category \\(\mathcal{X}\\), the \\(\mathcal{V}\\)-enriched functor \\( \mathrm{hom} \colon \mathcal{X}^{\text{op}} \times \mathcal{X} \to \mathcal{V} \\), defined by > \[ \mathrm{hom}(x,x') = \mathcal{X}(x,x') ,\] > corresponds to a \\(\mathcal{V}\\)-enriched profunctor > \[ 1_{\mathcal{X}} \colon \mathcal{X} \nrightarrow \mathcal{X} \] > that serves as an identity for composition. A feasibility relation is just a \\(\textbf{Bool}\\)-enriched profunctor, so we can water down the above Lemma to this special case: **Watered-Down Lemma.** For an preorder \\(X\\), the monotone function \\( \mathrm{hom} \colon X^{\text{op}} \times X \to \mathbf{Bool} \\), defined by \[ \mathrm{hom}(x,x') = \begin{cases} \texttt{true} & \mbox{if } x \le x' \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] corresponds to a feasibility relation \[ 1\_{\mathcal{X}} \colon X \nrightarrow X \] that serves as an identity for composition. In [Lecture 67](https://forum.azimuthproject.org/discussion/2303/lecture-67-chapter-4-collaborative-design/p1) we'll see another use for the 'hom-functor': it not only gives identities, it gives something called the 'cup'.`

Matthew wrote:

I think I might have been wrong about that.

My intuition for companions and conjoints wasn't so good at first: witness my surprise in comment #9! But I think that surprise wound up improving my intuition.

So, let me try to explain my intuition for this stuff. It's easiest with an example:

Suppose we want \(\Psi\) to be the companion of some monotone function \(F \colon {0,1,2} \nrightarrow [0,\infty) \).

\(F\) is a function that takes a number of loaves of bread and gives an amount of money. So, the obvious first guess is a function \(F\) such that

\(\hat{F}\) will then take this function and 'pad it out' to give a feasibility relation. If you have

more than\(F(x)\) dollars, it's still feasible to buy \(x\) loaves of bread. And if you have \(F(x)\) dollars, it's feasible to buyless than\(x\) loaves of bread. So the feasibility relation \(\hat{F}\) is true for more pairs \( (x,y) \) than those for which \(F(x) = y\).In fact, it's true exactly for pairs with \(F(x) \le y\)!

This isn't hard to see. The idea of a companion is that

$$ \hat{F}(x,y) = \mathbf{Bool}(F(x), y ) $$ but if you unravel all the jargon and notation, this just means

So, to find a function \(F\) whose companion is \(\Psi\), we need a function such that

But to repeat myself: if we're seeking such a function, the obvious first guess is a function such that

For Puzzle 207, I think such a function exists.

`Matthew wrote: > John mentioned that one of the problems has *neither* a conjoint nor a companion [....] I think I might have been wrong about that. My intuition for companions and conjoints wasn't so good at first: witness my surprise in [comment #9](https://forum.azimuthproject.org/discussion/comment/20337/#Comment_20337)! But I think that surprise wound up improving my intuition. So, let me try to explain my intuition for this stuff. It's easiest with an example: > **Puzzle 207.** Suppose you buy loaves of bread and then use them to feed hungry children. Compose the feasibility relation \\(\Psi : \{0,1,2\} \nrightarrow [0,\infty) \\) from Puzzle 205 and the feasibility relation \\(\Phi : \mathbb{N} \nrightarrow \lbrace 0,1,2\rbrace \\) from Puzzle 206 to get a feasibility relation \\(\Psi \Phi : \mathbb{N} \nrightarrow [0,\infty) \\) describing how many children you can feed for a certain amount of money (given the fact that you plan to buy at most two loaves). Suppose we want \\(\Psi\\) to be the companion of some monotone function \\(F \colon \{0,1,2\} \nrightarrow [0,\infty) \\). \\(F\\) is a function that takes a number of loaves of bread and gives an amount of money. So, the obvious first guess is a function \\(F\\) such that <center> \\(x\\) loaves of bread costs \\(F(x)\\) dollars.</center> \\(\hat{F}\\) will then take this function and 'pad it out' to give a feasibility relation. If you have _more than_ \\(F(x)\\) dollars, it's still feasible to buy \\(x\\) loaves of bread. And if you have \\(F(x)\\) dollars, it's feasible to buy _less than_ \\(x\\) loaves of bread. So the feasibility relation \\(\hat{F}\\) is true for more pairs \\( (x,y) \\) than those for which \\(F(x) = y\\). In fact, it's true exactly for pairs with \\(F(x) \le y\\)! This isn't hard to see. The idea of a companion is that \[ \hat{F}(x,y) = \mathbf{Bool}(F(x), y ) \] but if you unravel all the jargon and notation, this just means <center> \\( \hat{F}(x,y) = \text{true} \\) iff \\(F(x) \le y \\) </center> So, to find a function \\(F\\) whose companion is \\(\Psi\\), we need a function such that <center> You can buy \\(x\\) loaves of bread for \\(y\\) dollars iff \\(F(x) \le y\\). </center> But to repeat myself: if we're seeking such a function, the obvious first guess is a function such that <center> \\(x\\) loaves of bread costs \\(F(x)\\) dollars.</center> For Puzzle 207, I think such a function exists.`

Conjoints work the same way only backwards. If you've got a feasibility relation \(\Phi \colon X \nrightarrow Y \) and you want it to be the conjoint of some function \(G \colon Y \to X\), you need

But in Puzzle 207, which is about buying loaves of bread, the obvious first guess would be a function \(G\) such that

`Conjoints work the same way only backwards. If you've got a feasibility relation \\(\Phi \colon X \nrightarrow Y \\) and you want it to be the conjoint of some function \\(G \colon Y \to X\\), you need <center> \\(\Phi(x,y) = \text{true} \\) iff \\(x \le G(y) \\). </center> But in Puzzle 207, which is about buying loaves of bread, the obvious first guess would be a function \\(G\\) such that <center> \\(y\\) dollars can buy \\(G(y) \\) loaves of bread. </center>`

re this puzzle:

I thought it might be worth proving it in the general case, ie

$$ \Phi \text{ and } \Psi \text{ are }\mathcal{V}\text{-profunctors} \implies (\Phi\otimes\Psi) \text{ is a }\mathcal{V}\text{-profunctor} $$ This amounts to proving that for all objects \((x, x')\) and \((a, a')\) in \(X\times X'\), and all objects \((y, y')\) and \((b, b')\) in \(Y\times Y'\), we have:

$$ (X\times X')((a, a'), (x, x')) \otimes (\Phi \otimes \Psi)((x, x'), (y, y')) \otimes (Y \times Y')((y, y'), (b, b')) \leq (\Phi \otimes \Psi)((a, a'), (b, b')) $$ Using the definitions of \(X\times X', \Phi \otimes \Psi, Y \times Y'\) we see that the left hand side is

$$ \big(X(a, x) \otimes X'(a', x')\big) \otimes \big(\Phi(x, y) \otimes \Psi(x', y')\big) \otimes \big(Y(y, b) \otimes Y(y', b')\big) $$ We can reorder this because \(\otimes\) is symmetric:

$$ \big(X(a, x) \otimes \Phi(x, y) \otimes Y(y, b)\big) \otimes \big(X'(a', x') \otimes \Psi(x', y') \otimes Y(y', b')\big) $$ But \(\Phi\) and \(\Psi\) are \(\mathcal{V}\)-profunctors, and \(\otimes\) is monotone, so this must be \(\leq\)

$$ \Phi(a, b) \otimes \Psi(a', b') $$ ... which is just the definition of \((\Phi \otimes \Psi)((a, a'), (b, b'))\). QED.

`re this puzzle: > **Puzzle 210.** Show that \\(\Phi \otimes \Psi\\) is really a feasibility relation if \\(\Phi\\) and \\(\Psi\\) are feasibility relations. I thought it might be worth proving it in the general case, ie \[ \Phi \text{ and } \Psi \text{ are }\mathcal{V}\text{-profunctors} \implies (\Phi\otimes\Psi) \text{ is a }\mathcal{V}\text{-profunctor} \] This amounts to proving that for all objects \\((x, x')\\) and \\((a, a')\\) in \\(X\times X'\\), and all objects \\((y, y')\\) and \\((b, b')\\) in \\(Y\times Y'\\), we have: \[ (X\times X')((a, a'), (x, x')) \otimes (\Phi \otimes \Psi)((x, x'), (y, y')) \otimes (Y \times Y')((y, y'), (b, b')) \leq (\Phi \otimes \Psi)((a, a'), (b, b')) \] Using the definitions of \\(X\times X', \Phi \otimes \Psi, Y \times Y'\\) we see that the left hand side is \[ \big(X(a, x) \otimes X'(a', x')\big) \otimes \big(\Phi(x, y) \otimes \Psi(x', y')\big) \otimes \big(Y(y, b) \otimes Y(y', b')\big) \] We can reorder this because \\(\otimes\\) is symmetric: \[ \big(X(a, x) \otimes \Phi(x, y) \otimes Y(y, b)\big) \otimes \big(X'(a', x') \otimes \Psi(x', y') \otimes Y(y', b')\big) \] But \\(\Phi\\) and \\(\Psi\\) are \\(\mathcal{V}\\)-profunctors, and \\(\otimes\\) is monotone, so this must be \\(\leq\\) \[ \Phi(a, b) \otimes \Psi(a', b') \] ... which is just the definition of \\((\Phi \otimes \Psi)((a, a'), (b, b'))\\). QED.`

John wrote:

Based on Yoav's comment, I think we can say further that:

$$\mathrm{hom}_{\mathcal{X}} \otimes \mathrm{hom}_{\mathcal{Y}} = \mathrm{hom}_{\mathcal{X} \times \mathcal{Y}} $$ Perhaps we can also think about

Puzzle 209from the perspective of companions and conjoints.One way between \(\mathcal{V}\)-enriched categories form a category is via composition. Every \(\mathcal{V}\)-category has a identity functor that leaves the objects alone and \(F \circ G (x) = F(G(x))\) is associative and obeys the \(\mathcal{V}\)-laws.

Let \(I_{\mathcal{X}}\) denote the identity functor for \(\mathcal{X}\), then we have:

$$ \hat{I}_{\mathcal{X}} = \check{I}_{\mathcal{X}} = \mathrm{hom}_{\mathcal{X}} $$ Moreover, for \(\mathbf{Bool}\)-categories in particular, we know how to construct products. We can lift this into product functors with \((F\times G)(x,y) := (F(x),G(y))\). In the special case of identity functors, we have:

$$ \begin{align} \widehat{(I_{\mathcal{X}} \times I_{\mathcal{Y}})} & = \hat{I}_{\mathcal{X}} \otimes \hat{I}_{\mathcal{Y}} \\ \overline{(I_{\mathcal{X}} \times I_{\mathcal{Y}})}& = \check{I}_{\mathcal{X}} \otimes \check{I}_{\mathcal{Y}} \\ \end{align} $$ Here I am using \(\overline{(I_{\mathcal{X}} \times I_{\mathcal{Y}})}\) because mathjax doesn't support

`\widecheck`

.This sort of leads me to wonder if we can generalize the above as a special case of two more general rules:

Moreover, thinking about Puzzle 207, I have been wondering:

I think the answer to those two questions is

yesbut I don't quite know...`John wrote: >> **Lemma.** For any \\(\mathcal{V}\\)-enriched category \\(\mathcal{X}\\), the \\(\mathcal{V}\\)-enriched functor \\( \mathrm{hom} \colon \mathcal{X}^{\text{op}} \times \mathcal{X} \to \mathcal{V} \\), defined by >> \[ \mathrm{hom}(x,x') = \mathcal{X}(x,x') ,\] >> corresponds to a \\(\mathcal{V}\\)-enriched profunctor >> \[ 1_{\mathcal{X}} \colon \mathcal{X} \nrightarrow \mathcal{X} \] >> that serves as an identity for composition. Based on Yoav's comment, I think we can say further that: \[\mathrm{hom}\_{\mathcal{X}} \otimes \mathrm{hom}\_{\mathcal{Y}} = \mathrm{hom}\_{\mathcal{X} \times \mathcal{Y}} \] Perhaps we can also think about **Puzzle 209** from the perspective of companions and conjoints. One way between \\(\mathcal{V}\\)-enriched categories form a category is via composition. Every \\(\mathcal{V}\\)-category has a identity functor that leaves the objects alone and \\(F \circ G (x) = F(G(x))\\) is associative and obeys the \\(\mathcal{V}\\)-laws. Let \\(I\_{\mathcal{X}}\\) denote the identity functor for \\(\mathcal{X}\\), then we have: \[ \hat{I}\_{\mathcal{X}} = \check{I}\_{\mathcal{X}} = \mathrm{hom}\_{\mathcal{X}} \] Moreover, for \\(\mathbf{Bool}\\)-categories in particular, we know how to construct products. We can lift this into product functors with \\((F\times G)(x,y) := (F(x),G(y))\\). In the special case of identity functors, we have: \[ \begin{align} \widehat{(I\_{\mathcal{X}} \times I\_{\mathcal{Y}})} & = \hat{I}\_{\mathcal{X}} \otimes \hat{I}\_{\mathcal{Y}} \\\\ \overline{(I\_{\mathcal{X}} \times I\_{\mathcal{Y}})}& = \check{I}\_{\mathcal{X}} \otimes \check{I}\_{\mathcal{Y}} \\\\ \end{align} \] Here I am using \\(\overline{(I\_{\mathcal{X}} \times I\_{\mathcal{Y}})}\\) because mathjax doesn't support `\widecheck`. This sort of leads me to wonder if we can generalize the above as a special case of two more general rules: 1. Is \\(\hat{F} \otimes \hat{G} = \widehat{F \times G}\\)? 2. Is \\(\check{F} \otimes \check{G} = \overline{F \times G}\\)? Moreover, thinking about Puzzle 207, I have been wondering: 3. Is \\(\hat{F} \hat{G} = \widehat{F \circ G}\\)? 4. Is \\(\check{F} \check{G} = \overline{F \circ G}\\)? I think the answer to those two questions is *yes* but I don't quite know...`

Okay, I have thought about this a little and here's what I've come up with:

Lemma. For two functors \(G: \mathcal{X} \to \mathcal{Y}\) and \(F: \mathcal{Y} \to \mathcal{Z}\), if \(F \dashv H\) then \(\hat{F} \hat{G} = \widehat{F \circ G}\)Proof. First, expanding \(\hat{F} \hat{G}\) gives us$$ \hat{F} \hat{G}(x,z) = \bigvee_{y} \mathcal{Y}(G(x),y) \otimes \mathcal{Z}(F(y),z) $$ However, since \(F \dashv H\) then \(\mathcal{Z}(F(y),z) = \mathcal{Y}(y,H(z))\). Since \(\mathcal{Y}\) is a \(\mathcal{V}\)-enriched category we have \(\mathcal{Y}(G(x),y) \otimes \mathcal{Y}(y,H(z)) \leq \mathcal{Y}(G(x),H(z)) \) for all \(y\). Hence:

$$ \bigvee_{y} \mathcal{Y}(G(x),y) \otimes \mathcal{Z}(F(y),z) \leq \mathcal{Y}(G(x),H(z)). $$ Moreover, we know that since \(I \leq \mathcal{Y}(H(z),H(z))\) then \(\mathcal{Y}(G(x),H(z)) \leq \mathcal{Y}(G(x),H(z)) \otimes \mathcal{Y}(H(z),H(z))\), hence

$$ \mathcal{Y}(G(x),H(z)) \leq \bigvee_{y}\mathcal{Y}(G(x),y) \otimes \mathcal{Y}(y,H(z))$$ Thus

$$\bigvee_{y}\mathcal{Y}(G(x),y) \otimes \mathcal{Y}(y,H(z)) = \mathcal{Y}(G(x),H(z))$$ Since \(F \dashv H\), then \(\mathcal{Y}(G(x),H(z)) = \mathcal{Y}(F(G(x)),z) = \widehat{F \circ G}(x,z)\). Hence

$$\bigvee_{y}\mathcal{Y}(G(x),y) \otimes \mathcal{Y}(y,H(z)) = \widehat{F \circ G}(x,z)$$ Which suffices to prove \(\hat{F} \hat{G} = \widehat{F \circ G}. \quad\quad \blacksquare\)

I can't make this lemma lemma work for conjoints.

I don't think there is a companion that answers

Puzzle 206, so the lemma helps forPuzzle 207... :(`> Moreover, thinking about Puzzle 207, I have been wondering: > > 3. Is \\(\hat{F} \hat{G} = \widehat{F \circ G}\\)? > 4. Is \\(\check{F} \check{G} = \overline{F \circ G}\\)? Okay, I have thought about this a little and here's what I've come up with: **Lemma**. For two functors \\(G: \mathcal{X} \to \mathcal{Y}\\) and \\(F: \mathcal{Y} \to \mathcal{Z}\\), if \\(F \dashv H\\) then \\(\hat{F} \hat{G} = \widehat{F \circ G}\\) **Proof**. First, expanding \\(\hat{F} \hat{G}\\) gives us \[ \hat{F} \hat{G}(x,z) = \bigvee_{y} \mathcal{Y}(G(x),y) \otimes \mathcal{Z}(F(y),z) \] However, since \\(F \dashv H\\) then \\(\mathcal{Z}(F(y),z) = \mathcal{Y}(y,H(z))\\). Since \\(\mathcal{Y}\\) is a \\(\mathcal{V}\\)-enriched category we have \\(\mathcal{Y}(G(x),y) \otimes \mathcal{Y}(y,H(z)) \leq \mathcal{Y}(G(x),H(z)) \\) for all \\(y\\). Hence: \[ \bigvee_{y} \mathcal{Y}(G(x),y) \otimes \mathcal{Z}(F(y),z) \leq \mathcal{Y}(G(x),H(z)). \] Moreover, we know that since \\(I \leq \mathcal{Y}(H(z),H(z))\\) then \\(\mathcal{Y}(G(x),H(z)) \leq \mathcal{Y}(G(x),H(z)) \otimes \mathcal{Y}(H(z),H(z))\\), hence \[ \mathcal{Y}(G(x),H(z)) \leq \bigvee_{y}\mathcal{Y}(G(x),y) \otimes \mathcal{Y}(y,H(z))\] Thus \[\bigvee_{y}\mathcal{Y}(G(x),y) \otimes \mathcal{Y}(y,H(z)) = \mathcal{Y}(G(x),H(z))\] Since \\(F \dashv H\\), then \\(\mathcal{Y}(G(x),H(z)) = \mathcal{Y}(F(G(x)),z) = \widehat{F \circ G}(x,z)\\). Hence \[\bigvee_{y}\mathcal{Y}(G(x),y) \otimes \mathcal{Y}(y,H(z)) = \widehat{F \circ G}(x,z)\] Which suffices to prove \\(\hat{F} \hat{G} = \widehat{F \circ G}. \quad\quad \blacksquare\\) I can't make this lemma lemma work for conjoints. I don't think there is a companion that answers **Puzzle 206**, so the lemma helps for **Puzzle 207**... :(`

I think the first one of those is certainly true @Matthew:

\((\hat{F} \otimes \hat{G})((x, x'), (y, y'))\)

\(= \hat{F}(x, y) \otimes \hat{G}(x', y')\)

\(= Y(Fx, y) \otimes Y'(Gx', y')\)

\(= (Y \times Y')((Fx, Gx'), (y, y'))\)

\(= (Y \times Y')((F \times G)(x, x'), (y, y'))\)

\(= (\widehat{F \times G})((x, x'), (y, y'))\)

`> This sort of leads me to wonder if we can generalize the above as a special case of two more general rules: > 1. Is \\(\hat{F} \otimes \hat{G} = \widehat{F \times G}\\)? > 2. Is \\(\check{F} \otimes \check{G} = \overline{F \times G}\\)? > Moreover, thinking about Puzzle 207, I have been wondering: > 3. Is \\(\hat{F} \hat{G} = \widehat{F \circ G}\\)? > 4. Is \\(\check{F} \check{G} = \overline{F \circ G}\\)? >I think the answer to those two questions is *yes* but I don't quite know... I think the first one of those is certainly true @Matthew: \\((\hat{F} \otimes \hat{G})((x, x'), (y, y'))\\) \\(= \hat{F}(x, y) \otimes \hat{G}(x', y')\\) \\(= Y(Fx, y) \otimes Y'(Gx', y')\\) \\(= (Y \times Y')((Fx, Gx'), (y, y'))\\) \\(= (Y \times Y')((F \times G)(x, x'), (y, y'))\\) \\(= (\widehat{F \times G})((x, x'), (y, y'))\\)`

Looks like the third one is true as well

\((\hat{F} \circ \hat{G})(x, z)\)

\(= \bigvee\big(\hat{G}(x, y) \otimes \hat{F}(y, z)\big)\)

\(= \bigvee\big(Y(Gx, y) \otimes Z(Fy, z)\big)\)

And it turns out this join \(= Z(FGx, z) = \widehat{FG}(x, z)\)

To prove this, first set \(y = Gx\) to see that our join

\(\geq Y(Gx, Gx) \otimes Z(FGx, z) \geq I \otimes Z(FGx, z) = Z(FGx, z)\)

But given any \(y\) we have

\(Z(FGx, z) \geq Z(FGx, Fy) \otimes Z(Fy, z) \geq Y(Gx, y) \otimes Z(Fy, z)\)

So we also have \(Z(FGx, z) \geq\) our join. QED

`Looks like the third one is true as well \\((\hat{F} \circ \hat{G})(x, z)\\) \\(= \bigvee\big(\hat{G}(x, y) \otimes \hat{F}(y, z)\big)\\) \\(= \bigvee\big(Y(Gx, y) \otimes Z(Fy, z)\big)\\) And it turns out this join \\(= Z(FGx, z) = \widehat{FG}(x, z)\\) To prove this, first set \\(y = Gx\\) to see that our join \\(\geq Y(Gx, Gx) \otimes Z(FGx, z) \geq I \otimes Z(FGx, z) = Z(FGx, z)\\) But given any \\(y\\) we have \\(Z(FGx, z) \geq Z(FGx, Fy) \otimes Z(Fy, z) \geq Y(Gx, y) \otimes Z(Fy, z)\\) So we also have \\(Z(FGx, z) \geq\\) our join. QED`

Hey Anindya,

Great! I could only figure \(\hat{F} \hat{G} = \widehat{F \circ G}\) using an adjunction, but you strengthened it!

I think all of the results involving conjoints are basically the same arguments but flipped.

`Hey Anindya, Great! I could only figure \\(\hat{F} \hat{G} = \widehat{F \circ G}\\) using an adjunction, but you strengthened it! I think all of the results involving conjoints are basically the same arguments but flipped.`

Yeah, I'm thinking that any profunctor \(X \nrightarrow Y\) can be flipped to give a profunctor \(Y^\text{op} \nrightarrow X^\text{op}\), because \(X^\text{op} \times Y \cong (Y^\text{op})^\text{op} \times (X^\text{op})\)... so, um, something something duality... (bit too tired to think this through right now!)

`Yeah, I'm thinking that any profunctor \\(X \nrightarrow Y\\) can be flipped to give a profunctor \\(Y^\text{op} \nrightarrow X^\text{op}\\), because \\(X^\text{op} \times Y \cong (Y^\text{op})^\text{op} \times (X^\text{op})\\)... so, um, something something duality... (bit too tired to think this through right now!)`

Matthew

Thanks for doing this. Guidance like this is really helpful as a newb. Really appreciate it.

I think the conjoint is pretty obvious from the feasibility relation. First set \(G(y) =3x\):

$$ \text{y loaves feeds G(y) children} $$ Then \(\check{G}(x,y) = \text{true iff } x \le G(y) \).

Feasibily relation is saying "If we have y loaves, we can feed at most G(y) children."

I think I see why this whole business is confusing. I can give a companion solution using a different G(y) but I do not see how we can make a companion using the function described above nor can I prove it. I can plug it in using definitions and can see it is impossible to give a viable companion solution tho. Using a different G(y) or to make notation more applicable, using a new function F(x), we can do the following:

First set \(F(x) = \left\lceil x/3 \right\rceil\):

$$\text{x children need F(x) loaves of bread} $$ Then \(\hat{F}(x,y) = \text{true iff } F(x) \le y \):

$$ \Psi(x, y) = \begin{cases} \texttt{true} & \mbox{if } (0 \leq x \mbox{ and } 0 \leq y) \mbox{ or } (3 \leq x \mbox{ and } 1 \leq y) \mbox{ or } (6 \leq x \mbox{ and } 2 \leq y ) \\ \texttt{false} & \mbox{otherwise.} \end{cases} $$ In this case, feasibility relation is saying "if we have at least x children, we need at least F(x) loaves of bread."

Since F(x) and G(y) are adjoints, shouldn't \(\hat{F}(x,y) = \check{G}(x,y)\)?

`Matthew > >**Puzzle 206.** Suppose you are trying to feed hungry children with the loaves of bread you bought in the previous puzzle, and you can feed at most three children with each loaf of bread. Describe this using a feasibility relation \\(\Phi : \mathbb{N} \nrightarrow \lbrace 0,1,2\rbrace \\). Here \\(\mathbb{N}\\) is the set of natural numbers \\( \lbrace 0,1,2,3,\dots \rbrace \\) with its usual ordering. > > \[ \Psi(x, y) = \begin{cases} \texttt{true} & \mbox{if } (x \leq 0 \mbox{ and } y = 0) \mbox{ or } (x \leq 3 \mbox{ and } y = 1) \mbox{ or } (x \leq 6 \mbox{ and } y = 2) \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] > I can see a conjoint that gives rise to your answer. Thanks for doing this. Guidance like this is really helpful as a newb. Really appreciate it. I think the conjoint is pretty obvious from the feasibility relation. First set \\(G(y) =3x\\): \[ \text{y loaves feeds G(y) children} \] Then \\(\check{G}(x,y) = \text{true iff } x \le G(y) \\). Feasibily relation is saying "If we have y loaves, we can feed at most G(y) children." > The companion, if it exists at all, is less intuitive. If it doesn't exist do you see how we'd go about proving it doesn't? I think I see why this whole business is confusing. I can give a companion solution using a different G(y) but I do not see how we can make a companion using the function described above nor can I prove it. I can plug it in using definitions and can see it is impossible to give a viable companion solution tho. Using a different G(y) or to make notation more applicable, using a new function F(x), we can do the following: First set \\(F(x) = \left\lceil x/3 \right\rceil\\): \[\text{x children need F(x) loaves of bread} \] Then \\(\hat{F}(x,y) = \text{true iff } F(x) \le y \\): \[ \Psi(x, y) = \begin{cases} \texttt{true} & \mbox{if } (0 \leq x \mbox{ and } 0 \leq y) \mbox{ or } (3 \leq x \mbox{ and } 1 \leq y) \mbox{ or } (6 \leq x \mbox{ and } 2 \leq y ) \\\\ \texttt{false} & \mbox{otherwise.} \end{cases} \] In this case, feasibility relation is saying "if we have at least x children, we need at least F(x) loaves of bread." Since F(x) and G(y) are adjoints, shouldn't \\(\hat{F}(x,y) = \check{G}(x,y)\\)?`

Michael wrote:

Yes! This is exactly what I got :)

Believe me, this is really confusing for me too!

The conjoint \(G\) you gave works, as well as the feasibility relation \(\Phi\). In this case, there is no companion \(F\).

Let's see the issue. For starters, the \(F\) you gave here is not a function. It needs to map every value in \(\mathbb{N}\) to the range \(\lbrace 0,1,2 \rbrace\).

Now suppose that we tried to

repair\(F\) to be a function somehow. It turns out it's impossible to fix.We know that since 2 is the max in \(\lbrace 0,1,2\rbrace\), then \(F(7) \leq 2\).

But if \(\hat{F} = \check{G}\), then we know that \(F \dashv G\) hence \(7 \leq G(2)\). But that says \(7 \leq 6\), which is impossible!

This argument I just gave to prove there is no companion used two things: \(\hat{F} = \check{G} \iff F \dashv G\) and the Adjoint functor theorem for posets. I did not explicitly invoke the adjoint functor theorem, however, just thought about it.

If you want, you can try to see how to use the adjoint functor theorem directly.

The adjoint functor theorem says that the \(G\) you gave, if it is a right adjoint, must preserve all arbitrary meets. Can you see a meet it doesn't preserve?

`Michael wrote: > Thanks for doing this. Guidance like this is really helpful as a newb. Really appreciate it. > > I think the conjoint is pretty obvious from the feasibility relation. > First set \\(G(y) =3y\\) Yes! This is exactly what I got :) > > The companion, if it exists at all, is less intuitive. If it doesn't exist do you see how we'd go about proving it doesn't? > > I think I see why this whole business is confusing. I can give a companion solution using a different G(y) but I do not see how we can make a companion using the function described above nor can I prove it. I can plug it in using definitions and can see it is impossible to give a viable companion solution tho. Using a different G(y) or to make notation more applicable, using a new function F(x), we can do the following: > > First set \\(F(x) = \left\lceil x/3 \right\rceil\\) Believe me, this is really confusing for me too! The conjoint \\(G\\) you gave works, as well as the feasibility relation \\(\Phi\\). In this case, there is no companion \\(F\\). Let's see the issue. For starters, the \\(F\\) you gave here is not a function. It needs to map every value in \\(\mathbb{N}\\) to the range \\(\lbrace 0,1,2 \rbrace\\). Now suppose that we tried to *repair* \\(F\\) to be a function somehow. It turns out it's impossible to fix. We know that since 2 is the max in \\(\lbrace 0,1,2\rbrace\\), then \\(F(7) \leq 2\\). But if \\(\hat{F} = \check{G}\\), then we know that \\(F \dashv G\\) hence \\(7 \leq G(2)\\). But that says \\(7 \leq 6\\), which is impossible! This argument I just gave to prove there is no companion used two things: \\(\hat{F} = \check{G} \iff F \dashv G\\) and the [Adjoint functor theorem for posets](https://forum.azimuthproject.org/discussion/2031/lecture-16-chapter-1-the-adjoint-functor-theorem-for-posets/p1). I did not explicitly invoke the adjoint functor theorem, however, just thought about it. If you want, you can try to see how to use the adjoint functor theorem directly. The adjoint functor theorem says that the \\(G\\) you gave, if it is a right adjoint, must preserve all arbitrary meets. Can you see a meet it doesn't preserve?`

John wrote:

Okay, I cheated a little and I looked this up in Steve Awodey's lecture notes.

If \(X\) and \(Y\) are posets, then let \(Y^X\) be the set \(\lbrace F: X \to Y \mid F \text{ is monotone}\rbrace\). If \(f,g \in Y^X\) then \(f \leq_{Y^X} g\) if and only if \(f(x) \leq_Y g(x)\) for all \(x \in X\).

We want to show \(\mathrm{Hom}(X\times Y,Z) \cong \mathrm{Hom}(X,Z^Y)\). This can be done by defining

We also need to show these definititions are well defined, and demonstrate \(\mathtt{curry} \circ \mathtt{uncurry} = id\) and \(\mathtt{uncurry} \circ \mathtt{curry} = id\).

Here are the definitions:

$$ \begin{align} \mathtt{curry}(f) & := x \mapsto (y \mapsto f (x,y))\\ \mathtt{uncurry}(g) & := (x,y) \mapsto (g(x))(y) \end{align} $$ Let's check that if \(f : X \times Y \to Z\) is a monotonic function then \(\mathtt{curry}(f) : X \to Z^Y\) is monotonic.

First, let \(x \leq x'\). We need to show \(\mathtt{curry}(f)(x) \leq \mathtt{curry}(f)(x')\). But this means we need to show \(\mathtt{curry}(f)(x)(y) \leq \mathtt{curry}(f)(x')(y)\) for all \(y\). By evaluating these functions we can see we want to show \( f(x,y) \leq f(x',y)\) for all \(y\). Since \(x \leq x'\) we know that \((x,y) \leq (x',y)\) by definition of the product order, and \(f(x,y) \leq f(x',y)\) since \(f\) is mono.

Next, we'll want to check if \(g : X \to Z^Y\) is a monotonic function then \(\mathtt{uncurry}(g) : X \times Y \to Z\) is monotonic. Let \((x,y) \leq (x',y')\). We need to show \(\mathtt{uncurry}(g)(x,y) \leq \mathtt{uncurry}(g)(x',y')\). This amounts to showing if \(x \leq x'\) and \(y \leq y'\) then \((g(x))(y) \leq (g'(x'))(y')\). We know that \(g(x') \in Z^Y\), are monotonic by definition, hence \((g(x'))(y) \leq (g(x'))(y')\). We also know that \(g\) is monotonic, hence \(g(x) \leq g(x')\), and thus \(g(x)(y) \leq g(x')(y)\). By transitivity we have \((g(x))(y) \leq (g(x'))(y')\).

We can be confident then that \(\mathtt{curry}\) and \(\mathtt{uncurry}\) are well defined.

Next, let's check that they are inverses. Evaluating the functions defined gives:

$$ \begin{align} (((\mathtt{curry} \circ \mathtt{uncurry})(g))(x))(y) & = ((\mathtt{curry} (\mathtt{uncurry}(g)))(x))(y) \\ & = (\mathtt{uncurry}(g))(x,y) \\ & = (g(x))(y) \end{align} $$ However, \(((id(g))(x))(y) = (g(x))(y)\), so by

extensionalitywe have \((\mathtt{curry} \circ \mathtt{uncurry}) = id\). Extensionality is the principle that says that if two sets have the same elements, then they are equivalent. In Higher Order Logic and the λ-calculus, it holds that if two functions are the same on all inputs then they are the same.Considering the other direction, we have:

$$ \begin{align} ((\mathtt{uncurry} \circ \mathtt{curry})(g))(x,y) & = ((\mathtt{curry}(g))(x))(y) \\ & = g(x,y) \end{align} $$ Hence, we have the isomorphism we desire.

We can note that the category of Posets and the category of Preorders have a terminal object: the poset with 1 element. So the categories are in fact Cartesian Closed Categories.

They also have coproducts (I can talk about this a little if someone wants). I do not know if they have an initial object, however. So I can't say if the categories of Posets and Preorders are Bicartesian closed...

`John wrote: > **Puzzle.** Suppose \\(X\\) and \\(Y\\) are preorders. Can we reinterpret a feasibility relation, namely a monotone function > > \[ \Phi : X^{\text{op}} \times Y \to \textbf{Bool} , \] > > as a monotone function > > \[ \hat{\Phi} : X^{\text{op}} \to \textbf{Bool}^{\textbf{X}} \] > > or perhaps slightly better > > \[ \tilde{\Phi} : Y \to \textbf{Bool}^{\textbf{X}^{\text{op}}} ? \] > > The first problem here is figuring out what's an exponential of preorders! Okay, I cheated a little and I looked this up in [Steve Awodey's lecture notes](https://www.andrew.cmu.edu/course/80-413-713/notes/chap06.pdf). If \\(X\\) and \\(Y\\) are posets, then let \\(Y^X\\) be the set \\(\lbrace F: X \to Y \mid F \text{ is monotone}\rbrace\\). If \\(f,g \in Y^X\\) then \\(f \leq\_{Y^X} g\\) if and only if \\(f(x) \leq\_Y g(x)\\) for all \\(x \in X\\). We want to show \\(\mathrm{Hom}(X\times Y,Z) \cong \mathrm{Hom}(X,Z^Y)\\). This can be done by defining - \\(\mathtt{curry} : \mathrm{Hom}(X\times Y,Z) \to \mathrm{Hom}(X,Z^Y)\\) and - \\(\mathtt{uncurry} : \mathrm{Hom}(X,Z^Y) \to \mathrm{Hom}(X\times Y,Z)\\) We also need to show these definititions are well defined, and demonstrate \\(\mathtt{curry} \circ \mathtt{uncurry} = id\\) and \\(\mathtt{uncurry} \circ \mathtt{curry} = id\\). Here are the definitions: \[ \begin{align} \mathtt{curry}(f) & := x \mapsto (y \mapsto f (x,y))\\\\ \mathtt{uncurry}(g) & := (x,y) \mapsto (g(x))(y) \end{align} \] Let's check that if \\(f : X \times Y \to Z\\) is a monotonic function then \\(\mathtt{curry}(f) : X \to Z^Y\\) is monotonic. First, let \\(x \leq x'\\). We need to show \\(\mathtt{curry}(f)(x) \leq \mathtt{curry}(f)(x')\\). But this means we need to show \\(\mathtt{curry}(f)(x)(y) \leq \mathtt{curry}(f)(x')(y)\\) for all \\(y\\). By evaluating these functions we can see we want to show \\( f(x,y) \leq f(x',y)\\) for all \\(y\\). Since \\(x \leq x'\\) we know that \\((x,y) \leq (x',y)\\) by definition of the product order, and \\(f(x,y) \leq f(x',y)\\) since \\(f\\) is mono. Next, we'll want to check if \\(g : X \to Z^Y\\) is a monotonic function then \\(\mathtt{uncurry}(g) : X \times Y \to Z\\) is monotonic. Let \\((x,y) \leq (x',y')\\). We need to show \\(\mathtt{uncurry}(g)(x,y) \leq \mathtt{uncurry}(g)(x',y')\\). This amounts to showing if \\(x \leq x'\\) and \\(y \leq y'\\) then \\((g(x))(y) \leq (g'(x'))(y')\\). We know that \\(g(x') \in Z^Y\\), are monotonic by definition, hence \\((g(x'))(y) \leq (g(x'))(y')\\). We also know that \\(g\\) is monotonic, hence \\(g(x) \leq g(x')\\), and thus \\(g(x)(y) \leq g(x')(y)\\). By transitivity we have \\((g(x))(y) \leq (g(x'))(y')\\). We can be confident then that \\(\mathtt{curry}\\) and \\(\mathtt{uncurry}\\) are well defined. Next, let's check that they are inverses. Evaluating the functions defined gives: \[ \begin{align} (((\mathtt{curry} \circ \mathtt{uncurry})(g))(x))(y) & = ((\mathtt{curry} (\mathtt{uncurry}(g)))(x))(y) \\\\ & = (\mathtt{uncurry}(g))(x,y) \\\\ & = (g(x))(y) \end{align} \] However, \\(((id(g))(x))(y) = (g(x))(y)\\), so by [*extensionality*](https://en.wikipedia.org/wiki/Axiom_of_extensionality) we have \\((\mathtt{curry} \circ \mathtt{uncurry}) = id\\). Extensionality is the principle that says that if two sets have the same elements, then they are equivalent. In Higher Order Logic and the [λ-calculus](https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B7-conversion), it holds that if two functions are the same on all inputs then they are the same. Considering the other direction, we have: \[ \begin{align} ((\mathtt{uncurry} \circ \mathtt{curry})(g))(x,y) & = ((\mathtt{curry}(g))(x))(y) \\\\ & = g(x,y) \end{align} \] Hence, we have the isomorphism we desire. We can note that the category of Posets and the category of Preorders have a terminal object: the poset with 1 element. So the categories are in fact [Cartesian Closed Categories](https://en.wikipedia.org/wiki/Cartesian_closed_category). They also have coproducts (I can talk about this a little if someone wants). I do not know if they have an initial object, however. So I can't say if the categories of Posets and Preorders are [Bicartesian closed](https://en.wikipedia.org/wiki/Cartesian_closed_category#Equational_theory)...`