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

[tlaplus] How do I replace elements of a certain value in an array?


I have a constant set called clients = {"c1","c2","c3"}. clients is an index set for clientState. The values in the array clientState can be {"working", "attempting", "acknowledged"}. 
E.g. clientState["c1"] = "working".

Here's what I want to do: I want to replace all appearances of "attempting" in clientState array by "working". (I know TLA checks variables and doesn't perform executions, but you get what I mean to check for)

This is what I've tried, using a nested set constructor:

\A r \in {\A s \in clients: clientState[s] = "attempting"} : clientState' = [clientState EXCEPT ![r] = "working"]

The pretty printed version is attached.

Screenshot from 2020-01-09 18-08-02.png

TLA returns this error: 

TLC threw an unexpected exception.
This was probably caused by an error in the spec or model.
See the User Output or TLC Console for clues to what happened.
The exception was a java.lang.RuntimeException
: Attempted to check equality of string "c1" with non-string:

I would greatly appreciate your help.

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/053966d9-5b4e-4ba5-b0e3-ad04b03436a8%40googlegroups.com.