3

I want to construct a regular expression such as a* b* c*, There is a function re.++ in z3 that can concatenate 3 regular expressions together so I can construct a* b* c* as below

(assert (str.in.re "aabbc" (re.++ (re.* (str.to.re "a")) (re.* (str.to.re "b")) (re.* (str.to.re "c")))))
(check-sat)

However, I can't find such concatenation function in z3py API in the website: https://z3prover.github.io/api/html/namespacez3py.html

So my question is how can I concatenate multiple regular expressions using z3py?

Huan Sun
  • 147
  • 6

1 Answers1

4

Use Concat:

>>> from z3 import *
>>> print(Concat(Star(Re("a")), Star(Re("b")), Star(Re("c"))))
re.++(Star(Re("a")), re.++(Star(Re("b")), Star(Re("c"))))
alias
  • 28,120
  • 2
  • 23
  • 40