tlaplus: Evaluate alias expression on pair of states s and t in error-trace and printed in place of s
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)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 16 (14 by maintainers)
Commits related to this issue
- Let users enter an alias expression on the TLC options page. Part of Github issue: Evaluate alias expression on pair of states s and t in error-trace and printed in place of s #485 https://github.com... — committed to tlaplus/tlaplus by lemmy 6 years ago
- Support overwriting the previous state of a counterexample on the command-line instead of appending to it. `-Dtlc2.output.StatePrinter.overwrite=250` overwrites the previous state after 250ms. [Feat... — committed to tlaplus/tlaplus by lemmy 3 years ago
- Allow an ALIAS to define a Java formatter. The following contrived example defines a formatter that sets the background of the record to green (ANSI color), uses `&&` instead of `/\`, and swaps the k... — committed to tlaplus/tlaplus by lemmy 3 years ago
- Set Java system properties with `TLCSet`. Set TLC's line width to 240 for your spec with: `ASSUME TLCSet("-Dtlc2.value.Values.width", 240)` [Feature][TLC] — committed to tlaplus/tlaplus by lemmy 3 years ago
- Evaluate the ALIAS expression on counterexamples generated by liveness checking while running in simulation mode. Part of Github issue #485 https://github.com/tlaplus/tlaplus/issues/485 [Feature][TL... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Evaluate the ALIAS expression on counterexamples generated by liveness checking while running in simulation mode. Part of Github issue #485 https://github.com/tlaplus/tlaplus/issues/485 [Feature][TL... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Evaluate the ALIAS expression on counterexamples generated by liveness checking while running in simulation mode. Part of Github issue #485 https://github.com/tlaplus/tlaplus/issues/485 [Feature][TL... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Evaluate the ALIAS expression on counterexamples generated by liveness checking while running in simulation mode. Also evaluate the ALIAS on all states that are used by TLCExt!Counterexample. Part o... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Evaluate the ALIAS expression on counterexamples generated by liveness checking while running in simulation mode. Also evaluate the ALIAS on all states that are used by TLCExt!Counterexample. Part o... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Evaluate the ALIAS expression on counterexamples generated by liveness checking while running in simulation mode. Also evaluate the ALIAS on all states that are used by TLCExt!Counterexample. Part o... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Evaluate the ALIAS expression on counterexamples generated by liveness checking while running in simulation mode. Also evaluate the ALIAS on all states that are used by TLCExt!Counterexample. Part o... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Evaluate the ALIAS expression on counterexamples generated by liveness checking while running in simulation mode. Also evaluate the ALIAS on all states that are used by TLCExt!Counterexample. Part o... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Raise warning when symbol appears in Records. However, do NOT raise a warning in cases like the following, which imply that the user understands the semantics correctly: ```tla bar == 23 R == [bar |... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Raise warning when symbol appears in Records. However, do NOT raise a warning in cases like the following, which imply that the user understands the semantics correctly: ```tla bar == 23 R == [bar |... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Raise warning when symbol appears in Records. However, do NOT raise a warning in cases like the following, which imply that the user understands the semantics correctly: ```tla bar == 23 R == [bar |... — committed to tlaplus/tlaplus by lemmy 2 years ago
- Raise warning when symbol appears in Records. However, do NOT raise a warning in cases like the following, which imply that the user understands the semantics correctly: ```tla bar == 23 R == [bar |... — committed to tlaplus/tlaplus by lemmy 2 years ago
FYI this feature is wonderful for debugging refinement mappings.
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