Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programs Synthesis from Refinement Types Nadia Polikarpova joint work with: Ivan Kuraj Armando Solar-Lezama To appear at PLDI’16.

Similar presentations


Presentation on theme: "Programs Synthesis from Refinement Types Nadia Polikarpova joint work with: Ivan Kuraj Armando Solar-Lezama To appear at PLDI’16."— Presentation transcript:

1 Programs Synthesis from Refinement Types Nadia Polikarpova joint work with: Ivan Kuraj Armando Solar-Lezama To appear at PLDI’16

2 Program Synthesis 2 “Make a list with n copies of x” replicate n x = if n ≤ 0 then Nil else Cons x (replicate (dec n) x) declarative specification executable program 2 50 ⊨ ? Synthesizer

3 Modular Verification for Synthesis 3

4 “Make a list with n copies of x” Specifications for synthesis 4 refinement type replicate n x = if n ≤ 0 then Nil else Cons x (replicate (dec n) x) Synthesizer

5 Example: replicate data List α where Nil :: List α Cons :: x: α → xs: List α → List α measure len :: List α -> Int where... zero :: {ν: Int | ν = 0} inc :: x: Int → {ν: Int | ν = x + 1} dec :: x: Int → {ν: Int | ν = x - 1} replicate :: n: Nat → x: α → {ν: List α | len ν = n} replicate = ?? 5 Demo

6 Type-driven Synthesis 6 Γ ⊢ ?? :: T x 1 :: T 1 ;... ?? :: U ?? :: V I. top-down enumerative search II. round-trip type checking

7 Specification decomposition 7 Nil ; 0 ; 5 ; -5 zeros replicate ; Cons ⊢ ?? :: {List Neg | len ν ≥ 5} Nil :: {List Neg |len ν = 0} Nil :: {List a | len ν = 0} zeros :: n:Nat → {List Zero | len ν = n} Γ ?? :: _ → List Neg

8 0 :: { ν = 0 } 5 :: { ν = 5 } Nil ; 0 ; 5 ; -5 zeros replicate Cons Specification decomposition 8 ⊢ ?? :: {List Neg | len ν ≥ 5} replicate :: n: Nat → x: Neg → {List Neg | len ν = n} ?? :: Nat?? :: Neg 0 :: { ν = 0 } 5 :: { ν = 5 } :: {List Neg | len ν = 0} :: {List Neg | len ν = 5} -5 :: { ν = -5 } replicate :: n: Nat → x: a → {List a | len ν = n} ?? :: _ → _ → List Neg

9 Evaluation 9 take, drop, delete, zip with, reverse, de-duplicate, fold, length/append with fold,... Lists insertion s., selection s., merge s., quick s. Sorting member, insert, delete Binary Search Trees RBT & AVL insertion, AVL deletion Balanced trees AST desugaring, address book Custom datatypes 20 s 6 s 64 benchmarks 33 31 > 120 s No roundtrip type checking


Download ppt "Programs Synthesis from Refinement Types Nadia Polikarpova joint work with: Ivan Kuraj Armando Solar-Lezama To appear at PLDI’16."

Similar presentations


Ads by Google