Hi all,
Until now, I though the predicate on a function result, was an assertion
about the result, not more. I’m stuck since some hours trying to understand
why it seems to become a constraint on another function parameter.
The concrete sample will tell more (not too long, I hope):
sortdef set = t@ype
abst@ype set(s: set)
typedef set = [s: set] set s
sortdef item = string
abstype item(i: item)
typedef item = [i: item] item i
extern fn item(): item
stacst has(s: set, i: item): bool
extern fn has{s: set; i: item}(s: set s, i: item i): bool(has(s, i))
extern fn empty(): [s: set] {i: item | ~has(s, i)} set s
val s = empty()
val i = item()
val b = has(s, i)
PATSOPT complains about a constraint error with the s parameter in val b = has(s, i). It complains it can’t verify ~has(x, y) where x and y
are variables [1] (I don’t know which ones, as it displays it only as
numbers).
If I remove the {i: item | ~has(s, i)} from the dynamic empty function,
the constraint error disappears.
Here how I understood the predicate when I wrote it: “there exist a set s,
such that for any item i, has(s, i) does not hold, and this such a set s
which this function returns”.
… it must be something else, otherwise it would not end into a constraint
error on the parameter of another function.
… or else it really means what I intended and that’s something else which
confuse me?
[1]: here is the literal message:
error(3): unsolved constraint: C3NSTRprop(main; S2Eapp(S2Ecst(~); S2Eapp(
S2Ecst(has); S2Evar(s$1078$1080(4460)), S2EVar(140))))