question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Evaluate alias expression on pair of states s and t in error-trace and printed in place of s

See original GitHub issue

TLC now allows the cfg file to contain the statement ALIAS R where R is the definition of a record in the spec or the model. R’s component expressions can be formed from constant-, state-, and action-level expressions. When printing an error-trace, TLC evaluates the record R on every step (pair or states s -> t) on the behavior that violated the property for every state of the error-trace. TLC prints the result r of the evaluation of R in place of s by formatting each component hi of r as a conjunct s.t. "hi" = r["hi"]. If the evaluation of R for a step fails, TLC falls back to printing s.

---- CONFIG Alias ----
SPECIFICATION FairSpec
INVARIANT Inv
PROPERTY Prop
ALIAS Alias
======================

---- MODULE Alias ----
EXTENDS Integers, TLC, Sequences

VARIABLES x, y
vars == <<x,y>>

Next == /\ y' = ~y
        /\ \/ /\ x < 4
              /\ x' = x + 1
           \/ /\ x = 4
              /\ x' = 1

Spec == x = 1 /\ y = FALSE /\ [][Next]_vars

FairSpec == Spec /\ WF_vars(Next)

Inv == x < 4

Prop == <>(x > 4)

Animation(e1,e2) == "e1: " \o ToString(e1) \o " e2: " \o ToString(e2)

\* An expression that is evaluated on the pair of states
\* s and t and printed in place of s in an error trace.
\* Useful to:
\* - filter out variables (not shown below)
\* - rename variables
\* - map variables (e.g. animation)
\* - additional trace expressions
\* TLC shows the original state if the evaluation of
\* Alias fails.
Alias == [y |-> y, \* x and y reordered.
          x |-> x, 
          a |-> x' - x, 
          b |-> x' = x,
          anim |-> Animation(x, y), \* Animation
          te |-> ENABLED Next]      \* Trace Expression

\* Syntactic variant for those that prefer this notation.
AliasEq ==
     "y" :> y @@
     "x" :> x @@
     "a" :> x' - x @@
     "b" :> (x' = x) @@
     "anim" :> Animation(x, y) @@
     "te" :> ENABLED Next
=======================
\* FairSpec => []Inv
Error: Invariant Inv is violated.
Error: The behavior up to this point is:
State 1: <Initial predicate>
/\ y = FALSE
/\ x = 1
/\ a = 1
/\ b = FALSE
/\ anim = "e1: 1 e2: FALSE"
/\ te = TRUE

State 2: <Next line 7, col 9 to line 11, col 23 of module Alias>
/\ y = TRUE
/\ x = 2
/\ a = 1
/\ b = FALSE
/\ anim = "e1: 2 e2: TRUE"
/\ te = TRUE

State 3: <Next line 7, col 9 to line 11, col 23 of module Alias>
/\ y = FALSE
/\ x = 3
/\ a = 1
/\ b = FALSE
/\ anim = "e1: 3 e2: FALSE"
/\ te = TRUE

State 4: <Next line 7, col 9 to line 11, col 23 of module Alias>
/\ y = TRUE
/\ x = 4
/\ a = 0         \* Stuttering
/\ b = TRUE \* Stuttering
/\ anim = "e1: 4 e2: TRUE"
/\ te = TRUE

-------------------------------
\* Spec => Prop
Error: Temporal properties were violated.
Error: The following behavior constitutes a counter-example:
State 1: <Initial predicate>
/\ y = FALSE
/\ x = 1
/\ a = 0         \* Stuttering
/\ b = TRUE \* Stuttering
/\ anim = "e1: 1 e2: FALSE"
/\ te = TRUE

State 2: Stuttering

-------------------------------
\* FairSpec => Prop
Error: Temporal properties were violated.
Error: The following behavior constitutes a counter-example:
State 1: <Initial predicate>
/\ y = FALSE
/\ x = 1
/\ a = 1
/\ b = FALSE
/\ anim = "e1: 1 e2: FALSE"
/\ te = TRUE

State 2: <Next line 7, col 9 to line 11, col 23 of module Alias>
/\ y = TRUE
/\ x = 2
/\ a = 1
/\ b = FALSE
/\ anim = "e1: 2 e2: TRUE"
/\ te = TRUE

State 3: <Next line 7, col 9 to line 11, col 23 of module Alias>
/\ y = FALSE
/\ x = 3
/\ a = 1
/\ b = FALSE
/\ anim = "e1: 3 e2: FALSE"
/\ te = TRUE

State 4: <Next line 7, col 9 to line 11, col 23 of module Alias>
/\ y = TRUE
/\ x = 4
/\ a = -3           \* State 1 is successor
/\ b = FALSE   \* State 1 is successor
/\ anim = "e1: 4 e2: TRUE"
/\ te = TRUE

Back to state 1: <Next line 7, col 9 to line 11, col 23 of module Alias>

-------------------------------

(The Alias feature would perhaps have helped with https://github.com/dgpv/bip32_template_parse_tplaplus_spec/issues/1)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
lemmycommented, Jul 10, 2020

Quickly generate animations:

java -cp /opt/toolbox/tla2tools.jar:CommunityModules.jar tlc2.TLC -simulate num=1 -depth 32001 -config AsyncGameOfLife.cfg AsyncGameOfLifeAnim.tla | grep anim | sed 's;anim = ;anim |-> ;g' | xclip

Peek 2020-07-09 17-55

0reactions
lemmycommented, Jun 21, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Markus Kuppe on Twitter: "@lhochstein @jeanqasaur @hillelogram ...
Evaluate alias expression on pair of states s and t in error-trace and printed in place of s ·... TLC now allows the...
Read more >
Prevent bash alias from evaluating statement at shell start
It evaluates pwd as soon as the shell starts. Is there anyway to delay the evaluation of the expression in the ticks until...
Read more >
The variable is set, but the evaluation failed for value ... - IBM
Periodically the following errors appears in your AppCluster SystemOut.log: CWLLG0324W: The variable is set, but the evaluation failed for value expression: ...
Read more >
XDOC — Advanced-features - UT Computer Science
See set-raw-proof-format to make proof output display lists of runes. ... See wet to evaluate a form and print a subsequent error trace....
Read more >
Advanced Tcl - Electrical Engineering @Columbia
It can be tricky to assemble a command so that it is evaluated properly by eval. The same difficulties apply to commands like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found