Clock Synchronization with Apalache
October 7, 2021 ยท View on GitHub
Version 1: Introducing clocks
-
Open ClockSync1 and MC_ClockSync1.
-
Notice how the variables
time,hc, andadjare declared. -
Check the type annotations that start with
@type. -
Check the test in MC_ClockSync1.
-
Run:
$ apalache check --init=Test1_Init \ --next=Test1_Next --inv=Test1_Inv --length=1 MC_ClockSync1.tla -
The tool reports no error.
Version 2: Sending messages
-
Open ClockSync2 and MC_ClockSync2.
-
Check constants
t_minandt_max. -
Notice that variables
msgsandstateare added. -
Check the test in MC_ClockSync2.
-
Run:
$ apalache check --init=Test2_Init \ --next=Test2_Next --inv=Test2_Inv --length=1 MC_ClockSync2.tla -
The tool reports no error.
Version 3: Receiving messages
-
Open ClockSync3 and MC_ClockSync3.
-
Notice that variable
rcvdis added. -
Check the test in MC_ClockSync3.
-
Run:
$ apalache check --init=Test3_Init \ --next=Test3_Next --inv=Test3_Inv --length=1 MC_ClockSync3.tla -
The tool reports no error.
Version 4: Adjusting clocks
-
Open ClockSync4 and MC_ClockSync4.
-
Notice that variable
diffis added. -
Check the test in MC_ClockSync4.
-
Run:
$ apalache check --init=Test4_Init \ --next=Test4_Next --inv=Test4_Inv --length=1 MC_ClockSync4.tla -
The tool reports no error.
-
Check the invariant
SkewInvin ClockSync4. -
Run:
$ apalache check --inv=SkewInv MC_ClockSync4.tla -
The tool reports an error. Open
counterexample1.tla.
Version 5: Ignoring self-messages
-
Open ClockSync5 and MC_ClockSync5.
-
Notice the changes in
AdjustClock. -
Run:
$ apalache check --inv=SkewInv MC_ClockSync5.tla -
The tool reports no error.
Version 6: Parameterizing the set of processes
-
Open ClockSync6 and MC_ClockSync6.
-
Notice that we made
Proca constant. -
Check the operator
DiffSumand how it is used. -
Run:
$ apalache check --inv=SkewInv MC_ClockSync6.tla
Version 6p: ConstInit to check arbitrary t_min and t_max
-
Open MC_ClockSync6p.
-
Check the operator
ConstInit. -
Check how we have changed the bound in
SkewInv. -
Run:
$ apalache check --cinit=ConstInit --inv=SkewInv MC_ClockSync6p.tla -
The tool reports no error.