Skip to content

Commit aed2ce7

Browse files
committed
use markdown to render foundations page
1 parent 6467eca commit aed2ce7

7 files changed

Lines changed: 130 additions & 26 deletions

File tree

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"diffeomorphisms",
9393
"dualizable",
9494
"Dualization",
95+
"endofunctors",
9596
"Engelking",
9697
"epimorphic",
9798
"epimorphism",
@@ -113,6 +114,10 @@
113114
"Haus",
114115
"Heyting",
115116
"homotopy",
117+
"hypercategories",
118+
"hypercategory",
119+
"hypercollection",
120+
"hypercollections",
116121
"infima",
117122
"infimum",
118123
"infinitary",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@sveltejs/kit": "^2.55.0",
2929
"@sveltejs/vite-plugin-svelte": "^7.0.0",
3030
"@types/katex": "^0.16.8",
31+
"@types/markdown-it": "^14.1.2",
3132
"@types/node": "^25.5.0",
3233
"chokidar": "^5.0.0",
3334
"dotenv": "^17.3.1",
@@ -53,6 +54,7 @@
5354
"ioredis": "^5.10.1",
5455
"katex": "^0.16.44",
5556
"leo-profanity": "^1.9.0",
57+
"markdown-it": "^14.1.1",
5658
"sql-template-tag": "^5.2.1",
5759
"svelte-chartjs": "^4.0.1",
5860
"svelte-fa": "^4.0.4"

