<s>
The	O
Guarded	B-Application
Command	I-Application
Language	I-Application
(	O
GCL	O
)	O
is	O
a	O
programming	O
language	O
defined	O
by	O
Edsger	O
Dijkstra	O
for	O
predicate	B-Application
transformer	I-Application
semantics	I-Application
in	O
EWD472	O
.	O
</s>
<s>
It	O
makes	O
it	O
easier	O
to	O
develop	O
a	O
program	B-Application
and	O
its	O
proof	O
hand-in-hand	O
,	O
with	O
the	O
proof	O
ideas	O
leading	O
the	O
way	O
;	O
moreover	O
,	O
parts	O
of	O
a	O
program	B-Application
can	O
actually	O
be	O
calculated	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
the	O
if-statement	O
,	O
several	O
alternatives	O
may	O
be	O
true	O
,	O
and	O
the	O
choice	O
of	O
which	O
to	O
choose	O
is	O
done	O
at	O
runtime	O
,	O
when	O
the	O
if-statement	O
is	O
executed	B-General_Concept
.	O
</s>
<s>
The	O
guarded	B-Application
command	I-Application
is	O
the	O
most	O
important	O
element	O
of	O
the	O
guarded	B-Application
command	I-Application
language	I-Application
.	O
</s>
<s>
In	O
a	O
guarded	B-Application
command	I-Application
,	O
just	O
as	O
the	O
name	O
says	O
,	O
the	O
command	O
is	O
"	O
guarded	O
"	O
.	O
</s>
<s>
The	O
guard	O
is	O
a	O
proposition	O
,	O
which	O
must	O
be	O
true	O
before	O
the	O
statement	O
is	O
executed	B-General_Concept
.	O
</s>
<s>
Also	O
,	O
if	O
the	O
guard	O
is	O
false	O
,	O
the	O
statement	O
will	O
not	O
be	O
executed	B-General_Concept
.	O
</s>
<s>
The	O
use	O
of	O
guarded	B-Application
commands	I-Application
makes	O
it	O
easier	O
to	O
prove	O
the	O
program	B-Application
meets	O
the	O
specification	B-Application
.	O
</s>
<s>
The	O
statement	O
is	O
often	O
another	O
guarded	B-Application
command	I-Application
.	O
</s>
<s>
skip	O
and	O
abort	O
are	O
important	O
statements	O
in	O
the	O
guarded	B-Application
command	I-Application
language	I-Application
.	O
</s>
<s>
It	O
is	O
used	O
to	O
describe	O
the	O
program	B-Application
when	O
formulating	O
a	O
proof	O
,	O
in	O
which	O
case	O
the	O
proof	O
usually	O
fails	O
.	O
</s>
<s>
It	O
is	O
used	O
in	O
the	O
program	B-Application
itself	O
,	O
when	O
the	O
syntax	O
requires	O
a	O
statement	O
but	O
the	O
state	B-Application
should	O
not	O
change	O
.	O
</s>
<s>
The	O
selection	B-Language
(	O
often	O
called	O
the	O
"	O
conditional	B-Language
statement	O
"	O
or	O
"	O
if	O
statement	O
"	O
)	O
is	O
a	O
list	O
of	O
guarded	B-Application
commands	I-Application
,	O
of	O
which	O
one	O
is	O
chosen	O
to	O
execute	O
.	O
</s>
<s>
If	O
more	O
than	O
one	O
guard	O
is	O
true	O
,	O
one	O
statement	O
whose	O
guard	O
is	O
true	O
is	O
nondeterministically	O
chosen	O
to	O
be	O
executed	B-General_Concept
.	O
</s>
<s>
The	O
statement	O
if	O
fi	O
has	O
no	O
guarded	B-Application
commands	I-Application
,	O
so	O
there	O
is	O
never	O
a	O
true	O
guard	O
.	O
</s>
<s>
Upon	O
execution	O
of	O
a	O
selection	B-Language
all	O
guards	O
are	O
evaluated	O
.	O
</s>
<s>
If	O
none	O
of	O
the	O
guards	O
evaluates	O
to	O
true	O
then	O
execution	O
of	O
the	O
selection	B-Language
aborts	O
,	O
otherwise	O
one	O
of	O
the	O
guards	O
that	O
has	O
the	O
value	O
true	O
is	O
chosen	O
non-deterministically	O
and	O
the	O
corresponding	O
statement	O
is	O
executed	B-General_Concept
.	O
</s>
<s>
In	O
pseudocode	B-Language
:	O
</s>
<s>
In	O
guarded	B-Application
command	I-Application
language	I-Application
:	O
</s>
<s>
In	O
pseudocode	B-Language
:	O
</s>
<s>
In	O
guarded	B-Application
command	I-Application
language	I-Application
:	O
</s>
<s>
Execution	O
of	O
the	O
repetition	O
consists	O
of	O
executing	O
0	O
or	O
more	O
iterations	O
,	O
where	O
an	O
iteration	O
consists	O
of	O
(	O
nondeterministically	O
)	O
choosing	O
a	O
guarded	B-Application
command	I-Application
whose	O
guard	O
evaluates	O
to	O
true	O
and	O
executing	O
the	O
command	O
.	O
</s>
<s>
Execution	O
of	O
the	O
repetition	O
do	O
od	O
,	O
which	O
has	O
no	O
guarded	B-Application
commands	I-Application
,	O
executes	O
0	O
iterations	O
,	O
so	O
do	O
od	O
is	O
equivalent	O
to	O
skip	O
.	O
</s>
<s>
The	O
program	B-Application
keeps	O
on	O
permuting	O
elements	O
while	O
one	O
of	O
them	O
is	O
greater	O
than	O
its	O
successor	O
.	O
</s>
<s>
This	O
non-deterministic	O
bubble	B-Algorithm
sort	I-Algorithm
is	O
not	O
more	O
efficient	O
than	O
its	O
deterministic	O
version	O
,	O
but	O
easier	O
to	O
proof	O
:	O
it	O
will	O
not	O
stop	O
while	O
the	O
elements	O
are	O
not	O
sorted	O
and	O
that	O
each	O
step	O
it	O
sorts	O
at	O
least	O
2	O
elements	O
.	O
</s>
<s>
Not	O
only	O
the	O
computation	O
but	O
also	O
the	O
final	O
state	B-Application
is	O
not	O
necessarily	O
uniquely	O
determined	O
.	O
</s>
<s>
Generalizing	O
the	O
observational	O
congruence	O
of	O
Guarded	B-Application
Commands	I-Application
into	O
a	O
lattice	O
has	O
led	O
to	O
Refinement	B-Application
Calculus	I-Application
.	O
</s>
<s>
This	O
has	O
been	O
mechanized	O
in	O
Formal	B-Architecture
Methods	I-Architecture
like	O
B-Method	B-Application
that	O
allow	O
one	O
to	O
formally	O
derive	O
programs	O
from	O
their	O
specifications	B-Application
.	O
</s>
<s>
allows	O
arbitrary	O
relative	O
delays	O
for	O
the	O
selection	B-Language
of	O
different	O
commands	O
.	O
</s>
<s>
a	O
logic	O
gate	O
driving	O
a	O
node	O
y	O
in	O
the	O
circuit	O
consists	O
of	O
two	O
guarded	B-Application
commands	I-Application
,	O
as	O
follows	O
:	O
</s>
<s>
circuit	O
evaluation	O
models	O
,	O
the	O
repetition	O
for	O
a	O
set	O
of	O
guarded	B-Application
commands	I-Application
(	O
corresponding	O
to	O
an	O
asynchronous	O
circuit	O
)	O
can	O
accurately	O
describe	O
all	O
possible	O
dynamic	O
behaviors	O
of	O
that	O
circuit	O
.	O
</s>
<s>
Guarded	B-Application
commands	I-Application
are	O
used	O
within	O
the	O
Promela	B-Application
programming	O
language	O
,	O
which	O
is	O
used	O
by	O
the	O
SPIN	B-Application
model	I-Application
checker	I-Application
.	O
</s>
<s>
The	O
Perl	O
module	O
implements	O
a	O
deterministic	O
,	O
rectifying	O
variant	O
on	O
Dijkstra	O
's	O
guarded	B-Application
commands	I-Application
.	O
</s>
