多重ループからの脱出でのgoto文の是非:Hoare論理の観点から

Bibliographic Information

Other Title
  • タジュウ ループ カラ ノ ダッシュツ デ ノ gotoブン ノ ゼヒ Hoare ロンリ ノ カンテン カラ
  • On the Use of goto's in Escaping from Nested Loops: from the Hoare Logic Viewpoint
  • プログラミング方法論とパラダイム

Search this article

Abstract

Dijkstraのgoto文有害説とそれに引き続く構造的プログラミングの提唱以降,goto文の使用に関する問題は長く議論されてきたが,goto文の使用法に関しての理論的裏付けを持つ研究としては,逐次的プログラムの制御フローは3基本構造(順次接続,条件分岐,反復)のみで表現可能であるからgoto文を用いたプログラムは3基本構造のみによる等価なプログラムに書き換えられる,という結果に基づいたMillsらのgoto文排斥論以外は皆無であり,Dijkstra本来のプログラムの正しさを示す手段としてのプログラムの構造化という観点でのgoto文の使用の是非は,プログラム検証論の立場から考察されなかった.本論文では,プログラムの正しさを示すという検証手段としてのHoare論理に基づきgoto文の使用を再検討する.特に,多重ループの打ち切りの場合,goto文を用いて脱出するプログラミングスタイルの方が,Mills流のBoolean型変数を追加してループを打ち切るスタイルよりも,Hoare論理での証明アウトラインが簡単に構成でき,したがって,前者のgoto文を用いたプログラミングスタイルの方が,そのようなプログラムに対するHoare論理による検証上からは望ましいことを示す.

There have been a vast amount of debates on the issue on usages of goto statements initiated by the famous Dijkstra's Letter to the Editor of CACM and his proposal of ``Structured Programming''.Except for the goto-less programming style by Mills based on the fact that any control flows of sequential programs can be expressed by the sequential composition, the conditional (If-Then-Else)and the indefinite loop (While), there have not been, however, any scientific accounts on this issuefrom the Dijkstra's own viewpoint of verifiability of programs.In this work, we reconsider this issue from the viewpoint of Hoare Logic,the most standard framework for proving the correctness of programs, and we see that usages of goto's in escaping from nested loops can be justified from the Hoare Logic viewpoint by showing the fact that constructing the proof-outline of a program using a goto for this purpose is easier than constructing the proof-outline of a Mills-style program without goto by introducing a new Boolean variable.

Journal

Citations (1)*help

See more

References(49)*help

See more

Keywords

Details 詳細情報について

Report a problem

Back to top