Build [00H1]
When a robot (the "parent") wishes to build another robot, it can execute \mathsf {build}\;p in order to create a robot (the "child") running program p. There are several things to take into consideration here:
- Of course, the parent robot must have the capability to execute \mathsf {build}.
- The child robot should be the one to evaluate and execute p.
- The child robot must have the capabilities needed to evaluate and execute p. Hence, it must have a set of equipped devices which provide the necessary capabilities, and hence the parent robot must take these devices from its inventory and equip them on the child robot at build time.
- The program to be run by the child robot may also explicitly require certain devices to be installed, and certain inventory to be present. The parent robot must also provide these things to the child robot from its inventory at build time.
These considerations lead us to the following typing rule for \mathsf {build}:
- First, the premise states that p must be a delayed command. The reason for requiring the command to be wrapped in a delay is to make clear that any evaluation of the command is to be carried out by the child robot.
- The conclusion states that \mathsf {build}\;p is a command, producing a value of type \mathsf {Actor} (a reference to the child robot). The only capabilities needed by the parent robot to evaluate \mathsf {build}\;p are \Delta _1, the capabilities needed to evaluate p.
- The only capability needed to execute \mathsf {build}\;p is \mathsf {Exc}(\mathsf {build}).
- Executing the \mathsf {build} command does not require any specific devices to be equipped; any device which provides the \mathsf {Exc}(\mathsf {build}) capability will do.
- Executing the \mathsf {build} command does require inventory. In particular:
- The child robot will require capabilities \Delta _2 (to evaluate the delayed command) and \Delta _3 (to execute the command); and it specifically must have devices D equipped. Thus we use the provisioning oracle \mathsf {provision}(\Delta _2 \cup \Delta _3, D) to compute a set of devices to install.
- We convert this to an inventory, and union it with the inventory I specifically required to execute p.
- The result is the inventory required of the parent robot to execute \mathsf {build}\;p, since it will need to be transferred to the child robot.