i am recently working with Alloy. Can I say something like:
fact{
all i: Int | i >= 0
}
I want to say: all Integer which Alloy uses should be positive. Alloy doesn't fail but also don't give me instances.
greetings
i am recently working with Alloy. Can I say something like:
fact{
all i: Int | i >= 0
}
I want to say: all Integer which Alloy uses should be positive. Alloy doesn't fail but also don't give me instances.
greetings
You can't currently say that. The only scope you can specify for integers (which tells Alloy which integers to "use") is the bitwidth (e.g., 4 Int
); Alloy then always uses all integers within that bitwidth (e.g., for bitwidth of 4, integers used are -8, ..., 7
).
If you have a field of type Int in your model, you can use a fact (like you said above) to restrict its values:
sig S { i: Int }
fact { all s: S | s.i >= 0 }