Why vars is defined as tuples instead of set

31 views
Skip to first unread message

Chris Ortiz

unread,
Oct 24, 2023, 7:16:59 PM10/24/23
to tlaplus
Hi tlaplus group,

I am just curious with the convention why vars is defined as tuples of variables for UNCHANGED, <<A>>_vars, [A]_vars, [][Next]_vars, WF_vars and SF_vars. My understanding is that tuples preserved ordering of elements. Maybe I am still confused or still having a hang over with Programming Language, but I like to understand why tuple is the selected convention for such variables for those semantics, instead of set. Sometimes it confused me to make sure I follow the ordering from how I defined them in vars up to the way I removed variables in my UNCHANGED expression.

Thanks,
Zitro

Hillel Wayne

unread,
Oct 25, 2023, 12:16:59 AM10/25/23
to tla...@googlegroups.com

Hi Chris,

Here's a quick toy model:

VARIABLES x, y

Swap ==
  /\ x' = y
  /\ y' = x


If vars == {x, y}, then after Swap we have vars' = {x', y'} = {y, x}. Since sets are unordered, we have vars' = vars, or UNCHANGED vars. But clearly the state of the system changed!

With vars == <<x, y>>, after Swap we have vars' = <<y, x>>. Since order matters in sequences, vars' # vars and we get the expected behavior.

H

--
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/8c448736-b5e8-4855-a094-3c80ad617a94n%40googlegroups.com.

Chris Ortiz

unread,
Oct 25, 2023, 8:18:19 AM10/25/23
to tlaplus
Thank you very much Hillel. That toy model example makes sense why ordering matters.

Regards,
Zitro

Reply all
Reply to author
Forward
0 new messages