From: Marjolein Zwerver Date: Fri, 13 Jun 2014 14:04:04 +0000 (+0200) Subject: afleidingsrij 2! toegevoegd X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=012eaa0644b181d6bacb631df774350d3cd1904c;p=sec1415.git afleidingsrij 2! toegevoegd --- diff --git a/an_faculteit.tex b/an_faculteit.tex index a8a92c7..364a5f9 100644 --- a/an_faculteit.tex +++ b/an_faculteit.tex @@ -130,7 +130,7 @@ $ \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;not, [\:], [\:], [0,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\\ @@ -149,3 +149,92 @@ 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} + +\newpage + +\begin{landscape} +De afleidingsrij voor 2! ziet er als volgt uit:\\ +$ +\langle R_1; R_2; R_3; greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2;push \: 1;push \: 2, [\:], [\:], [\:]\rangle \Rightarrow +\langle R_1; R_2; R_3; greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2;push \: 1, [\:], [\:], [2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2, [\:], [\:], [1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1, [\:], [\:], [2,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll, [\:], [\:], [1,2,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup, [\:], [\:], [2,1]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3, [\:], [\:], [2,2,1]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1, [\:], [\:], [3,2,2,1]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll, [\:], [\:], [1,3,2,2,1]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1, [\:], [\:], [2,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not;subtract;, [\:], [\:], [1,2,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1;not, [\:], [\:], [1,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1;push \: 1, [\:], [\:], [0,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract;push\:1, [\:], [\:], [1,0,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater;subtract, [\:], [\:], [1,1,0,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3;greater, [\:], [\:], [0,0,1,2]\rangle \Rightarrow\\ +\langle R_1; R_2; R_3, [\:], [\:], [1,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4; dup; roll; push \: 2; push \: 3; dup; pointer; not, [\:], [\:], [1,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4; dup; roll; push \: 2; push \: 3; dup; pointer, [\:], [\:], [0,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4; dup; roll; push \: 2; push \: 3; dup, [\:], [\:], [1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4; dup; roll; push \: 2; push \: 3, [\:], [\:], [1,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4; dup; roll; push \: 2, [\:], [\:], [3,1,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4; dup; roll, [\:], [\:], [2,3,1,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4; dup, [\:], [\:], [2,1,1]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4, [\:], [\:], [2,2,1,1]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll; push \: 1, [\:], [\:], [4,2,2,1,1]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul; roll, [\:], [\:], [1,4,2,2,1,1]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2; mul, [\:], [\:], [2,1,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1; push \: 2, [\:], [\:], [2,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll; push \: 1, [\:], [\:], [2,2,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop; roll, [\:], [\:], [1,2,2,1,2]\rangle \Rightarrow\\ +\langle R_1;R_2; pop, [\:], [\:], [1,2,2]\rangle \Rightarrow\\ +\langle R_1;R_2, [\:], [\:], [2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1; roll; push \: 1; push \: 3; dup; roll; push \: 1; push \: 2, [\:], [\:], [2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1; roll; push \: 1; push \: 3; dup; roll; push \: 1, [\:], [\:], [2,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1; roll; push \: 1; push \: 3; dup; roll, [\:], [\:], [1,2,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1; roll; push \: 1; push \: 3; dup, [\:], [\:], [2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1; roll; push \: 1; push \: 3, [\:], [\:], [2,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1; roll; push \: 1, [\:], [\:], [3,2,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1; roll, [\:], [\:], [1,3,2,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1, [\:], [\:], [2,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub, [\:], [\:], [1,2,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3, [\:], [\:], [1,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll; push \: 2, [\:], [\:], [3,1,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop; roll, [\:], [\:], [2,3,1,2,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2; pop, [\:], [\:], [2,1,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1; push \: 2, [\:], [\:], [1,2]\rangle \Rightarrow\\ +\langle R_1; roll; push \: 1, [\:], [\:], [2,1,2]\rangle \Rightarrow\\ +\langle R_1; roll, [\:], [\:], [1,2,1,2]\rangle \Rightarrow\\ +\langle R_1, [\:], [\:], [2,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, [\:], [\:], [2,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,2,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,2,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup, [\:], [\:], [1,2]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3, [\:], [\:], [1,1,2]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1, [\:], [\:], [3,1,1,2]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll, [\:], [\:], [1,3,1,1,2]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1, [\:], [\:], [1,2,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;, [\:], [\:], [1,1,2,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not, [\:], [\:], [0,2,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1, [\:], [\:], [1,2,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1, [\:], [\:], [1,1,2,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract, [\:], [\:], [1,1,1,2,1]\rangle \Rightarrow\\ +\langle pointer; not;greater, [\:], [\:], [0,1,2,1]\rangle \Rightarrow\\ +\langle pointer; not, [\:], [\:], [1,2,1]\rangle \Rightarrow\\ +\langle pointer [\:], [\:], [0,2,1]\rangle \Rightarrow\\ +\langle [\:], [\:], [2,1]\rangle\\ +$ + +In deze afleidingsrij zijn de volgende afkortingen gebruikt:\\ +$ +R_1: pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2\\ +R_2: roll; push \: 1; push \: 2; pop; roll; push \: 2; push \: 3; sub; push \: 1; roll; push \: 1; push \: 3; dup; roll; push \: 1; push \: 2\\ +R_3: pop; roll; push \: 1; push \: 2; mul; roll; push \: 1; push \: 4; dup; roll; push \: 2; push \: 3; dup; pointer; not\\ +$ + +Eerst worden x en y op de stack gestopt zodat de stack [y,x] = [1,2]. +De stack in de termineerende configuratie is [y',x'] = [2,1] en 2 = 2! dus x! = y' . +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 +tweefaculteit worden alle wiskundige operaties die bij de commando's horen +achter elkaar uitgevoerd op de stack, waarbij het resultaat [2,1] is.\\ +\end{landscape} \ No newline at end of file