Hi there,
I was at studying possible variations of a proposal from Artyom Shalkhakov,
in https://groups.google.com/d/msg/ats-lang-users/_7E45-45sXA/4Jf-HiFXu44J
, when I faced a unexpected assertion from ATS (I don’t want to say ATS is
wrong, just that it’s me who was surprised).
In short, I wanted to attach a proposition to a type instead of returning a
proposition along with a value of this type (for convenience only, I will
finally try to achieve this convience another way, but this is a another
question).
Schematically, I had these steps (the conclusion and the related question
comes later):
First, I declared an abstract proposition:
absprop PROP(int)
I wanted to have something different than
typedef special_int = [i: int] (PROP(i) | int i)
I had a naive attempt to attach it to a typedef
, this alternative wrong
way:
typedef special_int = [i: int | PROP(i)] int i
ATS complained PROP(i)
is of sort prop
, while it is expected to be of
sort bool
.
So I naively attempted to workaround it, this as much bad way:
typedef special_int = [i: int] [PROP(i) | true] int i
ATS complained the same… looks like it tells me at that place too, a
boolean expression is expected, to my surprise.
I wanted to check if it indeed was, thinking: if it expects a boolean
expression at the place PROP(i)
was in the second attempt, this means the
a: some_type
are boolean expressions too, as this is what normally
appears on the left side of |
in quantifiers, and so this could as much
appears on the right side, where ATS expects a boolean expression too (less
surprisingly).
So I tried this:
typedef special_int = [i: int] [j: int | k: int] int i
ATS does not complains, and type‑check it…
Does it really means i: int
and the likes are expressions of sort boolean?
If yes, what means the k: int
above, as a predicate?