11 ms·
How Did Software Get So Reliable Without Proof? (1996) [pdf]
- tpmx 6y agoThis didn't age very well. Especially the part celebrating "over-engineering" including the explicit duplication of code, instead of re-use, since that is "risky". I do however like the strong emphasis on (manual) testing.
- Jtsummers 6y agoThat section actually criticizes duplication, it does not endorse it: > So it seems safer to take an entirely fresh copy of the existing code, and modify that instead. Over a period of years there arise a whole family of such near-clones, extending over several generations. Each of them is a quick and efficient solution to an immediate problem; but over time they create additional problems of maintenance of the large volumes of code. For example, if a change is made in one version of the clone, it is quite difficult even to decide whether it should be propagated to the other versions, so it usually isn't. The expense arises when the same error or deficiency has to be detected and corrected again in the other versions. Note his use of the phrase "it seems safer", he doesn't say it is safer and at the end explains what the actual risk/expense is with the copy/paste approach. And at the end he discusses the issues with over-engineering in summary: > The limitation of over-engineering as a safety technique is that the extra weight and volume may begin to contribute to the very problem that it was intended to solve. No-one knows how much of the volume of code of a large system is due to over-engineering, or how much this costs in terms of reliability. In general safety engineering, it is not unknown for catastrophes to be caused by the very measures that are introduced to avoid them.
- jpollock 6y agoCode reuse can result in failures. Sometimes those failures are big and loud. The Ariane 5 failure also happened in 1996, which is quite funny. :) https://www.bugsnag.com/blog/bug-day-ariane-5-disaster https://www.bugsnag.com/blog/bug-day-ariane-5-disaster https://www.youtube.com/watch?v=gp_D8r-2hwk https://www.youtube.com/watch?v=gp_D8r-2hwk
- ouid 6y agotl;dr: The testing of code is done by intelligent adversaries.
- Jtsummers 6y agoThat's a poor TL;DR for this paper. It contains a lot more than that.
- ErikAugust 6y agoOne thing I would think helps software is Linus's law: "Given enough eyeballs, all bugs are shallow". https://en.wikipedia.org/wiki/Linus%27s_law https://en.wikipedia.org/wiki/Linus%27s_law As far as I know, this is not something available to other forms of engineering.
- javiramos 6y agoDefinitely true for my domain, mechanical engineering. Enough reviews and bugs will be found and corrected.
- londons_explore 6y agoIn most other fields, there are far fewer eyeballs, because far less work is opensource. If most/all CAD designs were opensource, you can imagine there would be projects underway to automatically "find all screws in the world that are too short to hold the design load". With enough projects of that nature, standards across the entire field will improve.
- amelius 6y agoReminds me of the old jokes that start with "if cars were like computers". https://www-users.cs.york.ac.uk/susan/joke/crash.htm https://www-users.cs.york.ac.uk/susan/joke/crash.htm
- jolux 6y agoI don't think that's true, or at the very least it's misleading. Qualified eyeballs are often expensive, and moreover there are consistent intellectual biases of human beings that interfere with catching all bugs.
- mjw1007 6y agoThe first sentence of the article begins "Twenty years ago", and yet the article itself is undated. This appears to be entirely normal for scientific papers. Can anyone tell me how this foolishness came to be considered acceptable among scientists, and why it persists?
- londons_explore 6y agoBecause traditionally, articles were published in journals, and journals had the date written on the cover, so it was superfluous to add it on every page.
- mjw1007 6y agoThat seems rather sloppy to start with: you could easily end up a year or two out (the date that matters isn't the date of publication, it's the date that was in the author's head when they wrote something like "Twenty years ago"). In any case nowadays I think there's no excuse for this practice continuing. It's far too common for a paper to get sent around, or put on the author's personal website, with no associated date at all.
- thaumasiotes 6y ago> you could easily end up a year or two out (the date that matters isn't the date of publication, it's the date that was in the author's head when they wrote something like "Twenty years ago") Doesn't matter. If the author was thinking of a specific year, they'd say the year. If they say "20 years ago", everything that was "20 years ago" this year is also "20 years ago" a couple years from now.
- mjw1007 6y agoIt's common for papers to include words like "recently", or indeed "has not yet", which are rather more time-sensitive and still don't specify an exact year.
- gmueckl 6y ago
- hcarvalhoalves 6y agoIt didn't - but most errors are simply tolerated because imperfect automation still has absurd economy of scale, very few applications are on a regulated field or have a well-defined quality standard to meet, and unreliable software tends to at least fail consistently, so it's still a win to diagnose and fix processes compared to humans making creative mistakes.
- MattGaiser 6y agoIt is also replacing humans most of the time as well, who are prone to making all sorts of errors. Worse, humans can make the same error twice even after being corrected.
- 7thaccount 6y agoSoftware can also make the same mistake, thousands of times per second or more :)
- jeffasinger 6y agoThose types of errors are usually pretty easy for humans to find and fix.
- king_panic 6y ago"same" is the operative word. Easier to correct the same mistake every time than a different mistake on unpredictable executions.
- redis_mlc 6y agoWell, actually it did. Some of the reasons are: 1) Most applications use very reliable databases as a store. Back in the day, programmers used to write their own one-off BTREE libraries, which stopped with msql/mysql, jet, dbm and sqlite. (A holdover from that era is when interviewers asked you to roll your own sort algorithm, which you should almost never do for production apps.) 2) Some software is fuzzed. 3) Some software has managed memory. 4) Some software has tests.
- Jtsummers 6y agoFrom the conclusion: > Formal methods researchers who are really keen on rigorous checking and proof should identify and concentrate on the most critical areas of a large software system, for example, synchronisation and mutual exclusion protocols, dynamic resource allocation, and reconfiguration strategies for recovery from partial system failure. It is known that these are areas where obscure time-dependent errors, deadlocks and livelocks (thrashing) can lurk untestable for many years, and then trigger a failure costing many millions. It is possible that proof methods and model checking are now sufficiently advanced that a good formal methodologist could occasionally detect such obscure latent errors before they occur in practice. Publication of such an achievement would be a major milestone in the acceptance of formal methods in solving the most critical problems of software reliability. I feel like this presages the way TLA+ (in particular) has had a relative surge among practitioners.
- atdixon 6y agoA relevant paper to discuss alongside this one: https://www.cs.umd.edu/~gasarch/BLOGPAPERS/social.pdf https://www.cs.umd.edu/~gasarch/BLOGPAPERS/social.pdf Social Processes and Proofs of Theorems and Programs Even rigorous mathematics requires social processes to become 'reliable', ie truthful.
- snarkypixel 6y agoAre there any research projects trying to make "proof" programs / languages?
- the_benno 6y agoYes, this is an extremely active area of research with lots of connections in the broader programming languages and formal methods communities. For the last decade or so, POPL has had a co-located workshop on proof, the programs of which would be a great place to see the current state of the art. Here's last year's: https://popl20.sigplan.org/home/CPP-2020#event-overview https://popl20.sigplan.org/home/CPP-2020#event-overview
- Jtsummers 6y agoDependently typed languages may fit what you're asking for. See Idris and the book Type-Driven Development with Idris for an example of encoding critical information into the type system. Beyond that, see SPARK where you're limited to a provable subset of the Ada language (the subset has been extended with each version) so you can make assertions and it will attempt to prove (as part of compilation) that the assertions hold. As in, you could have a function that should always return a non-negative integer, but if it does something like (not fluent, so may be wrong but the principle is correct): function Foo(A : Integer; B :integer) return Integer with Post => Foo'Result > 0; function Foo(A : Integer; B : Integer) return Integer is begin return A - B; end Foo; This should fail when the proof checker is run on this program.
- stan_rogers 6y agoCombine Spark with Z as a specification language and you can get to "correct by construction". The only problem seems to be a reluctance to actually formulate a spec.
- Jtsummers 6y agoYep. I've tried to use Z Notation in the past but haven't had much luck (doesn't help that I had no collaborators so was learning on my own). I've often, also, worked on projects that had decent (but massive and all prose) specs. They would've benefited by formalizing at least portions of them. I'm not sure I'd try to use Z Notation at this point, given that there are other systems out there that seem to fill the same niche but with better tooling. Event-B and TLA+ are the two I've explored the most.
- hyperpallium2 6y agouser find bug, dev fix bug. happy path! other path: dragons be here The tree or tributary structure of software suggests that deeper, more fundamental, more general bugs will be revealed first and frequently. And logically will be fixed at the root, rather than hacking at the myriad leaves... right...?
- yters 6y agobecause humans are halting oracles
- maweki 6y agoI am usually programming in Haskell (the little programming I do besides research) and I try to do property based testing a lot. And of course, you have to come up with the properties to test for when generating test cases. With a proof doubly so, as you need a specification that you can prove your implementation against. In my time in industry (YMMV) I think I've never seen a formal enough specification that would be useful in that sense. I think we're in a specification crisis where behavior is unspecified and documentation diverges from that as well. APIs break regularily and services are down daily. It's a miracle the whole house of cards has not come down yet.
- suyash 6y agoThe proof is in the pudding, software program either works or it doesn't. Also it's never a one time thing like writing a math formula, software is constantly improved until it's not.
- jasonhansel 6y agoIn my view, type systems have replaced formal methods as the main way of enforcing guarantees around program behavior. Type systems are conceptually simpler, and although they aren't nearly as powerful as formal verification, they're good enough for many common purposes.
- angel_j 6y agoObviously because it just works.
- lmilcin 6y agoI think the reason is natural selection. Since the beginning of computer software (and computer hardware) the solutions that were not reliable enough for practical purposes were discarded.
- hyperman1 6y agoI've seen a paper provide a natural selection model of bugs: If a bug occurs frequently enough, someone will bother to fix it. Hence, popular software has less bugs and becomes more popular. Using popular software in a different way will trigger unfound bugs. Security bugs were special, as nobody triggers them by default. There is no selection pressure to make them disappear.
- lmilcin 6y agoI think of bugs as signal. Bugs are energy of noise on continuous spectrum where frequency describes types of bugs. When you write software you generate initial signal which will depend on what you are doing and your ability (awareness of different types of bugs, etc.) Then during further stages of testing these bugs tend to be filtered out. Some types of bugs are attenuated very efficiently. For example a bug that would cause your application to not compile would have very little chance of being shipped... Some bugs are only detected (as signal) only in some circumstances. For example, users use a detector that has different characteristics from the detector used by developer. You don't generally want to invest in attenuating all frequencies. What you do is you ignore frequencies that don't matter (that just pass and cause no harm) and focus on harmful frequencies. In the end, the best way to reduce the output noise of the system is usually to reduce the input noise (ie. signal produced by developer).
- thefifthsetpin 6y agoProof is how the authors of this paper discovered that OpenJDK's java.utils.Collection.sort() was broken http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf http://envisage-project.eu/wp-content/uploads/2015/02/sortin...
- dehrmann 6y agoI'm not sure if that's a victory or a loss for formal proofs. Sure, it found the bug, but for a language that popular, it wasn't a very meaningful bug, and sorting algorithms is one of the easier things to analyze.
- ookdatnog 6y agoFor algorithms without provided proof, we can only estimate their correctness based on how battle-tested they are. If an algorithm has been run many times and it has been correct every one of those times, then we feel somewhat confident that we got it right. Over time, we'll find weird edge cases where it doesn't work, and fix them. Few algorithms are as battle-tested as the sorting algorithm from the Java standard library. I can't even estimate how many calls are made to this function every day. The fact that we can still find bugs in it, no matter how obscure, suggests to me that we simply can't write correct nontrivial software without proof. The victory isn't in showing that this specific algorithm is incorrect in some fairly obscure way. It's in the fact that even software that's this battle-tested is still not fully reliable.
- dehrmann 6y ago> even software that's this battle-tested is still not fully reliable But does it matter? I also don't understand formal methods well, but wouldn't they also be subject to bugs? It seems like all we can do is make software less unreliable.
- ookdatnog 6y ago> But does it matter? That depends on the application. It probably doesn't most of the time. My point is not that it is always economical to use formal methods, just that I suspect their cost is overestimated compared to the benefit (because most programmers are simply unfamiliar with FM). > I also don't understand formal methods well, but wouldn't they also be subject to bugs? Yes, they are. There are multiple classes of errors FM are vulnerable to. 1. In FM you prove your code correct with respect to a specification. But you can make errors in the specification too. The arguments for FM are: a) the spec is much smaller than the program, so the opportunity for error is lower, and spec errors are more obvious; b) often if your spec is wrong, you'll find out when you try to prove your algorithm; and c) combining testing with FM is very likely to uncover whatever errors are left. 2. If your proof of correctness is not mechanically verified, then you may still have trivial implementation errors like mixing up variables and the like. 3. If it is mechanically verified, then theoretically there's still opportunity for errors. The verifier might contain a bug, the compiler might contain a bug, the hardware you run the algorithm on might contain a bug, cosmic radiation may flip a bit during the verification/compilation process, invalidating the correctness, etc. I can soapbox about the implications of this but I will only do that when prompted to :) So indeed, there is no method that gives you zero probability of failure. But you can get the probability orders of magnitude lower, which may be worth it depending on what you're working on.
- AnimalMuppet 6y agoFirst: Software got so abundant without proof. How much of an effort is a formal proof of a program? I suspect that it's at least as much effort as the total effort of writing the program, and maybe several times that. If I'm right, then formally proving all programs would result in more than twice as much effort, which would mean less than half as much software. So, think of all the programs that you interact with in a day. Now think of a world where half of those programs simply do not exist. Is that better than this world of buggy programs? Or worse? Second: Programs got so reliable by killing the bugs that made them most unreliable. That is, if a program has two bugs, one of which 10% of people hit, and one of which 0.0001% of people hit, the 10% bug gets fixed. The program is still buggy, but it's buggy in a way that most people never encounter. And third: For (many kinds of) formal proof, you need a formal specification. Much of software is somewhat discovered. (What's the right user interaction flow for this, anyway? Let's try some ideas out and see.) If you write the formal specification before you have really discovered what the software should be, then you can have formally-proven software that does less-than-optimal things. And then you can have bugs in the specification. (Hello, MCAS!) Formally proving that you correctly implemented an incorrect spec does not make the software more correct.
- Jtsummers 6y ago> First: Software got so abundant without proof. How much of an effort is a formal proof of a program? I suspect that it's at least as much effort as the total effort of writing the program, and maybe several times that. If I'm right, then formally proving all programs would result in more than twice as much effort, which would mean less than half as much software. So, think of all the programs that you interact with in a day. Now think of a world where half of those programs simply do not exist. Is that better than this world of buggy programs? Or worse? I don't think it'd require twice the effort unless you insisted on a full and complete formal proof of the entire program. Which most contemporary advocates of formal methods do not want (and this paper basically concurs with). Rather, see TLA+ where the advocation is for people to model critical parts, or the concurrency model, or the synchronization model of their distributed system. You can elide so many details that it's nowhere near the same level of work as actually writing the full program, but can inform your design so that you spend less time reworking later. OTOH, I've seen lots of programs where the testing comprises at least as much effort, if not some small integer multiple, as the actual coding portion. But no one is advocating for removing tests (though some people strongly despise, if not outright hate, certain test approaches).
- k__ 6y agolol, tell that functional programming proponents. They will tell you that current software is basically crap and they can't understand how the majority tolerates this state of affairs.
- marta_morena_25 6y agoThis is common misconception of students or perhaps research people, who don't need to actually earn money with their projects. Software needs to be as reliable as it needs to be to satisfy customers and not erode customer trust. And that's it. Now sure, you can proof everything mathematically and ship your fitbit application within 10 years instead of 10 days, but there are more than a few problems with this approach: 1. You will be bankrupt before you even proved the first theorem 1. Your proofs will turn out to not align with realities of a real world environment 1. Hardware has bugs 1. Software you depend on has bugs 1. Requirements change like a flag in the wind, i.e. 100 times faster than you can prove your little theorems 1. Customers don't give a shit if your fitbit app is never crashing and always does what you think it should do. Especially if its 10 years outdated and doesn't do what customers want lol.
- tus88 6y agoUnit testing.
- disown 6y agoBecause reliable and proof are not the same concepts and one is not needed for the other. Proof is logical certainty for all time ( in the past, present and future ). Reliability is not. Reliability doesn't require mathematical proof - this goes for airplanes to your kitchen faucet to software. Software became more and more reliable through testing, errors, fixes/patches, etc. Also, many times good enough is good enough. We don't need the perfect for most situations. Also, it's a subjective call too. For some software is an unreliable mess and we need to throw everything out and rebuild it from scratch. Search for haskell, rust, etc threads. The neverending arguments against side-effects, mutation, pointers, etc. For most, they are good enough and get the job done.
- xmprt 6y agoProofs are only valid as long as the requirements don't change and assumptions are still valid. Two things that any first year CS student could tell you are absurd to even imagine.
- MaxBarraclough 6y agoYou seem to be dismissing formal methods, but they've been used successfully in various domains.
- chas 6y agoThe control systems for airplanes often have a significant number of mathematical proofs.
- nimish 6y agoSure because the alternative is death Me shit posting is not a life or death situation so a bug here or there is fine
- thereisnospork 6y agoThe bolts don't, and yet they don't (usually) fail.
- senthil_rajasek 6y agoThe title seems to suggest that software or computer programs are provable. They are not. Programs or algorithms only guarantee that they can go from one state to another state. Somehow computer programs have been conflated with relability and proof possibly because of close adjacency to mathematics.
- MR4D 6y agoNatural Selection. If you account for survivorship bias, I would bet that software is not very reliable.
- doonesbury 6y agoAgree. Plus plenty of labor has gone into customer facing bugs that autos, hw, consumer electronics etc prob wouldn't stand for. And we build on hw which is formally verified.
- viluon 6y ago> And we build on hw which is formally verified. Ehm, what?
- Jtsummers 6y agoIntel (and presumably others) use formal methods to verify their hardware designs, or at least large portions of them. This started in earnest after the FDIV bug. Here's a presentation on the topic (dated now, but my understanding is the use of formal methods has only increased since then). https://www.cl.cam.ac.uk/~jrh13/slides/nijmegen-21jun02/slides.pdf https://www.cl.cam.ac.uk/~jrh13/slides/nijmegen-21jun02/slid...
- doonesbury 6y agoSoftware ... the part that software developers write ... is created to run on a strong foundation of CPU, GPU, NICs, RAM, PCI buses, SSD and so on (which the EE, ChemE, Chem, math, physics people make). That makes our stuff better than if it was software all the way down. HW is formally verified.
- ransith 6y agoIn my opinion its just not practical for most programmers to understand a book like "The science of programming" and consciously apply proofs each time they write code. Most programs can be delivered with bugs, These can be discovered and corrected over time. So having strong QA teams as an alternative to proofs should be the reason of having and abundance of reliable software.
- Jtsummers 6y agoWhich is part of the discussion in the paper.
- bamboozled 6y agoUncountable man hours going into squashing bugs, Googling, trial and error, getting it to work, and not touching it.
- jillesvangurp 6y agoUncle Bob makes some interesting points about software testing and scientific methodology. His main point is that science is mostly not about proving things correct but about attempting to find ways to falsify an hypothesis by doing experiments. Failing to do falsify means the hypothesis is more likely to be true at some level. It could still be wrong or imperfect and theories are often refined or replaced by new theories. Science is about trying to find ways to prove things wrong and occasionally failing to do that in interesting ways. The more you fail at that, the better a theory becomes. If you succeed (by failing), you refine your theory and run more experiments. Software testing is exactly the same. The more tests you have, the more evidence you build up that the theory that the software is incorrect in some way may be wrong. If you find out about a new way it could still be wrong, you write a test to prove that wrong. And then if you are right about that, you fix the software.
- raverbashing 6y agoUncle Bob is insufferable and thinks that anything less than 100% testing and your code doesn't work. > The more tests you have, the more evidence you build up that the theory that the software is incorrect in some way may be wrong. Or you could actually use the software. You can have 100% unit tests passing and a completely broken integration. He's not exactly wrong in that analogy but I think that in practice such utopia does not exist.
- jillesvangurp 6y agoI'm not advocating TDD either. But he has a point that testing (manual or automated), or even just using the software is a form of experimentation and thus a perfectly valid and scientific way of assessing whether software works or not.
- jondubois 6y agoFormal proofs are useless because most systems in the real world are far too complex to be formally verified. The formal proofs for most systems would be so long and complex that they would be almost guaranteed to suffer from human error; the proofs are much more likely to have errors than the underlying code itself. It is a tool invented by bureaucrats for the sole purpose of job creation. If society keeps becoming more bureaucratic, soon enough, someone will invent the concept of unit testing for formal proofs... There is no limit to how ridiculous this can get. The Fed's mandate is job creation, and job creation is just what it'll do! Any job! Mostly useless jobs!
- TheCoelacanth 6y agoMost real world systems would be practically impossible to even write a formal specification for, much less actually prove that the system follows it correctly.
- jmnicolas 6y agoI don't know for others but my software became reliable because my users work a few meters from me and have no problem coming to my desk and question my dev skills after finding a bug :)