Nesting/Unnesting Sets

16 views
Skip to first unread message

Amir Hossein Sayyad Abdi

unread,
Jul 31, 2019, 6:56:23 PM7/31/19
to tla...@googlegroups.com
Hi everyone,

I woud like to know is there a way to unnest a set in TLA+?

The reason I am asking is because I have a set, say {a, b, c} which its elements are constants, and when I perform a union on this set with another set that contains the same elements I will get: {a, b, c, {a, b, c}}. But I expect the result to be {a, b, c}.

Best Regards
AmirHossein

Hillel Wayne

unread,
Jul 31, 2019, 10:35:02 PM7/31/19
to tla...@googlegroups.com

The reason I am asking is because I have a set, say {a, b, c} which its elements are constants, and when I perform a union on this set with another set that contains the same elements I will get: {a, b, c, {a, b, c}}. But I expect the result to be {a, b, c}.

That shouldn't happen. If S = {a, b, c}, then S \union S = {a, b, c}. Are you accidentally writing S \union {S}?

If you have S = {{a}, {b}, {c}}, then UNION S = {a, b, c}.

H


Best Regards
AmirHossein

--
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/CAKxfy0sdTWMRETZEJkqUAVvVNspbC9VpRmXRtJJYa56-RkNNhA%40mail.gmail.com.

Amir Hossein Sayyad Abdi

unread,
Aug 1, 2019, 12:20:22 AM8/1/19
to tla...@googlegroups.com
Correct, thanks for your help.

AmirHossein

Amir Hossein Sayyad Abdi

unread,
Aug 1, 2019, 12:34:20 AM8/1/19
to tla...@googlegroups.com
Is there a way to unnest this set?

S = {{a, b, c}}

I mean for S to be as follows:
S = {a, b, c}


I have tried using SUBSET with cardinality equal to 1, but no luck so far.

Best Regards
AmirHossein

Stephan Merz

unread,
Aug 1, 2019, 2:37:30 AM8/1/19
to tla...@googlegroups.com
UNION {{a,b,c}} = {a,b,c}

Regards,
Stephan

Amir Hossein Sayyad Abdi

unread,
Aug 1, 2019, 3:24:14 AM8/1/19
to tla...@googlegroups.com
Thank you very much. Sorry I did not understand it earlier from Hillel's answer.

Best Regards,
AmirHossein


Reply all
Reply to author
Forward
0 new messages