Skip to content

Commit afcf29a

Browse files
committed
Fix main.lnt template
A deadlocked state is a spurious one iff. there is at least one "running" agent (ie. one with pc[0] != 0)
1 parent 6f76596 commit afcf29a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

LabsTranslate/templates/lnt/main.lnt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ function canProceed(a: Agent): Bool is
8282
end var
8383
end function
8484

85+
function existsRunningAgent(sys: Sys): Bool is
86+
var check: Bool, n: Nat in
87+
check := false;
88+
for n := 0 while ((n < MAXCOMPONENTS) and (not(check))) by n := n + 1 loop
89+
check := check or not(sys.agents[n].pc[0] == 0)
90+
end loop;
91+
return check
92+
end var
93+
end function
94+
8595
function existsEnabledAgent (sys: Sys): Bool is
8696
var check: Bool, n: Nat in
8797
check := false;
@@ -125,7 +135,7 @@ process MAIN [{%- if simulation -%}o:Any, {% endif %}monitor:any] is
125135
{%- if simulation -%}
126136
o(sys);
127137
{%- endif -%}
128-
if not(existsEnabledAgent(sys)) and not(existsSystemTransition(sys)) then
138+
if existsRunningAgent(sys) and not(existsEnabledAgent(sys)) and not(existsSystemTransition(sys)) then
129139
monitor("deadlock"); --vacuous pass
130140
stop
131141
end if;

0 commit comments

Comments
 (0)