Skip to content

Commit f88267b

Browse files
committed
FIX: fix .gitignore
1 parent b7f41f0 commit f88267b

File tree

4 files changed

+79
-125
lines changed

4 files changed

+79
-125
lines changed

rfc/.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
# RFCs
12
_site
23
_svgs
3-
4+
.gitignore
5+
.svg-cache
46
/.quarto/
5-
**/*.quarto_ipynb
6-
7-
.auctex-auto

rfc/0003.md

Lines changed: 72 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: |
3-
`0003` Splitting logics into builder syntax and interpretation
3+
`0003` Splitting logics into builder declaration and interpretation
44
author: Tim Hosgood
55
date: 2026-03-27
66
bibliography: _references.bib
@@ -19,9 +19,20 @@ It seems possible that a better separation of these aspects would make the creat
1919
Here I will sketch out why viewing logics as functors from instances of a schema to models of a theory could be a good idea, and what an implementation might look like.
2020
Much of this comes from conversation with Jason Brown and Evan Patterson.
2121

22-
The motto that I might try to summarise this with is something like
22+
The motto that I might try to summarise this with is something like the following:
2323

24-
> The core should know about mathematical abstractions such as double theories, and the front-end must therefore have some understanding of this. But, *as much as possible*, the front-end should be a builder for *instances of schemas* with the extra knowledge of how these instances are to be interpreted in the core.
24+
::: {.callout-note}
25+
### Summary
26+
27+
The core should know about mathematical abstractions such as double theories, and the front-end must therefore have some understanding of this. But, *as much as possible*, the front-end should be a builder for *instances of schemas* with the extra knowledge of how these instances are to be interpreted in the core.
28+
:::
29+
30+
This RFC touches on *two* suggestions:
31+
32+
1. Rethinking the front-end editor as an editor for **builder declarations** (@sec-builder-declarations)
33+
2. Allowing a single front-end logic to have multiple **interpretations** (@sec-interpretations).
34+
35+
It is reasonable that each of these suggestions merit their own RFC with more detail; this current document exists more to give context to those future conversations.
2536

2637

2738

@@ -37,7 +48,7 @@ In short, there are many double theories in which we might wish to *interpret* s
3748
This suggests that we could separate out the actual data structure that is being built in a notebook from the way in which it is being computed with by the analyses.
3849
That is, we could define the logic of stock-flow diagrams to consist of
3950

40-
1. a *single* front-end **builder syntax**, namely the ability to create stocks, flows, and links; and
51+
1. a *single* front-end **builder declaration**, namely the ability to create stocks, flows, and links; and
4152
2. a *collection* of **interpretations** of models thus created in various double theories.
4253

4354

@@ -48,12 +59,58 @@ That is, we could define the logic of stock-flow diagrams to consist of
4859
*This should not, however, affect the reading of this RFC, whose purpose is to figure out whether or not this seems like a sensible path to follow in the first place.*
4960

5061
::: {#def-catcolab-logic}
51-
A **logic** $\mathtt{L}$ consists of
62+
A **(CatColab) logic** $\mathtt{L}$ consists of
5263

53-
1. a schema $\cat{B}$, called the **builder schema**; and
64+
1. a small (possibly necessarily finite) category $\cat{B}$, called the **builder declaration**; and
5465
2. a collection of (1-)functors $I_i\colon[\cat{B},\Set]\to[\dbl{T}_i,\SSet]$ for some double theories $\dbl{T}_i$, where each $I_i$ is called an **interpretation** (of $\mathtt{L}$) in $\dbl{T}_i$.
5566
:::
5667

68+
69+
### Builder declarations {#sec-builder-declarations}
70+
71+
It is reasonable to interpret the builder declaration $\cat{B}$ as a schema, used for building instances $\cat{B}\to\Set$.
72+
However, this is not quite the attitude that I intend.
73+
Rather, we should consider $\cat{B}$ as specifying a system of *dependent types*.
74+
75+
I am not a type theorist, at all, so I will give an example rather than use more words (and the words I do use will be softened by scare quotes).
76+
Consider the category
77+
$$
78+
\cat{B}
79+
= (E \rightrightarrows V)
80+
$$
81+
which we recognise as the schema for graphs, since to give a functor $G\colon\cat{B}\to\Set$ is precisely to give sets $G(E)$ and $G(V)$ along with source and target functions $s,t\colon G(E)\to G(V)$.
82+
One can think of constructing the object
83+
$$
84+
G(E) \rightrightarrows G(V)
85+
$$
86+
by gluing together basic blocks: we can posit the existence of some $e\in G(E)$ (a "walking edge") and this "automatically" implies the existence of two vertices, namely $s(e)$ and $t(e)$.
87+
We can then posit the existence of, say, $x,y\in G(V)$, and make the identifications $s(e)=x$ and $t(e)=y$.
88+
89+
Let's compare this to what happens in practice in e.g. CatColab, where a user is building a graph as a model of the theory of graphs.
90+
The initial state of a new notebook has $G(E)=G(V)=\varnothing$.
91+
The user can posit the existence of an edge $e\in G(E)$ by creating a morphism and naming it $e$.
92+
But this leaves the notebook in an incomplete ("non-compiling") state: the arrow $e$ needs to have a source and target set; CatColab does not freely create two objects for the source and target.
93+
94+
This difference in behaviour (or attitude) can be seen as an artefact of working with the 1-categorical schema $E\rightrightarrows V$ rather than the corresponding (under some correspondence that we briefly describe in @sec-interpretations) double-categorical "schema" $V\xproto{E}V$.
95+
96+
But we can also change the way that we read our 1-categorical schema.
97+
Using the fact that our $\cat{B}$ is a direct category, we can start from the locally initial elements (i.e. ones with no incoming morphisms) and assign a degree to each object in $\cat{B}$ such that $\deg(x)<\deg(y)\implies\Hom_\cat{B}(x,y)=\varnothing$ (and we can do this, to be imprecise, in a "best possible way", making each object have the minimal possible degree).
98+
In our running example of $\cat{B}=(E\rightrightarrows V)$ we can take $\deg(E)=0$ and $\deg(V)=1$.
99+
Then we can build up the data of *type dependencies* by running over objects of increasing degree: objects of degree $0$ correspond to types with no dependencies; objects of degree $1$ to types with dependencies on those of degree $0$; and so on.
100+
To return to our example of graphs, we see that we get two types: the non-dependent type $V\colon \mathcal{U}$, and the dependent type $E:V\times V\to\mathcal{U}$.
101+
This means that to declare a term of type $E$ we need to give two terms of type $V$ at the moment of declaration.
102+
103+
Rather than rambling on about type theory (since, again, I do not know about type theory), I will simply repeat the main point:
104+
105+
::: {.callout-note}
106+
### Summary
107+
108+
Builder declarations can be understood as describing a system of dependent types, and notebooks are precisely constructions of terms of these types.
109+
:::
110+
111+
112+
### Interpretations {#sec-interpretations}
113+
57114
There are different adjectives that we can use to describe interpretations, corresponding to factorisations.
58115
For example, the **co-continuous** interpretations are those that arise from functors $\cat{B}\to[\dbl{T}_i,\SSet]$.
59116
There is a more restrictive adjective that we might also be interested in, for which we will give a "definition" that makes sense whenever it makes sense, and doesn't when it doesn't.
@@ -90,6 +147,12 @@ I don't yet know how exactly to classify this hierarchy of adjectives, coming fr
90147

91148
but it seems like (a) this would be good to understand, as we do for e.g. duc-queries vs arbitrary queries, and (b) quite a few key examples seem to be at least ccf.
92149

150+
::: {.callout-note}
151+
### Summary
152+
153+
Rather than a front-end logic prioritising a *single* double theory in catlog, it could correspond to *multiple* double theories (and perhaps even other things besides).
154+
:::
155+
93156

94157

95158
## Examples {#sec-examples}
@@ -161,117 +224,6 @@ The logic $\mathtt{L}=(\cat{B},\{I_\text{tab},I_\text{sgn},I_\text{sym}\})$ of s
161224
(note that this is at least *co-continuous*, but I have no idea how $\spanr{-}$ behaves with respect to modalities, so am not too sure beyond this).
162225

163226

164-
### Pseudo-implementation example
165-
166-
Let's look at the current front-end definition of stock-flow diagrams.
167-
The main chunk of interest (with some lines omitted) is:
168-
169-
```{.typescript filename="primitive-stock-flow.ts"}
170-
theory: thCategoryLinks.theory(),
171-
modelTypes: [
172-
{
173-
tag: "ObType",
174-
obType: { tag: "Basic", content: "Object" },
175-
name: "Stock",
176-
description: "Thing with an amount",
177-
shortcut: ["S"],
178-
cssClasses: [styles.box],
179-
svgClasses: [svgStyles.box],
180-
},
181-
{
182-
tag: "MorType",
183-
morType: {
184-
tag: "Hom",
185-
content: { tag: "Basic", content: "Object" },
186-
},
187-
name: "Flow",
188-
description: "Flow from one stock to another",
189-
shortcut: ["F"],
190-
arrowStyle: "double",
191-
},
192-
{
193-
tag: "MorType",
194-
morType: { tag: "Basic", content: "Link" },
195-
name: "Link",
196-
description: "Influence of a stock on a flow",
197-
preferUnnamed: true,
198-
shortcut: ["L"],
199-
},
200-
],
201-
```
202-
203-
If we make a rough attempt at translating @sec-mathematical-example into code, then we might end up with something like the following:
204-
205-
```typescript
206-
builder: [
207-
{
208-
tag: "ObType",
209-
name: "Stock",
210-
description: "Thing with an amount",
211-
shortcut: ["S"],
212-
cssClasses: [styles.box],
213-
svgClasses: [svgStyles.box],
214-
},
215-
{
216-
tag: "MorType",
217-
name: "Flow",
218-
description: "Flow from one stock to another",
219-
shortcut: ["F"],
220-
arrowStyle: "double",
221-
},
222-
{
223-
tag: "MorType",
224-
name: "Link",
225-
description: "Influence of a stock on a flow",
226-
preferUnnamed: true,
227-
shortcut: ["L"],
228-
},
229-
]
230-
interpretations: [
231-
{
232-
name: "Category with links",
233-
theory: thCategoryLinks.theory(),
234-
mapping: [
235-
("Stock", { obType: { tag: "Basic", content: "Object" }}),
236-
("Flow", { morType: { tag: "Hom", content: { tag: "Basic", content: "Object" }}}),
237-
("Link", { morType: { tag: "Basic", content: "Link" }}),
238-
]
239-
},
240-
{
241-
name: "Flows as spans",
242-
theory: thSignedCategory.theory(),
243-
mapping: [
244-
("Stock", { obType: { tag: "Basic", content: "Object" }}),
245-
("Flow", ⚠️),
246-
("Link", ⚠️),
247-
]
248-
},
249-
{
250-
name: "Petri net",
251-
theory: thSymMonoidalCategory.theory(),
252-
mapping: [
253-
("Stock", { obType: { tag: "Basic", content: "Object" }}),
254-
("Flow", { morType: { tag: "Hom", content: { tag: "Basic", content: "Object" }}}),
255-
("Link", {
256-
morType: { tag: "Hom", content: { tag: "Basic", content: "Object" }},
257-
domain: {
258-
apply: { tag: "Basic", content: "tensor" },
259-
⚠️
260-
},
261-
codomain: { apply: { tag: "Basic", content: "Object" }},
262-
}),
263-
]
264-
},
265-
]
266-
```
267-
268-
::: {.callout-warning}
269-
Any interpretation that is not identity ccf poses a problem: how could (and how should) we express that an object in the schema is sent to an entire motif?
270-
:::
271-
272-
Note that there is still some strict rigidity enforced by this separation, since we declare upfront in `builder` that e.g. stocks are `ObType` and flows are `MorType``, which means that we cannot contradict this in any interpretation. I am not sure if this is actually a feature or a bug.
273-
274-
275227
#### Analyses
276228

277229
If a logic admits interpretations into multiple theories, then we need to consider what should happen with analyses.
@@ -303,13 +255,13 @@ We can specify a migration between logics in different ways, again in some order
303255

304256
We could take this idea and either considerably restrict its scope or lean into it even more.
305257
The former would look like still associating a single theory to each logic, but including information about non-trivial migrations within the logic definition itself.
306-
The latter would look like actually specifying the builder schema as a schema even more explicitly, building it up as a colimit of
258+
The latter would look like actually specifying the builder declaration as a schema even more explicitly, building it up as a colimit of
307259
$$
308260
\{ \mathsf{Object} \}
309261
\qquad\text{and}\qquad
310262
\{ \mathsf{Source}\from\mathsf{Arrow}\to\mathsf{Target} \}.
311263
$$
312-
For example, we might define the builder schema for stock-flow diagrams as
264+
For example, we might define the builder declaration for stock-flow diagrams as
313265

314266
```typescript
315267
interface Object {
@@ -345,4 +297,4 @@ Another option would be to actually allow for the interpretation functors to be
345297

346298
## Prior art
347299

348-
It seems possible that compositional notebooks can help with defining interpretation functors that send objects to motifs.
300+
It seems possible that compositional notebooks can help with defining interpretation functors that send objects to *motifs*.

rfc/_macros.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<!-- Arrows -->
2525
\newcommand{\xto}[1]{\xrightarrow{#1}}
2626
\newcommand{\from}{\leftarrow}
27-
\newcommand{\proto}{\mathrel{\mkern3mu\vcenter{\hbox{$\shortmid$}}\mkern-10mu{\to}}}
27+
\newcommand{\proto}{\nrightarrow}
2828
\newcommand{\xproto}[1]{\overset{#1}{\proto}}
2929
\newcommand{\proTo}{\mathrel{\mkern3mu\vcenter{\hbox{$\shortmid$}}\mkern-10mu{\Rightarrow}}}
3030

rfc/_quarto.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
project:
22
type: website
3+
preview:
4+
port: 3950
5+
browser: false
36

47
website:
58
title: "CatColab RFCs"

0 commit comments

Comments
 (0)