JP6363027B2 - Verification device, verification system, verification method, and program - Google Patents

Verification device, verification system, verification method, and program Download PDF

Info

Publication number
JP6363027B2
JP6363027B2 JP2015015887A JP2015015887A JP6363027B2 JP 6363027 B2 JP6363027 B2 JP 6363027B2 JP 2015015887 A JP2015015887 A JP 2015015887A JP 2015015887 A JP2015015887 A JP 2015015887A JP 6363027 B2 JP6363027 B2 JP 6363027B2
Authority
JP
Japan
Prior art keywords
code
verification
value
output variable
source code
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.)
Expired - Fee Related
Application number
JP2015015887A
Other languages
Japanese (ja)
Other versions
JP2016143074A (en
Inventor
謹公 梅田
謹公 梅田
ルークウィセントフロレンド シー
ルークウィセントフロレンド シー
大 荒木
大 荒木
朋宏 柳
朋宏 柳
則孝 川勝
則孝 川勝
美裕 佐藤
美裕 佐藤
大野 徹
徹 大野
健児 井筒
健児 井筒
航介 渡邉
航介 渡邉
吉則 長谷部
吉則 長谷部
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.)
Toshiba Corp
Toyota Motor Corp
Toshiba Digital Solutions Corp
Original Assignee
Toshiba Corp
Toyota Motor Corp
Toshiba Digital Solutions 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 Toshiba Corp, Toyota Motor Corp, Toshiba Digital Solutions Corp filed Critical Toshiba Corp
Priority to JP2015015887A priority Critical patent/JP6363027B2/en
Publication of JP2016143074A publication Critical patent/JP2016143074A/en
Application granted granted Critical
Publication of JP6363027B2 publication Critical patent/JP6363027B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Description

本発明の実施形態は、検証装置、検証システム、検証方法およびプログラムに関する。   Embodiments described herein relate generally to a verification apparatus, a verification system, a verification method, and a program.

ソフトウェア開発において、ソースコードは仕様書から作成される。この時、ソフトウェアの設計図となるドキュメントは、基本設計書および詳細設計書等が存在するが、通常、これらは機能(モジュール)毎に作成される。したがって、ソフトウェアの設計および製造を行う際には、機能毎の設計書からモジュールを製造し、それを組み合わせて一つのソフトウェアを製造する。ソフトウェアの仕様を抽出するには、ソフトウェアのソースコードからモジュールを区分けし、そのモジュールごとの振舞いを調査する必要がある。   In software development, source code is created from specifications. At this time, there are a basic design document, a detailed design document, and the like as a document to be a software design drawing. Usually, these are created for each function (module). Therefore, when designing and manufacturing software, modules are manufactured from a design document for each function, and one software is manufactured by combining the modules. In order to extract software specifications, it is necessary to classify modules from the software source code and investigate the behavior of each module.

上述のようなソフトウェアの仕様として、例えば、入力条件と出力値との関係を規定したデシジョンテーブル(決定表)がある。しかし、このようなソフトウェアの仕様が、そのソースコードの振る舞いを正確に規定しているものであるかどうか、または、ソースコードの振る舞いが、ソフトウェアの仕様通りに動作するものであるか否かの等価性の検証をするためには、別途検証ツールが必要となる。   As the above-mentioned software specifications, for example, there is a decision table (decision table) that defines the relationship between input conditions and output values. However, whether such software specifications precisely specify the behavior of the source code, or whether the behavior of the source code operates according to the software specifications. In order to verify equivalence, a separate verification tool is required.

ここで、例えば、ソースコードの振る舞いが、検証範囲(関数中の変数の値の範囲)と、その検証範囲における出力変数の期待値とを設定し、そのソースコードの振る舞いが、設定された検証範囲で、出力変数が期待値となるか否かを検証する技術が提案されている。   Here, for example, the behavior of the source code sets the verification range (value range of the variable in the function) and the expected value of the output variable in the verification range, and the behavior of the source code is set to the verification A technique for verifying whether an output variable is an expected value within a range has been proposed.

特開2013−239008号公報JP 2013-239008 A

しかしながら、上述のような検証技術は、検証範囲と期待値との組み合わせをまとまりとして検証できるのか否か明確ではなく、例えば、デシジョンテーブルのように、入力条件と出力値との組み合わせのまとめた仕様情報を検証するのは適さないという問題点があった。   However, it is not clear whether the verification technology as described above can verify the combination of the verification range and the expected value as a whole. For example, a specification that summarizes the combination of the input condition and the output value as in a decision table. There was a problem that it was not suitable to verify the information.

また、検証対象となるソースコードを検証するために、必要となる検証用のコード(検証ツールが認識するためのコード)を、ソースコードの中にC言語のコメント形式で予め記述しておかなければならないという問題点もあった。   In addition, in order to verify the source code to be verified, the necessary verification code (code for recognition by the verification tool) must be described in advance in the C language comment format in the source code. There was also the problem of having to.

本発明は、上記に鑑みてなされたものであって、検証対象となるソースコードに対してコメント等を記述する必要がなく、デシジョンテーブルとの等価性を検証することができる検証装置、検証システム、検証方法およびプログラムを提供することを目的とする。   The present invention has been made in view of the above, and it is not necessary to describe a comment or the like for a source code to be verified, and a verification device and a verification system that can verify equivalence with a decision table It is an object to provide a verification method and a program.

実施形態の検証装置は、テーブル生成手段と、第1生成手段と、第2生成手段と、コード生成手段と、検証手段と、を備える。テーブル生成手段は、ソースコードから、ソースコードに含まれる出力変数の入力条件に応じた値を示すデシジョンテーブルを生成する。第1生成手段は、入力条件に応じた出力変数の値の変動を示すデシジョンテーブルから、入力条件の真偽の値の組み合わせを抽出して、組み合わせを規定する第1コードを生成する。第2生成手段は、デシジョンテーブルから、第1生成手段により抽出された組み合わせに対応する出力変数の値を抽出し、出力変数の値を規定する第2コードを生成する。コード生成手段は、第1コードを、ソースコードを実行するための実行コードの前段側に付加し、第2コードを、実行コードの後段側に付加することにより検証用コードを生成する。検証手段は、検証用コードを実行することにより、デシジョンテーブルと、ソースコードとの等価性を検証する。テーブル生成手段は、特定手段と、第1変換手段と、作成手段と、第2変換手段と、を有する。特定手段は、ソースコードから出力変数を特定する。第1変換手段は、ソースコードに含まれる式を等価な式に置き換える等価変換処理を実行して、特定手段により特定された出力変数についての方程式を導出する。作成手段は、方程式から入力条件を抽出し、入力条件をノードとする原因結果グラフを作成する。第2変換手段は、原因結果グラフを、入力条件の真偽の値の組み合わせと、出力変数の値との対応関係を示すデシジョンテーブルに変換する。 The verification apparatus according to the embodiment includes a table generation unit, a first generation unit, a second generation unit, a code generation unit, and a verification unit. The table generating means generates a decision table indicating values corresponding to the input conditions of the output variables included in the source code from the source code. The first generation means extracts a combination of true / false values of the input condition from a decision table indicating fluctuations in the value of the output variable according to the input condition, and generates a first code that defines the combination. The second generation unit extracts a value of the output variable corresponding to the combination extracted by the first generation unit from the decision table, and generates a second code that defines the value of the output variable. The code generation means generates the verification code by adding the first code to the preceding stage of the execution code for executing the source code and adding the second code to the succeeding stage of the execution code. The verification unit verifies the equivalence between the decision table and the source code by executing the verification code. The table generation unit includes a specifying unit, a first conversion unit, a creation unit, and a second conversion unit. The specifying unit specifies an output variable from the source code. The first conversion means executes an equivalent conversion process for replacing an expression included in the source code with an equivalent expression, and derives an equation for the output variable specified by the specifying means. The creating means extracts an input condition from the equation and creates a cause / result graph having the input condition as a node. The second conversion means converts the cause / result graph into a decision table indicating the correspondence between the combination of the true / false values of the input condition and the value of the output variable.

図1は、検証装置のハードウェア構成の一例を示す図である。FIG. 1 is a diagram illustrating an example of a hardware configuration of the verification apparatus. 図2は、検証装置の機能ブロックの構成の一例を示す図である。FIG. 2 is a diagram illustrating an example of a functional block configuration of the verification apparatus. 図3は、入力変数から出力変数の値を生成する動作を説明する図である。FIG. 3 is a diagram for explaining the operation of generating the value of the output variable from the input variable. 図4は、仕様抽出動作の一例を示すフローチャートである。FIG. 4 is a flowchart illustrating an example of the specification extraction operation. 図5は、定数伝播処理を説明する図である。FIG. 5 is a diagram for explaining constant propagation processing. 図6は、入力変数伝播処理を説明する図である。FIG. 6 is a diagram for explaining the input variable propagation process. 図7は、枝刈り処理を説明する図である。FIG. 7 is a diagram for explaining the pruning process. 図8は、条件式情報伝播処理を説明する図である。FIG. 8 is a diagram for explaining conditional expression information propagation processing. 図9は、等価変換処理の一部を示すフローチャートである。FIG. 9 is a flowchart showing a part of the equivalent conversion process. 図10は、モジュールのソースコードのサンプルを示す図である。FIG. 10 is a diagram showing a sample of the module source code. 図11は、出力変数を特定する処理を説明する図である。FIG. 11 is a diagram illustrating processing for specifying an output variable. 図12は、定数伝播処理および入力伝播処理を説明する図である。FIG. 12 is a diagram for explaining constant propagation processing and input propagation processing. 図13は、枝刈り処理を説明する図である。FIG. 13 is a diagram illustrating the pruning process. 図14は、条件式情報伝播処理を説明する図である。FIG. 14 is a diagram for explaining conditional expression information propagation processing. 図15は、条件式情報伝播処理を実行して方程式を得る動作を説明する図である。FIG. 15 is a diagram for explaining an operation for obtaining an equation by executing conditional expression information propagation processing. 図16は、論理演算子で表された方程式に変換する動作を説明する図である。FIG. 16 is a diagram for explaining an operation of converting into an equation represented by a logical operator. 図17は、出力変数を仮変数に設定する動作を説明する図である。FIG. 17 is a diagram illustrating an operation for setting an output variable as a temporary variable. 図18は、中間的な原因結果グラフを導出する動作を説明する図である。FIG. 18 is a diagram for explaining an operation of deriving an intermediate cause / result graph. 図19は、最終的な原因結果グラフを導出する動作を説明する図である。FIG. 19 is a diagram for explaining an operation of deriving a final cause / result graph. 図20は、デシジョンテーブルを作成する動作を説明する図である。FIG. 20 is a diagram illustrating an operation for creating a decision table. 図21は、検証用コードを作成する動作の概要を説明する図である。FIG. 21 is a diagram for explaining the outline of the operation for creating the verification code. 図22は、等価性検証動作の一例を示すフローチャートである。FIG. 22 is a flowchart showing an example of the equivalence checking operation. 図23は、事前条件および事後条件のコードを設定する例を示す図である。FIG. 23 is a diagram illustrating an example of setting a precondition and a postcondition code. 図24は、事前条件および事後条件のコードを設定する別の例を示す図である。FIG. 24 is a diagram illustrating another example in which codes for the precondition and the postcondition are set. 図25は、検証用コードを作成する動作の概要を説明する図である。FIG. 25 is a diagram for explaining the outline of the operation for creating the verification code.

以下の図面において、同一の部分には同一の符号が付してある。ただし、図面は模式的なものであり、厚みと平面寸法との関係、各層の厚みの比率等は現実のものとは異なる場合がある。したがって、具体的な厚みおよび寸法は以下の説明を参酌して判断すべきものである。   In the following drawings, the same portions are denoted by the same reference numerals. However, the drawings are schematic, and the relationship between the thickness and the planar dimensions, the ratio of the thickness of each layer, and the like may differ from the actual ones. Therefore, specific thicknesses and dimensions should be determined in consideration of the following description.

(第1の実施形態)
図1は、第1の実施形態に係る検証装置のハードウェア構成の一例を示す図である。図1を参照しながら、検証装置の一例であるPC1のハードウェア構成について説明する。
(First embodiment)
FIG. 1 is a diagram illustrating an example of a hardware configuration of the verification apparatus according to the first embodiment. A hardware configuration of the PC 1 which is an example of the verification apparatus will be described with reference to FIG.

図1に示すように、検証装置の一例であるPC1は、通信部11と、操作部12と、表示部13と、記憶部14と、外部記憶装置15と、制御部16と、CD−ROMドライブ18と、備えている。上述の各部は、バス19によって接続され、互いにデータの送受信が可能となっている。   As shown in FIG. 1, the PC 1, which is an example of a verification device, includes a communication unit 11, an operation unit 12, a display unit 13, a storage unit 14, an external storage device 15, a control unit 16, and a CD-ROM. And a drive 18. The above-described units are connected by a bus 19 and can transmit / receive data to / from each other.

通信部11は、外部機器と通信する装置である。通信部11は、例えば、NIC(Network Interface Card)等の通信装置によって実現される。通信部11の通信プロトコルとして、例えば、TCP(Transmission Control Protocol)/IP(Internet Protocol)またはUDP(User Datagram Protocol)/IP等を適用できる。   The communication unit 11 is a device that communicates with an external device. The communication part 11 is implement | achieved by communication apparatuses, such as NIC (Network Interface Card), for example. For example, TCP (Transmission Control Protocol) / IP (Internet Protocol) or UDP (User Datagram Protocol) / IP can be applied as the communication protocol of the communication unit 11.

操作部12は、ユーザによって制御部16に対して所定の処理を実行させるための操作入力を行う装置である。操作部12は、例えば、マウス、キーボード、テンキー、タッチパッド、またはタッチパネルにおける操作入力機能によって実現される。   The operation unit 12 is a device that performs an operation input for causing the control unit 16 to execute a predetermined process by the user. The operation unit 12 is realized by, for example, an operation input function in a mouse, a keyboard, a numeric keypad, a touch pad, or a touch panel.

表示部13は、制御部16により実行されているアプリケーション画像等を表示する装置である。表示部13は、例えば、CRT(Cathode Ray Tube)ディスプレイ、液晶ディスプレイ、プラズマディスプレイまたは有機EL(Electroluminescence)ディスプレイ等によって実現される。   The display unit 13 is a device that displays an application image or the like being executed by the control unit 16. The display unit 13 is realized by, for example, a CRT (Cathode Ray Tube) display, a liquid crystal display, a plasma display, an organic EL (Electroluminescence) display, or the like.

記憶部14は、PC1で実行される各種プログラムおよびPC1で行われる各種処理に使用されるデータ等を記憶する装置である。記憶部14は、例えば、ROM(Read Only Memory)およびRAM(Random Access Memory)等の記憶装置によって実現される。   The storage unit 14 is a device that stores various programs executed by the PC 1 and data used for various processes performed by the PC 1. The storage unit 14 is realized by a storage device such as a ROM (Read Only Memory) and a RAM (Random Access Memory), for example.

外部記憶装置15は、プログラム、ソースコード、および各種データ等を蓄積して記憶する記憶装置である。外部記憶装置15は、例えば、HDD(Hard Disk Drive)、SSD(Solid State Drive)、光ディスク、または光磁気ディスク(MO:Magneto−Optical Disk)等の記憶装置によって実現される。   The external storage device 15 is a storage device that accumulates and stores programs, source codes, various data, and the like. The external storage device 15 is realized, for example, by a storage device such as a hard disk drive (HDD), a solid state drive (SSD), an optical disk, or a magneto-optical disk (MO: Magneto-Optical Disk).

制御部16は、PC1の各部の動作を制御する装置である。制御部16は、例えば、CPU(Central Processing Unit)およびASIC(Application Specific Integrated Circuit)等で実現される。   The control unit 16 is a device that controls the operation of each unit of the PC 1. The control unit 16 is realized by, for example, a CPU (Central Processing Unit) and an ASIC (Application Specific Integrated Circuit).

CD−ROMドライブ18は、着脱自在な記憶媒体の一例としてのCD−ROM(Compact Disc Read Only Memory)17に対するデータの読み出しおよび書き込みを制御する装置である。なお、上述の着脱可能な記憶媒体の他の例として、CD−R(Compact Disc Recordable)、DVD(Digital Versatile Disk)またはブルーレイディスク等のコンピュータで読み取り可能な記憶媒体に記憶して提供するように構成してもよい。   The CD-ROM drive 18 is a device that controls reading and writing of data with respect to a CD-ROM (Compact Disc Read Only Memory) 17 as an example of a removable storage medium. As another example of the removable storage medium described above, the program is stored in a computer-readable storage medium such as a CD-R (Compact Disc Recordable), a DVD (Digital Versatile Disk), or a Blu-ray disc. It may be configured.

図2は、第1の実施形態に係る検証装置の機能ブロックの構成の一例を示す図である。図2を参照しながら、PC1の機能ブロックの構成について説明する。   FIG. 2 is a diagram illustrating an example of a functional block configuration of the verification apparatus according to the first embodiment. The configuration of functional blocks of the PC 1 will be described with reference to FIG.

図2に示すように、PC1は、各機能を実現する手段として、仕様抽出手段100(テーブル生成手段)と、等価性検証手段150と、記憶手段160と、を有する。   As shown in FIG. 2, the PC 1 includes a specification extraction unit 100 (table generation unit), an equivalence verification unit 150, and a storage unit 160 as units for realizing each function.

仕様抽出手段100は、仕様抽出動作の対象となるソフトウェアのモジュール(対象モジュール)のソースコードから、仕様情報としてのデシジョンテーブル(決定表)を生成する機能部である。仕様抽出手段100は、出力変数特定手段101(特定手段)と、等価変換手段102(第1変換手段)と、グラフ作成手段103(作成手段)と、テーブル変換手段104(第2変換手段)と、を有する。   The specification extraction unit 100 is a functional unit that generates a decision table (decision table) as specification information from the source code of a software module (target module) that is the target of the specification extraction operation. The specification extracting means 100 includes an output variable specifying means 101 (specifying means), an equivalent converting means 102 (first converting means), a graph generating means 103 (creating means), a table converting means 104 (second converting means), Have.

