Skip to content

Commit 3e3269e

Browse files
authored
Merge pull request #6982 from tautschnig/cleanup/cprover-manual
Cleanup CPROVER Manual
2 parents d8f3d49 + 83850e1 commit 3e3269e

23 files changed

+127
-111
lines changed

doc/cprover-manual/api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The functions **\_\_CPROVER\_input** and **\_\_CPROVER\_output** are
3131
used to report an input or output value. Note that they do not generate
3232
input or output values. The first argument is a string constant to
3333
distinguish multiple inputs and outputs (inputs are typically generated
34-
using nondeterminism, as described [here](./modeling-nondeterminism.md)). The
34+
using nondeterminism, as described [here](../modeling/nondeterminism/)). The
3535
string constant is followed by an arbitrary number of values of
3636
arbitrary types.
3737

@@ -159,12 +159,12 @@ int main()
159159

160160
#### Uninterpreted Functions
161161

162-
Uninterpreted functions are documented [here](./modeling-nondeterminism.md)).
162+
Uninterpreted functions are documented [here](../modeling/nondeterminism/)).
163163

164164
### Memory-Related Functions
165165

166166
The semantics of the primitives listed in this section is described in more detail in the
167-
document about [Memory Primitives](http://cprover.diffblue.com/memory-primitives.html).
167+
document about [Memory Primitives](../memory-primitives/).
168168

169169
#### \_\_CPROVER\_POINTER\_OBJECT, \_\_CPROVER\_POINTER\_OFFSET, \_\_CPROVER\_same\_object
170170

@@ -184,7 +184,7 @@ arguments point to the same object.
184184
185185
The following primitives require a pointer that is null or valid in order to
186186
have well-defined semantics in all usage cases. See the document about
187-
[Memory Primitives](http://cprover.diffblue.com/memory-primitives.html)
187+
[Memory Primitives](../memory-primitives/)
188188
for more details. It also includes a description of the `--pointer-primitive-check`
189189
option to verify the preconditions of the primitives.
190190

doc/cprover-manual/cbmc-tutorial.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,6 @@ possible output format.
137137
cbmc file1.c --bounds-check --pointer-check --trace --xml-ui
138138
```
139139

140-
The specification of the XML trace output can be found here: [XML
141-
Specification](../assets/xml_spec.tex)
142-
and can be built by `pdflatex -shell-escape xml_spec.tex`. See the [README
143-
](../assets/README.md#xml_spec.tex) for details.
144-
145-
Alternatively, you can view it in [Markdown](../assets/xml_spec.md).
146-
147140
### Verifying Modules
148141

149142
In the example above, we used a program that starts with a `main`

doc/cprover-manual/contracts-assigns.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[CPROVER Manual TOC](../../)
2+
13
# Assigns Clause
24

35
## In Function Contracts
@@ -135,8 +137,8 @@ where the left-hand-side is in the *free* set are not instrumented with the abov
135137

136138
Assuming _assigns_ clauses are a sound abstraction of the write set for
137139
a given function, CBMC will use the function contract in place of the function
138-
implementation as described by [Requires \& Ensures
139-
Clauses](contracts-requires-and-ensures.md) - Replacement section, and it will add
140+
implementation as described by
141+
[Requires \& Ensures Clauses](../../contracts/requires-and-ensures/#replacement), and it will add
140142
non-deterministic assignments for each object listed in the `__CPROVER_assigns`
141143
clause. Since these objects might be modified by the function, CBMC uses
142144
non-deterministic assignments to havoc them and restrict their values only by

doc/cprover-manual/contracts-decreases.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[CPROVER Manual TOC](../../)
2+
13
# Decreases Clauses
24

35
A _decreases_ clause specifies a measure that must strictly decrease at every iteration of a loop.
@@ -30,7 +32,7 @@ __CPROVER_decreases(n - i)
3032
{ ... }
3133
```
3234
33-
Please see the [invariant clauses](contracts-invariants.md) page
35+
Please see the [invariant clauses](../../contracts/invariants/) page
3436
for more examples on `for` and `do...while` loops.
3537
3638
To help prove termination of more complex loops,
@@ -69,7 +71,7 @@ Decreases clause is not side-effect free. (at: file main.c line 4 function main)
6971

7072
### Semantics
7173

72-
A decreases clause extends the loop abstraction introduced in the [invariants clause](contracts-invariants.md) manual.
74+
A decreases clause extends the loop abstraction introduced in the [invariants clause](../../contracts/invariants/) manual.
7375
In addition to the inductiveness check asserted at the end of a single arbitrary iteration,
7476
CBMC would also assert the strict decrement of the measure specified in the decreases clause.
7577
At a high level, in addition to the assumptions and assertions introduced by the invariant clause,
@@ -166,7 +168,7 @@ int binary_search(int val, int *buf, int size)
166168
The instrumented code points (5), (6), (8), and (9) are specific to the decreases clause.
167169

168170
**Important.**
169-
Decreases clauses work in conjunction with [loop invariants](contract-invariants.md),
171+
Decreases clauses work in conjunction with [loop invariants](../../contracts/invariants/),
170172
which model an arbitrary loop iteration at which the decreases clause is checked.
171173
If a decreases clause is annotated on a loop without an invariant clause,
172174
then the weakest possible invariant (i.e, `true`) is used to model an arbitrary iteration.

doc/cprover-manual/contracts-functions.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[CPROVER Manual TOC](../../)
2+
13
# Function Contracts
24

35
CBMC offers support for function contracts, which includes three basic clauses:
@@ -56,9 +58,9 @@ A function contract has three parts:
5658
In our example, the developer may require from the caller to properly allocate
5759
all arguments, thus, pointers must be valid. We can specify the preconditions of
5860
a function using `__CPROVER_requires` (see [Requires \& Ensures
59-
Clauses](contracts-requires-and-ensures.md) Section for details) and we can
61+
Clauses](../../contracts/requires-and-ensures/) for details) and we can
6062
specify an allocated object using a predicate called `__CPROVER_is_fresh` (see
61-
[Memory Predicate](contracts-memory-predicates.md) Section for details). Thus, for the `sum` function, the set
63+
[Memory Predicate](../../contracts/memory-predicates/) for details). Thus, for the `sum` function, the set
6264
of preconditions are
6365
6466
```c
@@ -67,15 +69,15 @@ __CPROVER_requires(__CPROVER_is_fresh(out, sizeof(*out)))
6769
```
6870

