4
4
5
5
### Iteration-based Unwinding
6
6
7
- The basic idea of CBMC is to model the computation of the programs up to
8
- a particular depth . Technically, this is achieved by a process that
7
+ The basic idea of CBMC is to model a program's execution up to a
8
+ bounded number of steps . Technically, this is achieved by a process that
9
9
essentially amounts to * unwinding loops* . This concept is best
10
10
illustrated with a generic example:
11
11
@@ -47,7 +47,7 @@ The construction above is meant to produce a program that is trace
47
47
equivalent with the original programs for those traces that contain up
48
48
to five iterations of the loop.
49
49
50
- In many cases, CBMC is able to automatically determine an upper bound on
50
+ In many cases, CBMC is able to determine automatically an upper bound on
51
51
the number of loop iterations. This may even work when the number of
52
52
loop unwindings is not constant. Consider the following example:
53
53
@@ -83,12 +83,12 @@ requires a limit of 101, and not 100.
83
83
84
84
The setting given with ` --unwind ` is used globally, that is, for all
85
85
loops in the program. In order to set individual limits for the loops,
86
- first use
86
+ first use:
87
87
88
88
--show-loops
89
89
90
90
to obtain a list of all loops in the program. Then identify the loops
91
- you need to set a separate bound for, and note their loop ID. Then use
91
+ you need to set a separate bound for, and note their loop ID. Then use:
92
92
93
93
--unwindset L:B,L:B,...
94
94
@@ -138,8 +138,7 @@ execution time](http://en.wikipedia.org/wiki/Worst-case_execution_time)
138
138
(WCET).
139
139
140
140
In some cases, it is desirable to cut off very deep loops in favor of
141
- code that follows the loop. As an example, consider the following
142
- program:
141
+ code that follows the loop. As an example, consider this program:
143
142
144
143
```C
145
144
int main() {
@@ -159,18 +158,18 @@ to the later assertion, use the option
159
158
This option will allow paths that execute loops only partially, enabling
160
159
a counterexample for the assertion above even for small unwinding
161
160
bounds. The disadvantage of using this option is that the resulting path
162
- may be spurious, i.e., may not exist in the original program.
161
+ may be spurious, that is, it may not exist in the original program.
163
162
164
163
### Depth-based Unwinding
165
164
166
165
The loop-based unwinding bound is not always appropriate. In particular,
167
166
it is often difficult to control the size of the generated formula when
168
- using the ` --unwind ` option. The option
167
+ using the ` --unwind ` option. The option:
169
168
170
169
--depth nr
171
170
172
171
specifies an unwinding bound in terms of the number of instructions that
173
- are executed on a given path, irrespectively of the number of loop
172
+ are executed on a given path, irrespective of the number of loop
174
173
iterations. Note that CBMC uses the number of instructions in the
175
174
control-flow graph as the criterion, not the number of instructions in
176
175
the source code.
0 commit comments