出力変数特定手段101は、仕様抽出動作の対象となるソフトウェアのモジュール(対象モジュール)のソースコード(例えば、後述の第1記憶手段161に記憶されたソースコード)に含まれる出力変数(例えば、グローバル変数)を抽出して特定する機能部である。ここで、グローバル変数とは、ソフトウェアの各モジュールの外で宣言された変数であり、いずれのモジュールにおいても参照および更新が可能な変数である。   The output variable specifying unit 101 is an output variable (for example, a global code) included in a source code (for example, a source code stored in a first storage unit 161 described later) of a software module (target module) that is a target of a specification extraction operation. This is a functional unit that extracts and identifies variables. Here, the global variable is a variable declared outside each module of the software, and can be referred to and updated in any module.

等価変換手段102は、モジュールのソースコードに対して等価変換処理を実行して、ソースコードを縮約し、出力変数についての方程式を導出する機能部である。等価変換処理として、定数伝播処理、入力変数伝播処理、枝刈り処理および条件式情報伝播処理等があるが、各処理の詳細については後述する。   The equivalent conversion means 102 is a functional unit that executes equivalent conversion processing on the module source code, reduces the source code, and derives an equation for the output variable. The equivalent conversion process includes a constant propagation process, an input variable propagation process, a pruning process, a conditional expression information propagation process, and the like. Details of each process will be described later.

グラフ作成手段103は、等価変換手段102により導出された出力変数についての方程式から、原因結果グラフを作成する機能部である。ここで、原因結果グラフとは、1または複数の入力条件をノードとして、各ノードを論理記号により結合し、入力条件の組み合わせから出力値を導出するためのグラフである。原因結果グラフを作成する動作の詳細については後述する。   The graph creation unit 103 is a functional unit that creates a cause / result graph from the equation for the output variable derived by the equivalent conversion unit 102. Here, the cause / result graph is a graph for deriving an output value from a combination of input conditions by using one or a plurality of input conditions as nodes and connecting the nodes with logical symbols. Details of the operation for creating the cause-result graph will be described later.

テーブル変換手段104は、グラフ作成手段103により作成された原因結果グラフをデシジョンテーブルに変換する機能部である。ここで、デシジョンテーブルとは、入力条件の組み合わせから出力変数の値(出力値)がどのような値をとるかを示す表であり、モジュールの振る舞いを表現する、すなわち、モジュールの仕様を決定付けるものである。   The table conversion unit 104 is a functional unit that converts the cause / result graph created by the graph creation unit 103 into a decision table. Here, the decision table is a table showing what value of the output variable (output value) takes from the combination of the input conditions, and expresses the behavior of the module, that is, determines the specification of the module. Is.

等価性検証手段150は、仕様抽出手段100による仕様抽出動作により生成されたデシジョンテーブルと、仕様抽出動作の対象となったソースコードとの等価性を検証する機能部である。ここで、等価性を有するとは、ソースコードを実行した場合に、仕様情報(例えば、デシジョンテーブル)で規定された振る舞い通りに動作する場合をいうものとする。等価性検証手段150は、コード生成手段151と、検証手段152と、結果出力手段153と、を有する。   The equivalence verification unit 150 is a functional unit that verifies the equivalence between the decision table generated by the specification extraction operation by the specification extraction unit 100 and the source code subjected to the specification extraction operation. Here, “having equivalence” refers to a case in which when the source code is executed, it operates according to the behavior defined by the specification information (for example, a decision table). The equivalence verification unit 150 includes a code generation unit 151, a verification unit 152, and a result output unit 153.

コード生成手段151は、ソースコードとデシジョンテーブルとの等価性を検証するための検証用コードを生成する機能部である。コード生成手段151は、事前条件設定手段151a(第1生成手段)と、事後条件設定手段151b(第2生成手段)と、を有する。   The code generation unit 151 is a functional unit that generates a verification code for verifying the equivalence between the source code and the decision table. The code generation unit 151 includes a precondition setting unit 151a (first generation unit) and a post condition setting unit 151b (second generation unit).

事前条件設定手段151aは、等価性の検証対象となるソースコード(以下、検証対象ソースコードという)に対する検証用コードに、仕様抽出手段100により生成されたデシジョンテーブルの入力条件を規定するコード(第1コード)を設定する機能部である。事後条件設定手段151bは、検証対象ソースコードに対する検証用コードに、仕様抽出手段100により生成されたデシジョンテーブルの事前条件設定手段151aにより設定された入力条件に対応する出力変数の値(出力値)を規定するコード(第2コード)を設定する機能部である。   The precondition setting unit 151a is a code that defines the input condition of the decision table generated by the specification extraction unit 100 as the verification code for the source code (hereinafter referred to as the verification target source code) to be verified for equivalence. 1 code). The post-condition setting unit 151b adds the value (output value) of the output variable corresponding to the input condition set by the pre-condition setting unit 151a of the decision table generated by the specification extraction unit 100 to the verification code for the verification target source code. This is a functional unit for setting a code (second code) that defines.

検証手段152は、コード生成手段151により生成された検証用コードを解析し、検証対象ソースコードを実行した場合に、事前条件設定手段151aにより設定された入力条件を満たす場合に、事後条件設定手段151bにより設定された出力値となるか否かを検証する機能部である。検証手段152は、例えば、CBMC(Bounded Model Checking for C/C++)等の既存のモデル検査ツール(モデル検査ソフトウェア)を利用することが可能である。   The verification unit 152 analyzes the verification code generated by the code generation unit 151 and executes the verification target source code. When the input condition set by the precondition setting unit 151a is satisfied, the post-condition setting unit It is a functional unit that verifies whether or not the output value set by 151b is obtained. The verification unit 152 can use an existing model checking tool (model checking software) such as CBMC (Bounded Model Checking for C / C ++).

結果出力手段153は、検証手段152により検証された検証対象ソースコードの検証結果を出力する機能部である。結果出力手段153は、例えば、検証結果をデータとして出力し記憶部14に記憶させて保存するものとしてもよく、検証結果を表示部13に表示させるものとしてもよい。   The result output unit 153 is a functional unit that outputs the verification result of the verification target source code verified by the verification unit 152. For example, the result output unit 153 may output the verification result as data, store it in the storage unit 14 and save it, or display the verification result on the display unit 13.

なお、本実施形態における「モジュール」とは、特定の機能を有するソフトウェア部品であり、その実体であるプログラムのコードを「ソースコード」と記載しているが、双方を明確に区別することを意図するものではない。   Note that the “module” in this embodiment is a software component having a specific function, and the code of the program that is the entity is described as “source code”, but it is intended to clearly distinguish both of them. Not what you want.

記憶手段160は、制御部16により実行される各種プログラム、およびPC1で行われる各種処理に使用されるデータ等を記憶する機能部である。記憶手段160は、図1に示す、記憶部14によって実現される。記憶手段160は、第1記憶手段161と、第2記憶手段162と、を有する。   The storage unit 160 is a functional unit that stores various programs executed by the control unit 16 and data used for various processes performed by the PC 1. The storage unit 160 is realized by the storage unit 14 shown in FIG. The storage unit 160 includes a first storage unit 161 and a second storage unit 162.

第1記憶手段161は、仕様抽出動作の対象、かつ、等価性の検証対象となるソースコードを記憶する機能部である。第2記憶手段162は、仕様抽出手段100により生成されたデシジョンテーブルをデータとして記憶する機能部である。   The first storage unit 161 is a functional unit that stores a source code that is a target of a specification extraction operation and a target of equivalence verification. The second storage unit 162 is a functional unit that stores the decision table generated by the specification extraction unit 100 as data.

上述の出力変数特定手段101、等価変換手段102、グラフ作成手段103、テーブル変換手段104、コード生成手段151、検証手段152および結果出力手段153は、PC1の制御部16が外部記憶装置15等に記憶されたプログラムを記憶部14に読み出して実行することにより実現される。なお、出力変数特定手段101、等価変換手段102、グラフ作成手段103、テーブル変換手段104、コード生成手段151、検証手段152および結果出力手段153は、すべてがプログラムの実行により実現されることに限定されるものではなく、少なくともいずれかが、ハードウェア回路によって実現されるものとしてもよい。   The above-described output variable specifying means 101, equivalent conversion means 102, graph creation means 103, table conversion means 104, code generation means 151, verification means 152, and result output means 153 are controlled by the control unit 16 of the PC 1 in the external storage device 15 or the like. This is realized by reading the stored program into the storage unit 14 and executing it. The output variable specifying means 101, equivalent conversion means 102, graph creation means 103, table conversion means 104, code generation means 151, verification means 152, and result output means 153 are all limited to being realized by executing a program. However, at least one of them may be realized by a hardware circuit.

また、図2に示す機能ブロックの構成は、機能を概念的に示したものであって、このような構成に限定されるものではない。例えば、図2で独立した機能部として図示した複数の機能部を、1つの機能部として構成してもよい。一方、図2の1つの機能部が有する機能を複数の分割し、複数の機能部として構成するものとしてもよい。   Further, the functional block configuration shown in FIG. 2 conceptually shows functions, and is not limited to such a configuration. For example, a plurality of functional units illustrated as independent functional units in FIG. 2 may be configured as one functional unit. On the other hand, the function of one functional unit in FIG. 2 may be divided into a plurality of parts and configured as a plurality of functional parts.

図3は、モジュールが入力変数から出力変数の値を生成する動作を説明する図である。図3を参照しながら、対象モジュール20について、モジュールとしての動作の概要を説明する。   FIG. 3 is a diagram for explaining the operation in which the module generates the value of the output variable from the input variable. With reference to FIG. 3, an outline of the operation of the target module 20 as a module will be described.

図3に示すように、対象モジュール20は、入力変数に格納された値(入力値)に基づいて、所定の処理を実行し、出力変数に出力値を格納して出力する機能を有する。対象モジュール20の入力変数の値は、対象モジュール20の外部から入力されるデータであって、例えば、引数およびグローバル変数に格納される。対象モジュール20の出力変数の値は、対象モジュール20の外部に伝達されるデータであって、例えば、対象モジュール20内で更新されるグローバル変数の値である。このような、対象モジュール20の入出力関係に基づいた動作仕様を抽出することが、上述のデシジョンテーブルを求めることに相当する。   As illustrated in FIG. 3, the target module 20 has a function of executing a predetermined process based on a value (input value) stored in an input variable, storing an output value in an output variable, and outputting the output value. The value of the input variable of the target module 20 is data input from the outside of the target module 20, and is stored in, for example, an argument and a global variable. The value of the output variable of the target module 20 is data transmitted to the outside of the target module 20 and is, for example, the value of a global variable updated in the target module 20. Extracting such operation specifications based on the input / output relationship of the target module 20 corresponds to obtaining the above-described decision table.

図4は、第1の実施形態に係る検証装置の仕様抽出動作の一例を示すフローチャートである。図5は、定数伝播処理を説明する図である。図6は、入力変数伝播処理を説明する図である。図7は、枝刈り処理を説明する図である。図8は、条件式情報伝播処理を説明する図である。図9は、等価変換処理のうち定数伝播処理、入力変数伝播処理および枝刈り処理のループ処理を示すフローチャートである。図4〜9を参照しながら、検証装置であるPC1の仕様抽出動作の流れについて説明する。   FIG. 4 is a flowchart illustrating an example of the specification extraction operation of the verification apparatus according to the first embodiment. FIG. 5 is a diagram for explaining constant propagation processing. FIG. 6 is a diagram for explaining the input variable propagation process. FIG. 7 is a diagram for explaining the pruning process. FIG. 8 is a diagram for explaining conditional expression information propagation processing. FIG. 9 is a flowchart showing loop processing of constant propagation processing, input variable propagation processing, and pruning processing in the equivalent conversion processing. With reference to FIGS. 4 to 9, the flow of the specification extraction operation of the PC 1 as the verification device will be described.

(ステップS10)
出力変数特定手段101は、第1記憶手段161に記憶された対象モジュールのソースコードを読み出して入力する。出力変数特定手段101は、ソースコードに含まれる関数における出力変数を特定する。具体的には、出力変数特定手段101は、出力変数として、ソースコードに含まれる関数における、更新されているグローバル変数を特定する。そして、ステップS11へ移行する。
(Step S10)
The output variable specifying unit 101 reads and inputs the source code of the target module stored in the first storage unit 161. The output variable specifying unit 101 specifies an output variable in a function included in the source code. Specifically, the output variable specifying unit 101 specifies an updated global variable in a function included in the source code as an output variable. Then, the process proceeds to step S11.

なお、出力変数特定手段101は、出力変数として、ソースコードに含まれる関数において、更新されるグローバル変数を特定するものとしているが、これに限定されるものではない。例えば、出力変数特定手段101は、対象モジュールのグローバル変数ではなく、関数の戻り値を、出力変数として特定してもよい。   The output variable specifying unit 101 specifies the global variable to be updated in the function included in the source code as the output variable, but is not limited to this. For example, the output variable specifying unit 101 may specify the return value of the function, not the global variable of the target module, as the output variable.

また、出力変数特定手段101は、第1記憶手段161からソースコードを読み出して入力するものとしたが、これに限定されるものではなく、ユーザが操作部12を介して直接、操作入力したソースコードを入力するものとしてもよい。   The output variable specifying unit 101 reads the source code from the first storage unit 161 and inputs it. However, the present invention is not limited to this, and the source directly input by the user via the operation unit 12 is not limited thereto. It is good also as what inputs a code.

(ステップS11)
等価変換手段102は、対象モジュールのソースコードにおいて等価変換処理を実行し、出力変数についての方程式を導出する。具体的には、等価変換手段102は、等価変換処理として、定数伝播処理、入力変数伝播処理、枝刈り処理および条件式情報伝播処理を実行する。
(Step S11)
The equivalent conversion means 102 performs an equivalent conversion process on the source code of the target module, and derives an equation for the output variable. Specifically, the equivalent conversion unit 102 performs constant propagation processing, input variable propagation processing, pruning processing, and conditional expression information propagation processing as equivalent conversion processing.

ここで、図5を参照しながら、定数伝播処理の内容について説明する。定数伝播処理は、ソースコードにおいて、変数への定数の代入箇所を開始点として、その変数を読み取る(参照する)時点で有効かどうかを判定し、有効である場合、定数に置き換える処理である。図5に示すサンプルコード30に対して、定数伝播処理を実行した結果のコードを定数伝播処理後コード31とする。   Here, the content of the constant propagation process will be described with reference to FIG. The constant propagation process is a process of determining whether or not the source code is valid at the time of reading (referring to) the variable, starting from the position where the constant is assigned to the variable, and replacing it with a constant if valid. A code obtained as a result of executing constant propagation processing for the sample code 30 shown in FIG.

まず、サンプルコード30のコード部300において、定数「1」が変数「A」に代入されているので、この代入している箇所を開始点とする。   First, since the constant “1” is assigned to the variable “A” in the code part 300 of the sample code 30, this assigned location is used as a starting point.

次に、サンプルコード30のコード部301において、変数「A」が参照されている。変数「A」には、コード部300において定数「1」が代入されており、コード部301において、変数「A」を参照すると定数「1」を得ることができるので、この変数「A」を定数「1」に置き換える。その結果、コード部301(「B=A+1;」)は、定数伝播処理後コード31の定数伝播処理後コード部310(「B=2;」)に置き換えることができる。   Next, the variable “A” is referenced in the code portion 301 of the sample code 30. The constant “1” is assigned to the variable “A” in the code part 300, and the constant “1” can be obtained by referring to the variable “A” in the code part 301. Replace with the constant “1”. As a result, the code portion 301 (“B = A + 1;”) can be replaced with the constant propagation post-constant code portion 310 (“B = 2;”) of the post-constant propagation post-processing code 31.

次に、同様に、コード部301が、定数伝播処理後コード部310に置き換えられた結果、サンプルコード30のコード部302(「C=B;」)は、定数伝播処理後コード31の定数伝播処理後コード部311(「C=2;」)に置き換えることができる。   Next, similarly, as a result of replacing the code part 301 with the code part 310 after constant propagation processing, the code part 302 (“C = B;”) of the sample code 30 causes the constant propagation of the code 31 after constant propagation processing. The post-processing code part 311 (“C = 2;”) can be substituted.

そして、コード部300における変数「A」への定数「1」の代入から、サンプルコード30のコード部303(「Func(A);」)は、定数伝播処理後コード31の定数伝播処理後コード部312(「Func(1);」)に置き換えることができる。これは、関数「Func」の引数としての変数「A」が定数「1」に置き換えられたことを意味する。   Then, from the assignment of the constant “1” to the variable “A” in the code part 300, the code part 303 (“Func (A);”) of the sample code 30 is the code after the constant propagation process of the code 31 after the constant propagation process. The unit 312 (“Func (1);”) can be replaced. This means that the variable “A” as an argument of the function “Func” has been replaced with the constant “1”.

以上の動作にように、定数伝播処理は、ソースコード中の変数を定数に置き換えることによって、ソースコードを簡略化して縮約することができる。   As described above, in the constant propagation process, the source code can be simplified and reduced by replacing the variables in the source code with constants.

次に、図6を参照しながら、入力変数伝播処理の内容について説明する。入力変数伝播処理は、グローバル変数である入力変数を使って計算される変数の箇所を起点として、その下流でその変数を用いる式において、その変数を入力変数に置き換える処理をいうものとする。図6に示すサンプルコード30aに対して、入力変数伝播処理を実行した結果のコードを入力変数伝播処理後コード31aとする。   Next, the contents of the input variable propagation process will be described with reference to FIG. The input variable propagation process refers to a process of replacing a variable with an input variable in an expression that uses the variable downstream from the position of the variable calculated using the input variable that is a global variable. A code obtained as a result of executing the input variable propagation process on the sample code 30a shown in FIG.

まず、サンプルコード30aにおけるコード部300aにおいて、入力変数「g1」が変数「a1」に代入されているので、この代入計算されている箇所を起点とする。   First, in the code part 300a in the sample code 30a, since the input variable “g1” is substituted into the variable “a1”, the place where the substitution calculation is performed is used as a starting point.

次に、サンプルコード30aのコード部301a(「a2=a1+1;」)において、コード部300aにおける変数「a1」が計算に用いられているので、入力変数伝播処理後コード31aの入力変数伝播処理後コード部310a(「a2=g1+1;」)に置き換えることができる。   Next, in the code portion 301a (“a2 = a1 + 1;”) of the sample code 30a, since the variable “a1” in the code portion 300a is used for the calculation, after the input variable propagation processing of the code 31a after the input variable propagation processing It can be replaced with the code part 310a (“a2 = g1 + 1;”).

以上の動作のように、入力変数伝播処理は、ソースコード中の変数を入力変数に置き換えることによって、ソースコードを簡略化して縮約することができる。   As described above, in the input variable propagation process, the source code can be simplified and reduced by replacing the variable in the source code with the input variable.

次に、図7を参照しながら、枝刈り処理の内容について説明する。枝刈り処理は、定数伝播処理および入力変数伝播処理を実行した結果、分岐条件式を定数(例えば、if文であれば条件式、switch文であればcase値)に置き換えること等によって、複数の分岐の選択肢のうち、実行されることのない選択肢を削除する処理である。図7に示すサンプルコード30bに対して、枝刈り処理を実行した結果のコードを枝刈り処理後コード31bとする。   Next, the contents of the pruning process will be described with reference to FIG. As a result of executing the constant propagation process and the input variable propagation process, the pruning process replaces a branch conditional expression with a constant (for example, a conditional expression for an if statement, a case value for a switch statement), etc. This is a process for deleting an option that will not be executed from among the branch options. A code obtained by executing the pruning process on the sample code 30b illustrated in FIG. 7 is referred to as a post-pruning code 31b.

サンプルコード30bのコード部300bにおいて、変数「A」に定数「1」が入力されている。したがって、条件分岐式であるサンプルコード30bのコード部301bにおける条件(「A==0」)を満たすことはないので、分岐の選択肢の一つである「分岐1;」が実行されることはない。よって、この実行されることのない「分岐1;」を削除することによって、条件分岐式であるコード部301bは、枝刈り処理後コード31bの枝刈り処理後コード部310b(「分岐2;」)に置き換えることができる。   In the code part 300b of the sample code 30b, a constant “1” is input to the variable “A”. Therefore, since the condition (“A == 0”) in the code part 301b of the sample code 30b that is a conditional branch expression is not satisfied, “branch 1;”, which is one of the branching options, is executed. Absent. Therefore, by deleting the “branch 1;” that is not executed, the code unit 301b that is a conditional branching expression can generate the post-pruning code unit 310b (“branch 2;” of the post-pruning code 31b. ).

以上のように、枝刈り処理は、数行に渡って記述された条件分岐式の記述量を減らす(図7の例では1行)ことができるので、ソースコードを簡略化して縮約することができる。   As described above, the pruning process can reduce the description amount of the conditional branching expression described over several lines (one line in the example of FIG. 7), so the source code can be simplified and reduced. Can do.

次に、図8を参照しながら、条件式情報伝播処理の内容について説明する。条件式情報伝播処理は、条件分岐式(例えば、if文およびswitch文等)を3項式に置き換える処理をいうものとする。図8に示すサンプルコード30cに対して、条件式情報伝播処理を実行した結果のコードを条件式情報伝播処理後コード31cとする。   Next, the contents of the conditional expression information propagation process will be described with reference to FIG. The conditional expression information propagation process refers to a process of replacing a conditional branch expression (for example, an “if” sentence and “switch” sentence) with a ternary expression. A code obtained as a result of executing the conditional expression information propagation process on the sample code 30c shown in FIG.

サンプルコード30cのコード部300cは、if文で表された条件分岐式である。このコード部300cを、3項演算子を用いた3項式に置き換えたのが条件式情報伝播処理後コード31cの条件式情報伝播処理後コード部310c(「b=(A?0:1);」)である。   The code part 300c of the sample code 30c is a conditional branching expression represented by an “if” statement. This code part 300c is replaced with a ternary expression using a ternary operator, and the conditional expression information post-processing code part 310c of the post-conditional information propagation process code 31c ("b = (A? 0: 1)" ;)).

以上のように、条件式情報伝播処理は、数行に渡って記述された条件分岐式を1行の3項式に置き換えることができるので、ソースコードを簡略化して縮約することができる。   As described above, the conditional expression information propagation process can replace a conditional branch expression written over several lines with a one-line ternary expression, so that the source code can be simplified and reduced.

次に、図9を参照しながら、定数伝播処理、入力変数伝播処理および枝刈り処理をループ処理する動作を説明する。枝刈り処理は、上述のように、定数伝播処理および入力変数伝播処理を実行した後等に、分岐条件式を定数に置き換えることが可能となった場合に置き換えることによって、複数の分岐の選択肢のうち、実行されることのない選択肢を削除する処理である。なお、定数伝播処理、入力変数伝播処理および枝刈り処理の実行順序は任意でよい。   Next, with reference to FIG. 9, the operation of performing loop processing of constant propagation processing, input variable propagation processing, and pruning processing will be described. As described above, the pruning process is performed after the constant propagation process and the input variable propagation process are performed. Of these, it is a process of deleting options that will not be executed. The execution order of the constant propagation process, the input variable propagation process, and the pruning process may be arbitrary.

また、枝刈り処理を実行することによって、条件分岐式が簡略化され、分岐の選択肢のうち特定の選択肢が条件分岐式外に出る、すなわち、特定の選択肢が常時実行されることになる。この枝刈り処理により常時実行されることになった選択肢は、新たに、定数伝播処理または入力変数伝播処理により縮約することができる可能性がある。   In addition, by executing the pruning process, the conditional branch expression is simplified, and a specific option out of the branch options comes out of the conditional branch expression, that is, the specific option is always executed. There is a possibility that the options that are always executed by the pruning process can be newly reduced by the constant propagation process or the input variable propagation process.

以上のことから、図9に示す手順で定数伝播処理、入力変数伝播処理および枝刈り処理を実行する。まず、等価変換手段102は、ソースコードに対して、定数伝播処理(ステップS110)および入力変数伝播処理(ステップS111)を実行する。次に、等価変換手段102は、定数伝播処理および入力変数伝播処理によって縮約されたソースコードに対して、枝刈り処理を実行する(ステップS112)。そして、等価変換手段102は、定数伝播処理、入力変数伝播処理および枝刈り処理を実行した結果、ソースコードの縮約が収束したか否か、すなわち、ソースコードがこれ以上縮約できないか否かを判定する。縮約が収束した場合(ステップS113:Yes)、処理を終了し、縮約が収束していない場合(ステップS113:No)、ステップS110へ戻る。   From the above, the constant propagation process, the input variable propagation process, and the pruning process are executed according to the procedure shown in FIG. First, the equivalent conversion means 102 performs constant propagation processing (step S110) and input variable propagation processing (step S111) on the source code. Next, the equivalent conversion unit 102 performs a pruning process on the source code reduced by the constant propagation process and the input variable propagation process (step S112). Then, the equivalence conversion means 102 determines whether or not the contraction of the source code has converged as a result of executing the constant propagation process, the input variable propagation process and the pruning process, that is, whether or not the source code can be further contracted. Determine. If the contraction has converged (step S113: Yes), the process ends. If the contraction has not converged (step S113: No), the process returns to step S110.

以上のように、図9に示す定数伝播処理、入力変数伝播処理および枝刈り処理のループ処理を実行することによって、ソースコードをより確実に縮約することができる。そして、等価変換手段102は、定数伝播処理、入力変数伝播処理および枝刈り処理のループ処理を実行した後、条件式情報伝播処理を実行することによって、3項式で表された、出力変数についての方程式を導出することができる。そして、ステップS12へ移行する。   As described above, by executing the loop process of the constant propagation process, the input variable propagation process, and the pruning process shown in FIG. 9, the source code can be reduced more reliably. Then, the equivalent conversion unit 102 executes the conditional propagation process, the loop process of the constant propagation process, the input variable propagation process, and the pruning process, and then executes the conditional expression information propagation process for the output variable represented by the ternary expression. The following equation can be derived. Then, the process proceeds to step S12.

(ステップS12)
グラフ作成手段103は、等価変換手段102により導出された出力変数についての方程式から、原因結果グラフを作成する。具体的には、グラフ作成手段103は、出力変数についての方程式の各入力条件をノードとして、後述するように、OR記号部、AND記号部およびNOT記号部で結合することにより、出力変数の値(出力値)の振る舞いを把握するための原因結果グラフを作成する。ただし、グラフ作成手段103は、上述のように出力変数についての方程式から、入力条件式のノードがOR記号部、AND記号部およびNOT記号部によって結合された原因結果グラフを作成する。したがって、等価変換手段102は、3項演算子を用いて表された方程式を、論理演算子を用いて表された方程式に変換することが望ましい。また、グラフ作成手段103による出力変数についての方程式から原因結果グラフへの作成手順の詳細は後述する。そして、ステップS13へ移行する。
(Step S12)
The graph creation unit 103 creates a cause / result graph from the equation for the output variable derived by the equivalent conversion unit 102. Specifically, the graph creating unit 103 uses each input condition of the equation for the output variable as a node, and combines the values of the output variable by combining the OR symbol part, the AND symbol part, and the NOT symbol part as will be described later. Create a cause-result graph to understand the behavior of (output value). However, the graph creating means 103 creates a cause / result graph in which the nodes of the input conditional expression are combined by the OR symbol part, the AND symbol part, and the NOT symbol part from the equation for the output variable as described above. Therefore, it is desirable that the equivalent conversion unit 102 converts an equation expressed using a ternary operator into an equation expressed using a logical operator. Details of the procedure for creating the cause-result graph from the equation for the output variable by the graph creating means 103 will be described later. Then, the process proceeds to step S13.

(ステップS13)
テーブル変換手段104は、グラフ作成手段103により作成された原因結果グラフをデシジョンテーブルに変換する。具体的には、テーブル変換手段104は、上述の出力変数についての方程式の入力条件(原因結果グラフにおける入力条件のノード)の値の組み合わせごとに、出力変数の値(出力値)がどのように値をとるかについて表にしたデシジョンテーブルを作成する。また、テーブル変換手段104による原因結果グラフからデシジョンテーブルへの変換手順の詳細は後述する。そして、仕様抽出動作を終了する。
(Step S13)
The table conversion unit 104 converts the cause / result graph created by the graph creation unit 103 into a decision table. Specifically, the table conversion unit 104 determines how the value (output value) of the output variable is different for each combination of values of the input condition (node of the input condition in the cause / result graph) for the above-described output variable. Create a decision table that tabulates whether to take a value. Details of the conversion procedure from the cause / result graph to the decision table by the table conversion means 104 will be described later. Then, the specification extraction operation ends.

図10は、仕様抽出動作の対象となるモジュールのソースコードのサンプルを示す図である。図11は、モジュールに対して出力変数を特定する処理を説明する図である。図12は、モジュールに対して定数伝播処理および入力伝播処理を実行する動作を説明する図である。図13は、モジュールに対して枝刈り処理を実行する動作を説明する図である。図14は、モジュールに対して条件式情報伝播処理を実行する動作を説明する図である。図15は、モジュールに対して条件式情報伝播処理を実行して方程式を得る動作を説明する図である。図16は、3項演算子により表された方程式を論理演算子により表された方程式に変換する動作を説明する図である。図17は、等価変換処理を実行する前に出力変数を仮変数に設定する動作を説明する図である。図10〜17を参照しながら、具体的なモジュールに対する等価変換手段102による等価変換処理について説明する。   FIG. 10 is a diagram illustrating a sample of source code of a module that is a target of the specification extraction operation. FIG. 11 is a diagram illustrating processing for specifying an output variable for a module. FIG. 12 is a diagram for explaining an operation of executing constant propagation processing and input propagation processing for a module. FIG. 13 is a diagram for explaining an operation of executing a pruning process on a module. FIG. 14 is a diagram for explaining an operation of executing conditional expression information propagation processing for a module. FIG. 15 is a diagram for explaining an operation of obtaining an equation by executing conditional expression information propagation processing for a module. FIG. 16 is a diagram for explaining an operation of converting an equation represented by a ternary operator into an equation represented by a logical operator. FIG. 17 is a diagram illustrating an operation of setting an output variable as a temporary variable before executing the equivalent conversion process. With reference to FIGS. 10 to 17, an equivalent conversion process performed by the equivalent conversion unit 102 for a specific module will be described.

図10に示す対象モジュール20は、以下の等価変換処理を実行する前の具体的なサンプルコードである。なお、図10においては、対象モジュール20のソースコードがC言語で記載されているが、これに限定されるものではなく、上述の等価変換処理が実行できるプログラム言語であればよい。   The target module 20 shown in FIG. 10 is a specific sample code before executing the following equivalent conversion process. In FIG. 10, the source code of the target module 20 is described in C language, but the present invention is not limited to this, and any program language that can execute the above-described equivalent conversion process may be used.

まず、図11に示すように、出力変数特定手段101は、対象モジュール20において、更新されているグローバル変数、すなわち出力変数を特定する。図11に示すように、対象モジュール20においては、グローバル変数としては、グローバル変数200(「Output_data」)およびグローバル変数201(「Global_status」)が宣言されている。出力変数特定手段101は、グローバル変数のうち、グローバル変数201は参照されているのみ(「sample_status1=Global_status;」)なので、出力変数ではなく入力変数であると判断する。また、出力変数特定手段101は、グローバル変数のうち、グローバル変数200は書き換えられている(更新されている)(例えば「Output_data=status2;」)ので出力変数であると特定する。   First, as shown in FIG. 11, the output variable specifying unit 101 specifies the updated global variable, that is, the output variable in the target module 20. As shown in FIG. 11, in the target module 20, a global variable 200 (“Output_data”) and a global variable 201 (“Global_status”) are declared as global variables. Since the global variable 201 is only referred to among the global variables (“sample_status1 = Global_status;”), the output variable specifying unit 101 determines that it is not an output variable but an input variable. The output variable specifying unit 101 specifies that the global variable 200 is an output variable because the global variable 200 is rewritten (updated) (for example, “Output_data = status2;”).

対象モジュール20における入力条件部202〜204は、後述するように、等価変換手段102によって導出された出力変数についての方程式における入力条件となるコード部である。   As will be described later, the input condition sections 202 to 204 in the target module 20 are code sections that serve as input conditions in the equations for the output variables derived by the equivalent conversion means 102.

次に、図12に示すように、コード部205において変数「status1」に定数「0」が代入されていることから、「status2=status1+1;」は「status2=1;」と置き換えることができる。したがって、等価変換手段102は、定数伝播処理によって、対象モジュール20のコード部205を、定数伝播処理後コード部210に置き換えることができる。   Next, as shown in FIG. 12, since the constant “0” is assigned to the variable “status1” in the code unit 205, “status2 = status1 + 1;” can be replaced with “status2 = 1;”. Therefore, the equivalent conversion means 102 can replace the code part 205 of the target module 20 with the code part 210 after the constant propagation process by the constant propagation process.

また、変数「statsu2」には定数「1」が代入されていることから、コード部207a〜207c(「Output_data=status2;」)は、「Output_data=1;」に置き換えることができる。したがって、等価変換手段102は、定数伝播処理によって、対象モジュール20のコード部207a〜207cを、それぞれ定数伝播処理後コード部212a〜212cに置き換えることができる。   Further, since the constant “1” is assigned to the variable “status2”, the code parts 207a to 207c (“Output_data = status2;”) can be replaced with “Output_data = 1;”. Therefore, the equivalent conversion means 102 can replace the code portions 207a to 207c of the target module 20 with the post-constant propagation processing code portions 212a to 212c, respectively, by constant propagation processing.

また、変数「status2」には定数「1」が代入されていることから、If文の条件式を示すコード部208(「if((status2==0))」)は、「if((1==0))」に置き換えることができる。したがって、等価変換手段102は、定数伝播処理によって、対象モジュール20のコード部208を、定数伝播処理後コード部213に置き換えることができる。   Since the constant “1” is assigned to the variable “status2”, the code part 208 (“if ((status2 == 0))”) indicating the conditional expression of the If statement is “if ((1 == 0)) ”. Therefore, the equivalent conversion means 102 can replace the code portion 208 of the target module 20 with the post-constant propagation processing code portion 213 by constant propagation processing.

また、コード部206において入力変数「Global_status」が変数「sample_status1」に入力されていることから、「sample_status2=sample_status1+1;」は「sample_status2=Global_status+1;」に置き換えることができる。したがって、等価変換手段102は、入力変数伝播処理によって、対象モジュール20のコード部206を、入力変数伝播処理後コード部211に置き換えることができる。   Also, since the input variable “Global_status” is input to the variable “sample_status1” in the code unit 206, “sample_status2 = sample_status1 + 1;” can be replaced with “sample_status2 = Global_status + 1;”. Therefore, the equivalent conversion means 102 can replace the code part 206 of the target module 20 with the post-input variable propagation process code part 211 by the input variable propagation process.

以上のようにして、等価変換手段102は、定数伝播処理および入力変数伝播処理によって、対象モジュール20を処理後モジュール21に変換する。   As described above, the equivalent conversion unit 102 converts the target module 20 into the post-processing module 21 by the constant propagation process and the input variable propagation process.

次に、図13に示すように、分岐条件式であるコード部214において、図12に示す定数伝播処理後コード部213に相当する条件の部分が「1==0」であるので、「Output_data=1;」は実行されることがない。したがって、等価変換手段102は、枝刈り処理によって、処理後モジュール21のコード部214を、枝刈り処理後コード部220(コードなし)に置き換えることができる。   Next, as shown in FIG. 13, in the code part 214 which is a branch condition expression, the condition part corresponding to the code part 213 after constant propagation processing shown in FIG. 12 is “1 == 0”, so “Output_data” = 1; "is never executed. Therefore, the equivalent conversion means 102 can replace the code part 214 of the post-processing module 21 with the post-pruning code part 220 (no code) by the pruning process.

