Skip to content

Commit 71dad0d

Browse files
author
davidcok
committed
Editing
1 parent 1c6a10b commit 71dad0d

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

tutorial/Constructors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A simple class with a few data fields might have constructors that look like thi
1111

1212
The first constructor simply initializes the fields from the constructor's argument list. The specification for the constructor first requires that the
1313
input values are non-negative and then simply says that after the constructor is finished, the newly constructed object's data fields equal the input
14-
values. The heading `normal_behavior` says that the constructor does not throw any exceptions; it is discussed further [here](MultipleBehaviors).
14+
values. The heading `normal_behavior` says that the constructor does not throw any exceptions; it is discussed further [here](MultipleBehaviors#SpecializedBehaviors).
1515
There is also the modifier `pure`; more on that below.
1616

1717
The second constructor is similar to the first. The specification is perhaps less obvious because of the constructor call (the `this` call) of the first

tutorial/InitiallyConstraint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ which yeilds
3737
{% include_relative T_initially2.out %}
3838
```
3939
Now the first constructor passes verification, but the second one does not. The reason is obvious:
40-
the size we have given for a default rectangle (0 by 0) does not satisfy our desired initially postcondition.
40+
the size we have given for a default rectangle (0 by 0) does not satisfy our desired `initially` postcondition.
4141
We'll have a to pick a different size -- 1x2 perhaps.
4242

4343
## Constraint clauses

tutorial/MultipleBehaviors.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ There are a few points to note:
2121
* There is no order to the behaviors; they can be written in any order that is understandable.
2222
* Every behavior applies on its own and must hold by itself --- there is no if-then-else among them. If a behavior's preconditions hold,
2323
then its postconditions must hold, independent of what any other behavior says.
24-
* The effective precondition for each behavior is the conjunction (with `&&`) of the preconditions for that behavior. The effective precondition for the combination of multiple behaviors is the disjunction (with `||`) of the effective preconditions of the individual behaviors. Consequently, at the point where such a method is called, at least one, but by no means necessarily all, of the behaviors must have an effective precondition that is true.
24+
* The effective precondition for each behavior is the conjunction (with `&&`) of the preconditions for that behavior. The effective precondition for the combination of multiple behaviors is the disjunction (with `|`) of the effective preconditions of the individual behaviors. Consequently, at the point where such a method is called, at least one, but by no means necessarily all, of the behaviors must have an effective precondition that is true.
2525

2626
In our example, if `a`, `b`, and `c` are all equal, then the precondiition (`requires` clause) of each of the three behaviors is true.
2727
So the postconditions of each of the behaviors must also be true. Fortunately they all agree.
@@ -67,18 +67,18 @@ The normal and exceptional behaviors illustrated in the previous section are ver
6767
The `normal_behavior` heading implies that no exception is allowed (`signals false`); the `exceptional_behavior` heading says that normal termination is not allowed (`ensures false`).
6868
A behavior that is neither of these is a simple `behavior`, which is the default when there is no heading.
6969

70-
One other point: any one of the behavior keywords needs a visibility keyword; almost always, as in the example above, the visibility is the same as the method. The absence of a visibility modifier means `package` visibility, just as the absence of a visibility modifier on the method declaration. However, if there is no specialized behavior keyword, then there is no place for the visibility keyword; in that cae, the visibility is the same as the visibility of the method.
70+
One other point: any one of the behavior keywords needs a visibility keyword; almost always, as in the example above, the visibility is the same as the method. The absence of a visibility modifier means `package` visibility, just as the absence of a visibility modifier on the method declaration. However, if there is no specialized behavior keyword, then there is no place for the visibility keyword; in that case, the visibility is the same as the visibility of the method.
7171

72-
## Summary of specification cases
72+
## <a name="SpecializedBehaviors"></a>Summary of specification cases
7373

7474
To summarize, a method may have multiple specification cases.
7575
* They are separated/connected by the `also` keyword.
7676
* Each specification case consists of an optional heading followed by a series of method specification clauses
77-
* There are four styles of headings. Here `V` is a visibility modifier: one of `public`, `protected, `private`, or absent, meaning package visibility
77+
* There are four styles of headings. Here `V` is a visibility modifier: one of `public`, `protected`, `private`, or absent, meaning package visibility
7878
* The most general: `V behavior`
7979
* Normal exit only: `V normal_behavior`
8080
* Exit by exception only: `V exceptional_behavior`
81-
* The most common: no heading, which means `V behavior` with the visibility `V` being the same as the method's visibilty
81+
* The most common: no heading, which means `V behavior` with the visibility `V` being the same as the method's visibility
8282

8383

8484
## Nested clause groups

tutorial/tutorial1.001.png

-5.11 KB
Loading

0 commit comments

Comments
 (0)