clear that (p ◦ q) ◦ r = 0 p ◦ (q ◦ r) holds <strong>for</strong> all p, q, r ∈ W . For the inductive stepn > 0, by definition of the distance function on Pred it suffices to show that <strong>for</strong>all w ∈ W , ι −1 ((p ◦ q) ◦ r)(w) n−1= ι −1 (p ◦ (q ◦ r))(w). Suppose w ∈ W , thenι −1 ((p ◦ q) ◦ r)(w) = ι −1 (p ◦ q)(r ◦ w) ∗ ι −1 (r)(w)= ι −1 (p)(q ◦ (r ◦ w)) ∗ ι −1 (q)(r ◦ w) ∗ ι −1 (r)(w)= ι −1 (p)(q ◦ (r ◦ w)) ∗ ι −1 (q ◦ r)(w)n−1= ι −1 (p)((q ◦ r) ◦ w) ∗ ι −1 (q ◦ r)(w)= ι −1 (p ◦ (q ◦ r))(w)using the induction hypothesis in the fourth equation.That ⊗ <strong>for</strong>ms an action of W on Pred follows from these properties of ◦:first, p ⊗ emp = λw.p(emp ◦ w) = p since emp is a unit <strong>for</strong> ◦, <strong>and</strong>(p ⊗ q) ⊗ r = λw.p(q ◦ (r ◦ w)) = λw.p((q ◦ r) ◦ w) = p ⊗ (q ◦ r)by the associativity of ◦.⊓⊔Since there is a closure applied to the post-condition of semantic triples, butno similar closure used in the pre-condition, it is not immediately clear how tocompose comm<strong>and</strong>s. The following characterisation permits the proof <strong>for</strong> therule of sequential composition.Lemma 15 (Closure). If f:D ⊸ D ′ is a strict continuous function, q ⊆ D ′ isan admissible <strong>and</strong> downwards closed subset of D ′ , <strong>and</strong> p ⊆ D is an arbitrarysubset of D, then f(p) ⊆ q implies f(Ad(p)) ⊆ q.Proof. Since f is continuous, the pre-image f −1 (q) of q is admissible <strong>and</strong> downwardclosed. From the assumption that f(p) ⊆ q it follows that p ⊆ f −1 (q), <strong>and</strong>thus Ad(p) ⊆ f −1 (q) as the <strong>for</strong>mer is by definition the least admissible <strong>and</strong> downwardclosed subset of D containing p. Thus, if h ∈ Ad(p) then f(h) ∈ q. ⊓⊔Lemma 16 (Admissibility <strong>and</strong> downward closure of semantic triples).Assume w ∈ W <strong>and</strong> p, q ∈ Pred. Then the set {c ∈ Com | w |= {p}c{q}} is anadmissible <strong>and</strong> downward closed subset of Com.Proof. Both properties follow from the definition of w |={p}c{q}, specificallyfrom the respective properties of the closure applied in the post-condition. ⊓⊔Lemma 17 (Non-expansiveness of semantic triples). Assume w, w ′ ∈ W<strong>and</strong> let n>0 s.t. w n =w ′ . If w |={p}c{q}, then w ′ |={p}c ′ {q} <strong>for</strong> c ′ def= π n−1 ◦ c ◦ π n−1 .Proof. Assume w = n w ′ , <strong>and</strong> let p, q ∈ Pred <strong>and</strong> c : Heap ⊸ T err (Heap) suchthat w |={p}c{q}. To show that w ′ |={p}c ′ {q} <strong>for</strong> c ′ (h) = defπ n−1 (c(π n−1 (h))), letr ∈ UAdm <strong>and</strong> h ∈ Heap such that h ∈ p(w ′ ) ∗ ι −1 (w ′ )(emp) ∗ r. We must provethat c ′ (h) ∈ Ad(q(w ′ ) ∗ ι −1 (w ′ )(emp) ∗ r).
Since w = n w ′ , we have ι −1 (w ′ )(emp) n−1= ι −1 (w)(emp). Hence, by thenon-expansiveness of p <strong>and</strong> the compatibility of ∗ with projections, we haveπ n−1 (h) ∈ p(w) ∗ ι −1 (w)(emp) ∗ r. By the assumption that w |= {p}c{q}, thisyields c(π n−1 (h)) ∈ Ad(q(w)∗ι −1 (w)(emp)∗r). Using the non-expansiveness of q,the uni<strong>for</strong>mity of r, <strong>and</strong> the fact that ι −1 (w)(emp) n−1= ι −1 (w ′ )(emp) again, weknow that π n−1 (h ′ ) ∈ q(w ′ )∗ι −1 (w ′ )(emp)∗r whenever h ′ ∈ q(w)∗ι −1 (w)(emp)∗r. Thus π n−1 (c(π n−1 (h))) ∈ Ad(q(w ′ ) ∗ ι −1 (w ′ )(emp) ∗ r) by Lemma 15 <strong>and</strong> thecontinuity of π n−1 . This was to show.⊓⊔Lemma 18 (Heyting BI algebra). Let I = {{||}, ⊥}. Then (UAdm, ⊆, ∗, I)is a complete BI algebra. That is, (UAdm, ⊆) is a residuated complete Heytingalgebra with a (monotone) commutative monoid structure (UAdm, ∗, I) <strong>and</strong> the∗ operator also has the corresponding residuation operator.Proof. Since admissibility <strong>and</strong> uni<strong>for</strong>mity are preserved by arbitrary intersections,UAdm is a complete lattice, with meets given by set-theoretic intersection,least element {⊥} <strong>and</strong> greatest element Heap. Binary joins are given byset-theoretic union, <strong>and</strong> arbitrary joins by ⊔ i p i = ⋂ {p ∈ UAdm | p ⊇ ⋃ i p i}.The join is described more explicitly as ⊔ i p i = {h | ∀n ∈ ω. π n (h) ∈ ⋃ i p i}.First, note that the right h<strong>and</strong> side r = def{h | ∀n ∈ ω. π n (h) ∈ ⋃ i p i} is anelement of UAdm: r is uni<strong>for</strong>m, i.e., h ∈ r implies π m (h) ∈ r <strong>for</strong> all m ∈ ω, sinceπ n · π m = π min{n,m} . To show that r is also admissible suppose h 0 ⊑ h 1 ⊑ . . . isa chain in r, <strong>and</strong> let h be the lub of this chain. We must show that π n (h) ∈ ⋃ i p i<strong>for</strong> all n ∈ ω. By compactness, π n (h) ⊑ h k ⊑ h <strong>for</strong> some k, <strong>and</strong> hence π n (h) =π n (h k ) ∈ ⋃ p i using the idempotency of π n <strong>and</strong> the fact that h k ∈ r. To seethe inclusion r ⊆ ⊔ i p i, note that <strong>for</strong> all h, if π n (h) ∈ ⋃ i p i ⊆ p <strong>for</strong> all n ∈ ω<strong>and</strong> some arbitrary p ∈ UAdm, then also h = ⊔ n π n (h) ∈ p by admissibility, <strong>and</strong>hence h ∈ ⊔ i p i follows. For the other inclusion, we claim that the right h<strong>and</strong>side r = def{h | ∀n ∈ ω. π n (h) ∈ ⋃ i p i} is one of the elements appearing in theintersection; from this claim it is immediate that r ⊇ ⊔ i p i. The claim followssince r ⊇ ⋃ i p i by the uni<strong>for</strong>mity of the p i ’s.The implication of this complete lattice UAdm is described by p ⇒ q def={h | ∀n ∈ ω. if π n (h) ∈ p then π n (h) ∈ q}: Using π n · π m = π min{n,m} it is easyto see that p ⇒ q is uni<strong>for</strong>m. Admissibility follows analogously to the case ofjoins: if h 0 ⊑ h 1 ⊑ . . . is a chain in p ⇒ q with lub h, <strong>and</strong> if n ∈ ω is such thatπ n (h) ∈ p then we must show that π n (h) ∈ q. Since π n (h) ⊑ h is compact, thereis some k such that π n (h) ⊑ h k ⊑ h, <strong>and</strong> thus the required π n (h) = π n (h k ) ∈ qfollows from h k ∈ p ⇒ q. Next, to see that p ⇒ q is indeed the implicationin UAdm, first note that we have p ∩ (p ⇒ q) ⊆ q, using the uni<strong>for</strong>mity of p<strong>and</strong> the admissibility of q. If p ∩ r ⊆ q <strong>for</strong> some r ∈ UAdm, <strong>and</strong> h ∈ r <strong>and</strong>π n (h) ∈ p <strong>for</strong> some n ∈ ω, then the uni<strong>for</strong>mity of r yields π n (h) ∈ q. Thus weobtain p ∩ r ⊆ q ⇔ r ⊆ p ⇒ q.That ∗ is an operation on UAdm is established in the proof of Lemma 12. Itis easy to check that ∗ is commutative <strong>and</strong> associative <strong>and</strong> that it is monotone,i.e., if p ⊆ p ′ <strong>and</strong> q ⊆ q ′ then p ∗ q ⊆ p ′ ∗ q ′ . Moreover, we have I ∈ UAdm, <strong>and</strong>