以上のようにして、等価変換手段102は、枝刈り処理によって、処理後モジュール21を処理後モジュール22に変換する。   As described above, the equivalent conversion unit 102 converts the processed module 21 into the processed module 22 by the pruning process.

次に、図14に示すように、条件分岐式であるコード部221は、3項演算子を用いた3項式に置き換えることができる。すなわち、等価変換手段102は、条件式情報伝播処理によって、処理後モジュール22のコード部221を、3項式である条件式情報伝播処理後コード部230(「Output_data=(!(sample_varialbe2==1)&&sample_flags==1)?1:0;」)に置き換えることができる。   Next, as shown in FIG. 14, the code part 221 which is a conditional branching expression can be replaced with a ternary expression using a ternary operator. That is, the equivalent conversion unit 102 converts the code part 221 of the post-processing module 22 into the post-conditional expression information post-processing code part 230 (“Output_data = (! (Sample_varialbe2 == 1) by the conditional expression information propagation process. ) && sample_flags == 1)? 1: 0; ”).

以上のようにして、等価変換手段102は、条件式情報伝播処理によって、処理後モジュール22を処理後モジュール23に変換する。   As described above, the equivalent conversion unit 102 converts the post-processing module 22 into the post-processing module 23 by the conditional expression information propagation processing.

次に、図15に示すように、条件分岐式であるコード部231は、3項演算子を用いた3項式に置き換えることができる。すなわち、等価変換手段102は、条件式情報伝播処理によって、処理後モジュール23のコード部231を、3項式である条件式情報伝播処理後コード部240(「Output_data=sample_variable1>61?1:((!(sample_variable2==1)&&sample_flags==1)?1:0);」)に置き換えることができる。   Next, as shown in FIG. 15, the code part 231 which is a conditional branching expression can be replaced with a ternary expression using a ternary operator. That is, the equivalent conversion unit 102 converts the code part 231 of the post-processing module 23 into a post-conditional expression information propagation post-processing code part 240 (“Output_data = sample_variable1> 61? 1 :() by conditional expression information propagation processing. (! (Sample_variable2 == 1) && sample_flags == 1)? 1: 0); ").

以上のようにして、等価変換手段102は、条件式情報伝播処理によって、処理後モジュール23を処理後モジュール24に変換する。この変換された処理後モジュール24の条件式情報伝播処理後コード部240の方程式が、等価変換手段102によって導出される出力変数ついての方程式となる。ただし、上述したように、後工程の原因結果グラフは、グラフ作成手段103により、入力条件式のノードがOR記号部、AND記号部およびNOT記号部によって結合されて作成される。したがって、図16に示すように、等価変換手段102は、導出した条件式情報伝播処理後コード部240に示す3項演算子を用いた表された方程式を、論理演算子を用いて表された方程式241(「Output_data=(sample_variable1>61)||!(sample_variable1>61)&&!(sample_variable2==1)&&sample_flags==1」)に変換する。すなわち、方程式241が、等価変換手段102が最終的に導出する出力変数についての方程式である。   As described above, the equivalent conversion unit 102 converts the post-processing module 23 into the post-processing module 24 by the conditional expression information propagation processing. The converted equation of the post-condition information transmission processing code unit 240 of the post-processing module 24 becomes an equation for the output variable derived by the equivalent conversion means 102. However, as described above, the cause / result graph of the post-process is created by the graph creation unit 103 by combining the nodes of the input conditional expression by the OR symbol part, the AND symbol part, and the NOT symbol part. Therefore, as shown in FIG. 16, the equivalent conversion unit 102 expressed the expressed equation using the ternary operator shown in the derived conditional expression information propagation post-processing code unit 240 using the logical operator. The equation 241 (“Output_data = (sample_variable1> 61) ||! (Sample_variable1> 61) &&! (Sample_variable2 == 1) && sample_flags == 1”) is converted. That is, the equation 241 is an equation for the output variable finally derived by the equivalent conversion means 102.

以上のように、等価変換手段102による等価変換処理(定数伝播処理、入力変数伝播処理、枝刈り処理および条件式情報伝播処理)によって、モジュールのソースコードを縮約することができ、それによって縮約された出力変数についての方程式を導出することができる。   As described above, the module source code can be reduced by the equivalent conversion process (constant propagation process, input variable propagation process, pruning process, and conditional expression information propagation process) by the equivalent conversion unit 102, thereby reducing the module source code. An equation for the reduced output variable can be derived.

なお、モジュールのソースコードにおいて出力変数を使って計算する式がない場合、出力変数が等価変換手段102による等価変換処理のうちの枝刈り処理によって、出力変数についての方程式が削除されてしまう場合がある。この場合、図17の対象モジュール25の仮変数設定コード部250に示すように、出力変数特定手段101により特定された出力変数(図17では「V1」、「V2」および「V3」)を、仮変数(図17では「tmp_V1」、「tmp_V2」および「tmp_V3」)に代入処理を実行すればよい。これによって、等価変換手段102によって対象モジュール25から等価変換後モジュール26に変換された場合、仮変数設定コード部250は、仮変数(実質は出力変数)についての方程式である方程式コード部260に変換され、方程式が削除されてしまうことを防止できる。   If there is no expression to be calculated using the output variable in the module source code, the equation for the output variable may be deleted by the pruning process in the equivalent conversion process by the equivalent conversion means 102. is there. In this case, as shown in the temporary variable setting code section 250 of the target module 25 in FIG. 17, the output variables (“V1”, “V2” and “V3” in FIG. 17) specified by the output variable specifying unit 101 are Substitution processing may be executed for temporary variables (“tmp_V1”, “tmp_V2”, and “tmp_V3” in FIG. 17). As a result, when the equivalent conversion means 102 converts the target module 25 to the post-equivalent conversion module 26, the temporary variable setting code unit 250 converts into an equation code unit 260 that is an equation for the temporary variable (substantially an output variable). It is possible to prevent the equation from being deleted.

図18は、方程式の入力条件の論理式からOR記号部およびAND記号部によって中間的な原因結果グラフを導出する動作を説明する図である。図19は、中間的な原因結果グラフからNOT記号部および同一式のノードの統合によって最終的な原因結果グラフを導出する動作を説明する図である。図18および19を参照しながら、グラフ作成手段103による原因結果グラフの作成について説明する。   FIG. 18 is a diagram for explaining the operation of deriving an intermediate cause / result graph from the logical expression of the input condition of the equation by the OR symbol part and the AND symbol part. FIG. 19 is a diagram for explaining an operation of deriving a final cause / result graph from the intermediate cause / result graph by integrating the NOT symbol part and the nodes of the same expression. The creation of the cause / result graph by the graph creation means 103 will be described with reference to FIGS.

まず、図18に示すように、グラフ作成手段103は、等価変換手段102によって導出された図16に示す方程式241の右辺(入力条件が論理演算子で結合された式)を抽出する。OR演算子(「||」)、AND演算子(「&&」)、NOT演算子(「!」)の順に演算の優先順位が高くなるので、グラフ作成手段103は、OR演算子によって結合された入力条件をそれぞれ抽出し、それぞれの入力条件をノードとして、各ノードを図18に示すOR記号部60によって結合させる。具体的には、グラフ作成手段103は、方程式241の右辺のうちOR演算子で結合された入力条件「sample_variable1>61」および「!(sample_variable1>61)&&!(sample_variable2==1)&&sample_flags==1」を、それぞれノード40、41としてOR記号部60で結合させる。ノード40とノード41とのOR演算の結果が出力値となり、グラフ作成手段103は、OR記号部60の出力側と、出力値を示す出力値ノード70とを結合させる。   First, as shown in FIG. 18, the graph creating unit 103 extracts the right side of the equation 241 shown in FIG. 16 derived by the equivalent conversion unit 102 (an expression in which input conditions are combined with a logical operator). Since the priority of operations increases in the order of the OR operator (“||”), the AND operator (“&&”), and the NOT operator (“!”), The graph creating means 103 is coupled by the OR operator. Each input condition is extracted, and each node is connected by the OR symbol unit 60 shown in FIG. 18 with each input condition as a node. Specifically, the graph creating unit 103 inputs the input conditions “sample_variable1> 61” and “! (Sample_variable1> 61) &&! (Sample_variable2 == 1) && sample_flags == 1 ”are coupled by the OR symbol part 60 as nodes 40 and 41, respectively. The result of the OR operation between the node 40 and the node 41 becomes the output value, and the graph creating unit 103 couples the output side of the OR symbol part 60 and the output value node 70 indicating the output value.

次に、グラフ作成手段103は、生成した各ノードの入力条件において、AND演算子によって結合された入力条件をそれぞれ抽出し、それぞれの入力条件を新たなノードとして、各ノードを図18に示すAND記号部61によって結合させる。具体的には、グラフ作成手段103は、ノード41の入力条件のうちAND演算子で結合された入力条件「!(sample_variable1>61)」、「!(sample_variable2==1)」および「sample_flags==1」を、それぞれ、ノード42〜44としてAND記号部61で結合させる。そして、グラフ作成手段103は、AND記号部61の出力側と、OR記号部60とを結合させる。   Next, the graph creation means 103 extracts the input conditions combined by the AND operator in the input conditions of each generated node, sets each input condition as a new node, and sets each node to the AND shown in FIG. The symbols 61 are combined. Specifically, the graph creating unit 103 includes input conditions “! (Sample_variable1> 61)”, “! (Sample_variable2 == 1)” and “sample_flags ==” which are combined with an AND operator among the input conditions of the node 41. 1 ”are coupled by the AND symbol part 61 as nodes 42 to 44, respectively. Then, the graph creating unit 103 couples the output side of the AND symbol part 61 with the OR symbol part 60.

次に、図19に示すように、グラフ作成手段103は、生成した各ノードの入力条件において、NOT演算子を含む入力条件を抽出し、NOT演算子を外した入力条件を新たなノードとして、そのノードを図19に示すNOT演算子と結合させる。具体的には、グラフ作成手段103は、ノード42の入力条件「!(sample_variable1>61)」にNOT演算子が含まれるので、NOT演算子を外した入力条件「sample_variable1>61」を新たなノードであるノード42aとする。そして、グラフ作成手段103は、ノード42aを、NOT記号部62aを介してAND記号部61に結合させる。また、グラフ作成手段103は、ノード43の入力条件「!(sample_variable2==1)」にNOT演算子が含まれるので、NOT演算子を外した入力条件「sample_variable2==1」を新たなノードであるノード43aとする。そして、グラフ作成手段103は、ノード43aを、NOT記号部62bを介してAND記号部61に結合させる。   Next, as illustrated in FIG. 19, the graph creating unit 103 extracts the input condition including the NOT operator in the generated input condition of each node, and sets the input condition from which the NOT operator is removed as a new node. The node is combined with the NOT operator shown in FIG. Specifically, since the NOT operator is included in the input condition “! (Sample_variable1> 61)” of the node 42, the graph creating unit 103 sets the input condition “sample_variable1> 61” from which the NOT operator is removed as a new node. Is a node 42a. Then, the graph creating means 103 couples the node 42a to the AND symbol portion 61 via the NOT symbol portion 62a. Further, since the NOT condition is included in the input condition “! (Sample_variable2 == 1)” of the node 43, the graph creating unit 103 sets the input condition “sample_variable2 == 1” from which the NOT operator is removed as a new node. A node 43a is assumed. Then, the graph creating means 103 couples the node 43a to the AND symbol portion 61 via the NOT symbol portion 62b.

次に、グラフ作成手段103は、ここまでで生成したノードのうち、入力条件が同一式であるノードを1つのノードに統一する。具体的には、グラフ作成手段103は、ノード40およびノード42aの入力条件が「sample_variable1>61」で同一式なので、ノード40とノード42aとを1つのノード45に統一する。   Next, the graph creating unit 103 unifies the nodes having the same input condition into one node among the nodes generated so far. Specifically, the graph creating unit 103 unifies the node 40 and the node 42a into one node 45 because the input conditions of the node 40 and the node 42a are “sample_variable1> 61” and the same expression.

このように、グラフ作成手段103は、等価変換手段102より導出された方程式241から、右辺に含まれる入力条件をノードとしてOR記号部、AND記号部およびNOT記号部で結合させ、同一式の入力条件を1つのノードに統一させることによって、原因結果グラフを作成する。   As described above, the graph creating unit 103 combines the input conditions included in the right side from the equation 241 derived from the equivalent conversion unit 102 as nodes in the OR symbol part, the AND symbol part, and the NOT symbol part, and inputs the same expression. A cause / effect graph is created by unifying the conditions into one node.

以上のように、グラフ作成手段103は、出力変数の方程式における入力条件を抽出して、抽出した入力条件をノードとして、論理記号(OR記号部、AND記号部およびNOT記号部)によって結合し、共通のノードを統合している。これによって、等価変換手段102により導出された出力変数についての方程式から、縮約された原因結果グラフを作成することができる。   As described above, the graph creating unit 103 extracts the input condition in the equation of the output variable, and combines the extracted input condition as a node by using logical symbols (OR symbol part, AND symbol part, and NOT symbol part), A common node is integrated. As a result, a reduced cause-result graph can be created from the equation for the output variable derived by the equivalent conversion means 102.

図20は、原因結果グラフからデシジョンテーブルを作成する動作を説明する図である。図20を参照しながら、テーブル変換手段104による原因結果グラフからデシジョンテーブルへの変換について説明する。   FIG. 20 is a diagram for explaining the operation of creating a decision table from the cause / result graph. The conversion from the cause / result graph to the decision table by the table conversion means 104 will be described with reference to FIG.

図20に示すように、テーブル変換手段104は、グラフ作成手段103により作成された原因結果グラフをデシジョンテーブル50に変換する。デシジョンテーブルの形式は、様々な形式が存在するが、本実施形態においては、図20に示すデシジョンテーブル50のように、入力条件を示す「入力」、および出力変数を示す「出力」の各列で構成されたテーブルを作成するものとする。ただし、デシジョンテーブルの形式は、上述に限定されるものではない。   As shown in FIG. 20, the table conversion unit 104 converts the cause / result graph created by the graph creation unit 103 into a decision table 50. There are various formats for the decision table. In this embodiment, as in the decision table 50 shown in FIG. 20, each column of “input” indicating an input condition and “output” indicating an output variable are provided. A table composed of However, the format of the decision table is not limited to the above.

具体的には、まず、テーブル変換手段104は、テーブルの「入力」(入力条件)の欄に、グラフ作成手段103により作成された原因結果グラフにおけるすべてのノードの入力条件をそれぞれ記載する。図20においては、入力条件として、「sample_variable1>61」、「sample_variable2==1」および「sample_flags==1」が記載されている。そして、テーブル変換手段104は、テーブルの「出力」(出力変数)の欄に、出力変数を記載する。図20においては、出力変数として、「Output_data」が記載されている。   Specifically, the table conversion unit 104 first describes the input conditions of all the nodes in the cause / result graph created by the graph creation unit 103 in the “input” (input condition) column of the table. In FIG. 20, “sample_variable1> 61”, “sample_variable2 == 1”, and “sample_flags = 1” are described as input conditions. Then, the table conversion unit 104 describes the output variable in the “output” (output variable) column of the table. In FIG. 20, “Output_data” is described as an output variable.

次に、テーブル変換手段104は、原因結果グラフに基づいて、各入力条件が真値「T」(true)であるか、偽値「F」(false)であるかの組み合わせによって、出力値が取り得る値である「1」および「0」のいずれとなるかについての対応関係を記載する。   Next, based on the cause / result graph, the table conversion unit 104 determines whether each output condition is a true value “T” (true) or a false value “F” (false). The correspondence relationship between “1” and “0”, which are possible values, is described.

原因結果グラフから、入力条件「sample_variable1>61」が真値「T」であれば、入力条件「sample_variable2==1」および「sample_flags==1」の真偽に関わりなく、出力値は「1」となる。したがって、テーブル変換手段104は、テーブルに、入力条件「sample_variable1>61」が真値「T」の場合、出力値は「1」となる対応関係を記載する。このとき、テーブルにおける入力条件「sample_variable2==1」および「sample_flags==1」の欄は空欄としている。   If the input condition “sample_variable1> 61” is a true value “T”, the output value is “1” regardless of whether the input conditions “sample_variable2 == 1” and “sample_flags == 1”. It becomes. Accordingly, the table conversion unit 104 describes a correspondence relationship in which the output value is “1” when the input condition “sample_variable1> 61” is a true value “T”. At this time, the fields of the input conditions “sample_variable2 == 1” and “sample_flags == 1” in the table are blank.

また、原因結果グラフから、入力条件「sample_variable1>61」が偽値「F」、かつ入力条件「sample_flags==1」が真値「T」の場合、入力条件「sample_variable2==1」の真偽によって、出力値は異なる。すなわち、入力条件「sample_variable2==1」が偽値「F」の場合、出力値は「1」となり、真値「T」の場合、出力値は「0」となる。したがって、テーブル変換手段104は、テーブルに、入力条件「sample_variable1>61」が偽値「F」、「sample_variable2==1」が偽値「F」、かつ「sample_flags==1」が真値「T」の場合、出力値は「1」となる対応関係を記載する。また、テーブル変換手段104は、テーブルに、入力条件「sample_variable1>61」が偽値「F」、「sample_variable2==1」が真値「T」、かつ「sample_flags==1」が真値「T」の場合、出力値は「0」となる対応関係を記載する。   Further, from the cause / result graph, if the input condition “sample_variable1> 61” is a false value “F” and the input condition “sample_flags == 1” is a true value “T”, the truth / false of the input condition “sample_variable2 == 1”. Depending on the output value. That is, when the input condition “sample_variable2 == 1” is a false value “F”, the output value is “1”, and when the input condition is “T”, the output value is “0”. Therefore, the table conversion unit 104 includes a table in which the input condition “sample_variable1> 61” is the false value “F”, “sample_variable2 == 1” is the false value “F”, and “sample_flags == 1” is the true value “T”. In the case of “”, the correspondence relationship in which the output value is “1” is described. Further, the table conversion means 104 stores the input condition “sample_variable1> 61” in the table as a false value “F”, “sample_variable2 == 1” as a true value “T”, and “sample_flags == 1” as a true value “T”. ", A correspondence relationship in which the output value is" 0 "is described.

