Anda di halaman 1dari 11

.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Shared Variables
Dr. Mattox Beckman
Illinois Institute of Technology
Department of Computer Science
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Motivation

Disjoint parallel programs have only one problem.

They cant talk to each other!

There are a few ways to x that.

Todays x: let them write to each others variables.

What could possibly go wrong?


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
New Syntax

Assignment

Atomic Regions.
S ::= S
0

Here, S
0
is loop free and contains no atomic regions.

[S
1
S
2
S
n
]
Here, S
i
must not contain parallelism or loops.

Why must S
0
be loop free?

What other things are atomic?


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Semantics
< S, >

< E, >
< S, >< E, >
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Non-Blocking Lemma

Every conguration < S, >with S E and a proper state has a


successor conguration in the transition relation .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Bounded Nondeterminism

Let S be a simple parallel program and a proper state. Then


M
tot
[[S]]() is either nite or contains .
Compare to Disjoint Parallelism:

Let S be a disjoint parallel program and a proper state. Then


M
tot
[[S]]() has exactly one element.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Finiteness

For every parallel program S and proper state , the conguration


< S, >has only nitely many successors in the relation .
Wait! What about innite loops?
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Knigs Lemma
Any nitely branching tree is either nite or has an innite path.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Rule 11
{p}S{q}
{p}S{q}
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Sequential Composition
|= {p}x := x + 2{q} |= {p}x := x + 1; x := x + 1{q}
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Introduction Hoare Triples
Parallel Composition
|= {true}[x := x + 2x := 0]{x = 0 x = 2}
What about
|= {true}[x := x + 1; x := x + 1x := 0]{x = 0 x = 2}
Do the Shared Variable Proof Outline activity.

Anda mungkin juga menyukai