-- file: searchCommand.mod -- counter mod! COUNTER { [ Counter ] op 0 : -> Counter {constr} op s_ : Counter -> Counter {constr} pred _<_ : Counter Counter vars C C' : Counter eq 0 < 0 = false . eq 0 < s C = true . eq s C < 0 = false . eq s C < s C' = C < C' . } mod! READERS-WRITERS { pr(COUNTER) -- configuration: representation of state [ Config ] op <_,_> : Counter Counter -> Config { constr } . -- < readers, writers > -- the following four transitions rules -- are specifying a READERS-WRITERS policy vars R W : Counter . -- can start to write if no readers and no writers trans [+w] : < 0, 0 > => < 0, s 0 > . -- can start to read if no writers trans [+r] : < R, 0 > => < s R, 0 > . -- can stop reading anytime trans [-r] : < s R, W > => < R, W > . -- can stop writing anytime trans [-w] : < R, s W > => < R, W > . } -- basic search commands -- "show path " command -- "show sch graph" -- "set exec trace on" open READERS-WRITERS red < 0, 0 > =(2,3)=>* C:Config . red < 0, 0 > =(2,3)=>* < R:Counter, s 0 > . red < 0, 0 > =(2,3)=>+ C:Config . red < 0, 0 > =(2,3)=>+ < R:Counter, s 0 > . red < 0, 0 > =(2,3)=>! C:Config . red < 0, 0 > =(2,3)=>! < R:Counter, s 0 > . op stop : -> Config . trans [stop] : < R:Counter, W:Counter > => stop . red < 0, 0 > =(1,2)=>! C:Config . red < 0, 0 > =(10,2)=>* C:Config . show path 4 show sch graph set exec trace on red < 0, 0 > =(10,2)=>* C:Config . set exec trace off close -- suchThat condition open READERS-WRITERS red < 0, 0 > =(2,3)=>* < R:Counter, W:Counter > suchThat R < W . red < 0, 0 > =(2,3)=>* < R:Counter, W:Counter > suchThat W < R . close -- withStateEq predicate open READERS-WRITERS pred _=c=_ : Config Config . var C : Config . vars R1 R2 W1 W2 : Counter . eq (C =c= C) = true . eq (< s s R1,W1 > =c= < s 0,W1 >) = true . -- withStateEq red < 0, 0 > =(5,3)=>* < R:Counter, W:Counter > withStateEq (C1:Config =c= C2:Config) . show sch graph red < 0, 0 > =(*,*)=>* < R:Counter, W:Counter > withStateEq (C1:Config =c= C2:Config) . set exec trace on red < 0, 0 > ==>* < R:Counter, W:Counter > withStateEq (C1:Config =c= C2:Config) . set exec trace off -- suchThat and withStateEq red < 0, 0 > =(5,3)=>* < R:Counter, W:Counter > suchThat (W < R) withStateEq (C1:Config =c= C2:Config) . red < 0, 0 > ==>* < R:Counter, W:Counter > suchThat (W < R) withStateEq (C1:Config =c= C2:Config) . close eof -- abbreviated search commands -- eq (CXU ==>1 CYU) = (CXU =(1,*)=>+ CYU) . -- eq (CXU ==>* CYU) = (CXU =(*,*)=>* CYU) . -- eq (CXU ==>! CYU) = (CXU =(*,*)=>! CYU) . -- eq (CXU ==>+ CYU) = (CXU =(*,*)=>+ CYU) . open READERS-WRITERS red < 0, 0 > ==>1 < 0, 0 > . red < 0, 0 > ==>1 < 0, s 0 > . red < 0, 0 > ==>* < 0, 0 > . red < 0, 0 > ==>* < 0, s 0 > . red < 0, 0 > ==>! < 0, 0 > . red < 0, 0 > ==>! < 0, s 0 > . red < 0, 0 > ==>+ < 0, 0 > . red < 0, 0 > ==>+ < 0, s 0 > . close