"In evaluation, the identifier v is either undefined or not an operator" when temporal properties involve operators with Java module overrides
See original GitHub issueHi,
I have a spec like below
spec.tla
-------------------------------- MODULE spec --------------------------------
EXTENDS Integers, TLC, Sequences, Json
VARIABLES mainVar
vars == << mainVar >>
Init == mainVar = << 1 >>
Next == mainVar' = << 3 >>
prop ==
<>(JsonSerialize("eiei.json", mainVar) /\ Head(mainVar) >= 1)
Spec == Init /\ [][Next]_vars
=============================================================================
-------------------------------- CONFIG spec --------------------------------
INIT
Init
NEXT
Next
PROPERTY
prop
=============================================================================
When I run it with TLC, it gives me
...
Semantic processing of module TLC
Semantic processing of module Json
Semantic processing of module spec
Starting... (2021-04-14 23:29:09)
Error: In evaluation, the identifier mainVar is either undefined or not an operator.
line 14, col 20 to line 14, col 26 of module spec
Finished in 00s at (2021-04-14 23:29:09)
Originally I have been using a custom overridden operator with TLAPlusOperator
(which just returns TRUE
and it works fine when not in use by a temporal property) and it was giving me the same error, I’m just using JsonSerialize
because it’s already embedded. Removing the JsonSerialize
and letting Head
alone works (although Head
also is an overridden operator, but it uses a different mechanism other that `TLAPlusOperator).
Use the toolbox or run the spec from the CLI with
$ java -cp $SOME_FOLDER/tla2tools.jar tlc2.TLC spec.tla -config spec.tla
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Overriding operator which is used in a temporal property
Error : In evaluation, the identifier mainVar is either undefined or not an operator. I'm doing this for a personal project and I...
Read more >In evaluation, the identifier messagesSend is either undefined ...
"In evaluation, the identifier messagesSend is either undefined or not an operator." Can someone help me along explaining my error?
Read more >in works, while \subseteq gives a "identifier undefined" error
In evaluation, the identifier members is either undefined or not an operator. The error points to the Init line.
Read more >mku · GitHub
Trace expression evaluation fails for a trace where the initial state ... (beginner) Trying to write a new module override #713 opened by...
Read more >Specifying Concurrent Systems with TLA+ - Leslie Lamport
properties, which can be specified with almost no temporal logic, are all that. most engineers will need to know about.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Root cause
A non-zero arity operator with constant-level right-hand side, whose (left-hand side) arguments do not appear on the RHS, is constant-level. Consider the operator
Op
:Op
is clearly constant-level even ifOp
is evaluated with some or all of its arguments equal to variables.This fact causes a bug (see above), iff the operator appears in a (temporal) property and has a Java module override:
Op
is accepted by safety checking (Inv
) because safety is more liberal compared to liveness checking when it comes toOp
’s level. In other words, safety happily checksSpec => []TRUE
.Scope
Below is a list of operators, from the (extended) list of standard operators, that are affected when evaluated with state-level arguments in a (liveness) property:
TLC!Print
(whenout
argument has state-level)TLC!PrintT
TLC!Assert
(out
state-level)TLC!TLCGet
TLC!TLCSet
Not affected because ops use
@Evaluation
or lack a Java module override:TLCExt!Trace
TLCExt!TLCDefer
Toolbox!_TETrace
Toolbox!_TEPosition
Likely affected CommunityModules modules:
SVGElemToString
,NodeOfRingNetwork
)Possible fixes:
Print
,PrintT
, and, perhaps,TLCGet
, most operators usually don’t appear in liveness properties. However,TLCGet
has been discussed in the scope of trace evaluation on the command-line. Also, the liveness property might be a behavior spec, and in behavior specs, it would be less surprising to find e.g. aPrintT(var)
. However, the level-checking in then does not take the code path that triggers the bug.PrintT
is proper TLA+. Rather,PrintT
should be seen as an operator with side-effects outside of the TLA+ formalismPrintT(val) == val = val
,TLCGet(i) == CHOOSE n : i = i
,TLCGet(i) == CHOOSE n : i = i
Please try loading your module override that fails with
@TLAPlusOperator
through the old mechanism: Place it in the default package, align the Java class file name with the module name, and the operator name with the (static) method name. E.g for a constant-level operator defined in module M with nameOp(a,b,c)
: