Reputation: 33
I am wondering if multiplication and division operators are supported by Alloy. I tried "*" as multiplication operator, but it does not work. "+" works though.
Thanks a lot. Sincerely, Fathiyeh
Upvotes: 0
Views: 598
Reputation: 3867
The arithmetic operators are supported by means of built-in functions: plus
/add
, minus
/sub
, mul
, div
, rem
.
one sig S {
x, y: Int,
pres, sres, mres, rres, dres: Int
} {
pres = plus[x, y]
sres = sub[x, y]
mres = mul[x, y]
rres = rem[x, y]
dres = div[x, y]
}
run {}
Upvotes: 3
Reputation: 3654
From Software Abstractions (2006 edition) by Daniel Jackson, p. 135, the answer in the discussion around multiplication states "No, it doesn't" and goes on to explain that models that require this are often not well suited to modelling in Alloy.
Upvotes: 0