LARA

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sav08:summary_of_hoare_logic [2008/03/04 22:31]
vkuncak
sav08:summary_of_hoare_logic [2008/03/05 10:55]
vkuncak
Line 106: Line 106:
 **Theorem:​** If Hoare triple for each basic path is valid, then the Hoare triple $\{Pre\}c\{Post\}$ is valid.  ​ **Theorem:​** If Hoare triple for each basic path is valid, then the Hoare triple $\{Pre\}c\{Post\}$ is valid.  ​
  
-**Proof:** If each basic path is valid, then each path is valid, by induction and Hoare logic rule for sequential composition. ​ Each program is of (potentially infinitely many) paths, so the property ​extends ​(Another explanation:​ consider any given execution and corresponding path in the control-flow graph. ​ By induction on the length of the path we prove that all assert statements hold, up to the last one.)+**Proof:** If each basic path is valid, then each path is valid, by induction and Hoare logic rule for sequential composition. ​ Each program is union of (potentially infinitely many) paths, so the property ​holds for the entire program. ​(Another explanation:​ consider any given execution and corresponding path in the control-flow graph. ​ By induction on the length of the path we prove that all assert statements hold, up to the last one.)
  
 The verification condition of a basic path is the formula whose validity expresses the validity of the Hoare triple for this path. The verification condition of a basic path is the formula whose validity expresses the validity of the Hoare triple for this path.
Line 118: Line 118:
  
 In a program of size $n$, what is the ++bound on the number of basic paths?| it can be $2^{O(n)}$++ In a program of size $n$, what is the ++bound on the number of basic paths?| it can be $2^{O(n)}$++
 +
 +++Choice of annotations?​|If we put annotations after if statements, we avoid exponential explosion.++
 +
  
 ===== Further reading ===== ===== Further reading =====
Line 123: Line 126:
   * [[Calculus of Computation Textbook]], see Section 5.2: Partial Correctness   * [[Calculus of Computation Textbook]], see Section 5.2: Partial Correctness
   * Glynn Winskel: The Formal Semantics of Programming Languages, fourth printing, MIT Press, 1997, see Section 7.4: Verification Conditions   * Glynn Winskel: The Formal Semantics of Programming Languages, fourth printing, MIT Press, 1997, see Section 7.4: Verification Conditions
- 
-