We can think about all these in terms of dimension.
Data are like points, 0 dimensional.
Channels (of communication) are 1-dimensional. They are the fundamental bricks of IT. They are not enough, though.
Contracts are 2-dimensional. A contract is an algorithm over channels.
As an example, here’s how we can turn a graph rewrite system in the sticks and rings version into a contract-like one.
For the (oriented) sticks and rings version of chemlambda see this. Two small rewrite systems involving non-oriented sticks are described here and there.
The closest algorithm relevant for this post is the one from needs. I shall mention in ths post names from there, like “succ”, “ccus”, “gamma” and “ammag”.
We can descrine a sticks and rings graph with two invertible functions. Each node of a trivalent graph is decomposed as two half-nodes. Indees, cut a trivalent node in half, you get a half-node with one half-edge (this is type I half-node) and another half-node with two half-edges (this is type II half-node). Each stick has two ends which are type I half-nodes and it is a list which starts and ends with type I half-nodes and contains otherwise only type II hald-nodes. A ring is a circular list made of type II half-nodes.
Succ and it’s inverse ccus is the function (permutation) which for any half-node from a stick or ring gives the sucessor half-node, if any (or the predecessor half-node in the case of ccus).
Gamma and it’s inverse ammag is the function (permutation) which pairs each type I half-node with it’s type II other half-node.
The new thing here is that we shall think about half-nodes as names of channels in an asynchronous pi-calculus.
In the needs algorithm the rewrites (which are conservative in the number of half-nodes) are small permutations of half-nodes. The gamma-ammag function is passive, in the sense that it never changes. The rewrites are random.
In the version I propose here each half-node is a unidirectional channel which can be used to communicate other channels names and some data. In the case of the graph rewrite systems we discuss here the other data is the color of the (half-)node.
In the case of chemlambda strings we need a bit for the half-node type and 2 bits for the colors. As a (half) tongue-in-cheek I used DNA or RNA like encoding, like in this screen casting, to turn a mol file into the sticks and rings version.
In the version proposed here we change the algorithm of random application of a rewrite with an algorithm which involves only communication via the channels associated with the half-nodes.
Here is the description of a SH rewrite
Each stick is the property of somebody (A, B, C, D, …), say an actor. A stick is a list of channels names. So the data (0-dim) are the channels names, organized in lists which are managed by actors.
Actors can send messages through channels and also they can edit their list.
A rewrite, here the SH, is an contract, i.e. an algorithm which describes how to achieve the rewrite via communication and editing of list, such that each actor can locally execute it’s part.
But how can we read such a contract? In many ways, because the formalism is so general. For example: B and D exchange C in the place A, witnessed by the notary node e1.
Then what can be the pairs yellow-blue and blue-blue? Recall that originally the SH rewrite is
Well, coins? Or coin (yellow-blue) and gas (blue-blue)? Or receipts? Imagination is the limit and all can be made in practice. If you are interested to make it real contact me.