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=2.0 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b78c363353551702 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.227.67 with SMTP id ry3mr16439093pbc.8.1340804518692; Wed, 27 Jun 2012 06:41:58 -0700 (PDT) Path: l9ni25908pbj.0!nntp.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: about the new Ada 2012 pre/post conditions Date: Wed, 27 Jun 2012 08:41:55 -0500 Organization: Aioe.org NNTP Server Message-ID: References: <4fe76fad$0$9507$9b4e6d93@newsspool1.arcor-online.net> <1jt8vhzxfrv2i.eohce4d3rwx1$.dlg@40tude.net> <4fe83aaa$0$6624$9b4e6d93@newsspool2.arcor-online.net> <1pkfv0tiod3rn$.onx6dmaa3if9$.dlg@40tude.net> <1i1mp8xs3vtl2.1oc4m66qtfgzq.dlg@40tude.net> <4fe9bde5$0$6566$9b4e6d93@newsspool4.arcor-online.net> <4fe9e7c5$0$6567$9b4e6d93@newsspool4.arcor-online.net> <4feac313$0$9504$9b4e6d93@newsspool1.arcor-online.net> <1et105d0sks1i.pcgog9ym17ym.dlg@40tude.net> <4feae0d1$0$6568$9b4e6d93@newsspool3.arcor-online.net> <2klq69d4qqsp$.veefi8i6jnwa.dlg@40tude.net> Reply-To: nma@12000.org NNTP-Posting-Host: KdJUrTuvv3Zv/s8pPxNluw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-06-27T08:41:55-05:00 List-Id: On 6/27/2012 7:19 AM, Dmitry A. Kazakov wrote: > >> A: >> if Pre (...) then >> A (X) := 1; >> else >> raise Assertion_Failure; >> end if; >> >> B: >> A (X) := 1; >> >> A and B can be shown to both be implementations of the behavior >> that some contract stipulates. >> A and B have *essentially* the same effect once the program >> is correct. > > I don't know what "essentially same effect" is, but whatever formal > definition of essential you took you would have to prove that two programs > are equivalent according to the definition. That will require proving that > the exception is not propagated or else handled to an "essentially" same > result. Good luck with that. > Hello; I did not check, but I assumed all along that the evaluation of pre() can have no side effects? i.e. in the process of executing with pre ==> boolean valued expression Then X could not be _modified_ during this check? Because if X is modified, as a side effect of the check, from say 3 to 5 then A(X):=1 will act differently if pre() was NOT present. Hence both code examples shown above will not be equivalent. Therefore, I assume this can not happen, and it is guaranteed by the language and compiler that pre() and post() do not have side-effects? Else this becomes like Heisenberg uncertainty principle. thanks, --Nasser