Boolean Functional Synthesis via Self-Substitution Lucas M. Tabajara Rice University lucasmt@rice.edu May 9, 2016 Joint work with Dror Fried and Moshe Vardi Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 1 / 14
Motivation x 1 y 1. g : Bm Bn. x m y n Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 2 / 14
Motivation x 1 y 1. g : Bm Bn. x m y n f : B m B n f ( x, y) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 2 / 14
Motivation x 1 y 1. g : Bm Bn. x m y n f : B m B n f ( x, y) g : B m B n y = g( x) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 2 / 14
Motivation x 1 y 1. g : Bm Bn. x m y n f : B m B n f ( x, y) g : B m B n y = g( x) Given f ( x, y), how to obtain g( x)? Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 2 / 14
Motivation x 1 y 1. g : Bm Bn. x m y n f : B m B n f ( x, y) g : B m B n y = g( x) Given f ( x, y), how to obtain g( x)? How to identify when an input x has no corresponding output? Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 2 / 14
Overview 1 Problem formulation 2 Framework Introducing Self-Substitution Synthesis in two phases 3 Experimental evaluation Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 3 / 14
Problem formulation Given: Specification: Boolean formula f ( x, y) Input variables: x 1,..., x m Output variables: y 1,..., y n Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 4 / 14
Problem formulation Given: Specification: Boolean formula f ( x, y) Input variables: x 1,..., x m Output variables: y 1,..., y n Obtain: Precondition: Boolean formula p( x) p( x) is true exactly for those inputs for which there is a valid output Formally, p( x) y.f ( x, y) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 4 / 14
Problem formulation Given: Specification: Boolean formula f ( x, y) Input variables: x 1,..., x m Output variables: y 1,..., y n Obtain: Precondition: Boolean formula p( x) p( x) is true exactly for those inputs for which there is a valid output Formally, p( x) y.f ( x, y) Implementation: Boolean function g( x) = (g 1 ( x),..., g n ( x)) for every input that satisfies the precondition, g satisfies f Formally, p( x) f ( x, g( x)) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 4 / 14
Self-Substitution Lemma (Self-Substitution) Let f ( x, y) be a Boolean formula. Then, y.f ( x, y) f ( x, f ( x, 1)) y.f ( x, y) f ( x, f ( x, 0)) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 5 / 14
Self-Substitution Lemma (Self-Substitution) Let f ( x, y) be a Boolean formula. Then, y.f ( x, y) f ( x, f ( x, 1)) y.f ( x, y) f ( x, f ( x, 0)) Self-Substitution provides a novel way to perform Quantifier Elimination. Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 5 / 14
Self-Substitution for Synthesis For a specification f ( x, y) of a single output variable, Self-Substitution directly defines an implementation for y: Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 6 / 14
Self-Substitution for Synthesis For a specification f ( x, y) of a single output variable, Self-Substitution directly defines an implementation for y: y.f ( x, y) f ( x, f ( x, 1)) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 6 / 14
Self-Substitution for Synthesis For a specification f ( x, y) of a single output variable, Self-Substitution directly defines an implementation for y: y.f ( x, y) f ( x, f ( x, 1)) g( x) = f ( x, 1) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 6 / 14
Self-Substitution for Synthesis For a specification f ( x, y) of a single output variable, Self-Substitution directly defines an implementation for y: y.f ( x, y) f ( x, f ( x, 1)) g( x) = f ( x, 1) f ( x, 1) is a default 1 implementation of y. Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 6 / 14
General framework Given a specification f ( x, y), we perform synthesis in two phases: Phase 1: Quantifier elimination Phase 2: Function construction Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 7 / 14
Phase 1: Quantifier Elimination Using Self-Substitution, eliminate each y i in sequence. At each step of this process we obtain: f i ( x, y 1,..., y i ) y i+1... y n.f ( x, y 1,..., y n ) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 8 / 14
Phase 1: Quantifier Elimination Using Self-Substitution, eliminate each y i in sequence. At each step of this process we obtain: f i ( x, y 1,..., y i ) y i+1... y n.f ( x, y 1,..., y n ) In the final step, we have: f 0 ( x) y 1... y n.f ( x, y 1,..., y n ) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 8 / 14
Phase 1: Quantifier Elimination Using Self-Substitution, eliminate each y i in sequence. At each step of this process we obtain: f i ( x, y 1,..., y i ) y i+1... y n.f ( x, y 1,..., y n ) In the final step, we have: f 0 ( x) y 1... y n.f ( x, y 1,..., y n ) f 0 ( x) is exactly the precondition p( x). Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 8 / 14
Phase 2: Function construction For each output y i, use f i ( x, y 1,..., y i ) to construct g i ( x). Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 9 / 14
Phase 2: Function construction For each output y i, use f i ( x, y 1,..., y i ) to construct g i ( x). Base case: f 1 ( x, y 1 ) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 9 / 14
Phase 2: Function construction For each output y i, use f i ( x, y 1,..., y i ) to construct g i ( x). Base case: f 1 ( x, y 1 ) g 1 ( x) = f 1 ( x, 1) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 9 / 14
Phase 2: Function construction For each output y i, use f i ( x, y 1,..., y i ) to construct g i ( x). Base case: f 1 ( x, y 1 ) g 1 ( x) = f 1 ( x, 1) Induction step: f i ( x, y 1,..., y i 1, y i ) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 9 / 14
Phase 2: Function construction For each output y i, use f i ( x, y 1,..., y i ) to construct g i ( x). Base case: f 1 ( x, y 1 ) g 1 ( x) = f 1 ( x, 1) Induction step: f i ( x, y 1,..., y i 1, y i ) g i ( x) = f i ( x, g 1 ( x),..., g i 1 ( x), 1) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 9 / 14
Phase 2: Function construction For each output y i, use f i ( x, y 1,..., y i ) to construct g i ( x). Base case: f 1 ( x, y 1 ) g 1 ( x) = f 1 ( x, 1) Induction step: f i ( x, y 1,..., y i 1, y i ) g i ( x) = f i ( x, g 1 ( x),..., g i 1 ( x), 1) g( x) = (g 1 ( x),..., g n ( x)) is a correct implementation of f ( x, y). Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 9 / 14
Experiments RSynth: implementation of the framework using Binary Decision Diagrams Comparison with MonoSkolem tool based on (Jiang et al., 2009) Evaluation on scalable benchmarks Function Specification Subtraction y = x x y + x = x Maximum y = max( x, x ) ( y x) ( y x ) (( y = x) ( y = x )) Ceiling of Average x + x y = 2 (2 y = x + x ) (2 y + 1 = x + x ) Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 10 / 14
Results 10000 1000 100 T (s) 10 1 Subtraction (RSynth) 0.1 Maximum (RSynth) Ceiling of Average (RSynth) 0.01 Subtraction (MonoSkolem) Maximum (MonoSkolem) Ceiling of Average (MonoSkolem) 0.001 0 200 400 600 800 1000 1200 n Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 11 / 14
Conclusions When problem has an efficient variable ordering, performance scales well even for a large number of variables. RSynth outperforms previous approaches, even using a naive strategy for selecting implementations. Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 12 / 14
Future work Factored representation as a way to control formula size. More elaborate strategies for selecting the implementation for each variable. Alternative representations Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 13 / 14
Thank you! Questions? Lucas M. Tabajara (Rice University) Boolean Functional Synthesis May 9, 2016 14 / 14