| avols[default-volid][m2] = mapped(buf0, n2), avol = abs(avols[default-volid]), m = m1, m0 = m2, n0 = 0, n1 = n3, avol[m0].mapped?, m0 < # avol, m2 < # avols[default-volid], ebm-cons(avols), ebm-vol-inv(abs(avols[default-volid])), is-aligned(m, EB_PAGE_SIZE), is-aligned(n0, EB_PAGE_SIZE), is-aligned(m1, EB_PAGE_SIZE), default-volid ∈ avols, # avol[m0].data ≤ m, m + n0 ≤ LEB_SIZE, n1 + n0 ≤ # buf, n2 ≤ m1, m1 ≤ LEB_SIZE, n3 ≤ # buf, n2 ≤ LEB_SIZE, m0 < # avol → m0 < # avol ∧ (avol[m0].mapped? → avol[m0].mapped? ∧ m0 < # avol) ⊦ ⟨fail_or_success#(; ; err); if err = ESUCCESS then if n0 ≠ 0 then avol[m0] := mapped(avol[m0].data + mkempbuf(m - # avol[m0].data) + subarray(buf, n1, n0)) else choose n with n < n0 ∧ is-aligned(n, EB_PAGE_SIZE) in if n ≠ 0 then avol[m0] := mapped(avol[m0].data + mkempbuf(m - # avol[m0].data) + subarray(buf, n1, n)) ifnone skip⟩ (avol = abs(avols[default-volid]) ∧ ESUCCESS = err) |
avols[default-volid][m2] = mapped(buf0, n2), m2 < # avols[default-volid], ebm-cons(avols), ebm-vol-inv(abs(avols[default-volid])), is-aligned(m1, EB_PAGE_SIZE), default-volid ∈ avols, n2 ≤ LEB_SIZE, n2 ≤ m1, n3 ≤ # buf, m1 ≤ LEB_SIZE ⊦ ⟨fail_or_success#(; ; err); avol := abs(avols[default-volid]); if err = ESUCCESS then skip else {n0 := 0; choose n with n < n0 ∧ is-aligned(n, EB_PAGE_SIZE) in if n ≠ 0 then avol[m2] := mapped(avol[m2].data + mkempbuf(m1 - # avol[m2].data) + subarray(buf, n3, n)) ifnone skip}⟩ (avol = abs(avols[default-volid]) ∧ ESUCCESS = err)
Used simplifier rules: ⊦ # subarray(buf, m, n) = n; (s)% ⊦ mapped(buf).data = buf; (s)% ⊦ abs(mapped(buf, n)) = mapped(subarray(buf, 0, n)); (s)% ⊦ mapped(buf, m) = mapped(buf0, m0) ↔ buf = buf0 ∧ m = m0; (ws)%let: ⊦ n ≤ n0 ∧ n0 ≤ n1 → n ≤ n1; (forward) from specification nat% ⊦ abs(leb).mapped? ↔ (∃ buf, n. leb = mapped(buf, n)); (s)% ⊦ # abs(evol) = # evol; (s)%n ≠ 0 ⊦ is-aligned(0, n); (s)% ⊦ EB_PAGE_SIZE ≠ 0; (s)% ⊦ n < # evol → abs(evol)[n] = abs(evol[n]); (s)%c: ⊦ m + n = n + m; from specification nat-basic%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic% ⊦ n + 0 = n; (s)