Constant conversion into Set

38 views
Skip to first unread message

MK Bug

unread,
Jun 22, 2019, 2:21:46 PM6/22/19
to tlaplus
Please share how to convert a constant into a set.

For Eaxample:

Constant A    ----Contains value 'ABCnma12'

Set B {'A','B','C','n','m','a','1','2'}

Thanks in advance.

Regards,
Malaika

Stephan Merz

unread,
Jun 23, 2019, 9:17:41 AM6/23/19
to tla...@googlegroups.com
Hello,

I find it hard to understand your question: since TLA+ is based on Zermelo-Fraenkel set theory, formally all values are sets (although it is easier to think of objects such as numbers, strings or functions as being separate entities since we don't know which elements they contain when considered as sets). There is no need to "convert" constants into sets.

For the rest, the syntax that you use is not that of TLA+, which doesn't help me understand your problem.

May I suggest that you study the introductory material about TLA+ [1,2] and come back when you have precise questions?

Thank you,
Stephan



--
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 post to this group, send email to tla...@googlegroups.com.
Visit this group at https://groups.google.com/group/tlaplus.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/aa716feb-a210-4857-9868-ab2903ff8843%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MK Bug

unread,
Jun 23, 2019, 9:32:56 AM6/23/19
to tla...@googlegroups.com
I am new in tla+, I want to convert 

Z='somevalue'

Into

S= {'s','o','m','e','v','a','l','u','e'}

This is the only conversion I want or can anyone suggest how to split values in tla+

Thanks

Stephan Merz

unread,
Jun 23, 2019, 9:44:28 AM6/23/19
to tla...@googlegroups.com
Strings are sequences of characters, and it looks like you want to compute the set of characters contained in a string. For an arbitrary sequence (hence in particular for a string), its range can be defined as

Range(seq) == { seq[i] : i \in 1 .. Len(seq) }

Stephan

MK Bug

unread,
Jun 23, 2019, 9:55:11 AM6/23/19
to tla...@googlegroups.com
But this will share the length of the string but not the actual values of the string. 

I need the values as mentioned. 

Hillel Wayne

unread,
Jun 24, 2019, 12:04:45 PM6/24/19
to tla...@googlegroups.com

That's a set map and will give you all of the values in the sequence. Note that while in TLA+ strings are sequences, TLC treats them as atoms. If you're using TLC and need to convert strings to sets, you're better off storing the string as a sequence, like

Z == <<'s', 'o', 'm', 'e'>>

H

MK Bug

unread,
Jun 24, 2019, 12:54:36 PM6/24/19
to tla...@googlegroups.com
Thanks Hillel. Its been a pleasure that you answered. I have following your blog it is very informative and helping me a lot. 

I have some confusion about the tool as well. Is it appropriate to send you an email regarding to the tool understanding. 

Regards 
Malaika

MK Bug

unread,
Jul 6, 2019, 5:21:51 PM7/6/19
to tla...@googlegroups.com
Hi,

I getting the following error, can you please share how to resolve this issue?

image.png
Reply all
Reply to author
Forward
0 new messages