-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Fairness constraints cause bogus warning about Spec not in canonical form #468
Comments
Thanks! I will fix that. |
Another example of the same problem:
gives me
crdt.tla ---- MODULE crdt ----
EXTENDS TLC, FiniteSets, Naturals, Sequences
CONSTANTS MAX_TIMESTAMP, KEYS, VALUES, N_NODES
VARIABLES timestamp, values, deliverQueues
vars == <<timestamp, values, deliverQueues>>
nodeIds == 1..N_NODES
DeliverSet(n, t, k, v) ==
LET previous == { <<tp, kp, vp>> \in values[n]: kp = k } IN
IF previous = {} \/ \A <<tp, kp, vp>> \in previous : tp < t THEN
values' = [ values EXCEPT ![n] = (values[n] \ previous) \union {<<t, k, v>>} ]
ELSE
UNCHANGED values
DeliverDelete(n, t) ==
values' = [values EXCEPT ![n] = {<<tp, k, v>> \in values[n] : tp /= t }]
Deliver(n, command, payload) ==
\/ command = "set"
/\ DeliverSet(n, payload[1], payload[2], payload[3])
\/ command = "delete"
/\ DeliverDelete(n, payload)
Broadcast(n, command, payload) ==
/\ Deliver(n, command, payload)
/\ deliverQueues' = [
i \in nodeIds |->
IF i = n THEN
deliverQueues[i]
ELSE
Append(deliverQueues[i], <<command, payload>>)
]
RequestSet(n, k, v) ==
/\ timestamp' = timestamp + 1
/\ Broadcast(n, "set", <<timestamp, k, v>>)
RequestDelete(n, k) ==
\E <<t, kp, v>> \in values[n] :
/\ kp = k
/\ Broadcast(n, "delete", t)
RequestSetOnNode ==
/\ timestamp < MAX_TIMESTAMP
/\ \E <<n, k, v>> \in nodeIds \X KEYS \X VALUES : RequestSet(n, k, v)
RequestDeleteOnNode ==
/\ \E <<n, k>> \in nodeIds \X KEYS : RequestDelete(n, k)
/\ UNCHANGED timestamp
DeliverOnNode ==
\E n \in nodeIds :
/\ Len(deliverQueues[n]) > 0
/\ \E <<command, payload>> \in {Head(deliverQueues[n])} :
Deliver(n, command, payload)
/\ deliverQueues' = [deliverQueues EXCEPT ![n] = Tail(deliverQueues[n])]
/\ UNCHANGED timestamp
DeliverQueuesIsEmpty ==
\A n \in nodeIds: Len(deliverQueues[n]) = 0
Terminating ==
/\ DeliverQueuesIsEmpty
/\ UNCHANGED vars
Init ==
/\ values = [i \in nodeIds |-> {}]
/\ deliverQueues = [i \in nodeIds |-> <<>>]
/\ timestamp = 1
Next ==
\/ RequestSetOnNode
\/ RequestDeleteOnNode
\/ DeliverOnNode
\/ Terminating
Spec == Init /\ [][Next]_vars /\ WF_vars(DeliverOnNode)
AllValuesEqual ==
\A <<n1, n2>> \in nodeIds \X nodeIds :
values[n1] = values[n2]
EventuallyConsistent == <>[]AllValuesEqual
==== crdt.cfg SPECIFICATION Spec
CONSTANTS
MAX_TIMESTAMP = 3
KEYS = {key}
VALUES = {value}
N_NODES = 2
PROPERTIES
EventuallyConsistent |
We are going to fix several bugs for the specs mentioned here and cut a new release on Monday |
This is fixed now and will be included in the release (today). @lemmy, @Alexander-N, if you have further problems with your specs, open an issue or we could chat on zulip. |
Co-authored-by: Shon Feder <[email protected]>
The current fix is too narrow: ---- MODULE M ----
EXTENDS Integers
VARIABLE
\* @type: Int;
x
Init ==
x = 0
Next ==
x' \in 0..42
\* No problem if F is in-lined.
F ==
WF_x(Next)
\* Fails with Configuration error (see the manual): M.cfg: Expected Spec to be in the canonical form Init /\ [][Next]_vars /\ ... E@10:51:44.946
SpecF1== Init /\ [][Next]_x /\ F \* This is not uncommon
SpecF2 == x = 0 /\ [][Next]_x /\ WF_x(Next)
SpecF3 == Init /\ [][x' \in 0..42]_x /\ WF_x(Next)
\* Works
SpecW1 == Init /\ [][Next]_x /\ WF_x(Next)
SpecW2 == Init /\ [][Next]_x /\ WF_x(x' \in 0..42) \* Compare SpecF3
====
|
Btw. it would be nice if |
Yeah, you are right. We should fix the spec. As for the |
This specification Spec == /\ Init /\ [][Next]_vars
/\ \A self \in servers : WF_vars(server(self)) Produced by translaction of this PlusCal algorithm -------------------------- MODULE mod --------------------------
CONSTANT
\* @type: Int;
defaultInitValue,
\* @type: Set(SERVER);
servers
VARIABLES
\* @type: SERVER -> Str;
pc,
\* @type: Int;
s
Inv == TRUE
(*--algorithm main
variables s;
fair process server \in servers
begin
Start:
s := 1;
end process;
end algorithm; *)
===================================================================== Also gives the same error when checked with config SPECIFICATION Spec
CONSTANT
defaultInitValue = 0
servers = { "s1_OF_SERVER", "s2_OF_SERVER" }
INVARIANT Inv
|
The example below has been fixed. For a follow up, see #468 (comment)
The text was updated successfully, but these errors were encountered: