Model Counting for Recursively Defined Strings

Minh-Thai Trinh, Duc-Hiep Chu and Joxan Jaffar

Abstract

We present a new algorithm for model counting of a class of string constraints. In addition to the classic operation of concatenation, our class in- cludes some recursively defined operations such as Kleene closure, and replace- ment of substrings. Additionally, our class also includes length constraints on the string expressions, which means, by requiring reasoning about numbers, that we face a multi-sorted logic. In the end, our string constraints are motivated by their use in programming for web applications.

Our algorithm comprises two novel features: the ability to use a technique of (1) partial derivatives for constraints that are already in a solved form, i.e. a form where its (string) satisfiability is clearly displayed, and (2) non-progression, where cyclic reasoning in the reduction process may be terminated (thus allowing for the algorithm to look elsewhere). Finally, we experimentally compare our model counter with two recent works on model counting of similar constraints, SMC [18] and ABC [5], to demonstrate its superior performance.