Upcoming SlideShare
×

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

• 1,023 views

More in: Technology
• Comment goes here.
Are you sure you want to
Be the first to comment

Total Views
1,023
On Slideshare
0
From Embeds
0
Number of Embeds
0

Shares
2
0
Likes
1

No embeds

### Report content

No notes for slide

### Transcript

• 1. Coq GC id:mzp 1
• 2. • : • http://twitter.com/mzp • http://d.hatena.ne.jp/mzp/ • : • Coq 2
• 3. Coq 3
• 4. Coq • • • OCaml Haskell • http://coq.inria.fr 4
• 5. Coq • 1. Coq • 2. ” ” • 3. OCaml Haskell 5
• 6. GC 6
• 7. “ ”GC ? • GC ” ” • 7
• 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. 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. 3. c b 10
• 11. ... • github • http://github.com/mzp/GC 11