z3 API中的str.suffix未知

时间:2018-05-24 09:27:38

标签: z3 suffix

我试图在以下脚本中使用Z3中的后缀API函数, 但是Z3抱怨它不知道str.suffix。自从我在API中看到它 here我猜它存在但只叫不同(?) 谢谢!

(declare-const s   String)
(declare-const s00 String)
(declare-const s1  String)
(declare-const s2  String)
(declare-const i      Int)

(assert (= s "X2a2@@aDD\x00444ppa800"))

(assert (= s00 (str.substr s 0 (str.indexof s "\x00" 0))))

(assert (str.suffixof s1 s00))
(assert (str.suffixof s2  s1))

(assert (= (str.len s1) (+ (str.len s2) 1)))

(assert (or (and (str.contains s00 "a")
                 (str.contains s1  "a"))
            (not (str.contains s00 "a"))))

(assert (not (str.contains s2 "a")))

(assert (= i (ite (not (str.contains s00 "a")) -1
(- (str.len s00) (str.len s1)))))

(check-sat)
(get-value (s s00 s1 s2 i))

编辑:

脚本根据答案修复。这是z3的输出:

sat
((s "X2a2@@aDD\x00444ppa800")
 (s00 "X2a2@@aDD")
 (s1 "aDD")
 (s2 "DD")
 (i 6))

1 个答案:

答案 0 :(得分:1)

正确的电话是:str.suffixof

(PS。你的文件仍然没有加载,因为它有其他问题;但除了这个问题之外,还没有加载。)