comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: {Pre,Post}conditions and side effects
Date: Mon, 11 May 2015 19:15:27 -0500
Date: 2015-05-11T19:15:27-05:00	[thread overview]
Message-ID: <mirgmv$kgq$1@loke.gir.dk> (raw)
In-Reply-To: cr5jl8Fee0jU1@mid.individual.net

"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
news:cr5jl8Fee0jU1@mid.individual.net...
> On 15-05-09 02:16 , Randy Brukardt wrote:
>> "Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message
>> news:cr1snsF60hoU1@mid.individual.net...
>>> On 15-05-07 22:01 , Randy Brukardt wrote:
...
>>> Those are practical problems, not problems of principle. If you would 
>>> take
>>> the same attitude to mathematics, you would claim that there are no
>>> correct theorems. So I disagree with you.
>>
>> All programming is practical. We do not care about theorems, only that 
>> the
>> current program is correct in the current environment.
>
> You have lost me here: you want to make the compiler prove things, but you 
> do not care about theorems, and do not want to be infected with a "theory" 
> disease? Is Humpty Dumpty involved somehow, making words mean whatever he 
> wants them to mean? :-)

I see no value to "theorems" or "theory" per se; the value is in the 
techniques, not in those end results.

In any case, after years of arguing with Dmitry here, I've learned to take 
on his best approaches to winning an argument. ;-)

...
>> (another good reason for putting it into the compiler, as skipping the 
>> step
>> isn't possible, and thus problems like the Ariene 5 don't happen).
>
> It is true that an optimizing and run-time-check-removing compiler has to 
> make the same kind of analyses and have the same kind of understanding of 
> the program's semantics as a program-proving tool. But constructing a 
> proof from scratch is expensive, unpredictably expensive, and possibly 
> non-terminating, while compilation of source code into machine code should 
> take a time that is reasonable, and reasonably predictable.

I don't see that either is a given. Janus/Ada would run approximately 
forever if we didn't artifically bound the optimization time, and it still 
can take a long time to produce code. If we ever built the link-time code 
generation version, that time would go up by a lot.

As with everything, one can make bad code quickly, or take longer to make 
good code.

Similarly, I don't see any reason that proper proofs should take forever, as 
it is approximately the same problem as optimization and code generation. At 
some point, you give up and decide that something is unprovable. No big 
deal.

> Hitherto, compilers have been expected to remove run-time checks that the 
> compiler can prove to itself are redundant, but not to remove *all* 
> redundant run-time checks. If the latter is required, compilation time 
> becomes unlimited -- a practical problem, no?

If you want truly good code, compilation time should be nearly unlimited. 
But I agree that there is a practical limit, but the same limit applies to a 
proof tool (if you can wait 12 hours for a proof tool, you can wait 12 hours 
for a compilation, too, especially if one can turn that mode off or down, 
just like optimizers).

...
> Ada has always had such features -- principally types, subtypes, ranges --  
> and Ada 2012 has added more -- pre/post-conds and invariants. However, I'm 
> not sure if the features are yet sufficient to let us require, in the Ada 
> standard, that an Ada compiler should be able to prove (rather, to check) 
> exception-freeness, or termination, just to give two examples.

Certainly not yet. One needs exception contracts at a minimum, as otherwise 
one cannot tell between exceptions raised as part of the behavior of a 
subprogram and those which represent bugs.

> I believe it is a good goal for evolving Ada, but of course not the only 
> goal.

I doubt that there is an "only goal", because lots of people have input. I 
happen to think it is the only goal that ulitmately matters, as much of the 
other ideas don't really move the needle in any significant way.

> By the way, if exception contracts are added to Ada, termination contracts 
> should be considered, too.

