str.suffix 在 z3 API 中是未知的
str.suffix in z3 API is unknown
我正在尝试在以下脚本中使用 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))
正确的叫法是:str.suffixof
(PS。即使进行了该修复,您的文件仍然无法加载,因为它还有其他问题;但这不是这个问题的重点。)
我正在尝试在以下脚本中使用 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))
正确的叫法是:str.suffixof
(PS。即使进行了该修复,您的文件仍然无法加载,因为它还有其他问题;但这不是这个问题的重点。)