-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
97 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
/states | ||
/temporary.cfg | ||
|
||
/examples/bool.tla | ||
/examples/init.tla | ||
/examples/int.tla | ||
/examples/seq.tla | ||
/examples/set.tla | ||
/examples/struct.tla | ||
/examples/temp.tla |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
---- MODULE threads ---- | ||
EXTENDS TLC, Sequences, Integers, init | ||
|
||
NumThreads == 2 | ||
Threads == seq!range(1, NumThreads) | ||
|
||
VARIABLES counter, pc | ||
|
||
AllDone == | ||
seq!all(Threads, LAMBDA t: pc[t] = "Done") | ||
|
||
Correct == | ||
bool!implies(AllDone, int!eq(counter, NumThreads)) | ||
|
||
|
||
vars == << counter, pc >> | ||
|
||
ProcSet == (Threads) | ||
|
||
Init == | ||
/\ int!is_zero(counter) | ||
/\ pc = [self \in ProcSet |-> "IncCounter"] | ||
|
||
IncCounter(self) == | ||
/\ pc[self] = "IncCounter" | ||
/\ counter' = int!inc(counter) | ||
/\ pc' = [pc EXCEPT ![self] = "Done"] | ||
|
||
thread(self) == IncCounter(self) | ||
|
||
(* Allow infinite stuttering to prevent deadlock on termination. *) | ||
Terminating == | ||
/\ seq!all(ProcSet, LAMBDA self: pc[self] = "Done") | ||
/\ UNCHANGED vars | ||
|
||
Next == | ||
\/ seq!any(Threads, thread) | ||
\/ Terminating | ||
|
||
Spec == Init /\ [][Next]_vars | ||
|
||
Termination == temp!eventually( | ||
seq!all(ProcSet, LAMBDA self: pc[self] = "Done") | ||
) | ||
|
||
==== |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
---- MODULE int ---- | ||
---- MODULE init ---- | ||
|
||
\* boolean operations | ||
bool = INSTANCE bool | ||
bool == INSTANCE bool | ||
|
||
\* operations with integer numbers | ||
int = INSTANCE int | ||
int == INSTANCE int | ||
|
||
\* operations on ordered sequences of values (tuples) | ||
seq = INSTANCE seq | ||
seq == INSTANCE seq | ||
|
||
\* operations on onordered collections of unique values (sets) | ||
set = INSTANCE set | ||
set == INSTANCE set | ||
|
||
\* temporal logic operations (checking how values change over time) | ||
temp = INSTANCE temp | ||
temp == INSTANCE temp | ||
|
||
struct = INSTANCE struct | ||
struct == INSTANCE struct | ||
==== |
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
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