Show HN: Bel
Reproduced from feedback that I gave pg on an earlier draft (omitting things he seems to have addressed):<p>When you say,<p>&gt; But I also believe it will be possible to write efficient implementations based on Bel, by adding restrictions.<p>I&#x27;m having trouble picturing what such restrictions would look like. The difficulty here is that, although you speak of axioms, this is not really an axiomatic specification; it&#x27;s an operational one, and you&#x27;ve provided primitives that permit a great deal of introspection into
that operation. For example, you&#x27;ve defined closures as lists with a particular form, and from your definition of the basic operations on lists it follows that the programmer can introspect into them as such, even at runtime. You can&#x27;t provide any implementation of closures more efficient than the one you&#x27;ve given without violating your spec, because doing so would change the result of calling car and cdr on closure objects. To change this would not be a mere matter of &quot;adding restrictions&quot;;
it would be taking a sledgehammer to a substantial piece of your edifice and replacing it with something new. If closures were their own kind of object and had their own functions for introspection, then a restriction could be that those functions are unavailable at runtime and can be only be used from macros. But there&#x27;s no sane way to restrict cdr.<p>A true axiomatic specification would deliberately leave such internals undefined. Closures aren&#x27;t necessarily lists, they&#x27;re just values that can be applied to other values and behave the same as any other closure that&#x27;s equivalent up to alpha, beta, and eta conversion. Natural numbers aren&#x27;t necessarily lists, they&#x27;re just values that obey the Peano axioms. The axioms are silent on what
happens if you try to take the cdr of one, so that&#x27;s left to the implementation to pick something that can be implemented efficiently.<p>Another benefit of specifying things in this style is that you get much greater concision than any executable specification can possible give you, without any loss of rigor. Suppose you want to include matrix operations in your standard library. Instead of having to put an implementation of matrix inversion into your spec, you could just write that for all x,<p><pre><code>    (or
     (not (is-square-matrix x))
     (singular x)
     (= (* x (inv x))
        (id-matrix (dim x))))
</code></pre>
Which presuming you&#x27;ve already specified the constituent functions is every bit as rigorous as giving an implementation. And although you can&#x27;t automate turning this into something executable (you can straightforwardly specify a halting oracle this way), you <i>can</i> automate turning this into an executable fuzz test that generates
a bunch of random matrices and ensures that the specification holds.<p>If you do stick with an operational spec, it would help to actually give a formal small-step semantics, because without a running implementation to try, some of the prose concerning the primitives and special forms leaves your intent unclear.  I&#x27;m specifically puzzling over the `where` form, because you haven&#x27;t explained what you mean by what pair a value comes from or why that pair or its location within it should be unique. What should<p><pre><code>   (where &#x27;#1(#1 . #1))
</code></pre>
evaluate to? Without understanding this I don&#x27;t really understand the macro system.