<s>
Predicate	B-Application
transformer	I-Application
semantics	I-Application
were	O
introduced	O
by	O
Edsger	O
Dijkstra	O
in	O
his	O
seminal	O
paper	O
"	O
Guarded	B-Application
commands	I-Application
,	I-Application
nondeterminacy	I-Application
and	I-Application
formal	I-Application
derivation	I-Application
of	I-Application
programs	I-Application
"	O
.	O
</s>
<s>
They	O
define	O
the	O
semantics	B-Application
of	O
an	O
imperative	B-Application
programming	I-Application
paradigm	O
by	O
assigning	O
to	O
each	O
statement	O
in	O
this	O
language	O
a	O
corresponding	O
predicate	B-Algorithm
transformer	O
:	O
a	O
total	B-Algorithm
function	I-Algorithm
between	O
two	O
predicates	B-Algorithm
on	O
the	O
state	O
space	O
of	O
the	O
statement	O
.	O
</s>
<s>
In	O
this	O
sense	O
,	O
predicate	B-Application
transformer	I-Application
semantics	I-Application
are	O
a	O
kind	O
of	O
denotational	B-Application
semantics	I-Application
.	O
</s>
<s>
Actually	O
,	O
in	O
guarded	B-Application
commands	I-Application
,	O
Dijkstra	O
uses	O
only	O
one	O
kind	O
of	O
predicate	B-Algorithm
transformer	O
:	O
the	O
well-known	O
weakest	B-Application
preconditions	I-Application
(	O
see	O
below	O
)	O
.	O
</s>
<s>
Moreover	O
,	O
predicate	B-Application
transformer	I-Application
semantics	I-Application
are	O
a	O
reformulation	O
of	O
Floyd	O
–	O
Hoare	O
logic	O
.	O
</s>
<s>
Whereas	O
Hoare	O
logic	O
is	O
presented	O
as	O
a	O
deductive	O
system	O
,	O
predicate	B-Application
transformer	I-Application
semantics	I-Application
(	O
either	O
by	O
weakest-preconditions	O
or	O
by	O
strongest-postconditions	O
see	O
below	O
)	O
are	O
complete	O
strategies	O
to	O
build	O
valid	O
deductions	O
of	O
Hoare	O
logic	O
.	O
</s>
<s>
Technically	O
,	O
predicate	B-Application
transformer	I-Application
semantics	I-Application
perform	O
a	O
kind	O
of	O
symbolic	B-General_Concept
execution	I-General_Concept
of	O
statements	O
into	O
predicates	B-Algorithm
:	O
execution	O
runs	O
backward	O
in	O
the	O
case	O
of	O
weakest-preconditions	O
,	O
or	O
runs	O
forward	O
in	O
the	O
case	O
of	O
strongest-postconditions	O
.	O
</s>
<s>
For	O
a	O
statement	O
S	O
and	O
a	O
postcondition	O
R	O
,	O
a	O
weakest	B-Application
precondition	I-Application
is	O
a	O
predicate	B-Algorithm
Q	O
such	O
that	O
for	O
any	O
precondition	O
,	O
if	O
and	O
only	O
if	O
.	O
</s>
<s>
In	O
other	O
words	O
,	O
it	O
is	O
the	O
"	O
loosest	O
"	O
or	O
least	O
restrictive	O
requirement	O
needed	O
to	O
guarantee	O
that	O
R	O
holds	O
after	O
S	O
.	O
Uniqueness	O
follows	O
easily	O
from	O
the	O
definition	O
:	O
If	O
both	O
Q	O
and	O
Q	O
 '	O
