Skip to content

Commit 5f9d500

Browse files
committed
Apply @stjepang's comments
1 parent 06a00fb commit 5f9d500

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

text/2018-01-07-deque-proof.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ After `self.buffer` is initialized, it is modified only by the owner in `fn resi
233233
the contents inside a buffer is always accessed modulo the buffer's capacity (`'L109`, `'L211`,
234234
`'L409`) and the buffer's size is always nonzero, there are no buffer overruns.
235235

236-
Thus it remains to prove that the buffer is not used after freed. Thanks to Crossbeam, we don't need
237-
to take care of all the details of memory reclamation; [this RFC][rfc-relaxed-memory] says that as a
238-
user of Crossbeam, we only need to prove that:
236+
Thus it remains to prove that the buffer is not used after it has been freed. Thanks to Crossbeam,
237+
we don't need to take care of all the details of memory reclamation; [this RFC][rfc-relaxed-memory]
238+
says that as a user of Crossbeam, we only need to prove that:
239239

240240
- When a buffer is deferred to be dropped (`'L308`), there are no longer references to the buffer in
241241
the shared memory, and no concurrent mutators introduce a reference to the buffer in the memory
@@ -361,7 +361,7 @@ follows:
361361
We will insert the invocations in `G_i` between `O_i` and `O_(i+1)`. Inside a group `G_i`, we give
362362
the linearization order as follows:
363363

364-
- Let `STEAL^x` be the set of steal invocations tat stole an element at the index `x`, and
364+
- Let `STEAL^x` be the set of steal invocations that stole an element at the index `x`, and
365365
`STEAL_EMPTY` be the set of steal invocations that returns `EMPTY`. Let `STEAL` be `Union_x
366366
{STEAL^x}`.
367367

@@ -394,7 +394,7 @@ Suppose that `O_i` is `pop()` taking the irregular path, and `x` be the value `O
394394
succeeds or fails, `O_i` reads or writes `top >= x`.
395395

396396
It is worth nothing that for this lemma to hold, it is necessary for the CAS at `'L213` to be
397-
strong, i.e. it the CAS does not spuriously fail.
397+
strong, i.e. the CAS does not spuriously fail.
398398

399399
- > (IRREGULAR-STEAL): Let `S` be a successful `steal()` that reads from `bottom` a value written by
400400
`O_i` and returns a value, and `y` be the value `S` writes to `top` at `'L410`. Then `y < x`
@@ -455,11 +455,11 @@ Now suppose `S` returns a value. Let `O_k` be such an owner invocation that the
455455
irregular path. If `k < j`, then `view_beginning(S)[bottom] <= Timestamp(WL_k) < Timestamp(WL_j) <=
456456
view_end(O_j)[bottom]`, and by `(VIEW-LOC)`, the conclusion follows.
457457

458-
Now suppose `j ∈ (i, k]`. Let `x` and `y` be the values `O_j` read from `bottom` at `'201` and `top`
459-
at `'204`, respectively. Then we have `x-1 <= y` by the fact that `O_j` is a `pop()` taking the
460-
irregular path, `view_beginning(S)[top] < x-1` by `(IRREGULAR-STEAL)`, and `x <= view_end(O_j)[top]`
461-
by `(IRREGULAR-TOP)`. Thus we have `view_beginning(S)[top] < x-1 < x <= view_end(O_j)[top]`, and by
462-
`(VIEW-LOC)`, the conclusion follows.
458+
Now suppose `j ∈ (i, k]`. Let `x` and `y` be the values `O_j` read from `bottom` at `'L201` and
459+
`top` at `'L204`, respectively. Then we have `x-1 <= y` by the fact that `O_j` is a `pop()` taking
460+
the irregular path, `view_beginning(S)[top] < x-1` by `(IRREGULAR-STEAL)`, and `x <=
461+
view_end(O_j)[top]` by `(IRREGULAR-TOP)`. Thus we have `view_beginning(S)[top] < x-1 < x <=
462+
view_end(O_j)[top]`, and by `(VIEW-LOC)`, the conclusion follows.
463463

464464
#### Proof of `(VIEW-STEAL-INTER-GROUP)`
465465

@@ -962,7 +962,7 @@ stronger than the success argument." ([C11][c11] 7.17.7.4 paragraph 2). So inste
962962
the companion implementation. This C11 requirement may be fail-safe for most use cases, but can
963963
actually be slightly inefficient in this case.
964964

965-
It is worth nothing that the CAS at `'L213` should be strong. Otherwise, a similar execution to the
965+
It is worth noting that the CAS at `'L213` should be strong. Otherwise, a similar execution to the
966966
one above is possible, where the CAS at `'L213` reads `top = 0` and then spuriously fails.
967967

968968

0 commit comments

Comments
 (0)