metapost for better rendering
This commit is contained in:
parent
0b244e6615
commit
556ac267fb
1 changed files with 141 additions and 89 deletions
|
@ -60,7 +60,7 @@ And will discuss about some categories.
|
||||||
> - For every pair of objects \\((A,B)\\) a set \\(\hom(A,B)\\)
|
> - For every pair of objects \\((A,B)\\) a set \\(\hom(A,B)\\)
|
||||||
> of _morphisms_ \\(f:A→B\\) (Another notation for \\(f\in \hom(A,B)\\))
|
> of _morphisms_ \\(f:A→B\\) (Another notation for \\(f\in \hom(A,B)\\))
|
||||||
> - A composition operator \\(∘\\)
|
> - A composition operator \\(∘\\)
|
||||||
> which associate to each couple \\(g:A→B\\), \\(f:B→C\\) another morphism \\(f∘g:A→C\\).
|
> which associate to each couple \\(f:A→B\\), \\(g:B→C\\) another morphism \\(g∘f:A→C\\).
|
||||||
>
|
>
|
||||||
> With the following properties
|
> With the following properties
|
||||||
>
|
>
|
||||||
|
@ -68,23 +68,45 @@ And will discuss about some categories.
|
||||||
> \\(id_x:x→x\\)
|
> \\(id_x:x→x\\)
|
||||||
> s.t. for any morphism \\(f:A->B\\),
|
> s.t. for any morphism \\(f:A->B\\),
|
||||||
> \\(id_A∘f = f = f∘id_B\\)
|
> \\(id_A∘f = f = f∘id_B\\)
|
||||||
> - for all triplet of morphisms \\(h:A->B\\), \\(g:B->C\\) and \\(f:C->D\\)
|
> - for all triplet of morphisms \\(f:A->B\\), \\(g:B->C\\) and \\(h:C->D\\)
|
||||||
> \\( (f∘g)∘h = f∘(g∘h) \\)
|
> \\( (h∘g)∘f = h∘(g∘f) \\)
|
||||||
|
<mpost title="Identity is left and right neutral element for ∘">
|
||||||
|
z0=origin;
|
||||||
|
z1=(2gu,0);
|
||||||
|
|
||||||
<graph title="Identity is left and right neutral element for ∘">
|
drawState(z0,btex $A$ etex);
|
||||||
A -> A [label="idA"]
|
drawState(z1,btex $B$ etex);
|
||||||
B -> B [label="idB"]
|
|
||||||
A -> B [label="f∘idA=f=idB∘f"]
|
|
||||||
</graph>
|
|
||||||
|
|
||||||
<graph title="Associativity">
|
drawLoop(z0,btex $id_A$ etex);
|
||||||
A -> B [label="f"]
|
drawLoop(z1,btex $id_B$ etex);
|
||||||
B -> C [label="g"]
|
|
||||||
C -> D [label="h"]
|
drawEdge(z0,z1,btex $f\circ id_A = f = id_B\circ f$ etex);
|
||||||
A -> C [label="g∘f",style="bold",fontcolor="cyan",color="cyan",constraint="false"]
|
</mpost>
|
||||||
B -> D [label="h∘g",style="bold",fontcolor="yellow",color="yellow",constraint="false"]
|
|
||||||
A -> D [label="(h∘g)∘f=h∘(g∘f)",style="bold",color="red",fontcolor="red",constraint="false"]
|
<mpost title="Associativity">
|
||||||
</graph>
|
z0=origin;
|
||||||
|
z1=(gu,0);
|
||||||
|
z2=(2gu,0);
|
||||||
|
z3=(3gu,0);
|
||||||
|
|
||||||
|
drawState(z0,btex $A$ etex);
|
||||||
|
drawState(z1,btex $B$ etex);
|
||||||
|
drawState(z2,btex $C$ etex);
|
||||||
|
drawState(z3,btex $D$ etex);
|
||||||
|
|
||||||
|
drawEdge(z0,z1,btex $f$ etex);
|
||||||
|
drawEdge(z1,z2,btex $g$ etex);
|
||||||
|
drawEdge(z2,z3,btex $h$ etex);
|
||||||
|
|
||||||
|
drawoptions(withcolor blue);
|
||||||
|
drawEdgeWithAngle(z0,z2,btex $g\circ f$ etex,30);
|
||||||
|
|
||||||
|
drawoptions(withcolor yellow);
|
||||||
|
drawEdgeWithAngle(z1,z3,btex $h\circ g$ etex,-30);
|
||||||
|
|
||||||
|
drawoptions(withcolor red);
|
||||||
|
drawEdgeWithAngle(z0,z3,btex $(h\circ g)\circ f = h\circ (g\circ f)$ etex,45);
|
||||||
|
</mpost>
|
||||||
|
|
||||||
### Representation of Category
|
### Representation of Category
|
||||||
|
|
||||||
|
@ -96,17 +118,24 @@ A naïve representation (which can work in many cases) is to represent
|
||||||
a specific category as a directed graph.
|
a specific category as a directed graph.
|
||||||
Here is a first example of the representation of a category:
|
Here is a first example of the representation of a category:
|
||||||
|
|
||||||
<graph title="First Naïve Category Representation">
|
<mpost title="First Naïve Category Representation">
|
||||||
|
z0=origin;
|
||||||
|
z1=2/3(gu,gu);
|
||||||
|
z2=(4/3gu,0);
|
||||||
|
|
||||||
A -> B [label="f"]
|
drawState(z0,btex $A$ etex);
|
||||||
B -> C [label="g"]
|
drawState(z1,btex $B$ etex);
|
||||||
A -> C [label="h"]
|
drawState(z2,btex $C$ etex);
|
||||||
|
|
||||||
A -> A [label="idA"]
|
drawEdge(z0,z1,btex $f$ etex);
|
||||||
B -> B [label="idB"]
|
drawEdge(z1,z2,btex $g$ etex);
|
||||||
C -> C [label="idC"]
|
drawEdge(z0,z2,btex $h$ etex);
|
||||||
|
|
||||||
</graph>
|
drawLoop(z0,btex $id_A$ etex);
|
||||||
|
drawLoop(z1,btex $id_B$ etex);
|
||||||
|
drawLoop(z2,btex $id_C$ etex);
|
||||||
|
|
||||||
|
</mpost>
|
||||||
|
|
||||||
From this graph we can conclude without any ambiguity that:
|
From this graph we can conclude without any ambiguity that:
|
||||||
|
|
||||||
|
@ -122,33 +151,35 @@ What is \\(∘\\)?
|
||||||
Now, we can add informations to our previous representation.
|
Now, we can add informations to our previous representation.
|
||||||
We simply add a relation between 3 arrows that represent the composition.
|
We simply add a relation between 3 arrows that represent the composition.
|
||||||
|
|
||||||
<graph title="Naïve Category Representation">
|
<mpost title="Naïve Category Representation">
|
||||||
|
z0=origin;
|
||||||
|
z1=(gu,gu);
|
||||||
|
z2=(2gu,0);
|
||||||
|
|
||||||
A[pos="0,0!"]
|
drawState(z0,btex $A$ etex);
|
||||||
B[pos="1.5,1.5!"]
|
drawState(z1,btex $B$ etex);
|
||||||
C[pos="3,0!"]
|
drawState(z2,btex $C$ etex);
|
||||||
|
|
||||||
f[pos="0.75,0.75!",label="", fixedsize="false", width=0,height=0,shape=none];
|
drawEdge(z0,z1,btex $f$ etex);
|
||||||
A -> f[label="f", arrowhead=None]
|
drawEdge(z1,z2,btex $g$ etex);
|
||||||
f -> B
|
drawEdge(z0,z2,btex $h$ etex);
|
||||||
|
|
||||||
g[pos="2.25,0.75!",label="", fixedsize="false", width=0,height=0,shape=none];
|
drawoptions( withcolor red );
|
||||||
B -> g[label="g", arrowhead=None]
|
|
||||||
g -> C
|
|
||||||
|
|
||||||
|
z3=.6[z0,z1];
|
||||||
|
z4=.6[z2,z1];
|
||||||
|
|
||||||
fg [pos="1.5,0.75!",label="", fixedsize="false", width=0,height=0,shape=none];
|
draw z3 -- z4 dashed evenly;
|
||||||
AC [pos="1.5,0!",label="", fixedsize="false", width=0,height=0,shape=none];
|
|
||||||
|
|
||||||
f -> fg [color="red",style=dashed,arrowhead=None]
|
z5 = .45[z3,z4];
|
||||||
fg -> g [color="red",style=dashed,arrowhead=None]
|
z6 = .55[z0,z2];
|
||||||
fg -> AC [label="h=g∘f",fontcolor="red",color="red",style=bold]
|
path bigarrow;
|
||||||
|
bigarrow := subpath (.1,.9) of z5 -- z6;
|
||||||
|
drawarrow bigarrow withpen pencircle scaled 1.5;
|
||||||
|
|
||||||
A -> AC [label="h",arrowhead=None]
|
label.rt(btex $h = g \circ f$ etex, .5[z5,z6]);
|
||||||
AC -> C
|
|
||||||
|
|
||||||
|
</mpost>
|
||||||
</graph>
|
|
||||||
|
|
||||||
Now we have a complete representation.
|
Now we have a complete representation.
|
||||||
We don't have to represent \\(idX\\), we know there are there.
|
We don't have to represent \\(idX\\), we know there are there.
|
||||||
|
@ -228,42 +259,49 @@ A -> C [label="h'\n=g'∘f\n=g∘f'"]
|
||||||
Which can be a valid category by choosing ∘ appropriately?
|
Which can be a valid category by choosing ∘ appropriately?
|
||||||
The identity morphisms are assumed.
|
The identity morphisms are assumed.
|
||||||
|
|
||||||
<graph title="Can be a valid category">
|
<mpost title="This can be a valid category">
|
||||||
A[label="★"]
|
z0=(0,0);
|
||||||
B[label="★"]
|
z1=2(u,0);
|
||||||
C[label="★"]
|
z2=2(2u,0);
|
||||||
A -> B
|
|
||||||
B -> C
|
|
||||||
A -> C [constraint=false]
|
|
||||||
</graph>
|
|
||||||
|
|
||||||
<graph title="Cannot be a category; no candidate for \(g∘f\).">
|
drawedge(z0,z1,"");
|
||||||
A[label="★"]
|
drawedge(z1,z2,"");
|
||||||
B[label="★"]
|
drawedgeangle(z0,z2,"",50);
|
||||||
C[label="★"]
|
|
||||||
A -> B[label="f"]
|
|
||||||
B -> C[label="g"]
|
|
||||||
</graph>
|
|
||||||
|
|
||||||
<graph title="Also a valid category">
|
drawstate(z0);
|
||||||
A[label="★",pos="0,50"]
|
drawstate(z1);
|
||||||
B[label="★",pos="50,50"]
|
drawstate(z2);
|
||||||
C[label="★",pos="25,0"]
|
</mpost>
|
||||||
A -> B
|
|
||||||
B -> A
|
|
||||||
B -> C
|
|
||||||
A -> C
|
|
||||||
</graph>
|
|
||||||
|
|
||||||
<graph title="Not a category; no \(A→C\) while there exists \(A→B\) and \(B→C\)">
|
<mpost title="Cannot be a category; no candidate for g∘f.">
|
||||||
A[pos="0,0"]
|
z0=(0,0); z1=3(u,0); z2=3(2u,0);
|
||||||
B[pos="2,0"]
|
drawstate(z0); drawstate(z1); drawstate(z2);
|
||||||
C[pos="1,-1"]
|
|
||||||
A -> B
|
drawedge(z0,z1,btex $f$ etex);
|
||||||
B -> C
|
drawedge(z1,z2,btex $g$ etex);
|
||||||
B -> A
|
</mpost>
|
||||||
C -> A
|
|
||||||
</graph>
|
<mpost title="Also a possible valid category">
|
||||||
|
z0=(0,0); z1=(4u,0); z2=(2u,-3u);
|
||||||
|
drawstate(z0); drawstate(z1); drawstate(z2);
|
||||||
|
|
||||||
|
drawedgeangle(z0,z1,"",35);
|
||||||
|
drawedgeangle(z1,z0,"",-145);
|
||||||
|
drawedge(z0,z2,"");
|
||||||
|
drawedge(z1,z2,"");
|
||||||
|
</mpost>
|
||||||
|
|
||||||
|
<mpost title="Not a category; no \(A→C\) while there exists \(A→B\) and \(B→C\)">
|
||||||
|
z0=(0,0); z1=(gu,0); z2=(.5gu,-.75gu);
|
||||||
|
drawState(z0,btex $A$ etex);
|
||||||
|
drawState(z1,btex $B$ etex);
|
||||||
|
drawState(z2,btex $C$ etex);
|
||||||
|
|
||||||
|
drawEdgeWithAngle(z0,z1,"",35);
|
||||||
|
drawEdgeWithAngle(z1,z0,"",-145);
|
||||||
|
drawEdge(z1,z2,"");
|
||||||
|
drawEdge(z2,z0,"");
|
||||||
|
</mpost>
|
||||||
|
|
||||||
<graph title="Cannot be a category ; no possible associative ∘<br/>\((h∘g)∘f=idB∘f=f≠h=h∘idA=h∘(g∘f)\)">
|
<graph title="Cannot be a category ; no possible associative ∘<br/>\((h∘g)∘f=idB∘f=f≠h=h∘idA=h∘(g∘f)\)">
|
||||||
A -> B[label="g"]
|
A -> B[label="g"]
|
||||||
|
@ -305,19 +343,33 @@ Typical examples:
|
||||||
- `Integer` with `(*)` and `1`
|
- `Integer` with `(*)` and `1`
|
||||||
- Generalized by `Monoid a` with `(<>)` and `mempty`
|
- Generalized by `Monoid a` with `(<>)` and `mempty`
|
||||||
|
|
||||||
<graph title="Strings are Categories">
|
<mpost title="Strings are Categories">
|
||||||
|
u:=.5cm;
|
||||||
|
def drawloop(expr a,b,l) =
|
||||||
|
pair ba,ea;
|
||||||
|
path circ,p,s;
|
||||||
|
p:=a{1,1}..b..{1,-1}cycle;
|
||||||
|
circ:= fullcircle scaled 6 shifted a;
|
||||||
|
ba = circ intersectionpoint (subpath (0,1) of p);
|
||||||
|
ea = circ intersectionpoint (subpath (1,2) of p);
|
||||||
|
s:= ba{1,1}..b..{1,-1}ea;
|
||||||
|
drawarrow s;
|
||||||
|
label.top(l,b);
|
||||||
|
enddef;
|
||||||
|
|
||||||
★ -> ★[label="e"]
|
pair A,B,C,D,E,F;
|
||||||
★ -> ★[label="x"]
|
A:=(0,0);
|
||||||
★ -> ★[label="y"]
|
B:=(0,u);
|
||||||
★ -> ★[label="..."]
|
C:=(0,2u);
|
||||||
|
D:=(0,3u);
|
||||||
|
E:=(0,4u);
|
||||||
|
F:=(0,6u);
|
||||||
|
|
||||||
</graph>
|
drawloop(A,B,btex $\varepsilon$ etex);
|
||||||
|
drawloop(A,C,btex $a$ etex);
|
||||||
metapost test
|
drawloop(A,D,btex $b$ etex);
|
||||||
|
drawloop(A,E,btex $ab$ etex);
|
||||||
<mpost title="metapost test">
|
drawloop(A,F,btex $\omega$ etex);
|
||||||
pair A, B, C;
|
draw (0,4.8u)--(0,5.8u) dashed withdots;
|
||||||
A:=(0,0); B:=(1cm,0); C:=(0,1cm);
|
draw A withpen pencircle scaled 4bp;
|
||||||
draw A--B--C;
|
|
||||||
</mpost>
|
</mpost>
|
||||||
|
|
Loading…
Reference in a new issue