How to get a set like this in TLA+?

41 views
Skip to first unread message

Delta Striker

unread,
Dec 22, 2022, 8:18:55 AM12/22/22
to tlaplus
Hello I'm a newbie in TLA+.

I knew that Cartesian product is something like this:
 S × T × U = {<<a, b, c>> : a ∈ S, b ∈ T,c ∈ U }.

And I wonder how can I get a set like this:
{{a, b, c} : a ∈ S, b ∈ T,c ∈ U }.

Thank you.

Stephan Merz

unread,
Dec 22, 2022, 10:57:08 AM12/22/22
to tla...@googlegroups.com
Hello,

using TLC for evaluating the constant expression [1]

{{xx, yy, zz} : xx \in 1 .. 2, yy \in 3 .. 4, zz \in 5 .. 6}

produces

{ {1, 3, 5},
     {1, 3, 6},
     {1, 4, 5},
     {1, 4, 6},
     {2, 3, 5},
     {2, 3, 6},
     {2, 4, 5},
     {2, 4, 6} }

Is this what you had in mind?

Stephan

[1] Note that TLC will complain if the base sets are not homogeneous, for example if you mix integers and strings.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/135ba505-ec94-4f0d-9f9d-d3312e9d9444n%40googlegroups.com.

Delta Striker

unread,
Dec 25, 2022, 3:20:34 AM12/25/22
to tlaplus
Yes,that's exactly what I want,thank you.
Reply all
Reply to author
Forward
0 new messages