大 table 警告(声明关系)

large table warning for (declare-relation)

$ z3 sat.smt2
WARNING: creating large table of size 16777216 for relation match1

原始 sat.smt 文件:

; (set-option :fixedpoint.engine datalog)
; sorts
(define-sort s () (_ BitVec 24))
(define-sort t () (_ BitVec 8))
; Relations 
(declare-rel f (t s s))
(declare-rel match1 (t s))
(declare-rel better (t s))
(declare-rel best (t s))
(declare-rel a (t))
(declare-rel b ())
(declare-rel c ())
(declare-var x s)
(declare-var xmin s)
(declare-var xmax s)
(declare-var p t)
(declare-var q t)

; Rules
(rule (=> (and (f p xmin xmax) (bvsle xmin x) (bvsle x xmax)) 
      (match1 p x)))
(rule (=> (and (match1 q x) (bvslt q p))
      (better p x)))
(rule (=> (and (not (better p x)) (match1 p x))
     (best p x)))
; Facts (EDB)
(rule (f #x10 #x100000 #x200000))
(rule (f #x20 #x150000 #x200000))
(rule (f #x20 #x300000 #x500000))

; Queries 
(rule (=> (best #x10 #x170000) c))

; Output 'WARNING: creating large table of size 16777216 for relation better' and fails
(query c)

如何解决这个问题,为什么? z3 的版本是 Z3 版本 4.8.13 - 64 位。以及如何添加所有声明和查询,以便示例可以是 运行.

除了减少您使用的位向量大小之外,您无能为力。引用自 https://github.com/Z3Prover/z3/issues/1698#issuecomment-399577761:

It is a design decision. The bottom up data log engine that uses hash tables can at most hold relations with a few million entries. So using large bit vectors for that engine is not a good match.

您的问题需要 z3 构建非常大的内部表,这非常昂贵。问题是为什么需要这么大的位向量?您可以使用更小的位向量大小吗?您还没有说明您要建模的内容,因此很难猜测。看看您是否可以“抽象”掉这些数字并使用更小的位向量来对问题建模。