CBMC
Function Contracts Reminder

Back to top Code Contracts Transformation Specification

The user documentation for function contracts is available at Function Contracts, but we briefly remind the developer of the structure of a contract below.

A contract is defined by adding one or more clauses to a function declaration or definition:

ret_t foo(parameters)
// preconditions
__CPROVER_requires(R)
// postconditions
__CPROVER_ensures(E)
// frame conditions
__CPROVER_assigns(A)
__CPROVER_frees(F)
;

For each such function foo carrying contract clauses, the ansi-c front-end of CBMC creates a dedicated function symbol named contract::foo in the symbol table, with the same signature as foo, and attaches the contract clauses to that new symbol. We call contract::foo the pure contract associated with the function foo.


Prev Next
Code Contracts Transformation Specification Program Transformation Overview