comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: The future of Spark . Spark 2014 : a wreckage
Date: Fri, 12 Jul 2013 10:02:28 +0200
Date: 2013-07-12T10:02:28+02:00	[thread overview]
Message-ID: <1lhsyg46iz9jj.8jrvydqxt8l6.dlg@40tude.net> (raw)
In-Reply-To: krnbig$jl6$1@loke.gir.dk

On Thu, 11 Jul 2013 17:28:31 -0500, Randy Brukardt wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
> news:1s6sw93u97355$.1n0205ucj6251.dlg@40tude.net...

>> How do you know that the copy you made is authentic? What is about the 
>> accuracy of the implementation?
> 
> That's easily determinable by unit tests (which are needed in any case - 
> testing and proof are not exclusive, you need both because it's real easy to 
> prove the wrong thing).

Firstly, you propose to replace proofs with tests, which automatically
disqualifies the answer.

Secondly, it does not work anyway. One famous example was given by Forsythe
in his book on numerical methods. It is solving quadratic equation using
school formula. In some cases (when roots are close to each other) the
accuracy catastrophically drops for one root and increases for another. You
*cannot* catch such stuff through tests. Only analysis can, and analysis is
equivalent to proofs.

>>>>> What's too hard shouldn't be bothered with, because we've lived just
>>>>> fine with no proofs at all for programming up to this point.
>>>>
>>>> We didn't. Accessibility checks and constraint errors are a permanent
>>>> headache in Ada.
>>>
>>> Constraint_Errors a headache? They're a blessing, because the alternative 
>>> is zillions of impossible to find bugs.
>>
>> No, the alternative is to prove that the constraint is not violated.
> 
> That's completely impractical.

You *always* can do on the client's side:

exception
   when Constraint_Error =>
       Put_Line ("Oops!');
end;

Which is the point, things are much simpler on instances of use compared to
universal usage.

>> You can do this only at the client side. Which is why it cannot be
>> contracted for the callee. When you move from instances to universally
>> holding contracts you frequently lose provability.
> 
> ...of things that aren't worth proving in the first place. You get rid of 
> constraint_errors from bodies by writing good preconditions, predicates, 
> constraints, and exclusions in the first place.

Really? You can start writing preconditions for +,-,*,/,** defined in the
package Standard and continue to user defined types and subtypes. If
anything is totally impractical then the idea to move Constraint_Error from
post to pre-condition. It is wrong and will never work for anything beyond
trivial examples.

> If for whatever reason you can't do this, then yes you lose proveability.

Nope. See above. I can prove that Constraint_Error is handled by given
client. Which is what Ada programmers really want, because unhandled
Constraint_Error is by far the most common bug.
 
>> Note how accessibility checks attempted in the form of a contract became
>> more problem than solution. In order to have it provable you must
>> strengthen it. Probably every Ada programmer was annoyed by silly "must be
>> statically deeper" messages about pointers. It cannot be handled at the
>> level of contracts. Yet in most cases it is no problem to see that a
>> *given* pointer is never dangling.
> 
> "No problem"? Informally, sure. It's impossible to prove in any real case; 
> there is too much going on. (Claw, for instance, prevents it by design, but 
> I don't think there is any way to formally describe that design -- certainly 
> not in systems like Spark which ignore the effects of finalization [which is 
> how Claw guarentees non-dangling]).

Most real cases are about downward closures and stuff when pointer is
aliased argument. For the latter you need the body.

>>> It's annoying that one can't tell between specification errors that should
>>> be contracted and proved away and those that are truly runtime (that is, 
>>> a normal part of the implementation);
>>
>> That was ARG's decision for Ada 2012, wasn't it?
> 
> No, it was an effect of Ada 83, which conflated those uses of exceptions. We 
> had to formalize existing practice (we need the ability to add these 
> specifications to existing code without changing any behavior). It would be 
> better for exceptions that we would want to "prove-away" (like Status_Error 
> and Mode_Error in Text_IO) to be strictly separated from those that are 
> purely runtime behavior (like End_Error and Device_Error).

This has nothing with that.

Status_Error and Mode_Error are there because file type as designed does
not reflect its mode:

   type Read_File_Type is ...
   type Write_File_Type is ...
   type Readwrite_File_Type is Read_File_Type and Write_File_Type is ...

Done.

> One thing we had to do is to make these things work is to allow existing 
> compilers to use runtime checks, with the hope that more will become proved 
> over time. Compiler technology isn't quite ready for mandatory proof 
> requirements (maybe next time).

This is a conflation of its worst.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2013-07-12  8:02 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08 17:56 The future of Spark . Spark 2014 : a wreckage vincent.diemunsch
2013-07-08 19:24 ` Simon Wright
2013-07-08 20:59 ` Florian Weimer
2013-07-09  7:40   ` Dmitry A. Kazakov
2013-07-09  8:30     ` Georg Bauhaus
2013-07-09  8:58       ` Dmitry A. Kazakov
2013-07-09 10:27         ` G.B.
2013-07-09 11:13         ` G.B.
2013-07-09 15:14     ` Adam Beneschan
2013-07-09 22:51     ` Robert A Duff
2013-07-10  7:49       ` Dmitry A. Kazakov
2013-07-10  8:21         ` Georg Bauhaus
2013-07-08 21:32 ` Randy Brukardt
2013-07-09  7:28   ` Dmitry A. Kazakov
2013-07-09 11:29     ` Simon Wright
2013-07-09 12:22       ` Dmitry A. Kazakov
2013-07-09 20:37     ` Randy Brukardt
2013-07-10 10:03       ` Dmitry A. Kazakov
2013-07-10 23:21         ` Randy Brukardt
2013-07-11  7:44           ` Dmitry A. Kazakov
2013-07-11 22:28             ` Randy Brukardt
2013-07-12  8:02               ` Dmitry A. Kazakov [this message]
2013-07-12 21:16                 ` Randy Brukardt
2013-07-14 10:19                   ` Dmitry A. Kazakov
2013-07-14 15:57                     ` Georg Bauhaus
2013-07-16  0:16                       ` Randy Brukardt
2013-07-17  1:30                         ` Shark8
2013-07-17 23:08                           ` Randy Brukardt
2013-07-18  7:19                             ` Dmitry A. Kazakov
2013-07-19  4:36                               ` Randy Brukardt
2013-07-16  0:13                     ` Randy Brukardt
2013-07-16  8:37                       ` Dmitry A. Kazakov
2013-07-16 22:13                         ` Randy Brukardt
2013-07-17  7:59                           ` Dmitry A. Kazakov
2013-07-17 23:26                             ` Randy Brukardt
2013-07-18  7:37                               ` Dmitry A. Kazakov
2013-07-19  4:32                                 ` Randy Brukardt
2013-07-19  7:16                                   ` Dmitry A. Kazakov
2013-07-20  5:32                                     ` Randy Brukardt
2013-07-20  9:06                                       ` Dmitry A. Kazakov
2013-07-12  1:01           ` Slow? Ada?? Bill Findlay
2013-07-09  7:57   ` The future of Spark . Spark 2014 : a wreckage Stefan.Lucks
2013-07-09 20:46     ` Randy Brukardt
2013-07-10  8:03       ` Stefan.Lucks
2013-07-10 12:46         ` Simon Wright
2013-07-10 23:10         ` Randy Brukardt
2013-07-11 19:23           ` Stefan.Lucks
2013-07-12  0:21             ` Randy Brukardt
2013-07-12  9:12               ` Stefan.Lucks
2013-07-12 20:47                 ` Randy Brukardt
2013-08-05  5:43                 ` Paul Rubin
2013-07-10 12:19   ` vincent.diemunsch
2013-07-10 16:02     ` Simon Wright
2013-07-11  0:36     ` Randy Brukardt
2013-07-11  6:19       ` Simon Wright
2013-07-11 23:11         ` Randy Brukardt
2013-07-11 10:10       ` vincent.diemunsch
2013-07-11 14:23         ` Dmitry A. Kazakov
2013-07-12  0:07           ` Randy Brukardt
2013-07-12  0:00         ` Randy Brukardt
2013-07-12  7:25           ` Simon Wright
2013-07-12 20:07             ` Randy Brukardt
2013-07-12 14:23           ` Robert A Duff
2013-07-12 20:14             ` Randy Brukardt
2013-07-11 23:50       ` Shark8
2013-07-08 23:18 ` Peter C. Chapin
2013-07-09  7:34   ` Stefan.Lucks
2013-07-09 15:21     ` Adam Beneschan
replies disabled

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