Skip to main content

Propagating Regular Membership with Dashed Strings

  • Conference paper
  • First Online:
Principles and Practice of Constraint Programming (CP 2018)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 11008))

Abstract

Using dashed strings is an approach recently introduced in Constraint Programming (CP) to represent the domain of string variables, when solving combinatorial problems with string constraints. One of the most important string constraints is that of regular membership: \(\textsc {regular} (x, R)\) imposes string x to be a member of the regular language defined by automaton R. The regular constraint is useful for specifying complex constraints on fixed length finite sequences, and regularly appears in CP models. Dealing with regular is also desirable in software testing and verification, because regular expressions are often used in modern programming languages for pattern matching. In this paper, we define a regular propagator for dashed string solvers. We show that this propagator, implemented in the G-Strings solver, is substantially better than the current state-of-the-art. We also demonstrate that many regular constraints appearing in string solving benchmarks can actually be tackled by dashed strings solvers without explicitly using regular.

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 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.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.

    Note that \(maxl(R) \ne \max \{ |w| ~|~ w \in L(R), |w| \le \lambda \}\), which is less easy to compute. If \(maxl(R) > \lambda \), we set \(maxl(R) = \lambda \): this is a correct but not optimal upper bound.

  2. 2.

    Note this is different from the iterated concatenation of strings. For example, encoding with is unsound because this actually encodes the constraint (e.g., ).

  3. 3.

    We used Z3str3 4.6.2 and CVC4 1.5. The source code of the experiments is publicly available at: https://bitbucket.org/robama/exp_cp_2018.

  4. 4.

    Precisely, this is the instance 489 of the HammingDistance class. G-Decomp with \(\lambda = 500\) takes 454.6 s to detect the unsatisfiability. Clearly, we can only prove that there is no solution where all string variables x have length \(|x| \le \lambda \).

References

  1. Abdulla, P.A., Atig, M.F., Chen, Y., Diep, B.P., Holík, L., Rezine, A., Rümmer, P.: Flatten and conquer: a framework for efficient analysis of string constraints. In: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation PLDI 2017, pp. 602–617, Barcelona, Spain, 18–23 June 2017 (2017)

    Google Scholar 

  2. 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). https://doi.org/10.1007/978-3-319-21690-4_29

    Chapter  Google Scholar 

  3. Amadini, R., Flener, P., Pearson, J., Scott, J.D., Stuckey, P.J., Tack, G.: MiniZinc with Strings. In: Logic-Based Program Synthesis and Transformation - 25th International Symposium LOPSTR 2016 (2016). https://arxiv.org/abs/1608.03650

  4. Amadini, R., Gange, G., Stuckey, P.J.: Propagating lex, find and replace with dashed strings. In: van Hoeve, W.-J. (ed.) CPAIOR 2018. LNCS, vol. 10848, pp. 18–34. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-93031-2_2

    Chapter  MATH  Google Scholar 

  5. Amadini, R., Gange, G., Stuckey, P.J.: Sweep-based propagation for string cosntraint solving. In: To appear in AAAI 2018 (2018)

    Google Scholar 

  6. Amadini, R., Gange, G., Stuckey, P.J., Tack, G.: A novel approach to string constraint solving. In: Beck, J.C. (ed.) CP 2017. LNCS, vol. 10416, pp. 3–20. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66158-2_1

    Chapter  Google Scholar 

  7. Barták, R.: Modelling resource transitions in constraint-based scheduling. In: Grosky, W.I., Plášil, F. (eds.) SOFSEM 2002. LNCS, vol. 2540, pp. 186–194. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-36137-5_13

    Chapter  Google Scholar 

  8. 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/

    Article  MathSciNet  Google Scholar 

  9. Berzish, M., Zheng, Y., Ganesh, V.: Z3str3: A string solver with theory-aware branching. CoRR abs/1704.07935 (2017). http://arxiv.org/abs/1704.07935

  10. Cheng, K.C.K., Yap, R.H.C.: Maintaining generalized arc consistency on Ad Hoc r-ary constraints. In: Stuckey, P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 509–523. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-85958-1_34

    Chapter  Google Scholar 

  11. Gecode Team: Gecode: Generic constraint development environment (2016). http://www.gecode.org

  12. Holík, L., Janku, P., Lin, A.W., Rümmer, P., Vojnar, T.: String constraints with concatenation and transducers solved efficiently. PACMPL 2(POPL), 4:1–4:32 (2018)

    Article  Google Scholar 

  13. IBM: Security AppScan (2018). https://www.ibm.com/security/application-security/appscan

  14. 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). https://doi.org/10.1007/978-3-319-08867-9_43

    Chapter  Google Scholar 

  15. Martens, W., Niewerth, M., Schwentick, T.: Schema design for XML repositories: complexity and tractability. In: Paredaens, J., Gucht, D.V. (eds.) Proceedings of the Twenty-Ninth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2010, Indianapolis, Indiana, USA, pp. 239–250. ACM, 6–11 June 2010 (2010)

    Google Scholar 

  16. Perez, G., Régin, J.-C.: Improving GAC-4 for table and MDD constraints. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 606–621. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-10428-7_44

    Chapter  Google Scholar 

  17. 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). https://doi.org/10.1007/978-3-540-30201-8_36

    Chapter  MATH  Google Scholar 

  18. 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). https://doi.org/10.1007/978-3-319-59776-8_5

    Chapter  MATH  Google Scholar 

  19. Tateishi, T., Pistoia, M., Tripp, O.: Path- and index-sensitive string analysis based on monadic second-order logic. ACM Trans. Softw. Eng. Methodol. 22(4), 33 (2013)

    Article  Google Scholar 

  20. Thomé, J., Shar, L.K., Bianculli, D., Briand, L.C.: Search-driven string constraint solving for vulnerability detection. In: Proceedings of the 39th International Conference on Software Engineering ICSE 2017, Buenos Aires, Argentina, pp. 198–208, 20–28 May 2017 (2017)

    Google Scholar 

  21. 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 

  22. 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). https://doi.org/10.1007/978-3-642-12002-2_13

    Chapter  Google Scholar 

Download references

Acknowledgments

This work is supported by the Australian Research Council (ARC) through Linkage Project Grant LP140100437 and Discovery Early Career Researcher Award DE160100568.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Roberto Amadini .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Amadini, R., Gange, G., Stuckey, P.J. (2018). Propagating Regular Membership with Dashed Strings. In: Hooker, J. (eds) Principles and Practice of Constraint Programming. CP 2018. Lecture Notes in Computer Science(), vol 11008. Springer, Cham. https://doi.org/10.1007/978-3-319-98334-9_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-98334-9_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-98333-2

  • Online ISBN: 978-3-319-98334-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics