Upcoming SlideShare
×

CoqでGCの証明をしてみたよ(LT)

1,432 views

Published on

Published in: Technology
2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,432
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
6
0
Likes
2
Embeds 0
No embeds

No notes for slide

• CoqでGCの証明をしてみたよ(LT)

1. 1. Coq GC id:mzp 1
2. 2. • : • http://twitter.com/mzp • http://d.hatena.ne.jp/mzp/ • : • Coq 2
3. 3. Coq 3
4. 4. Coq • • • OCaml Haskell • http://coq.inria.fr 4
5. 5. Coq • 1. Coq • 2. ” ” • 3. OCaml Haskell 5
6. 6. GC 6
7. 7. “ ”GC ? • GC ” ” • 7
8. 8. 1. Definition mark_phase {A : Type} (dec : x_dec A) (m : Mem) := mkMem A (nodes m) (roots m) closuresM : (frees m) (fun x => if In_dec dec x (closuresM dec m) then Marked else Marked Unmarked) (next m). Unmarked Definition sweep_phase {A : Type} (dec : x_dec A) (m : Mem) : Mem := let unmarked := filter_dec (fun n => mark_dec (GC.marker m n) Unmarked) @@ nodes m in mkMem A (nodes m) (roots m) (union dec (frees m) unmarked) Unmarked (fun _ => Unmarked) (next m). Definition gc {A : Type} (dec : x_dec A) (m : Mem) : Mem := gc mark_phase sweep_phase dec (mark_phase dec m). sweep_phase 8
9. 9. 2. Safety: Lemma SweepPhase_Safety : forall A (dec : x_dec A) (m1 m2 : Mem (A:=A)), SweepPhase dec m1 m2 -> Safety dec m1 -> MarksAll dec m1 -> Safety dec m2. Sweep Safety Proof. (snip) Qed. Lemma MarkPhase_Safety : forall A (dec : x_dec A) (m1 m2 : Mem (A:=A)), MarkPhase dec m1 m2 -> Safety dec m1 -> Safety dec m2 / Mark Safety MarksAll dec m2. Proof. (snip) Qed. Theorem GC_Safety: forall A (dec : x_dec A) (m1 m2 : Mem (A:=A)), GC Safety GC dec m1 m2 -> Safety dec m1 -> Safety dec m2. Proof. (snip) Qed. 9
10. 10. 3. c b 10
11. 11. ... • github • http://github.com/mzp/GC 11