Weak fairness until a majority

31 views
Skip to first unread message

Jack Vanlightly

unread,
Dec 8, 2022, 7:59:25 AM12/8/22
to tlaplus
Hi all,

Let's say that I have an ensemble of nodes and each node has a counter. I have the action Increment which increments the counter of a node, if the value is 0.

Increment == 
    \E n \in Nodes : 
        /\ counter[n] = 0
        /\ counter' = [counter EXCEPT ![n] = @ + 1]

I would like to express weak fairness of Increment, but only while a minority of nodes have incremented their counter. So once a majority have incremented their counter, the weak fairness no longer applies.

Is there a way of defining weak fairness in this way?

Thanks
Jack Vanlightly

Stephan Merz

unread,
Dec 8, 2022, 11:29:56 AM12/8/22
to tla...@googlegroups.com
How about

Nodes0 == {n \in Nodes : counter[n] = 0}
Nodes1 == {n \in Nodes : counter[n] = 1}
WF_vars(Card(Nodes0) > Card(Nodes1) /\ Increment)

Stephan

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/b32e95fb-e3db-4425-84d7-c0392ead61bcn%40googlegroups.com.

Hillel Wayne

unread,
Dec 8, 2022, 11:44:03 AM12/8/22
to tla...@googlegroups.com
One tweak, if `counter` is unbound then it should be

Nodes0 == {n \in Nodes : counter[n] = 0}
NodesInc == {n \in Nodes : counter[n] >= 1}
WF_vars(Card(Nodes0) >= Card(NodesInc) /\ Increment)

Jack Vanlightly

unread,
Dec 8, 2022, 12:21:46 PM12/8/22
to tlaplus
So if I want to express weak fairness of an action with some conditions, I simply write WF_vars(conditions /\ MyAction)?

Markus Kuppe

unread,
Dec 8, 2022, 12:29:08 PM12/8/22
to tla...@googlegroups.com
Yes, just recall WF_v(A) <=> <>[](ENABLED <<A>>_v) => []<>(<<A>>_v) . Your condition or A in general rather may be any action-level formula. For a concrete example, see https://github.com/lemmy/BlockingQueue/blob/14a1baed2dd80ce83f32687c67749b39320ea121/BlockingQueue.tla#L136-L143.

Markus

Jack Vanlightly

unread,
Dec 8, 2022, 5:42:17 PM12/8/22
to tlaplus
Great, I get it, thanks to you all!
Reply all
Reply to author
Forward
0 new messages