[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlaplus] How to express this set comprehension in TLA+?



This language construct of binding tuple values to variables is a neat little trick that I had no idea existed in TLA+ before reading the grammar a few weeks back!

On Monday, April 5, 2021 at 5:49:05 AM UTC-4 martin...@xxxxxxxxxxxxxx wrote:
Hello Hengxin,

The { e: x \in S} pattern is treated differently, you need to move the domain
constraints to the front:

P == { <<x,y>> \in 1..2 \X 1..2 : x # y }

Please refer also to the Specifying Systems book p.299 where you can see the
different shapes. I hope that helps :)

kind regards,
Martin

On 4/5/21 11:34 AM, hengx...@xxxxxxxxx wrote:
> I want to express the following set comprehension (as a simplied example)
>
> {<<x, y>> : x \in 1 .. 2, y \in 1 .. 2, y # x}
>
> in TLA+ and expect the result {<<1, 2>>, <<2, 1>>}.
> Note that the third condition "y # x" uses variable "x".
>
> However, I got a parse error.
>
> How should I correctly express it in TLA+?
>
> Best regards,
> hengxin
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "tlaplus" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to tlaplus+u...@xxxxxxxxxxxxxxxx
> <mailto:tlaplus+u...@xxxxxxxxxxxxxxxx>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tlaplus/dbff9f03-c5bf-45cc-a9f9-b361b98cb278n%40googlegroups.com
> <https://groups.google.com/d/msgid/tlaplus/dbff9f03-c5bf-45cc-a9f9-b361b98cb278n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/3979e08b-2ab3-45dc-9ce1-d8f114c7e12en%40googlegroups.com.