We specify safety and liveness properties to be checked in terms of
temporal logics like
CTL and LTL.
They are the most popular temporal logics, and together they can
express all common safety and liveness properties.
In the following we will restrict our considerations to only a part of
CTL's and LTL's syntax, but for a more detailed description of CTL and LTL
see here.
- Example 1:
The Kit offers several algorithms for checking LTL properties,
and we show how they are used.
- Using PEP:
To invoke the PEP algorithm type the following line:
check cfa:pep-ltl
dekker.cfa
liveness_1.ltl
The following output should appear on your screen:
Time needed: 0.180000 seconds
Result: NO.
Counterexample:
dek2: B1 [ flag2=0 --> flag2=1 ] B2
dek2: B2 [ flag1=0 --> flag1=0 ] B3
dek1: A1 [ flag1=0 --> flag1=1 ] A2
*** loop starts here ***
dek1: A2 [ flag2=1 --> flag2=1 ] A5
dek1: A5 [ turn=1 --> turn=1 ] A2
*** loop ends here ***
- Using PROD:
Type the following line to use PROD:
check cfa:prod-ltl
dekker.cfa
liveness_1.ltl
The following output should appear on your screen:
Time needed: 3.330000 seconds
Result: NO.
Counterexample:
dek2: B1 [ flag2=0 --> flag2=1 ] B2
dek1: A1 [ flag1=0 --> flag1=1 ] A2
*** loop starts here ***
dek1: A2 [ flag2=1 --> flag2=1 ] A5
dek1: A5 [ turn=1 --> turn=1 ] A2
*** loop ends here ***
- Using SPIN:
Type the following line to use SPIN:
check cfa:spin-ltl
dekker.cfa
liveness_1.ltl
The following output should appear on your screen:
Time needed: 0.650000 seconds
Result: NO.
Counterexample:
dek2: B1 [ flag2=0 --> flag2=1 ] B2
dek1: A1 [ flag1=0 --> flag1=1 ] A2
dek1: A2 [ flag2=1 --> flag2=1 ] A5
dek2: B2 [ flag1=1 --> flag1=1 ] B5
dek2: B5 [ turn=1 --> turn=1 ] B6
dek1: A5 [ turn=1 --> turn=1 ] A2
dek2: B6 [ flag2=1 --> flag2=0 ] B7
dek1: A2 [ flag2=0 --> flag2=0 ] A3
dek1: A3 [ turn=1 --> turn=2 ] A4
dek2: B7 [ turn=2 --> turn=2 ] B8
dek2: B8 [ flag2=0 --> flag2=1 ] B2
dek2: B2 [ flag1=1 --> flag1=1 ] B5
dek1: A4 [ flag1=1 --> flag1=0 ] A1
dek2: B5 [ turn=2 --> turn=2 ] B2
dek1: A1 [ flag1=0 --> flag1=1 ] A2
dek1: A2 [ flag2=1 --> flag2=1 ] A5
dek1: A5 [ turn=2 --> turn=2 ] A6
dek2: B2 [ flag1=1 --> flag1=1 ] B5
dek1: A6 [ flag1=1 --> flag1=0 ] A7
dek2: B5 [ turn=2 --> turn=2 ] B2
*** loop starts here ***
dek1: A7 [ turn=2 --> turn=2 ] A7
*** loop ends here ***
- Using DSSZ:
To invoke the DSSZ algorithm type the following line:
check cfa:dssz-ltl
dekker.cfa
liveness_1.ltl
The following output should appear on your screen (note that this checker
does not produce any counterexamples):
Time needed: 0.210000 seconds
Result: NO.
By means of a counterexample we see that the formula specified above does not
hold. This is due to the fact that we do not have considered some
fairness conditions. So, if a process can execute a transition,
the process should execute this transition in finite time.
Consideration of fairness conditions
We change the specification of the dekker algorithm in such a way that we
consider fairness conditions. For the new specification see
here.
Now the formula to be checked looks like the following:
(G F "prcs=1" & G F "prcs=2") =>
G (("trying1" => (F "incs1")) & ("trying2" => (F "incs2")))
We write the formula to a file called
liveness_2.ltl.
The first part of the formula demands that the automata execute
enabled transitions in finite time. So the problem we encountered above
(one process may eexecute a loop infinitely often whereas the other
process stays in a state for an infinte time although it could execute
a transition) can no longer happen.
Now we want to check if this formula holds:
- Using PEP:
check cfa:pep-ltl
dekker_fair.cfa
liveness_2.ltl
The following output should appear on your screen:
Time needed: 299.730011 seconds
Result: YES.
- Using PROD:
check cfa:prod-ltl
dekker_fair.cfa
liveness_2.ltl
The following output should appear on your screen:
Time needed: 12.530000 seconds
Result: YES.
- Using SPIN:
check cfa:spin-ltl
dekker_fair.cfa
liveness_2.ltl
The following output should appear on your screen:
Time needed: 277.800000 seconds
Result: YES.
- Using DSSZ:
check cfa:dssz-ltl
dekker_fair.cfa
liveness_2.ltl
The following output should appear on your screen:
Time needed: 0.770000 seconds
Result: YES.