1
1
[ CPROVER Manual TOC] ( ../ )
2
2
3
- ## The CPROVER API Reference
3
+ # The CPROVER API Reference
4
4
5
5
The following sections summarize the functions available to programs
6
6
that are passed to the CPROVER tools.
7
7
8
- ### Functions
8
+ ## Functions
9
9
10
- #### \_\_ CPROVER\_ assume, \_\_ CPROVER\_ assert, assert
10
+ ### \_\_ CPROVER\_ assume, \_\_ CPROVER\_ assert, assert
11
11
12
12
``` C
13
13
void __CPROVER_assume (_ Bool assumption);
@@ -20,7 +20,7 @@ to the program. If the expression evaluates to false, the execution
20
20
aborts without failure. More detail on the use of assumptions is in the
21
21
section on [Assumptions](../modeling/assumptions/).
22
22
23
- #### \_\_CPROVER\_input, \_\_CPROVER\_output
23
+ ### \_\_CPROVER\_input, \_\_CPROVER\_output
24
24
25
25
```C
26
26
void __CPROVER_input(const char *id, ...);
@@ -35,7 +35,7 @@ using nondeterminism, as described [here](../modeling/nondeterminism/)). The
35
35
string constant is followed by an arbitrary number of values of
36
36
arbitrary types.
37
37
38
- #### \_\_ CPROVER\_ printf
38
+ ### \_\_ CPROVER\_ printf
39
39
40
40
``` C
41
41
void __CPROVER_printf (const char * format, ...);
@@ -45,7 +45,7 @@ The function **\_\_CPROVER\_printf** implements the C `printf` function (without
45
45
any return value). The observable effect is that its output is shown within a
46
46
counterexample trace.
47
47
48
- #### \_\_CPROVER\_cover
48
+ ### \_\_CPROVER\_cover
49
49
50
50
```C
51
51
void __CPROVER_cover(_Bool condition);
@@ -54,7 +54,7 @@ void __CPROVER_cover(_Bool condition);
54
54
This statement defines a custom coverage criterion, for usage with the
55
55
[ test suite generation feature] ( ../test-suite/ ) .
56
56
57
- #### \_\_ CPROVER\_ isnan, \_\_ CPROVER\_ isfinite, \_\_ CPROVER\_ isinf, \_\_ CPROVER\_ isnormal, \_\_ CPROVER\_ sign
57
+ ### \_\_ CPROVER\_ isnan, \_\_ CPROVER\_ isfinite, \_\_ CPROVER\_ isinf, \_\_ CPROVER\_ isnormal, \_\_ CPROVER\_ sign
58
58
59
59
``` C
60
60
_Bool __CPROVER_isnan (double f);
@@ -83,7 +83,7 @@ number.
83
83
This function **\_\_CPROVER\_sign** returns true if the double-precision
84
84
floating-point number passed as argument is negative.
85
85
86
- #### \_\_CPROVER\_abs, \_\_CPROVER\_labs, \_\_CPROVER\_fabs, \_\_CPROVER\_fabsl, \_\_CPROVER\_fabsf
86
+ ### \_\_CPROVER\_abs, \_\_CPROVER\_labs, \_\_CPROVER\_fabs, \_\_CPROVER\_fabsl, \_\_CPROVER\_fabsf
87
87
88
88
```C
89
89
int __CPROVER_abs(int x);
@@ -95,7 +95,7 @@ float __CPROVER_fabsf(float x);
95
95
96
96
These functions return the absolute value of the given argument.
97
97
98
- #### \_\_ CPROVER\_ overflow\_ minus, \_\_ CPROVER\_ overflow\_ mult, \_\_ CPROVER\_ overflow\_ plus, \_\_ CPROVER\_ overflow\_ shl, \_\_ CPROVER\_ overflow\_ unary\_ minus
98
+ ### \_\_ CPROVER\_ overflow\_ minus, \_\_ CPROVER\_ overflow\_ mult, \_\_ CPROVER\_ overflow\_ plus, \_\_ CPROVER\_ overflow\_ shl, \_\_ CPROVER\_ overflow\_ unary\_ minus
99
99
100
100
``` C
101
101
__CPROVER_bool __CPROVER_overflow_minus ();
@@ -111,7 +111,7 @@ operation would overflow when applied to the arguments. For example,
111
111
` __CPROVER_overflow_plus(x, y) ` returns true if ` x + y ` would result in an
112
112
arithmetic overflow.
113
113
114
- #### \_\_ CPROVER\_ array\_ equal, \_\_ CPROVER\_ array\_ copy, \_\_ CPROVER\_ array\_ set
114
+ ### \_\_ CPROVER\_ array\_ equal, \_\_ CPROVER\_ array\_ copy, \_\_ CPROVER\_ array\_ set
115
115
116
116
``` C
117
117
_Bool __CPROVER_array_equal (const void array1[ ] , const void array2[ ] );
@@ -126,7 +126,7 @@ the array **dest**. The function **\_\_CPROVER\_array\_set** initializes
126
126
the array **dest** with the given value.
127
127
128
128
129
- #### \_\_CPROVER\_enum\_is\_in\_range
129
+ ### \_\_CPROVER\_enum\_is\_in\_range
130
130
131
131
```C
132
132
__CPROVER_bool __CPROVER_enum_is_in_range();
@@ -157,16 +157,16 @@ int main()
157
157
```
158
158
159
159
160
- #### Uninterpreted Functions
160
+ ## Uninterpreted Functions
161
161
162
- Uninterpreted functions are documented [ here] ( ../modeling/nondeterminism/ ) ) .
162
+ Uninterpreted functions are documented [ here] ( ../modeling/nondeterminism/ ) .
163
163
164
- ### Memory-Related Functions
164
+ ## Memory-Related Functions
165
165
166
166
The semantics of the primitives listed in this section is described in more detail in the
167
167
document about [ Memory Primitives] ( ../memory-primitives/ ) .
168
168
169
- #### \_\_ CPROVER\_ POINTER\_ OBJECT, \_\_ CPROVER\_ POINTER\_ OFFSET, \_\_ CPROVER\_ same\_ object
169
+ ### \_\_ CPROVER\_ POINTER\_ OBJECT, \_\_ CPROVER\_ POINTER\_ OFFSET, \_\_ CPROVER\_ same\_ object
170
170
171
171
``` C
172
172
__CPROVER_size_t __CPROVER_POINTER_OBJECT (const void * p);
@@ -180,7 +180,7 @@ offset of the given pointer relative to the base address of the object. The
180
180
function **\_\_CPROVER\_same\_object** returns true if the two pointers given as
181
181
arguments point to the same object.
182
182
183
- #### \_\_CPROVER\_OBJECT\_SIZE, \_\_CPROVER\_DYNAMIC\_OBJECT, \_\_CPROVER\_r\_ok, \_\_CPROVER\_w\_ok
183
+ ### \_\_CPROVER\_OBJECT\_SIZE, \_\_CPROVER\_DYNAMIC\_OBJECT, \_\_CPROVER\_r\_ok, \_\_CPROVER\_w\_ok
184
184
185
185
The following primitives require a pointer that is null or valid in order to
186
186
have well-defined semantics in all usage cases. See the document about
@@ -211,7 +211,7 @@ returns true when it is safe to do both. These predicates can be given an
211
211
optional size; when the size argument is not given, the size of the subtype
212
212
(which must not be ** void** ) of the pointer type is used.
213
213
214
- #### \_\_ CPROVER\_ havoc\_ object
214
+ ### \_\_ CPROVER\_ havoc\_ object
215
215
216
216
217
217
This function requires a valid pointer and updates ** all bytes** of the
@@ -243,7 +243,7 @@ __CPROVER_assert(thefoo.y == 2, "fails because `thefoo.y` is now nondet");
243
243
__CPROVER_assert(thefoo.z == 3, "fails because `thefoo.z` is now nondet");
244
244
```
245
245
246
- #### \_\_ CPROVER\_ havoc\_ slice
246
+ ### \_\_ CPROVER\_ havoc\_ slice
247
247
248
248
This function requires requires that ` __CPROVER_w_ok(p, size) ` holds,
249
249
and updates ` size ` consecutive bytes of the underlying object, starting at ` p ` ,
@@ -262,9 +262,9 @@ void __CPROVER_havoc_slice(void *p, __CPROVER_size_t size);
262
262
by the program, then havocing the slice is equivalent to making the
263
263
interpretation of these bytes nondeterministic.
264
264
265
- ### Predefined Types and Symbols
265
+ ## Predefined Types and Symbols
266
266
267
- #### \_\_CPROVER\_bitvector
267
+ ### \_\_CPROVER\_bitvector
268
268
269
269
```C
270
270
__CPROVER_bitvector [ expression ]
@@ -275,7 +275,7 @@ bit vector with arbitrary but fixed size. The usual integer type
275
275
modifiers ** signed** and ** unsigned** can be applied. The usual
276
276
arithmetic promotions will be applied to operands of this type.
277
277
278
- #### \_\_ CPROVER\_ floatbv
278
+ ### \_\_ CPROVER\_ floatbv
279
279
280
280
``` C
281
281
__CPROVER_floatbv [ expression ] [ expression ]
@@ -287,7 +287,7 @@ parameter is the total size (in bits) of the number, and the second is
287
287
the size (in bits) of the mantissa, or significand (not including the
288
288
hidden bit, thus for single precision this should be 23).
289
289
290
- #### \_\_ CPROVER\_ fixedbv
290
+ ### \_\_ CPROVER\_ fixedbv
291
291
292
292
``` C
293
293
__CPROVER_fixedbv [ expression ] [ expression ]
@@ -298,51 +298,51 @@ fixed-point bit vector with arbitrary but fixed size. The first
298
298
parameter is the total size (in bits) of the type, and the second is the
299
299
number of bits after the radix point.
300
300
301
- #### \_\_ CPROVER\_ size\_ t
301
+ ### \_\_ CPROVER\_ size\_ t
302
302
303
303
The type of sizeof expressions.
304
304
305
- #### \_\_ CPROVER\_ rounding\_ mode
305
+ ### \_\_ CPROVER\_ rounding\_ mode
306
306
307
307
``` C
308
308
extern int __CPROVER_rounding_mode;
309
309
```
310
310
311
311
This variable contains the IEEE floating-point arithmetic rounding mode.
312
312
313
- #### \_\_ CPROVER\_ constant\_ infinity\_ uint
313
+ ### \_\_ CPROVER\_ constant\_ infinity\_ uint
314
314
315
315
This is a constant that models a large unsigned integer.
316
316
317
- #### \_\_ CPROVER\_ integer, \_\_ CPROVER\_ rational
317
+ ### \_\_ CPROVER\_ integer, \_\_ CPROVER\_ rational
318
318
319
319
** \_\_ CPROVER\_ integer** is an unbounded, signed integer type.
320
320
** \_\_ CPROVER\_ rational** is an unbounded, signed rational number type.
321
321
322
- #### \_\_ CPROVER\_ memory
322
+ ### \_\_ CPROVER\_ memory
323
323
324
324
``` C
325
325
extern unsigned char __CPROVER_memory[];
326
326
```
327
327
328
328
This array models the contents of integer-addressed memory.
329
329
330
- #### \_\_ CPROVER::unsignedbv< ; N> ; (C++ only)
330
+ ### \_\_ CPROVER::unsignedbv< ; N> ; (C++ only)
331
331
332
332
This type is the equivalent of ** unsigned \_\_ CPROVER\_ bitvector\[ N\] **
333
333
in the C++ front-end.
334
334
335
- #### \_\_ CPROVER::signedbv< ; N> ; (C++ only)
335
+ ### \_\_ CPROVER::signedbv< ; N> ; (C++ only)
336
336
337
337
This type is the equivalent of ** signed \_\_ CPROVER\_ bitvector\[ N\] ** in
338
338
the C++ front-end.
339
339
340
- #### \_\_ CPROVER::fixedbv< ; N> ; (C++ only)
340
+ ### \_\_ CPROVER::fixedbv< ; N> ; (C++ only)
341
341
342
342
This type is the equivalent of ** \_\_ CPROVER\_ fixedbv\[ N,m\] ** in the
343
343
C++ front-end.
344
344
345
- ### Concurrency
345
+ ## Concurrency
346
346
347
347
Asynchronous threads are created by preceding an instruction with a
348
348
label with the prefix ** \_\_ CPROVER\_ ASYNC\_ ** .
0 commit comments