Hoare Logic

Hoare logic is a formal system developed by the British computer scientist C. A. R. Hoare, and subsequently refined by Hoare and other researchers. It was published in Hoare's 1969 paper "An axiomatic basis for computer programming". The purpose of the system is to provide a set of logical rules in order to reason about the correctness of computer programs with the rigour of mathematical logic. Hoare acknowledges earlier contributions from Robert Floyd, who had published a similar system for flowcharts. The central feature of Hoare logic is the Hoare triple. A triple describes how the execution of a piece of code changes the state of the computation. A Hoare triple is of the form
\{P\}\;C\;\{Q\}
where P and Q are assertions and C is a command. P is called the precondition and Q the postcondition. Assertions are formulas in predicate logic. The intuitive reading of such a triple is: Whenever P holds of the state before the execution of C, then Q will hold afterwards. Note that if C does not terminate, then there is no "after", so Q can be any statement at all. Indeed, one can choose Q to be false to express that C does not terminate. This is called "partial correctness". If C terminates and at termination Q is true, the expression exhibits "total correctness". Termination would have to be proved separately. Hoare logic has axioms and inference rules for all the constructs of a simple imperative programming language. The assignment axiom states that after the assignment any predicate holds for the variable that was previously true for the right-hand side of the assignment:
\frac{}{\{PE/x\}\ x:=E \ \{P\} }
An example of a valid triple is:
\{ x = 42\} \ y:=x + 1\ \{y =43 \wedge x= 42\}

See also

References

 

<< PreviousWord BrowserNext >>
inventory
bjrnstjerne bjrnson
excel
anselm
atmospheric pressure demonstration
louis lazare hoche
verdens gang
sudbury valley school
surface to air missile
cannon fire
music of norway
msf
msf time signal
iserlohn
bloodhound
raymond keene
david souter
mikoyan gurevich mig 15
clock signal
washington heights
chlorin
u.s. generally accepted accounting principles
nova scotia technical college
how to make a transformer
flour bomb
petroleum geology
list of companies traded at nasdaq
mickey finn
mach's principle
de havilland comet
sedimentary basin
magnetohydrodynamic drive
lithification
to sir, with love
john shirley
ron grainer
greater flamingo
porosity
johnson nyquist noise
ernesto nazareth
may sexton
macintosh iifx
basin modelling
conrad iv of germany