14.09.2014 Views

Sémantique Axiomatique ou Logique de Hoare - Ensiie

Sémantique Axiomatique ou Logique de Hoare - Ensiie

Sémantique Axiomatique ou Logique de Hoare - Ensiie

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The rule (axiom) for the assignment statement<br />

{P[x ← e]}x := e{P}<br />

P[x → e] : it is the formula P where all the free occurrences of x<br />

are replaced by e.<br />

e.g. x > 1[x ← x + 1] is x + 1 > 1.<br />

Assignments change the state so we expect <strong>Hoare</strong> triples for<br />

assignments always to reflect that change.<br />

The meaning of this rule is clearer when read from right to left.<br />

Intuition :<br />

If we want x to have some property Q after the assignment, then<br />

that property must hold for the value (e) being assigned to x<br />

before the assignment is executed.<br />

{(x +1) > 5} x := x+1 {x > 5} is an instance of the assignment<br />

axiom<br />

(ENSIIE) <strong>Hoare</strong> 17 / 52

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!