6971
We can use `__CPROVER_ensures` to specify postconditions (see [Requires \&
70-
Ensures Clauses](contracts-requires-and-ensures.md) Section for details). In our
72+
Ensures Clauses](../../contracts/requires-and-ensures/) for details). In our
7173
example, developers can use the built-in construct `__CPROVER_return_value`,
7274
which represents the return value of a function. As postconditions, one may list
7375
possible return values (in this case, either `SUCCESS` or `FAILURE`) as well as
7476
describe the main property of this function: if the function returns `SUCCESS`,
7577
then `*out` stores the result of `a + b`. We can also check that the value in
7678
`*out` will be preserved in case of failure by using `__CPROVER_old`, which
7779
refers to the value of a given object in the pre-state of a function (see
78-
[History Variables](contracts-history-variables.md) Section for details). Thus, for the `sum` function, the
80+
[History Variables](../../contracts/history-variables/) for details). Thus, for the `sum` function, the
7981
set of postconditions are
8082

8183

@@ -87,7 +89,7 @@ __CPROVER_ensures((__CPROVER_return_value == FAILURE) ==> (*out == __CPROVER_old
8789
```
8890
8991
Finally, the _assigns_ clause allows developers to define a frame condition (see
90-
[Assigns Clause](contracts-assigns.md) Section for details).
92+
[Assigns Clause](../../contracts/assigns/) for details).
9193
In general, systems for describing the frame condition of a function
9294
use either writes or modifies semantics; this design is based on the former.
9395
This means that memory not specified by the assigns clause must
@@ -149,8 +151,8 @@ program using contracts.
149151

150152
## Additional Resources
151153

152-
- [Requires \& Ensures Clauses](contracts-requires-and-ensures.md)
153-
- [Assigns Clause](contracts-assigns.md)
154-
- [Memory Predicates](contracts-memory-predicates.md)
155-
- [History Variables](contracts-history-variables.md)
156-
- [Quantifiers](contracts-quantifiers.md)
154+
- [Requires \& Ensures Clauses](../../contracts/requires-and-ensures/)
155+
- [Assigns Clause](../../contracts/assigns/)
156+
- [Memory Predicates](../../contracts/memory-predicates/)
157+
- [History Variables](../../contracts/history-variables/)
158+
- [Quantifiers](../../contracts/quantifiers/)

doc/cprover-manual/contracts-history-variables.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[CPROVER Manual TOC](../../)
2+
13
# History Variables
24

35
## In Function Contracts

doc/cprover-manual/contracts-invariants.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[CPROVER Manual TOC](../../)
2+
13
# Invariant Clauses
24

35
An _invariant_ clause specifies a property that must be preserved
@@ -141,14 +143,14 @@ A few things to note here:
141143
using alias analysis of l-values appearing in the loop body.
142144
However, the analysis is incomplete and may fail to characterize the set for complex loops.
143145
In such cases, the user must manually annotate the set of modified variables
144-
using an [_assigns clause_](contracts-assigns.md).
146+
using an [_assigns clause_](../../contracts/assigns/).
145147

146148
- At instrumented code point (6), when we _assume_ `false`,
147149
observe that this assumption only exists within the `lb <= ub` conditional.
148150
Therefore, only the symbolic execution path _inside_ this conditional block terminates.
149151
The code outside of the conditional block continues to be symbolically executed,
150152
and subsequent assertions do not become vacuously `true`.
151153

152-
[history variables]: contracts-history-variables.md
154+
[history variables]: ../../contracts/history-variables/
153155

154156
[binary search]: https://en.wikipedia.org/wiki/Binary_search_algorithm

doc/cprover-manual/contracts-loops.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[CPROVER Manual TOC](../../)
2+
13
# Loop Contracts
24

35
CBMC offers support for loop contracts, which includes three basic clauses:
@@ -63,7 +65,7 @@ A developer might be interested in verifying two high-level properties on the lo
6365
2. the loop must eventually always terminate
6466
6567
To prove the first (memory-safety) property,
66-
we may declare [_loop invariants_](contracts-invariant.md)
68+
we may declare [_loop invariants_](../../contracts/invariants/)
6769
that must be preserved across all loop iterations.
6870
In this case, two invariant clauses would together imply that `buf[mid]` lookup is always safe.
6971
The first invariant clause would establish that the bounds (`lb` and `ub`) are always valid:
@@ -80,7 +82,7 @@ __CPROVER_loop_invariant(mid == (lb + ub) / 2L)
8082
```
8183
8284
To prove the second (termination) property,
83-
we may declare a [_decreases clause_](contracts-decreases.md)
85+
we may declare a [_decreases clause_](../../contracts/decreases/)
8486
that indicates a bounded numeric measure
8587
which must monotonically decrease with each loop iteration.
8688
In this case, it is easy to see that `lb` and `ub` are approaching closer together with each iteration, since either `lb` must increase or `ub` must decrease in each iteration.
@@ -143,10 +145,10 @@ and finally we verify the instrumented GOTO binary with desired checks.
143145

144146
## Additional Resources
145147

146-
- [Assigns Clause](contracts-assigns.md)
147-
- [Decreases Clause](contracts-decreases.md)
148-
- [History Variables](contracts-history-variables.md)
149-
- [Invariant Clause](contracts-invariant.md)
150-
- [Quantifiers](contracts-quantifiers.md)
148+
- [Assigns Clause](../../contracts/assigns/)
149+
- [Decreases Clause](../../contracts/decreases/)
150+
- [History Variables](../../contracts/history-variables/)
151+
- [Invariant Clause](../../contracts/invariants/)
152+
- [Quantifiers](../../contracts/quantifiers/)
151153

152154
[binary search algorithm]: https://en.wikipedia.org/wiki/Binary_search_algorithm

doc/cprover-manual/contracts-memory-predicates.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[CPROVER Manual TOC](../../)
2+
13
# Memory Predicates
24

35
### Syntax

doc/cprover-manual/contracts-quantifiers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[CPROVER Manual TOC](../../)
2+
13
# Quantifiers
24

35
### Syntax

0 commit comments

Comments
 (0)