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

Re: [tlaplus] Beginner question: EXCEPT construct



Hello,

if my understanding is correct, you would like to update the function state for all elements of the set. There is no specific syntax for this, write

state' = [ x \in DOMAIN state |-> IF x \in A THEN "newState" ELSE state[x] ]

(Presumably you can replace "DOMAIN state" by a simpler set.)

Hope this helps,
Stephan


On 2 May 2019, at 10:38, kestutis@xxxxxxxxx wrote:

Suppose the next state relation for the function "state" is:

state' = [state EXCEPT ![A] = "newState"]

where A is some argument of the function "state". This obviously works when A is a single argument.

What about when A is a "set of arguments" (i.e., A = {"A1", "A2", "A3"})? Then the _expression_:

state' =  [state EXCEPT ![A] = "newState"]     

is not correct: TLC gives an error message:

"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 "A1" with non-string: {"A1"}

The error occurred when TLC was evaluating the nested
expressions at the following positions:"

Clearly, I am missing something obvious. How could it be possible to resolve this?

--
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 post to this group, send email to tlaplus@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/tlaplus.
For more options, visit https://groups.google.com/d/optout.

--
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 post to this group, send email to tlaplus@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/tlaplus.
For more options, visit https://groups.google.com/d/optout.