使用C ++ API加载smt2文件后,将断言添加到Z3

时间:2017-04-04 16:57:27

标签: z3

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

以下是我将文件加载到求解器的示例:

;(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))))

那么如何使用C或C ++ API来使用smt2文件中定义的内容? (如果可能的话)。我想使用smt2文件中定义的函数和数据类型进行更多断言,获取模型,然后进行评估。如果有人感兴趣,以下是smt2文件的内容:

https://dist.nuget.org/index.html

1 个答案:

答案 0 :(得分:0)

这是一个非常" z3实现特定"题。如果您向开发人员提交了一张票证,您可能会得到更好的回复:https://github.com/Z3Prover/z3/issues