|
|
|
|
|
by tombert
2 days ago
|
|
I mean, just for this particular example, you could certainly also add a check that the sorted list is the same length as the input list. That said, your broader point is more or less correct. I think the advantage of something like TLA+ is that the specs can generally be more abstract and as such the checks can be more exhaustive than you would likely get with regular "code". With concurrent code, in particular, it can be difficult to know if your algorithm is correct, especially without the confounding variables that you get with a "real" programming language. Is my program broken because of some memory allocation quirk? Is it broken because of some peculiarity with how pthreads are dispatched? Or is my design wrong? Being able to work at an abstract level at least can check the last part. Of course, though, you are correct that formal methods aren't silver bullets. |
|
And of course, that raises the issue of what do you want to do about ties....