A-Minimal-Set-of-Properties.html 5.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <html lang="en">
  2. <head>
  3. <title>A Minimal Set of Properties - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="Virtual-Code-Semantics.html#Virtual-Code-Semantics" title="Virtual Code Semantics">
  9. <link rel="prev" href="On-Equality.html#On-Equality" title="On Equality">
  10. <link rel="next" href="A-Simple-Lisp-Like-Language.html#A-Simple-Lisp-Like-Language" title="A Simple Lisp Like Language">
  11. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  12. <meta http-equiv="Content-Style-Type" content="text/css">
  13. <style type="text/css"><!--
  14. pre.display { font-family:inherit }
  15. pre.format { font-family:inherit }
  16. pre.smalldisplay { font-family:inherit; font-size:smaller }
  17. pre.smallformat { font-family:inherit; font-size:smaller }
  18. pre.smallexample { font-size:smaller }
  19. pre.smalllisp { font-size:smaller }
  20. span.sc { font-variant:small-caps }
  21. span.roman { font-family:serif; font-weight:normal; }
  22. span.sansserif { font-family:sans-serif; font-weight:normal; }
  23. --></style>
  24. </head>
  25. <body>
  26. <div class="node">
  27. <a name="A-Minimal-Set-of-Properties"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="A-Simple-Lisp-Like-Language.html#A-Simple-Lisp-Like-Language">A Simple Lisp Like Language</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="On-Equality.html#On-Equality">On Equality</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="Virtual-Code-Semantics.html#Virtual-Code-Semantics">Virtual Code Semantics</a>
  32. <hr>
  33. </div>
  34. <h4 class="subsection">2.7.3 A Minimal Set of Properties</h4>
  35. <p>For any trees <var>x</var>, <var>y</var>, and <var>k</var>, and any non-<code>nil</code>
  36. trees <var>p</var>, <var>f</var>, and <var>g</var>, the new invisible operator satisfies these
  37. conditions. In these expressions and hereafter, increasing abuse of
  38. notation is perpetrated by not writing the <code>cons</code> in expressions of the form
  39. <code>cons(</code><var>x</var><code>,</code><var>y</var><code>)</code>.
  40. <dl>
  41. <dt><em>P0</em><dd><code>(nil,(nil,nil)) </code><var>x</var> = <var>x</var>
  42. <br><dt><em>P1</em><dd><code>(nil,((nil,nil),nil)) (</code><var>x</var><code>,</code><var>y</var><code>)</code> = <var>x</var>
  43. <br><dt><em>P2</em><dd><code>(nil,(nil,(nil,nil))) (</code><var>x</var><code>,</code><var>y</var><code>)</code> = <var>y</var>
  44. <br><dt><em>P3</em><dd><code>((nil,</code><var>k</var><code>),nil) </code><var>x</var> = <var>k</var>
  45. <br><dt><em>P4</em><dd><code>(((nil,(nil,nil)),nil),nil) (</code><var>f</var><code>,</code><var>x</var><code>)</code> = <var>f</var><code> (</code><var>f</var><code>,</code><var>x</var><code>)</code>
  46. <br><dt><em>P5</em><dd><code>((</code><var>f</var><code>,</code><var>g</var><code>),nil) </code><var>x</var> = <var>f</var> <var>g</var> <var>x</var>
  47. <br><dt><em>P6</em><dd><code>((</code><var>f</var><code>,nil),</code><var>g</var><code>) </code><var>x</var> = <code>(</code><var>f</var> <var>x</var><code>,</code><var>g</var> <var>x</var><code>)</code>
  48. <br><dt><em>P7</em><dd><code>((</code><var>p</var><code>,</code><var>f</var><code>),</code><var>g</var><code>) </code><var>x</var> = <var>f</var> <var>x</var> if
  49. <var>p</var> <var>x</var> is a non-<code>nil</code> tree,
  50. but <var>g</var> <var>x</var> if <var>p</var> <var>x</var> = <code>nil</code>
  51. </dl>
  52. <p><a name="index-properties-246"></a><a name="index-operator-properties-247"></a>Although other properties remain to be described, it is worth pausing at
  53. this point because there is ample food for thought in the ones already
  54. given. An obvious question would be that of their origin. The short
  55. answer is that they have been chosen arbitrarily to be true by
  56. definition of the operator. At best, the completion of the construction
  57. may lead to a more satisfactory answer based on aesthetic or engineering
  58. grounds.
  59. <p>A more important question would be that of the relevance of the mystery
  60. operator and its properties to the stated purpose of this section, which
  61. is to specify the virtual machine code semantics. The answer lies in
  62. that the operator induces a function for any given tree <var>t</var>,
  63. such that the value returned by the function when given an argument
  64. <var>x</var> is <var>t</var> <var>x</var>. This function is the one that is
  65. implemented by the virtual code <var>t</var>, which is to say the way an
  66. application will behave if we put <var>t</var> in its virtual code file. An
  67. equivalent way of looking at the situation is that the virtual machine
  68. does nothing but compute the result of this operator, taking the tree in
  69. the virtual code file as its left operand and the input data as the
  70. right operand. By knowing what the operator will do with a given pair of
  71. operands, we know what to put into the virtual code file to get the
  72. function we want.
  73. <p><a name="index-universality-248"></a><a name="index-Turing-equivalence-249"></a><a name="index-exceptions-250"></a><a name="index-lists-251"></a>It is worthwhile to note that properties <em>P0</em> to <em>P7</em> are
  74. sufficient for universality in the sense of Turing equivalence. That
  75. means that any computable function could be implemented by the suitable
  76. choice of a tree <var>t</var> without recourse to any other properties of the
  77. operator. A compiler writer who finds this material boring could
  78. therefore stop reading at this point and carry out the task of targeting
  79. any general purpose programming language to the virtual machine based on
  80. the specifications already given. However, such an implementation would
  81. not take advantage of the features for list processing, exception
  82. handling, or profiling that are also built into the virtual
  83. machine and have yet to be described.
  84. </body></html>