why `init` will invoke twice

21 views
Skip to first unread message

Qd Wang

unread,
Aug 8, 2018, 11:10:27 PM8/8/18
to tlaplus
In my spec:

```
Init ==
  /\ PrintT("init")
  /\ ...
  /\ ...
```

In the user ouput console, I will get two lines of "init". 
Why is this happening?

Markus Kuppe

unread,
Aug 8, 2018, 11:20:16 PM8/8/18
to tla...@googlegroups.com
Hi,

to answer this question we need to see the complete spec (at least the
Init predicate).

Thanks
Markus

Qd Wang

unread,
Aug 9, 2018, 3:26:19 AM8/9/18
to tlaplus
Sorry, I'm debuging my spec, it's a bit mess. I'll upload later if I can't fix it myself. Thanks.

Markus Kuppe

unread,
Aug 9, 2018, 11:28:58 AM8/9/18
to tla...@googlegroups.com
On 09.08.2018 00:26, Qd Wang wrote:
> Sorry, I'm debuging my spec, it's a bit mess. I'll upload later if I
> can't fix it myself. Thanks.

Hi,

redundant PrintT output doesn't necessarily mean your spec is buggy.
There are cases where e.g. left-to-right evaluation causes TLC to
evaluate PrintT multiple times:

Init == /\ x \in 1..10
/\ PrintT("init")
/\ PrintT(x)
/\ ...

Cheers
Markus

Qd Wang

unread,
Aug 10, 2018, 12:32:01 AM8/10/18
to tlaplus
I'm using it as:

```
Init ==
  /\ PrintT("init")
  /\ ...
  /\ ...
```
Reply all
Reply to author
Forward
0 new messages