diff --git a/mCRL2/TrafiicLights/TrafficLights v2_spec_1.lts b/mCRL2/TrafiicLights/TrafficLights v2_spec_1.lts deleted file mode 100644 index 3d85ce2..0000000 Binary files a/mCRL2/TrafiicLights/TrafficLights v2_spec_1.lts and /dev/null differ diff --git a/mCRL2/TrafiicLights/v3/v3.mcrl2proj b/mCRL2/TrafiicLights/v3/v3.mcrl2proj new file mode 100644 index 0000000..044d9f2 --- /dev/null +++ b/mCRL2/TrafiicLights/v3/v3.mcrl2proj @@ -0,0 +1,4 @@ + + v3_spec.mcrl2 + + diff --git a/mCRL2/TrafiicLights/v3/v3_spec.lps b/mCRL2/TrafiicLights/v3/v3_spec.lps new file mode 100644 index 0000000..7165696 Binary files /dev/null and b/mCRL2/TrafiicLights/v3/v3_spec.lps differ diff --git a/mCRL2/TrafiicLights/v3/v3_spec.lts b/mCRL2/TrafiicLights/v3/v3_spec.lts new file mode 100644 index 0000000..dbb6758 Binary files /dev/null and b/mCRL2/TrafiicLights/v3/v3_spec.lts differ diff --git a/mCRL2/TrafiicLights/v3/v3_spec.mcrl2 b/mCRL2/TrafiicLights/v3/v3_spec.mcrl2 new file mode 100644 index 0000000..0ee5f1b --- /dev/null +++ b/mCRL2/TrafiicLights/v3/v3_spec.mcrl2 @@ -0,0 +1,103 @@ +%----------------------------------------------------------------------- + +sort + CardinalDirection = struct north | east | south | west; + +map + otherDirections : CardinalDirection -> Set(CardinalDirection); + +eqn + otherDirections(north) = {east, west}; + otherDirections(south) = {east, west}; + otherDirections(east) = {north, south}; + otherDirections(west) = {north, south}; + +%----------------------------------------------------------------------- + +sort + Colour = struct red | green | yellow; + +map + nextColour: Colour -> Colour; + safeColour: Colour -> Colour; + +eqn + nextColour(red) = green; + nextColour(green) = yellow; + nextColour(yellow) = red; + +%------------------------------------------------------------------------ + +sort + Map = K -> V; + +map + _Map: V -> Map; + +var + k: K; + v: V; + +eqn + _Map(v)(k) = v; + +sort + K = CardinalDirection; + V = Colour; + +map + combinations: Map; + + + +%------------------------------------------------------------------------ + +act + show : CardinalDirection # Colour; + seeColour : CardinalDirection # Colour; + colourSeen : CardinalDirection # Colour; + +%------------------------------------------------------------------------ + +proc + TrafficLight(direction : CardinalDirection) = TL(direction, red); + + TL(direction : CardinalDirection, colour : Colour) = + show(direction, colour) . TL(direction, nextColour(colour)) + ; + + Monitor(status : Map) = + sum direction : CardinalDirection.( + sum c : Colour . + (c == green) -> + (direction == north || direction == south) -> + ((status(east) == red && status(west) == red) -> + seeColour(direction, c) . Monitor(status= status[direction -> c])) + <> + ((status(north) == red && status(south) == red) -> + seeColour(direction, c) . Monitor(status= status[direction -> c])) + <> + seeColour(direction, c) . + Monitor(status= status[direction -> c]) + + ); + + System = + allow({ + colourSeen + }, + comm({ + show | seeColour -> colourSeen + + }, + + TrafficLight(north) || TrafficLight(east) || TrafficLight(south) || TrafficLight(west) || Monitor(_Map(red)) + )); + + + + + +init + System +; \ No newline at end of file