verbatimtex %&latex \documentclass[12pt]{article} % \usepackage{mathpazo} \usepackage{amssymb} \begin{document} % \newcommand\plugnode{\ensuremath{\circledast}} \newcommand\fv[1]{\ensuremath{\mathbf{fv}(#1)}} \newcommand\plugnode{\ensuremath{\bullet}} \newcommand\sharecontextnode{\ensuremath{\triangledown}} etex input boxes; beginfig(1); a=.7in; b=0.5in; z0=(0,0); z1=(a,0); z2=(0,b); z0=.5[z1,z3]=.5[z2,z4]; draw z1..z2..z3..z4..cycle; drawarrow z0..z1; drawarrow z0..z2; label.top(btex $a$ etex, .5[z0,z1]); label.lft(btex $b$ etex, .5[z0,z2]); endfig; beginfig(2); u=1cm; draw (2u,6u)..(2u,5u); dotlabel(btex $\lambda f$ etex, (2u,5u)); dotlabel(btex $\sharecontextnode$ etex, (1u,4u)); draw (2u,5u){dir 225}..{down}(1u,4u); dotlabel(btex @ etex, (1u,3u)); draw (1u,4u){dir 225}..{dir -45}(1u,3u); draw (1u,3u){down}..(5u,2u)..{dir 135}(2u,5u); dotlabel(btex $\lambda v$ etex, (2u,3u)); draw (1u,3u){dir 45}..{down}(2u,3u); draw (2u,3u){dir 225}..(4u,2u)..{dir 135}(1u,4u); dotlabel(btex $\plugnode$ etex, (3u,2u)); draw (2u,3u){dir -45}..{dir -45}(3u,2u); endfig; vardef drawshadowed(text t) = fixsize(t); forsuffixes s=t: fill bpath.s shifted (1pt,-1pt); unfill bpath.s; drawboxed(s); endfor enddef; vardef drawinvisible(text t) = fixsize(t); forsuffixes s=t: unfill bpath.s shifted (1pt,-1pt); unfill bpath.s; endfor enddef; beginfig(3); circleit.ff(btex $\lambda$ etex); circleit.ss(btex $\sharecontextnode$ etex); circleit.aa(btex $@$ etex); circleit.vv(btex $\lambda$ etex); circleit.pp(btex $\plugnode$ etex); ff.c = ss.c + (1u,1u) = aa.c + (1u,2u) = vv.c + (-1u,3u) = pp.c + (0,4u); drawshadowed(ff,ss,aa,vv,pp); draw ff.c+(0,1u)..ff.c cutafter bpath ff; draw ff.c{dir 210}..{down}ss.c cutbefore bpath ff cutafter bpath ss; draw ss.c{dir 210}..{dir 330}aa.c cutbefore bpath ss cutafter bpath aa; draw aa.c{dir 30}..{down}vv.c cutbefore bpath aa cutafter bpath vv; draw vv.c{dir 210}..pp.c cutbefore bpath vv cutafter bpath pp; draw aa.c{down}..{dir 150}ff.c cutbefore bpath aa cutafter bpath ff; draw vv.c{dir 330}..{up}vv.c+(1u,0)..{dir 150}ss.c cutbefore bpath vv cutafter bpath ss; endfig; beginfig(4); z0=(0,0); z1=-z3=(.5u,0); z2=-z4=(0,.5u); path po; po = fullcircle scaled 1u; path p[]; p1 = po shifted (.5u,0); p2 = po shifted (0,.5u); p3 = po shifted (-.5u,0); p4 = po shifted (0,-.5u); draw p1 withcolor red; draw buildcycle(p2,p3,p4,p1); endfig; beginfig(5); circleit.aa(btex $@$ etex); circleit.ab(btex $@$ etex); circleit.ac(btex $@$ etex); circleit.lf(btex $\lambda$ etex); circleit.lx(btex $\lambda$ etex); circleit.ly(btex $\lambda$ etex); circleit.ss(btex $\sharecontextnode$ etex); aa.c = lf.c + (0,1u) = ab.c + (0,2u) = ly.c + (-1u,2u) = ss.c + (-2u,2u) = ac.c + (-1u,4u) = lx.c + (-2u,0); drawshadowed(aa,ab,ac,lf,lx,ly,ss); draw aa.c+(-1u,1u){down}..{dir 330}aa.c cutafter bpath aa; draw aa.c..lf.c cutbefore bpath aa cutafter bpath lf; draw aa.c{dir 30}..{down}lx.c cutbefore bpath aa cutafter bpath lx; draw lf.c{dir 210}..{dir 330}ab.c cutbefore bpath lf cutafter bpath ab; draw lf.c{dir 330}..{down}ss.c cutbefore bpath lf cutafter bpath ss; draw lx.c{dir 210}..lx.c-(0,1u)..{dir 150}lx.c cutbefore bpath lx cutafter bpath lx; draw ly.c{dir 210}..ly.c-(0,1u)..{dir 150}ly.c cutbefore bpath ly cutafter bpath ly; draw ab.c{down}..{dir 330}ac.c cutbefore bpath ab cutafter bpath ac; draw ac.c{down}..{dir 150}ss.c cutbefore bpath ac cutafter bpath ss; draw ss.c{dir 210}..{dir 210}ac.c cutbefore bpath ss cutafter bpath ac; draw ab.c{dir 30}..{down}ly.c cutbefore bpath ab cutafter bpath ly; endfig; beginfig(6); circleit.aa(btex $@$ etex); circleit.ll(btex $\lambda$ etex); aa.c = ll.c + (0,1u); drawshadowed(aa,ll); draw aa.c+(-1u,1u){down}..{dir 330}aa.c cutafter bpath aa; draw aa.c+(1u,1u){down}..{dir 210}aa.c cutafter bpath aa; draw aa.c..ll.c cutbefore bpath aa cutafter bpath ll; draw ll.c+(-1u,-1u){up}..{dir 30}ll.c cutafter bpath ll; draw ll.c+(1u,-1u){up}..{dir 150}ll.c cutafter bpath ll; endfig; beginfig(7); circleit.aa(btex $@$ etex); circleit.ll(btex $@$ etex); %% because the width of app and lambda are different. aa.c = ll.c + (0,1u); drawinvisible(aa,ll); draw aa.c+(-1u,1u){down}..{down}aa.w..{down}ll.w..{down}ll.c+(-1u,-1u); draw aa.c+(1u,1u){down}..{down}aa.e..{down}ll.e..{down}ll.c+(1u,-1u); endfig; beginfig(8) path p[], pcirc, pcloud; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines circleit.term(btex $M$ etex); term.dx = term.dy = .3u; drawunboxed(term); pcirc = term.n..term.w..term.s..term.e..cycle; for i=0 upto n: t[i] = arctime i/n*arclength pcirc of pcirc; endfor pcloud = point t0 of pcirc{direction t0 of pcirc rotated -a} for i=1 upto n: ..{direction t[i] of pcirc rotated a}point t[i] of pcirc{direction t[i] of pcirc rotated -a} endfor ..cycle; circleit.ff(btex $\lambda$ etex); ff.c = term.e + (0,1u); drawshadowed(ff); fill pcloud shifted (1pt,-1pt); unfill pcloud; draw pcloud; drawunboxed(term); draw ff.c+(0,1u)..ff.c cutafter bpath ff; draw ff.c{dir 210}..{down}term.c cutafter pcloud cutbefore bpath ff; draw ff.c{dir 330}..{up}term.s cutbefore bpath ff; endfig; %% Cloud \lambda x.M beginfig(9); save v; pair a[]; v=10pt; a1 = (0,0); a2 = (1v, v*sqrt(3)); a3 = (2v, 0); path p[], pcirc, pcloud; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines circleit.term(btex $M$ etex); term.dx = term.dy = .3u; .5[a1,a3] = term.e + (0,1u); pcirc = term.n..term.w..term.s..term.e..cycle; for i=0 upto n: t[i] = arctime i/n*arclength pcirc of pcirc; endfor drawunboxed(term); pcloud = point t0 of pcirc{direction t0 of pcirc rotated -a} for i=1 upto n: ..{direction t[i] of pcirc rotated a}point t[i] of pcirc{direction t[i] of pcirc rotated -a} endfor ..cycle; fill pcloud shifted (1pt,-1pt); unfill pcloud; draw pcloud; drawunboxed(term); draw a1--a2--a3--cycle; draw a1--(1/4)[a1,a3]--(1/4)[a1,a2]--cycle; fill (3/4)[a1,a3]--a3--(1/4)[a3,a2]--cycle; label.top(btex $\lambda$ etex, .5[a1,a3]); draw a2+(0,1u)..a2; draw a1{dir 240}..{down}term.n cutafter pcloud; draw a3{dir 300}..{up}term.s; pickup pencircle scaled 2pt; drawdot a2; endfig; % From Stephan Henning on meta-post list 4/14/2008. def cloud(expr k) = begingroup save ang, da; numeric ang, da; ang := 360/k; da := 5; (.5, 0){dir da} ..% First point. for i=1 upto k-1:% Inner points. {dir(ang*i-180-da)} (.5, 0) rotated (ang*i) {dir(ang*i+da)} .. endfor {dir(-180-da)}cycle% Close path. endgroup enddef; beginfig(10); draw cloud(5); endfig; %% Cloud apply beginfig(11); save v; pair a[]; v=10pt; path p[], pcirc, pcirc_left, pcirc_right, pcloud_left, pcloud_right; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines circleit.term_left(btex $M$ etex); term_left.dx = term_left.dy = .3u; circleit.term_right(btex $N$ etex); term_right.dx = term_right.dy = .3u; term_right.w = (0,0); % aligns terms. term_left.c = term_right.c - (2u,0); % path of the circle around the term. pcirc_left = term_left.n..term_left.w..term_left.s..term_left.e..cycle; pcirc_right = term_right.n..term_right.w..term_right.s..term_right.e..cycle; for i=0 upto n: t[i] = arctime i/n*arclength pcirc_left of pcirc_left; endfor % draw overall cloud path pcirc_overall, pcloud_overall; circleit.overall(); overall.c = .5[term_left.c, term_right.c]; overall.n = overall.c + (0,2.2u); overall.e = overall.c + (2.2u,0); pcirc_overall = overall.n..overall.w..overall.s..overall.e..cycle; pcloud_overall = point t0 of pcirc_overall{direction t0 of pcirc_overall rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_overall rotated a}point t[i] of pcirc_overall{direction t[i] of pcirc_overall rotated -a} endfor ..cycle; fill pcloud_overall shifted (1pt,-1pt) withcolor .8white; unfill pcloud_overall; draw pcloud_overall withcolor .8white; % path of the cloud around the term. pcloud_left = point t0 of pcirc_left{direction t0 of pcirc_left rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_left rotated a}point t[i] of pcirc_left{direction t[i] of pcirc_left rotated -a} endfor ..cycle; pcloud_right = point t0 of pcirc_right{direction t0 of pcirc_right rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_right rotated a}point t[i] of pcirc_right{direction t[i] of pcirc_right rotated -a} endfor ..cycle; fill pcloud_left shifted (1pt,-1pt); unfill pcloud_left; draw pcloud_left; fill pcloud_right shifted (1pt,-1pt); unfill pcloud_right; draw pcloud_right; drawunboxed(term_left); drawunboxed(term_right); % The application node pair appnode; appnode = term_left.n+(0,1u); label(btex $@$ etex, appnode+(0,3pt)); a1 = a2 - (2v,0); a3 = a1 + (1v, -v*sqrt(3)); a1 = appnode + (-1v, 1/2v*sqrt(3)); % drawing the application node and ports. draw a1--a2--a3--cycle; draw a1--(1/4)[a1,a3]--(1/4)[a1,a2]--cycle; fill (3/4)[a1,a2]--a2--(1/4)[a2,a3]--cycle; % The sharing node pair sharenode; % sharenode = term_left.c+(1u,-1u); sharenode = .5[term_left.s, term_right.s]-(.1u,1u); pair b[]; b1 = b2 - (2v,0); b3 = b1 + (1v, -v*sqrt(3)); b1 = sharenode + (-1v, 1/2v*sqrt(3)); % drawing the sharing node and ports. draw b1--b2--b3--cycle; draw b1--(1/4)[b1,b3]--(1/4)[b1,b2]--cycle; fill (3/4)[b1,b2]--b2--(1/4)[b2,b3]--cycle; pair c[]; c1 = c2 - (2v,0); c3 = c1 + (1v, -v*sqrt(3)); c1 = sharenode + (.3u,0) + (-1v, 1/2v*sqrt(3)); % drawing the sharing node and ports. unfill c1--c2--c3--cycle; draw c1--c2--c3--cycle; draw c1--(1/4)[c1,c3]--(1/4)[c1,c2]--cycle; fill (3/4)[c1,c2]--c2--(1/4)[c2,c3]--cycle; label.top(btex $MN$ etex, .5[term_left.c, term_right.c]+(0,.5u)) withcolor .8white; label.rt(btex $\mathbf{fv}(N)\setminus\mathbf{fv}(M)$ etex, term_right.c+(.5u,-2.5u)); label.bot(btex $\mathbf{fv}(N)\cap\mathbf{fv}(M)$ etex, b3+(.18u,-1u)); label.lft(btex $\mathbf{fv}(M)\setminus\mathbf{fv}(N)$ etex, term_left.c+(-.5u,-2.5u)); % label(btex $@$ etex, sharenode+(0,3pt)); % drawing the wires from application node ports to clouds. draw a1+(-.5u,.5u){down}..{dir 330}a1 cutafter a1; draw a3..term_left.n cutafter pcloud_left; draw a2{dir 30}..{down}term_right.n cutafter pcloud_right; % drawing the wires from sharing node ports to clouds. draw term_left.c+(.4u,0){down}..term_left.c+(.4u,-.5u){down}..{dir 330}c1 cutbefore pcloud_left; draw term_left.c+(.1u,0){down}..term_left.c+(.1u,-.5u){down}..{dir 330}b1 cutbefore pcloud_left; draw term_right.c+(-.4u,0){down}..term_right.c+(-.4u,-.5u){down}..{dir 210}b2 cutbefore pcloud_right; draw term_right.c+(-.1u,0){down}..term_right.c+(-.1u,-.5u){down}..{dir 210}c2 cutbefore pcloud_right; % shared variable wires draw b3{down}..b3-(0,1u); draw c3{down}..c3-(0,1u); % free variable wires draw term_left.c-(.4u,0)..term_left.c-(.4u,2.5u) cutbefore pcloud_left; draw term_left.c-(.1u,0)..term_left.c-(.1u,2.5u) cutbefore pcloud_left; draw term_right.c+(.4u,0)..term_right.c+(.4u,-2.5u) cutbefore pcloud_right; draw term_right.c+(.1u,0)..term_right.c+(.1u,-2.5u) cutbefore pcloud_right; pickup pencircle scaled 1pt; drawdot term_right.c+(.18u,-.6u); drawdot term_right.c+(.25u,-.6u); drawdot term_right.c+(.32u,-.6u); drawdot term_left.c+(-.18u,-.6u); drawdot term_left.c+(-.25u,-.6u); drawdot term_left.c+(-.32u,-.6u); drawdot b3+(.08u,-.25u); drawdot b3+(.15u,-.25u); drawdot b3+(.22u,-.25u); drawdot term_left.c+(.18u,-.6u); drawdot term_left.c+(.25u,-.6u); drawdot term_left.c+(.32u,-.6u); drawdot term_right.c+(-.18u,-.6u); drawdot term_right.c+(-.25u,-.6u); drawdot term_right.c+(-.32u,-.6u); % redraw cloud outline draw pcloud_overall withcolor .8white; %% principal port dot, left to end for pen mutation (FIXME). pickup pencircle scaled 2pt; drawdot a3; drawdot b3; drawdot c3; endfig; %% Cloud M, N beginfig(12); save v; pair a[]; v=10pt; path p[], pcirc, pcirc_left, pcirc_right, pcloud_left, pcloud_right; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines circleit.term_left(btex $M$ etex); term_left.dx = term_left.dy = .3u; circleit.term_right(btex $N$ etex); term_right.dx = term_right.dy = .3u; term_right.w = (0,0); % aligns terms. term_left.c = term_right.c - (2u,0); % path of the circle around the term. pcirc_left = term_left.n..term_left.w..term_left.s..term_left.e..cycle; pcirc_right = term_right.n..term_right.w..term_right.s..term_right.e..cycle; for i=0 upto n: t[i] = arctime i/n*arclength pcirc_left of pcirc_left; endfor % path of the cloud around the term. pcloud_left = point t0 of pcirc_left{direction t0 of pcirc_left rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_left rotated a}point t[i] of pcirc_left{direction t[i] of pcirc_left rotated -a} endfor ..cycle; pcloud_right = point t0 of pcirc_right{direction t0 of pcirc_right rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_right rotated a}point t[i] of pcirc_right{direction t[i] of pcirc_right rotated -a} endfor ..cycle; fill pcloud_left shifted (1pt,-1pt); unfill pcloud_left; draw pcloud_left; fill pcloud_right shifted (1pt,-1pt); unfill pcloud_right; draw pcloud_right; drawunboxed(term_left); drawunboxed(term_right); draw term_left.c..term_left.c+(0,1u) cutbefore pcloud_left; draw term_right.c..term_right.c+(0,1u) cutbefore pcloud_right; draw term_left.c+(-.15u,0)..term_left.c+(-.15u,-1u) cutbefore pcloud_left; draw term_left.c+(.15u,0)..term_left.c+(.15u,-1u) cutbefore pcloud_left; draw term_right.c+(-.15u,0)..term_right.c+(-.15u,-1u) cutbefore pcloud_right; draw term_right.c+(.15u,0)..term_right.c+(.15u,-1u) cutbefore pcloud_right; label.bot(btex $\mathbf{fv}(M)$ etex, term_left.c+(0,-1u)); label.bot(btex $\mathbf{fv}(N)$ etex, term_right.c+(0,-1u)); pickup pencircle scaled 1pt; drawdot term_right.c+(-.07u,-.6u); drawdot term_right.c+(0,-.6u); drawdot term_right.c+(.07u,-.6u); drawdot term_left.c+(-.07u,-.6u); drawdot term_left.c+(0,-.6u); drawdot term_left.c+(.07u,-.6u); endfig; %% Cloud M beginfig(13); save v; pair a[]; v=10pt; path p[], pcirc, pcirc_left, pcloud_left; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines circleit.term_left(btex $M$ etex); term_left.dx = term_left.dy = .3u; term_left.w = (0,0); % path of the circle around the term. pcirc_left = term_left.n..term_left.w..term_left.s..term_left.e..cycle; for i=0 upto n: t[i] = arctime i/n*arclength pcirc_left of pcirc_left; endfor % path of the cloud around the term. pcloud_left = point t0 of pcirc_left{direction t0 of pcirc_left rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_left rotated a}point t[i] of pcirc_left{direction t[i] of pcirc_left rotated -a} endfor ..cycle; fill pcloud_left shifted (1pt,-1pt); unfill pcloud_left; draw pcloud_left; drawunboxed(term_left); draw term_left.c..term_left.c+(0,1u) cutbefore pcloud_left; draw term_left.c+(-.15u,0)..term_left.c+(-.15u,-1u) cutbefore pcloud_left; draw term_left.c+(.15u,0)..term_left.c+(.15u,-1u) cutbefore pcloud_left; label.bot(btex $\mathbf{fv}(M)$ etex, term_left.c+(0,-1u)); pickup pencircle scaled 1pt; drawdot term_left.c+(-.07u,-.6u); drawdot term_left.c+(0,-.6u); drawdot term_left.c+(.07u,-.6u); endfig; %% var beginfig(14); save v; pair a[]; v=10pt; path p[], pcirc, pcirc_left, pcirc_right, pcloud_left, pcloud_right; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines for i=0 upto n: t[i] = arctime i/n*arclength pcirc_overall of pcirc_overall; endfor % draw overall cloud path pcirc_overall, pcloud_overall; circleit.overall(); overall.c = (0,0); overall.n = overall.c + (0,1/2u); overall.e = overall.c + (1/2u,0); pcirc_overall = overall.n..overall.w..overall.s..overall.e..cycle; pcloud_overall = point t0 of pcirc_overall{direction t0 of pcirc_overall rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_overall rotated a}point t[i] of pcirc_overall{direction t[i] of pcirc_overall rotated -a} endfor ..cycle; fill pcloud_overall shifted (1pt,-1pt) withcolor .8white; unfill pcloud_overall; draw pcloud_overall withcolor .8white; label(btex $x$ etex, (1/4u, 0)) withcolor .8white; draw (-1/4u,1u)..(-1/4u,-1u); label.bot(btex $x$ etex, (-1/4u,-1u)); endfig; %% Cloud M, x free beginfig(15); save v; pair a[]; v=10pt; path p[], pcirc, pcirc_left, pcloud_left; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines circleit.term_left(btex $M$ etex); term_left.dx = term_left.dy = .3u; term_left.w = (0,0); % path of the circle around the term. pcirc_left = term_left.n..term_left.w..term_left.s..term_left.e..cycle; for i=0 upto n: t[i] = arctime i/n*arclength pcirc_left of pcirc_left; endfor % path of the cloud around the term. pcloud_left = point t0 of pcirc_left{direction t0 of pcirc_left rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_left rotated a}point t[i] of pcirc_left{direction t[i] of pcirc_left rotated -a} endfor ..cycle; fill pcloud_left shifted (1pt,-1pt); unfill pcloud_left; draw pcloud_left; drawunboxed(term_left); draw term_left.c..term_left.c+(0,1u) cutbefore pcloud_left; draw term_left.c+(-.3u,0)..term_left.c+(-.3u,-1u) cutbefore pcloud_left; draw term_left.c+(0,0)..term_left.c+(0,-1u) cutbefore pcloud_left; draw term_left.c+(.3u,0)..term_left.c+(.3u,-1u) cutbefore pcloud_left; label.lft(btex $\mathbf{fv}(M) \setminus \{x\}$ etex, term_left.c+(-.5u,-1u)); label.rt(btex $x$ etex, term_left.c+(.5u,-1u)); pickup pencircle scaled 1pt; drawdot term_left.c+(-.08u,-.6u); drawdot term_left.c+(-.15u,-.6u); drawdot term_left.c+(-.22u,-.6u); endfig; %% Cloud \lambda x.M, x occurs beginfig(16); save v; pair a[]; v=10pt; a1 = (0,0); a2 = (1v, v*sqrt(3)); a3 = (2v, 0); path p[], pcirc, pcirc_left, pcloud_left; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines circleit.term_left(btex $M$ etex); term_left.dx = term_left.dy = .3u; a1 = term_left.e + (0,1u); % path of the circle around the term. pcirc_left = term_left.n..term_left.w..term_left.s..term_left.e..cycle; for i=0 upto n: t[i] = arctime i/n*arclength pcirc_left of pcirc_left; endfor % path of the cloud around the term. pcloud_left = point t0 of pcirc_left{direction t0 of pcirc_left rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_left rotated a}point t[i] of pcirc_left{direction t[i] of pcirc_left rotated -a} endfor ..cycle; % draw overall cloud path pcirc_overall, pcloud_overall; circleit.overall(); overall.c = .5[a1,a3] - (0,1u); overall.n = overall.c + (0,2u); overall.e = overall.c + (2u,0); pcirc_overall = overall.n..overall.w..overall.s..overall.e..cycle; pcloud_overall = point t0 of pcirc_overall{direction t0 of pcirc_overall rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_overall rotated a}point t[i] of pcirc_overall{direction t[i] of pcirc_overall rotated -a} endfor ..cycle; fill pcloud_overall shifted (1pt,-1pt) withcolor .8white; unfill pcloud_overall; draw pcloud_overall withcolor .8white; label.rt (btex $\lambda x.M, x \in \fv{M}$ etex, overall.e+(1u,0)); fill pcloud_left shifted (1pt,-1pt); unfill pcloud_left; draw pcloud_left; drawunboxed(term_left); draw term_left.c+(-.3u,0)..term_left.c+(-.3u,-2.5u) cutbefore pcloud_left; draw term_left.c+(0,0)..term_left.c+(0,-2.5u) cutbefore pcloud_left; label.bot(btex $\mathbf{fv}(M) \setminus \{x\}$ etex, term_left.c+(-.15u,-2.5u)); draw a1--a2--a3--cycle; draw a1--(1/4)[a1,a3]--(1/4)[a1,a2]--cycle; fill (3/4)[a1,a3]--a3--(1/4)[a3,a2]--cycle; label.top(btex $\lambda$ etex, .5[a1,a3]); draw a2+(0,1u)..a2; draw a1{dir 210}..{down}term_left.n cutafter pcloud_left; draw a3{dir 330}..{up}term_left.s+(.3u,0); pickup pencircle scaled 2pt; drawdot a2; pickup pencircle scaled 1pt; drawdot term_left.c+(-.08u,-.6u); drawdot term_left.c+(-.15u,-.6u); drawdot term_left.c+(-.22u,-.6u); endfig; % Cloud lambda x.M, x does not occur. beginfig(17); save v; pair a[]; v=10pt; a1 = (0,0); a2 = (1v, v*sqrt(3)); a3 = (2v, 0); path p[], pcirc, pcirc_left, pcloud_left; numeric n, a, t[]; n = 8; % number of sides to the cloud a = 40; % angle of cloud lines circleit.term_left(btex $M$ etex); term_left.dx = term_left.dy = .3u; a1 = term_left.e + (0,1u); % path of the circle around the term. pcirc_left = term_left.n..term_left.w..term_left.s..term_left.e..cycle; for i=0 upto n: t[i] = arctime i/n*arclength pcirc_left of pcirc_left; endfor % path of the cloud around the term. pcloud_left = point t0 of pcirc_left{direction t0 of pcirc_left rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_left rotated a}point t[i] of pcirc_left{direction t[i] of pcirc_left rotated -a} endfor ..cycle; % draw overall cloud path pcirc_overall, pcloud_overall; circleit.overall(); overall.c = term_left.e + (.5u,0); overall.n = overall.c + (0,2u); overall.e = overall.c + (2u,0); pcirc_overall = overall.n..overall.w..overall.s..overall.e..cycle; pcloud_overall = point t0 of pcirc_overall{direction t0 of pcirc_overall rotated -a} for i=1 upto n: ..{direction t[i] of pcirc_overall rotated a}point t[i] of pcirc_overall{direction t[i] of pcirc_overall rotated -a} endfor ..cycle; fill pcloud_overall shifted (1pt,-1pt) withcolor .8white; unfill pcloud_overall; draw pcloud_overall withcolor .8white; label.rt (btex $\lambda x.M, x \notin \fv{M}$ etex, overall.e+(1u,0)); fill pcloud_left shifted (1pt,-1pt); unfill pcloud_left; draw pcloud_left; drawunboxed(term_left); draw term_left.c+(-.3u,0)..term_left.c+(-.3u,-2.5u) cutbefore pcloud_left; draw term_left.c+(0,0)..term_left.c+(0,-2.5u) cutbefore pcloud_left; label.bot(btex $\fv{M}$ etex, term_left.c+(-.15u,-2.5u)); draw a1--a2--a3--cycle; draw a1--(1/4)[a1,a3]--(1/4)[a1,a2]--cycle; fill (3/4)[a1,a3]--a3--(1/4)[a3,a2]--cycle; label.top(btex $\lambda$ etex, .5[a1,a3]); % wires out of lambda node. draw a2+(0,1u)..a2; draw a1{dir 210}..{down}term_left.n cutafter pcloud_left; draw a3{dir 330}..{down}term_left.e+(1u,0u); label.bot(btex $\odot$ etex, term_left.e+(1u,.2u)); % draw a1{dir 210}..{down}term_left.n cutafter pcloud_left shifted (1u,1u); pickup pencircle scaled 2pt; drawdot a2; pickup pencircle scaled 1pt; drawdot term_left.c+(-.08u,-.6u); drawdot term_left.c+(-.15u,-.6u); drawdot term_left.c+(-.22u,-.6u); endfig; % Circuit diagram beginfig(18); circleit.aa(btex $\wedge$ etex); circleit.ab(btex $\wedge$ etex); circleit.ac(btex $\wedge$ etex); circleit.oa(btex $\vee$ etex); circleit.ob(btex $\vee$ etex); circleit.oc(btex $\vee$ etex); circleit.ca(btex $C$ etex); aa.c = ac.c + (1.5u,1u); ab.c = ac.c + (-1.5u,1u); ac.c = ca.c + (0,1u); oa.c = ca.c + (-1.5u,-1u); ob.c = ca.c + (1.5u,-1u); oc.c = ca.c + (0,-2u); drawboxed(aa,ab,ac,oa,ob,oc,ca); draw aa.c+(-1u,1u){down}..{dir 330}aa.c cutafter bpath aa; draw aa.c+(1u,1u){down}..{dir 210}aa.c cutafter bpath aa; draw ab.c+(-1u,1u){down}..{dir 330}ab.c cutafter bpath ab; draw ab.c+(1u,1u){down}..{dir 210}ab.c cutafter bpath ab; draw aa.c{down}..{dir 210}ac.c cutafter bpath ac cutbefore bpath aa; draw ab.c{down}..{dir 330}ac.c cutafter bpath ac cutbefore bpath ab; draw ac.c{down}..ca.c cutafter bpath ca cutbefore bpath ac; draw ca.c{dir 210}..{dir 210}oa.c cutafter bpath oa cutbefore bpath ca; draw ca.c{dir 330}..{dir 330}ob.c cutafter bpath ob cutbefore bpath ca; draw ab.c+(-2u,1u){down}..{dir 330}oa.c cutafter bpath oa; draw aa.c+(2u,1u){down}..{dir 210}ob.c cutafter bpath ob; draw oa.c{down}..{dir 330}oc.c cutafter bpath oc cutbefore bpath oa; draw ob.c{down}..{dir 210}oc.c cutafter bpath oc cutbefore bpath ob; draw oc.c{down}..{down}oc.c+(0,-1u) cutbefore bpath oc; label.top(btex $e_1$ etex, ab.c shifted (-2u,1u)); label.top(btex $e_2$ etex, ab.c shifted (-1u,1u)); label.top(btex $e_3$ etex, ab.c shifted (1u,1u)); label.top(btex $e_4$ etex, aa.c shifted (-1u,1u)); label.top(btex $e_5$ etex, aa.c shifted (1u,1u)); label.top(btex $e_6$ etex, aa.c shifted (2u,1u)); label.top(btex $e_7$ etex, .5[ab.c,ac.c]); label.top(btex $e_8$ etex, .5[aa.c,ac.c]); label.lft(btex $f$ etex, .5[ac.c,ca.c]); label.top(btex $e_9$ etex, .5[ca.c,oa.c] shifted (-.1u,0)); label.top(btex $e_{10}$ etex, .5[ca.c,ob.c] shifted (.1u,0)); label.top(btex $e_{11}$ etex, .5[oa.c,oc.c]); label.top(btex $e_{12}$ etex, .5[ob.c,oc.c]); label.bot(btex $o$ etex, oc.c shifted (0,-1u)); % draw aa.c..ll.c cutbefore bpath aa cutafter bpath ll; % draw ll.c+(-1u,-1u){up}..{dir 30}ll.c cutafter bpath ll; % draw ll.c+(1u,-1u){up}..{dir 150}ll.c cutafter bpath ll; endfig; end