を開催することを証明する方法はSPARK.Text_IO手順の多くは、前提条件を持っていることであるIどのようにして証明しようとするのかわからない、すなわち標準入力が読み込み可能であり、ファイルの終わりではないということです。私の試みは、以下のコードに示されているように、SPARK.Text_IOプロシージャ(この場合はGet_Immediate)の前提条件を呼び出し側プロシージャの前提条件に追加して、その前提条件が真。それはうまくいかなかった。ここで私が話しているかの例を示します。SPARK.Text_IO手順の前提条件は、私が2017年</p> <p>私の問題SPARKの発見にspark_io例からSPARK.Text_IOを使用してい
テスト仕様:
with SPARK.Ada.Text_IO; use SPARK.Ada.Text_IO;
package test with SPARK_Mode
is
continue_messages_key : Character := ' ';
procedure User_Wait_For_Continue_Messages_Key
with Global => (In_Out => Standard_Input,
Input => continue_messages_key),
Pre => Is_Readable (Standard_Input) and then
not End_Of_File;
end test;
テスト本体:前提条件があります
証明者が与えエラーがGet_Immediateライン上にある」メディアが
pragma SPARK_Mode(On);
package body test is
procedure User_Wait_For_Continue_Messages_Key
is
IR : Immediate_Result;
Avail : Boolean;
begin
loop
Get_Immediate(IR, Avail);
if Avail then
if IR.Status = Success then
if IR.Available = True then
if IR.Item = continue_messages_key then
return;
end if;
end if;
end if;
end if;
end loop;
end User_Wait_For_Continue_Messages_Key;
end test;
「失敗」Get_Immediateプロシージャのプロトタイプとコントラクトは次のとおりです。
procedure Get_Immediate (Item : out Character_Result)
with Global => (In_Out => Standard_Input),
Pre => Is_Readable (Standard_Input) and then
not End_Of_File,
Post => Is_Readable (Standard_Input) and
Name (Standard_Input) = Name (Standard_Input)'Old and
Form (Standard_Input) = Form (Standard_Input)'Old and
Is_Standard_Input (Standard_Input);
Standard_Inputが読み込み可能であり、ファイルの終わりではないことをSPARKに証明しますか?
私は、Standard_Inputが読み込み可能であると宣言されていると仮定しました。外部ファイルは、プログラムに影響する唯一のものではないので、扱いにくいです。 –
ええ、SPARKがどのように外部ファイルを推論することができるのか理解できません。すべてのText_IOを完全なAdaにする方が良いでしょうか? –
私はSPARK 2014をI/O(またはデータベースアクセス)と組み合わせることを真剣に試みていませんが、Adaとは異なるソリューションを考える必要があると私は感じています。 –