alloy - Adding an removing relation between state -
i have alloy model
module test sig b {} sig { c: b, delta: c lone -> lone c } pred operationa[disj x, x': a, c1, c2: b]{ x'.delta = x.delta + (c1->c2) x'.delta = x'.delta - (c1->c2) x'.c = x.c } run operationa 10 2
this not generate me instance. adding relation c1->c2 in x' state , removing again, reason not allow me that.
the alloy language declarative, meaning write specification of what has happen in end , not how make happen (which imperative approach). therefore, body of operationa
predicate interpreted conjunction of 3 lines wrote there, , not sequence of operations performed.
more concretely, line x'.delta = x'.delta - (c1->c2)
says content of x'.delta
relation at same time equal x'.delta - c1->c2
. on it's own, line satisfiable if , if x'.delta
not contain tuple c1->c2
(because -
operator set difference, , if try remove set that's not in there, result same set). however, previous line, x'.delta = x.delta + (c1->c2)
says content of x'.delta
must include c1->c2
(plus whatever in x.delta
, 2 lines unsatisfiable.
if want model 3 steps of imperative algorithm, you'll have use 3 variable, e.g., x
, x'
, , x''
.
Comments
Post a Comment