annotate user/ryokka/poster-slide.md @ 121:6138bdc8f9dc

backup 2023-05-11
author autobackup
date Thu, 11 May 2023 00:10:04 +0900
parents b6c284fd5ae4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
1 Continuation Based C の Hoare Logic を用いた仕様記述と検証
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
2 =====
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
3
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
4 琉球大学大学院 : 並列信頼研究室\
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
5 外間 政尊
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
6
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
7 ---
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
8
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
9 ## OS の検証技術としての Hoare Logic の問題点
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
10 - OS やアプリケーションの信頼性は重要な課題
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
11
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
12 - 信頼性を上げるために仕様の検証が必要
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
13
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
14 - 検証にはモデル検査や**定理証明**などが存在する
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
15
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
16 - 定理証明では証明の手法と型システムの対応を用いて検証
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
17
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
18 - また、仕様検証の手法として **Hoare Logic** がある
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
19
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
20 - Hoare Logic ではコマンドを実行する上で事前の条件があり、実行が停止したとき成立する条件がある
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
21
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
22 - コマンドが細かいため大きなプログラムを記述するのが大変
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
23
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
24 ---
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
25
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
26 ## Hoare Logic をベースにした Gears 単位での検証
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
27 - 当研究室では 処理の単位を **CodeGear**、データの単位を **DataGear** としてプログラムを記述する手法を提案している
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
28
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
29 - CodeGear は Input DataGear を受け取り、処理を行って Output DataGear に書き込む
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
30
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
31 - CodeGear は継続を用いて次の CodeGear に接続される
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
32
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
33 - **定理証明支援機**である **Agda** 上で CodeGear DataGear の単位を用いた検証を行う
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
34
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
35 - 本研究では Gears 単位を用いた Hoare Logic ベースの検証手法を提案する
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
36
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
37 ---
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
38
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
39 ## Hoare Logic
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
40 Hoare Logic はプログラム検証の手法
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
41
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
42 事前条件( P )が成り立つとき、コマンド( C )を実行すると事後条件( Q )が成り立つ
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
43
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
44 これは **{ P } C { Q }** の形で表され、Hoare Triple と呼ばれる
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
45
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
46 以下のような while program を検証した
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
47
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
48 n = 10 となっているが検証では n は任意の自然数
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
49
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
50 ```C
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
51 n = 10;
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
52 i = 0;
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
53
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
54 while (n>0)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
55 {
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
56 i++;
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
57 n--;
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
58 }
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
59 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
60
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
61 ---
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
62
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
63 ## Hoare Logic と while program
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
64
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
65 **Seq** はコマンドを2つ受け取って順に実行する
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
66
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
67 **PComm** は代入
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
68
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
69 **while** は変数の状態が(0<n)の間、コマンドを繰り返し実行
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
70
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
71 実際に while program を表すために、コマンドでの構文木を記述している
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
72
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
73 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
74 Seq
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
75 / \
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
76 PComm Seq
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
77 (n=10) / \
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
78 PComm While
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
79 (i=0) |
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
80 Cond
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
81 (0<n)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
82 |
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
83 Seq
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
84 / \
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
85 PComm PComm
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
86 (i++) (n--)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
87 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
88 更にこの後、プログラムの仕様を記述して証明する
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
89
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
90 ---
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
91
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
92 ## CbC での Hoare Logic 概略
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
93 CodeGear は処理の単位、更にメタレベルの処理を Meta CodeGear という単位で分けてる
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
94
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
95 メタレベルの処理は今見えるところだと CodeGear 間を接続する処理とか
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
96
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
97 ![](./hoare-cg-dg.svg)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
98 ![](/attachment/5e469a577b378d004670d3d6)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
99
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
100 Meta CodeGear で信頼性の検証を行う
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
101
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
102
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
103
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
104 ## 詳しい話、質問等はポスターで!
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
105 よろしくお願いします
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
106
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
107 ご静聴ありがとうございました
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
108
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
109
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
110 ## CbC での Hoare Logic 記述
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
111 「代入」、「ループ」の2つの CodeGear に分けた
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
112
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
113 代入では「事前条件なし」 から 「n=10 かつ i=0」
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
114
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
115 ループでは少し条件を緩めて 「n + i = 10」
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
116
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
117 ループ終了後は 「i=0」が成り立ってるはず
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
118
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
119 というのを Gears 単位上で Hoare Logic っぽく検証しましたというお話になる予定
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
120
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
121 ---