Created
March 11, 2017 20:25
-
-
Save hwayne/25cbc07bab057087225d997ffaa3755d to your computer and use it in GitHub Desktop.
Formal Methods Example Spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXTENDS Integers, TLC, Sequences | |
CONSTANTS Devices | |
(* --algorithm BatchInstall | |
variables | |
AppScope \in [Devices -> {0, 1}]; | |
Installs \in [Devices -> BOOLEAN]; | |
batch_pool = {}; | |
define | |
PoolNotEmpty == batch_pool # {} | |
end define; | |
procedure ChangeAppScope() | |
begin | |
Add: | |
AppScope := [d \in Devices |-> | |
IF d \in batch_pool THEN AppScope[d] + 1 | |
ELSE AppScope[d] | |
]; | |
Clean: | |
batch_pool := {}; | |
return; | |
end procedure; | |
fair process SyncDevice \in Devices | |
begin | |
Sync: | |
if Installs[self] then | |
batch_pool := batch_pool \union {self}; | |
end if; | |
end process; | |
fair process TimeLoop = 0 | |
begin | |
Start: | |
while TRUE do | |
await PoolNotEmpty; | |
call ChangeAppScope(); | |
end while; | |
end process; | |
end algorithm; *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment