I以下を達成するためにZ3 C++ APIを使用しようとしています:Z3 C++ APIを使用して入力パラメータに基づく理論を証明するにはどうすればよいですか?
(set-option :produce-proofs true)
(declare-const Weight Int)
(declare-const WeightLimit Int)
(declare-const P1 Bool)
(assert (= WeightLimit 10))
(assert (= P1 (>= Weight WeightLimit)))
(assert (= P1 true))
;Facts - Input
(assert (= Weight 100))
(check-sat)
そして、私は次の関数になってしまった:
void test() {
try {
context ctx;
Z3_string str = "(declare-const Weight Int) (declare-const WeightLimit Int) (declare-const P1 Bool) (assert (= WeightLimit 10)) (assert (= P1 (>= Weight WeightLimit))) (assert (= P1 true)) (assert (= Weight 100)) (check-sat)"; //Generated by some other function
expr fs(ctx, Z3_parse_smtlib2_string(Z3_context(ctx), str, 0, 0, 0, 0, 0, 0));
solver s(ctx);
s.add(fs);
switch (s.check()) {
case unsat: std::cout << "not satisfied\n"; break;
case sat: std::cout << "satisfied\n"; break;
case unknown: std::cout << "unknown\n"; break;
}
model m = s.get_model();
std::cout << m << "\n";
}
catch (z3::exception e) {
std::cout << e.msg() << std::endl;
}
}
は、入力として重み値を渡す方法はありますパラメータをハードコーディングする代わりに関数に渡しますか?
さらに、Z3 C++ APIを使用してset-optionを設定するにはどうすればよいですか?オプションを設定しないと、どのような影響がありますか?
もし 'Weight'が値9で渡されれば'(assert(= P1(> Weight WeightLimit))) ''という理論は満足すべきではないと考えています。 – gliatsos