Is it theoretically possible to have a better Operational Semantics than the BitMachine #89
Replies: 5 comments 11 replies
-
In some sense, the combinators of Simplicity and the Bit Machine were designed hand-in-hand. There are a couple of variations in choices one could make with the combinator language and get an equivalently powerful language. Simplicity's combinator set, in particular with respect to the The above is maybe incidental to what you are asking about. It is certainly possible that something else could be better for some definition of better. What would qualify as being a better operational semantics? In a very vague sense, the Bit Machine doesn't operate so differently from how Bitcoin Script does. There are some stacks, items are pushed and popped of stack. The main difference is that the Bit Machine doesn't have byte alignment, and requires somewhat messy bit level access and realignment when marshaling data between the Bit Machine and the native code that implements jets. (At least Simplicity isn't using ternary machine like IOTA uses. So things could always get funnier :) |
Beta Was this translation helpful? Give feedback.
-
I suspect that a byte-aligned or even word-aligned machine could be defined without too much trouble, with only a small constant-multiple hit to memory requirements. @ProofOfKeags regarding "laughably silly", do you have any resources that we non-silicon people could read to try to understand some rules of thumb we could use? Alternately, do you know anybody who has experience in this area who'd be willing to chat with us for a few hours to get a shared understanding of Simplicity's semantics? |
Beta Was this translation helpful? Give feedback.
-
From the outside it looks like Simplicity's design looks like took a bunch of trivial, very low level combinators and, through ridiculous effort, uses those combinators to program anything we want from them. We argue that these combinators are simple and, through that enormous effort, adequate in a technical sense that requires jets to order to overcome it's ridiculous primitiveness. But let me offer you a different perspective which may help assuage concerns about the ridiculously primitive nature of Simplicity's combinators. When designing a Blockchain programing language we will have a set of basic functionality that we will want to build programs out of. Basic functionality like adding, multiplying and dividing numbers, computing signature hashes, checking BIP-0340 schnorr signatures, etc. Eventually this basic functionality will be realized as jets in Simplicity's design, but for now let's just say we want a language that comes with some expressive set of basic functionality. These basic functions all come with some sort of interface, that determine what inputs are acceptable and what outputs they produce on those inputs. In order to program we need ways of compose all these basic functions together to get new functionality from the parts. There is lots of different ways we can choose to enable this composition. Bitcoin Script uses stacks for this composition, where inputs and output values are places on these stacks, and these stacks come with operations to manipulate them them in such a way that the basic functions can have their inputs and outputs combined together allowing new computations that go beyond just the basic functions themselves. From a type-theory perspective, there are just a handful of fundamental ways of combining functions together. The most basic way is by function composition, that is using the output of one function as the input to another function, but there are other ways. Another way is parallel composition, where two functions are both evaluated logically in parallel with each other (not necessarily operationally concurrent), producing two outputs. Another important way is by making a choice between evaluating one of two functions, the heart of the "if" expression. The type theory way says to create combinators to enable function composition, parallel composition, and choice composition of basic functions to derive new functions, and to recursively use those combinators again to derive further new function from those new derivations. Type theory gives other operations for manipulating these combinations. Bitcoin Script also enables these forms of composition. Function composition doesn't have have an explicit operation to enable it, just sequencing two basic functions one after the other is all you need to do this in a "concatinative" language. The My point here is, that Simplicity's combinator design emerges before we even get to something low level. We would want Simplicity's combinators anyways, even if we were building a high-level language. The choice composition more or less requires a notion of a bit in order to make its choice. That's what "if" expressions operate on in almost every language design. So no matter what, we are going to need all this stuff. In particular, if we want to formally reason about this language, we will need to give formal semantics to this choice of combinators, in addition to the formal semantics of each of the basic functions. From here we note that we can "complete" our combinator language by adding Ultimately I expect Simplicity programs to mostly consist of jets, with a few uses of P.S. Type theory does give us even more ways of combining functions. For example the, |
Beta Was this translation helpful? Give feedback.
-
Personally I've been truly amazed by this hand in hand codesign of the two languages.
Of course bit alignments of |
Beta Was this translation helpful? Give feedback.
-
One of the things I keep returning back to is how laughably silly the BitMachine's semantics seem from a silicon efficiency perspective. However, it isn't obvious that it can be done more efficiently that generalizes over all possible type-correct arrangements of the combinators. I am also assuming that since there isn't a better way presented in either the Whitepaper or Tech Report that we don't definitively know of a better way. However, do we know that no better way is possible? Why or why not?
Beta Was this translation helpful? Give feedback.
All reactions