Extending enumerative function synthesis via SMT-driven classification Haniel Barbosa , Andrew Reynolds, Daniel Larraz, Cesare Tinelli FMCAD 2019 2019-10-25, San Jose, CA, USA
Syntax-Guided Synthesis (SyGuS) [Alur et al. 2013] Speci fi cation Program Synthesizer Syntax restrictions ⊲ Specification is given by T -formula: ∃ f. ∀ ¯ x. ϕ [ f, ¯ x ] ⊲ Syntactic restrictions given by context-free grammar R Extending enumerative function synthesis via SMT-driven classification 1 / 18
Enumerative CEGIS [Solar-Lezama et al. 2006; Udupa et al. 2013] Consider the example: ϕ = f ( x, x ) ≃ x + 1 ∧ f ( x, x + 1) ≃ x A → 0 | 1 | x | y | A + A | ite( B, A, A ) = R B → A ≤ A | ¬ B Counterexamples = { } Solution Solution Enumerator Veri fi er ⊲ De facto approach to SyGuS solving given its simplicity and efficacy Extending enumerative function synthesis via SMT-driven classification 2 / 18
Enumerative CEGIS [Solar-Lezama et al. 2006; Udupa et al. 2013] Consider the example: ϕ = f ( x, x ) ≃ x + 1 ∧ f ( x, x + 1) ≃ x A → 0 | 1 | x | y | A + A | ite( B, A, A ) = R B → A ≤ A | ¬ B Counterexamples = { } Candidate f(x,y)=x Solution Solution Enumerator Veri fi er ⊲ De facto approach to SyGuS solving given its simplicity and efficacy Extending enumerative function synthesis via SMT-driven classification 2 / 18
Enumerative CEGIS [Solar-Lezama et al. 2006; Udupa et al. 2013] Consider the example: ϕ = f ( x, x ) ≃ x + 1 ∧ f ( x, x + 1) ≃ x A → 0 | 1 | x | y | A + A | ite( B, A, A ) = R B → A ≤ A | ¬ B Counterexamples = { f(1,1) = 2, Candidate f(1,2) = 1 } f(x,y)=x Solution Solution Enumerator Veri fi er Counterexample f(x=1,y=0) ⊲ De facto approach to SyGuS solving given its simplicity and efficacy Extending enumerative function synthesis via SMT-driven classification 2 / 18
Enumerative CEGIS [Solar-Lezama et al. 2006; Udupa et al. 2013] Consider the example: ϕ = f ( x, x ) ≃ x + 1 ∧ f ( x, x + 1) ≃ x A → 0 | 1 | x | y | A + A | ite( B, A, A ) = R B → A ≤ A | ¬ B Counterexamples = Examples rule out candidates { f(1,1) = 2, 0, 1, y, x+y, ... f(1,2) = 1 } Solution Solution Enumerator Veri fi er ⊲ De facto approach to SyGuS solving given its simplicity and efficacy Extending enumerative function synthesis via SMT-driven classification 2 / 18
Enumerative CEGIS [Solar-Lezama et al. 2006; Udupa et al. 2013] Consider the example: ϕ = f ( x, x ) ≃ x + 1 ∧ f ( x, x + 1) ≃ x A → 0 | 1 | x | y | A + A | ite( B, A, A ) = R B → A ≤ A | ¬ B Counterexamples = { f(1,1) = 2, Candidate f(1,2) = 1, f(x,y)=ite(y<1, 1+1, 1) f(0,0) = 1, Solution Solution f(0,1) = 0 Enumerator Veri fi er } Counterexample f(x=0,y=0) ⊲ De facto approach to SyGuS solving given its simplicity and efficacy Extending enumerative function synthesis via SMT-driven classification 2 / 18
Enumerative CEGIS [Solar-Lezama et al. 2006; Udupa et al. 2013] Consider the example: ϕ = f ( x, x ) ≃ x + 1 ∧ f ( x, x + 1) ≃ x A → 0 | 1 | x | y | A + A | ite( B, A, A ) = R B → A ≤ A | ¬ B Counterexamples = SUCCESS { f(1,1) = 2, Candidate f(1,2) = 1, f(x,y)= f(0,0) = 1, Solution Solution f(0,1) = 0 Enumerator Veri fi er } ⊲ De facto approach to SyGuS solving given its simplicity and efficacy Extending enumerative function synthesis via SMT-driven classification 2 / 18
Scalability issues Enumerative techniques are effective but limited to the generation of small terms due to the explosion of the space of terms as size increases For this bit-vector grammar, enumerating ⊲ Terms of size = 1 : .05 seconds ⊲ Terms of size = 2 : .6 seconds ⊲ Terms of size = 3 : 48 seconds ⊲ Terms of size = 4 : 5.8 hours ⊲ Terms of size = 5 : ??? (100+ days) Extending enumerative function synthesis via SMT-driven classification 3 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator Counterexamples = { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning Extending enumerative function synthesis via SMT-driven classification 4 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator Counterexamples = { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning y ≤ x ⊤ ⊥ { f (1 , 1) = 2 , f (0 , 0) = 1 } { f (1 , 2) = 1 , f (0 , 1) = 0 } Extending enumerative function synthesis via SMT-driven classification 4 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator Counterexamples = { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning y ≤ x ⊤ ⊥ { f (1 , 1) = 2 , f (0 , 0) = 1 } { f (1 , 2) = 1 , f (0 , 1) = 0 } 0 ✗ Extending enumerative function synthesis via SMT-driven classification 4 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator Counterexamples = { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning y ≤ x ⊤ ⊥ { f (1 , 1) = 2 , f (0 , 0) = 1 } { f (1 , 2) = 1 , f (0 , 1) = 0 } 1 ✗ Extending enumerative function synthesis via SMT-driven classification 4 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator Counterexamples = { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning y ≤ x ⊤ ⊥ { f (1 , 1) = 2 , f (0 , 0) = 1 } { f (1 , 2) = 1 , f (0 , 1) = 0 } x ✗ Extending enumerative function synthesis via SMT-driven classification 4 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator Counterexamples = { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning y ≤ x ⊤ ⊥ { f (1 , 1) = 2 , f (0 , 0) = 1 } { f (1 , 2) = 1 , f (0 , 1) = 0 } y ✗ Extending enumerative function synthesis via SMT-driven classification 4 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator Counterexamples = { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning y ≤ x ⊤ ⊥ { f (1 , 1) = 2 , f (0 , 0) = 1 } { f (1 , 2) = 1 , f (0 , 1) = 0 } x + 1 � Extending enumerative function synthesis via SMT-driven classification 4 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator Counterexamples = { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning y ≤ x ⊤ ⊥ { f (1 , 1) = 2 , f (0 , 0) = 1 } { f (1 , 2) = 1 , f (0 , 1) = 0 } x + 1 � x � Extending enumerative function synthesis via SMT-driven classification 4 / 18
Divide and conquer (D&C) [Alur et al. 2017; Neider et al. 2018] T erms = Predicates = T erm Predicate { 0, 1, x, y, x+1 } { } Enumerator Enumerator SUCCESS Counterexamples = Candidate f(x,y)= { f(1,1) = 2, f(1,2) = 1, Decision Tree Solution f(0,0) = 1, Learner Veri fi er f(0,1) = 0 } ⊲ Generate partial solutions correct on subset of input ⊲ Unify partial solutions via decision tree learning y ≤ x ⊤ ⊥ { f (1 , 1) = 2 , f (0 , 0) = 1 } { f (1 , 2) = 1 , f (0 , 1) = 0 } x + 1 � x � ⊲ D&C provides much better scalability Extending enumerative function synthesis via SMT-driven classification 4 / 18
However... ⊲ D&C can only be applied to point-wise specifications ◮ Each input valuation is specified independently Extending enumerative function synthesis via SMT-driven classification 5 / 18
Recommend
More recommend