X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=an_faculteit.tex;h=59fd9214cb5cbdf928d1e196b7c3f06e8e834726;hb=d5eb78db13b8b04fdf0a3edf3e636dd9006948af;hp=695fb4dc791a47f14973a02e4a693120b9316a28;hpb=8978bbc9285ae5e8def8349ee70d75027f8f2d59;p=sec1415.git diff --git a/an_faculteit.tex b/an_faculteit.tex index 695fb4d..59fd921 100644 --- a/an_faculteit.tex +++ b/an_faculteit.tex @@ -95,3 +95,37 @@ Wat in piet er uit zit als in \ref{fig:img3} \fbox{\includegraphics[natheight=320px, natwidth=256px, height=320px, width=256px]{img3.png}} \end{figure} + +\begin{landscape} +De afleidingsrij voor 1! ziet er als volgt uit:\\ +$ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2;push \: 1;push \: 1, [\:], [\:], [\:]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2;push \: 1, [\:], [\:], [1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2, [\:], [\:], [1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1, [\:], [\:], [2,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll, [\:], [\:], [1,2,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup, [\:], [\:], [1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1, [\:], [\:], [3,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll, [\:], [\:], [1,3,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;, [\:], [\:], [1,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1, [\:], [\:], [1,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract, [\:], [\:], [1,1,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater, [\:], [\:], [0,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer [\:], [\:], [0,1,1]\rangle \Rightarrow\\ +\langle [\:], [\:], [1,1]\rangle\\ +\\ +$ +Eerst worden x en y op de stack gestopt zodat de stack [y,x] = [1,1]. +Deze stack is gelijk aan de stack in de termineerende configuratie: 1 = 1! dus y = x!. +Als bewijs dat de wiskundige operaties op de stack goed zijn uitgevoerd staat in +de appendix onder het kopje voorbeelden een stukje code. In het programma +eenfaculteit worden alle wiskundige operaties die bij de commando's horen +achter elkaar uitgevoerd op de stack, waarbij het resultaat [1,1] is.\\ +Bij de voorbeelden staan ook nog de programma's tweefaculteit en +vijffaculteit die respectievelijk 2! en 5! uitrekenen. +\end{landscape} \ No newline at end of file