Formal Models - Copy
Formal Models - Copy
Modelling a Node
A single node has a bunch of neighbours
- Can send & receive messages
- Can do local computations
Formally:
- States {X0, X1, X2, X1’}
- Transition function {X0 -> X1, X1 -> X2, X2 -> X1}
- Initial States {X0}
Modelling a Node
State Machine of Node i
- Set of states Qi
Initial States
- inbuf is empty
State of one Node
Example States
Transition Functions
The state of a node, except outbuf, is called the accessible state of a
node.
Transition function f
• Takes accessible state and gives new state
• Removes at most one message from inbuf in new state
• Adds at zero, one, or more new msgs in outbuf of new state
• Possibly modifies local state
Transition Functions Formally
State of a node is triple <s, I, O>
- s is the local state
- I is inbuf
- O is outbuf
- f state transition function
- f(si, Ii, Oi) -> (si + 1, Ii + 1, Oi + 1)
- Removes at one message m from inbuf
o Ii + 1 = Ii / {m}
- Computes a function f’(si, m) -> (si + 1, {m1, …, mn})
- Adds {m1, …, mn} to outbuf
o Oi + 1 = Oi ∪ {m1, …, mn}
Execution
An execution is an infinite sequence of
- config0, event1, config1, event2, config2 …
- config0 is an initial configuration
If eventk is comp(i)
- configk – 1 changes to configk by applying pi’s transition function on i’s
state in configk – 1
If eventk is del(i, j, m)
- configk – 1 changes to configk by applying moving m from i’s outbuf to j’s
inbuf
Example Execution
Event1 Event2
x=4 del(2,3,m7) x=4 Comp(3) x=1
P2 outbuf={m7}
P2
outbuf={} P2 outbuf={}