comp.lang.ada
 help / color / mirror / Atom feed
From: Tim Rowe <spamtrap@tgrowe.plus.net>
Subject: Newbie question: SPARK verification condition on member of private record
Date: Wed, 01 Apr 2009 20:38:35 +0100
Date: 2009-04-01T20:38:35+01:00	[thread overview]
Message-ID: <jsudnfEigqAgX07UnZ2dnUVZ8ridnZ2d@posted.plusnet> (raw)

Ok, I've been busily reading all of the spark documentation, and there's 
just one thing I'm stuck on at the moment.

I have:
    subtype Array_Index is Integer range 1..5000;
    type Foo is private;
    function Get_Order(This: in Foo) return Array_Index;
    -- other specifications

and in the private part I have
    type Foo is record
       Highest_Valid_Index: Array_Index;
       -- other definitions
    end record;

The body of Get_Order is simply
    function Get_Order(This: in Foo) return Array_Index is
    begin
       return This.Highest_Valid_Index;
    end Get_Order;

My problem is that I'm getting a proof obligation
H1:    get_order(this) < 5000 .
C1:    fld_highest_valid_index(this) <= 4999 .
If I'm reading that correctly then it's clearly true, but I would like 
to be able to annotate the code so that Examiner knows that 
get_order(this) = fld_highest_valid_index(this). My instinct is to 
annotate Get_Order with
    --# return This.Highest_Valid_Index;
but that's not allowed (" Semantic Error    :  9: Selected components 
are not allowed for This.")

So how should I annotate or restructure the code to make the 
relationship between Get_Order(This) and This.Highest_Valid_Index?

Thanks,

Tim Rowe



             reply	other threads:[~2009-04-01 19:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-01 19:38 Tim Rowe [this message]
2009-04-01 21:04 ` Newbie question: SPARK verification condition on member of private record JP Thornley
2009-04-01 23:50   ` Tim Rowe
2009-04-02  9:00     ` JP Thornley
2009-04-02 12:00       ` Tim Rowe
2009-04-02 15:22         ` JP Thornley
2009-04-02 18:09           ` roderick.chapman
2009-04-03 11:26             ` Tim Rowe
2009-04-02 23:58           ` Tim Rowe
2009-04-03 13:36             ` JP Thornley
2009-04-06 11:49               ` Tim Rowe
replies disabled

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