% Common symbols for CMLL and EULL.

% The code for arrows is the one from the downward and upward arrows
% (characters '041 and '042 in cmsy, defined in sym.mf)
% with some coordinates moved.

cmchar "Short downward arrow (positive shift)";
beginchar(1,9u#,body_height#,0);
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,0); pos2(rule_thickness,0);
pos3(rule_thickness,90); pos4(rule_thickness,90);
lft x1l=hround(.5w-.5rule_thickness); y1+.5rule_thickness=h;
x0=x1=x2; bot y0=-d-o; x0-x3=x4-x0=if monospace:3u else:4u fi+eps;
y3=y4=y0+if monospace:.24 else:.36 fi asc_height+eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4r{z9-z4}..z6r;
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p;
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r)
 ---z1r..z1l---subpath (t,0) of\\(z3r{z9-z3}..z5r)
 --z3l{z9-z3}..z0 & cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

cmchar "Short upward arrow (negative shift)";
beginchar(2,9u#,body_height#,0);
italcorr .76asc_height#*slant+.5crisp#-u#;
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,0); pos2(rule_thickness,0);
pos3(rule_thickness,90); pos4(rule_thickness,90);
lft x1l=hround(.5w-.5rule_thickness); y1-.5rule_thickness=-d;
x0=x1=x2; top y0=h+o; x0-x3=x4-x0=if monospace:3u else:4u fi+eps;
y3=y4=y0-if monospace:.24 else:.36 fi asc_height-eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4l{z9-z4}..z6r;
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p;
filldraw z0..{z4-z9}z4r--subpath (0,t) of\\(z4l{z9-z4}..z6r)
 ---z1r..z1l---subpath (t,0) of\\(z3l{z9-z3}..z5r)
 --z3r{z9-z3}..z0 & cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

cmchar "Short up-and-down arrow";
beginchar(3,9u#,body_height#,0);
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,0); pos2(rule_thickness,0);
pos3(rule_thickness,90); pos4(rule_thickness,90);
lft x1l=hround(.5w-.5rule_thickness); y1=.5[-d,h];
x0=x1=x2; bot y0=-d-o; x0-x3=x4-x0=4u+eps;
y3=y4=y0+.36asc_height+eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4r{z9-z4}..z6r;
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p;
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r)
 ---z1r..z1l---subpath (t,0) of\\(z3r{z9-z3}..z5r)
 --z3l{z9-z3}..z0 & cycle;  % lower arrowhead and stem
pos11(rule_thickness,0); pos12(rule_thickness,0); z11=z1;
pos13(rule_thickness,90); pos14(rule_thickness,90);
x10=x11=x12; top y10=h+o; x10-x13=x14-x10=4u+eps;
y13=y14=y10-.36asc_height-eps;
pos15(rule_thickness,angle(z14-z10)); z15l=z10;
pos16(rule_thickness,angle(z13-z10)); z16l=z10;
z19=.2[.5[z13,z14],z10];
numeric t; path p; p=z14l{z19-z14}..z16r;
t=xpart(p intersectiontimes((x12r,-d)--(x12r,h))); y12=ypart point t of p;
filldraw z10..{z14-z19}z14r--subpath (0,t) of\\(z14l{z19-z14}..z16r)
 ---z11r..z11l---subpath (t,0) of\\(z13l{z19-z13}..z15r)
 --z13r{z19-z13}..z10 & cycle;  % upper arrowhead and stem
penlabels(0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,19); endchar;


