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: a07f3367d7,39579ad87542da0e X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.160.212 with SMTP id xm20mr1651565wib.0.1368583921926; Tue, 14 May 2013 19:12:01 -0700 (PDT) Path: p18ni110090wiv.0!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!nrc-news.nrc.ca!News.Dal.Ca!news.litech.org!news.glorb.com!xmission!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Seeking for papers about tagged types vs access to subprograms Date: Sat, 11 May 2013 18:51:27 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1vrhb7oc4qbob$.q02vuouyovp5$.dlg@40tude.net> <19lrzzbgm77v6.1dzpgqckptaj6.dlg@40tude.net> <1bfhq7jo34xpi.p8n2vq6yjsea.dlg@40tude.net> <12gn9wvv1gwfk.10ikfju4rzmnj.dlg@40tude.net> <1oy5rmprgawqs.1jz36okze0xju$.dlg@40tude.net> <1q2ql1e4rcgko.diszzq1mhaq8$.dlg@40tude.net> <1msoad3apbkf.1optea1ujjydv.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1368312688 6536 192.74.137.71 (11 May 2013 22:51:28 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 11 May 2013 22:51:28 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:DusVIIO1jJzmeuhoYsjQ9rSNg14= Content-Type: text/plain; charset=us-ascii Date: 2013-05-11T18:51:27-04:00 List-Id: "Dmitry A. Kazakov" writes: > The condition is moved to the post-condition. E.g. > > # require X >= 0.0 > function sqrt (X : Float) return Float; > # ensure sqrt (X)**2 = X > > is replaced with > > # require true > function sqrt (X : Float) return Float; > # ensure sqrt (X)**2 = X or else Constraint_Error raised It seems to me that this replacement loses information (the info that X is "supposed to be nonnegative"). For example, a body of sqrt that says "return X / 0.0;" obeys the second contract but not the first above. But that's obviously wrong to anyone who thinks that "sqrt" means "approximate square root of X". (Never mind the accuracy issues -- sqrt(X) might not be representable as a Float. ;-) ) - Bob