How does TLC know which action is the Init action?

32 views
Skip to first unread message

jayaprabhakar k

unread,
Oct 23, 2023, 9:10:16 AM10/23/23
to tla...@googlegroups.com
In TLC we can specify the behavioral spec as a temporal formula spec, and that is typically defined as

Spec === Init /\ [][Next]_vars /\ WF_vars(Next)

In this case,
  • How does TLC know Init is the init function? And more specifically, how does it know Init must happen before any Next operation occurs?
  • Is it by the order in which they are defined or by convention like if the name is Init etc?

Thanks,
JP
 

Stephan Merz

unread,
Oct 23, 2023, 9:45:03 AM10/23/23
to tla...@googlegroups.com
TLC parses the temporal formula, Init is a state predicate and Next is the [1] action that appears within the sub formula [][A]_v.

Stephan

[1] Although in TLA+ it is OK to write specifications that contain more complex formulas, such as [][A]_v /\ [][B]_w, TLC only accepts temporal formulas that contain a single sub-formula of that form.


--
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/CA%2Bt%3DSiKL660Kjkn-aX13y-BytRqaUTCwXf6asFAO3X54e2vKfA%40mail.gmail.com.

jayaprabhakar k

unread,
Oct 23, 2023, 5:04:26 PM10/23/23
to tla...@googlegroups.com
Does that mean, if I have the Spec defined as something like,

Spec == Predicate1 /\ [][Next]_vars /\ WF_vars(Next) /\ Predicate2 
Is it still valid? (Because /\ is commutative)

What are the requirements for a valid init step? For example, any predicate with no unprimed variable. Is that required and is it sufficient? 

Similarly, what if there are two predicates that follow the same requirements, would it be a valid TLA+ spec?

Thanks,
JP


Hillel Wayne

unread,
Oct 23, 2023, 5:07:18 PM10/23/23
to tla...@googlegroups.com

Yup, that's fine, as long as the conjunction of the two predicates fully specifies all variables. So you might do something like

Spec == MachineInit /\ WorldInit /\ [][Next]_vars

Or

Spec == Init /\ DebugInit /\ [][Next]_vars

H

jayaprabhakar k

unread,
Oct 23, 2023, 5:56:15 PM10/23/23
to tla...@googlegroups.com
Got it. Thanks.

jayaprabhakar k

unread,
Oct 23, 2023, 8:37:05 PM10/23/23
to tla...@googlegroups.com
More questions on the syntax.

For the common form of the spec,

Init == count = 0

Next == count' = count + 1

Spec == Init /\ [][Next]_vars /\ WF_vars(Next)

Here, wouldn't the Init state be true only at the initialization, and ever since any next state operation takes place, that modifies count, then Init predicate is false forever.
Then, wouldn't this Spec evaluate to false in every behavior?

Stephan Merz

unread,
Oct 24, 2023, 6:25:50 AM10/24/23
to tla...@googlegroups.com
The initial condition is just that: the predicate is only evaluated in the initial state.

Stephan

A. Jesse Jiryu Davis

unread,
Oct 24, 2023, 10:51:11 PM10/24/23
to tla...@googlegroups.com
From Specifying Systems: "Formally, we define a behavior to be a sequence of states, where a state is an assignment of values to variables. We specify a system by specifying a set of possible behaviors—the ones representing a correct execution of the system." A spec is a temporal formula, which is true of a behavior if the behavior's initial state matches Init and every step matches Next. For example, in Chapter 2, specifying an "hour clock", the book says:

image.png

Reply all
Reply to author
Forward
0 new messages