我使用Z3 4.5.1成功地使用了字符串和操作,例如子字符串,字符串长度,字符串比较等,如下例所示:
(declare-const s1 String)
(declare-const s2 String)
(declare-const i Int)
(assert (= s1 "97\x00098\x0099###$$"))
(assert (= s2 (str.substr s1 2 (- (str.len s1) 2))))
(assert (= "\x00058\x0099###$$" (str.replace s2 "9" "5")))
(check-sat)
(get-value (s1 s2 i))
但是,当我尝试添加 str.to-int :
时(declare-const s1 String)
(declare-const s2 String)
(declare-const i Int)
(assert (= s1 "97\x00098\x0099###$$"))
(assert (= s2 (str.substr s1 2 (- (str.len s1) 2))))
(assert (= "\x00058\x0099###$$" (str.replace s2 "9" "5")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(assert (= 98 (str.to-int "000098")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(check-sat)
(get-value (s1 s2 i))
我收到此错误:
(error "line 8 column 35: unknown function/constant str.to-int")
我感到困惑,因为" to-int"出现在其他文档中 字符串操作都完美无缺。我使用此文档:Z3str3 Input Language。非常感谢任何帮助,谢谢!!
答案 0 :(得分:2)
Z3已经使用str.to.int和int.to.str一段时间了。此时,字符串的SMTLIB2格式尚未最终确定。