comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Generic Package
Date: Wed, 2 May 2007 12:29:58 +0200
Date: 2007-05-02T12:29:58+02:00	[thread overview]
Message-ID: <1gptkhkkk93hj.1n23zmm3go7tc$.dlg@40tude.net> (raw)
In-Reply-To: 1178055690.27673.39.camel@localhost.localdomain

On Tue, 01 May 2007 23:41:31 +0200, Georg Bauhaus wrote:

> On Tue, 2007-05-01 at 19:16 +0200, Dmitry A. Kazakov wrote:
> 
>> Apart from obvious uselessness of contracts referencing to the memory
>> layout,
> 
> I didn't say that.

But I did! (:-))

>> the above is self-contradictory. Memory layout defines an order. It
>> also is a part of the contract.
> 
> Memory is not abstract, addresses aren't abstract,

In what sense? 

[ I doubt that you were able to bind objects of a higher level language to
"non-abstract memory" in a more or less formal way. It is yet another
discussion, we probably should not go into. The states of the memory are
associated with some computational states and those with some objects
"having" some values. It is a tick Napoleon pastry of abstractions layered
over abstractions which you would not be able to flatten. As a practical
example consider

for I in ... loop
   -- what is I'Address here?

can you specify the transistors I has? ]

> The abstraction of the implementation implies the existence
> of a possible internal private ordering.

No, that is of course wrong. An abstraction of unordered set does not imply
anything beyond itself.

>>>     -- Proof. Foreach calls Add_One exactly once for each node
>>>     -- in s. Add_One unconditionally increments Count_Var by 1.
>>>     -- No other operation changes the value of Count_Var.
>>>     -- Hence, Count_Var (initially zero) is incremented by 1 for
>>>     -- each node in s, so Foreach counts the elements of s. ∎
>> 
>> So the precondition of Add_One is true?
> 
> The proof mentions that Count_Var is initially zero and that
> it is only changed by Add_One. Together with the fact that these
> are (1) a local variable and (2) a local procedure
> closely tied this should imply that pre: Count_Var = 0.

So, the precondition is not constant true, it is Count_Var = 0? Then either

1. N = 1

or

2. The program is incorrect, because for any N > 1  your precondition gets
violated on the second call to Add_One.

Here you are. You cannot specify the precondition of Add_One without
referring to the iteration state. You are caught in a circle of
tautologies.

>>> As you can see, there is some order again but I don't have to know
>>> the order. (Finding a first book (and then the next book) is the
>>> job of the librarian, not mine.)
>> 
>> Librarian is the interface. If it finds first book then that is a publicly
>> ordered set = you _can_ know the order without breaking the abstraction.
> 
> ?
> The first book might be determined by whatever order the librarian
> thinks he should choose this time.

No, first = [whatever] order. It is same.

> Nothing I could determine beforehand.

"Beforehand" means what? I hope it does not that you present one set while
dealing with another. Ordering is determined by sole existence of the
librarian who can give you a [first] book and continue to do so.

> The order(s), if any, isn't/aren't publicly known.

It is, if you don't cheat. The procedure was described by me in other post.

>>>>>> To be able to pick a random member <=>
>>>>>> to have an order.
>>>>> 
>>>>> Can you determine whether one of your sets is empty?
>>>> 
>>>> Sure. I can compare an empty set with the given set. This does not require
>>>> picking elements.
>>> 
>>> Uhm, not require the client to pick or the implementation to pick?
>>> When two sets A and B are equal iff the same elements
>>> belong to both A and B, won't you need at least references to the
>>> elements for "=" to be called for the elements?
>> 
>> No. You have to show that whatever element you took (no matter how) it is
>> either in both sets or else in neither:
>> 
>>    forall x in S, x in Q
>> 
>> This does not force you to present any method of getting elements from any
>> of the sets.
> 
> What's the contract of "in"?

One of the set theory. You choose the language and a set of axioms, and
likely "in" will be somewhere there. So "in" is in a different position
than ordering. In ZF ordered pairs are not fundamental, they are
constructed. So we could talk about the contracts of on "ZF hardware."

