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

Re: [tlaplus] Could it be possible to check the variable starting alphabet



So it means and overall my digging in TLA+, I come to know that this is not possible in TLA+ to check the value of a string/variable by matching some other string, or check a specific format of a string.

On Friday, September 13, 2019 at 12:04:39 PM UTC+5, Leslie Lamport wrote:
Stephan is incorrect when he says that TLC treats strings as primitive objects.  It treats them as sequences, but of elements that it can't handle.  Some sequence operations (I believe \o is one of them) work on strings.  The documentation on the latest versions of the tools should tell you which operators work, or you can just experiment.  TLC may be able to handle a spec that does what you want.

On Thursday, September 12, 2019 at 1:37:13 PM UTC-7, Stephan Merz wrote:
Hello,

according to TLA+ semantics, a string is a sequence of characters, so you could write something like

myletter[1] = "A"[1] /\ myletter[Len(myletter)] = "a"[1]

However, TLC treats strings as primitive objects and doesn't convert them to sequences / functions when needed. This also means that you cannot really do any string manipulation in your specification if you want to be able to analyze it with TLC. I'd recommend using sequences instead of strings.

Regards,
Stephan

On 12 Sep 2019, at 13:25,   wrote:

If I want to check that my variable must start with specific letter would it be possible.

Variable myletter = 'Alpha'

And condition is myletter must start with 'A' and ends on 'a'

Thanks in advance

--
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  ...

--
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/5fded759-85f5-4b1e-a972-8e18d1343296%40googlegroups.com.