また、原因結果グラフから、入力条件「sample_variable1>61」および「sample_flags==1」が偽値「F」であれば、入力条件「sample_variable2==1」の真偽に関わりなく、出力値は「0」となる。したがって、テーブル変換手段104は、テーブルに、入力条件「sample_variable1>61」および「sample_flags==1」が偽値「F」の場合、出力値は「0」となる対応関係を記載する。このとき、テーブルにおける入力条件「sample_variable2==1」の欄は空欄としている。   In addition, if the input conditions “sample_variable1> 61” and “sample_flags = 1” are false values “F”, the output value is “regardless of whether the input conditions“ sample_variable2 == 1 ”are true or false. 0 ". Therefore, the table conversion unit 104 describes a correspondence relationship in which the output value is “0” when the input conditions “sample_variable1> 61” and “sample_flags == 1” are false values “F”. At this time, the column of the input condition “sample_variable2 == 1” in the table is blank.

以上の動作によって、テーブル変換手段104は、グラフ作成手段103により作成された原因結果グラフを、図20に示すデシジョンテーブル50に変換する。このように、テーブル変換手段104は、等価変換手段102により導出された、縮約された出力変数についての方程式から、グラフ作成手段103により縮約された原因結果グラフが作成され、この縮約された原因結果グラフに基づいてデシジョンテーブル50に変換している。これによって、グラフ作成手段103により作成された原因結果グラフから、最適化された入力条件の組み合わせから構成されたコンパクトなデシジョンテーブルを求めることができる。   With the above operation, the table conversion unit 104 converts the cause / result graph created by the graph creation unit 103 into a decision table 50 shown in FIG. As described above, the table conversion unit 104 generates the cause / result graph reduced by the graph generation unit 103 from the reduced output variable equation derived by the equivalent conversion unit 102 and reduces the reduced result. Based on the cause / result graph, the decision table 50 is converted. As a result, a compact decision table composed of a combination of optimized input conditions can be obtained from the cause / result graph created by the graph creation means 103.

なお、上述したソースコードからデシジョンテーブルを生成する方法は一例であり、これに限定されるものではなく、その他の方法でデシジョンテーブルを生成するものとしてもよい。   Note that the above-described method for generating a decision table from the source code is an example, and the present invention is not limited to this. The decision table may be generated by other methods.

図21は、第1の実施形態に係る検証装置のデシジョンテーブルから検証用コードを作成する動作の概要を説明する図である。図21を参照ながら、本実施形態に係る検証装置であるPC1の等価性検証動作の流れの概要について説明する。   FIG. 21 is a diagram for explaining an overview of an operation for creating a verification code from the decision table of the verification apparatus according to the first embodiment. With reference to FIG. 21, an outline of the flow of the equivalence checking operation of the PC 1, which is the verification device according to the present embodiment, will be described.

図21に示すように、検証対象ソースコード80は、上述のように仕様抽出手段100により仕様情報であるデシジョンテーブル81が生成されているものとする。次に、等価性検証手段150のコード生成手段151は、デシジョンテーブル81の入力条件のそれぞれの真偽の値を示す行(以下、入力条件行という)を抜き出して、検証対象ソースコード80の前段側に、その入力条件行の入力条件を規定するコード(事前条件部82)を設定する。また、コード生成手段151は、デシジョンテーブル81から抜き出した入力条件行に対応する出力変数の値(出力値)を抜き出し、検証対象ソースコード80の後段側に、その出力値を規定するコード(事後条件部83)を設定する。このように、コード生成手段151は、事前条件部82、検証対象ソースコード80、および事後条件部83を含んだ検証用コード84を生成する。   As shown in FIG. 21, in the verification target source code 80, it is assumed that a decision table 81, which is specification information, is generated by the specification extraction unit 100 as described above. Next, the code generation unit 151 of the equivalence verification unit 150 extracts lines indicating the true / false values of the input conditions of the decision table 81 (hereinafter referred to as input condition lines), and the preceding stage of the verification target source code 80. On the side, a code (pre-condition unit 82) that defines the input condition of the input condition line is set. In addition, the code generation unit 151 extracts the value (output value) of the output variable corresponding to the input condition line extracted from the decision table 81, and the code (post facto) specifying the output value on the subsequent stage side of the verification target source code 80 The condition part 83) is set. As described above, the code generation unit 151 generates the verification code 84 including the precondition unit 82, the verification target source code 80, and the postcondition unit 83.

次に、コード生成手段151は、生成した検証用コード84を、検証ツール85(図2の検証手段152に相当)に出力する。検証用コード84を入力した検証ツール85は、検証用コード84を解析し、検証対象ソースコード80を実行した場合に、コード生成手段151により設定された入力条件を満たす場合に、設定された出力値となるか否かを検証する。そして、検証ツール85は、検証の結果(OK・NG判定)を出力する。   Next, the code generation unit 151 outputs the generated verification code 84 to the verification tool 85 (corresponding to the verification unit 152 in FIG. 2). The verification tool 85 to which the verification code 84 has been input analyzes the verification code 84 and executes the verification target source code 80, and when the input condition set by the code generation unit 151 is satisfied, the set output It is verified whether it becomes a value. Then, the verification tool 85 outputs a verification result (OK / NG determination).

図22は、第1の実施形態に係る検証装置の等価性検証動作の一例を示すフローチャートである。図23は、検証用コードに事前条件および事後条件のコードを設定する例を示す図である。図24は、検証用コードに事前条件および事後条件のコードを設定する別の例を示す図である。図22〜24を参照ながら検証装置であるPC1の等価性検証動作の流れの詳細について説明する。なお、図22においては、簡便に記載するため、デシジョンテーブルを「DT」と記載している。   FIG. 22 is a flowchart illustrating an example of the equivalence checking operation of the verification device according to the first embodiment. FIG. 23 is a diagram illustrating an example of setting the precondition and postcondition codes in the verification code. FIG. 24 is a diagram illustrating another example in which a precondition code and a postcondition code are set in the verification code. The details of the flow of the equivalence checking operation of the PC 1 that is the verification device will be described with reference to FIGS. In FIG. 22, the decision table is described as “DT” for simple description.

(ステップS21)
等価性検証手段150のコード生成手段151は、記憶手段160の第1記憶手段161に記憶された、仕様抽出動作の対象、かつ、等価性の検証対象となるソースコード(検証対象ソースコード)を読み出して入力する。さらに、コード生成手段151は、記憶手段160の第2記憶手段162に記憶された、検証対象ソースコードに対する仕様抽出動作により生成されたデシジョンテーブルを読み出して入力する。また、コード生成手段151は、図23に示すように、例えば、検証対象ソースコードのうち、関数「func01」について、仕様情報であるデシジョンテーブル90との等価性の検証動作を行う。すなわち、デシジョンテーブル90は、関数「func01」に含まれる出力変数「z」のデシジョンテーブルである。
(Step S21)
The code generation unit 151 of the equivalence verification unit 150 stores the source code (verification target source code) that is the target of the specification extraction operation and the verification target of the equivalence stored in the first storage unit 161 of the storage unit 160. Read and input. Further, the code generation unit 151 reads and inputs the decision table generated by the specification extraction operation for the verification target source code stored in the second storage unit 162 of the storage unit 160. 23, for example, the function “func01” of the verification target source code performs the verification operation of the equivalence with the decision table 90 that is the specification information. That is, the decision table 90 is a decision table for the output variable “z” included in the function “func01”.

図23に示すように、コード生成手段151は、関数「func01」を検証対象とするために、検証用コード91において、関数「func01」を使用するためのヘッダファイル「func01.h」をインクルードするためのコードを、3行目に追記する。次に、コード生成手段151は、ソースコードが外部ファイルで記述されている関数「func01」を検証用コード91内で呼び出すために、extern宣言(プロトタイプ宣言)をするためのコードを、6行目に追記する。そして、コード生成手段151は、単純に関数「func01」を実行するための関数「cprover_main」(引数・戻り値なし)を、13行目に追記し、関数「func01」を実行するコード「func01();」(以下、実行コードという)を、19行目に追記する。なお、単純に関数「func01」を実行するための関数名は、一例であり任意の関数名でよい。   As illustrated in FIG. 23, the code generation unit 151 includes the header file “func01.h” for using the function “func01” in the verification code 91 in order to set the function “func01” as a verification target. Add the code for the third line. Next, the code generation unit 151 adds a code for making an “extern” declaration (prototype declaration) in order to call the function “func01” in which the source code is described in an external file in the verification code 91. Add to Then, the code generation unit 151 simply adds a function “cprover_main” (no argument / return value) for executing the function “func01” to the 13th line, and executes the function “func01” by executing the code “func01 ( ); ”(Hereinafter referred to as execution code) is added to the 19th line. The function name for simply executing the function “func01” is an example and may be an arbitrary function name.

なお、コード生成手段151は、第1記憶手段161からソースコードを読み出して入力するものとしたが、これに限定されるものではなく、ユーザが操作部12を介して直接、操作入力したソースコードを入力するものとしてもよい。   The code generation unit 151 reads the source code from the first storage unit 161 and inputs it. However, the present invention is not limited to this, and the source code directly input by the user via the operation unit 12 is not limited thereto. It is good also as what inputs.

(ステップS22)
コード生成手段151の事前条件設定手段151aは、デシジョンテーブル90から1行ずつ入力条件行を抜き出す(抽出する)。具体的には、図23に示すように、例えば、事前条件設定手段151aが抜き出した行を入力条件行900とする。
(Step S22)
The pre-condition setting unit 151a of the code generation unit 151 extracts (extracts) input condition lines line by line from the decision table 90. Specifically, as shown in FIG. 23, for example, a line extracted by the precondition setting unit 151a is set as an input condition line 900.

また、コード生成手段151の事後条件設定手段151bは、デシジョンテーブル90から事前条件設定手段151aにより抜き出された入力条件行に対応する出力変数の値(出力値)を抜き出す(抽出する)。具体的には、図23に示すように、例えば、事後条件設定手段151bが抜き出した出力変数の値を出力値901とする。そして、ステップS23へ移行する。   Further, the post-condition setting unit 151b of the code generation unit 151 extracts (extracts) the value (output value) of the output variable corresponding to the input condition line extracted by the pre-condition setting unit 151a from the decision table 90. Specifically, as shown in FIG. 23, for example, the value of the output variable extracted by the post-condition setting unit 151b is set as the output value 901. Then, the process proceeds to step S23.

(ステップS23)
事前条件設定手段151aは、抜き出した入力条件行の入力条件の真偽値を規定するコードを事前条件として生成する。例えば、図23に示す入力条件行900は、入力条件「g1>100」が真値(T)であり、かつ、入力条件「g2==0」が偽値(F)であることを示す。したがって、事前条件設定手段151aは、入力条件行の入力条件の真偽値を規定するコードとして、「__CPROVER_assume((g1>100)&&!(g2==0));」を生成する。この「__CPROVER_assume();」のコードは、入力条件の真偽を満たす場合、すなわち、入力条件「g1>100」が真値、かつ、入力条件「g2==0」が偽値であるものと指定するコードである。
(Step S23)
The precondition setting unit 151a generates, as a precondition, a code that defines the true / false value of the input condition in the extracted input condition line. For example, the input condition row 900 illustrated in FIG. 23 indicates that the input condition “g1> 100” is a true value (T) and the input condition “g2 == 0” is a false value (F). Therefore, the precondition setting unit 151a generates “__COVER_assume ((g1> 100) &&! (G2 == 0));” as a code that defines the truth value of the input condition in the input condition row. This code of “__COVER_assume ();” indicates that the input condition “g1> 100” is a true value and the input condition “g2 == 0” is a false value when the input condition is true or false. This is the code to specify.

事後条件設定手段151bは、抜き出した出力値を規定するコードを事後条件として生成する。例えば、図23に示す出力値901は、入力条件行900の真偽値を満たす場合、出力変数「z」の値が「0」であることを示す。したがって、事後条件設定手段151bは、出力値を規定するコードとして、「__CPROVER_assert(z==(0));」を生成する。この「__CPROVER_assert(z==(0));」のコードは、入力条件行900が示す入力条件の真偽値の場合であって、関数「func01」が実行された時点で、出力変数(図23においては「z」)が取るべき値を指定するコードである。そして、ステップS24へ移行する。   The post-condition setting unit 151b generates a code that defines the extracted output value as a post-condition. For example, when the output value 901 shown in FIG. 23 satisfies the true / false value of the input condition row 900, it indicates that the value of the output variable “z” is “0”. Therefore, the post-condition setting unit 151b generates “__COVER_assert (z == (0));” as a code that defines the output value. The code of “__COVER_assert (z == (0));” is the case of the truth value of the input condition indicated by the input condition line 900, and when the function “func01” is executed, the output variable (FIG. In 23, “z”) is a code for designating a value to be taken. Then, the process proceeds to step S24.

(ステップS24)
事前条件設定手段151aは、生成した「__CPROVER_assume((g1>100)&&!(g2==0));」を、事前条件設定コード910として、検証用コード91における実行コードの前段側(図23では、16行目)に追記する。また、事前条件設定手段151aは、変数「g1」、「g2」を不定値とするために、検証用コード91において、未定義関数「nondet()」を用いて型宣言をするためのコード「int g1 = nondet();」および「int g2 = nondet():」をそれぞれ追記している。これは、C言語の仕様に基づくものであり、他の言語で必要がなければ追記する必要はない。
(Step S24)
The precondition setting unit 151a uses the generated “__COVER_assume ((g1> 100) &&! (G2 == 0));” as the precondition setting code 910 in the preceding stage of the execution code in the verification code 91 (FIG. 23). Now add it to the 16th line). Further, the precondition setting unit 151a uses a code “for declaring a type using an undefined function“ nondet () ”in the verification code 91 in order to set the variables“ g1 ”and“ g2 ”to undefined values. int g1 = nondet (); "and" int g2 = nondet (): "are added respectively. This is based on the specification of the C language, and it is not necessary to add it if it is not necessary for other languages.

事後条件設定手段151bは、生成した「__CPROVER_assert(z==(0));」を、事後条件設定コード911として、検証用コード91における実行コードの後段側(図23では、22行目)に追記する。また、事後条件設定手段151bは、出力変数「z」を不定値とするために、検証用コード91において、未定義関数「nondet()」を用いて型宣言をするためのコード「intz1 = nondet();」を追記している。これは、C言語の仕様に基づくものであり、他の言語で必要がなければ追記する必要はない。   The post-condition setting unit 151b uses the generated “__COVER_assert (z == (0));” as the post-condition setting code 911 on the rear side of the execution code in the verification code 91 (the 22nd line in FIG. 23). Append. Further, the post-condition setting unit 151b uses a code “intz1 = nondet” for performing type declaration using the undefined function “nondet ()” in the verification code 91 in order to set the output variable “z” to an indefinite value. (); "Is added. This is based on the specification of the C language, and it is not necessary to add it if it is not necessary for other languages.

なお、未定義関数として「nondet()」としているが、仮に表記した関数であり、未定義関数であればどのような関数でもよい。   Note that although “nondet ()” is used as the undefined function, it is a tentative function, and any function may be used as long as it is an undefined function.

すなわち、コード生成手段151は、検証対象ソースコード、事前条件設定手段151aにより生成された事前条件設定コード910、および、事後条件設定手段151bにおより生成された事後条件設定コード911等に基づいて、検証用コード91を完成(生成)させる。そして、ステップS25へ移行する。   That is, the code generation unit 151 is based on the verification target source code, the precondition setting code 910 generated by the precondition setting unit 151a, the postcondition setting code 911 generated by the postcondition setting unit 151b, and the like. Then, the verification code 91 is completed (generated). Then, the process proceeds to step S25.

(ステップS25)
等価性検証手段150の検証手段152は、コード生成手段151により生成された検証用コード(図23では、検証用コード91)を入力する。そして、検証手段152は、入力した検証用コードを実行することによって、検証対象ソースコード(具体的には、図23に示す関数「func01」)と、仕様抽出手段100により生成されたデシジョンテーブル(図23では、デシジョンテーブル90)との等価性の検証動作を行う。
(Step S25)
The verification unit 152 of the equivalence verification unit 150 inputs the verification code generated by the code generation unit 151 (the verification code 91 in FIG. 23). Then, the verification unit 152 executes the input verification code, thereby verifying the source code to be verified (specifically, the function “func01” shown in FIG. 23) and the decision table ( In FIG. 23, an operation for verifying equivalence with the decision table 90) is performed.

図23の例では、検証手段152は、検証用コード91を実行する場合に、「__CPROVER_assume((g1>100)&&!(g2==0));」によって、「g1>100」が真値、かつ、「g2==0」が偽値であるものとして、関数「func01」を実行する。そして、検証手段152は、関数「func01」を実行した時点で、「__CPROVER_assert(z==(0));」によって、出力変数「z」が指定された出力値「0」であるか否かの判定を行う。そして、ステップS26へ移行する。   In the example of FIG. 23, when executing the verification code 91, the verification unit 152 indicates that “g1> 100” is a true value by “_CPROVER_assume ((g1> 100) &&! (G2 == 0));”. In addition, assuming that “g2 == 0” is a false value, the function “func01” is executed. Then, when the function “func01” is executed, the verification unit 152 determines whether or not the output variable “z” is the output value “0” designated by “__COVER_assert (z == (0));”. Judgment is made. Then, the process proceeds to step S26.

(ステップS26)
等価性検証手段150の結果出力手段153は、検証手段152により検証対象ソースコードに対して、デシジョンテーブルの入力条件行ごとに行われた等価性の検証動作の検証結果を出力する。結果出力手段153は、例えば、検証結果をデータとして出力し記憶部14に記憶させて保存するものとしてもよく、検証結果を表示部13に表示させるものとしてもよい。
(Step S26)
The result output unit 153 of the equivalence verification unit 150 outputs a verification result of the equivalence verification operation performed for each input condition line of the decision table to the verification target source code by the verification unit 152. For example, the result output unit 153 may output the verification result as data, store it in the storage unit 14 and save it, or display the verification result on the display unit 13.

上述のステップS22〜26の処理を、デシジョンテーブル(図23では、デシジョンテーブル90)のすべての入力条件行に対して行う。その後、ステップS27へ移行する。   The processes in steps S22 to S26 described above are performed for all input condition rows in the decision table (in FIG. 23, decision table 90). Thereafter, the process proceeds to step S27.

(ステップS27)
検証手段152は、デシジョンテーブルのすべての入力条件行、およびそれに対応する出力値について、検証対象ソースコードと、デシジョンテーブルとの等価性の検証動作を行った後、検証結果が判定NGとなる入力条件行が1つでも存在するか否かを求める。検証結果が判定NGとなる入力条件行が1つも存在しない場合(ステップS27:No)、ステップS28へ移行し、存在する場合(ステップS27:Yes)、ステップS29へ移行する。
(Step S27)
The verification unit 152 performs an operation of verifying the equivalence between the verification target source code and the decision table for all input condition rows in the decision table and the corresponding output values, and then inputs the verification result as a determination NG. It is determined whether or not there is even one conditional row. When there is no input condition line whose verification result is determined to be NG (step S27: No), the process proceeds to step S28, and when it exists (step S27: Yes), the process proceeds to step S29.

(ステップS28)
検証手段152は、等価性の検証動作の結果、デシジョンテーブルで判定NGとなる入力条件行が1つも存在しない場合、デシジョンテーブルと、検証対象ソースコードとは等価であるものと判定する。検証手段152は、この判定結果(検証結果)を結果出力手段153に送る。そして、ステップS30へ移行する。
(Step S28)
The verification unit 152 determines that the decision table and the verification target source code are equivalent if there is no input condition line that is judged NG in the decision table as a result of the equivalence verification operation. The verification unit 152 sends this determination result (verification result) to the result output unit 153. Then, the process proceeds to step S30.

(ステップS29)
検証手段152は、等価性の検証動作の結果、デシジョンテーブルで判定NGとなる入力条件行が1つでも存在する場合、デシジョンテーブルと、検証対象ソースコードとは等価でないものと判定する。検証手段152は、この判定結果(検証結果)を結果出力手段153に送る。そして、ステップS30へ移行する。
(Step S29)
The verification unit 152 determines that the decision table and the verification target source code are not equivalent when there is at least one input condition line that is judged NG in the decision table as a result of the equivalence verification operation. The verification unit 152 sends this determination result (verification result) to the result output unit 153. Then, the process proceeds to step S30.

(ステップS30)
結果出力手段153は、検証手段152により検証対象ソースコードに対する等価性の検証動作の検証結果を出力する。結果出力手段153は、例えば、検証結果をデータとして出力し記憶部14に記憶させて保存するものとしてもよく、検証結果を表示部13に表示させるものとしてもよい。そして、等価性検証動作を終了する。
(Step S30)
The result output unit 153 outputs the verification result of the equivalence verification operation for the verification target source code by the verification unit 152. For example, the result output unit 153 may output the verification result as data, store it in the storage unit 14 and save it, or display the verification result on the display unit 13. Then, the equivalence checking operation ends.

なお、上述の図23に示すデシジョンテーブル90では、出力値はすべて特定の値をとる場合を示したが、図24に示すデシジョンテーブル90aのように、出力変数「z」の出力値として不変値(この場合「z」と記載するものとする)を含む場合を想定する。この場合、事前条件設定手段151aによって、デシジョンテーブル90aから入力条件行900aが抜き出され、入力条件の真偽値を規定するコードとして、「__CPROVER_assume((g1>100)&&!(g2==0));」が生成され、このコードを事前条件設定コード910aとして検証用コード91aに追記される動作は、上述の入力条件行900および事前条件設定コード910と同様である。   In the above-described decision table 90 shown in FIG. 23, the output values are all assumed to have specific values. However, as in the decision table 90a shown in FIG. 24, the output value of the output variable “z” is an invariant value. (In this case, it is described as “z”). In this case, the precondition setting unit 151a extracts the input condition row 900a from the decision table 90a, and uses “__COVER_assume ((g1> 100) &&! (G2 == 0) as a code that defines the truth value of the input condition. )); ”Is generated, and this code is added to the verification code 91a as the precondition setting code 910a, and the operation is the same as the input condition line 900 and the precondition setting code 910 described above.

一方、出力変数「z」が不変値であるか否か、すなわち、関数「func01」の実行前後で出力変数「z」の値が変わらないか否かを検証する場合には、関数「func01」の実行前の出力変数「z」の値を取得しておく必要がある。したがって、事後条件設定手段151bは、関数「func01」の実行前の出力変数「z」の値を仮変数「z_tmp」に退避させるために、図24に示すように、検証用コード91aの15行目に、「int z_tmp = z;」のコードを追記する。そして、事後条件設定手段151bは、事前条件設定手段151aにより抜き出された入力条件行900aに対応する出力変数の値(不変値)である出力値901aを抜き出す。そして、事後条件設定手段151bは、不変値の出力値901aを規定するコードとして、「__CPROVER_assert(z==z_tmp);」を生成する。この「__CPROVER_assert(z==z_tmp);」のコードは、入力条件行900aが示す入力条件の真偽値の場合であって、関数「func01」が実行された時点で、出力変数「z」が不変のままであるか否かを検証するコードである。そして、事後条件設定手段151bは、生成した「__CPROVER_assert(z==z_tmp);」を、事後条件設定コード911aとして、検証用コード91aにおける実行コードの後段側(図24では、24行目)に追記する。   On the other hand, when verifying whether or not the output variable “z” is an invariant value, that is, whether or not the value of the output variable “z” does not change before and after the execution of the function “func01”, the function “func01” It is necessary to acquire the value of the output variable “z” before the execution of. Therefore, the post-condition setting unit 151b stores 15 lines of the verification code 91a as shown in FIG. 24 in order to save the value of the output variable “z” before execution of the function “func01” in the temporary variable “z_tmp”. Add a code of “int z_tmp = z;” to the eyes. Then, the post-condition setting unit 151b extracts an output value 901a that is the value (invariant value) of the output variable corresponding to the input condition row 900a extracted by the pre-condition setting unit 151a. Then, the post-condition setting unit 151b generates “__COVER_assert (z == z_tmp);” as a code that defines the output value 901a of the invariant value. The code of “__COVER_assert (z == z_tmp);” is a case of the truth value of the input condition indicated by the input condition line 900a, and the output variable “z” is set when the function “func01” is executed. This code verifies whether or not it remains unchanged. Then, the post-condition setting unit 151b uses the generated “__COVER_assert (z == z_tmp);” as the post-condition setting code 911a on the subsequent stage side (the 24th line in FIG. 24) of the execution code in the verification code 91a. Append.

これによって、出力変数の出力値として不変値を含む場合であっても、検証対象ソースコード(関数)の実行後においても、出力変数が不変であるか否かを検証することが可能となる。   As a result, even if an invariant value is included as the output value of the output variable, it is possible to verify whether or not the output variable is invariant even after execution of the verification target source code (function).

また、上述の図23では、検証対象ソースコードが外部ファイルで記述されている場合であって、extern宣言をすることにより、外部ファイルで記述されている等価性検証動作の対象となる関数を呼び出すものとしたが、これに限定されるものではない。例えば、図23に示す検証用コード91において、19行目の「func01();」の代わりに、検証対象ソースコードの関数が記述されたコードそのもの(実行コード)を記述するものとしてもよい。   In FIG. 23 described above, the source code to be verified is described in an external file, and an extern declaration is performed to call a function that is the target of the equivalence verification operation described in the external file. However, the present invention is not limited to this. For example, in the verification code 91 shown in FIG. 23, the code itself (execution code) in which the function of the verification target source code is described may be described instead of “func01 ();” on the 19th line.

以上の動作のように、本実施形態に係る検証装置(PC1)は、検証対象ソースコードについて仕様抽出手段100による仕様抽出動作によって、デシジョンテーブルを生成し、等価性検証手段150による等価性検証動作によって、デシジョンテーブルと検証対象ソースコードとが等価であるか否かを検証するものとしている。これによって、仕様抽出手段100による仕様抽出動作によって生成したデシジョンテーブルが、元のソースコード(検証対象ソースコード)と等価であるか否か、すなわち、生成されたデシジョンテーブルがソースコードの仕様情報として正確な情報であるか否かを検証することができる。   As described above, the verification apparatus (PC1) according to the present embodiment generates a decision table for the verification target source code by the specification extraction operation by the specification extraction unit 100, and the equivalence verification operation by the equivalence verification unit 150. Thus, whether or not the decision table and the verification target source code are equivalent is verified. Thereby, whether or not the decision table generated by the specification extracting operation by the specification extracting means 100 is equivalent to the original source code (verification target source code), that is, the generated decision table is used as the specification information of the source code. It is possible to verify whether the information is accurate.

また、コード生成手段151は、検証対象ソースコードを編集することなく、デシジョンテーブルの入力条件行および出力値から生成したコードに基づいて、検証用コードを生成するものとしている。これによって、検証対象ソースコードに対して、検証用コードを生成するためのコメント等を記述する必要がなく、検証用コードを自動生成することができるので、検証対象ソースコードとデシジョンテーブルとの等価性の検証を効率的に行うことができる。   The code generation unit 151 generates the verification code based on the code generated from the input condition line and the output value of the decision table without editing the verification target source code. As a result, it is not necessary to write comments for generating verification code for the verification target source code, and verification code can be automatically generated, so the verification source code and the decision table are equivalent. Verification can be performed efficiently.

また、等価性検証手段150への入力情報を、入力条件と出力値とが構造化されたデシジョンテーブルとしている。これによって、検証手段152による仕様情報(デシジョンテーブル)とソースコードとの等価性の検証動作をまとめて効率的に行うことができる。   The input information to the equivalence verification unit 150 is a decision table in which input conditions and output values are structured. Thus, the verification operation of the equivalence between the specification information (decision table) and the source code by the verification unit 152 can be performed efficiently.

なお、図2に示すように、仕様抽出手段100および等価性検証手段150は、双方、PC1が有するものとしたが、これに限定されるものではない。例えば、仕様抽出手段100を有する装置と、等価性検証手段150を有する装置とを別々の装置として、これらの装置が全体として上述の実施形態の動作を実現する検証システムを構成するものとしてもよい。この場合、仕様抽出手段100を有する装置により生成されたデシジョンテーブルのデータは、通信手段(有線または無線を問わない)によって、等価性検証手段150を有する装置に送信され、等価性検証手段150を有する装置は、受信したデシジョンテーブルのデータを用いて等価性検証動作を実行するものとしてもよい。さらに、仕様抽出手段100と等価性検証手段150とがそれぞれ別の装置に備えられる構成に限定されるものではなく、これらが含む各手段がさらに別の装置に備えられるものとしてもよい。例えば、等価性検証手段150のうち、検証手段152だけ別の装置に備えられるものとし、コード生成手段151により生成した検証コードに基づく等価性検証動作を、検証手段152を有する装置に委託する、という構成であってもよい。   As shown in FIG. 2, the specification extracting unit 100 and the equivalence checking unit 150 are both included in the PC 1, but the present invention is not limited to this. For example, the apparatus having the specification extracting unit 100 and the apparatus having the equivalence verifying unit 150 may be separate devices, and these devices may constitute a verification system that implements the operation of the above-described embodiment as a whole. . In this case, the data of the decision table generated by the apparatus having the specification extracting means 100 is transmitted to the apparatus having the equivalence verifying means 150 by the communication means (whether wired or wireless), and the equivalence verifying means 150 is The apparatus having the above may execute the equivalence checking operation using the data of the received decision table. Furthermore, the specification extraction unit 100 and the equivalence verification unit 150 are not limited to the configurations provided in different devices, and each unit included therein may be provided in a further device. For example, it is assumed that only the verification unit 152 of the equivalence verification unit 150 is provided in another device, and the equivalence verification operation based on the verification code generated by the code generation unit 151 is entrusted to a device having the verification unit 152. It may be configured as follows.

(第2の実施形態)
本実施形態のPC1について、第1の実施形態のPC1と相違する点を中心に説明する。第1の実施形態においては、仕様抽出手段100により生成されたデシジョンテーブルを用いて、検証対象ソースコードと等価であるか否かを検証する動作を説明した。本実施形態においては、例えば、検証対象ソースコードについてユーザ自身が作成したデシジョンテーブルと、その検証対象ソースコードとが等価であるか否かを検証する動作について説明する。なお、本実施形態のPC1のハードウェア構成および機能ブロック構成は、それぞれ上述の図1および2に示した構成と同様である。以下、特に機能ブロック構成について、第1の実施形態と相違する点を説明する。
(Second Embodiment)
The PC 1 of the present embodiment will be described focusing on differences from the PC 1 of the first embodiment. In the first embodiment, the operation of verifying whether or not it is equivalent to the verification target source code using the decision table generated by the specification extraction unit 100 has been described. In the present embodiment, for example, an operation for verifying whether or not a decision table created by the user for the verification target source code and the verification target source code are equivalent will be described. Note that the hardware configuration and functional block configuration of the PC 1 of this embodiment are the same as those shown in FIGS. 1 and 2, respectively. In the following, differences from the first embodiment will be described, particularly regarding the functional block configuration.

等価性検証手段150は、例えば、検証対象ソースコードについてユーザ自身により作成されたデシジョンテーブル(すなわち、PC1とは無関係に独立に外部で作成されたデシジョンテーブル)と、その検証対象ソースコードとの等価性を検証する機能部である。等価性検証手段150は、コード生成手段151と、検証手段152と、結果出力手段153と、を有する。なお、コード生成手段151、検証手段152および結果出力手段153の機能は、第1の実施形態と同様である。   For example, the equivalence verification unit 150 is configured to determine whether the decision table created by the user himself or herself for the verification target source code (that is, the decision table created outside independently of the PC 1) and the verification target source code are equivalent. It is a functional part that verifies the characteristics. The equivalence verification unit 150 includes a code generation unit 151, a verification unit 152, and a result output unit 153. The functions of the code generation unit 151, the verification unit 152, and the result output unit 153 are the same as those in the first embodiment.

記憶手段160は、制御部16により実行される各種プログラム、およびPC1で行われる各種処理に使用されるデータ等を記憶する機能部である。記憶手段160は、第1記憶手段161と、第2記憶手段162と、を有する。   The storage unit 160 is a functional unit that stores various programs executed by the control unit 16 and data used for various processes performed by the PC 1. The storage unit 160 includes a first storage unit 161 and a second storage unit 162.

第1記憶手段161は、等価性の検証対象となるソースコードを記憶する機能部である。第2記憶手段162は、例えば、検証対象ソースコードについてユーザ自身により作成されたデシジョンテーブルをデータとして記憶する機能部である。   The first storage unit 161 is a functional unit that stores source code to be verified for equivalence. The second storage unit 162 is a functional unit that stores, for example, a decision table created by the user for the verification target source code as data.

以上のように、本実施形態に係る検証装置(PC1)は、第1の実施形態のように仕様抽出手段100により生成されたデシジョンテーブルではなく、例えば、検証対象ソースコードについてユーザ自身により作成されたデシジョンテーブルと、その検証対象ソースコードとの等価性を検証するものとしている。これによって、ユーザ自身により作成されたデシジョンテーブルが、検証対象ソースコードと等価であるか否か、すなわち、ユーザ自身により作成されたデシジョンテーブルが、検証対象ソースコードの振る舞いを正確に示す仕様情報であるか否かを検証することができる。   As described above, the verification apparatus (PC1) according to the present embodiment is not the decision table generated by the specification extraction unit 100 as in the first embodiment, but is generated by the user himself for the verification target source code, for example. The equivalence between the decision table and the source code to be verified is verified. As a result, whether the decision table created by the user himself is equivalent to the verification target source code, that is, the decision table created by the user himself is the specification information that accurately indicates the behavior of the verification target source code. It can be verified whether or not there is.

なお、本実施形態に係るPC1は、ユーザ自身により作成されたデシジョンテーブルと検証対象ソースコードとの等価性の検証動作のみに特化するものであれば、仕様抽出手段100は備えていなくてもよい。   Note that the PC 1 according to the present embodiment does not include the specification extraction unit 100 as long as it is specialized only in the operation of verifying the equivalence between the decision table created by the user and the source code to be verified. Good.

(第3の実施形態)
本実施形態のPC1について、第1の実施形態のPC1と相違する点を中心に説明する。第1の実施形態においては、仕様抽出手段100により生成されたデシジョンテーブルを用いて、検証対象ソースコードと等価であるか否かを検証する動作を説明した。本実施形態においては、バージョンアップ(以下、派生開発ともいう)される前のソースコード(以下、レガシーソースコードともいう)に対して仕様抽出手段100によりデシジョンテーブルを生成させ、このデシジョンテーブルと、派生開発後のソースコードとの等価性の検証動作について説明する。なお、本実施形態のPC1のハードウェア構成および機能ブロック構成は、それぞれ上述の図1および2に示した構成と同様である。以下、特に機能ブロック構成について、第1の実施形態と相違する点を説明する。
(Third embodiment)
The PC 1 of the present embodiment will be described focusing on differences from the PC 1 of the first embodiment. In the first embodiment, the operation of verifying whether or not it is equivalent to the verification target source code using the decision table generated by the specification extraction unit 100 has been described. In this embodiment, a specification extraction unit 100 generates a decision table for source code (hereinafter also referred to as legacy source code) before version upgrade (hereinafter also referred to as derivative development), and this decision table, The operation for verifying equivalence with the source code after derivation development will be described. Note that the hardware configuration and functional block configuration of the PC 1 of this embodiment are the same as those shown in FIGS. 1 and 2, respectively. In the following, differences from the first embodiment will be described, particularly regarding the functional block configuration.

