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 : 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: : An example of a valid triple is: :
See also
References
- C. A. R. Hoare. "An axiomatic basis for computer programming". Communications of the ACM, 12(10):576-585, October 1969. http://doi.acm.org/10.1145/363235.363259
- Robert D. Tennent: "Specifying Software" (a recent textbook that includes an introduction to Hoare logic) Order: ISBN 0-521-00401-2 http://www.cs.queensu.ca/home/specsoft/
oare logic
Hare logic
Hore logic
Hoae logic
Hoar logic
Hoarelogic
Hoare ogic
Hoare lgic
Hoare loic
Hoare logc
Hoare logi
oHare logic
Haore logic
Horae logic
Hoaer logic
Hoar elogic
Hoarel ogic
Hoare olgic
Hoare lgoic
Hoare loigc
Hoare logci
Hoare logi
HHoare logic
Hooare logic
Hoaare logic
Hoarre logic
Hoaree logic
Hoare logic
Hoare llogic
Hoare loogic
Hoare loggic
Hoare logiic
Hoare logicc
oare logic
hare logic
hore logic
hoae logic
hoar logic
hoarelogic
hoare ogic
hoare lgic
hoare loic
hoare logc
hoare logi
ohare logic
haore logic
horae logic
hoaer logic
hoar elogic
hoarel ogic
hoare olgic
hoare lgoic
hoare loigc
hoare logci
hoare logi
hhoare logic
hooare logic
hoaare logic
hoarre logic
hoaree logic
hoare logic
hoare llogic
hoare loogic
hoare loggic
hoare logiic
hoare logicc