Go up to B.5 Verification Go forward to Invariants |
The following definitions capture the measures we are interested in:
Definition. [Network Value] The network value valuenet is the sum of all node deposits plus the sum of the values of all messages being processed in some node plus all channel values:valuenet := Sumi (depositi + mvalue(messagei)) + Sumc cvalue(c).
Definition. [Channel Value] The channel value cvalue(c) of a channel c is the sum of all message values in c:cvalue(c) := Sumk mvalue(c[k])
Definition. [Message Value] The message value mvalue(m) of a message m is the value carried by m, if m is a value message, and 0, otherwise:mvalue(m) :=
m.getValue() if m instanceOf ValueMessage 0 else
The correctness theorem for our program can be then expressed as follows:
Theorem. [Correctness] When a node terminates, its totalValue equals the network value:modei = TERMINATED => totalValuei = valuenet