var y1, y2, yS, yAtt :clock; x (* shared variable *) : discrete; a, (* maximum time before updating the variable x *) b, (* time to test again for the variable x *) acc, (* access time, i.e., minimal time between two consecutive accesses to the memory *) ucs, (* maximum duration in critical section *) n, (* non-interference parameter, i.e., minimal time between two consecutive intrusions *) : parameter; --************************************************************-- automaton proc1 --************************************************************-- synclabs : iWant_1, access_1, enter_1, exit_1, no_access_1, pre_access_1, try_1, update_1, error_1; loc idle1: invariant True stop { y1 } when True sync iWant_1 goto iWantToTry1; loc iWantToTry1: invariant True stop { y1 } when x = 0 sync try_1 do {y1 := 0} goto active1; when x > 0 & x < 0 sync error_1 do {y1 := 0} goto idle1; loc active1: invariant y1 < a when y1 < a sync iWant_1 goto iWantToUpdate1; loc iWantToUpdate1: invariant True stop { y1 } when True sync update_1 do {x := 1, y1 := 0} goto check1; loc check1: invariant y1 <= b when y1 = b sync iWant_1 goto iWantNoPre1; loc iWantNoPre1: invariant True stop { y1 } when x = 1 sync pre_access_1 goto pre_access1; when x > 1 & x < 1 sync no_access_1 goto idle1; urgent loc pre_access1: invariant True when True sync iWant_1 goto iWantToAccess1; loc iWantToAccess1: invariant True stop { y1 } when True sync access_1 do {x := 0, y1 := 0} goto access1; urgent loc access1: invariant True when y1 = 0 sync enter_1 goto CS1; loc CS1: invariant y1 <= ucs when 0 < y1 & y1 <= ucs sync exit_1 goto idle1; end --************************************************************-- automaton proc2 --************************************************************-- synclabs : iWant_2, access_2, enter_2, exit_2, no_access_2, pre_access_2, try_2, update_2, error_2; loc idle2: invariant True stop { y2 } when True sync iWant_2 goto iWantToTry2; loc iWantToTry2: invariant True stop { y2 } when x = 0 sync try_2 do {y2 := 0} goto active2; when x > 0 & x < 0 sync error_2 do {y2 := 0} goto idle2; loc active2: invariant y2 < a when y2 < a sync iWant_2 goto iWantToUpdate2; loc iWantToUpdate2: invariant True stop { y2 } when True sync update_2 do {x := 2, y2 := 0} goto check2; loc check2: invariant y2 <= b when y2 = b sync iWant_2 goto iWantNoPre2; loc iWantNoPre2: invariant True stop { y2 } when x = 2 sync pre_access_2 goto pre_access2; when x > 2 & x < 2 sync no_access_2 goto idle2; urgent loc pre_access2: invariant True when True sync iWant_2 goto iWantToAccess2; loc iWantToAccess2: invariant True stop { y2 } when True sync access_2 do {x := 0, y2 := 0} goto access2; urgent loc access2: invariant True when y2 = 0 sync enter_2 goto CS2; loc CS2: invariant y2 <= ucs when 0 < y2 & y2 <= ucs sync exit_2 goto idle2; end --************************************************************-- automaton intruder --************************************************************-- synclabs : iWant_a, att_0, att_1, att_2; loc Att0: invariant True when True sync iWant_a goto iWantToAttFirst; loc iWantToAttFirst: invariant True when True sync att_0 do {x := 0, yAtt := 0} goto Att1; when True sync att_1 do {x := 1, yAtt := 0} goto Att1; when True sync att_2 do {x := 2, yAtt := 0} goto Att1; loc Att1: invariant True when yAtt >=n sync iWant_a goto iWantToAttSecond; loc iWantToAttSecond: invariant True when True sync att_0 do {x := 0, yAtt := 0} goto Att1; when True sync att_1 do {x := 1, yAtt := 0} goto Att1; when True sync att_2 do {x := 2, yAtt := 0} goto Att1; end --************************************************************-- automaton serializer --************************************************************-- synclabs : iWant_a, iWant_1, iWant_2, access_2, no_access_2, pre_access_2, try_2, update_2, access_1, no_access_1, pre_access_1, try_1, update_1, att_0, att_1, att_2, error_1, error_2; (*Transitions of 0*) loc idle: invariant True stop { yS } when True sync iWant_1 do {yS := 0} goto iWant0_1; when True sync iWant_2 do {yS := 0} goto iWant0_2; when True sync iWant_a do {yS := 0} goto iWant0_a; urgent loc iWant0_1: invariant True when yS = 0 sync access_1 do {x := 0} goto delay; when yS = 0 & x = 0 sync try_1 goto delay; when yS = 0 & x > 1 & x < 1 sync no_access_1 goto delay; when yS = 0 sync update_1 do {x := 1} goto delay; when yS = 0 & x = 1 sync pre_access_1 goto delay; when yS = 0 & x < 0 & x > 0 sync error_1 goto delay; urgent loc iWant0_2: invariant True when yS = 0 sync access_2 do {x := 0} goto delay; when yS = 0 & x = 0 sync try_2 goto delay; when yS = 0 & x > 2 & x < 2 sync no_access_2 goto delay; when yS = 0 sync update_2 do {x := 2} goto delay; when yS = 0 & x = 2 sync pre_access_2 goto delay; when yS = 0 & x < 0 & x > 0 sync error_2 goto delay; urgent loc iWant0_a: invariant True when yS = 0 sync att_0 do {x := 0} goto delay; when yS = 0 sync att_1 do {x := 1} goto delay; when yS = 0 sync att_2 do {x := 2} goto delay; loc delay: invariant yS <= acc when yS = acc goto idle; when True sync iWant_1 goto w1; when True sync iWant_2 goto w2; when True sync iWant_a goto wa; (*Transitions of wait*) loc w1: invariant yS <= acc when yS = acc & x = 0 sync try_1 do {yS := 0} goto delay; when yS = acc & x > 1 & x < 1 sync no_access_1 do {yS := 0} goto delay; when yS = acc sync access_1 do {yS := 0, x := 0} goto delay; when yS = acc sync update_1 do {yS := 0, x := 1} goto delay; when yS = acc & x = 1 sync pre_access_1 do {yS := 0} goto delay; when yS = acc & x > 0 & x < 0 sync error_1 do {yS := 0} goto delay; when True sync iWant_2 goto w12; when True sync iWant_a goto w1a; loc w2: invariant yS <= acc when yS = acc & x = 0 sync try_2 do {yS := 0} goto delay; when yS = acc & x > 2 & x < 2 sync no_access_2 do {yS := 0} goto delay; when yS = acc sync access_2 do {yS := 0, x := 0} goto delay; when yS = acc sync update_2 do {yS := 0, x := 2} goto delay; when yS = acc & x = 2 sync pre_access_2 do {yS := 0} goto delay; when yS = acc & x > 0 & x < 0 sync error_2 do {yS := 0} goto delay; when True sync iWant_1 goto w12; when True sync iWant_a goto w2a; loc wa: invariant yS <= acc when True sync iWant_1 goto w1a; when True sync iWant_2 goto w2a; when yS = acc sync att_0 do {yS := 0, x := 0} goto delay; when yS = acc sync att_1 do {yS := 0, x := 1} goto delay; when yS = acc sync att_2 do {yS := 0, x := 2} goto delay; loc w12: invariant yS <= acc when yS = acc & x = 0 sync try_1 do {yS := 0} goto w2; when yS = acc sync update_1 do {yS := 0, x := 1} goto w2; when yS = acc & x = 1 sync pre_access_1 do {yS := 0} goto w2; when yS = acc & x > 1 & x < 1 sync no_access_1 do {yS := 0} goto w2; when yS = acc sync access_1 do {yS := 0, x := 0} goto w2; when yS = acc & x > 0 & x < 0 sync error_1 do {yS := 0} goto w2; when yS = acc & x = 0 sync try_2 do {yS := 0} goto w1; when yS = acc sync update_2 do {yS := 0, x := 2} goto w1; when yS = acc & x = 2 sync pre_access_2 do {yS := 0} goto w1; when yS = acc & x > 2 & x < 2 sync no_access_2 do {yS := 0} goto w1; when yS = acc sync access_2 do {yS := 0, x := 0} goto w1; when yS = acc & x > 0 & x < 0 sync error_2 do {yS := 0} goto w1; when True sync iWant_a goto w12a; loc w1a: invariant yS <= acc when yS = acc & x = 0 sync try_1 do {yS := 0} goto wa; when yS = acc sync update_1 do {yS := 0, x := 1} goto wa; when yS = acc & x = 1 sync pre_access_1 do {yS := 0} goto wa; when yS = acc & x > 1 & x < 1 sync no_access_1 do {yS := 0} goto wa; when yS = acc sync access_1 do {yS := 0, x := 0} goto wa; when yS = acc & x > 0 & x < 0 sync error_1 do {yS := 0} goto wa; when yS = acc sync att_0 do {yS := 0, x := 0} goto w1; when yS = acc sync att_1 do {yS := 0, x := 1} goto w1; when yS = acc sync att_2 do {yS := 0, x := 2} goto w1; when True sync iWant_2 goto w12a; loc w2a: invariant yS <= acc when yS = acc & x = 0 sync try_2 do {yS := 0} goto wa; when yS = acc sync update_2 do {yS := 0, x := 2} goto wa; when yS = acc & x = 2 sync pre_access_2 do {yS := 0} goto wa; when yS = acc & x > 2 & x < 2 sync no_access_2 do {yS := 0} goto wa; when yS = acc sync access_2 do {yS := 0, x := 0} goto wa; when yS = acc & x > 0 & x < 0 sync error_2 do {yS := 0} goto wa; when yS = acc sync att_0 do {yS := 0, x := 0} goto w2; when yS = acc sync att_1 do {yS := 0, x := 1} goto w2; when yS = acc sync att_2 do {yS := 0, x := 2} goto w2; when True sync iWant_1 goto w12a; loc w12a: invariant yS <= acc when yS = acc & x = 0 sync try_1 do {yS := 0} goto w2a; when yS = acc sync update_1 do {yS := 0, x := 1} goto w2a; when yS = acc & x = 1 sync pre_access_1 do {yS := 0} goto w2a; when yS = acc & x > 1 & x < 1 sync no_access_1 do {yS := 0} goto w2a; when yS = acc sync access_1 do {yS := 0, x := 0} goto w2a; when yS = acc & x > 0 & x < 0 sync error_1 do {yS := 0} goto w2a; when yS = acc & x = 0 sync try_2 do {yS := 0} goto w1a; when yS = acc sync update_2 do {yS := 0, x := 2} goto w1a; when yS = acc & x = 2 sync pre_access_2 do {yS := 0} goto w1a; when yS = acc & x > 2 & x < 2 sync no_access_2 do {yS := 0} goto w1a; when yS = acc sync access_2 do {yS := 0, x := 0} goto w1a; when yS = acc & x > 0 & x < 0 sync error_2 do {yS := 0} goto w1a; when yS = acc sync att_0 do {yS := 0, x := 0} goto w12; when yS = acc sync att_1 do {yS := 0, x := 1} goto w12; when yS = acc sync att_2 do {yS := 0, x := 2} goto w12; end --************************************************************-- init:= ---------------------- -- Initial locations ---------------------- & loc[proc1] = idle1 & loc[proc2] = idle2 & loc[serializer] = idle & loc[intruder] = Att0 ---------------------- -- Clocks ---------------------- & y1 = 0 & y2 = 0 & yS = 0 & yAtt = 0 ---------------------- -- Discrete ---------------------- & x = 0 ---------------------- -- Parameters ---------------------- & a > 0 & b >= 0 & n >= 0 & acc >= 0 & ucs > 0 (* & a < b*) (* & n > b *) (* & ucs <= a + b*) ; property := unreachable (loc[proc1] = CS1 & loc[proc2] = CS2); end