are	O
weakest	B-Application
preconditions	I-Application
,	O
then	O
by	O
the	O
definition	O
so	O
and	O
so	O
,	O
and	O
thus	O
.	O
</s>
<s>
We	O
often	O
use	O
to	O
denote	O
the	O
weakest	B-Application
precondition	I-Application
for	O
statement	O
S	O
with	O
repect	O
to	O
a	O
postcondition	O
R	O
.	O
</s>
<s>
We	O
use	O
T	O
to	O
denote	O
the	O
predicate	B-Algorithm
that	O
is	O
everywhere	O
true	O
and	O
F	O
to	O
denote	O
the	O
one	O
that	O
is	O
everywhere	O
false	O
.	O
</s>
<s>
For	O
such	O
scalars	O
we	O
need	O
to	O
do	O
a	O
type	O
coercion	O
such	O
that	O
we	O
have	O
T	O
=	O
predicate(true )	O
and	O
F	O
=	O
predicate(false )	O
.	O
</s>
<s>
This	O
is	O
also	O
the	O
"	O
weakest	B-Application
precondition	I-Application
"	O
,	O
in	O
that	O
it	O
is	O
the	O
"	O
weakest	O
"	O
restriction	O
on	O
the	O
value	O
of	O
x	O
which	O
makes	O
x	O
>	O
10	O
true	O
after	O
the	O
assignment	O
.	O
</s>
<s>
Ignoring	O
termination	O
for	O
a	O
moment	O
,	O
we	O
can	O
define	O
the	O
rule	O
for	O
the	O
weakest	O
liberal	O
precondition	O
,	O
denoted	O
wlp	O
,	O
using	O
a	O
predicate	B-Algorithm
INV	O
,	O
called	O
the	O
loop	B-Application
invariant	I-Application
,	O
typically	O
supplied	O
by	O
the	O
programmer	O
:	O
</s>
<s>
For	O
this	O
we	O
define	O
a	O
well-founded	B-Algorithm
relation	I-Algorithm
on	O
the	O
state	O
space	O
denoted	O
as	O
(	O
wfs	O
,	O
<	O
)	O
and	O
define	O
a	O
variant	O
function	O
vf	O
,	O
such	O
that	O
we	O
have	O
:	O
</s>
<s>
the	O
first	O
one	O
means	O
that	O
the	O
variant	O
must	O
be	O
part	O
of	O
the	O
well-founded	B-Algorithm
relation	I-Algorithm
before	O
entering	O
the	O
loop	O
;	O
</s>
<s>
Actually	O
,	O
Dijkstra	O
's	O
Guarded	B-Application
Command	I-Application
Language	I-Application
(	O
GCL	O
)	O
is	O
an	O
extension	O
of	O
the	O
simple	O
imperative	B-Application
language	I-Application
given	O
until	O
here	O
with	O
non-deterministic	O
statements	O
.	O
</s>
<s>
Refinement	B-Application
calculus	I-Application
extends	O
GCL	O
with	O
the	O
notion	O
of	O
specification	O
statement	O
.	O
</s>
<s>
However	O
,	O
it	O
is	O
very	O
expressive	O
,	O
as	O
pre	O
and	O
post	O
are	O
arbitrary	O
predicates	B-Algorithm
.	O
</s>
<s>
Its	O
weakest	B-Application
precondition	I-Application
is	O
as	O
follows	O
.	O
</s>
<s>
But	O
it	O
enjoys	O
an	O
extremely	O
simple	O
operational	O
view	O
from	O
the	O
weakest	B-Application
precondition	I-Application
perspective	O
,	O
which	O
was	O
unexpected	O
.	O
</s>
<s>
where	O
wpL	O
is	O
the	O
weakest	B-Application
precondition	I-Application
at	O
label	O
L	O
.	O
</s>
<s>
For	O
goto	O
L	O
execution	O
transfers	O
control	O
to	O
label	O
L	O
at	O
which	O
the	O
weakest	B-Application
precondition	I-Application
has	O
to	O
hold	O
.	O
</s>
<s>
The	O
rule	O
does	O
not	O
require	O
the	O
uniqueness	O
for	O
locations	O
where	O
wpL	O
holds	O
within	O
a	O
program	O
,	O
so	O
theoretically	O
it	O
allows	O
the	O
same	O
label	O
to	O
appear	O
in	O
multiple	O
locations	O
as	O
long	O
as	O
the	O
weakest	B-Application
precondition	I-Application
at	O
each	O
location	O
is	O
the	O
same	O
wpL	O
.	O
</s>
<s>
for	O
any	O
initial	O
state	O
satisfying	O
R	O
.	O
In	O
other	O
words	O
,	O
a	O
Hoare	O
triple	O
is	O
provable	O
in	O
Hoare	O
logic	O
if	O
and	O
only	O
if	O
the	O
predicate	B-Algorithm
below	O
hold	O
:	O
</s>
<s>
Leslie	O
Lamport	O
has	O
suggested	O
win	O
and	O
sin	O
as	O
predicate	B-Algorithm
transformers	O
for	O
concurrent	B-Architecture
programming	I-Architecture
.	O
</s>
<s>
This	O
section	O
presents	O
some	O
characteristic	O
properties	O
of	O
predicate	B-Algorithm
transformers	O
.	O
</s>
<s>
Below	O
,	O
S	O
denotes	O
a	O
predicate	B-Algorithm
transformer	O
(	O
a	O
function	O
between	O
two	O
predicates	B-Algorithm
on	O
the	O
state	O
space	O
)	O
and	O
P	O
a	O
predicate	B-Algorithm
.	O
</s>
<s>
Predicate	B-Algorithm
transformers	O
of	O
interest	O
(	O
wp	O
,	O
wlp	O
,	O
and	O
sp	O
)	O
are	O
monotonic	O
.	O
</s>
<s>
A	O
predicate	B-Algorithm
transformer	O
S	O
is	O
monotonic	O
if	O
and	O
only	O
if	O
:	O
</s>
<s>
A	O
predicate	B-Algorithm
transformer	O
S	O
is	O
strict	O
iff	O
:	O
</s>
<s>
The	O
non-strict	O
but	O
monotonic	O
or	O
conjunctive	O
predicate	B-Algorithm
transformers	O
are	O
called	O
miraculous	O
and	O
can	O
also	O
be	O
used	O
to	O
define	O
a	O
class	O
of	O
programming	O
constructs	O
,	O
in	O
particular	O
,	O
jump	O
statements	O
,	O
which	O
Dijkstra	O
cared	O
less	O
about	O
.	O
</s>
<s>
A	O
predicate	B-Algorithm
transformer	O
S	O
is	O
terminating	O
iff	O
:	O
</s>
<s>
Actually	O
,	O
this	O
terminology	O
makes	O
sense	O
only	O
for	O
strict	O
predicate	B-Algorithm
transformers	O
:	O
indeed	O
,	O
is	O
the	O
weakest-precondition	O
ensuring	O
termination	O
of	O
S	O
.	O
</s>
<s>
A	O
predicate	B-Algorithm
transformer	O
S	O
is	O
conjunctive	O
iff	O
:	O
</s>
<s>
A	O
predicate	B-Algorithm
transformer	O
S	O
is	O
disjunctive	O
iff	O
:	O
</s>
<s>
Computations	O
of	O
weakest-preconditions	O
are	O
largely	O
used	O
to	O
statically	O
check	O
assertions	O
in	O
programs	O
using	O
a	O
theorem-prover	O
(	O
like	O
SMT-solvers	B-Application
or	O
proof	O
assistants	O
)	O
:	O
see	O
Frama-C	B-Language
or	O
ESC/Java2	B-Application
.	O
</s>
<s>
Unlike	O
many	O
other	O
semantic	O
formalisms	O
,	O
predicate	B-Application
transformer	I-Application
semantics	I-Application
was	O
not	O
designed	O
as	O
an	O
investigation	O
into	O
foundations	O
of	O
computation	O
.	O
</s>
<s>
Back	O
and	O
others	O
in	O
the	O
refinement	B-Application
calculus	I-Application
.	O
</s>
<s>
Some	O
tools	O
like	O
B-Method	B-Application
now	O
provide	O
automated	O
reasoning	O
in	O
order	O
to	O
promote	O
this	O
methodology	O
.	O
</s>
<s>
In	O
predicate	B-Algorithm
transformers	O
semantics	B-Application
,	O
expressions	O
are	O
restricted	O
to	O
terms	O
of	O
the	O
logic	O
(	O
see	O
above	O
)	O
.	O
</s>
<s>
There	O
are	O
many	O
proposals	O
to	O
extend	O
weakest-preconditions	O
or	O
strongest-postconditions	O
for	O
imperative	B-Application
expression	O
languages	O
and	O
in	O
particular	O
for	O
monads	O
.	O
</s>
<s>
Among	O
them	O
,	O
Hoare	O
Type	O
Theory	O
combines	O
Hoare	O
logic	O
for	O
a	O
Haskell-like	O
language	O
,	O
separation	O
logic	O
and	O
type	O
theory	O
.	O
</s>
<s>
This	O
system	O
is	O
currently	O
implemented	O
as	O
a	O
Coq	B-Application
library	O
called	O
Ynot	O
.	O
</s>
<s>
In	O
this	O
language	O
,	O
evaluation	B-Language
of	I-Language
expressions	I-Language
corresponds	O
to	O
computations	O
of	O
strongest-postconditions	O
.	O
</s>
<s>
Probabilistic	O
Predicate	B-Algorithm
Transformers	O
are	O
an	O
extension	O
of	O
predicate	B-Algorithm
transformers	O
for	O
probabilistic	B-General_Concept
programs	I-General_Concept
.	O
</s>
<s>
distributed	B-Architecture
systems	I-Architecture
(	O
symmetry	O
breaking	O
)	O
.	O
</s>
