M5: the completed path copy #
The views of copyRest j H t l: chunks y, z of job j carry x's path on levels l..H, and
the range pointers of the nodes on that part of x's path move to y (first) and z (last).
u is on x's path at a level from l to H.
Equations
- OrderMaintenance.Proof.Top.cpHit j H t l u = (List.range' l (H + 1 - l)).any fun (i : ℕ) => u == OrderMaintenance.Proof.Top.pth t j.x i
Instances For
The copy's hypotheses: three distinct chunks, distinct path nodes, room in the new paths.
Instances For
theorem
OrderMaintenance.Proof.Top.copyS_views
(t : TS)
(j : Model.Job)
(l : ℕ)
(hyz : j.y ≠ j.z)
(hv : pth t j.x l < t.nodes.size)
:
(copyS t j l).P = t.P ∧ (copyS t j l).cin = t.cin ∧ (copyS t j l).lpar = t.lpar ∧ (copyS t j l).tag = t.tag ∧ (copyS t j l).nodes.size = t.nodes.size ∧ (∀ (c : ℕ), c ≠ j.y → c ≠ j.z → (copyS t j l).path.getX c = t.path.getX c) ∧ (copyS t j l).path.getX j.y = (t.path.getX j.y).setX l (pth t j.x l) ∧ (copyS t j l).path.getX j.z = (t.path.getX j.z).setX l (pth t j.x l) ∧ ∀ (u : ℕ),
nd (copyS t j l) u = have __src := nd t u;
{ height := __src.height, livePar := __src.livePar, children := __src.children,
weight := __src.weight, table := __src.table, inTables := __src.inTables,
first := if u = pth t j.x l ∧ (nd t u).first = j.x then j.y else (nd t u).first,
last := if u = pth t j.x l ∧ (nd t u).last = j.x then j.z else (nd t u).last,
draining := __src.draining, t1 := __src.t1, t2 := __src.t2, side := __src.side,
overflowOf := __src.overflowOf, alive := __src.alive }
theorem
OrderMaintenance.Proof.Top.copyRest_views
(j : Model.Job)
(H k : ℕ)
(t : TS)
(l : ℕ)
:
H + 1 - l = k →
CopyOK j H t l →
(∀ (i : ℕ), l ≤ i → i ≤ H → pth t j.x i < t.nodes.size) →
(copyRest j H t l).P = t.P ∧ (copyRest j H t l).cin = t.cin ∧ (copyRest j H t l).lpar = t.lpar ∧ (copyRest j H t l).tag = t.tag ∧ (copyRest j H t l).nodes.size = t.nodes.size ∧ (∀ (c : ℕ), c ≠ j.y → c ≠ j.z → (copyRest j H t l).path.getX c = t.path.getX c) ∧ (∀ (i : ℕ),
((copyRest j H t l).path.getX j.y).getX i = if l ≤ i ∧ i ≤ H then pth t j.x i else (t.path.getX j.y).getX i) ∧ (∀ (i : ℕ),
((copyRest j H t l).path.getX j.z).getX i = if l ≤ i ∧ i ≤ H then pth t j.x i else (t.path.getX j.z).getX i) ∧ ((copyRest j H t l).path.getX j.y).size = (t.path.getX j.y).size ∧ ((copyRest j H t l).path.getX j.z).size = (t.path.getX j.z).size ∧ ∀ (u : ℕ),
nd (copyRest j H t l) u = have __src := nd t u;
{ height := __src.height, livePar := __src.livePar, children := __src.children,
weight := __src.weight, table := __src.table, inTables := __src.inTables,
first := cpFirst j H t l u, last := cpLast j H t l u, draining := __src.draining,
t1 := __src.t1, t2 := __src.t2, side := __src.side, overflowOf := __src.overflowOf,
alive := __src.alive }
The completed copy.