## Deduction system

We expect by the discussion above that the new syntactic element, the atomic region, can be handled in a straightforward manner in a calculus aiming to treat partial or total correctness formulas. This is indeed the case, as the rule of atomic regions defined below shows.

As to the proof outlines, the atomic region rule can be transformed without problem.

where is a proof outline obtained from S.

The situation becomes more complicated when we consider the case of parallel composition. In the shared variable case parallel composition is no more compositional, that is, we cannot infer for the partial correctness of a formula containing a parallel composition by the partial correctness of its components. A simple example is again the case of Example 108. The statements

are true for every . We cannot assert, however,

Thus the disjoint parallel rule is nor appropriate in this case. As we have pointed out earlier, the problem is caused by interfering components. Thus, the solution proposed by Owicki and Gries ([9]) was to eliminate this entanglement of proofs due to interference. This leads us to the notion of interference freedom. From now on we deal with proof outlines instead of deduction trees. In the case of shared variable parallelism, a proof outline is standard if, except for the main program C, every normal subprogram T of C is preceded by exactly one annotation . Moreover, for any two the consecutive annotations and , either or . As before, if the standard proof outline is preceded with two assertions and , for some T, such that holds, then we omit .

Definition 116.

1. Let be a standard proof outline for a component C of a parallel program S. Assume R is a subprogram of S with precondition . We say that R does not interfere with if, for all assertions in ,

is valid in the sense of partial correctness.

2. Let be a parallel program. Then a standard proof outline for the partial correctness assertion is inference free if no normal assignment or atomic region of the proof outline belonging to interferes with provided , and are the corresponding standard proof outlines for .

Example 117. ([1]) Consider the program and the standard proof outlines

;

and

;

Then, for example, does not interfere with the second proof outline, for and . The case for is similar. Thus, the above two proof outlines are interference free.

We formulate below the rule for parallelism with shared variable :

where are interference free standard proof outlines corresponding to .

Observe that the rule is the same as that of for disjoint parallelism apart from the fact that interference free proof outlines are taken into consideration. In some occasions, we may abbreviate the proof outline obtained by the rule by exchanging the composition of proof outlines in the conclusion for the composition of the components .

Example 118. Consider the program of Example 117. Since the proof outlines and presented there are interference free, we can conclude, by rule , that is a valid proof outline.

Example 119. ([1]) Consider the proof outline

;

for the partial correctness assertion . Let us also consider the proof outline

;

It can be checked that the two proof outlines are interference free. For example, is true. Then is a valid partial correctness assertion. Observe that taking the proof outline of Example 117 for the partial correctness assertion would not give interference free proof outlines. This is in accordance with our knowledge that is not a valid partial correctness formula. Finally, let us exchange in the previous formula for the atomic region . Let us formulate the proof outlines

;

and

;

Then the two proof outlines are interference free. For example, . We can infer, that in this case is valid.

In the examples above, we alluded to statements which can be considered as consequences of the soundness of the above proof system. After a short interlude, we will take up this question again.

The two main criteria in finding the rules of a deduction system is the soundness and completeness of the system. That is, the system be conceived in a way to not allow the deduction of false statements, and, on the other hand, it would be advisable if it was capable to deduce as much of the true formulas as it is theoretically possible. A not too difficult argument shows (cf. [1]) that, if we augment the rules for partial correctness of while programs with the parallelism with shared variable rule, the proof system is not strong enough to deduce the formula

On the other hand, if we introduce a new variable indicating whether the incrementation by two has taken part, the auxiliary variable rule will help us out in this case, too. Let us consider the proof outline

If we add the auxiliary variable rule to our deduction system, then Assertion (4.1) can also be proved, since is a set of auxiliary variables. To prove the proof outline above, let us take the following standard proof outlines:

and

We have to check now that the above two proof outlines are interference free. For example,

Now rule applies and we obtain

Moreover, trivially holds, thus, the composition rule gives the result. Note that the atomicity of was crucial in the proof, without it the partial correctness assertion would not have been valid.

A natural question arises whether it can be planned ahead how to add auxiliary variables to achieve the proof of a correctness formula. In ([7]), Lamport has shown that there is a systematic way of adding auxiliary variables to components of a parallel program, so that the execution of each component can be monitored separately leading to proofs unavailable with the rule for parallelism with shared variable alone. With this in hand, we can now turn to the soundness and completeness issues of our deduction system.