Skip to main content

The Boolean Constraint Solver of SWI-Prolog (System Description)

  • Conference paper
  • First Online:
Functional and Logic Programming (FLOPS 2016)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9613))

Included in the following conference series:

Abstract

We present a new constraint solver over Boolean variables, available as library(clpb) (documentation: http://eu.swi-prolog.org/man/clpb.html) in SWI-Prolog. Our solver distinguishes itself from other available CLP(\(\mathcal {B}\)) solvers by several unique features: First, it is written entirely in Prolog and is hence portable to different Prolog implementations. Second, it is the first freely available BDD-based CLP(\(\mathcal {B}\)) solver. Third, we show that new interface predicates allow us to solve new types of problems with CLP(\(\mathcal {B}\)) constraints. We also use our implementation experience to contrast features and state necessary requirements of attributed variable interfaces to optimally support CLP(\(\mathcal {B}\)) constraints in different Prolog systems. Finally, we also present some performance results and comparisons with SICStus Prolog.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The documentation of SICStus Prolog 4.3.2 contains the exact wording of current support terms of the clpb module that ships with the system: “The library module is a direct port from SICStus Prolog 3. It is not supported by SICS in any way.”.

  2. 2.

    Source: http://www.cs.otago.ac.nz/staffpriv/ok/COSC410/robdd.pl.

  3. 3.

    A Prolog DCG primer is available at http://www.metalevel.at/dcg.html.

  4. 4.

    See http://projecteuler.net for more information.

  5. 5.

    The code of all benchmarks is available at http://www.metalevel.at/clpb-bench.

  6. 6.

    The variant is freely available at http://www.metalevel.at/clpb-zdd.

References

  1. Benhamou, F., Touraïvane, T.: Prolog IV: langage et algorithmes. In: JFPLC, pp. 51–64 (1995)

    Google Scholar 

  2. Bryant, R.E.: Graph-based algorithms for boolean function manipulation. IEEE Trans. Comput. 35(8), 677–691 (1986)

    Article  MATH  Google Scholar 

  3. Burckel, S., Hoarau, S., Mesnard, F., Neumerkel, U.: cTI: Bottom-up termination inference for logic programs. In: 15. WLP, pp. 123–134 (2000)

    Google Scholar 

  4. Carlsson, M.: Boolean Constraints in SICStus Prolog. SICS TR, T91, 09 (1991)

    Google Scholar 

  5. Codognet, P., Diaz, D.: A simple and efficient boolean solver for constraint logic programming. J. Autom. Reason. 17(1), 97–129 (1996)

    MathSciNet  MATH  Google Scholar 

  6. Colin, S., Mesnard, F., Rauzy, A.: Un module Prolog de mu-calcul booléen: une réalisation par BDD. In: JFPLC 1999, Huitièmes Journées Francophones de Programmation Logique et Programmation par Contraintes, pp. 23–38 (1999)

    Google Scholar 

  7. Demoen, B.: Dynamic attributes, their hProlog implementation, and a first evaluation. Report CW 350, Department of Computer Science, K.U. Leuven, October 2002

    Google Scholar 

  8. Diaz, D., Abreu, S., Codognet, P.: On the implementation of GNU Prolog. TPLP 12(1–2), 253–282 (2012)

    MathSciNet  MATH  Google Scholar 

  9. Dincbas, M., Hentenryck, P.V., Simonis, H., Aggoun, A., Graf, T., Berthier, F.: The constraint logic programming language CHIP. In: FGCS, pp. 693–702 (1988)

    Google Scholar 

  10. Hooker, J.N.: Projection, consistency, and George Boole. Constraints 21(1), 59–76 (2016). http://dx.doi.org/10.1007/s10601-015-9201-2

    Google Scholar 

  11. Jaffar, J., Lassez, J.L.: Constraint logic programming. In: POPL, pp.111–119 (1987)

    Google Scholar 

  12. Knuth, D.E.: The Art of Computer Programming, Volume 4, Fascicle 1: Bitwise Tricks & Techniques; Binary Decision Diagrams, 12th edn. Addison-Wesley Professional, Reading, Massachusetts (2009)

    Google Scholar 

  13. Mantadelis, T., Rocha, R., Kimmig, A., Janssens, G.: Preprocessing boolean formulae for BDDs in a probabilistic context. In: Janhunen, T., Niemelä, I. (eds.) JELIA 2010. LNCS, vol. 6341, pp. 260–272. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  14. Marques-Silva, J.: Algebraic Simplification Techniques for Propositional Satisfiability. In: Dechter, R. (ed.) CP 2000. LNCS, vol. 1894, p. 537. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  15. Minato, S.: Zero-suppressed BDDs for set manipulation in combinatorial problems. In: Design Automation Conference (DAC), pp. 272–277 (1993)

    Google Scholar 

  16. Neumerkel, U.: Teaching Prolog and CLP (tutorial). In: ICLP (1997)

    Google Scholar 

  17. Neumerkel, U., Kral, S.: Declarative program development in Prolog with GUPU. In: Proceedings of the 12th International Workshop on Logic Programming Environments, WLPE, pp. 77–86 (2002)

    Google Scholar 

  18. Selman, B., Kautz, H., Cohen, B.: Local search strategies for satisfiability testing. In: Second DIMACS Implementation Challenge (1993)

    Google Scholar 

  19. Tarau, P.: Pairing functions, boolean evaluation and binary decision diagrams. CoRR abs/0808.0555 (2008). arxiv.org/abs/0808.0555

  20. Tarau, P., Luderman, B.: Boolean evaluation with a pairing and unpairing function. In: SYNASC 2012, pp. 384–390 (2012)

    Google Scholar 

  21. Wielemaker, J., Schrijvers, T., Triska, M., Lager, T.: SWI-Prolog. TPLP 12(1–2), 67–96 (2012)

    MathSciNet  MATH  Google Scholar 

  22. Zhang, H.: SATO: an efficient propositional prover. In: McCune, W. (ed.) CADE 1997. LNCS, vol. 1249. Springer, Heidelberg (1997)

    Google Scholar 

Download references

Acknowledgments

First and foremost, I thank Ulrich Neumerkel for introducing me to constraint logic programming and to testing constraint solvers. For their encouragement about CLP(\(\mathcal {B}\)), I thank Nysret Musliu and Fred Mesnard. My gratitude also goes to Jan Wielemaker for providing a robust and free Prolog system, for his fast reaction times and much appreciated support when discussing and implementing new features. I thank Mats Carlsson for the visionary CLP(\(\mathcal {B}\)) solver of SICStus Prolog and sending me a complimentary version of his system. For their supremely well-written documents about BDDs, I thank Donald Knuth and Henrik Reif Andersen. These books and papers further increased my interest in the subject and were very useful during development. I also thank the anonymous reviewers for their helpful comments.

With all my heart, I thank my partner Barbara for her love.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Markus Triska .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing Switzerland

About this paper

Cite this paper

Triska, M. (2016). The Boolean Constraint Solver of SWI-Prolog (System Description). In: Kiselyov, O., King, A. (eds) Functional and Logic Programming. FLOPS 2016. Lecture Notes in Computer Science(), vol 9613. Springer, Cham. https://doi.org/10.1007/978-3-319-29604-3_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-29604-3_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-29603-6

  • Online ISBN: 978-3-319-29604-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics