REFINEMENT ServerR
/* This is a proper refinement of Server. ProB will not find a counter example. */
/* To do refinement checking: Explore the entire state space of Server.mch (e.g. using
   model check and then "Save for Later Refinement Check" in ProB Tcl/Tk) and then
   use "Trace Refinement Check..." in the Verify menu and select the entry for Server */
REFINES Server

SETS
  SessionID = {sid1,sid2,sid3}
  
VARIABLES
  session
  
INVARIANT
  session : Process +-> SessionID &
   logged_in = dom(session)
  
INITIALISATION
  session := {}
  
OPERATIONS

  LogIn(pp) =
    PRE pp: Process & pp /: dom(session) THEN
     ANY sid WHERE sid: SessionID & sid /: ran(session) THEN
      session := session \/ {pp |-> sid}
     END
    END;
    
  LogOut(pp) =
    PRE pp: Process & pp: dom(session) THEN
      session := {pp} <<| session 
    END
    
END
