comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: loop variant in SPARK ADA
Date: Mon, 19 Sep 2005 08:40:14 -0700
Date: 2005-09-19T08:40:14-07:00	[thread overview]
Message-ID: <AZAXe.4$QR.3@dfw-service2.ext.ray.com> (raw)
In-Reply-To: <1127121942.777976.45330@f14g2000cwb.googlegroups.com>

Constantin Porphyrogenete wrote:
> Couldn't find the newsgroup for SPARK.
> Thought I'd try this one.

SPARK discussions have been welcome here in the past. I hope that won't 
be changing soon.

> Read the book. It seems there is no
> way to assert a loop variant to
> help prove termination (I am thinking
> of the Eiffel loop variant).

Presumably you mean a loop invariant?

> Is there any reason SPARK ADA doesn't
> have this?

I don't have the book to hand, but I do have the SPARK Quick Reference 1:

"The _/assert annotation/_ can be used to specify conditions that are to 
be true - of particular use when verifying programs containing loops."

There is then an example of a Div procedure to calculate M/N, giving the 
quotient in Q and the remainder in R. The loop invariant is:

--# assert (M = Q * N + R) and (R >= 0);

-- 
Jeffrey Carter
"Now go away or I shall taunt you a second time."
Monty Python and the Holy Grail
E-mail: jeffrey_r_carter-nr [commercial-at]
         raytheon [period | full stop] com



  parent reply	other threads:[~2005-09-19 15:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-19  9:25 loop variant in SPARK ADA Constantin Porphyrogenete
2005-09-19 13:23 ` Jacob Sparre Andersen
2005-09-19 15:40 ` Jeffrey Carter [this message]
2005-09-19 16:03   ` Georg Bauhaus
2005-09-19 22:22     ` Jeffrey Carter
2005-09-20  8:17       ` Georg Bauhaus
2005-09-20 17:15 ` Rod Chapman
2005-09-21  2:49   ` Constantin Porphyrogenete
2005-09-21 17:31     ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox