News for hackers. Stuff that matters.
Re:Learn TLA+ (2018) by akersten on Sunday April 14, 2019 @05:56PM (#19661945)
In the landing page example:

> But if we run the model checker, we find that’s not true: Alice could trade an item to herself and, before that process finishes running, resolve a parallel trade giving that same item to Bob. Then the first trade resolves and Alice gets the item back.

How does the model checker know that "parallel threads" are even a possibility here? It seems like it's checking what amounts to a leaky abstraction from the actual implementation of this algorithm.

In my mind a strictly logical validator would look at the proposed algorithm and say it checks out (since in math-land transactions are atomic). Is this just a feature of the model checker? Can it be turned off/tuned to the expected real-world implementations of the algorithm?

Re:Learn TLA+ (2018) by loup-vaillant on Sunday April 14, 2019 @06:30PM (#19662078)
TLA+ is originally mainly meant to check for concurrency bugs, so the possibility of parallel threads is kind of in its core DNA. The name "process" might also give a hint that parallel threads are indeed possible.

I don't know how, but I expect you can indeed model actual transactions.

Re:Learn TLA+ (2018) by hwayne on Sunday April 14, 2019 @10:01PM (#19662780)
Depends on what you mean by "actual transaction". Every TLA+ behavior is describable as a series of "next-states", where _usually_ (not always, but _usually_) one action is true. In which case you'd model the transaction by determining the changes that the overall transaction makes and then declaring them all as part of a single action.
Re:Learn TLA+ (2018) by strangecasts on Sunday April 14, 2019 @06:32PM (#19662087)
PlusCal uses labels (e.g. "Give:") to designate atomic actions - when you translate it, each labelled section is turned into an atomic action [1]. You can start off with a very simple spec with totally atomic transactions, and gradually make it more granular by introducing more labels, as shown in Wayne's Strange Loop presentation [2]

[1] https://learntla.com/concurrency/labels/ [2] https://youtu.be/_9B__0S21y8?t=955 (15:55)

Re:Learn TLA+ (2018) by hwayne on Sunday April 14, 2019 @09:33PM (#19662696)
A general rule-of-thumb in TLA+ is "default is worst-case". If you don't explicitly declare your actions are fair, they'll be unfair. If you don't explicitly encode atomicity into your spec, it's not atomic.

Much better to accidentally get a false positive than a false negative.

Re:Learn TLA+ (2018) by gmfawcett on Sunday April 14, 2019 @06:30PM (#19662080)
It's a feature. When you specify the algorithm, you also specify which actions are atomic, and which aren't.