| n2 = 0, r = rys, r0 = rxs, x0 = [], ((ls(rxs, xs) * ls(rys, ys) * del-list(to_delete, n0)))(H), # xs < h0, n0 ≤ # xs + # ys, n0 + # xs ≤ h0, ∃ x1. xs = x + x1 ∧ ((lls(rxs, r1, x) * ls(r1, x1) * ls(rys, ys) * del-list(to_delete, n0)))(H) ∧ n0 ≤ # xs + # ys ∧ n0 + # xs ≤ h0 ∧ n = # x, 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), n < h0 ∧ r1 ≠ null |
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)
Used simplifier rules: ⊦ n + 0 = n; (s)% ⊦ # [] = 0; (s)% ⊦ x + [] = x; (s)% ⊦ ⌜bv⌝ (H) ↔ bv; (s)% ⊦ ((P0 ∧ P1))(H) ↔ P0(H) ∧ P1(H); (s)%and-com: ⊦ (P0 ∧ P1) = (P1 ∧ P0); from specification heap-sep%and-ass: ⊦ ((P0 ∧ P1) ∧ P2) = (P0 ∧ P1 ∧ P2); from specification heap-sep%sep-com: ⊦ P0 * P1 = P1 * P0; from specification heap-sep%sep-ass: ⊦ (P0 * P1) * P2 = P0 * P1 * P2; from specification heap-sep% ⊦ emp * P = P; (s)% ⊦ (⌜bv⌝ ∧ P0) * P1 = (⌜bv⌝ ∧ P0 * P1); (s)% ⊦ ls(null, x) = (emp ∧ ⌜x = []⌝ ); (s)%lf-02: ⊦ m < n ∧ m = n0 → n0 < n; (forward) from specification nat-basic%c: ⊦ m + n = n + m; from specification nat-basic% ⊦ ¬ m < n → ¬ m + m0 < n; (s)%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic%a: ⊦ (x + y) + z = x + y + z; from specification list% ⊦ #(x + y) = # x + # y; (s)