| n = # x, r = rys, xs = x, (((lls(rxs, null, x) * ls(rys, ys)) * del-list(to_delete, n0)))(H), ((ls(rxs, x) * ls(rys, ys) * del-list(to_delete, n0)))(H), # x < h0, n0 ≤ # x + # ys, n0 + # x ≤ h0, ys = [] ∨ # ys = h0 ⊦ ⟪while n < h0 ∧ r ≠ null do {x := x + H[r].val '; r := H[r].nxt; n := n + 1}⟫ ⟨caterpillar_get#(h0, xs, ys; ; x0)⟩ ((∃ n0. ((ls(rxs, xs) * ls(rys, ys) * del-list(to_delete, n0)))(H) ∧ n0 ≤ # xs + # ys ∧ n0 + # xs ≤ h0) ∧ x = x0) |
n2 = # x0, r0 = rys, xs = x0, ((ls(rxs, x0) * ls(rys, ys) * del-list(to_delete, n0)))(H), (((lls(rxs, null, x0) * ls(rys, ys)) * del-list(to_delete, n0)))(H), # x0 < h0, n < h0, n0 + # x0 ≤ h0, n0 ≤ # x0 + # ys, ∃ x1, y1. ( x = xs + x1 ∧ ys = x1 + y1 ∧ ((ls(rxs, xs) * lls(rys, r, x1) * ls(r, y1) * del-list(to_delete, n0)))(H) ∧ n0 ≤ # xs + # ys ∧ n0 + # xs ≤ h0 ∧ n ≤ h0 ∧ n = # x) ∧ n = n1, ys = [] ∨ # ys = h0 ⊦ ⟪x := x + H[r].val '; r := H[r].nxt; n := n + 1⟫ ∃ x1, y1. ( x = xs + x1 ∧ ys = x1 + y1 ∧ ((ls(rxs, xs) * lls(rys, r, x1) * ls(r, y1) * del-list(to_delete, n0)))(H) ∧ n0 ≤ # xs + # ys ∧ n0 + # xs ≤ h0 ∧ n ≤ h0 ∧ n = # x) ∧ h0 - n < h0 - n1, r = null
n2 = # x0, r0 = rys, xs = x0, ((ls(rxs, x0) * ls(rys, ys) * del-list(to_delete, n0)))(H), (((lls(rxs, null, x0) * ls(rys, ys)) * del-list(to_delete, n0)))(H), # x0 < h0, n0 + # x0 ≤ h0, n0 ≤ # x0 + # ys, ∃ x1, y1. x = xs + x1 ∧ ys = x1 + y1 ∧ ((ls(rxs, xs) * lls(rys, r, x1) * ls(r, y1) * del-list(to_delete, n0)))(H) ∧ n0 ≤ # xs + # ys ∧ n0 + # xs ≤ h0 ∧ n ≤ h0 ∧ n = # x, ys = [] ∨ # ys = h0 ⊦ ⟨caterpillar_get#(h0, xs, ys; ; x0)⟩ ((∃ n0. ((ls(rxs, xs) * ls(rys, ys) * del-list(to_delete, n0)))(H) ∧ n0 ≤ # xs + # ys ∧ n0 + # xs ≤ h0) ∧ x = x0), n < h0 ∧ r ≠ null
Used simplifier rules: ⊦ x = x + y ↔ y = []; (s)%a: ⊦ (x + y) + z = x + y + z; from specification list% ⊦ [] + x = x; (s)% ⊦ lls(r0, r1, []) = (emp ∧ ⌜r0 = r1⌝ ); (s)% ⊦ ⌜true⌝ = true; (s)% ⊦ (true ∧ P) = P; (s)%and-ass: ⊦ ((P0 ∧ P1) ∧ P2) = (P0 ∧ P1 ∧ P2); from specification heap-sep%and-com: ⊦ (P0 ∧ P1) = (P1 ∧ P0); from specification heap-sep% ⊦ emp * P = P; (s)%sep-ass: ⊦ (P0 * P1) * P2 = P0 * P1 * P2; from specification heap-sep%sep-com: ⊦ P0 * P1 = P1 * P0; from specification heap-sep% ⊦ m < n → m ≤ n; (s) Used formulas: ∃ x1, y1. x = xs + x1 ∧ ys = x1 + y1 ∧ (( ls(rxs, xs) * lls(rys, r, x1) * ls(r, y1) * del-list(to_delete, n0)) )(H) ∧ n0 ≤ # xs + # ys ∧ n0 + # xs ≤ h0 ∧ n ≤ h0 ∧ n = # x, h0 - n = h0 - n