hierarchical finite state machine - liveness

72 views
Skip to first unread message

Ryan Dumouchel

unread,
Oct 3, 2023, 10:54:37 PM10/3/23
to tlaplus
I'm trying to adapt one of Hilel Waynes' examples of a hierachical fine state machines.

My liveness property fails in stuttering.  

I want to show that eventually all states are visited

Not sure what I'm missing, any help appreciated

 -------------------------------- MODULE smachine --------------------------------

EXTENDS TLC, Sequences \* For @@

VARIABLE state,  visited


States == {

  "s"

  "s1", "s2",  

    "s11", "s21", "s211"

}


Events == {"A", "B", "C", "D", "E""F", "G", "H"}


TopDown == [s |-> {"s1", "s2", "Reports"}, 

              s1 |-> {"s11"}, s2 |-> {"s21"}, s21 |-> {"s211"}] @@ [s \in States |-> {}]

  

Init == 

  /\ state = "s11"

  /\ visited = {}

  

vars == <<state, visited>>  

Next ==

  /\ \E evt \in Events:

     \/ state = "s11" /\ evt = "G" 

       /\ visited' = {state} \union visited

      

       /\ state' = "s211"

     

     \/ state = "s211" /\ evt = "B"

       /\ visited' = {state} \union visited

    

       /\ state' = "s11"


    


all == {"s11","s211"}

   

EventuallyVisited == <>(visited = all) 



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

AlwaysInLeaf == TopDown[state] = {}


         

Hillel Wayne

unread,
Oct 3, 2023, 11:20:30 PM10/3/23
to tla...@googlegroups.com

Hi Ryan,

Could you please share your .cfg file or a screenshot of your toolbox setup? It's passing for me.


H

--
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/4bffd6a6-3cf5-4efc-8827-8e443301f290n%40googlegroups.com.

Ryan Dumouchel

unread,
Oct 3, 2023, 11:34:15 PM10/3/23
to tlaplus
Hi Hillel, does this work
Screen Shot 2023-10-03 at 11.30.46 PM (2).png

Hillel Wayne

unread,
Oct 4, 2023, 12:34:17 PM10/4/23
to tla...@googlegroups.com

Hi Ryan


The problem is you have "What is the behavior spec" set to "initial predicate and next state relation", which doesn't use fairness. Change it to "temporal formula" and set the formula to "Spec" and it should work.

H

Ryan Dumouchel

unread,
Oct 4, 2023, 5:04:07 PM10/4/23
to tlaplus
Thank you Hillel

It worked.   Your Hfsm example finally made TLA click for me.  
Reply all
Reply to author
Forward
0 new messages