pnpm-lock.yaml

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/content/foundations.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Foundations
2+
3+
In _CatDat_, we work with the following convenient set-theoretic foundation for category theory.
4+
5+
We work with ZFC and two Grothendieck universes $U \in U^+$. So in principle everything is a set, but we will rename them as follows to introduce three levels of size: the sets in $U$ are renamed to _sets_ (sometimes for clarity: _small sets_), the sets in $U^+$ are renamed to _collections_ (sometimes also called _large sets_), and all sets are renamed to _hypercollections_ (which may or may not lie in $U^+$).
6+
7+
For example, $\mathbb{R}$ is a set, $U$ is a collection, and $U^+$ is a hypercollection. The collection $U$ consists of all sets, and the hypercollection $U^+$ consists of all collections. Every set is also a collection, and every collection is also a hypercollection.
8+
9+
Note that sets, collections, and hypercollections all satisfy the ZFC axioms. In this sense, (hyper-)collections behave in the same way as sets. This is crucial for category theory. For example, we can form the collection of all maps between two collections. Just imagine three levels of ZFC on top of each other. Grothendieck universes are just an implementation detail, which we can _and will_ drop from now on. Sets are on level 1, collections on level 2, and hypercollections on level 3. You can imagine concrete mathematical objects like numbers or functions as being on level 0 (even though they are usually modeled as sets in ZFC).
10+
11+
A _category_ $\mathcal{C}$ is defined as a pair of collections $O,M$, whose elements are called _objects_ resp. _morphisms_, together with maps $i : O \to M$ (_identity_), $s : M \to O$ (_source_), $t : M \to O$ (_target_) as well as $c : M \times_O M \to M$ (_composition_), and the usual category axioms need to be satisfied. The domain of $c$ consists of all pairs of morphisms $(f,g)$ with $s(f)=t(g)$, and we always write $f \circ g := c(f,g)$ for their composition. Instead of $i(X)$ one usually writes $\mathrm{id}_X$ for the identity morphism of $X$.
12+
13+
When $X \in O$ is an object, it is common to write $X \in \mathcal{C}$. When $f \in M$ is a morphism and $s(f) = X$, $t(f) = Y$, we write $f : X \to Y$. We write $\mathrm{Hom}(X,Y)$ for the collection of such morphisms with source $X$ and target $Y$. It is not necessarily a set. If this collection is a set for all $X,Y$, the category is called _locally small_.
14+
15+
A _small category_ is defined as above, just by using _sets_ $O$ and $M$ (instead of collections). A _hypercategory_ is also defined in the same way, but by using _hypercollections_ $O$ and $M$ (instead of collections). Every small category is also a category, and every category is also a hypercategory.
16+
17+
Functors $\mathcal{C} \to \mathcal{C}'$ between all types of categories are defined as in every textbook on category theory; they are given by two maps $O \to O'$, $M \to M'$, etc. Between two categories there is a collection of all functors, in the same way that between two small categories there is a set of all functors.
18+
19+
The category of sets $\mathbf{Set}$ is defined by using the collection of all sets as objects (aka small sets). The category of groups $\mathbf{Grp}$ uses the collection of all groups (aka small groups). We can also construct the category $\mathbf{Cat}$ of small categories, etc. All these are locally small.
20+
21+
If $\mathcal{C}, \mathcal{D}$ are two categories, we can construct the functor category $[\mathcal{C}, \mathcal{D}]$ as usual (there is simply no set-theoretic issue since collections behave just like sets). If $\mathcal{C}$ is small and $\mathcal{D}$ is locally small, then $[\mathcal{C}, \mathcal{D}]$ is locally small. This extra assumption on $\mathcal{C}$ is one of many indicators why categories should not be assumed to be locally small by default. We could not even talk about the category of endofunctors of a general locally small category, so there would certainly be no category of monads. It is better to explicitly say when we need the assumption of being locally small.
22+
23+
The collections form a hypercategory $\mathbf{Set}^+$. Likewise, we have a hypercategory $\mathbf{Cat}^+$ consisting of all categories. For instance, $\mathbf{Set}$ is an object of $\mathbf{Cat}^+$, but not of $\mathbf{Cat}$. In our framework, we have no way to group all hypercollections (or even all hypercategories) into a single mathematical object; for this we would need a third Grothendieck universe, but usually this grouping is not required anyway.
24+
25+
If $\mathcal{C}$ is any category and $A \in \mathcal{C}$ is an object, we have the Hom-functor $\mathrm{Hom}(A,-) : \mathcal{C} \to \mathbf{Set}^+$ defined as usual, but notice that it takes values in the hypercategory of all collections. The Yoneda Lemma and all of its corollaries can be proven as usual without ever assuming that $\mathcal{C}$ is locally small. But if that happens to be the case, we get $\mathrm{Hom}(A,-) : \mathcal{C} \to \mathbf{Set}$, the target being a category.
26+
27+
We may define _adjunctions_ as usual: we require natural isomorphisms $\mathrm{Hom}(F(A),B) \cong \mathrm{Hom}(A,G(B))$ of functors valued in $\mathbf{Set}^+$. We do not need to assume the categories to be locally small.
28+
29+
If $A$ is an object, the collection of all monomorphisms $B \to A$ does not need to be a set. But if (for every choice of $A$) there is a set of such monomorphisms such that every monomorphism $B \to A$ is isomorphic over $A$ to one in the set, then the category is called _well-powered_. The dual notion of being _well-copowered_ is defined in the same way by using epimorphisms $A \to B$. Every small category is well-powered, but there are many well-powered categories that are not small.
30+
31+
There is a lot more to say about the set-theoretic foundations of category theory (in fact, many papers have been written on the subject, and the approach developed above is just _one_ of [many](https://xkcd.com/927/) approaches), but this should be sufficient for the purposes of _CatDat_.

src/lib/server/rendering.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import katex from 'katex'
22
import { is_object } from './utils'
3+
import MarkdownIt from 'markdown-it'
34

45
function render_formula(formula: string): string {
56
return katex.renderToString(formula, {
@@ -36,3 +37,18 @@ export function render_nested_formulas<T>(obj: T): T {
3637

3738
return obj
3839
}
40+
41+
const md = new MarkdownIt()
42+
43+
const content_dict = import.meta.glob('$lib/content/*.md', {
44+
query: '?raw',
45+
import: 'default',
46+
eager: true,
47+
}) as Record<string, string>
48+
49+
export function get_rendered_content(file: string) {
50+
const key = `/src/lib/content/${file}.md`
51+
const txt = content_dict[key]
52+
const html = md.render(txt)
53+
return render_formulas(html)
54+
}
Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
1-
import { render_nested_formulas } from '$lib/server/rendering'
1+
import { get_rendered_content } from '$lib/server/rendering'
22

3-
const foundations = [
4-
'In <i>CatDat</i>, we work with the following convenient set-theoretic foundation for category theory.',
5-
'We work with ZFC and two Grothendieck universes $U \\in U^+$. So in principle everything is a set, but we will rename them as follows to introduce three levels of size: the sets in $U$ are renamed to <i>sets</i> (sometimes for clarity: <i>small sets</i>), the sets in $U^+$ are renamed to <i>collections</i> (sometimes also called <i>large sets</i>), and all sets are renamed to <i>hypercollections</i> (which may or may not lie in $U^+$).',
6-
'For example, $\\mathbb{R}$ is a set, $U$ is a collection, and $U^+$ is a hypercollection. The collection $U$ consists of all sets, and the hypercollection $U^+$ consists of all collections. Every set is also a collection, and every collection is also a hypercollection.',
7-
'Note that sets, collections, and hypercollections all satisfy the ZFC axioms. In this sense, (hyper-)collections behave in the same way as sets. This is crucial for category theory. For example, we can form the collection of all maps between two collections. Just imagine three levels of ZFC on top of each other. Grothendieck universes are just an implementation detail, which we can <i>and will</i> drop from now on. Sets are on level 1, collections on level 2, and hypercollections on level 3. You can imagine concrete mathematical objects like numbers or functions as being on level 0 (even though they are usually modeled as sets in ZFC).',
8-
'A <i>category</i> $\\mathcal{C}$ is defined as a pair of collections $O,M$, whose elements are called <i>objects</i> resp. <i>morphisms</i>, together with maps $i : O \\to M$ (<i>identity</i>), $s : M \\to O$ (<i>source</i>), $t : M \\to O$ (<i>target</i>) as well as $c : M \\times_O M \\to M$ (<i>composition</i>), and the usual category axioms need to be satisfied. The domain of $c$ consists of all pairs of morphisms $(f,g)$ with $s(f)=t(g)$, and we always write $f \\circ g := c(f,g)$ for their composition. Instead of $i(X)$ one usually writes $\\mathrm{id}_X$ for the identity morphism of $X$.',
9-
'When $X \\in O$ is an object, it is common to write $X \\in \\mathcal{C}$. When $f \\in M$ is a morphism and $s(f) = X$, $t(f) = Y$, we write $f : X \\to Y$. We write $\\mathrm{Hom}(X,Y)$ for the collection of such morphisms with source $X$ and target $Y$. It is not necessarily a set. If this collection is a set for all $X,Y$, the category is called <i>locally small</i>.',
10-
'A <i>small category</i> is defined as above, just by using <i>sets</i> $O$ and $M$ (instead of collections). A <i>hypercategory</i> is also defined in the same way, but by using <i>hypercollections</i> $O$ and $M$ (instead of collections). Every small category is also a category, and every category is also a hypercategory.',
11-
"Functors $\\mathcal{C} \\to \\mathcal{C}'$ between all types of categories are defined as in every textbook on category theory; they are given by two maps $O \\to O'$, $M \\to M'$, etc. Between two categories there is a collection of all functors, in the same way that between two small categories there is a set of all functors.",
12-
'The category of sets $\\mathbf{Set}$ is defined by using the collection of all sets as objects (aka small sets). The category of groups $\\mathbf{Grp}$ uses the collection of all groups (aka small groups). We can also construct the category $\\mathbf{Cat}$ of small categories, etc. All these are locally small.',
13-
'If $\\mathcal{C}, \\mathcal{D}$ are two categories, we can construct the functor category $[\\mathcal{C}, \\mathcal{D}]$ as usual (there is simply no set-theoretic issue since collections behave just like sets). If $\\mathcal{C}$ is small and $\\mathcal{D}$ is locally small, then $[\\mathcal{C}, \\mathcal{D}]$ is locally small. This extra assumption on $\\mathcal{C}$ is one of many indicators why categories should not be assumed to be locally small by default. We could not even talk about the category of endofunctors of a general locally small category, so there would certainly be no category of monads. It is better to explicitly say when we need the assumption of being locally small.',
14-
'The collections form a hypercategory $\\mathbf{Set}^+$. Likewise, we have a hypercategory $\\mathbf{Cat}^+$ consisting of all categories. For instance, $\\mathbf{Set}$ is an object of $\\mathbf{Cat}^+$, but not of $\\mathbf{Cat}$. In our framework, we have no way to group all hypercollections (or even all hypercategories) into a single mathematical object; for this we would need a third Grothendieck universe, but usually this grouping is not required anyway.',
15-
'If $\\mathcal{C}$ is any category and $A \\in \\mathcal{C}$ is an object, we have the Hom-functor $\\mathrm{Hom}(A,-) : \\mathcal{C} \\to \\mathbf{Set}^+$ defined as usual, but notice that it takes values in the hypercategory of all collections. The Yoneda Lemma and all of its corollaries can be proven as usual without ever assuming that $\\mathcal{C}$ is locally small. But if that happens to be the case, we get $\\mathrm{Hom}(A,-) : \\mathcal{C} \\to \\mathbf{Set}$, the target being a category.',
16-
'We may define <i>adjunctions</i> as usual: we require natual isomorphisms $\\mathrm{Hom}(F(A),B) \\cong \\mathrm{Hom}(A,G(B))$ of functors valued in $\\mathbf{Set}^+$. We do not need to assume the categories to be locally small.',
17-
'If $A$ is an object, the collection of all monomorphisms $B \\to A$ does not need to be a set. But if (for every choice of $A$) there is a set of such monomorphisms such that every monomorphism $B \\to A$ is isomorphic over $A$ to one in the set, then the category is called <i>well-powered</i>. The dual notion of being <i>well-copowered</i> is defined in the same way by using epimorphisms $A \\to B$. Every small category is well-powered, but there are many well-powered categories that are not small.',
18-
'There is a lot more to say about the set-theoretic foundations of category theory (in fact, many papers have been written on the subject, and the approach developed above is just <i>one</i> of <a href="https://xkcd.com/927/" target="_blank">many</a> approaches), but this should be sufficient for the purposes of <i>CatDat</i>.',
19-
]
20-
21-
export const load = () => {
22-
return render_nested_formulas({ foundations })
3+
export const load = async () => {
4+
const content = get_rendered_content('foundations')
5+
return { content }
236
}

src/routes/foundations/+page.svelte

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,4 @@
88
description="How to make sense of categories in set theory"
99
/>
1010

11-
<h2>Foundations</h2>
12-
13-
{#each data.foundations as para}
14-
<p>{@html para}</p>
15-
{/each}
11+
{@html data.content}

0 commit comments

Comments
 (0)