Z3 字符串:找到 API
Z3 Strings: finding the API
[1] 我已经从这个 GitHub 存储库下载并安装了 Z3 4.5.0:
https://github.com/Z3Prover/z3
[2] 接下来,我 运行 这个命令:
./build/z3 smt.string_solver=z3str3 -smt2 example.txt
[3] 其中 example.txt 是:
(declare-const s1 String)
(declare-const s2 String)
(declare-const s3 String)
(declare-const s4 String)
(assert (= (str.len s1) 1))
(assert (= (str.len s2) 2))
(assert (> (str.len s4) 4))
(assert (= (str.++ s1 s2) s3))
(assert (str.contains s4 s3))
(check-sat)
(get-value (s1 s2 s3 s4))
[4] 我得到了我所期望的:
sat
((s1 "d")
(s2 "af")
(s3 "daf")
(s4 "bdafaaaI"))
[5] 但是,我找不到对应的 API Z3 字符串函数,
所以我可以从我的 C++ 应用程序中逐步构建公式。
我希望是这样的:
z3_mk_concat(...)
z3_mk_str_contains(...)
etc.
但我找不到任何接近...
非常感谢任何帮助,谢谢!
字符串是一项相当新的功能,随着我们从当前方法中吸取教训,它正在得到改进。使用最新的每晚构建会更好。 C++ API 包含对字符串操作的支持。
[1] 我已经从这个 GitHub 存储库下载并安装了 Z3 4.5.0:
https://github.com/Z3Prover/z3
[2] 接下来,我 运行 这个命令:
./build/z3 smt.string_solver=z3str3 -smt2 example.txt
[3] 其中 example.txt 是:
(declare-const s1 String)
(declare-const s2 String)
(declare-const s3 String)
(declare-const s4 String)
(assert (= (str.len s1) 1))
(assert (= (str.len s2) 2))
(assert (> (str.len s4) 4))
(assert (= (str.++ s1 s2) s3))
(assert (str.contains s4 s3))
(check-sat)
(get-value (s1 s2 s3 s4))
[4] 我得到了我所期望的:
sat
((s1 "d")
(s2 "af")
(s3 "daf")
(s4 "bdafaaaI"))
[5] 但是,我找不到对应的 API Z3 字符串函数, 所以我可以从我的 C++ 应用程序中逐步构建公式。
我希望是这样的:
z3_mk_concat(...)
z3_mk_str_contains(...)
etc.
但我找不到任何接近...
非常感谢任何帮助,谢谢!
字符串是一项相当新的功能,随着我们从当前方法中吸取教训,它正在得到改进。使用最新的每晚构建会更好。 C++ API 包含对字符串操作的支持。