Boolean Satisfiability with Transitivity Constraints
Total Page:16
File Type:pdf, Size:1020Kb
Boolean Satisfiability with Transitivity Constraints RANDAL E. BRYANT MIROSLAV N. VELEV Carnegie Mellon University ¢¡¤£¦¥¨§ © ¡¦¨ §¥ ¡¥ ¥¨!¡"§#© $ ©&%'( ! *),+ ¥¨( !¡¦-/. ¡¦ ¡© 0 ( ©¡12¢¥3 ¡¤+ ¥¨+'¥¨© ¥¨§4! ¨ ( !¡¦©+ +'¡" § 5# §67¥¨ -0 !,8 ¡¦§ £¦¥ ¡,:©&);-<-<¡1 £¨=' § © >¡¨=3( §4&)6 ¡¦!$ ¥¨§?¥">¡¦A@B¡¦!¡1C ©9$ -<¡¦§©EDGF£9H¥I ¡¦© ¡KJ&LEM N¨OQP7R¨S'N¨MT ( !¡¦©"=VUEWYX Z =T[¥¨A\^]`_badce]f@6=g¡1h + ¡¦©© ¡¦©b. ¡1 ;¡"¥¨G§;¥G ;¡ ¡¦!$ ¥¨§< ¥¨! ©('¡1*.i¡¦¡¦§:¡¦!¡¦-<¡¦§©_j§ Ac4Dk;¡ © l^ ©m ¥¡¦ ;¡"% § K© $ ©&7) § 5A© © 5¨§ -<¡¦§m ¥A8 © $ X qr qEX s¤t X s>u 4$!© ¥©9$ ©% ¡"©n!!49§ © *)<£¦¥¨§ ©& §©n¥E>¡¦I ¡G ¡¦!$ ¥¨§4!'¨ (;!¡"©o[¡¨D 5 D=;Up U Up = ¥¨ ¥¤+ ¥E>¡i4$§ ¥¤©0 £9<©© 5¨§ -<¡¦§>j¡¦h ©©EDmv¥¨! ; § 5G ©j©9$ ©%'(; ! *)w+ ¥¨( !¡¦-x © ;¡%4§ !4§ ^-<¥¨©& y<£¦0 ! ©¡¦+6 §#¥¨0 G ;¡"£¦ © ¥¨§#+ ¥£¦¡¦ 0 ¡A[¥¨<!¥¨5¨ £¥I¡¦z04! *)e. 60 § §> ¡¦ +; ¡1 ¡¦ #70 § £1 ¥¨§ ©EDkn © + ¥ £¦¡¦ 0 ¡G[¥¨-<© ¡£¦¥¨ ¡¤¥¥¨0;n¥¥¨!V[¥¨>¡¦ {) § 5^+ +'¡¦! § ¡¦ :-< £¦¥¨+ ¥£¦¡"©© ¥¨©ED k3¥,0 ©¡A,£¦¥¨§>>¡¦§ ¥¨§4!m¥ ¥¨!¡"§6©9$ ©%4( ! *)#£9;¡"£ l¨¡""='.i¡w0;5¨-<¡"§>b ¡A© ¡1G¥m£¦!0 © ¡¦©¡¦h + ¡"©© § 5 8 . |£¦!0 © ¡¦©,¡1h;+ ¡¦© © §;5? ¡# § © *)|£"¥¨§;©9 §> ©"D} ¢¡6£¦¥¨§ © ¡¦,-<¡1 ;¥ ©^¥~¡¦ 0 £¦¡# ;¡ ©9$ §0 -w('¡¦n¥© 0 £9:£¦!0 © ¡¦©(4© ¡¦ #¥¨§K ¡¤©+4 ©¡¤© 0 £10 ¡¤¥ ¡¤ ¡¦!$ ¥¨§4!g ( !¡¦©ED u k3¥0 ©¡¤b ¡¦ ¡¦ < §4&)<b¡¦£¦ © ¥¨§,b 5¨ -<©oQGiGb© =>.i¡© ¥".4$i7¥¨I©¥¨-<¡©¡1 ©2j=> ¡GGiG ¡¦+ ¡¦© ¡¦§ $ ¥¨§w¥ ¡I9§ © *)¤£¦¥¨§ ©& §©m ©3¡¦h +'¥¨§ ¡¦§ ! © "¡j[¥¨!!>+'¥¨© © ( !¡m ( !¡m¥¨ ¡¦ § 5¨©ED I)?£"¥¨§;© ¡¦ §;56¥¨§ ! )? ¥¨©¡:¡"!$ ¥¨§4! ( !¡¦© 4$w¥ £¦£¦0 ^ §¢ ;¡#GiG ¡¦+ ¡"©¡¦§ $ ¥¨§¥b8 = ©9$ ¥¨0 ,¡1h;+'¡¦ -<¡¦§> ©,© ¥E. 4$K.i¡#£"§}¡" ! )|£¦¥¨§ © 0 £1e§Gib¡"+; ¡¦© ¡¦§>9$ ¥¨§¥¤ ¡6 ¡¦!¡1¨§> 9§ © *)K£"¥¨§;©9 §> ©b§ : 0;©©¥¨! >¡G ¡¤£¦¥¨§ ©& § ¡¦ #©9$ ©%4( ! *)K+ ¥¨( !¡¦-#D Categories and Subject Descriptors: F.4.1 [Mathematical Logic and Formal Languages]: Mathematical Logic— Mechanical theorem proving ¡¦§ ¡¦9!Vk3¡¦-<©Eb!5¨¥¨ ;-<©E=>I¡¦ %4£"$ ¥¨§ b ; ¥¨§ !nG¡¦)¢ ¢¥¨ ©§ m 9©¡¦©E^4¥¨-,!m>¡¦ % £E$ ¥¨§g=I¥ ¥¨!¡"§© $ ©&%'( ! *)>=mb¡¦£¦ © ¥¨§+ ¥ £¦¡1C 0 ¡¦© 1. INTRODUCTION Consider the following variant of the Boolean satisfiability problem. We are given a Boolean formula sat over a set of variables . A subset symbolically encodes a reflexive, symmetric, and transitive binary relation over elements. Each of these rela- :¡ f¢ tional variables, 4& , where , expresses whether or not the relation holds between elements and . Typically, will be “sparse,” containing much fewer than the ª ¤£¥¤ ¦E§'¨ ~© possible variables. Note that when & for some value of and of , this does not imply that the relation does not hold between elements and . It simply indicates This research was supported by the Semiconductor Research Corporation, Contract 00-DC-068. Authors’ addresses: R. E. Bryant, Computer Science Department, Carnegie Mellon University, Pittsburgh, PA 15213; M. N. Velev, Electrical and Computer Engineering Department, Carnegie Mellon University, Pitts- burgh, PA 15213. Permission to make digital/hard copy of all or part of this material without fee for personal or classroom use provided that the copies are not made or distributed for profit or commercial advantage, the ACM copyright/server notice, the title of the publication, and its date appear, and notice is given that copying is by permission of the ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists requires prior specific permission and/or a fee. « c 2001 ACM 1529-3785/2001/0700-0001 $5.00 ACM Transactions on Computational Logic, Vol. V, No. N, August 2001, Pages 1–22. 2 R. E. Bryant and M. N. Velev that sat does not directly depend on the relation between elements and . A transitivity constraint is a formula of the form ¡ ¡ ¡ ¡ £¢ ¥¤§¦©¨ ¥¤> ¥ §¦©¨ ¨ ¥ ¦ ¢ ¥¦ ¢ (1) ¡ & d $ ! £Yb¦ ¦ where & equals when and equals when . Let denote the set of all transitivity constraints that can be formed from the relational variables. Our E&%('*)!+-, task is to find an assignment "$# that satisfies sat, as well as every constraint T£Y¦ in ! . Goel et al. [1998] have shown this problem is NP-hard, even when sat is given as an Ordered Binary Decision Diagram (OBDD) [Bryant 1986]. Normally, Boolean satisfiability is trivial given an OBDD representation of a formula. We are motivated to solve this problem as part of a tool for verifying pipelined micro- processors [Velev and Bryant 1999]. This tool proves that the microprocessor has behavior equivalent to that of an unpipelined, reference implementation for all possible instruction sequences. The operations of the datapaths in both processor models are abstracted as a set of uninterpreted functions and uninterpreted predicates operating on symbolic data. The verifier uses the symbolic flushing technique developed by Burch and Dill [1994]. The ma- jor computational task is to decide the validity of a formula ver in a logic of equality with uninterpreted functions [Bryant et al. 1999; Bryant and Velev 2001]. Our decision proce- dure transforms ver first by replacing all function application terms with terms over a set T/{f 0, of domain variables ' . Similarly, all predicate applications are replaced by formulas over a set of newly-generated propositional variables. The result is a formula 21 . 435.; ver containing equations of the form , where . Each of these equations is then encoded by introducing a relational variable & , similar to the method proposed by Goel et al. [1998]. The result of the translation is a propositional formula 6 1 £ ¦ 87:9 ver expressing the verification condition over both the relational variables and the 6 1 ; <7=9b£&1 ¦ propositional variables appearing in ver. Let sat denote ver , the complement of the formula expressing the translated verification condition. To capture the transitivity .T>3?.; .;@3 .BA .'©3?.BA of equality, e.g., that ¨ , we have transitivity constraints of the ¡ ¡ ¡ ¦¨ E AC¦D & AC¦ form Y . Finding a satisfying assignment to sat that also satisfies the transitivity constraints will give us a counterexample to the original verification condition ver. On the other hand, if we can prove that there are no such assignments, then we have proved that ver is universally valid. We consider three methods to generate a Boolean formula trans that encodes the tran- sitivity constraints. The direct method enumerates the set of chord-free cycles in the undi- ª + V¦ '& rected graph having an edge £Y for each relational variable . This method avoids introducing additional relational variables but can lead to a formula of exponential size. The dense method uses relational variables Y for all possible values of and such that x . We can then axiomatize transitivity by forming constraints ¡ ¡ ¡ F ¦8¨ $ AC¦E & AC¦ of the form & for all distinct values of , , and . This will yield a formula that is cubic in . The sparse method augments with additional relational vari- HG ables to form a set of variables , such that the resulting graph is chordal [Rose 1970]. ¡ ¡ ¡ ¦I¨ E A¦E & AC¦ We then only require transitivity constraints of the form Y such that ª ¡ ¡ ¡ +E +E G ¦ E AC¦ & AC¦ Y . The sparse method will generate a formula no larger than the dense method, and often it does much better. To use a conventional Boolean Satisfiability (SAT) procedure to solve our constrained satisfiability problem, we run the checker over a set of clauses encoding both sat and trans. A version of the FGRASP SAT checker [Marques-Silva 1999] was able to com- ACM Transactions on Computational Logic, Vol. V, No. N, August 2001. Boolean Satisfiability with Transitivity Constraints 3 Table I. Microprocessor Verification Benchmarks. Benchmarks with suffix “t” were modified to require enforcing transitivity. Circuit Domain Propositional Equations Variables Variables 1 DLX-C 13 42 27 1 DLX-C-t 13 42 37 2 DLX-CA 25 58 118 2 DLX-CA-t 25 58 137 2 DLX-CC 25 70 124 2 DLX-CC-t 25 70 143 100 Buggy min. 22 56 89 2 DLX-CC avg. 25 69 124 max. 25 77 132 plete all of our benchmarks, although the run times increase significantly when transitivity constraints are enforced. When using Ordered Binary Decision Diagrams to evaluate satisfiability, we could gen- erate OBDD representations of sat and trans and use the APPLY algorithm [Bryant 1986] to compute an OBDD representation of their conjunction. From this OBDD, finding satis- fying solutions would be trivial. We show that this approach will not be feasible in general, because the OBDD representation of trans can be intractable. That is, for some sets of relational variables, the OBDD representation of the transitivity constraint formula trans will be of exponential size regardless of the variable ordering. The NP-completeness re- sult of Goel, et al. shows that the OBDD representation of trans may be of exponential size using the ordering previously selected for representing sat as an OBDD. This leaves open the possibility that there could be some other variable ordering that would yield ef- ficient OBDD representations of both sat and trans. Our result shows that transitivity constraints can be intrinsically intractable to represent with OBDDs, independent of the structure of sat. We present experimental results on the complexity of constructing OBDDs for the tran- sitivity constraints that arise in actual microprocessor verification. Our results show that the OBDDs can indeed be quite large. We consider two techniques to avoid constructing the OBDD representation of all transitivity constraints. The first of these, proposed by Goel et al. [1998], generates implicants