Of course it depends on the hardware. Nobody would construct, say, integers
as they are constructed in ZF, because there is the ALU, which we could use
instead. So "+" becomes per magic. Same is with foreach, you could have a
hardware (axioms) for it. In that case it would have no contract.

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



  parent reply	other threads:[~2007-05-02 10:29 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25 22:15 Generic Package andrew.carroll
2007-04-26  0:07 ` Jeffrey R. Carter
2007-04-26  7:46   ` Markus E Leypold
2007-04-26  6:02 ` Martin Krischik
2007-04-26  7:57 ` Dmitry A. Kazakov
2007-04-26 15:31 ` andrew.carroll
2007-04-26 16:07   ` Georg Bauhaus
2007-04-26 19:40     ` andrew.carroll
2007-04-26 20:01       ` Georg Bauhaus
2007-04-26 18:54   ` Dmitry A. Kazakov
2007-04-26 21:52     ` Simon Wright
2007-04-27  9:00       ` Dmitry A. Kazakov
2007-04-27 11:11         ` Georg Bauhaus
2007-04-27 12:06           ` Dmitry A. Kazakov
2007-04-27 12:52             ` Markus E Leypold
2007-04-27 14:10             ` Georg Bauhaus
2007-04-27 14:16               ` Dmitry A. Kazakov
2007-04-27 21:44                 ` Georg Bauhaus
2007-04-28  7:38                   ` Dmitry A. Kazakov
2007-04-28 17:50                     ` Simon Wright
2007-04-28 21:04                     ` Ray Blaak
2007-04-29 16:33                       ` Markus E Leypold
2007-04-27 19:44             ` Simon Wright
2007-04-27 20:34               ` Dmitry A. Kazakov
2007-04-27 21:16                 ` Simon Wright
2007-04-28  7:36                   ` Dmitry A. Kazakov
2007-04-27 11:43         ` Markus E Leypold
2007-04-28 17:35           ` Dmitry A. Kazakov
2007-04-28 23:06             ` Georg Bauhaus
2007-04-29  8:19               ` Dmitry A. Kazakov
2007-04-29 15:10                 ` (see below)
2007-04-29 17:48                   ` Dmitry A. Kazakov
2007-04-29 22:36                     ` (see below)
2007-04-30  6:58                       ` Dmitry A. Kazakov
2007-04-30  9:59                         ` Markus E Leypold
2007-04-30 10:01                         ` Markus E Leypold
2007-04-30 10:36                         ` Georg Bauhaus
2007-04-30 10:40                           ` Georg Bauhaus
2007-04-30 12:14                           ` Dmitry A. Kazakov
2007-04-30 14:57                         ` (see below)
2007-04-30 10:30                 ` Georg Bauhaus
2007-04-30 12:16                   ` Dmitry A. Kazakov
2007-04-30 14:48                     ` Georg Bauhaus
2007-04-30 16:29                       ` Dmitry A. Kazakov
2007-04-30 17:24                         ` Georg Bauhaus
2007-04-30 18:54                           ` Dmitry A. Kazakov
2007-04-30 19:29                         ` Simon Wright
2007-04-30 20:04                           ` Dmitry A. Kazakov
2007-05-01  0:11                             ` Markus E Leypold
2007-05-01  9:02                             ` Georg Bauhaus
2007-05-01 10:19                               ` Dmitry A. Kazakov
2007-05-01 13:42                                 ` Georg Bauhaus
2007-05-01 17:16                                   ` Dmitry A. Kazakov
2007-05-01 19:14                                     ` Randy Brukardt
2007-05-01 20:14                                       ` Dmitry A. Kazakov
2007-05-02  7:52                                         ` Markus E Leypold
2007-05-02  8:06                                       ` Markus E Leypold
2007-05-03  0:37                                         ` Randy Brukardt
2007-05-03  8:36                                           ` Markus E Leypold
2007-05-03 23:16                                             ` Randy Brukardt
2007-05-04  0:15                                               ` Markus E Leypold
2007-05-01 21:41                                     ` Georg Bauhaus
2007-05-02  6:57                                       ` Ray Blaak
2007-05-02  8:22                                         ` Markus E Leypold
2007-05-02  8:07                                       ` Markus E Leypold
2007-05-02 10:29                                       ` Dmitry A. Kazakov [this message]
2007-05-02 11:48                                         ` Georg Bauhaus
2007-05-02 11:50                                           ` Georg Bauhaus
2007-05-02 13:12                                           ` Dmitry A. Kazakov
2007-05-02 14:21                                             ` Markus E Leypold
2007-05-03 18:27                                             ` Georg Bauhaus
2007-05-03 19:07                                               ` Dmitry A. Kazakov
2007-05-03 19:49                                                 ` Markus E Leypold
2007-04-29 16:26             ` Markus E Leypold
2007-04-26 21:50   ` Simon Wright
2007-04-27  4:45   ` Jeffrey R. Carter
2007-04-27  7:45     ` Martin Krischik
2007-04-27 22:54       ` Georg Bauhaus
2007-04-30 20:13         ` Matthew Heaney
2007-04-26 20:48 ` andrew.carroll
  -- strict thread matches above, loose matches on Subject: below --
2003-12-02 23:15 Mr. J.
2003-12-03  9:31 ` Dmitry A. Kazakov
2003-12-02 23:13 generic package Ratson Janiv
2003-12-03 17:39 ` Stephen Leake
replies disabled

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