SAT Modulo Monotonic Theories
Total Page:16
File Type:pdf, Size:1020Kb
SAT Modulo Monotonic Theories by Sam Bayless B. Sc., The University of British Columbia, 2010 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF Doctor of Philosophy in THE FACULTY OF GRADUATE AND POSTDOCTORAL STUDIES (Computer Science) The University of British Columbia (Vancouver) March 2017 c Sam Bayless, 2017 Abstract Satisfiability Modulo Theories (SMT) solvers are a class of efficient constraint solvers which form integral parts of many algorithms. Over the years, dozens of different Satisfiability Modulo Theories solvers have been developed, supporting dozens of different logics. However, there are still many important applications for which specialized SMT solvers have not yet been developed. We develop a framework for easily building efficient SMT solvers for previ- ously unsupported logics. Our techniques apply to a wide class of logics which we call monotonic theories, which include many important elements of graph theory and automata theory. Using this SAT Modulo Monotonic Theories framework, we created a new SMT solver, MONOSAT. We demonstrate that MONOSAT improves the state of the art across a wide body of applications, ranging from circuit layout and data center management to protocol synthesis — and even to video game design. ii Preface The work in this thesis was developed in a collaboration between the Integrated Systems Design Laboratory (ISD) and the Bioinformatics and Empirical & Theo- retical Algorithmics Laboratory (BETA), at the University of British Columbia. This thesis includes elements of several published and unpublished works. In addition to my own contributions, each of these works includes significant contri- butions from my co-authors, as detailed below. Significant parts of the material found in chapters 3, 4, 5, 7, and 6.1 appeared previously at the conference of the Association for the Advancement of Artificial Intelligence, 2015, with co-authors N. Bayless, H. H. Hoos, and A. J. Hu. I was the lead investigator in this work, responsible for the initial concept and its execution, for conducting all experiments, and for writing the manuscript. Significant parts of the material found in Chapter 8 appeared previously at the International Conference on Computer Aided Verification, 2016, with co-authors T. Klenze and A. J. Hu. In this work, Tobias Klenze was the lead investigator; I also made significant contributions throughout, including playing a supporting role in the implementation. I was also responsible for conducting all experiments. Significant parts of Section 6.2 were previously published at the International Conference on ComputerAided Design, 2016, with co-authors H. H. Hoos, and A. J. Hu. In this work, I was the lead investigator, responsible for conducting all experiments, and for writing the manuscript. This work also included assistance and insights from Jacob Bayless. Finally, Section 6.3 is based on unpublished work in collaboration with co- authors N. Kodirov, I. Beschastnikh, H. H. Hoos, and A. J. Hu, in which I was the lead investigator, along with Nodir Kodirov. In this work, I was responsible for the implementation, as well as conducting all experiments and writing the manuscript. iii Table of Contents Abstract . ii Preface . iii Table of Contents . iv List of Tables . viii List of Figures . ix Acknowledgments . xi 1 Introduction . 1 2 Background . 3 2.1 Boolean Satisfiability . 3 2.2 Boolean Satisfiability Solvers . 6 2.2.1 DPLL SAT Solvers . 7 2.2.2 CDCL SAT Solvers . 9 2.3 Many-Sorted First Order Logic & Satisfiability Modulo Theories . 13 2.4 Satisfiability Modulo Theories Solvers . 17 2.5 Related Work . 22 3 SAT Modulo Monotonic Theories . 24 3.1 Monotonic Predicates . 24 3.2 Monotonic Theories . 28 iv 4 A Framework for SAT Modulo Monotonic Theories . 30 4.1 Theory Propagation for Finite Monotonic Theories . 32 4.2 Conflict Analysis for Finite Monotonic Theories . 40 4.3 Compositions of Monotonic Functions . 43 4.4 Monotonic Theories of Partially Ordered Sorts . 48 4.5 Theory Combination and Infinite Domains . 52 5 Monotonic Theory of Graphs . 55 5.1 A Monotonic Graph Solver . 56 5.2 Monotonic Graph Predicates . 59 5.2.1 Graph Reachability . 60 5.2.2 Acyclicity . 65 5.3 Weighted Graphs & Bitvectors . 68 5.3.1 Maximum Flow . 68 5.4 Conclusion . 74 6 Graph Theory Applications . 76 6.1 Procedural Content Generation . 76 6.2 Escape Routing . 85 6.2.1 Multi-Layer Escape Routing in MONOSAT . 87 6.2.2 Evaluation . 90 6.3 Virtual Data Center Allocation . 94 6.3.1 Problem Formulation . 94 6.3.2 Multi-Commodity Flow in MONOSAT . 96 6.3.3 Encoding Multi-Path VDC Allocation . 98 6.3.4 Evaluation . 99 6.4 Conclusion . 107 7 Monotonic Theory of Geometry . 108 7.1 Geometric Predicates of Convex Hulls . 111 7.1.1 Areas of Convex Hulls . 111 7.1.2 Point Containment for Convex Hulls . 112 7.1.3 Line-Segment Intersection for Convex Hulls . 115 7.1.4 Intersection of Convex Hulls . 116 v 7.2 Applications . 118 8 Monotonic Theory of CTL . 122 8.1 Background . 124 8.2 CTL Operators as Monotonic Functions . 127 8.3 Theory Propagation for CTL Model Checking . 130 8.4 Conflict Analysis for the Theory of CTL . 134 8.5 Implementation and Optimizations . 136 8.5.1 Symmetry Breaking . 136 8.5.2 Preprocessing . 137 8.5.3 Wildcard Encoding for Concurrent Programs . 137 8.6 Experimental Results . 139 8.6.1 The Original Clarke-Emerson Mutex . 140 8.6.2 Mutex with Additional Properties . 141 8.6.3 Readers-Writers . 143 9 Conclusions and Future Work . 146 Bibliography . 148 A The MONOSAT Solver . 169 B Monotonic Theory of Bitvectors . 173 C Supporting Materials . 179 C.1 Proof of Lemma 4.1.1 . 179 C.2 Proof of Correctness for Algorithm 7 . 181 C.3 Encoding of Art Gallery Synthesis . 184 D Monotonic Predicates . 187 D.1 Graph Predicates . 187 D.1.1 Reachability . 187 D.1.2 Acyclicity . 188 D.1.3 Connected Components . 189 D.1.4 Shortest Path . 190 vi D.1.5 Maximum Flow . 190 D.1.6 Minimum Spanning Tree Weight . 192 D.2 Geometric Predicates . 193 D.2.1 Area of Convex Hulls . 193 D.2.2 Point Containment for Convex Hulls . 194 D.2.3 Line-Segment Intersection for Convex Hulls . 195 D.2.4 Intersection of Convex Hulls . 196 D.3 Pseudo-Boolean Constraints . 197 D.4 CTL Model Checking . 198 vii List of Tables Table 6.1 Reachability constraints in terrain generation. 79 Table 6.2 Runtime results for shortest paths constraints in Diorama. 80 Table 6.3 Runtime results for connected components constraints in Dio- rama. 81 Table 6.4 Runtime results for maximum flow constraints in Diorama. 82 Table 6.5 Maze generation using minimum spanning tree constraints. 84 Table 6.6 Multi-layer escape routing with blind vias. 92 Table 6.7 Multi-layer escape routing with through-vias. 93 Table 6.8 Data centers with tree topologies. 101 Table 6.9 Data centers with FatTree and BCube Topologies. 103 Table 6.10 Hadoop VDCs allocated on data centers. 106 Table 7.1 Art gallery synthesis results. 120 Table 8.1 Results on the mutual exclusion example. 140 Table 8.2 Results on the mutual exclusion with additional properties . 142 Table 8.3 Results on the readers-writers instances. 144 viii List of Figures Figure 2.1 Example of Tseitin transformation . 5 Figure 2.2 A first order formula and associated Boolean skeleton. 18 Figure 3.1 A finite symbolic graph. 27 Figure 5.1 A finite symbolic graph and satisfying assignment. 56 Figure 5.2 A finite symbolic graph, under assignment. 60 Figure 5.3 Summary of our theory solver implementation of reachability. 61 Figure 5.4 Results on reachability constraints. 64 Figure 5.5 Summary of our theory solver implementation of acyclicity. 65 Figure 5.6 Results on acyclicity constraints. 67 Figure 5.7 Maximum flow predicate example. 69 Figure 5.8 Summary of our theory solver implementation of maximum flow. 71 Figure 5.9 Results on maximum flow constraints. 73 Figure 6.1 Generated terrain . 78 Figure 6.2 Random Mazes . 83 Figure 6.3 An example multi-layer escape routing. 85 Figure 6.4 Multi-layer escape routing with simultaneous via-placement. 87 Figure 6.5 Symbolic nodes and edges. 88 Figure 6.6 Constraints enforcing different via models. 90 Figure 7.1 Convex hull of a symbolic point set. 109 Figure 7.2 Under- and over-approximative convex hulls. 109 Figure 7.3 Point containment for convex hulls . 113 ix Figure 7.4 Line-segment intersection for convex hulls . 114 Figure 7.5 Intersection of convex hulls . 116 Figure 7.6 A separating axis between two convex hulls. 118 Figure 7.7 Art gallery synthesis. 120 Figure 8.1 An example CTL formula and Kripke structure. 123 x Acknowledgments Alan and Holger, for giving me both the freedom and the support that I needed. The students I have collaborated with, including Celina, Mike, Nodir, Tobias, Kuba, and many others who have passed through our lab, for being a continuing source of inspiration. My parents and siblings, for everything else. And the many shelves worth of science fiction that got me through it all.... xi Chapter 1 Introduction Constraint solvers have widespread applications in all areas of computer science, and can be found in products ranging from drafting.