We already have "blocking" contracts on the drawing board. I don't quite see 
the point of termination contracts, a non-terminating subprogram is wrong 
99.9% of the time. Maybe a "non-termination" contract would make some sense?

                                        Randy.




  reply	other threads:[~2015-05-12  0:15 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-22 16:22 {Pre,Post}conditions and side effects Jean François Martinez
2014-12-22 17:18 ` Brad Moore
2014-12-23  8:22   ` Jean François Martinez
2014-12-23 17:05     ` Robert A Duff
2014-12-23 21:09       ` Jean François Martinez
2014-12-23 21:35         ` Robert A Duff
2014-12-23 23:02         ` Peter Chapin
2014-12-24  1:03           ` Robert A Duff
2015-04-24  8:59             ` Jacob Sparre Andersen
2015-04-24  9:18               ` J-P. Rosen
2015-04-24 23:39                 ` Randy Brukardt
2015-04-24 12:10               ` G.B.
2015-04-24 14:40                 ` Jacob Sparre Andersen
2015-04-24 16:29                   ` G.B.
2015-04-24 23:46                   ` Randy Brukardt
2015-04-24 22:26               ` Peter Chapin
2015-04-25  0:13                 ` Randy Brukardt
2015-04-25  1:01                   ` Peter Chapin
2015-04-25  5:51                 ` Dmitry A. Kazakov
2015-04-25  0:31               ` Bob Duff
2015-04-25 12:08                 ` vincent.diemunsch
2015-04-25 16:37                   ` Georg Bauhaus
2015-05-06 21:07                   ` Randy Brukardt
2015-05-06 22:10                     ` Paul Rubin
2015-05-07  9:01                     ` Georg Bauhaus
2015-05-07  9:12                       ` Dmitry A. Kazakov
2015-05-07  9:29                         ` Georg Bauhaus
2015-05-07  9:31                           ` Georg Bauhaus
2015-05-07 18:32                         ` Randy Brukardt
2015-05-08  7:50                           ` Dmitry A. Kazakov
2015-05-08 23:31                             ` Randy Brukardt
2015-05-09  6:16                               ` Dmitry A. Kazakov
2015-05-12  0:28                                 ` Randy Brukardt
2015-05-12  8:04                                   ` Dmitry A. Kazakov
2015-05-07 10:06                     ` Stefan.Lucks
2015-05-07 12:16                       ` Dmitry A. Kazakov
2015-05-07 18:00                         ` Stefan.Lucks
2015-05-07 19:01                           ` Randy Brukardt
2015-05-07 19:29                             ` Niklas Holsti
2015-05-08 23:16                               ` Randy Brukardt
2015-05-09  5:18                                 ` Niklas Holsti
2015-05-12  0:15                                   ` Randy Brukardt [this message]
2015-05-07 19:55                             ` Dmitry A. Kazakov
2015-05-08 23:24                               ` Randy Brukardt
2015-05-09  5:47                                 ` Dmitry A. Kazakov
2015-05-07 18:52                       ` Randy Brukardt
2015-05-07 19:40                         ` Stefan.Lucks
2015-05-08  7:28                           ` Dmitry A. Kazakov
2015-05-08 22:58                             ` Randy Brukardt
2015-05-08 22:52                           ` Randy Brukardt
2015-05-09  0:14                             ` Paul Rubin
2015-05-12  0:30                               ` Randy Brukardt
2015-05-12 18:10                                 ` Paul Rubin
2015-05-12 22:01                                   ` Randy Brukardt
2015-05-13  9:35                                     ` Dmitry A. Kazakov
2015-05-13 11:53                                       ` G.B.
2015-05-13 12:47                                         ` Dmitry A. Kazakov
2015-05-13 14:06                                           ` G.B.
2015-05-13 14:21                                             ` Dmitry A. Kazakov
2015-05-13 16:33                                               ` G.B.
2015-05-13 19:15                                                 ` Dmitry A. Kazakov
2015-05-14  1:36                                                   ` Randy Brukardt
2015-05-14  7:10                                                     ` Dmitry A. Kazakov
2015-05-14  1:32                                         ` Randy Brukardt
2015-05-14  7:19                                           ` Dmitry A. Kazakov
2015-05-12  0:36                               ` Randy Brukardt
2015-05-11 10:35                             ` Stefan.Lucks
2015-05-11 21:49                               ` vincent.diemunsch
2015-05-11 22:49                                 ` Peter Chapin
2015-05-12  4:49                                   ` vincent.diemunsch
2015-05-12 23:25                                     ` Peter Chapin
2015-05-13  9:00                                       ` vincent.diemunsch
2015-05-12  4:42                                 ` vincent.diemunsch
2015-05-12 14:53                                   ` johnscpg
2015-05-13  9:14                                     ` vincent.diemunsch
2015-05-12  1:03                               ` Randy Brukardt
2015-05-12  7:21                                 ` Georg Bauhaus
2015-05-12 22:08                                   ` Randy Brukardt
2015-05-12  8:02                                 ` Georg Bauhaus
2015-05-12 22:14                                   ` Randy Brukardt
2015-05-12  8:37                                 ` Stefan.Lucks
2015-05-12 11:25                                   ` Stefan.Lucks
2015-05-12 18:44                                     ` Paul Rubin
2015-05-12 20:52                                       ` Stefan.Lucks
2015-05-18  9:49                                     ` Jacob Sparre Andersen
2015-05-18 12:10                                       ` Stefan.Lucks
2015-05-19  7:46                                         ` Jacob Sparre Andersen
2015-06-09  7:55                                           ` Stefan.Lucks
2015-06-09 12:02                                             ` G.B.
2015-06-09 17:16                                               ` Stefan.Lucks
2015-05-12 18:39                                   ` Paul Rubin
2015-05-12 20:51                                     ` Stefan.Lucks
2015-05-12 14:21                                 ` Bob Duff
2015-05-12 22:37                                   ` Randy Brukardt
2015-05-13  6:58                                     ` Georg Bauhaus
2015-05-14  1:21                                       ` Randy Brukardt
2015-05-07 21:29                         ` Georg Bauhaus
2015-05-08 23:11                           ` Randy Brukardt
2015-05-08 23:19                             ` tmoran
2014-12-23 21:53   ` Florian Weimer
2014-12-24 11:41     ` Brad Moore
2014-12-22 19:38 ` sbelmont700
2014-12-22 19:59   ` Brad Moore
2014-12-22 23:46   ` Randy Brukardt
2014-12-23 10:41   ` Georg Bauhaus
2014-12-22 23:32 ` Randy Brukardt
2015-04-24 17:59   ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox