【问题标题】:z3 times out in case of a formula with quantifiersz3 在带有量词的公式的情况下超时
【发布时间】:2014-04-16 18:42:52
【问题描述】:

我在以下示例中超时。 http://rise4fun.com/Z3/zbOcW

是否有任何技巧可以使这项工作(例如,通过重新制定问题或使用触发器)?

【问题讨论】:

    标签: z3 quantifiers


    【解决方案1】:

    对于本示例,宏查找器将很有用(我认为通常使用带有含义的 forall 量词),您可以通过以下方式启用它:

    (set-option :macro-finder true)
    

    这是您更新后的示例,可以快速获取sat(rise4fun 链接:http://rise4fun.com/Z3/Ux7gN):

    (set-option :macro-finder true)
    
    (declare-const a (Array Int Bool))
    (declare-const sz Int)
    (declare-const n Int)
    (declare-const d Int)
    (declare-const r Bool)
    (declare-const x Int)
    (declare-const y Int)
    
    ;;ttff
    (declare-fun ttff (Int Int Int) Bool)
      (assert
      (forall ((x1 Int) (y1 Int) (n1 Int))
      (= (ttff x1 y1 n1)
      (and
      (forall ((i Int))
      (=> (and (<= x1 i) (< i y1))
      (= (select a i) true)))
      (forall ((i Int))
      (=> (and (<= y1 i) (< i n1))
      (= (select a i) false)))))))
    
    ;; A1
      (assert (and (<= 0 n) (<= n sz)))
    
    ;; A2
      (assert (< 0 d))
    
    ;; A3
      (assert (and (and (<= 0 x) (<= x y)) (<= y n)))
    
    ;; A4
      (assert (ttff x y n))
    
    ;; A6
      (assert
      (=> (< 0 y)
      (= (select a (- y 1)) true)))
    
    ;; A7
      (assert
      (=> (< 0 x)
      (= (select a (- x 1)) false)))
    
    ;;G
    (assert
      (not
      (iff
      (and (<= (* 2 d) (+ n 1)) (ttff (- (+ n 1) (* 2 d)) (- (+ n 1) d) (+ n 1)))
      (and (= (- (+ n 1) y) d) (<= d (- y x))))))
    (check-sat)
    (get-model)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-09
      • 2019-10-02
      • 2016-02-16
      • 1970-01-01
      • 1970-01-01
      • 2020-01-27
      • 1970-01-01
      相关资源
      最近更新 更多