% The code for coherence relations is based on the \asymp symbol (named
% "Hardy's asymptotic equivalence sign" number '020 in symbols.mf).

cmchar "Coherence sign";
compute_spread(.45x_height#,.55x_height#);
beginchar(4,14u#,v_center(2spread#+rule_thickness#));
adjust_fit(0,0); pickup rule.nib; autorounded;
lft x1=hround u-eps; x3=x1; x2=x4=w-x1; x5=x6=.5w;
y1=y2; y5=good.y h; y3=y4; .5[y1,y3]=.5[y5,y6]=math_axis;
y1=good.y .3[y5,y6];
draw z1{x5-x1,2(y5-y1)}...z5{right}...z2{x2-x5,2(y2-y5)};  % upper bar
draw z3{x6-x3,2(y6-y3)}...z6{right}...z4{x4-x6,2(y4-y6)};  % lower bar
labels(1,2,3,4,5,6); endchar;

cmchar "Strict coherence";
beginchar(5,14u#,asc_height#,desc_depth#);
adjust_fit(0,0); pickup rule.nib;
lft x1=hround u; y1=vround(math_axis-.25x_height);
x3=w-x1; y3=y1;
penpos2(rule_thickness,90); x2=.5w; y2=good.y(.25x_height+math_axis);
numeric theta; theta=angle((z2-z1)yscaled 3);
penpos1(rule_thickness,90+theta);
penpos3(rule_thickness,90-theta);
draw z1{dir theta}...z2...{dir-theta}z3; penlabels(1,2,3);
endchar;

cmchar "Incoherence sign";
compute_spread(.45x_height#,.55x_height#);
beginchar(6,14u#,v_center(2spread#+rule_thickness#));
adjust_fit(0,0); pickup rule.nib; autorounded;
lft x1=hround u-eps; x3=x1; x2=x4=w-x1; x5=x6=.5w;
y1=y2=good.y h; y3=y4; .5[y1,y3]=.5[y5,y6]=math_axis;
y5=good.y .3[y1,y3];
draw z1{x5-x1,2(y5-y1)}...z5{right}...z2{x2-x5,2(y2-y5)};  % upper bar
draw z3{x6-x3,2(y6-y3)}...z6{right}...z4{x4-x6,2(y4-y6)};  % lower bar
labels(1,2,3,4,5,6); endchar;

cmchar "Strict incoherence";
beginchar(7,14u#,asc_height#,desc_depth#);
adjust_fit(0,0); pickup rule.nib;
lft x1=hround u; y1=vround(math_axis+.25x_height);
x3=w-x1; y3=y1; penpos2(rule_thickness,90); x2=.5w;
y2l=good.y -(.25x_height-math_axis);
numeric theta; theta=angle((z2-z1)yscaled 3);
penpos1(rule_thickness,90+theta);
penpos3(rule_thickness,90-theta);
draw z1{dir theta}...z2...{dir-theta}z3;
penlabels(1,2,3); endchar;

cmchar "Linear equivalence symbol";
beginchar(12,22u#,.8asc_height#,0#);
adjust_fit(0,0); pickup rule.nib; autorounded;
numeric circ_diam; circ_diam=5u;
y2=math_axis; y8=y2+.5circ_diam; rt x2=w-u;
x6=x2-circ_diam;
circle_points; draw_circle;
x11=u+.5rule_thickness; y11=y2;
draw_circle shifted (z11-z6);
x9=x11+circ_diam+.5rule_thickness; y9=y10=y2; x10=x6-.5rule_thickness;
draw z9---z10;
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

cmchar "Double-struck perpendicular sign";
beginchar(13,17u#,asc_height#,0);
adjust_fit(0,0); pickup rule.nib;
compute_spread(.45x_height#,.55x_height#); x3-x1=x4-x2=good.x spread;
x1=x2=good.x (.5w - spread/2);
center_on(.5[x1,x3]); lft x5=hround u; x6=w-x5; y3=y1;
bot y1=0; y2-y1=x6-x5-3u;
if top y2>h: y2:=bot h; fi
y5=y6=y1; y4=y2;
draw z1--z2;  % left stem
draw z3--z4;  % right stem
draw z5--z6;  % bar
labels(1,2,3,4,5,6); endchar;

cmchar "Oscillating perpendicular sign";
compute_spread(.45x_height#,.55x_height#);
spread#':=spread#; spread':=spread; % the spread of `$=$'
compute_spread(.54x_height#,.66x_height#);
beginchar(14,14u#,asc_height#,0);
adjust_fit(0,0);
pickup pencircle xscaled .7rule_thickness yscaled 1.4rule_thickness;
if vair#>.8curve#: pickup rule.nib; autorounded; fi % monoline
lft x3=hround u; x4=4u; x5=w-x4; x6=w-x3;
y3=y5; y4=y6; bot y3=0; top y4-bot y3=spread';
draw z3{up}...z4{right}..{right}z5...{up}z6;  % upper stroke
pickup rule.nib; autorounded;
x1=x2; z2=1/2[z3,z6]; y1-y2=x6-x3;
if top y1>h: y1:=bot h; fi
draw z1..z2;
labels(1,2,3,4,5,6); endchar;

cmchar "Reversed linear map symbol";
beginchar(15,20u#,.8asc_height#,0#);
adjust_fit(0,0); pickup rule.nib; autorounded;
numeric circ_diam; circ_diam=5u;
y2=math_axis; y8=y2+.5circ_diam; lft x6 = u;
x6=x2-circ_diam;
circle_points; draw_circle;
x9=x2+.5rule_thickness; y9=y10=y2; x10=w-u-.5rule_thickness;
draw z9---z10;
penlabels(1,2,3,4,5,6,7,8,9,10); endchar;

def negate (expr center) =
    .5[z101,z102] = center;
    y102-y101 = 9u;
    x102-x101 = 2/5 (y102-y101);
    draw z101---z102;
    penlabels(101,102);
enddef;


cmchar "Negated multimap symbol";
beginchar(16,20u#,.8asc_height#,0#);
adjust_fit(0,0); pickup rule.nib; autorounded;
numeric circ_diam; circ_diam=5u;
y2=math_axis; y8=y2+.5circ_diam; rt x2=w-u;
x6=x2-circ_diam;
circle_points; draw_circle;
x9=u+.5rule_thickness; y9=y10=y2; x10=x6-.5rule_thickness;
draw z9---z10;
penlabels(1,2,3,4,5,6,7,8,9,10);
negate(.6[z9,z10]);
endchar;

cmchar "Negated reversed linear map symbol";
beginchar(17,20u#,.8asc_height#,0#);
adjust_fit(0,0); pickup rule.nib; autorounded;
numeric circ_diam; circ_diam=5u;
y2=math_axis; y8=y2+.5circ_diam; lft x6 = u;
x6=x2-circ_diam;
circle_points; draw_circle;
x9=x2+.5rule_thickness; y9=y10=y2; x10=w-u-.5rule_thickness;
draw z9---z10;
penlabels(1,2,3,4,5,6,7,8,9,10);
negate(.4[z9,z10]);
endchar;

cmchar "Negated linear equivalence symbol";
beginchar(18,22u#,.8asc_height#,0#);
adjust_fit(0,0); pickup rule.nib; autorounded;
numeric circ_diam; circ_diam=5u;
y2=math_axis; y8=y2+.5circ_diam; rt x2=w-u;
x6=x2-circ_diam;
circle_points; draw_circle;
x11=u+.5rule_thickness; y11=y2;
draw_circle shifted (z11-z6);
x9=x11+circ_diam+.5rule_thickness; y9=y10=y2; x10=x6-.5rule_thickness;
draw z9---z10;
penlabels(1,2,3,4,5,6,7,8,9,10,11,12,13);
negate(.5[z9,z10]);
endchar;
