Programmer
Programmer

Reputation: 6753

Predicates and Int in alloy

I know the use of predicates in alloy but i was a little surprised by the below description:

pred locationConstraint(loc: Int -> Int){
    loc in (Int[0] + Int[1] + Int[2] + Int[3] + Int[4] + Int[5] + Int[6]) -> (Int[2] + Int[3])
 + (Int[2] + Int[3]) -> (Int[0] + Int[1] + Int[2] + Int[3] + Int[4] + Int[5])

}

Can someone please explain the above to me.

Upvotes: 2

Views: 357

Answers (1)

Aviad P.
Aviad P.

Reputation: 32629

Add run {} to your model, and type {x,y:Int | locationConstraint[x->y]} into the evaluator to get the result:

enter image description here

Upvotes: 1

Related Questions