我不明白我出错的地方。在Z3解算器中相互排斥返回SAT
。我犯了一个错误吗?我在我的照片中为四个地方使用了四个阵列,我想检查没有两个进程同时进入临界区。为什么Z3求解器将互斥排除归还SAT?
(declare-const p0 (Array Int Int))
(declare-const p1 (Array Int Int))
(declare-const p2 (Array Int Int))
(declare-const p3 (Array Int Int))
(declare-const p4 (Array Int Int))
(define-fun t0 ((i Int)) Bool
(and
(= (select p1 (+ i 1)) (- (select p1 i) 1))
(>= (select p1 i) 1)
(= (select p2 (+ i 1)) (- (select p2 i) 1))
(>= (select p2 i) 1)
(= (select p0 (+ i 1)) (+ (select p0 i) 1))
)
)
(define-fun t1 ((i Int)) Bool
(and
(= (select p0 (+ i 1)) (- (select p0 i) 1))
(>= (select p0 i) 1)
(= (select p1 (+ i 1)) (+ (select p1 i) 1))
(= (select p2 (+ i 1)) (+ (select p2 i) 1))
)
)
(define-fun t2 ((i Int)) Bool
(and
(= (select p4 (+ i 1)) (- (select p4 i) 1))
(>= (select p4 i) 1)
(= (select p2 (+ i 1)) (- (select p2 i) 1))
(>= (select p2 i) 1)
(= (select p3 (+ i 1)) (+ (select p3 i) 1))
)
)
(define-fun t3 ((i Int)) Bool
(and
(= (select p3 (+ i 1)) (- (select p3 i) 1))
(>= (select p3 i) 1)
(= (select p4 (+ i 1)) (+ (select p4 i) 1))
(= (select p2 (+ i 1)) (+ (select p2 i) 1))
)
)
(define-fun prop0 ((i Int)) Bool
(and
(> (select p0 i) 0)
(> (select p3 i) 0)
)
)
(define-fun prop1 ((i Int)) Bool
(> (select p0 i) 0)
)
(assert (= (select p0 0) 0))
(assert (= (select p1 0) 1))
(assert (= (select p2 0) 1))
(assert (= (select p3 0) 0))
(assert (= (select p4 0) 1))
(assert (or (t0 0) (t1 0)))
;(assert (or (t0 1) (t1 1)))
;(assert (or (t0 2) (t1 2)))
;(assert (or (t0 3) (t1 3)))
;(assert (or (t0 4) (t1 4)))
;(assert (or (t0 5) (t1 5)))
;(assert (or (prop0 0) (prop0 1) (prop0 2)))
;(assert (and (or (t0 0) (t1 0)) (prop1 0)))
(assert (or (t0 1) (t1 1)))
;here i check p0 and p3 are never in critical section together
(assert (or (prop0 0) (prop0 1)))
(check-sat)
这将是非常有益的,如果你将为这些表达式的意见和英语解释你正试图在每一步完成。你是从一个工具生成这个实例还是你手工创建了这个实例?我手工制作的 – mtrberzi
。 P0 ... p4是4个像照片一样的地方。每个地方都包含一个数组,数组中的每个案例都代表时间t的一个实例。例如,在时间点1(选择p0 1)p0。T0 .. t3是转换。我想检查的属性是prop0。 2进程可以同时进入临界区。 – uwevil