News for hackers. Stuff that matters.
Re:TLA+ by virgil_disgr4ce on Monday March 08, 2021 @09:45AM (#26386292)
How valuable is TLA+ for non-concurrent applications? I've always been interested in formal verification (is TLA+ technically that?).
Re:TLA+ by hwayne on Monday March 08, 2021 @03:31PM (#26391103)
If you don't have any concurrency or nondeterminism in your spec, then you'll probably want different tools. It's not that TLA+ is bad at modeling single-threaded algorithms, it's just that makes a lot of design decisions around representing concurrency, and there's an opportunity cost to that. I'd consider a code-level formal verification language, like Liquid Haskell or Dafny.
Re:TLA+ by Taikonerd on Monday March 08, 2021 @11:24AM (#26387434)
> How valuable is TLA+ for non-concurrent applications?

My understanding is that TLA+ is for concurrent applications, but with a broad definition of "concurrent." For example, it could be...

* multiple hosts messaging each other

* multiple threads in one process sharing a data structure

* multiple API calls that all use the same Postgres DB

In other words, any sort of system where different actors can step on each others' toes.

Re:TLA+ by flazzarino on Monday March 08, 2021 @02:31PM (#26390387)
You define variables and code that changes the variables over time. TLA+ lets you observe variable states and assert constraints. The amount of concurrency is up to you, it works fine with a single process.

Non-determinism might be a better thing to anchor the value to. For example in a deterministic "normal" programming environment, an if/then/else statement will execute only one out of two possible code paths. You have to run the code with a complementary condition to observe the other code path.

In a non-deterministic environment like TLA+ both possible code paths are executed. You can observe state transitions in both possibilities.

In a deterministic context the combinatorics of code paths can get out of hand quickly. Non-deterministically you have one set of assertions for all code paths, or patterns of paths.

Re:TLA+ by Jtsummers on Monday March 08, 2021 @12:53PM (#26388997)
That's definitely the main use. But TLA+ can also be applied to single threaded specifications by encoding various invariants (pre/post conditions on entry and exit, loop invariants).
Re:TLA+ by colonelcanoe on Monday March 08, 2021 @10:21AM (#26386658)
You can construct formal proofs about a TLA+ spec, using the "TLA proof system" (TLAPS). Or, you can verify properties for "bounded models" of your spec via brute force.

The latter is much less overhead, so it's good to use bounded models (with the TLC model checker) to become confident in the spec, then construct proofs if warranted.