我试图在此过程中添加派生子句,这是我的解决方案:
-#从键,数据中获取索引,从数据中获取索引,从数据中获取I;
我不确定,我需要帮助
procedure Find
(Key: Integer ;
Data : in MyArray ;
Index : out Integer ;
Found : out Boolean )
--# post (Found -> Data(Index) = Key);
--# derives ???
is
I: Integer ;
begin
I := 0;
Found := False ;
loop
--# assert (I >= 0) and
--# (I <= Data 'Last + 1) and
--# (Found -> Data(I) = Key);
exit when (I > Data 'Last ) or Found ;
if(Data(I)) = Key
then
Found := True;
else
I:= I + 1;
end if;
end loop;
Index := I;
end Find;