等価性検証手段150は、仕様抽出手段100による仕様抽出動作により生成されたデシジョンテーブルと、仕様抽出動作の対象となったソースコードから派生開発されたソースコードとの等価性を検証する機能部である。この場合、検証対象ソースコードは、仕様抽出動作の対象となったソースコードから派生開発されたソースコードとなる。等価性検証手段150は、コード生成手段151と、検証手段152と、結果出力手段153と、を有する。なお、コード生成手段151、検証手段152および結果出力手段153の機能は、第1の実施形態と同様である。   The equivalence verification unit 150 is a functional unit that verifies the equivalence between the decision table generated by the specification extraction operation by the specification extraction unit 100 and the source code derived and developed from the source code subjected to the specification extraction operation. is there. In this case, the verification target source code is a source code derived and developed from the source code subjected to the specification extraction operation. The equivalence verification unit 150 includes a code generation unit 151, a verification unit 152, and a result output unit 153. The functions of the code generation unit 151, the verification unit 152, and the result output unit 153 are the same as those in the first embodiment.

記憶手段160は、制御部16により実行される各種プログラム、およびPC1で行われる各種処理に使用されるデータ等を記憶する機能部である。記憶手段160は、図1に示す、記憶部14によって実現される。記憶手段160は、第1記憶手段161と、第2記憶手段162と、を有する。   The storage unit 160 is a functional unit that stores various programs executed by the control unit 16 and data used for various processes performed by the PC 1. The storage unit 160 is realized by the storage unit 14 shown in FIG. The storage unit 160 includes a first storage unit 161 and a second storage unit 162.

第1記憶手段161は、仕様抽出動作の対象となるレガシーソースコード、および、そのソースコードから派生開発された検証対象ソースコードを記憶する機能部である。第2記憶手段162は、派生開発される前のレガシーソースコードについて仕様抽出手段100により生成されたデシジョンテーブルをデータとして記憶する機能部である。   The first storage means 161 is a functional unit that stores the legacy source code that is the target of the specification extraction operation and the verification target source code that is derived and developed from the source code. The second storage unit 162 is a functional unit that stores, as data, the decision table generated by the specification extraction unit 100 for the legacy source code before the derivative development.

図25は、第3の実施形態に係る検証装置のデシジョンテーブルから検証用コードを作成する動作の概要を説明する図である。図25を参照しながら、本実施形態に係る検証装置であるPC1の等価性検証動作の流れについて説明する。   FIG. 25 is a diagram for explaining the outline of the operation for creating the verification code from the decision table of the verification apparatus according to the third embodiment. With reference to FIG. 25, the flow of an equivalence verification operation of the PC 1 that is the verification apparatus according to the present embodiment will be described.

図25に示すように、検証対象ソースコード80aは、レガシーソースコード86から派生開発されたソースコードである。まず、仕様抽出手段100は、レガシーソースコード86について仕様情報であるデシジョンテーブル81aを生成する。次に、等価性検証手段150のコード生成手段151は、デシジョンテーブル81aの入力条件のそれぞれの真偽の値を示す行(以下、入力条件行という)を抜き出して、検証対象ソースコード80aの前段側に、その入力条件行の入力条件を規定するコード(事前条件部82a)を設定する。また、コード生成手段151は、デシジョンテーブル81aから抜き出した入力条件行に対応する出力変数の値(出力値)を抜き出し、検証対象ソースコード80aの後段側に、その出力値を規定するコード(事後条件部83a)を設定する。このように、コード生成手段151は、事前条件部82a、検証対象ソースコード80a、および事後条件部83aを含んだ検証用コード84aを生成する。   As shown in FIG. 25, the verification target source code 80a is a source code derived and developed from the legacy source code 86. First, the specification extraction unit 100 generates a decision table 81 a that is specification information for the legacy source code 86. Next, the code generation unit 151 of the equivalence verification unit 150 extracts lines indicating the true / false values of the input conditions of the decision table 81a (hereinafter referred to as input condition lines), and the preceding stage of the verification target source code 80a. On the side, a code (precondition part 82a) that defines the input condition of the input condition line is set. In addition, the code generation unit 151 extracts the value (output value) of the output variable corresponding to the input condition line extracted from the decision table 81a, and the code (post facto) that defines the output value at the subsequent stage side of the verification target source code 80a. The condition part 83a) is set. As described above, the code generation unit 151 generates the verification code 84a including the precondition unit 82a, the verification target source code 80a, and the postcondition unit 83a.

次に、コード生成手段151は、生成した検証用コード84aを、検証ツール85(図2の検証手段152に相当)に出力する。検証用コード84aを入力した検証ツール85は、検証用コード84aを解析し、検証対象ソースコード80aを実行した場合に、コード生成手段151により設定された入力条件を満たす場合に、設定された出力値となるか否かを検証する。そして、検証ツール85は、検証の結果(OK・NG判定)を出力する。なお、上述の等価性検証動作の詳細は、第1の実施形態における図22〜24で説明した動作内容に準じる。   Next, the code generation unit 151 outputs the generated verification code 84a to the verification tool 85 (corresponding to the verification unit 152 in FIG. 2). The verification tool 85 to which the verification code 84a has been input analyzes the verification code 84a and executes the verification target source code 80a, and when the input condition set by the code generation means 151 is satisfied, the set output It is verified whether it becomes a value. Then, the verification tool 85 outputs a verification result (OK / NG determination). Note that the details of the above-described equivalence checking operation conform to the operation content described in FIGS. 22 to 24 in the first embodiment.

以上のように、本実施形態に係る検証装置(PC1)は、派生開発される前のレガシーソースコードに対して仕様抽出手段100によりデシジョンテーブルを生成させ、このデシジョンテーブルと、派生開発後のソースコードとの等価性の検証動作を行うものとしている。これによって、等価性検証手段150の検証結果により、レガシーソースコードと、派生開発されたソースコードとが、どのように動作仕様が異なるのかを把握することができる。また、レガシーソースコードから派生開発するにしても、機能として変更すべきでないコード部分も存在する。この場合、本実施形態に係る検証装置によれば、レガシーソースコードから生成されたデシジョンテーブルと、派生開発されたソースコードとの等価性の検証動作を行うことにより、変更すべきでない機能が保持されているか否かを確認することができる。   As described above, the verification apparatus (PC1) according to the present embodiment causes the specification extraction unit 100 to generate a decision table for the legacy source code before the derivative development, and the decision table and the source after the derivative development It is assumed that the operation of verifying equivalence with code is performed. As a result, it is possible to grasp how the operation specifications of the legacy source code and the source code that is derived and developed differ from the verification result of the equivalence verification unit 150. In addition, there are some code parts that should not be changed as functions even if they are developed from legacy source code. In this case, according to the verification apparatus according to the present embodiment, a function that should not be changed is maintained by performing an operation for verifying equivalence between the decision table generated from the legacy source code and the source code that is derived and developed. It can be confirmed whether or not.

なお、レガシーソースコード86から生成されたデシジョンテーブル81aを、検証対象ソースコード80a用にユーザ自身がデシジョンテーブルを編集し、このデシジョンテーブルと、検証対象ソースコード80aとの等価性の検証動作を行うことにより、ユーザ自身が作成したデシジョンテーブルが、検証対象ソースコード80aの振る舞いを正確に規定した仕様情報であるか否かを確認することもできる。逆に、ユーザ自身がデシジョンテーブル81aを検証対象ソースコード80a用に編集したデシジョンテーブルの仕様通りに、検証対象ソースコード80aが動作するか否かを確認することもできる。   Note that the decision table 81a generated from the legacy source code 86 is edited by the user for the verification target source code 80a, and the equivalence verification operation between the decision table and the verification target source code 80a is performed. Accordingly, it is possible to confirm whether or not the decision table created by the user is specification information that accurately defines the behavior of the verification target source code 80a. Conversely, the user himself / herself can check whether or not the verification target source code 80a operates according to the specification of the decision table obtained by editing the decision table 81a for the verification target source code 80a.

また、等価性検証手段150は、仕様抽出手段100による仕様抽出動作により生成されたデシジョンテーブルと、仕様抽出動作の対象となったソースコードから派生開発されたソースコードとの等価性を検証するものとしたが、これに限定されるものではない。例えば、等価性検証手段150は、仕様抽出手段100により派生開発されたソースコードに対して仕様抽出動作が行われて生成されたデシジョンテーブルと、派生開発前のソースコード(レガシーソースコード)との等価性を検証するものとしてもよい。これによっても、等価性検証手段150の検証結果により、レガシーソースコードと、派生開発されたソースコードとが、どのように動作仕様が異なるのかを把握することができる。   The equivalence verification unit 150 verifies the equivalence between the decision table generated by the specification extraction operation by the specification extraction unit 100 and the source code derived and developed from the source code subjected to the specification extraction operation. However, the present invention is not limited to this. For example, the equivalence verification unit 150 includes a decision table generated by performing a specification extraction operation on the source code derived and developed by the specification extraction unit 100, and a source code (legacy source code) before the derivation development. The equivalence may be verified. Also according to this, it is possible to grasp how the operation specifications of the legacy source code and the source code derived and derived are different from the verification result of the equivalence verification unit 150.

なお、上述の各実施形態に係るPC1で実行されるプログラムは、ROM等に予め組み込まれて提供される。また、上述の各実施形態に係るPC1で実行されるプログラムは、インストール可能な形式または実行可能な形式のファイルでCD−ROM(Compact Disk Read Only Memory)、フレキシブルディスク(FD)、CD−R(Compact Disk Recordable)、DVD(Digital Versatile Disk)等のコンピュータで読み取り可能な記憶媒体に記憶してコンピュータプログラムプロダクトとして提供されるように構成してもよい。   The program executed by the PC 1 according to each embodiment described above is provided by being incorporated in advance in a ROM or the like. The program executed by the PC 1 according to each of the above-described embodiments is a file in an installable format or an executable format, and is a CD-ROM (Compact Disk Read Only Memory), a flexible disk (FD), a CD-R ( It may be configured to be stored in a computer-readable storage medium such as a Compact Disk Recordable (DVD) or a DVD (Digital Versatile Disk) and provided as a computer program product.

さらに、上述の各実施形態に係るPC1で実行されるプログラムを、インターネット等のネットワークに接続されたコンピュータ上に格納し、ネットワーク経由でダウンロードさせることにより提供するように構成してもよい。また、上述の各実施形態に係るPC1で実行されるプログラムをインターネット等のネットワーク経由で提供または配布するように構成してもよい。   Furthermore, the program executed by the PC 1 according to each of the above-described embodiments may be provided by being stored on a computer connected to a network such as the Internet and downloaded via the network. The program executed on the PC 1 according to each of the above embodiments may be provided or distributed via a network such as the Internet.

また、上述の各実施形態のPC1で実行されるプログラムは、コンピュータを上述したPC1の各機能部として機能させ得る。このコンピュータは、CPU(制御部16)がコンピュータ読取可能な記憶媒体からプログラムを主記憶装置上に読み出して実行することができる。   In addition, the program executed by the PC 1 of each of the above-described embodiments can cause a computer to function as each functional unit of the PC 1 described above. In this computer, the CPU (control unit 16) can read and execute a program from a computer-readable storage medium onto a main storage device.

本発明の各実施形態を説明したが、これらの実施形態は、例として提示したものであり、発明の範囲を限定することは意図していない。この新規な各実施形態は、その他の様々な形態で実施されることが可能であり、発明の要旨を逸脱しない範囲で、種々の省略、置き換えおよび変更を行うことができる。これら実施形態は、発明の範囲および要旨に含まれるとともに、特許請求の範囲に記載された発明およびその均等の範囲に含まれる。   Although the embodiments of the present invention have been described, these embodiments are presented as examples, and are not intended to limit the scope of the invention. Each of the novel embodiments can be implemented in various other forms, and various omissions, replacements, and changes can be made without departing from the spirit of the invention. These embodiments are included in the scope and gist of the invention, and are included in the invention described in the claims and the equivalents thereof.

1 PC
11 通信部
12 操作部
13 表示部
14 記憶部
15 外部記憶装置
16 制御部
17 CD−ROM
18 CD−ROMドライブ
19 バス
20 対象モジュール
21〜24 処理後モジュール
25 対象モジュール
26 等価変換後モジュール
30、30a〜30c サンプルコード
31 定数伝播処理後コード
31a 入力変数伝播処理後コード
31b 枝刈り処理後コード
31c 条件式情報伝播処理後コード
40〜45 ノード
42a、43a ノード
50 デシジョンテーブル
60 OR記号部
61 AND記号部
62a、62b NOT記号部
70 出力値ノード
80、80a 検証対象ソースコード
81、81a デシジョンテーブル
82、82a 事前条件部
83、83a 事後条件部
84、84a 検証用コード
85 検証ツール
86 レガシーソースコード
90、90a デシジョンテーブル
91、91a 検証用コード
100 仕様抽出手段
101 出力変数特定手段
102 等価変換手段
103 グラフ作成手段
104 テーブル変換手段
150 等価性検証手段
151 コード生成手段
151a 事前条件設定手段
151b 事後条件設定手段
152 検証手段
153 結果出力手段
160 記憶手段
161 第1記憶手段
162 第2記憶手段
200、201 グローバル変数
202〜204 入力条件部
205、206、207a〜207c、208 コード部
210 定数伝播処理後コード部
211 入力変数伝播処理後コード部
212a〜212c、213 定数伝播処理後コード部
214 コード部
220 枝刈り処理後コード部
221 コード部
230 条件式情報伝播処理後コード部
231 コード部
240 条件式情報伝播処理後コード部
241 方程式
250 仮変数設定コード部
260 方程式コード部
300〜303 コード部
300a、301a コード部
300b、301b コード部
300c コード部
310〜312 定数伝播処理後コード部
310a 入力変数伝播処理後コード部
310b 枝刈り処理後コード部
310c 条件式情報伝播処理後コード部
900、900a 入力条件行
901、901a 出力値
910、910a 事前条件設定コード
911、911a 事後条件設定コード
1 PC
11 Communication Unit 12 Operation Unit 13 Display Unit 14 Storage Unit 15 External Storage Device 16 Control Unit 17 CD-ROM
18 CD-ROM drive 19 Bus 20 Target module 21-24 Module after processing 25 Target module 26 Module after equivalent conversion 30, 30a-30c Sample code 31 Code after constant propagation processing 31a Code after input variable propagation processing 31b Code after pruning processing 31c Code after conditional expression information propagation processing 40-45 Node 42a, 43a Node 50 Decision table 60 OR symbol part 61 AND symbol part 62a, 62b NOT symbol part 70 Output value node 80, 80a Verification target source code 81, 81a Decision table 82 , 82a Precondition section 83, 83a Postcondition section 84, 84a Verification code 85 Verification tool 86 Legacy source code 90, 90a Decision table 91, 91a Verification code 100 Specification extractor Stage 101 Output variable identification means 102 Equivalent conversion means 103 Graph creation means 104 Table conversion means 150 Equivalence verification means 151 Code generation means 151a Precondition setting means 151b Postcondition setting means 152 Verification means 153 Result output means 160 Storage means 161 First Storage unit 162 Second storage unit 200, 201 Global variable 202-204 Input condition part 205, 206, 207a-207c, 208 Code part 210 Code part after constant propagation process 211 Code part after input variable propagation process 212a-212c, 213 Constant Code part after propagation process 214 Code part 220 Code part after pruning process 221 Code part 230 Code part after conditional expression information propagation process 231 Code part 240 Code part after conditional expression information propagation process 241 Equation 250 Temporary variable setting code 260 code part 300a, 301a code part 300b, 301b code part 300c code part 310-312 code part after constant propagation process 310a code part after input variable propagation process 310b code part 310p after pruning process Code information post-processing part 900, 900a Input condition line 901, 901a Output value 910, 910a Precondition setting code 911, 911a Postcondition setting code

Claims (12)

ソースコードから、該ソースコードに含まれる出力変数の入力条件に応じた値を示すデシジョンテーブルを生成するテーブル生成手段と、
前記入力条件に応じた前記出力変数の値を示す前記デシジョンテーブルから、前記入力条件の真偽の値の組み合わせを抽出して、前記組み合わせを規定する第1コードを生成する第1生成手段と、
前記デシジョンテーブルから、前記第1生成手段により抽出された前記組み合わせに対応する前記出力変数の値を抽出し、前記出力変数の値を規定する第2コードを生成する第2生成手段と、
前記第1コードを、前記ソースコードを実行するための実行コードの前段側に付加し、前記第2コードを、前記実行コードの後段側に付加することにより検証用コードを生成するコード生成手段と、
前記検証用コードを実行することにより、前記デシジョンテーブルと、前記ソースコードとの等価性を検証する検証手段と、
を備え
前記テーブル生成手段は、
前記ソースコードから前記出力変数を特定する特定手段と、
前記ソースコードに含まれる式を等価な式に置き換える等価変換処理を実行して、前記特定手段により特定された前記出力変数についての方程式を導出する第1変換手段と、
前記方程式から前記入力条件を抽出し、該入力条件をノードとする原因結果グラフを作成する作成手段と、
前記原因結果グラフを、前記入力条件の真偽の値の組み合わせと、前記出力変数の値との対応関係を示す前記デシジョンテーブルに変換する第2変換手段と、
を有する検証装置。
Table generation means for generating a decision table indicating a value corresponding to an input condition of an output variable included in the source code from the source code;
From the decision table showing the value of the output variable in accordance with the input conditions, extracts the combination of the authenticity of the value of the input condition, a first generation means for generating a first code defining said combination,
Second generation means for extracting a value of the output variable corresponding to the combination extracted by the first generation means from the decision table and generating a second code defining the value of the output variable;
It said first code, added in the preceding stage of the execution code for executing the source code, the second code, and code generation means for generating a verification code by adding the subsequent stage of said execution code ,
A verification means for verifying equivalence between the decision table and the source code by executing the verification code;
Equipped with a,
The table generating means includes
Identifying means for identifying the output variable from the source code;
First conversion means for deriving an equation for the output variable specified by the specifying means by executing equivalent conversion processing for replacing an expression included in the source code with an equivalent expression;
Creating means for extracting the input condition from the equation and creating a cause-result graph having the input condition as a node;
Second conversion means for converting the cause / result graph into the decision table indicating a correspondence relationship between a combination of true / false values of the input condition and the value of the output variable;
A verification device having
ソースコードとは別のソースコードから、前記別のソースコードに含まれる出力変数の入力条件に応じた値を示すデシジョンテーブルを生成するテーブル生成手段と、Table generation means for generating a decision table indicating a value corresponding to an input condition of an output variable included in the other source code from a source code different from the source code;
前記デシジョンテーブルから、前記入力条件の真偽の値の組み合わせを抽出して、前記組み合わせを規定する第1コードを生成する第1生成手段と、First generation means for extracting a combination of true and false values of the input condition from the decision table and generating a first code defining the combination;
前記デシジョンテーブルから、前記第1生成手段により抽出された前記組み合わせに対応する前記出力変数の値を抽出し、前記出力変数の値を規定する第2コードを生成する第2生成手段と、Second generation means for extracting a value of the output variable corresponding to the combination extracted by the first generation means from the decision table and generating a second code defining the value of the output variable;
前記第1コードを、前記ソースコードを実行するための実行コードの前段側に付加し、前記第2コードを、前記実行コードの後段側に付加することにより検証用コードを生成するコード生成手段と、Code generating means for generating a verification code by adding the first code to a preceding stage of an execution code for executing the source code and adding the second code to a succeeding stage of the execution code; ,
前記検証用コードを実行することにより、前記デシジョンテーブルと、前記ソースコードとの等価性を検証する検証手段と、A verification means for verifying equivalence between the decision table and the source code by executing the verification code;
を備え、With
前記テーブル生成手段は、The table generating means includes
前記ソースコードから前記出力変数を特定する特定手段と、Identifying means for identifying the output variable from the source code;
前記ソースコードに含まれる式を等価な式に置き換える等価変換処理を実行して、前記特定手段により特定された前記出力変数についての方程式を導出する第1変換手段と、First conversion means for deriving an equation for the output variable specified by the specifying means by executing equivalent conversion processing for replacing an expression included in the source code with an equivalent expression;
前記方程式から前記入力条件を抽出し、該入力条件をノードとする原因結果グラフを作成する作成手段と、Creating means for extracting the input condition from the equation and creating a cause-result graph having the input condition as a node;
前記原因結果グラフを、前記入力条件の真偽の値の組み合わせと、前記出力変数の値との対応関係を示す前記デシジョンテーブルに変換する第2変換手段と、Second conversion means for converting the cause / result graph into the decision table indicating a correspondence relationship between a combination of true / false values of the input condition and the value of the output variable;
を有する検証装置。A verification device having
入力条件に応じた出力変数の値を示すデシジョンテーブルから、前記入力条件の真偽の値の組み合わせを抽出して、前記組み合わせを規定する第1コードを生成する第1生成手段と、First generation means for extracting a combination of true and false values of the input condition from a decision table indicating values of output variables according to the input condition, and generating a first code defining the combination;
前記デシジョンテーブルから、前記第1生成手段により抽出された前記組み合わせに対応する前記出力変数の値を抽出し、前記出力変数の値を規定する第2コードを生成する第2生成手段と、Second generation means for extracting a value of the output variable corresponding to the combination extracted by the first generation means from the decision table and generating a second code defining the value of the output variable;
前記第1コードを、ソースコードを実行するための実行コードの前段側に付加し、前記第2コードを、前記実行コードの後段側に付加することにより検証用コードを生成するコード生成手段と、Code generating means for generating a verification code by adding the first code to a preceding stage of an execution code for executing a source code, and adding the second code to a succeeding stage of the execution code;
前記検証用コードを実行することにより、前記デシジョンテーブルと、前記ソースコードとの等価性を検証する検証手段と、A verification means for verifying equivalence between the decision table and the source code by executing the verification code;
を備え、With
前記第2生成手段は、The second generation means includes
抽出した前記出力変数の値が不変値である場合、前記不変値を仮変数に格納する第3コードを生成し、前記検証用コードに含まれる前記実行コードの前段側に前記第3コードを付加し、If the extracted value of the output variable is an invariant value, a third code for storing the invariant value in a temporary variable is generated, and the third code is added to the preceding stage of the execution code included in the verification code And
前記出力変数の値が前記仮変数の値であるか否かを規定する前記第2コードを生成する検証装置。The verification apparatus which produces | generates the said 2nd code which prescribes | regulates whether the value of the said output variable is the value of the said temporary variable.
前記第1変換手段は、前記等価変換処理として、定数伝播処理、入力変数伝播処理および枝刈り処理のループ処理を実行することによって前記ソースコードを縮約し、該ソースコードの縮約が収束した時点で前記ループ処理を終了する請求項1または2に記載の検証装置。 The first conversion means contracts the source code by executing loop processing of constant propagation processing, input variable propagation processing and pruning processing as the equivalent conversion processing, and the contraction of the source code has converged verification device according to claim 1 or 2 terminates the loop processing at this point. 前記第1変換手段は、縮約が収束した前記ソースコードに対して、条件式情報伝播処理を実行する請求項に記載の検証装置。 The verification apparatus according to claim 4 , wherein the first conversion unit executes conditional expression information propagation processing on the source code in which the contraction has converged. 前記第1変換手段は、前記等価変換処理として、定数伝播処理、入力変数伝播処理、枝刈り処理および条件式情報伝播処理を実行する請求項1または2に記載の検証装置。 It said first converting means, as the equivalent transformation process, constant propagation process, the input variable propagation process, pruning process and condition information verification apparatus according to claim 1 or 2 executes the propagation process. 前記検証手段は、前記ソースコードが実行された場合に、前記デシジョンテーブルで規定された前記入力条件に応じて、前記出力変数の値が出力されるか否かを判定することにより、前記等価性を検証する請求項1〜3のいずれか一項に記載の検証装置。 The verification means determines whether or not the value of the output variable is output according to the input condition defined in the decision table when the source code is executed. The verification device according to any one of claims 1 to 3, wherein: 前記デシジョンテーブルは、検証装置とは独立して作成された請求項1〜3のいずれか一項に記載の検証装置。 The verification device according to any one of claims 1 to 3, wherein the decision table is created independently of the verification device. 前記第2生成手段は、
抽出した前記出力変数の値が不変値である場合、前記不変値を仮変数に格納する第3コードを生成し、前記検証用コードに含まれる前記実行コードの前段側に前記第3コードを付加し、
前記出力変数の値が前記仮変数の値であるか否かを規定する前記第2コードを生成する請求項1または2に記載の検証装置。
The second generation means includes
If the extracted value of the output variable is an invariant value, a third code for storing the invariant value in a temporary variable is generated, and the third code is added to the preceding stage of the execution code included in the verification code And
Verification device according to claim 1 or 2 to generate the second code value of the output variable defines whether the value of the temporary variable.
ソースコードから、前記ソースコードに含まれる出力変数の入力条件に応じた値を示すデシジョンテーブルを生成するテーブル生成手段と、
前記入力条件に応じた前記出力変数の値を示す前記デシジョンテーブルから、前記入力条件の真偽の値の組み合わせを抽出して、前記組み合わせを規定する第1コードを生成する第1生成手段と、
前記デシジョンテーブルから、前記第1生成手段により抽出された前記組み合わせに対応する前記出力変数の値を抽出し、前記出力変数の値を規定する第2コードを生成する第2生成手段と、
前記第1コードを、前記ソースコードを実行するための実行コードの前段側に付加し、前記第2コードを、前記実行コードの後段側に付加することにより検証用コードを生成するコード生成手段と、
前記検証用コードを実行することにより、前記デシジョンテーブルと、前記ソースコードとの等価性を検証する検証手段と、
を備え
前記テーブル生成手段は、
ソースコードから出力変数を特定する特定手段と、
前記ソースコードに含まれる式を等価な式に置き換える等価変換処理を実行して、前記特定手段により特定された前記出力変数についての方程式を導出する第1変換手段と、
前記方程式から入力条件を抽出し、該入力条件をノードとする原因結果グラフを作成する作成手段と、
前記原因結果グラフを、前記入力条件の真偽の値の組み合わせと、前記出力変数の値との対応関係を示すデシジョンテーブルに変換する第2変換手段と、
を有する検証システム。
Table generation means for generating a decision table indicating a value corresponding to an input condition of an output variable included in the source code from the source code;
First generation means for extracting a combination of true and false values of the input condition from the decision table indicating the value of the output variable according to the input condition, and generating a first code that defines the combination;
Second generation means for extracting a value of the output variable corresponding to the combination extracted by the first generation means from the decision table and generating a second code defining the value of the output variable;
Code generating means for generating a verification code by adding the first code to a preceding stage of an execution code for executing the source code and adding the second code to a succeeding stage of the execution code; ,
A verification means for verifying equivalence between the decision table and the source code by executing the verification code;
Equipped with a,
The table generating means includes
A specific means for identifying the output variable from the source code;
First conversion means for deriving an equation for the output variable specified by the specifying means by executing equivalent conversion processing for replacing an expression included in the source code with an equivalent expression;
Creating means for extracting an input condition from the equation and creating a causal result graph having the input condition as a node;
Second conversion means for converting the cause / result graph into a decision table indicating a correspondence relationship between a combination of true and false values of the input condition and the value of the output variable;
Having a verification system.
ソースコードから、該ソースコードに含まれる出力変数の入力条件に応じた値を示すデシジョンテーブルを生成するテーブル生成ステップと、
前記入力条件に応じた前記出力変数の値を示す前記デシジョンテーブルから、前記入力条件の真偽の値の組み合わせを抽出して、前記組み合わせを規定する第1コードを生成する第1生成ステップと、
前記デシジョンテーブルから、抽出した前記組み合わせに対応する前記出力変数の値を抽出し、前記出力変数の値を規定する第2コードを生成する第2生成ステップと、
前記第1コードを、ソースコードを実行するための実行コードの前段側に付加し、前記第2コードを、前記実行コードの後段側に付加することにより検証用コードを生成するコード生成ステップと、
前記検証用コードを実行することにより、前記デシジョンテーブルと、前記ソースコードとの等価性を検証する検証ステップと、
を有し、
前記テーブル生成ステップは、
前記ソースコードから前記出力変数を特定する特定ステップと、
前記ソースコードに含まれる式を等価な式に置き換える等価変換処理を実行して、特定した前記出力変数についての方程式を導出する第1変換ステップと、
前記方程式から前記入力条件を抽出し、該入力条件をノードとする原因結果グラフを作成する作成ステップと、
前記原因結果グラフを、前記入力条件の真偽の値の組み合わせと、前記出力変数の値との対応関係を示す前記デシジョンテーブルに変換する第2変換ステップと、
を有する検証方法。
A table generation step for generating a decision table indicating a value according to an input condition of an output variable included in the source code from the source code;
From the decision table showing the value of the output variable in accordance with the input conditions, it extracts the combination of the authenticity of the value of the input condition, a first generation step of generating a first code defining said combination,
A second generation step of extracting a value of the output variable corresponding to the extracted combination from the decision table and generating a second code defining the value of the output variable;
A code generation step of generating a verification code by adding the first code to a preceding stage of an execution code for executing a source code, and adding the second code to a succeeding stage of the execution code;
A verification step of verifying equivalence between the decision table and the source code by executing the verification code;
I have a,
The table generation step includes
A specifying step of specifying the output variable from the source code;
A first conversion step of performing an equivalent conversion process of replacing an expression included in the source code with an equivalent expression to derive an equation for the identified output variable;
A step of extracting the input condition from the equation and creating a cause-result graph having the input condition as a node;
A second conversion step of converting the cause / result graph into the decision table indicating a correspondence relationship between a combination of true / false values of the input condition and the value of the output variable;
A verification method comprising:
ソースコードから、該ソースコードに含まれる出力変数の入力条件に応じた値を示すデシジョンテーブルを生成するテーブル生成手段と、
前記入力条件に応じた前記出力変数の値を示す前記デシジョンテーブルから、前記入力条件の真偽の値の組み合わせを抽出して、前記組み合わせを規定する第1コードを生成する第1生成手段と、
前記デシジョンテーブルから、前記第1生成手段により抽出された前記組み合わせに対応する前記出力変数の値を抽出し、前記出力変数の値を規定する第2コードを生成する第2生成手段と、
前記第1コードを、前記ソースコードを実行するための実行コードの前段側に付加し、前記第2コードを、前記実行コードの後段側に付加することにより検証用コードを生成するコード生成手段と、
前記検証用コードを実行することにより、前記デシジョンテーブルと、前記ソースコードとの等価性を検証する検証手段と、
をコンピュータに実現させ
さらに、前記テーブル生成手段として、
前記ソースコードから前記出力変数を特定する特定手段と、
前記ソースコードに含まれる式を等価な式に置き換える等価変換処理を実行して、前記特定手段により特定された前記出力変数についての方程式を導出する第1変換手段と、
前記方程式から前記入力条件を抽出し、該入力条件をノードとする原因結果グラフを作成する作成手段と、
前記原因結果グラフを、前記入力条件の真偽の値の組み合わせと、前記出力変数の値との対応関係を示す前記デシジョンテーブルに変換する第2変換手段と、
を前記コンピュータに実現させるためのプログラム。
Table generation means for generating a decision table indicating a value corresponding to an input condition of an output variable included in the source code from the source code;
From the decision table showing the value of the output variable in accordance with the input conditions, extracts the combination of the authenticity of the value of the input condition, a first generation means for generating a first code defining said combination,
Second generation means for extracting a value of the output variable corresponding to the combination extracted by the first generation means from the decision table and generating a second code defining the value of the output variable;
It said first code, added in the preceding stage of the execution code for executing the source code, the second code, and code generation means for generating a verification code by adding the subsequent stage of said execution code ,
A verification means for verifying equivalence between the decision table and the source code by executing the verification code;
Is realized on a computer ,
Further, as the table generating means,
Identifying means for identifying the output variable from the source code;
First conversion means for deriving an equation for the output variable specified by the specifying means by executing equivalent conversion processing for replacing an expression included in the source code with an equivalent expression;
Creating means for extracting the input condition from the equation and creating a cause-result graph having the input condition as a node;
Second conversion means for converting the cause / result graph into the decision table indicating a correspondence relationship between a combination of true / false values of the input condition and the value of the output variable;
A program for causing the computer to realize the above .
JP2015015887A 2015-01-29 2015-01-29 Verification device, verification system, verification method, and program Expired - Fee Related JP6363027B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015015887A JP6363027B2 (en) 2015-01-29 2015-01-29 Verification device, verification system, verification method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015015887A JP6363027B2 (en) 2015-01-29 2015-01-29 Verification device, verification system, verification method, and program

Publications (2)

Publication Number Publication Date
JP2016143074A JP2016143074A (en) 2016-08-08
JP6363027B2 true JP6363027B2 (en) 2018-07-25

Family

ID=56570432

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015015887A Expired - Fee Related JP6363027B2 (en) 2015-01-29 2015-01-29 Verification device, verification system, verification method, and program

Country Status (1)

Country Link
JP (1) JP6363027B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0540616A (en) * 1991-08-02 1993-02-19 Hitachi Ltd Method for generating program specifications
KR101149828B1 (en) * 2010-10-20 2012-05-24 홍익대학교 산학협력단 Use case diagrams are based on test case generation programs and use them to generate test cases
JP5758311B2 (en) * 2012-01-13 2015-08-05 株式会社エヌ・ティ・ティ・データ Test code generation device, test code generation method, test code generation program

Also Published As

Publication number Publication date
JP2016143074A (en) 2016-08-08

Similar Documents

Publication Publication Date Title
US10824401B2 (en) Method and system for automated creation of graphical user interfaces
JP2013506895A (en) Automatic modification of applications based on runtime behavior
JP6268029B2 (en) Test case generation apparatus and test case generation method
EP3570576B1 (en) Method for the generation of personalized profile package data in integrated circuit cards, corresponding system and computer program product
US10365902B2 (en) Method for compiling a source code
US20160019266A1 (en) Query generating method and query generating device
JP4951416B2 (en) Program verification method and program verification apparatus
JP2009223851A (en) Method for migrating database system
JP6363027B2 (en) Verification device, verification system, verification method, and program
WO2004051470A1 (en) Program automatic converting method and program automatic converting device
JP6451417B2 (en) Debug support device, debug support system, debug support method, and debug support program
JP5041990B2 (en) Software component extraction support device
JP6239438B2 (en) Specification extraction device, specification extraction method and program
JP6490779B2 (en) Specification extraction device, specification extraction method and program
JP6305944B2 (en) Specification extraction device, specification extraction method and program
JP2019008799A (en) System and method for merging source data from source application into target data of target application
KR20190059701A (en) Method and apparatus for generating DEVS based simulation model and code
KR101790544B1 (en) Information processing apparatus, information processing method, and storage medium
JP2017228035A (en) Change meaning estimation device, change meaning estimation method and change meaning estimation program
JP6305356B2 (en) Specification extraction device, specification extraction method and program
JP6453685B2 (en) Arithmetic control device, arithmetic control method, and arithmetic control program
JP2016051367A (en) Data analysis device, data analysis method, and program
JP4698943B2 (en) Program production method, program production apparatus, program automatic conversion method, and program
CN111381814A (en) Method and device for generating syntax tree of code file and electronic equipment
JP4354514B2 (en) Program automatic conversion method, program automatic conversion device, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170328

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20180221

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20180306

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20180418

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20180529

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20180627

R150 Certificate of patent or registration of utility model

Ref document number: 6363027

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees