Advertisement

MiniZinc with Strings

  • Roberto AmadiniEmail author
  • Pierre Flener
  • Justin Pearson
  • Joseph D. Scott
  • Peter J. Stuckey
  • Guido Tack
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10184)

Abstract

Strings are extensively used in modern programming languages and constraints over strings of unknown length occur in a wide range of real-world applications such as software analysis and verification, testing, model checking, and web security. Nevertheless, practically no constraint programming solver natively supports string constraints. We introduce string variables and a suitable set of string constraints as builtin features of the MiniZinc modelling language. Furthermore, we define an interpreter for converting a MiniZinc model with strings into a FlatZinc instance relying only on integer variables. This conversion is obtained via rewrite rules, and does not require any extension of the existing FlatZinc specification. This provides a user-friendly interface for modelling combinatorial problems with strings, and enables both string and non-string solvers to actually solve such problems.

Notes

Acknowledgements

The authors from the University of Melbourne are supported by the Australian Research Council (ARC) through Linkage Project Grant LP140100437. The authors in Sweden are supported by the Swedish Research Council (VR) through Project Grant 2015-04910. Many thanks to Gustav Björdal for having run the experiments on his local-search backend [7] for MiniZinc. Many thanks also to all the referees and to the audience of LOPSTR 2016 for their thoughtful feedback.

References

  1. 1.
    Abdulla, P.A., Atig, M.F., Chen, Y.-F., Holík, L., Rezine, A., Rümmer, P., Stenman, J.: Norn: an SMT solver for string constraints. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 462–469. Springer, Cham (2015). doi: 10.1007/978-3-319-21690-4_29 CrossRefGoogle Scholar
  2. 2.
    Amadini, R., Gabbrielli, M., Mauro, J.: A multicore tool for constraint solving. In: IJCAI, pp. 232–238. AAAI Press (2015)Google Scholar
  3. 3.
    Beldiceanu, N., Carlsson, M., Demassey, S., Petit, T.: Global constraint catalogue: past, present and future. Constraints 12(1), 21–62 (2007). http://sofdem.github.io/gccat/
  4. 4.
    Belov, G., Stuckey, P.J., Tack, G., Wallace, M.: Improved linearization of constraint programming models. In: Rueher, M. (ed.) CP 2016. LNCS, vol. 9892, pp. 49–65. Springer, Cham (2016). doi: 10.1007/978-3-319-44953-1_4 CrossRefGoogle Scholar
  5. 5.
    Bisht, P., Hinrichs, T.L., Skrupsky, N., Venkatakrishnan, V.N.: WAPTEC: whitebox analysis of web applications for parameter tampering exploit construction. In: CCS, pp. 575–586. ACM (2011)Google Scholar
  6. 6.
    Björdal, G.: String variables for constraint-based local search. Master’s thesis, Department of Information Technology, Uppsala University, Sweden, August 2016. http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-301501
  7. 7.
    Björdal, G., Monette, J.-N., Flener, P., Pearson, J.: A constraint-based local search backend for MiniZinc. Constraints 20(3), 325–345 (2015)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Bjørner, N., Tillmann, N., Voronkov, A.: Path feasibility analysis for string-manipulating programs. In: Kowalewski, S., Philippou, A. (eds.) TACAS 2009. LNCS, vol. 5505, pp. 307–321. Springer, Heidelberg (2009). doi: 10.1007/978-3-642-00768-2_27 CrossRefGoogle Scholar
  9. 9.
    Bofill, M., Suy, J., Villaret, M.: A system for solving constraint satisfaction problems with SMT. In: Strichman, O., Szeider, S. (eds.) SAT 2010. LNCS, vol. 6175, pp. 300–305. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-14186-7_25 CrossRefGoogle Scholar
  10. 10.
    Chu, G.: Improving Combinatorial Optimization. Ph.D. thesis, Department of Computing and Information Systems, University of Melbourne, Australia (2011)Google Scholar
  11. 11.
    Costantini, G., Ferrara, P., Cortesi, A.: A suite of abstract domains for static analysis of string values. Softw. Pract. Exp. 45(2), 245–287 (2015)CrossRefGoogle Scholar
  12. 12.
    De Landtsheer, R., Ponsard, C.: OscaR.cbls: an open source framework for constraint-based local search. In: ORBEL-27, the 27th Annual Conference of the Belgian Operational Research Society (2013). http://www.orbel.be/orbel27/pdf/abstract293.pdf; The OscaR.cbls solver https://bitbucket.org/oscarlib/oscar/wiki/CBLS
  13. 13.
    Emmi, M., Majumdar, R., Sen, K.: Dynamic test input generation for database applications. In: ISSTA, pp. 151–162. ACM (2007)Google Scholar
  14. 14.
    Fu, X., Powell, M.C., Bantegui, M., Li, C.: Simple linear string constraints. Formal Aspects Comput. 25(6), 847–891 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Fujiwara, T.: iZplus description (2016). http://www.minizinc.org/challenge2016/description_izplus.txt
  16. 16.
    Ganesh, V., Minnes, M., Solar-Lezama, A., Rinard, M.: Word equations with length constraints: what’s decidable? In: Biere, A., Nahir, A., Vos, T. (eds.) HVC 2012. LNCS, vol. 7857, pp. 209–226. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-39611-3_21 CrossRefGoogle Scholar
  17. 17.
    Gange, G., Navas, J.A., Stuckey, P.J., Søndergaard, H., Schachte, P.: Unbounded model-checking with interpolation for regular language constraints. In: Piterman, N., Smolka, S.A. (eds.) TACAS 2013. LNCS, vol. 7795, pp. 277–291. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-36742-7_20 CrossRefGoogle Scholar
  18. 18.
    Gecode Team. Gecode: generic constraint development environment (2016). http://www.gecode.org
  19. 19.
    Grinchtein, O., Carlsson, M., Pearson, J.: A constraint optimisation model for analysis of telecommunication protocol logs. In: Blanchette, J.C., Kosmatov, N. (eds.) TAP 2015. LNCS, vol. 9154, pp. 137–154. Springer, Cham (2015). doi: 10.1007/978-3-319-21215-9_9 CrossRefGoogle Scholar
  20. 20.
    Gurobi Optimization, Inc., Gurobi Optimizer Reference Manual (2016). http://www.gurobi.com
  21. 21.
    He, J., Flener, P., Pearson, J., Zhang, W.M.: Solving string constraints: the case for constraint programming. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 381–397. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-40627-0_31 CrossRefGoogle Scholar
  22. 22.
    Hooimeijer, P., Weimer, W.: StrSolve: solving string constraints lazily. Autom. Softw. Eng. 19(4), 531–559 (2012)CrossRefGoogle Scholar
  23. 23.
    Kiezun, A., Ganesh, V., Artzi, S., Guo, P.J., Hooimeijer, P., Ernst, M.D.: HAMPI: a solver for word equations over strings, regular expressions, and context-free grammars. ACM Trans. Softw. Eng. Methodol. 21(4), 25 (2012)CrossRefGoogle Scholar
  24. 24.
    Kieżun, A., Ganesh, V., Guo, P.J., Hooimeijer, P., Ernst, M.D.: HAMPI: a solver for string constraints. In: ISSTA 2009, pp. 105–116. ACM (2009)Google Scholar
  25. 25.
    Kim, S.-W., Chin, W., Park, J., Kim, J., Ryu, S.: Inferring grammatical summaries of string values. In: Garrigue, J. (ed.) APLAS 2014. LNCS, vol. 8858, pp. 372–391. Springer, Cham (2014). doi: 10.1007/978-3-319-12736-1_20 Google Scholar
  26. 26.
    Li, G., Ghosh, I.: PASS: string solving with parameterized array and interval automaton. In: Bertacco, V., Legay, A. (eds.) HVC 2013. LNCS, vol. 8244, pp. 15–31. Springer, Cham (2013). doi: 10.1007/978-3-319-03077-7_2 CrossRefGoogle Scholar
  27. 27.
    Liang, T., Reynolds, A., Tinelli, C., Barrett, C., Deters, M.: A DPLL(T) theory solver for a theory of strings and regular expressions. In: Biere, A., Bloem, R. (eds.) CAV 2014. LNCS, vol. 8559, pp. 646–662. Springer, Cham (2014). doi: 10.1007/978-3-319-08867-9_43 Google Scholar
  28. 28.
    Madsen, M., Andreasen, E.: String analysis for dynamic field access. In: Cohen, A. (ed.) CC 2014. LNCS, vol. 8409, pp. 197–217. Springer, Heidelberg (2014). doi: 10.1007/978-3-642-54807-9_12 CrossRefGoogle Scholar
  29. 29.
    Michel, L.D., Van Hentenryck, P.: Constraint satisfaction over bit-vectors. In: Milano, M. (ed.) CP 2012. LNCS, pp. 527–543. Springer, Heidelberg (2012). doi: 10.1007/978-3-642-33558-7_39
  30. 30.
    Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc: towards a standard CP modelling language. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 529–543. Springer, Heidelberg (2007). doi: 10.1007/978-3-540-74970-7_38 CrossRefGoogle Scholar
  31. 31.
    Ohrimenko, O., Stuckey, P.J., Codish, M.: Propagation via lazy clause generation. Constraints 14(3), 357–391 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  32. 32.
    Saxena, P., Akhawe, D., Hanna, S., Mao, F., McCamant, S., Song, D.: A symbolic execution framework for JavaScript. In: S&P, pp. 513–528. IEEE Computer Society (2010)Google Scholar
  33. 33.
    Scott, J.D.: Other Things Besides Number: Abstraction, Constraint Propagation, and String Variable Types. Ph.D. thesis, Department of Information Technology, Uppsala University, Sweden (2016). http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-273311
  34. 34.
    Scott, J.D., Flener, P., Pearson, J.: Bounded strings for constraint programming. In: ICTAI, pp. 1036–1043. IEEE Computer Society (2013)Google Scholar
  35. 35.
    Scott, J.D., Flener, P., Pearson, J.: Constraint solving on bounded string variables. In: Michel, L. (ed.) CPAIOR 2015. LNCS, vol. 9075, pp. 375–392. Springer, Cham (2015). doi: 10.1007/978-3-319-18008-3_26 Google Scholar
  36. 36.
    Scott, J.D., Flener, P., Pearson, J., Schulte, C.: Design and implementation of bounded-length sequence variables. In: Salvagnin, D., Lombardi, M. (eds.) CPAIOR 2017. LNCS, vol. 10335, pp. 51–67. Springer, Cham (2017). doi: 10.1007/978-3-319-59776-8_5 CrossRefGoogle Scholar
  37. 37.
    Stuckey, P.J., Tack, G.: MiniZinc with functions. In: Gomes, C., Sellmann, M. (eds.) CPAIOR 2013. LNCS, vol. 7874, pp. 268–283. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-38171-3_18 CrossRefGoogle Scholar
  38. 38.
    Subramanian, S., Berzish, M., Zheng, Y., Tripp, O., Ganesh, V.: A solver for a theory of strings and bit-vectors. CoRR, abs/1605.09446 (2016)Google Scholar
  39. 39.
    Trinh, M., Chu, D., Jaffar, J.: S3: a symbolic string solver for vulnerability detection in web applications. In: SIGSAC, pp. 1232–1243. ACM (2014)Google Scholar
  40. 40.
    Yu, F., Alkhalaf, M., Bultan, T.: Stranger: an automata-based string analysis tool for PHP. In: Esparza, J., Majumdar, R. (eds.) TACAS 2010. LNCS, vol. 6015, pp. 154–157. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-12002-2_13 CrossRefGoogle Scholar
  41. 41.
    Zheng, Y., Ganesh, V., Subramanian, S., Tripp, O., Dolby, J., Zhang, X.: Effective search-space pruning for solvers of string equations, regular expressions and length constraints. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 235–254. Springer, Cham (2015). doi: 10.1007/978-3-319-21690-4_14 CrossRefGoogle Scholar
  42. 42.
    Zheng, Y., Zhang, X., Ganesh, V.: Z3-str: a Z3-based string solver for web application analysis. In: SIGSOFT, pp. 114–124. ACM (2013)Google Scholar
  43. 43.
    Zhou, N.-F., Kjellerstrand, H.: The Picat-SAT compiler. In: Gavanelli, M., Reppy, J. (eds.) PADL 2016. LNCS, vol. 9585, pp. 48–62. Springer, Cham (2016). doi: 10.1007/978-3-319-28228-2_4 CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  • Roberto Amadini
    • 1
    Email author
  • Pierre Flener
    • 2
  • Justin Pearson
    • 2
  • Joseph D. Scott
    • 2
  • Peter J. Stuckey
    • 1
  • Guido Tack
    • 3
  1. 1.University of MelbourneMelbourneAustralia
  2. 2.Uppsala UniversityUppsalaSweden
  3. 3.Monash UniversityMelbourneAustralia

Personalised recommendations