From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,229ea0001655d6a2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news4.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!news-kar1.dfn.de!npeer.de.kpn-eurorings.net!npeer1.kpn.DE!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Generic Package From: Georg Bauhaus In-Reply-To: <1ozvzzh59ebq8$.yeh9do8s3hig$.dlg@40tude.net> References: <1177539306.952515.222940@s33g2000prh.googlegroups.com> <1177601484.444701.171560@r35g2000prh.googlegroups.com> <9eejm6rqip.fsf@hod.lan.m-e-leypold.de> <19qllkvm6ut42$.1iqo74vjgmsrv$.dlg@40tude.net> <1177801611.10171.32.camel@localhost.localdomain> <1woad6hn9idy2$.6otnwphc1o0h$.dlg@40tude.net> <1177929029.6111.34.camel@localhost> <1177944533.13970.17.camel@localhost> <2aq08qbvw0ym$.1rquampzo7o53.dlg@40tude.net> <1ieq3io2d6nnq$.13818v3y35gnr.dlg@40tude.net> <1178010142.6695.29.camel@localhost.localdomain> <1178026941.16837.88.camel@localhost.localdomain> <1ozvzzh59ebq8$.yeh9do8s3hig$.dlg@40tude.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Organization: # Message-ID: <1178055690.27673.39.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Date: Tue, 01 May 2007 23:41:31 +0200 NNTP-Posting-Date: 01 May 2007 23:41:31 CEST NNTP-Posting-Host: 43867572.newsspool3.arcor-online.net X-Trace: DXC=VfeQgj:1?QkfF8a^:6>b7eMcF=Q^Z^V3h4Fo<]lROoRaFl8W>\BH3YbfR2Q_HPjYBdA:ho7QcPOVcXXm?^5Oj1;bA:;;6aVKo@` X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:15444 Date: 2007-05-01T23:41:31+02:00 List-Id: 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. > 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, but what I have described as a formal model is abstract. > Hence the interface is ordered. The abstraction of the implementation implies the existence of a possible internal private ordering. The order can be completely controlled by an implementation and it won't be "reachable" through the public Set interface. Randy has explained much more about possible internal orderings. > > -- 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. =E2=88=8E >=20 > 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 =3D 0. > 2. because pred (Add_One) =3D true, that also includes Count_Val =3D N + = 1. This is not a possible interpretation of the program as given (because Count_Var :=3D 0 immediately before Foreach is called), but you are right that the precondition is not explicitly stated. > > 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.) >=20 > Librarian is the interface. If it finds first book then that is a publicl= y > ordered set =3D 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. Nothing I could determine beforehand. The order(s), if any, isn't/aren't publicly known. > >>>> To be able to pick a random member <=3D> > >>>> to have an order. > >>>=20 > >>> Can you determine whether one of your sets is empty? > >>=20 > >> Sure. I can compare an empty set with the given set. This does not req= uire > >> picking elements. > >=20 > > 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 "=3D" to be called for the elements? >=20 > No. You have to show that whatever element you took (no matter how) it is > either in both sets or else in neither: >=20 > forall x in S, x in Q >=20 > This does not force you to present any method of getting elements from an= y > of the sets. What's the contract of "in"?