有人可以指出最终查询为什么没有输出?
基本上我告诉Z3如果vs-)vd和vs-> ss和vd-> sd,那么sd是从ss派生的。
(set-option :fixedpoint.engine datalog)
(define-sort site () (_ BitVec 3))
(declare-rel pointsto (Int site))
(declare-rel dcall (Int Int))
(declare-rel derived (site site))
(declare-var vs Int)
(declare-var vd Int)
(declare-var ss site)
(declare-var sd site)
;;;;; definition of derived ;;
(rule (=> (and (dcall vs vd) (pointsto vs ss) (pointsto vd sd)) (derived ss sd)))
(rule (dcall 11 12))
(rule (pointsto 11 #b001))
(rule (pointsto 12 #b010))
(query (derived #b001 #b010))
答案 0 :(得分:2)
此示例公开了一些内容。我会尝试通过这些。
(set-option :fixedpoint.engine datalog)
(define-sort site () (_ BitVec 3))
(define-sort Loc () (_ BitVec 8))
(declare-rel pointsto (Loc site))
(declare-rel dcall (Loc Loc))
(declare-rel derived (site site))
(declare-var vs Loc)
(declare-var vd Loc)
(declare-var ss site)
(declare-var sd site)
;;;;; definition of derived ;;
(rule (=> (and (dcall vs vd) (pointsto vs ss) (pointsto vd sd)) (derived ss sd)))
(rule (dcall (_ bv11 8) (_ bv12 8)))
(rule (pointsto (_ bv11 8) #b001))
(rule (pointsto (_ bv12 8) #b010))
(query (derived #b001 #b010)
:print-answer true)
(query (derived #b001 ss)
:print-answer true)