I'm a little lost using Z3, the goal is model 2 processes both running the same loop in parallel. As long as not both processes have been finished, an unfinished process is chosen and the next of its 10 steps is executed:
for i := 1 to 10 do
if x < 8 then x := x + i else x := i − 2x
x is a global variable, i is local in both instances.
Also I would like to initialize x to be 0, is this possible in Z3?
So far I'm getting unsat as a result, with this code:
(declare-const c Int)
(push)
(declare-const i1 Int)
(assert
(and
(>= i1 1)
(<= i1 20)
(ite (< c 5) (and (= c (+ c i1)) (>= i1 1) (<= i1 20)) (and (= c (- i1 (* 2 c))) (>= i1 1) (<= i1 20)))
))
(push)
(declare-const i2 Int)
(assert
(and
(>= i2 1)
(<= i2 20)
(ite (< c 5) (and (= c (+ c i2)) (>= i2 1) (<= i2 20)) (and (= c (- i2 (* 2 c))) (>= i2 1) (<= i2 20)))
))
(assert (= c -24))
(check-sat)
(get-model)
(pop)
(pop)
Thanks in advance!
xunder all interleavings? - alias