多重ループからの脱出でのgoto文の是非:Hoare論理の観点から  [in Japanese] On the Use of goto's in Escaping from Nested Loops: from the Hoare Logic Viewpoint  [in Japanese]

Access this Article

Search this Article

Author(s)

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.

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 nows 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 issue from 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 gasier than constructing the proof-outline of a Mills-style program without goto by introducing a new Boolean variable.

Journal

  • IPSJ journal

    IPSJ journal 45(3), 770-784, 2004-03-15

    Information Processing Society of Japan (IPSJ)

References:  49

Cited by:  1

Codes

  • NII Article ID (NAID)
    110002712129
  • NII NACSIS-CAT ID (NCID)
    AN00116647
  • Text Lang
    JPN
  • Article Type
    Journal Article
  • ISSN
    1882-7764
  • NDL Article ID
    6885099
  • NDL Source Classification
    ZM13(科学技術--科学技術一般--データ処理・計算機)
  • NDL Call No.
    Z14-741
  • Data Source
    CJP  CJPref  NDL  NII-ELS  IR  IPSJ 
Page Top