在用C+加载到smt2文件后向Z3添加断言+;美国石油学会

在用C+加载到smt2文件后向Z3添加断言+;美国石油学会,z3,Z3,我正在尝试使用C++/C API for z3(v4.5.1)加载smt2文件,然后使用API添加断言,并在smt2文件中声明数据类型和函数 以下是将文件加载到解算器中的示例: solver loadBackgroundTheoryFile(context& c, string filename) { Z3_ast ast = Z3_parse_smtlib2_file(c, filename.c_str(), 0, 0, 0, 0, 0, 0); Z3_solver c_so

我正在尝试使用C++/C API for z3(v4.5.1)加载smt2文件,然后使用API添加断言,并在smt2文件中声明数据类型和函数

以下是将文件加载到解算器中的示例:

solver loadBackgroundTheoryFile(context& c, string filename) {
  Z3_ast ast = Z3_parse_smtlib2_file(c, filename.c_str(), 0, 0, 0, 0, 0, 0);

  Z3_solver c_solver;

  expr e(c, ast);

  solver s(c);
  s.add(e);

  return s;
}

int main() {
  context g;

  solver s = loadBackgroundTheoryFile(g, "family.smt2");

  std::cout << s << std::endl;
  // Here it shows that the solver has all the contents of the family.smt2 file
  return 0;
} 

这是一个非常“z3实现特定”的问题。如果您在这里向开发人员提交了一份通知单,您可能会得到更好的答复:

这是一个非常“z3实现特定”的问题。如果您在这里向开发人员提交了一份通知单,您可能会得到更好的回复:

谢谢,我收到了关于一个问题的回复。谢谢,我收到了一个问题的答复。
;(declare-sort Person)
(declare-datatypes () ((Person (person (name String)))))
(declare-fun related (Person Person) Bool)
(declare-fun father (Person Person) Bool)
(declare-fun sibling (Person Person) Bool)

; related symetric
(assert
  (forall ((p Person) (q Person))
    (=> (related p q)
        (related q p))))
; related transitive
(assert
  (forall ((p Person) (q Person) (j Person))
    (=> (and (related p q) (related q j))
        (related p j))))
; the father of a person is related to that person
(assert
  (forall ((p Person) (q Person))
    (=> (father p q)
        (related p q))))
; for all people, there exists another person that is their father
(assert
  (forall ((p Person))
    (exists ((q Person)) (father q p))))
; sibling symetric
(assert
  (forall ((p Person) (q Person))
    (=> (sibling p q) (sibling q p))))
; siblings have the same father
(assert
  (forall ((p Person) (q Person) (j Person))
    (=> (and (sibling p q) (father j p))
        (father j q))))

(declare-fun get-father (Person) Person)
; here we use a double implication to define the behavior of get-father
(assert
  (forall ((p Person) (q Person))
    (= (father q p) (= (get-father p) q))))