Solving String Constraints: The Case for Constraint Programming

  • Jun He
  • Pierre Flener
  • Justin Pearson
  • Wei Ming Zhang
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8124)


We improve an existing propagator for the context-free grammar constraint and demonstrate experimentally the practicality of the resulting propagator. The underlying technique could be applied to other existing propagators for this constraint. We argue that constraint programming solvers are more suitable than existing solvers for verification tools that have to solve string constraints, as they have a rich tradition of constraints for membership in formal languages.


Decision Variable Regular Expression Constraint Programming Support Counter String Variable 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Axelsson, R., Heljanko, K., Lange, M.: Analyzing context-free grammars using an incremental SAT solver. In: Aceto, L., Damgård, I., Goldberg, L.A., Halldórsson, M.M., Ingólfsdóttir, A., Walukiewicz, I. (eds.) ICALP 2008, Part II. LNCS, vol. 5126, pp. 410–422. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  2. 2.
    Beldiceanu, N., Carlsson, M., Petit, T.: Deriving filtering algorithms from constraint checkers. In: Wallace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 107–122. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  3. 3.
    Bessière, C.: Arc-consistency and arc-consistency again. Artificial Intelligence 65(1), 179–190 (1994)CrossRefGoogle Scholar
  4. 4.
    Demassey, S., Pesant, G., Rousseau, L.-M.: A cost-regular based hybrid column generation approach. Constraints 11(4), 315–333 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  5. 5.
    Fu, X., Powell, M.C., Bantegui, M., Li, C.-C.: Simple linear string constraints. Formal Aspects of Computing (2012), Published on-line in January 2012 and available from Sushi is available from
  6. 6.
    Ganesh, V., Dill, D.L.: A decision procedure for bit-vectors and arrays. In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 519–531. Springer, Heidelberg (2007), STP is available from CrossRefGoogle Scholar
  7. 7.
    Gange, G., Stuckey, P.J.: Explaining propagators for s-DNNF circuits. In: Beldiceanu, N., Jussien, N., Pinson, É. (eds.) CPAIOR 2012. LNCS, vol. 7298, pp. 195–210. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  8. 8.
    Gecode Team. Gecode: A generic constraint development environment (2006),
  9. 9.
    He, J.: Constraints for Membership in Formal Languages under Systematic Search and Stochastic Local Search. PhD thesis, Uppsala University, Sweden (2013),
  10. 10.
    Hopcroft, J.E., Ullman, J.D.: Introduction to Automata Theory, Languages, and Computation. Addison Wesley, New York (1979)zbMATHGoogle Scholar
  11. 11.
    Kadioğlu, S., Sellmann, M.: Grammar constraints. Constraints 15(1), 117–144 (2008); An early version is published in the Proceedings of the 23rd AAAI Conference on Artificial Intelligence in 2008Google Scholar
  12. 12.
    Katsirelos, G., Narodytska, N., Walsh, T.: Reformulating global grammar constraints. In: van Hoeve, W.-J., Hooker, J.N. (eds.) CPAIOR 2009. LNCS, vol. 5547, pp. 132–147. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  13. 13.
    Katsirelos, G., Narodytska, N., Walsh, T.: The weighted Grammar constraint. Annals of Operations Research 184(1), 179–207 (2011), An early version is published in the Proceedings of the 5th International Conference on Integration of AI and OR Techniques in Constraint Programming for Combinatorial Optimization Problems in 2008MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Kieżun, A., Ganesh, V., Guo, P.J., Hooimeijer, P., Ernst, M.D.: HAMPI: A solver for string constraints. In: Proceedings of the 18th International Symposium on Software Testing and Analysis, Chicago, USA, July 2009, pp. 105–116. ACM Press (2009), Hampi is available from
  15. 15.
    Mohr, R., Henderson, T.C.: Arc and path consistency revisited. Artificial Intelligence 28(2), 225–233 (1986)CrossRefGoogle Scholar
  16. 16.
    Pesant, G.: A regular language membership constraint for finite sequences of variables. In: Wallace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 482–495. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  17. 17.
    Quimper, C.-G., Walsh, T.: Global grammar constraints. In: Benhamou, F. (ed.) CP 2006. LNCS, vol. 4204, pp. 751–755. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  18. 18.
    Quimper, C.-G., Walsh, T.: Decomposing global grammar constraints. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 590–604. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  19. 19.
    Saxena, P., Akhawe, D., Hanna, S., Mao, F., McCamant, S., Song, D.: A symbolic execution framework for javascript. In: Proceedings of the 31st IEEE Symposium on Security and Privacy, California, USA, pp. 513–528. IEEE Press (May 2010), Kaluza is available from
  20. 20.
    Sellmann, M.: The theory of grammar constraints. In: Benhamou, F. (ed.) CP 2006. LNCS, vol. 4204, pp. 530–544. Springer, Heidelberg (2006)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Jun He
    • 1
    • 2
  • Pierre Flener
    • 1
  • Justin Pearson
    • 1
  • Wei Ming Zhang
    • 2
  1. 1.Department of Information TechnologyUppsala UniversityUppsalaSweden
  2. 2.School of Information System and ManagementNational University of Defense TechnologyChangshaChina

Personalised recommendations