verification and model checking - gunma university · 2013. 11. 19. · 猫とねずみ •...
TRANSCRIPT
![Page 1: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/1.jpg)
論理と検証技術
モデル検査と定理証明
2011年7月29日
藤田 憲悦
![Page 2: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/2.jpg)
状態遷移図 Mm×Mc
m: W1 → B0 → B1 → W0cat:W1↓
B0↓
B1↓
W0↓↑
W2
IW
W
catcat
![Page 3: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/3.jpg)
猫とねずみ• 次のようなフィールド上で猫とねずみが追いかけっこをする
北
• ねずみは[北西]から、ネコは[南]からスタートする
• 隣り合うポイントにのみ動ける
• 先攻がねずみ、後攻がネコで交互に動く
• ネコがねずみを捕まえたらネコの勝ち
![Page 4: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/4.jpg)
斜め線と勝利条件
• 斜め線が無い場合、初期位置での互いの距離の偶奇性で勝敗が決まる
・・・今回の初期位置では、ななめ線が無い場合、勝利条件を満たせない
• 斜め線の通過により偶奇性が変わるのが鍵
![Page 5: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/5.jpg)
状態遷移図 Mm×Mc
m: W1 → B0 → B1 → W0cat:W1↓
B0↓
B1↓
W0↓↑
W2
IW
W
catcat
![Page 6: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/6.jpg)
状態遷移図 Mm×Mc
m: W2←W1 → B0 → B1 → W0 → W1’ → B0’→B1’→W0’
cat:W1↓
B0↓
B1↓
W0↓↑
W2
I W
W
W
W
catcat
m
![Page 7: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/7.jpg)
模倣と抽象化
• Mc = < Sc, Rc, Ic, Atom, Lc >• Ma = < Sa, Ra, Ia, Atom, La >• f : Sc→Sa がMcからMaへの模倣写像1.Lc(s) = La (f(s))2.Rc(s, t) ⇒ Ra(f(s), f(t))3.f(Ic) = Ia
• 保存定理:McからMaへの模倣写像が存在するなら,任意のLTL式Aに対して,
Ma |= A ⇒ Mc |= A
![Page 8: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/8.jpg)
模倣射像 f:Mc→Ma
p p
Mc Ma
![Page 9: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/9.jpg)
模倣射像 f:Mc→Ma
p p
Mc |= X X ¬ p Ma |= X X ¬ p
偽反例
f
f
![Page 10: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/10.jpg)
プロセスPwhile True{
//non‐critical sectionx:=y+1;while y != 0 and x > y{}
//critical sectionx:=0;}
プロセスQwhile True{
//non‐critical sectiony:=x+1;while x != 0 and x < y{}
//critical sectiony:=0;}
排他制御(ベーカリーアルゴリズム)
NC
Wait
Critical
x:=y+1
x:=0
y!=0andx>y
o.w.
NC
Wait
Critical
y:=x+1
y:=0
x!=0andy>x
o.w.
![Page 11: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/11.jpg)
プロセスPwhile True{
//non‐critical sectionx:=y+1;while y != 0 and x > y{}
//critical sectionx:=0;}
プロセスQwhile True{
//non‐critical sectiony:=x+1;while x != 0 and x < y{}
//critical sectiony:=0;}
排他制御(ベーカリーアルゴリズム)
NC
Wait
Critical
x:=y+1
x:=0
y!=0andx>y
o.w.
NC
Wait
Critical
y:=x+1
y:=0
x!=0andy>x
o.w.
|≠G(x<10)
![Page 12: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/12.jpg)
プロセスPwhile True{
//non‐critical sectionx:=y+1;while y != 0 and x > y{}
//critical sectionx:=0;}
プロセスQwhile True{
//non‐critical sectiony:=x+1;while x != 0 and x < y{}
//critical sectiony:=0;}
模倣射像 g : N×N → { ZZ, pZ, Zp, lp, pl, pEq }
ZZ (x=y=0)pZ (x>0かつy=0)
g(x, y) = Zp (x=0かつy>0) 述語による N×N の分割lp (0<x<y)pl (0<y<x)pEq (0<x=y)
述語抽象化
![Page 13: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/13.jpg)
N
N
4
3
2
1
0 1 2 3 4
lp g(x,y)
ZZ pZ
Zp
pl
pEq
![Page 14: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/14.jpg)
N
N
4
3
2
1
0 1 2 3 4
lp
pEq
g(x,y)
ZZ pZ
Zp
pl
![Page 15: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/15.jpg)
Abstract model: process P
Zp
lp
pEq
pl
pZZZ
x:=0
x:=y+1
x:=y+1
x:=y+1
x:=0
x:=0
x:=0
x:=y+1
x:=y+1x:=y+1
![Page 16: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/16.jpg)
Abstract model: process P
Zp
lp
pEq
pl
pZZZ
x:=0
x:=y+1
x:=y+1
x:=y+1
x:=0
x:=0
x:=0
x:=y+1
x:=y+1
y:=0
x:=y+1
y:=0
y:=x+1
y:=x+1
y:=0y:=x+1
y:=0
y:=x+1y:=x+1
y:=x+1
![Page 17: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/17.jpg)
Abstract model: process P
Zp
lp
pEq
pl
pZZZ
x:=0
x:=y+1
x:=y+1
x:=y+1
x:=0
x:=0
x:=0
x:=y+1
x:=y+1
y:=0
x:=y+1
y:=0
y:=x+1
y:=x+1
y:=0y:=x+1
y:=0
y:=x+1y:=x+1
y:=x+1
(x,y) : (0,0) →(1,0)→(1,2)→(0,2)→(3,2)→(3, 0)→ …..
![Page 18: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/18.jpg)
Combined approach of Verification and model
checking :D.A.Peled
System Model PropertiesVerify
Simulation
Model
Checking
* The adequacy of the simplification (abstraction).
* The essential properties are preserved.
![Page 19: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/19.jpg)
Forward simulation:concrete Mc refines abstract Ma
• Forward simulation R ⊆ Sc×Sa:1. ∀ ic∈Ic ∃ia∈ Ia. R(ic, ia)2. R(s, r) ⇒ Lc(s) = La(r)3. s → s’ & R(s,r) ⇒ ∃r’.r → r’ & R(s’,r’)
r r’
s s’
∀ Concrete operation in Mc
∃ Abstract operation in Ma
State Relation R State Relation R
![Page 20: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/20.jpg)
Forward simulation:concrete Mc refines abstract Ma
• Forward simulation R ⊆ Sc×Sa:1. ∀ ic∈Ic ∃ia∈ Ia. R(ic, ia)2. R(s, r) ⇒ Lc(s) = La(r)3. s → s’ & R(s,r) ⇒ ∃r’.r → r’ & R(s’,r’)
r r’
s s’
∀ Concrete operation in Mc
∃ Abstract operation in Ma
State Relation R State Relation R
Ma |= A ⇒ Mc |= A
£[A]
∪£[Ma]
∪£[Mc]
![Page 21: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/21.jpg)
Backward simulation:• Backward simulation Q ⊆ Sa×Sc:
1. ∀ ia∈Ia ∃ic∈ Ic. Q(ia, ic)2. Q(r, s) ⇒ La(r) = Lc(s) 3. r → r’ & Q(r, s) ⇒ ∃s’. s → s’ & Q(r’,s’)
r r’
s s’
∃ Concrete operation in Mc
∀ Abstract operation in Ma
State Relation Q State Relation Q
Ma |≠ A ⇒ Mc | ≠ A
![Page 22: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/22.jpg)
Combined approach of Verification and model
checking :D.A.Peled
System Model PropertiesVerify
Simulation
Model
Checking
System Model_c Model_a PropertiesVerify
Simulation
Model
Checking
![Page 23: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/23.jpg)
Refinement layers in seL4 Verifi.(G.Klein, et. al. )
• All properties of abstract model also hold for the refined model:
• Abstract specification: MA
↑ high-level (abstract)• Executable specification: ME
↓ low-level (concrete, refined)• High-performance C implementation: MC
![Page 24: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/24.jpg)
Refinement layers in seL4 Verifi.(G.Klein, et. al. )
• All properties of abstract model also hold for the refined model:
• Abstract specification: MA
↑ high-level (abstract)• Executable specification: ME
↓ low-level (concrete, refined)• High-performance C implementation: MC
• Th. MC refines ME, and ME refines MA.
![Page 25: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/25.jpg)
Formally verified compiler(X. Leroy, et. al. )
• Safety properties on source code also hold for compiled code:
• Clight (subset of C program. lang.): MA
↓ compilation• 8 Intermediate languages ‥‥‥
↓ compilation• PowerPC assembly code: MC
• Semantic preservation: MC behaves following semantics of MA.
![Page 26: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/26.jpg)
Comparison: verification and model checking
System Model_c Model_a PropertiesVerify
Simulation
Model
Checking
Implement.Spec. Spec_a Spec_cRefine
Simulation
![Page 27: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/27.jpg)
Hoare 論理へ
• ⇒ 定理証明システムを活用した検証
![Page 28: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/28.jpg)
JMLツールの例
• JMLツールの調査
![Page 29: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/29.jpg)
![Page 30: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/30.jpg)
![Page 31: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/31.jpg)
![Page 32: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/32.jpg)
![Page 33: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/33.jpg)
定理証明器の活用
• Coqの例
![Page 34: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/34.jpg)
![Page 35: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/35.jpg)
![Page 36: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/36.jpg)
Java プログラムの検証
• ⇒ Krakatoaへ
![Page 37: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/37.jpg)
![Page 38: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/38.jpg)
![Page 39: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/39.jpg)
Mulメソッドの検証
• Breunesse, Catano, Huisman, Jacobs:Formal methods for smart cards: an experience report,Science of Computer Programming 55 (2005) 53—80
• Short 型16bit で小数の積の計算をする mul メソッドを実装して,定理証明システムLOOPで検証
![Page 40: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/40.jpg)
Gemplus電子財布アプレット
• Genplusが開発したJava Card用電子財布
• Purseアプレット:入金,出金,外貨両替
• Card issuerアプレット:本人認証
• Loyaltyアプレット:ロイリャリティ・ポイント
![Page 41: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/41.jpg)
![Page 42: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/42.jpg)
(2^15 -1)
![Page 43: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/43.jpg)
Mulメソッド
![Page 44: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/44.jpg)
The “rest-part”
• a.b * e.f = a*e + a*0.f + 0.b * e + 0.b*0.f • b, f < 1000 and (b*f)/10^6 < 1
• decimal = a*e*PRECISION + a*f + e*b + (b*f)/10^3
• floor「(b*f)/10^3」• Overflow: “b*f” は short 型• Rounding:
(b*f)/10^3 ≠ (b/10^3 * f/10^3)*10^3
![Page 45: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/45.jpg)
Original Specification (a.b*e.f)/*@ requires 0 <= f && f < PRECISION &&@ 0 <= e && e <= MAX_DECIMAL_NUMBER &&@ (e+1) * (intPart+1) < MAX_DECIMAL_NUMBER@ modifies decimal;@ ensures decimal = e * ¥old(intPart) * PRECISION@ + ¥old(intPart) * f@ + e * ¥old(decPart)@ + @ ( ( f > 100 && ¥old(decPart) > 100) ?@ ( ((¥old(decPart)/10) * (f/10)) / 10 ) :@ ( ( f > 100 && ¥old(decPart) <= 100) ?@ ( (¥old(decPart) * (f/10)) / 100 ) :@ ……….@ ( ( f <= 100 && ¥old(decPart) <= 100) ?@ ( (¥old(decPart) * f) / 1000 )))); ……….@*/private void mul(short e, short f) { ……….}
![Page 46: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/46.jpg)
Original Specification (a.b*e.f)/*@ requires 0 <= f && f < PRECISION &&@ 0 <= e && e <= MAX_DECIMAL_NUMBER &&@ (e+1) * (intPart+1) < MAX_DECIMAL_NUMBER@ modifies decimal;@ ensures decimal = e * ¥old(intPart) * PRECISION@ + ¥old(intPart) * f@ + e * ¥old(decPart)@ + @ ( ( f > 100 && ¥old(decPart) > 100) ?@ ( ((¥old(decPart)/10) * (f/10)) / 10 ) :@ …………………………………………………
No overflow: (1000/10 * 1000/10) = 100*100 < 32767But rounding:( 999/10 * 999/10)/10 = (99 * 99)/10 = 9801/10 = 9800.999 * 0.999 = 0.998001 998!
![Page 47: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/47.jpg)
![Page 48: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/48.jpg)
0.b: b=a1a2a3
0.b * 0.f
![Page 49: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/49.jpg)
![Page 50: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/50.jpg)
![Page 51: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/51.jpg)
![Page 52: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/52.jpg)
![Page 53: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/53.jpg)
![Page 54: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/54.jpg)
![Page 55: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/55.jpg)
Mul メソッドの検証
• PostCondition:
intPart*PRECISION + decPart= a*e*PRECIEION
+ a*f + e*b + (b*f)/10^3
![Page 56: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/56.jpg)
![Page 57: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/57.jpg)
a.b*e.f :
![Page 58: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/58.jpg)
(a. b * e) < (a+1) * e
![Page 59: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/59.jpg)
(0.f * a) < a
![Page 60: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/60.jpg)
![Page 61: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/61.jpg)
(0.f * 0.b) < 1
![Page 62: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/62.jpg)
(a+1)*(e+1) = (e+1)*(intPart +1) < Max : PreCondition
![Page 63: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/63.jpg)
![Page 64: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/64.jpg)
![Page 65: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/65.jpg)
![Page 66: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/66.jpg)
![Page 67: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/67.jpg)
![Page 68: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/68.jpg)
![Page 69: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/69.jpg)
![Page 70: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/70.jpg)
![Page 71: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/71.jpg)
![Page 72: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/72.jpg)
![Page 73: Verification and Model checking - Gunma University · 2013. 11. 19. · 猫とねずみ • 次のようなフィールド上で猫とねずみが追いかけっこをする 北 •](https://reader036.vdocuments.site/reader036/viewer/2022071105/5fdf218c0b6d4e52ab4b2f06/html5/thumbnails/73.jpg)
参考資料へ
• Formal methods for smart cards• seL4: Formal Verification of an Operating
System Kernel• Formal verification of a realistic compiler• Software Reliability Methods
• The Seventeen Provers of the World• Survey: Verification Tools (Jave+JML)