From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,37e683828bae12e2 X-Google-Attributes: gid1014db,public X-Google-Thread: 1164f8,b0b9a5eaad4ab6eb X-Google-Attributes: gid1164f8,public X-Google-Thread: 1008e3,37e683828bae12e2 X-Google-Attributes: gid1008e3,public X-Google-Thread: f8c65,37e683828bae12e2 X-Google-Attributes: gidf8c65,public X-Google-Thread: 109fba,37e683828bae12e2 X-Google-Attributes: gid109fba,public From: Ruud Bruijnesteijn Subject: Re: [++] Tight coding Date: 1998/03/03 Message-ID: <34FB49B0.DF95B725@sds-sportdata.com>#1/1 X-Deja-AN: 330196251 Content-Transfer-Encoding: 7bit References: <6csl81$rb9@news-rocq.inria.fr> <34F3B7C5.5FD1@earthlink.net> <34F49435.B6307838@hda.hydro.com> <6dbgjv$lg$1@andros.cygnus.com> <34F97152.DBF199BD@sds-sportdata.com> <6dcdvp$6oa$1@mainsrv.main.nc.us> <34FB377C.C54C0FCE@acm.org> X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Organization: SDS Sport.Data.Systems GmbH Mime-Version: 1.0 Newsgroups: comp.sys.dec,comp.lang.c++,comp.lang.c,comp.lang.modula2,comp.lang.modula3 Pete Becker wrote: > > Terry Moore wrote: > > > > That is not the way to use proofs of programs. It's much easier > > to develop the proof along with the program, so it's the > > programmer's task, not the mathematician's. > > Which does not change the preceding fact. The issue is not whether these > things take time, but how much time they take. In order for this > approach to be cost effective you need to show that proving correctness > requires less time than fixing defects, which you have not done. It will be pretty damn difficult to show that in a general case, however a simple look at practical software should suffice ;-). I think there is literature that indicates practical gains of up to 40% in total devellopment time, however. Terry is right, and I'd like to follow up that proving the correctness of a program is quite simple as long as a program is develloped using stepwise refinement and using logical abstractions. I think this is what Terry means when he says 'along with the program'. Split the program into enough modules and procedures for which pre- and postconditions are clear, and you'll end up with trivial proof for these procedures. Now, by way of induction, it will be possible to prove the entire program. You'll need a decent programming language to make this statement valid though! I can tell you in Modula-2 it can be done. Once a program proven this way compiles it will be error-free. It can be done in C too, but there you'll be on your own; the compiler won't help you. I'll admit however, that it is not as simple as that, since there is allways the human factor, creating typo's, errors while copying the algorithms etc. But these errors are quite easily spotted in trivial procedures. So, making a point that proof is (or can be) trivial, you will easily deduct that the actual time it takes to proof is neglectable, certainly when compared to the time wasted on debugging. -- Ruud Bruijnesteijn SDS Sport.Data.Systems GmbH http://www.sds-sportdata.com