Hi,
the key elements of your toy module are
Mod(s) == INSTANCE mod WITH s <- s
All == {s0, s1}
t == \A s \in All : Mod(s)!Add
where in mod we have
Let's assume that TLC attempts to evaluate action t in state z where both variables s0 and s1 have value 0. Then All = {0} and the definition of t boils down to Mod(0)!Add, which in turn evaluates to 0' = 1, which is FALSE, so there is no successor state of z for action t.
It seems to me that your mental picture is a semantics of "call by name" where set All would contain references to the variables s0 and s1 rather than the values of these variables.
Back to your original intention: the canonical way to obtain a generic specification is to use functions (arrays). More precisely, a single variable evaluates to a function, and each "array cell" corresponds to the individual variables that you have in mind. Concretely,
CONSTANT Dom
VARIABLE s
\** initialize the entire array
Init == s = [d \in Dom |-> 0]
\** update certain elements of the array
trans(D) == s' = [d \in Dom |-> IF d \in D THEN 1 ELSE s[d]]
\** next-state relation: update some array elements
Next == \E D \in SUBSET Dom : trans(D)
In practice, of course, both the update and the conditions on the choice of the subset to update would be more complicated.
Note in particular that the action trans has to define the new value of the overall function and that it is not enough to write, say,
trans(D) ==
/\ \A d \in D : s'[d] = 1
/\ \A d \in Dom \ D : UNCHANGED s[d]
because this does not uniquely define the domain of s' (for example, it could be a superset of the original domain). In fact, the above definition does not even specify that s' is a function. In principle, you could write something like
trans(D) ==
/\ s' \in [Dom -> 0 .. 10]
/\ \A d \in D : s'[d] = 1
/\ \A d \in Dom \ D : UNCHANGED s[d]
but TLC is very inefficient in evaluating this definition because it would actually enumerate all possible functions and remove those that do not satisfy the formula in order to compute the only possible successor state.
Hope this helps,
Stephan