Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Z3 hangs on String formula #2553

Closed
muchang opened this issue Sep 13, 2019 · 0 comments
Closed

Z3 hangs on String formula #2553

muchang opened this issue Sep 13, 2019 · 0 comments

Comments

@muchang
Copy link

muchang commented Sep 13, 2019

Hi,
For this formula:

(declare-fun a () String)
(declare-fun b () String)
(declare-fun c () String)
(assert
 (and
  (=
   (str.at
    (str.substr (str.substr c 1 (- (str.len c) 1)) 0 (- (- (str.len (str.substr c 1 (- (str.len c) 1))) 1) 0))
    (- (str.len (str.substr (str.substr c 1 (- (str.len a ) 1)) 0 (- (- (str.len (str.substr (str.replace a b "") 1 (- (str.len (str.replace a b "")) 1))) 1) 0))) 1))
   "x"
   )
  (not (= (str.at (str.substr (str.substr c 1 (- (str.len a) 1)) 0 (- (- (str.len (str.substr a 1 (- (str.len (str.replace a b "")) 1))) 1) 0)) 0) "y"))
  (not (= (str.at (str.substr (str.substr c 1 (- (str.len c) 1)) 0 (- (str.len (str.substr a 1 (- (str.len a) 1))) 1)) 0) "z"))
  (= (str.at (str.substr a 1 (- (str.len c) 1)) (- (str.len (str.substr c 1 (- (str.len c) 1))) 1)) "w")
  )
 )
(check-sat)     

Z3 latest version will hang on it:

$ timeout -s 9 120 z3 test.smt2
Killed

While z3-4.8.5-stable version will give sat result quickly:

$ time z3-4.8.5-x64-ubuntu-16.04/bin/z3 test.smt2 
sat

real	0m0.049s
user	0m0.038s
sys	0m0.008s

OS: Ubuntu 18.04
Revision: 6384080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant