From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: My new post on dev.to about SPARK Date: Fri, 10 Jul 2020 09:47:16 +0200 Organization: Adalog Message-ID: References: <8e5d14a5-0311-4005-9655-951e8a274929o@googlegroups.com> <875zav52jw.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 10 Jul 2020 07:47:16 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="7976ce4c556d1d077396dbbe40d7d253"; logging-data="22460"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19F1VQ0tx2KlNhEISPLGMAp" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cancel-Lock: sha1:YwREhuvApxhxPc2Wgho4XsB/0E4= In-Reply-To: <875zav52jw.fsf@nightsong.com> Content-Language: fr Xref: reader01.eternal-september.org comp.lang.ada:59424 List-Id: Le 10/07/2020 à 08:04, Paul Rubin a écrit : > "J-P. Rosen" writes: >> Hmmm.. The following O(N**2) function: ... >> can be changed to a O(N) function: >> function Is_Sorted (Table : Array_Type) return Boolean >> is (for all L in Table'First .. Table'Last -1 => >> Table (L) < Table (L+1)) >> with Ghost; > Should it matter? The code is never executed. It's only used as a > specification for the theorem prover. For Spark, no (although I think that the simpler version is more understandable). But if you run it through an Ada compiler with assertions on, then it will make a difference. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr