JP2011154568A - Information processing apparatus, program verification method and program - Google Patents

Information processing apparatus, program verification method and program Download PDF

Info

Publication number
JP2011154568A
JP2011154568A JP2010016057A JP2010016057A JP2011154568A JP 2011154568 A JP2011154568 A JP 2011154568A JP 2010016057 A JP2010016057 A JP 2010016057A JP 2010016057 A JP2010016057 A JP 2010016057A JP 2011154568 A JP2011154568 A JP 2011154568A
Authority
JP
Japan
Prior art keywords
recursive
assertion
information
limited
verification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2010016057A
Other languages
Japanese (ja)
Inventor
Yusuke Hashimoto
祐介 橋本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP2010016057A priority Critical patent/JP2011154568A/en
Publication of JP2011154568A publication Critical patent/JP2011154568A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To efficiently verify a program handling recursive data by a model checking method. <P>SOLUTION: An information processing apparatus includes a syntactic analysis means for analyzing a source file to be verified which includes recursive assertion information about recursive data to extract the recursive assertion information, a limited assertion generation means for generating limited assertion information limited to a predetermined number of elements of recursive data from the recursive assertion information, and a verification file generation means for substituting the generated limited assertion information for the recursive assertion information in the source file to be verified to generate a verification file to be program-verified by model checking. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、モデル検査手法を用いてプログラムを検証するための技術に関する。   The present invention relates to a technique for verifying a program using a model checking method.

プログラムを解析し、不具合を検出する方法の一例が特許文献1及び2、並びに非特許文献1及び2に記載されている。また、この種の検出方法の一種として知られているモデル検査手法は、特許文献2及び非特許文献1に開示がある。モデル検査手法とは、システムやソフトウェアの振る舞いを表した有限個の「状態(state)」および状態間の遷移(transition)からなる有限状態空間(limited state space)において、調べたい性質(プロパティ)が成立するか否かを、網羅探索により調べる手法である。とくに、探索の深さを限定した有界モデル検査法は、効率的な不具合検出方法として注目されている。この方法では、プログラム中の変数の値および制御フロー上の位置の組合せを「状態」としてプログラムを有限状態空間に変換して有界モデル検査を適用する。変数の値の組合せと、プログラム中での値の変化とを制御フローに沿って追跡するので、精確な解析を行うことができる。   An example of a method for analyzing a program and detecting a defect is described in Patent Documents 1 and 2, and Non-Patent Documents 1 and 2. A model checking method known as a kind of this kind of detection method is disclosed in Patent Document 2 and Non-Patent Document 1. The model checking method is a property that is to be examined in a finite state space consisting of a finite number of “states” and transitions between states that represent the behavior of systems and software. This is a method for examining whether or not it is established by an exhaustive search. In particular, the bounded model inspection method with a limited search depth is attracting attention as an efficient defect detection method. In this method, a bounded model check is applied by converting the program into a finite state space with the combination of the value of the variable in the program and the position in the control flow as a “state”. Since the combination of the values of the variables and the change in the values in the program are traced along the control flow, accurate analysis can be performed.

調べたい性質を表現する一つの考え方に「契約による設計」(Design by Contract)がある(非特許文献2)。この考え方では、ソースコードに、関数の開始時点の状態を示す事前条件と終了時点の状態を示す事後条件と関数の実行により変らない状態を示す不変条件とを表明として記述し、表明に照らしてソースコードが正しく記述されているかを検証する。   One way of expressing the property to be investigated is “Design by Contract” (Non-Patent Document 2). In this way of thinking, in the source code, the precondition indicating the state at the beginning of the function, the postcondition indicating the state at the end of the function, and the invariant condition indicating the state that does not change due to the execution of the function are described as assertions. Verify that the source code is written correctly.

特開2008−210059号JP 2008-210059 特開2009−211503号JP 2009-21503 A

F. Ivancic, I. Shlyakhter, A. Gupta, M. Ganai, V. Kahlon,C.Wang, and Z. Yang. Model Checking C Programs Using F-SOFT. In Proc. ICCD’05, 2005.F. Ivancic, I. Shlyakhter, A. Gupta, M. Ganai, V. Kahlon, C. Wang, and Z. Yang. Model Checking C Programs Using F-SOFT. In Proc. ICCD’05, 2005. B. Meyer. Applying ”Design by Contract”. IEEE Computer,Vol.25, No.10, pages 40-51, 1992.B. Meyer. Applying “Design by Contract”. IEEE Computer, Vol.25, No.10, pages 40-51, 1992.

しかしながら、上述したモデル検査法により、例えば、リストやツリーなど同じ構造を持つ変数同士が繰り返し連結されてできた再帰データを扱うプログラムを、検証するのは困難である。その理由は、繰り返し回数が決まっていないため、再帰データの変数の数も決まらず、プログラムを有限状態空間に変換することができないからである。   However, it is difficult to verify a program that handles recursive data formed by repeatedly connecting variables having the same structure, such as lists and trees, by the above-described model checking method. This is because the number of iterations is not determined, the number of recursive data variables is not determined, and the program cannot be converted to a finite state space.

詳しく説明すると、再帰データを扱うプログラムは、引数で渡された再帰データの一部分を処理し、残りの部分に関して同じ関数を再帰的に呼出して処理をさせるという再帰関数の再帰呼出しとして記述される。しかし、再帰関数内で定義された変数は、1回目の呼出しにおける変数、2回目の呼出しにおける変数、・・・N回目の呼出しにおける変数・・・というように呼出し毎に異なる変数として実体化される。このため、再帰呼出しの繰り返し回数が決まらなければ、再帰関数内で定義された変数の数も決まらず、プログラムを有限状態空間に変換することができない。その結果、モデル検査法を適用することができない。   More specifically, a program that handles recursive data is described as a recursive call of a recursive function in which a part of recursive data passed as an argument is processed, and the same function is recursively called for the remaining part to be processed. However, the variables defined in the recursive function are instantiated as different variables for each call, such as a variable in the first call, a variable in the second call,... A variable in the Nth call. The For this reason, if the number of recursive calls is not determined, the number of variables defined in the recursive function is not determined, and the program cannot be converted to a finite state space. As a result, the model checking method cannot be applied.

以上を踏まえ、本発明は、上記課題を解決することを目的とする。   Based on the above, an object of the present invention is to solve the above problems.

上記目的を達成するため、本発明に係る情報処理装置は、
再帰データに関する再帰表明情報を含む検証対象ソースファイルを解析して前記再帰表明情報を抽出する構文解析手段と、
前記再帰表明情報から、前記再帰データの要素数を所定数に限定した限定表明情報を生成する限定表明生成手段と、
前記検証対象ソースファイルにおいて、前記再帰表明情報を、生成された前記限定表明情報に置換して、モデル検査によるプログラム検証を行なうための検証用ファイルを生成する検証用ファイル生成手段と、
を備えることを特徴とする。
In order to achieve the above object, an information processing apparatus according to the present invention provides:
Parsing means for analyzing the source file to be verified including recursive assertion information on recursive data and extracting the recursive assertion information;
From the recursive assertion information, limited assertion generation means for generating limited assertion information in which the number of elements of the recursive data is limited to a predetermined number;
In the verification target source file, the recursive assertion information is replaced with the generated limited assertion information, and verification file generation means for generating a verification file for performing program verification by model checking;
It is characterized by providing.

上記目的を達成するため、本発明に係るプログラム検証方法は、
再帰データに関する再帰表明情報を含む検証対象ソースファイルを解析して前記再帰表明情報を抽出する構文解析ステップと、
前記再帰表明情報から、前記再帰データの要素数を所定数に限定した限定表明情報を生成する限定表明生成ステップと、
前記検証対象ソースファイルにおいて、前記再帰表明情報を、生成された前記限定表明情報に置換して、モデル検査によるプログラム検証を行なうための検証用ファイルを生成する検証用ファイル生成ステップと、
を含むことを特徴とする。
In order to achieve the above object, a program verification method according to the present invention includes:
A parsing step for analyzing the source file to be verified including recursive assertion information on recursive data and extracting the recursive assertion information;
From the recursive assertion information, a limited assertion generation step for generating limited assertion information in which the number of elements of the recursive data is limited to a predetermined number;
In the verification target source file, the recursive assertion information is replaced with the generated limited assertion information, and a verification file generating step for generating a verification file for performing program verification by model checking;
It is characterized by including.

上記目的を達成するため、本発明に係るプログラムは、
コンピュータに、
再帰データに関する再帰表明情報を含む検証対象ソースファイルを解析して前記再帰表明情報を抽出する構文解析ステップと、
前記再帰表明情報から、前記再帰データの要素数を所定数に限定した限定表明情報を生成する限定表明生成ステップと、
前記検証対象ソースファイルにおいて、前記再帰表明情報を、生成された前記限定表明情報に置換して、モデル検査によるプログラム検証を行なうための検証用ファイルを生成する検証用ファイル生成ステップと、
を実行させることを特徴とする。
In order to achieve the above object, a program according to the present invention provides:
On the computer,
A parsing step for analyzing the source file to be verified including recursive assertion information on recursive data and extracting the recursive assertion information;
From the recursive assertion information, a limited assertion generation step for generating limited assertion information in which the number of elements of the recursive data is limited to a predetermined number;
In the verification target source file, the recursive assertion information is replaced with the generated limited assertion information, and a verification file generating step for generating a verification file for performing program verification by model checking;
Is executed.

本発明によれば、再帰データを扱うプログラムをモデル検査法により効率的に検証することができる。   According to the present invention, a program that handles recursive data can be efficiently verified by a model checking method.

本発明の実施形態としてのシステムの全体構成を示す概略図である。1 is a schematic diagram showing an overall configuration of a system as an embodiment of the present invention. 本発明の実施形態としてのシステムの全体的な処理の流れを示す概略図である。It is the schematic which shows the flow of the whole process of the system as embodiment of this invention. 本発明の実施形態としてのシステムにおける表明処理の流れを示す概略図である。It is the schematic which shows the flow of the assertion process in the system as embodiment of this invention. 本発明の実施形態としてのシステムにおける事前条件及び事後条件の生成処理を示す図である。It is a figure which shows the production | generation process of the precondition and the postcondition in the system as embodiment of this invention. 本発明の実施形態としてのシステムにおけるソースコードのデータ型情報及び関数呼出し情報を示す図である。It is a figure which shows the data type information and function call information of a source code in the system as embodiment of this invention. 本発明の実施形態としてのシステムにおいて、ソースコード中の再帰表明に関する情報を示す図である。In the system as an embodiment of the present invention, it is a figure showing information about recursive assertion in source code. 本発明の実施形態としてのシステムにおいて、推移閉包に関する表明について説明する図である。In the system as an embodiment of the present invention, it is a figure explaining statement about transition closure. 本発明の実施形態としてのシステムにおけるソースコードのデータ型及び関数の具体例を示す図である。It is a figure which shows the specific example of the data type and function of a source code in the system as embodiment of this invention. 本発明の実施例としてのシステムにおいて、ソースコード中の再帰表明の例を示す図である。In the system as an embodiment of the present invention, it is a diagram showing an example of recursive assertion in the source code. 本発明の実施例としてのシステムにおけるソースコードのデータ型情報及び関数呼出し情報の具体例を示す図である。It is a figure which shows the specific example of the data type information of a source code, and function call information in the system as an Example of this invention. 本発明の実施例としてのシステムにおいて、ソースコード中の再帰表明に関する情報の具体例を示す図である。In the system as an embodiment of the present invention, it is a diagram showing a specific example of information about recursive assertion in the source code. 本発明の実施例としてのシステムにおいて、ソースコード中の事前条件の要素数を限定する処理の具体例を示す図である。It is a figure which shows the specific example of the process which limits the number of elements of the precondition in a source code in the system as an Example of this invention. 本発明の実施例としてのシステムにおいて、ソースコード中の事後条件の要素数を限定する処理の具体例を示す図である。It is a figure which shows the specific example of the process which limits the number of elements of the postcondition in a source code in the system as an Example of this invention. 本発明の実施例としてのシステムにおいて、ソースコード中の事後条件の要素数を限定する処理の具体例を示す図である。It is a figure which shows the specific example of the process which limits the number of elements of the postcondition in a source code in the system as an Example of this invention. 本発明の実施例としてのシステムにおいて、ソースコード中の事後条件の要素数を限定する処理の具体例を示す図である。It is a figure which shows the specific example of the process which limits the number of elements of the postcondition in a source code in the system as an Example of this invention. 本発明の実施例としてのシステムにおいて、ソースコードの表明及び呼出し先の置換によって生成される検証用ファイルの具体例を示す図である。It is a figure which shows the specific example of the file for verification produced | generated by asserting a source code and substitution of a call destination in the system as an Example of this invention.

以下に、図面を参照して、本発明の実施の形態について例示的に詳しく説明する。ただし、以下の実施の形態に記載されている構成要素はあくまで例示であり、本発明の技術範囲をそれらのみに限定する趣旨のものではない。   Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the drawings. However, the components described in the following embodiments are merely examples, and are not intended to limit the technical scope of the present invention only to them.

(第1実施形態)
<装置構成>
図1は、本発明の第1実施形態としての情報処理装置100の概略構成を示す図である。情報処理装置100は、検証対象指定モジュール110と構文解析モジュール120と限定表明生成モジュール130と再帰関数置換モジュール140と検証用ファイル出力モジュール150と外部ツール実行モジュール160とファイル格納部170とを含む。これらのモジュールのうち、検証対象指定モジュール110は、利用者から検証の対象とするファイルと関数、また再帰データの繰り返し数を限定するための要素数を入力として受け取る。構文解析モジュール120は、検証対象として指定された検証対象ソースファイルを、ファイル格納部170から読み込み、ソースコードを解析して、検証対象関数に関係するデータ型の情報、関数呼出しの情報、再帰データに関する表明(Assertion)の情報を抽出する。限定表明生成モジュール130は、抽出されたデータ型の情報と再帰データに関する表明とに基づいて、指定された所定数に要素数を限定した限定表明(すなわち限定表明情報)を生成する。再帰関数置換モジュール140は、抽出された関数呼出しの情報を参照し、指定された関数が再帰関数であった場合には、再帰呼出しを無くし、限定表明を付与されたダミー関数への通常の関数呼出しに変換する。
(First embodiment)
<Device configuration>
FIG. 1 is a diagram showing a schematic configuration of an information processing apparatus 100 as the first embodiment of the present invention. The information processing apparatus 100 includes a verification target specification module 110, a syntax analysis module 120, a limited assertion generation module 130, a recursive function replacement module 140, a verification file output module 150, an external tool execution module 160, and a file storage unit 170. Among these modules, the verification target designating module 110 receives as input the files and functions to be verified and the number of elements for limiting the number of recursive data repetitions from the user. The parsing module 120 reads the verification target source file designated as the verification target from the file storage unit 170, analyzes the source code, and analyzes data type information related to the verification target function, function call information, and recursive data. Extract assertion information about. The limited assertion generation module 130 generates a limited assertion (that is, limited assertion information) in which the number of elements is limited to a specified predetermined number based on the extracted data type information and the recursive data assertion. The recursive function replacement module 140 refers to the extracted function call information. If the specified function is a recursive function, the recursive function replacement module 140 eliminates the recursive call and returns a normal function to the dummy function to which a limited assertion is given. Convert to call.

検証用ファイル出力モジュール150は、指定されたソースファイルの内容を、再帰データに関する表明を生成された限定表明に置き換える。また、再帰呼出しがある場合には、「再帰呼出し」を、「限定表明を付与されたダミー関数への呼出し」に置き換えて、モデル検査を行なうための検証用ファイルを生成し、ファイル格納部170に格納する。外部ツール実行モジュール160は、生成した検証用ファイルを用いて、既存のモデル検査によるプログラム検証モジュール190を実行する。   The verification file output module 150 replaces the contents of the designated source file with the generated limited assertion for the recursion data assertion. Further, when there is a recursive call, “recursive call” is replaced with “call to a dummy function with a limited assertion” to generate a verification file for performing model checking, and the file storage unit 170 To store. The external tool execution module 160 executes the program verification module 190 based on the existing model check using the generated verification file.

<全体の検証処理の流れ>
次に、図1及び図2、図3のフローチャートを参照して本実施の形態の全体の動作について詳細に説明する。検証対象指定モジュール110は、利用者からの、検証対象ファイル名、検証対象関数名、要素数の指定を受け付ける(S201)。
<Overall verification process flow>
Next, the overall operation of the present embodiment will be described in detail with reference to the flowcharts of FIGS. 1, 2, and 3. The verification target designating module 110 accepts designation of the verification target file name, verification target function name, and number of elements from the user (S201).

構文解析モジュール120は、指定された検証対象ファイル名に対応するソースファイルをファイル格納部170から読み込み(S202)、ソースコードおよび表明の構文解析を行う(S203)。   The syntax analysis module 120 reads the source file corresponding to the specified verification target file name from the file storage unit 170 (S202), and performs syntax analysis of the source code and the assertion (S203).

<<ソースコードおよび表明の構文解析>>
ここで、図3、図5、図6、図7を用いてソースコードおよび表明の構文解析(S203)について詳しく説明する。構文解析モジュール120は、ソースコードのデータ型について解析し(S301)、その結果をデータ型情報(図5の501)として登録する。また、関数の呼出し関係について解析し(S302)、その結果を関数呼出し情報(図5の502)として登録する。
<< Syntax analysis of source code and assertion >>
Here, the syntax analysis of the source code and the assertion (S203) will be described in detail with reference to FIG. 3, FIG. 5, FIG. 6, and FIG. The syntax analysis module 120 analyzes the data type of the source code (S301), and registers the result as data type information (501 in FIG. 5). Further, the function call relationship is analyzed (S302), and the result is registered as function call information (502 in FIG. 5).

次に、構文解析モジュール120は、表明について解析を行い(S303)、表明が再帰データに関するものであれば、その種類に応じて再帰表明情報(図6の601〜606)の登録を行う(S304〜S313)。   Next, the syntax analysis module 120 analyzes the assertion (S303), and if the assertion relates to recursive data, registers recursive assertion information (601 to 606 in FIG. 6) according to the type (S304). ~ S313).

ここでまず、ステップS305で推移閉包に関する表明か否か判断する。図7の701に示すように、推移閉包(TC:Transitive Closure)とは、起点となる要素から推移変数を辿って、終端に達するまでに、到達できる要素からなる集合である。TCは、データ構造が推移閉包であることを表わす識別子である。ソースコードに、推移閉包に関する表明が含まれると判断すれば、推移閉包の識別子である「TC名」をTCのリスト情報(図6の601)に登録し(S306)、表明の内容、つまり、起点、推移メンバ及び終端をTC情報(図6の602)として登録する。   Here, first, in step S305, it is determined whether or not the statement is related to transitional closure. As indicated by reference numeral 701 in FIG. 7, transition closure (TC) is a set of elements that can be reached by tracing a transition variable from an element as a starting point until reaching the end. TC is an identifier indicating that the data structure is transitive closure. If it is determined that the source code includes an assertion about transitive closure, “TC name” that is an identifier of transitive closure is registered in the TC list information (601 in FIG. 6) (S306), and the content of the assertion, that is, The starting point, transition member, and end point are registered as TC information (602 in FIG. 6).

次に、ステップS307で、推移閉包の要素の値設定に関する表明(図7の702)か否かを判断する。推移閉包の要素の値設定に関する表明であれば、表明の内容を要素の値設定情報(図6の603)に登録する(S308)。更に、ステップS309で、推移閉包の要素の値変更に関する表明(図7の703)であれば、表明の内容を要素の値変更情報(図6の604)に登録する(S310)。   Next, in step S307, it is determined whether or not it is an assertion regarding the value setting of the transition closure element (702 in FIG. 7). If the assertion is related to the value setting of the transition closure element, the content of the assertion is registered in the element value setting information (603 in FIG. 6) (S308). Furthermore, if it is an assertion regarding the value change of the element of transitional closure (703 in FIG. 7) in step S309, the content of the assertion is registered in the element value change information (604 in FIG. 6) (S310).

また、ステップS311で推移閉包の分割に関する表明(図7の704)であれば、分割された推移閉包の識別子とした「TC1」「TC2」をTCのリスト情報(図6の601)に登録し、表明の内容を分割TC情報(図6の605)に登録する(S312)。このとき、「TC1」と「TC2」とはそれぞれ別の分割TC情報として登録し、TC2についての条件はTC1についての条件を否定したものとして登録する。   Further, if it is an assertion regarding the division of the transitional closure (704 in FIG. 7) in step S311, “TC1” and “TC2” as the identifiers of the transitional closures thus divided are registered in the TC list information (601 in FIG. 6). The contents of the assertion are registered in the divided TC information (605 in FIG. 6) (S312). At this time, “TC1” and “TC2” are registered as different divided TC information, and the condition for TC2 is registered as a result of negating the condition for TC1.

それ以外で、推移閉包の結合に関する表明(図7の705)であれば、表明の内容をTCの結合情報(図6の606)に登録する(S313)。このとき、結合対象がTCのリスト情報(図6の601)に登録済みであれば結合対象のTC区分を「TC」とし、そうでなければ「要素」とする。   Otherwise, if it is an assertion regarding transitional closure (705 in FIG. 7), the content of the assertion is registered in the TC connection information (606 in FIG. 6) (S313). At this time, if the join target is already registered in the TC list information (601 in FIG. 6), the join target TC classification is set to “TC”, and if not, “element” is set.

<<要素の限定>>
図2に戻り、ステップS203でソースコードと表明の解析が終わると、ステップS205以下に進んで、限定要素数Nを、0からS201で指定された要素数までインクリメントさせつつ(S219)、限定表明の生成処理(S207〜S217)を複数回繰り返す。具体的には、まず、限定要素数Nに0を代入し(S205)、ステップS207において、Nが指定要素数より小さいか否か判定する。Nが指定要素数よりも小さければ、ステップS209に進み、限定表明生成モジュール130は、構文解析により得たデータ型情報と再帰表明情報を元に、推移閉包の要素の数を限定要素数Nに限定した表明を生成する(S209)。
<< Limitation of elements >>
Returning to FIG. 2, when the analysis of the source code and the assertion is completed in step S203, the process proceeds to step S205 and the subsequent steps, and the limited element number N is incremented from 0 to the number of elements specified in S201 (S219). The generation process (S207 to S217) is repeated a plurality of times. Specifically, first, 0 is substituted for the limited element number N (S205), and in step S207, it is determined whether N is smaller than the specified element number. If N is smaller than the specified number of elements, the process proceeds to step S209, and the limited assertion generation module 130 sets the number of transition closure elements to the limited number of elements N based on the data type information and the recursive assertion information obtained by the syntax analysis. A limited assertion is generated (S209).

次に、再帰関数置換モジュール140は、関数呼出し情報(図5の502)を参照して、指定された検証対象関数が再帰呼出しを行っているか否か判断する(S211)。指定された検証対象関数が再帰呼出しを行っていれば、ステップS213に進み、検証対象関数と同じ引数と関数型と表明を持つダミー関数を作成し、再帰呼出しをダミー関数の呼出しに変更(置換)する。   Next, the recursive function replacement module 140 refers to the function call information (502 in FIG. 5) and determines whether or not the specified verification target function is performing a recursive call (S211). If the specified verification target function has made a recursive call, the process advances to step S213 to create a dummy function having the same arguments, function type, and assertion as the verification target function, and change (replace) the recursive call to a dummy function call. )

ついで、検証用ファイル出力モジュール150は、限定表明生成モジュール130と再帰関数置換モジュール140の処理結果を検証用ファイルとして生成し、ファイル格納部170に出力する(S215)。最後に、外部ツール実行モジュール160は検証用ファイルを入力として、従来のモデル検査によるプログラム検証モジュール190を実行し(S217)、限定表明に照らしてソースコードが正しく記述されていることを検証する。以上の限定表明の生成処理(S207〜S217)を複数回繰り返すことにより、再帰データの要素数を、0から指定要素数(所定数)までの各要素数Nに限定した複数の限定表明情報を生成する。   Next, the verification file output module 150 generates processing results of the limited assertion generation module 130 and the recursive function replacement module 140 as verification files, and outputs them to the file storage unit 170 (S215). Finally, the external tool execution module 160 receives the verification file as an input, and executes the program verification module 190 based on the conventional model checking (S217) to verify that the source code is correctly described in light of the limited statement. A plurality of limited assertion information in which the number of elements of the recursive data is limited to the number N of elements from 0 to the specified number of elements (predetermined number) by repeating the above-described limited assertion generation process (S207 to S217) a plurality of times. Generate.

<<限定表明の生成処理>>
図2のステップS209で行なわれる限定表明生成モジュール130による要素数Nの限定表明の生成処理について、図4と図6を用いて詳細に説明する。まず、限定表明生成モジュール130は、限定要素数Nに応じたデータ構造を表す事前条件を生成する(S401)。すなわち、TC情報(図6の602)を参照して、起点から0〜N−1回だけ推移メンバを介して到達する要素に未使用のメモリアドレスを割り当てるような事前条件を生成する。そしてさらに、起点からN回だけ推移メンバを介して到達する要素には終端を割り当てるような事前条件を生成する。
<< Limitation Statement Generation Process >>
The generation process of the limited assertion of the number of elements N performed by the limited assertion generation module 130 performed in step S209 of FIG. 2 will be described in detail with reference to FIGS. First, the limited assertion generation module 130 generates a precondition representing a data structure corresponding to the limited element number N (S401). That is, with reference to the TC information (602 in FIG. 6), a precondition is generated such that an unused memory address is allocated to an element that arrives through the transition member 0 to N−1 times from the starting point. Further, a precondition is generated such that an end point is assigned to an element that reaches N times from the starting point via the transition member.

また、限定表明生成モジュール130は、TC情報と要素値設定情報(図6の603)を参照して、起点から0〜N−1回だけ推移メンバを経て到達できる各要素について、そのメンバの値が条件に合致するような事前条件を生成する(S402)。次に、限定表明生成モジュール130は、要素値変更情報(図6の603)を参照して、情報が登録されているか否かを判断する(S403)。情報が登録されている場合には、再帰データの構造が変らないことを示す事後条件を生成する(S404)。つまり、要素値変更情報の結果変数から0〜N−1回だけ推移メンバを介して到達できる各要素が、関数開始時に、TC情報の起点から0〜N−1回だけ推移メンバを介して到達できる各要素と等しいことを示す事後条件を生成する。   Further, the limited assertion generation module 130 refers to the TC information and the element value setting information (603 in FIG. 6), and for each element that can be reached through the transition member 0 to N−1 times from the starting point, the value of the member A pre-condition is generated so as to match the condition (S402). Next, the limitation assertion generation module 130 refers to the element value change information (603 in FIG. 6) and determines whether information is registered (S403). If the information is registered, a postcondition indicating that the structure of the recursive data does not change is generated (S404). That is, each element that can be reached through the transition member 0 to N-1 times from the result variable of the element value change information reaches through the transition member 0 to N-1 times from the starting point of the TC information at the start of the function. Generate a postcondition that indicates that each element is equal.

また、結果変数から推移メンバを介して0回、1回、・・・N−1回の推移で到達する要素毎に、当該要素のメンバが一致条件と変更条件を満たし、一致条件と変更条件に関与しないメンバの値は変らず、他の要素のメンバの値も変らないという事後条件を生成する(S405〜S407)。   For each element that arrives from the result variable via the transition member 0 times, 1 time,... N-1 times, the member of the element satisfies the matching condition and the changing condition, and the matching condition and the changing condition Post-conditions are generated in which the values of members not involved in the change do not change and the values of members of other elements also do not change (S405 to S407).

次に、限定表明生成モジュール130は、TC結合情報(図6の606)が登録されているか否かを判断する(S408)。TC結合情報が登録されている場合には、TC区分が「TC」である結合対象の要素数の和が、限定要素数Nになるような組合せを求める(S409)。例えば、TC区分が「TC」である結合対象TC1とTC2があり、限定要素数が2である場合、TC1およびTC2の要素数の組として、(2,0)、(1,1)、(0,2)が求められる。限定表明生成モジュール130は、この組合せ毎に事後条件の生成を繰り返す(S410〜S413)。   Next, the limited assertion generation module 130 determines whether or not the TC combination information (606 in FIG. 6) is registered (S408). When the TC connection information is registered, a combination is obtained such that the sum of the number of elements to be combined whose TC classification is “TC” is the limited number of elements N (S409). For example, when there are TC1 and TC2 to be joined whose TC classification is “TC” and the number of limited elements is 2, the combinations of the number of elements of TC1 and TC2 are (2, 0), (1, 1), ( 0,2) is required. The limited assertion generation module 130 repeats generation of the postcondition for each combination (S410 to S413).

事後条件としては、まずデータ構造についての条件が生成される(S411)。関数開始時点の再帰データをT0とし、T0を分割した再帰データをT1およびT2とし、再帰データと同じデータ型の要素eとを、T1、e、T2の順に結合するものとする。TC結合情報のTC・要素名を元に、TCリスト情報を参照すると、TC1とTC2に関する分割TC情報が判り、分割TC情報の被参照TC名を元に、TCリスト情報を参照すると、TC0に関するTC情報が判る。   As the post-condition, first, a condition for the data structure is generated (S411). It is assumed that the recursive data at the start of the function is T0, the recursive data obtained by dividing T0 is T1 and T2, and the element e having the same data type as the recursive data is combined in the order of T1, e, and T2. When the TC list information is referred to based on the TC / element name of the TC combination information, the divided TC information related to TC1 and TC2 is known. When the TC list information is referred to based on the referenced TC name of the divided TC information, the TC0 information is related to TC0. TC information is known.

TC1およびTC2の組合せが(2,0)の場合、結果変数から推移メンバを介して0〜1回の推移で到達する各要素は、TC0の起点から推移メンバを介して0回〜1回の推移で到達する各要素に等しくなるような事後条件が生成される。また、結果変数から2回の推移で到達する要素はeに等しく、結果変数から3回の推移で到達する要素はTC0のTC情報の終端に等しくなるような事後条件が生成される。   When the combination of TC1 and TC2 is (2, 0), each element that arrives from the result variable through the transition member through 0 to 1 transition is 0 to 1 through the transition member from the starting point of TC0. Postconditions are generated that are equal to each element reached in the transition. Further, a post-condition is generated such that an element that arrives in two transitions from the result variable is equal to e, and an element that arrives in three transitions from the result variable is equal to the end of the TC information of TC0.

TC1およびTC2の組合せが(1,1)の場合、結果変数から推移メンバを介して0回の推移で到達する要素は、TC0の起点から推移メンバを介して0回の推移で到達する要素に等しく、結果変数から1回の推移で到達する要素はeに等しくなるような事後条件が生成される。また、結果変数から2回の推移で到達する要素はTC0の起点から推移メンバを介して1回の推移で到達する要素に等しく、結果変数から3回の推移で到達する要素はTC0のTC情報の終端に等しくなるような事後条件が生成される。   When the combination of TC1 and TC2 is (1, 1), the element that arrives with 0 transitions from the result variable via the transition member is the element that reaches with 0 transitions via the transition member from the starting point of TC0. A postcondition is generated such that an element that is equal and arrives in one transition from the result variable is equal to e. In addition, the element that arrives in two transitions from the result variable is equal to the element that arrives in one transition from the starting point of TC0 via the transition member, and the element that arrives in three transitions from the result variable is the TC information of TC0 A postcondition is generated that is equal to the end of.

TC1およびTC2の組合せが(0,2)の場合、結果変数から推移メンバを介して0回の推移で到達する要素はeに等しくなるような事後条件が生成される。また、結果変数から1〜2回の推移で到達する要素はTC0の起点から推移メンバを介して0〜1回の推移で到達する要素に等しく、結果変数から3回の推移で到達する要素はTC0のTC情報の終端に等しくなるような事後条件が生成される。   When the combination of TC1 and TC2 is (0, 2), a postcondition is generated such that an element that arrives in 0 transitions via a transition member from the result variable is equal to e. In addition, the element that arrives from the result variable in 1 to 2 transitions is equal to the element that arrives in 0 to 1 transition from the starting point of TC0 via the transition member, and the element that arrives in 3 transitions from the result variable is A postcondition is generated that is equal to the end of the TC0 TC information.

データ構造についての事後条件の生成後には、限定表明生成モジュール130は、個々の要素の値に関する事後条件を生成する(S412)。   After the generation of the postcondition for the data structure, the limit assertion generation module 130 generates a postcondition regarding the value of each element (S412).

TC1およびTC2の組合せが(2,0)の場合、結果変数から推移メンバを介して0〜1回の推移で到達する各要素の各メンバが、TC0の起点から推移メンバを介して0回〜1回の推移で到達する各要素のメンバに等しくなるような事後条件が生成される。   When the combination of TC1 and TC2 is (2, 0), each member of each element that arrives from the result variable via the transition member through 0 to 1 transition is 0 times through the transition member from the starting point of TC0. A postcondition is generated that is equal to the member of each element reached in one transition.

TC1およびTC2の組合せが(1,1)の場合、結果変数から推移メンバを介して0回の推移で到達する要素の各メンバは、TC0の起点から推移メンバを介して0回の推移で到達する要素の各メンバに等しくなるような事後条件が生成される。また、結果変数から2回の推移で到達する要素の各メンバはTC0の起点から推移メンバを介して1回の推移で到達する要素の各メンバに等しくなるような事後条件が生成される。   When the combination of TC1 and TC2 is (1, 1), each member of the element that arrives from the result variable via the transition member with 0 transitions reaches 0 transition through the transition member from the starting point of TC0 Postconditions that are equal to each member of the element to be generated are generated. Further, post-conditions are generated such that each member of the element that arrives in the two transitions from the result variable is equal to each member of the element that arrives in one transition from the starting point of TC0 via the transition member.

TC1およびTC2の組合せが(0,2)の場合、結果変数から1〜2回の推移で到達する要素の各メンバはTC0の起点から推移メンバを介して0〜1回の推移で到達する要素の各メンバに等しくなるような事後条件が生成される。   When the combination of TC1 and TC2 is (0, 2), each member of an element that arrives from the result variable in 1 to 2 transitions is an element that arrives in 0 to 1 transition from the starting point of TC0 via the transition member Postconditions that are equal to each member of are generated.

以上のように、本実施の形態では、要素の個数が決まっていない再帰データに関する事前条件などの表明を、要素数を指定数以下に限定した表明に置き換え、また呼出し回数が決まっていない再帰呼出しを通常の関数呼出しに置き換える。これにより、検証対象のプログラムにおける変数の個数を有限個に限定することができ、検証対象のプログラムを有限状態空間に変換することができるため、モデル検査法による網羅的な検証を行うことが可能となる。すなわち、モデル検査法を用いたプログラムの精確な検証において、従来は検証が困難であった要素の個数が不明な再帰データおよび呼出し回数が不明な再帰関数についても検証を行うことができる。言い換えれば、要素数が決まっていない再帰構造を持つデータや呼出し回数が決まっていない再帰的な関数呼出しを持つプログラムの正しさを、ソースファイルに記述された事前条件と事後条件といった表明に照らして、モデル検査法によって検証できる。   As described above, in the present embodiment, a precondition relating to recursive data for which the number of elements is not determined is replaced with an assertion in which the number of elements is limited to a specified number or less, and a recursive call whose number of calls is not determined Replace with a normal function call. As a result, the number of variables in the program to be verified can be limited to a finite number, and the program to be verified can be converted to a finite state space, enabling comprehensive verification by model checking. It becomes. That is, in accurate verification of a program using the model checking method, it is possible to verify recursive data whose number of elements is unknown and recursive functions whose number of calls is unknown, which has been difficult to verify in the past. In other words, the correctness of data with a recursive structure for which the number of elements has not been determined or a program with a recursive function call for which the number of calls has not been determined is checked against the assertions such as preconditions and postconditions described in the source file. It can be verified by model checking.

<具体例>
次に、図8に示すように、再帰のあるデータ型「struct Node」と、このデータ型を扱い、自分自身への再帰呼出しを行う関数「put」を例として、実施形態として上述した検証用ファイル生成の具体例について説明する。検証対象としてのソースコードを図16の1601(行番号1〜18)に示す。図9は関数 put に関する再帰表明を示したものである。図9において、2行目の @pre は後続の式が事前条件であることを示しており、4行目の @post は後続の式が事後条件であることを示している。
<Specific example>
Next, as shown in FIG. 8, the data type “struct Node” with recursion and the function “put” that handles this data type and makes a recursive call to itself are taken as an example for the verification described above as an embodiment. A specific example of file generation will be described. The source code to be verified is shown in 1601 (line numbers 1 to 18) in FIG. Figure 9 shows the recursive assertion for the function put. In FIG. 9, @pre on the second line indicates that the subsequent expression is a precondition, and @post on the fourth line indicates that the subsequent expression is a postcondition.

事前条件としての2行目の式 __tc( TC0, p, "next", NULL ) は、引数 p を起点としてメンバ変数 next を介して、next の値が NULL になるまでに到達することができる変数の集合を「TC0」と名付けることを示している。   The expression __tc (TC0, p, "next", NULL) on the second line as a precondition is a variable that can be reached by the member variable next starting from the argument p until the next value becomes NULL. Indicates that the set is named “TC0”.

また、3行目の式 __tc_value( TC0, e, ( e->next == NULL ) ||( e->key < e->next->key ) ) は、集合 TC0 の各要素 e に関して、e のメンバ変数next の値が NULL で無ければ、e のメンバ変数 key の値は、e から next を介した1回の推移で到達する要素の key の値よりも小さいことを示している。   The expression __tc_value (TC0, e, (e-> next == NULL) || (e-> key <e-> next-> key))) on the third line is e with respect to each element e of the set TC0. If the value of the member variable next is not NULL, it indicates that the value of the member variable key of e is smaller than the value of the key of the element reached in one transition from e to next.

4行目の式 __tc_modify( __return, TC0, e, e->key == k, e->value == v ) は、集合 TC0 にメンバ key が引数 k と同じ値を持つ要素があれば、その要素のメンバ value は引数 v と同じ値に変更し、変更した結果を含む集合の起点を関数の戻り値とすることを示している。   The expression __tc_modify (__return, TC0, e, e-> key == k, e-> value == v) on the 4th line is used if the set TC0 has an element whose member key has the same value as the argument k. The element member value is changed to the same value as the argument v, indicating that the origin of the set containing the changed result is the return value of the function.

集合 TC0 にメンバ key が引数 k と同じ値を持つ要素が無い場合には、4行目の式は偽と評価されて、5行目の論理和の論理学上の意味に従って、6行目以降の式が評価される。6行目の式 __fresh(e) && e->key == k&& e->value == v は、変数 e に未使用のメモリアドレスを割り当てることと、eのメンバ key および value がそれぞれ引数 k および v と同じ値を持つことを示している。   If the set TC0 has no element whose member key has the same value as the argument k, the expression on the 4th line is evaluated as false, and the 6th and subsequent lines are evaluated according to the logical meaning of the OR of the 5th line. Is evaluated. The expression __fresh (e) && e-> key == k && e-> value == v on line 6 assigns an unused memory address to the variable e, and the members key and value of e are the arguments k and Indicates that it has the same value as v.

7行目の式 __tc_split( TC0, TC1, TC2, d, d->key < k ) は集合 TCOにおけるメンバ key が引数 k よりも小さい値を持つ要素の集合を TC1 と名付け、それ以外の要素の集合を TC2 と名付けたkとを示している。8行目の式 __tc_join( __return, “next", TC1 && e && TC2 ) は、TC1およびTC2内での要素の結合の順番は変えずに、TC1 の各要素と変数 e と TC2 の各要素とをメンバ next により結合し、結合結果としてできた集合の起点を関数の戻り値とすることを示している。   The expression __tc_split (TC0, TC1, TC2, d, d-> key <k) on line 7 names the set of elements whose member key in the set TCO has a value smaller than the argument k as TC1, and sets the other elements It shows k which named the set TC2. The expression __tc_join (__return, “next”, TC1 && e && TC2) on the 8th line does not change the joining order of elements in TC1 and TC2, but changes each element of TC1 Indicates that the return value of the function is the starting point of the set resulting from the join.

検証対象指定モジュール110に、要素数として2、検証対象関数名としてput、検証対象ファイル名として関数putを含むファイルが与えられたとする。   It is assumed that a file including 2 as the number of elements, “put” as the verification target function name, and “put” as the verification target file name is given to the verification target specifying module 110.

構文解析モジュール120は、検証対象のソースファイルを読み込み(図2のステップS201)、ソースコード(図16の1601)を解析して、データ型 struct Node についてのデータ型情報(図10の1011)と関数 put についての関数呼出し情報(図10の1021)を得る。また、ソースコードに付随した再帰表明(図9。図16の行5では仔細省略)を解析し、関数 put についての再帰表明情報(図11の1111から1161)を得る(図2のステップS202)。   The parsing module 120 reads the source file to be verified (step S201 in FIG. 2), analyzes the source code (1601 in FIG. 16), and analyzes the data type information (1011 in FIG. 10) on the data type struct Node. The function call information (1021 in FIG. 10) for the function put is obtained. Further, the recursive assertion (FIG. 9; details omitted in line 5 of FIG. 16) accompanying the source code is analyzed to obtain recursive assertion information (1111 to 1161 of FIG. 11) for the function put (step S202 of FIG. 2). .

指定要素数2に対する限定要素数N=0、1、2の繰り返し(図2のステップS205〜S219)において、N=2の場合を例に説明する。限定表明生成モジュール130は、TC情報(図11の1121)を参照して、要素の個数が2となるデータ構造を表す事前条件(図12の行2’)を生成する(図4のステップS401)。この事前条件は、集合TC0の起点 p およびnextを介して1回推移した要素のそれぞれに未使用のメモリアドレスを割り当て、2回推移した要素にはTC0の終端であるNULLを割り当てることを示している。   The case where N = 2 in the repetition of the limited element number N = 0, 1, and 2 with respect to the designated element number 2 (steps S205 to S219 in FIG. 2) will be described as an example. The limitation assertion generation module 130 refers to the TC information (1121 in FIG. 11) and generates a precondition (row 2 ′ in FIG. 12) representing a data structure in which the number of elements is 2 (step S401 in FIG. 4). ). This precondition indicates that an unused memory address is assigned to each of the elements that have transitioned once through the starting points p and next of the set TC0, and NULL that is the end of TC0 is allocated to the element that has transitioned twice. Yes.

限定表明生成モジュール130は、要素値設定情報(図11の1131)を参照し、要素の値についての事前条件(図12の行3’)を生成する(図4のステップS402)。この事前条件は、p のメンバ key の値が p から next を介して1回推移した要素の key の値よりも小さいことを示している。2回推移した要素は無効なアドレスの代表値であるNULLであるため、1回推移した要素の key 値と2回推移した要素の key 値との関係は事前条件に含めない。   The limitation assertion generation module 130 refers to the element value setting information (1131 in FIG. 11) and generates a precondition (row 3 'in FIG. 12) for the element value (step S402 in FIG. 4). This precondition indicates that the value of the member key of p is smaller than the value of key of the element that has transitioned once from p to next. Since the element that has changed twice is NULL, which is a representative value of an invalid address, the relationship between the key value of the element that has changed once and the key value of the element that has changed twice is not included in the precondition.

事後条件については、限定表明生成モジュール130は、まず要素値変更情報(図11の1141)を参照して情報があることを確認し(図4のステップS403)、再帰データの構造がどのように変わるのかを示す事後条件(図13の行4a’)を生成する(図4のステップS404)。ここでは、事後条件(図13の行4a’)は、関数の戻り値を起点とする再帰データの構造が、関数開始時点の引数 p を起点とする構造と同じであることを示している。データ構造に関する事後条件の生成後は、要素の値がどう変更されたかを示す事後条件(図13の行4b’と4c’)を生成する(図4のステップS405〜407)。図13の行4b’は戻り値が指す要素に関してメンバ value が引数 v に変り、その他の要素・メンバは変らないことを示している。図13の行4c’は戻り値からメンバ next を介して推移した要素に関してメンバ value が引数 v に変り、その他の要素・メンバは変らないことを示している。このようにデータ構造が変らない場合の事後条件を生成すると、次に限定表明生成モジュール130は、TC結合情報(図11の1161)を参照して情報があることを確認し(図4のステップS408)、結合の組合せを計算する(図4のステップS409)。   Regarding the post-condition, the limited assertion generation module 130 first confirms that there is information by referring to the element value change information (1141 in FIG. 11) (step S403 in FIG. 4), and how the recursive data structure is. A post-condition (row 4a ′ in FIG. 13) indicating whether or not to change is generated (step S404 in FIG. 4). Here, the postcondition (line 4a ′ in FIG. 13) indicates that the structure of the recursive data starting from the return value of the function is the same as the structure starting from the argument p at the start of the function. After the generation of the post-condition regarding the data structure, a post-condition (rows 4b 'and 4c' in FIG. 13) indicating how the element value has been changed is generated (steps S405 to 407 in FIG. 4). The row 4b 'in FIG. 13 indicates that the member value is changed to the argument v for the element indicated by the return value, and the other elements and members are not changed. The row 4c 'in FIG. 13 indicates that the member value changes to the argument v with respect to the element transitioned from the return value via the member next, and the other elements and members do not change. After generating the postcondition when the data structure does not change in this way, the limited assertion generation module 130 confirms that there is information by referring to the TC combination information (1161 in FIG. 11) (step of FIG. 4). S408), the combination of the bonds is calculated (step S409 in FIG. 4).

TC結合情報にはTC区分がTCである結合対象TC1とTC2があり、限定要素数N=2の制約の下では、TC1とTC2の要素の数の組合せは(2,0)、(1,1)、(0,2)の3通りである。この3通りについて、限定表明生成モジュール130は事後条件の生成を繰り返す(図4のステップS409〜412)。組合せ(2,0)について、データ構造に関する事後条件が図14の8a’と7a’行である。8a’行は、戻り値およびnext を介した1回目の推移先はTCと同じ要素であり、2回目の推移先は未使用のメモリを割り当てられた新たな要素であり、3回目の推移先はTC0の終端NULLであることを示している。7a’行は、関数の開始時点において引数 p と p から1回推移した要素 p->next のそれぞれのメンバ key が k よりも小さい、即ち これら2個の要素がTC1に属していることを表している。   In the TC connection information, there are TC1 and TC2 to be combined whose TC classification is TC, and under the restriction of the number of limited elements N = 2, the combinations of the numbers of elements of TC1 and TC2 are (2, 0), (1, 1) and (0, 2). For these three types, the limited assertion generation module 130 repeats generation of the postcondition (steps S409 to S412 in FIG. 4). For the combination (2, 0), the post-conditions regarding the data structure are the 8a 'and 7a' lines in FIG. In line 8a ', the first transition destination via the return value and next is the same element as TC, the second transition destination is a new element to which unused memory is allocated, and the third transition destination. Indicates that the end of TC0 is NULL. Line 7a 'indicates that each member key of element p-> next that has transitioned once from arguments p and p at the start of the function is smaller than k, that is, these two elements belong to TC1. ing.

要素の値に関する事後条件は図14の6a’行である。ここでは、戻り値および next を介した1回目の推移先の各メンバの値はTC0において対応する要素の各メンバと同じ値であり、2回目の推移先のメンバ key および value は引数 k およびvと同じ値であることを示している。組合せ(1,1)についてのデータ構造に関する事後条件は図14の8b’と7b’行、要素の値に関する事後条件は図14の6b’行、組合せ(0,2)についてのデータ構造に関する事後条件は図15の8c’と7c’行、要素の値に関する事後条件は図15の6c’行であり、組合せ(2,0)と図14の補足欄に示したような構造と要素の値を示している。再帰関数置換モジュール140は、関数呼出し情報(図10の1021)において、関数 put の被参照関数が put 自身であるという再帰呼出しがあることを確認する(図2のステップS207)。そして、関数 put と戻り値と引数が同じである非再帰関数のダミー関数を生成し、関数 put から put自身への再帰呼出しをダミー関数への通常の関数呼出しに変換する。検証用ファイル出力モジュール150は、限定表明生成モジュール130と再帰関数置換モジュール140による結果を検証用ファイルとして出力する。   The post-condition regarding the element value is the 6a 'line in FIG. Here, the value of each member of the first transition destination via the return value and next is the same value as each member of the corresponding element in TC0, and the members key and value of the second transition destination are the arguments k and v It is the same value as. The post-condition regarding the data structure for the combination (1, 1) is 8b ′ and 7b ′ in FIG. 14, and the post-condition regarding the element value is the post-condition regarding the data structure for the 6b ′ line and the combination (0, 2) in FIG. The conditions are the 8c ′ and 7c ′ lines in FIG. 15 and the post-condition regarding the element value is the 6c ′ line in FIG. 15. The combination (2, 0) and the values of the structure and elements as shown in the supplementary column of FIG. Is shown. The recursive function replacement module 140 confirms in the function call information (1021 in FIG. 10) that there is a recursive call that the referenced function of the function put is put itself (step S207 in FIG. 2). Then, a dummy function of a non-recursive function having the same return value and argument as the function put is generated, and a recursive call from the function put to put itself is converted into a normal function call to the dummy function. The verification file output module 150 outputs the result of the limited assertion generation module 130 and the recursive function replacement module 140 as a verification file.

図16において、置換後の検証用ファイル1602において、4b’〜4c’行は再帰関数置換モジュールにより生成されたダミー関数であり、15’行が put自身への再帰呼出しをダミー関数への呼出しに変えた箇所である。また、図16では4a’行と5’行について図を簡略化するために省略しているが、実際には図12〜図14に記した、要素数を限定した表明がここに存在する。   In FIG. 16, lines 4b ′ to 4c ′ in the verification file 1602 after replacement are dummy functions generated by the recursive function replacement module, and line 15 ′ is a recursive call to put itself as a call to the dummy function. It is a changed place. In FIG. 16, the 4a ′ line and the 5 ′ line are omitted for the sake of simplification, but in reality, there are assertions limited to the number of elements described in FIGS. 12 to 14.

(他の実施形態)
本発明は、上記実施形態の機能を実現する検証プログラムが、システム或いは装置に直接或いは遠隔から供給される場合にも適用可能である。したがって、本発明の機能をコンピュータで実現するために、コンピュータにインストールされるプログラム、或いはそのプログラムを格納した媒体、そのプログラムをダウンロードさせるWWWサーバも、本発明の範疇に含まれる。
(Other embodiments)
The present invention can also be applied to a case where a verification program that realizes the functions of the above-described embodiments is supplied directly or remotely to a system or apparatus. Therefore, in order to realize the functions of the present invention on a computer, a program installed in the computer, a medium storing the program, and a WWW server that downloads the program are also included in the scope of the present invention.

Claims (8)

再帰データに関する再帰表明情報を含む検証対象ソースファイルを解析して前記再帰表明情報を抽出する構文解析手段と、
前記再帰表明情報から、前記再帰データの要素数を所定数に限定した限定表明情報を生成する限定表明生成手段と、
前記検証対象ソースファイルにおいて、前記再帰表明情報を、生成された前記限定表明情報に置換して、モデル検査によるプログラム検証を行なうための検証用ファイルを生成する検証用ファイル生成手段と、
を備えることを特徴とする情報処理装置。
Parsing means for analyzing the source file to be verified including recursive assertion information on recursive data and extracting the recursive assertion information;
From the recursive assertion information, limited assertion generation means for generating limited assertion information in which the number of elements of the recursive data is limited to a predetermined number;
In the verification target source file, the recursive assertion information is replaced with the generated limited assertion information, and verification file generation means for generating a verification file for performing program verification by model checking;
An information processing apparatus comprising:
前記限定表明生成手段は、
前記再帰データの要素数を、0から前記所定数までの各要素数に限定した複数の限定表明情報を生成し、
前記検証用ファイル生成手段は、
前記検証対象ソースファイルにおいて、前記再帰表明情報を、生成された前記複数の限定表明情報の各々に置換して、モデル検査によるプログラム検証を行なうための複数の検証用ファイルを生成することを特徴とする請求項1に記載の情報処理装置。
The limited assertion generation means includes:
Generating a plurality of limited assertion information in which the number of elements of the recursive data is limited to the number of elements from 0 to the predetermined number;
The verification file generation means includes:
In the verification target source file, the recursive assertion information is replaced with each of the generated plurality of limited assertion information, and a plurality of verification files for performing program verification by model checking are generated. The information processing apparatus according to claim 1.
前記限定表明生成手段は、
前記再帰データの要素数を、0から前記所定数までの各要素数に限定した事前条件と、前記再帰データの構造がどのように変わるのかを示す事後条件とを生成することを特徴とする請求項1又は2に記載の情報処理装置。
The limited assertion generation means includes:
A precondition in which the number of elements of the recursive data is limited to each number of elements from 0 to the predetermined number, and a postcondition indicating how the structure of the recursive data changes are generated. Item 3. The information processing apparatus according to item 1 or 2.
前記再帰表明情報は、推移閉包に関する表明を示す情報であり、前記限定表明生成手段は、前記構文解析手段による構文解析により得たデータ型情報に基づいて、推移閉包の要素の数を0から前記所定数までの限定要素数に限定した表明を生成することを特徴とする請求項1、2又は3に記載の情報処理装置。   The recursive assertion information is information indicating an assertion related to transitive closure, and the limited assertion generation unit is configured to change the number of elements of transitive closure from 0 based on data type information obtained by syntax analysis by the syntax analysis unit. The information processing apparatus according to claim 1, 2, or 3, wherein an assertion limited to a limited number of elements up to a predetermined number is generated. 前記検証用ファイル生成手段は、更に、前記検証対象ソースファイルが関数の再帰呼出しを含む場合に、該関数の再帰呼出しを、ダミー関数の呼出しに置換することを特徴とする請求項1乃至4の何れか1項に記載の情報処理装置。   5. The verification file generation means further replaces the recursive call of the function with a call of a dummy function when the verification target source file includes a recursive call of the function. The information processing apparatus according to any one of claims. 前記検証用ファイル生成手段は、前記検証対象ソースファイル中の関数が再帰呼出しを行っている場合に、該関数と同じ引数と関数型と表明とを持つダミー関数を作成し、再帰呼出しをダミー関数の呼出しに変更することを特徴とする請求項1乃至5の何れか1項に記載の情報処理装置。   The verification file generation means creates a dummy function having the same arguments, function type, and assertion as the function when the function in the verification target source file performs a recursive call, and makes the recursive call a dummy function. The information processing apparatus according to claim 1, wherein the information processing apparatus is changed to a call of 再帰データに関する再帰表明情報を含む検証対象ソースファイルを解析して前記再帰表明情報を抽出する構文解析ステップと、
前記再帰表明情報から、前記再帰データの要素数を所定数に限定した限定表明情報を生成する限定表明生成ステップと、
前記検証対象ソースファイルにおいて、前記再帰表明情報を、生成された前記限定表明情報に置換して、モデル検査によるプログラム検証を行なうための検証用ファイルを生成する検証用ファイル生成ステップと、
を含むことを特徴とするプログラム検証方法。
A parsing step for analyzing the source file to be verified including recursive assertion information on recursive data and extracting the recursive assertion information;
From the recursive assertion information, a limited assertion generation step for generating limited assertion information in which the number of elements of the recursive data is limited to a predetermined number;
In the verification target source file, the recursive assertion information is replaced with the generated limited assertion information, and a verification file generating step for generating a verification file for performing program verification by model checking;
A program verification method comprising:
コンピュータに、
再帰データに関する再帰表明情報を含む検証対象ソースファイルを解析して前記再帰表明情報を抽出する構文解析ステップと、
前記再帰表明情報から、前記再帰データの要素数を所定数に限定した限定表明情報を生成する限定表明生成ステップと、
前記検証対象ソースファイルにおいて、前記再帰表明情報を、生成された前記限定表明情報に置換して、モデル検査によるプログラム検証を行なうための検証用ファイルを生成する検証用ファイル生成ステップと、
を実行させることを特徴とするプログラム。
On the computer,
A parsing step for analyzing the source file to be verified including recursive assertion information on recursive data and extracting the recursive assertion information;
From the recursive assertion information, a limited assertion generation step for generating limited assertion information in which the number of elements of the recursive data is limited to a predetermined number;
In the verification target source file, the recursive assertion information is replaced with the generated limited assertion information, and a verification file generating step for generating a verification file for performing program verification by model checking;
A program characterized by having executed.
JP2010016057A 2010-01-27 2010-01-27 Information processing apparatus, program verification method and program Pending JP2011154568A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010016057A JP2011154568A (en) 2010-01-27 2010-01-27 Information processing apparatus, program verification method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010016057A JP2011154568A (en) 2010-01-27 2010-01-27 Information processing apparatus, program verification method and program

Publications (1)

Publication Number Publication Date
JP2011154568A true JP2011154568A (en) 2011-08-11

Family

ID=44540472

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010016057A Pending JP2011154568A (en) 2010-01-27 2010-01-27 Information processing apparatus, program verification method and program

Country Status (1)

Country Link
JP (1) JP2011154568A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014229174A (en) * 2013-05-24 2014-12-08 三菱電機株式会社 Communication data structure compression device, communication data structure decompression device, communication data compression/decompression system, and communication data compression/decompression method
CN111221730A (en) * 2020-01-02 2020-06-02 华数传媒网络有限公司 Automatic testing and asserting method for interface serving network media industry
CN112486796A (en) * 2020-12-30 2021-03-12 智道网联科技(北京)有限公司 Method and device for collecting information of vehicle-mounted intelligent terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000010820A (en) * 1998-06-26 2000-01-14 Hitachi Ltd Method and device for testing one process of multiprocess system
JP2003150267A (en) * 2001-11-16 2003-05-23 Hitachi Software Eng Co Ltd Method for providing service program
JP2009211622A (en) * 2008-03-06 2009-09-17 Nec Corp Contract definition function verification device, method thereof, and program thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000010820A (en) * 1998-06-26 2000-01-14 Hitachi Ltd Method and device for testing one process of multiprocess system
JP2003150267A (en) * 2001-11-16 2003-05-23 Hitachi Software Eng Co Ltd Method for providing service program
JP2009211622A (en) * 2008-03-06 2009-09-17 Nec Corp Contract definition function verification device, method thereof, and program thereof

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CSNG200800444002; 宮崎義昭、橋本祐介: '特集 フォーマルメソッドの新潮流4 Part II:産業界への応用 C言語へのフォーマルメソッドの適用' 情報処理 第49巻,第5号, 20080515, pp.514〜520, 社団法人情報処理学会 *
CSNG200800770005; 橋本祐介、岩崎新一: '解説 高信頼ソフトウェア開発技法の実践的試み' システム/制御/情報 第52巻,第9号, 20080915, pp.27〜28, システム制御情報学会 *
JPN6013040029; 橋本祐介、岩崎新一: '解説 高信頼ソフトウェア開発技法の実践的試み' システム/制御/情報 第52巻,第9号, 20080915, pp.27〜28, システム制御情報学会 *
JPN6013040030; 宮崎義昭、橋本祐介: '特集 フォーマルメソッドの新潮流4 Part II:産業界への応用 C言語へのフォーマルメソッドの適用' 情報処理 第49巻,第5号, 20080515, pp.514〜520, 社団法人情報処理学会 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014229174A (en) * 2013-05-24 2014-12-08 三菱電機株式会社 Communication data structure compression device, communication data structure decompression device, communication data compression/decompression system, and communication data compression/decompression method
CN111221730A (en) * 2020-01-02 2020-06-02 华数传媒网络有限公司 Automatic testing and asserting method for interface serving network media industry
CN111221730B (en) * 2020-01-02 2023-05-26 华数传媒网络有限公司 Interface automation test assertion method for network media industry
CN112486796A (en) * 2020-12-30 2021-03-12 智道网联科技(北京)有限公司 Method and device for collecting information of vehicle-mounted intelligent terminal
CN112486796B (en) * 2020-12-30 2023-07-11 智道网联科技(北京)有限公司 Method and device for collecting information of vehicle-mounted intelligent terminal

Similar Documents

Publication Publication Date Title
JP7371141B2 (en) Tools and methods for real-time dataflow programming languages
Khan Different approaches to black box testing technique for finding errors
Gosain et al. Static analysis: A survey of techniques and tools
WO2012032890A1 (en) Source code conversion method and source code conversion program
Hegedüs et al. Back-annotation of simulation traces with change-driven model transformations
US20070061641A1 (en) Apparatus and method for generating test driver
US11307975B2 (en) Machine code analysis for identifying software defects
CN104090798A (en) Dynamic and static combined interrupt drive program data race detection method
Tahvili et al. Functional dependency detection for integration test cases
Letychevskyi et al. Modeling method for development of digital system algorithms based on programmable logic devices
Nair et al. A static code analysis tool for control system software
JP2011154568A (en) Information processing apparatus, program verification method and program
Elmqvist et al. Safety-oriented design of component assemblies using safety interfaces
Tomar et al. Verification & validation of components with new x component-based model
CN115408289A (en) SCADE model-oriented test case automatic generation method
Ryser et al. On the State of the Art in Requirements-based Validation and Test of Software
WO2013161057A1 (en) Source code inspection method and device
Mateo Navarro et al. A proposal for automatic testing of GUIs based on annotated use cases
Raza et al. An automated approach to system testing based on scenarios and operations contracts
Massicotte et al. Generating aspects-classes integration testing sequences a collaboration diagram based strategy
Sun et al. A hierarchical CPN model automatically generating method aiming at multithreading program algorithm error detection
Nikfard et al. Functional testing on web applications
Wang et al. A static analysis approach for automatic generating test cases for web applications
Javed et al. A Novel Model-Driven Framework for Software and System Testing
Mussa et al. Model-based test cases reuse and optimization

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20121205

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130725

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130814

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130920

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20131210