annotate tex/hoare.tex @ 7:acad18934981

add description of rbtree
author soto@cr.ie.u-ryukyu.ac.jp
date Mon, 14 Sep 2020 05:41:23 +0900
parents b124f02ea3f1
children 27a6616b6683
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
b124f02ea3f1 post agda code
soto@cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 \section{Hoare Logic}
7
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
2 Hoare Logic とは C.A.R Hoare、 R.W Floyd が考案したプログラムの検証の手法である。
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
3 これは、「プログラムの事前条件(P)が成立しているとき、コマンド(C)実行して停止すると事後条件(Q)が成り立つ」
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
4 というもので、CbCの実行を継続するという性質に非常に相性が良い。
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
5 Hoare Logic を表記すると以下のようになる。
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
6 {P} C {Q}
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
7 この3つ組は Hoare Triple と呼ばれる。
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
8
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
9 Hoare Triple の事後条件を受け取り異なる条件を返す別の Hoare Triple を繋げることでプログラムを記述していく。
3
b124f02ea3f1 post agda code
soto@cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10
7
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
11 Hoare Logic の検証では、「条件がすべて正しく接続されている」かつ「コマンドが停止する」ことが必要である。
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
12 これらを満たし、事前条件から事後条件を導けることを検証することで Hoare Logic の健全性を示すことができる。
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
13
3
b124f02ea3f1 post agda code
soto@cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14
7
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
15 \begin{center}
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
16 \includegraphics[height=3.5cm]{pic/hoare_cg_dg.pdf}
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
17 \caption{CodeGear、DataGear での Hoare Logic}
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
18 \label{hoare}
acad18934981 add description of rbtree
soto@cr.ie.u-ryukyu.ac.jp
parents: 3
diff changeset
19 \end{center}
3
b124f02ea3f1 post agda code
soto@cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20