diff --git a/mCRL2/TrafiicLights/TrafficLights v2_spec_1.lts b/mCRL2/TrafiicLights/TrafficLights v2_spec_1.lts new file mode 100644 index 0000000..3d85ce2 Binary files /dev/null and b/mCRL2/TrafiicLights/TrafficLights v2_spec_1.lts differ diff --git a/mCRL2/TrafiicLights/TrafficLights v3_spec.lps b/mCRL2/TrafiicLights/TrafficLights v3_spec.lps new file mode 100644 index 0000000..e498f13 Binary files /dev/null and b/mCRL2/TrafiicLights/TrafficLights v3_spec.lps differ diff --git a/mCRL2/TrafiicLights/TrafficLights v4_spec.lps b/mCRL2/TrafiicLights/TrafficLights v4_spec.lps new file mode 100644 index 0000000..6e39877 Binary files /dev/null and b/mCRL2/TrafiicLights/TrafficLights v4_spec.lps differ diff --git a/mCRL2/TrafiicLights/v2/v2_spec.lps b/mCRL2/TrafiicLights/v2/v2_spec.lps index 431f53f..39315fe 100644 Binary files a/mCRL2/TrafiicLights/v2/v2_spec.lps and b/mCRL2/TrafiicLights/v2/v2_spec.lps differ diff --git a/mCRL2/TrafiicLights/v2/v2_spec.lts b/mCRL2/TrafiicLights/v2/v2_spec.lts new file mode 100644 index 0000000..77fc0b9 Binary files /dev/null and b/mCRL2/TrafiicLights/v2/v2_spec.lts differ diff --git a/mCRL2/TrafiicLights/v2/v2_spec.mcrl2 b/mCRL2/TrafiicLights/v2/v2_spec.mcrl2 index 5d06f0d..8855810 100644 --- a/mCRL2/TrafiicLights/v2/v2_spec.mcrl2 +++ b/mCRL2/TrafiicLights/v2/v2_spec.mcrl2 @@ -19,37 +19,86 @@ sort map nextColour: Colour -> Colour; + safeColour: Colour -> Colour; eqn nextColour(red) = green; nextColour(green) = yellow; nextColour(yellow) = red; + safeColour(green) = red; + safeColour(red) = green; + safeColour(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; crossingUnsafe : Colour # Colour # Colour # Colour; - safe : Bool; - emptyAct; %------------------------------------------------------------------------ proc - TrafficLight(direction : CardinalDirection) = TF(direction, red); + TrafficLight(direction : CardinalDirection) = TL(direction, red); - TF(direction : CardinalDirection, colour : Colour) = - show(direction, colour) . TF(direction, nextColour(colour)) + TL(direction : CardinalDirection, colour : Colour) = + show(direction, colour) . TL(direction, nextColour(colour)) ; - Monitor = - emptyAct - ; + Monitor(status : Map) = + ((status(north) in {green, yellow} || status(south) in {green, yellow}) && (status(east) in {green, yellow} || status(west) in {green, yellow})) + -> crossingUnsafe(status(north), status(east), status(south), status(west)) . delta + + <> + sum direction : CardinalDirection.( + sum c : Colour . + seeColour(direction, c) . + Monitor(status= status[direction -> c]) + ); + + System = + allow({ + colourSeen, + crossingUnsafe + }, + comm({ + show | seeColour -> colourSeen + + }, + + TrafficLight(north) || TrafficLight(east) || TrafficLight(south) || TrafficLight(west) || Monitor(_Map(red)) + )); + init - TrafficLight(north) || TrafficLight(east) || TrafficLight(south) || TrafficLight(west) || Monitor + System ; \ No newline at end of file diff --git a/mCRL2/VendingMachine/VendingMachine_spec.lps b/mCRL2/VendingMachine/VendingMachine_spec.lps index deea810..d73c6aa 100644 Binary files a/mCRL2/VendingMachine/VendingMachine_spec.lps and b/mCRL2/VendingMachine/VendingMachine_spec.lps differ diff --git a/mCRL2/VendingMachine/VendingMachine_spec.lts b/mCRL2/VendingMachine/VendingMachine_spec.lts index a61f92d..b335078 100644 Binary files a/mCRL2/VendingMachine/VendingMachine_spec.lts and b/mCRL2/VendingMachine/VendingMachine_spec.lts differ diff --git a/mCRL2/VendingMachine/VendingMachine_spec.mcrl2 b/mCRL2/VendingMachine/VendingMachine_spec.mcrl2 index 3027a87..0488106 100644 --- a/mCRL2/VendingMachine/VendingMachine_spec.mcrl2 +++ b/mCRL2/VendingMachine/VendingMachine_spec.mcrl2 @@ -18,7 +18,7 @@ sort map value: Coin -> Int; % the value of a coin as an integer - next: Coin -> Int; + next: Coin -> Int; %nächst größerer Betrag eqn value(_5c) = 5; @@ -27,7 +27,7 @@ eqn value(_50c) = 50; value(Euro) = 100; - next(Euro) = 10000; + next(Euro) = 500; next(_50c) = 100; next(_20c) = 50; next(_10c) = 20; @@ -67,18 +67,21 @@ act proc VM(credit : Int) = - (credit < 200) -> sum c : Coin.accept(c).VM(credit + value(c)) + (credit < 200) -> sum c : Coin.accept(c).VM(credit + value(c)) %Coins akzeptieren, solange credit < 2€ - + (credit > 0) -> returnChange(credit).ReturnChange(credit) + + (credit > 0) -> returnChange(credit).ReturnChange(credit)%Geld zurückgeben wenn credit > 0 + sum p : Product.( - (credit >= price(p)) -> offer(p).serve(p).VM(credit - price(p)) + (credit >= price(p)) -> offer(p).serve(p).VM(credit - price(p))%Produkt anbieten, wenn genug credit ); ReturnChange(credit : Int) = - sum c : Coin.((credit >= value(c) && credit < next(c)) -> return(c).( - ((credit - value(c)) > 0) -> ReturnChange(credit - value(c)) <> VM(credit - value(c)) + sum c : Coin.((credit >= value(c) && credit < next(c)) -> %größt möglichen Coin ermitteln + return(c).( %diesen zurückgeben + ((credit - value(c)) > 0) %wenn noch Geld übrig + -> ReturnChange(credit - value(c)) %dieses zurückgeben + <> VM(credit - value(c)) % oder nur abziehen ));