-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Type compatibility error message, when reading from .cfg (#2757)
* Manual type check * regression * test files * UL support * . * Update test/tla/Bug2750.cfg Co-authored-by: Thomas Pani <[email protected]> --------- Co-authored-by: Thomas Pani <[email protected]>
- Loading branch information
Showing
8 changed files
with
208 additions
and
42 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
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,7 @@ | ||
\* Add statements after this line. | ||
SPECIFICATION Spec | ||
CONSTANTS | ||
Producers = {p1,p2} | ||
Consumers = {c1,c2} | ||
BufCapacity = 1 | ||
INVARIANT Inv |
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,87 @@ | ||
--------------------------- MODULE Bug2750 --------------------------- | ||
(***************************************************************************) | ||
(* Original problem and spec by Michel Charpentier *) | ||
(* http://www.cs.unh.edu/~charpov/programming-tlabuffer.html *) | ||
(***************************************************************************) | ||
EXTENDS Naturals, Sequences | ||
|
||
CONSTANTS | ||
\* @type: Set(PROC); | ||
Producers, (* the (nonempty) set of producers *) | ||
\* @type: Set(PROC); | ||
Consumers, (* the (nonempty) set of consumers *) | ||
\* @type: Int; | ||
BufCapacity (* the maximum number of messages in the bounded buffer *) | ||
|
||
ASSUME Assumption == | ||
/\ Producers # {} (* at least one producer *) | ||
/\ Consumers # {} (* at least one consumer *) | ||
/\ Producers \intersect Consumers = {} (* no thread is both consumer and producer *) | ||
/\ BufCapacity \in (Nat \ {0}) (* buffer capacity is at least 1 *) | ||
|
||
----------------------------------------------------------------------------- | ||
|
||
VARIABLES | ||
\* @type: Seq(PROC); | ||
buffer, | ||
\* @type: Set(PROC); | ||
waitP, | ||
\* @type: Set(PROC); | ||
waitC | ||
|
||
(* define statement *) | ||
isfull(b) == Len(b) = BufCapacity | ||
isempty(b) == Len(b) = 0 | ||
|
||
\* @type: << Seq(PROC), Set(PROC), Set(PROC) >>; | ||
vars == << buffer, waitP, waitC >> | ||
|
||
ProcSet == (Producers) \cup (Consumers) | ||
|
||
Init == (* Global variables *) | ||
/\ buffer = << >> | ||
/\ waitP = {} | ||
/\ waitC = {} | ||
|
||
p(self) == /\ (self \notin waitP) | ||
/\ IF isfull(buffer) | ||
THEN /\ IF self \in Producers | ||
THEN /\ waitP' = (waitP \union {self}) | ||
/\ waitC' = waitC | ||
ELSE /\ waitC' = (waitC \union {self}) | ||
/\ waitP' = waitP | ||
/\ UNCHANGED buffer | ||
ELSE /\ buffer' = Append(buffer, self) | ||
/\ IF waitC # {} | ||
THEN /\ \E t \in waitC: | ||
waitC' = waitC \ {t} | ||
ELSE /\ TRUE | ||
/\ waitC' = waitC | ||
/\ waitP' = waitP | ||
|
||
c(self) == /\ (self \notin waitC) | ||
/\ IF isempty(buffer) | ||
THEN /\ IF self \in Producers | ||
THEN /\ waitP' = (waitP \union {self}) | ||
/\ waitC' = waitC | ||
ELSE /\ waitC' = (waitC \union {self}) | ||
/\ waitP' = waitP | ||
/\ UNCHANGED buffer | ||
ELSE /\ buffer' = Tail(buffer) | ||
/\ IF waitP # {} | ||
THEN /\ \E t \in waitP: | ||
waitP' = waitP \ {t} | ||
ELSE /\ TRUE | ||
/\ waitP' = waitP | ||
/\ waitC' = waitC | ||
|
||
Next == (\E self \in Producers: p(self)) | ||
\/ (\E self \in Consumers: c(self)) | ||
|
||
Spec == Init /\ [][Next]_vars | ||
|
||
\* END TRANSLATION | ||
|
||
Inv == ~(waitP = Producers /\ waitC = Consumers) | ||
|
||
============================================================================= |
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,8 @@ | ||
INIT | ||
Init | ||
NEXT | ||
Next | ||
INVARIANT | ||
Inv | ||
CONSTANT | ||
C = "1_OF_A" |
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,19 @@ | ||
----------------------- MODULE Test2750 ----------------------------- | ||
VARIABLES | ||
\* @type: A; | ||
x | ||
|
||
CONSTANT | ||
\* @type: A; | ||
C | ||
|
||
|
||
Init == | ||
/\ x = C | ||
|
||
Next == | ||
UNCHANGED x | ||
|
||
Inv == TRUE | ||
|
||
=============================================================================== |
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