Analysis of Nested Loops
How to identify the initializations of inner loops? In Chapter 4, it has been assumed that a loop is immediately preceded by its initialization. Because the syntax of most imperative programming languages does not satisfy this assumption, a method for identifying the initialization statements of inner loops needs to be defined. Identifying the initialization of an outermost loop is not as crucial because the analysis results of this loop are not used in analyzing other loops. Specifications of the whole nested construct can be written relative to the program state just before its start.
How to represent and utilize the analysis results of inner loops? A technique for analyzing flat loops has been described in Chapter 4. Can the same basic technique be used for outer loops (loops containing other loops)? What modifications, if any, need to be performed on the basic analysis technique to analyze outer loops?
How to modify the resulting specifications to facilitate Hoare-style verification ? This problem can be further divided into two subproblems, which are explained using the nested construct shown in Figure 5.1. In this nested construct, let I; and 10 be the invariants of the inner and outer loops, respectively.
Unable to display preview. Download preview PDF.