-- ======================================================================== -- QLOCK Simulation by Search -- ======================================================================== -- ======================================================================== require qlock-sys -- ======================================================================== mod SIMbySearch {pr(QLOCKsys) -- Aid literals [AidLt < Aid] -- an equation for literals of sort AidLt eq (B1:AidLt = B2:AidLt) = (B1 == B2) . -- arbitrary Aid literals ops b1 b2 b3 b4 b5 b6 : -> AidLt . -- mutual exclusion property: at most one agent is in the critical section -- this is the goal predicate pred mx_ : As . eq (mx empS) = true . eq (mx (A:Aid AS:As)) = (AS = empS) . } select SIMbySearch . --> search all reachable states with one agent red [empQ r b1 w empS c empS] =(*,*)=>* S:State . #| [ empQ r b1 w empS c empS ] [ b1 r empS w b1 c empS ] [ b1 r empS w empS c b1 ] |# --> search all reachable states with two agents red [empQ r (b1 b2) w empS c empS] =(*,*)=>* S:State . #| [ empQ r (b1 b2) w empS c empS ] [ b1 r b2 w b1 c empS ] [ b2 r b1 w b2 c empS ] [ b1 r b2 w empS c b1 ] [ b2 r b1 w empS c b2 ] [ (b1 | b2) r empS w (b2 b1) c empS ] [ (b2 | b1) r empS w (b1 b2) c empS ] [ (b1 | b2) r empS w b2 c b1 ] [ (b2 | b1) r empS w b1 c b2 ] |# --> search all reachable states with three agents red [empQ r (b1 b2 b3) w empS c empS] =(*,*)=>* S:State . #| [ empQ r (b1 b2 b3) w empS c empS ] [ b1 r (b2 b3) w b1 c empS ] [ b2 r (b1 b3) w b2 c empS ] [ b3 r (b1 b2) w b3 c empS ] [ b1 r (b2 b3) w empS c b1 ] [ b2 r (b1 b3) w empS c b2 ] [ b3 r (b1 b2) w empS c b3 ] [ (b1 | b2) r b3 w (b2 b1) c empS ] [ (b1 | b3) r b2 w (b3 b1) c empS ] [ (b2 | b1) r b3 w (b1 b2) c empS ] [ (b2 | b3) r b1 w (b3 b2) c empS ] [ (b3 | b1) r b2 w (b1 b3) c empS ] [ (b3 | b2) r b1 w (b2 b3) c empS ] [ (b1 | b2) r b3 w b2 c b1 ] [ (b1 | b3) r b2 w b3 c b1 ] [ (b2 | b1) r b3 w b1 c b2 ] [ (b2 | b3) r b1 w b3 c b2 ] [ (b3 | b1) r b2 w b1 c b3 ] [ (b3 | b2) r b1 w b2 c b3 ] [ (b1 | b2 | b3) r empS w (b3 b2 b1) c empS ] [ (b1 | b3 | b2) r empS w (b2 b3 b1) c empS ] [ (b2 | b1 | b3) r empS w (b3 b1 b2) c empS ] [ (b2 | b3 | b1) r empS w (b1 b3 b2) c empS ] [ (b3 | b1 | b2) r empS w (b2 b1 b3) c empS ] [ (b3 | b2 | b1) r empS w (b1 b2 b3) c empS ] [ (b1 | b2 | b3) r empS w (b3 b2) c b1 ] [ (b1 | b3 | b2) r empS w (b2 b3) c b1 ] [ (b2 | b1 | b3) r empS w (b3 b1) c b2 ] [ (b2 | b3 | b1) r empS w (b1 b3) c b2 ] [ (b3 | b1 | b2) r empS w (b2 b1) c b3 ] [ (b3 | b2 | b1) r empS w (b1 b2) c b3 ] |# --> check whether mutual exclusion property holds for --> all reachable states with 2 agents red not([empQ r (b1 b2) w empS c empS] =(*,*)=>* [AQ:Aq r ASr:As w ASw:As c ASc:As] suchThat (not(mx ASc))) . --> check whether mutual exclusion property holds for --> all reachable states with 3 agents red not([empQ r (b1 b2 b3) w empS c empS] =(*,*)=>* [AQ:Aq r ASr:As w ASw:As c ASc:As] suchThat (not(mx ASc))) . --> check whether mutual exclusion property holds for --> all reachable states with 4 agents red not([empQ r (b1 b2 b3 b4) w empS c empS] =(*,*)=>* [AQ:Aq r ASr:As w ASw:As c ASc:As] suchThat (not(mx ASc))) . --> check whether mutual exclusion property holds for --> all reachable states with 5 agents red not([empQ r (b1 b2 b3 b4 b5) w empS c empS] =(*,*)=>* [AQ:Aq r ASr:As w ASw:As c ASc:As] suchThat (not(mx ASc))) . --> check whether mutual exclusion property holds for --> all reachable states with 6 agents red not([empQ r (b1 b2 b3 b4 b5 b6) w empS c empS] =(*,*)=>* [AQ:Aq r ASr:As w ASw:As c ASc:As] suchThat (not(mx ASc))) . -- ======================================================================== eof