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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.157.46.207 with SMTP id w73mr25419480ota.117.1481668380221; Tue, 13 Dec 2016 14:33:00 -0800 (PST) X-Received: by 10.157.37.247 with SMTP id q110mr6522124ota.5.1481668380173; Tue, 13 Dec 2016 14:33:00 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!n6no12786qtd.0!news-out.google.com!m27ni1qtf.1!nntp.google.com!p16no11482qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 13 Dec 2016 14:32:59 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=67.0.242.189; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 67.0.242.189 References: <47366b42-c0a3-41bf-a44a-5241c109d60f@googlegroups.com> <1af458a8-cf5b-4dd7-824d-eed1ed5ffb21@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada 2012 Constraints (WRT an Ada IR) From: Shark8 Injection-Date: Tue, 13 Dec 2016 22:33:00 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:32793 Date: 2016-12-13T14:32:59-08:00 List-Id: On Tuesday, December 13, 2016 at 2:11:56 PM UTC-7, Dmitry A. Kazakov wrote: > On 2016-12-13 19:25, Shark8 wrote: > > On Tuesday, December 13, 2016 at 4:19:17 AM UTC-7, Dmitry A. Kazakov wr= ote: > >> On 13/12/2016 11:39, G.B. wrote: > >>> > >>> Pre doesn't have to be object language as has now been > >>> said and confirmed a number of times. > >> > >> Being a part of the body it does not belong to declarations. > > > > By that logic we shouldn't have something like: > > type Item is null record; -- Stub > > type Pointer is access Item; -- Access type > > subtype Handle is not null Pointer; -- Subtype excluding null > > > > Procedure Something(Object : Handle); -- Object can't be null. > > because we could instead say: > > Procedure Something(Object : Pointer) is > > begin > > if Object =3D Null then --... > > end; > > > > Or, really, any subtype. >=20 > No. Type/subtype declarations are expressions involving type-algebraic=20 > operations [some operands are types, results are types]. =20 And now we're back to the question I presented illustrating the thrust of t= his thread* with the P0, P1, P2, & P3 examples. > You cannot use them in the bodies. They implicitly define operations of= =20 > the resulting type and the corresponding bodies. Nope. Ada 83 LRM (3.3.2) says, in part: "A type mark denotes a type or a subtype. If a type mark is the name of a t= ype, the type mark denotes this type and also the corresponding unconstrain= ed subtype. The base type of a type mark is, by definition, the base type o= f the type or subtype denoted by the type mark." And (3.3) says, as its very first sentence: "A type is characterized by a set of values and a set of operations." It is therefore *MOT* the subtype which defines the operations. > This has nothing to do=20 > with the bodies defined explicitly in the declarative region by the=20 > programmer. I never claimed it did -- just that your reasoning would carry over to spec= /body as shown. > > But this works against your whole anti-pre, anti-post, anti-aspect > > argument... those *ARE* [generally] Ada Boolean expressions. >=20 > They are not, what was meant would be a predicate, spelled fully: >=20 > forall a > b, a in T, b in T exist n in N > a =3D b * n + a rem b >=20 > It is not a Boolean expression and it cannot be written or evaluated in= =20 > Ada. Though it is possible to write a program in Ada that would perform= =20 > calculus on such expressions, e.g. SPARK. I agree that SPARK is all about doing those proofs... but what are (for all= x in Y =3D> ...) about then if not to facilitate this sort of thing? * Namely: what is a good way to define constraints that can generally be ap= plied to all forms of Ada 2012.