| apebs[m3] = mkpeb(aehdr, avhdr, buf0, m2, false), pebs[m3] = mkpeb(buf1, 2 * EB_PAGE_SIZE + m2, false), m = m1 + 2 * EB_PAGE_SIZE, m0 = m3, n0 = n, n1 = n2, aehdr.valid?, avhdr.valid?, m3 < # apebs, m3 < # pebs, abs(pebs, apebs), abs-peb(mkpeb(buf1, 2 * EB_PAGE_SIZE + m2, false), mkpeb(aehdr, avhdr, buf0, m2, false)), is-aligned(m1, EB_PAGE_SIZE), is-aligned(n, EB_PAGE_SIZE), mtd-cons(pebs), ubi-io-inv(apebs), m2 ≤ m1, m1 + n ≤ LEB_SIZE, n2 + n ≤ # buf ⊦ ⟪if m0 < # pebs ∧ ¬ pebs[m0].bad ∧ pebs[m0].fill ≤ m ∧ m + n0 ≤ PEB_SIZE ∧ n1 + n0 ≤ # buf ∧ is-aligned(m, EB_PAGE_SIZE) ∧ is-aligned(n0, EB_PAGE_SIZE) then {fail_or_success#(; ; err); if err = ESUCCESS then {pebs[m0].data := copy(buf, n1, pebs[m0].data, m, n0); pebs[m0].fill := m + n0} else choose n with (n < n0 ∨ n = 0 ∧ n0 = 0) ∧ is-aligned(n, EB_PAGE_SIZE) in if n ≠ 0 then {pebs[m0].data := copy(buf, n1, pebs[m0].data, m, n); pebs[m0].fill := m + n}} else abort⟫ ⟨aubi_io_write_data#(m3, m1, n2, n, buf; apebs; err0)⟩ (abs(pebs, apebs) ∧ err = err0) |
pebs[m3] = mkpeb(buf1, 2 * EB_PAGE_SIZE + m2, false), apebs[m3] = mkpeb(aehdr, avhdr, buf0, m2, false), m = m1 + 2 * EB_PAGE_SIZE, m0 = m3, n0 = n, n1 = n2, avhdr.valid?, aehdr.valid?, m3 < # pebs, m3 < # apebs, abs(pebs, apebs), abs-peb(mkpeb(buf1, 2 * EB_PAGE_SIZE + m2, false), mkpeb(aehdr, avhdr, buf0, m2, false)), is-aligned(n, EB_PAGE_SIZE), is-aligned(m1, EB_PAGE_SIZE), mtd-cons(pebs), ubi-io-inv(apebs), n2 + n ≤ # buf, m1 + n ≤ LEB_SIZE, m2 ≤ m1 ⊦ ⟪fail_or_success#(; ; err); if err = ESUCCESS then {pebs[m0].data := copy(buf, n1, pebs[m0].data, m, n0); pebs[m0].fill := m + n0} else choose n with (n < n0 ∨ n = 0 ∧ n0 = 0) ∧ is-aligned(n, EB_PAGE_SIZE) in if n ≠ 0 then {pebs[m0].data := copy(buf, n1, pebs[m0].data, m, n); pebs[m0].fill := m + n}⟫ ⟨aubi_io_write_data#(m3, m1, n2, n, buf; apebs; err0)⟩ (abs(pebs, apebs) ∧ err = err0)
Used simplifier rules: ⊦ mkpeb(buf, m, boolvar).bad ↔ boolvar; (s)% ⊦ mkpeb(buf, m, boolvar).fill = m; (s)% ⊦ m + n ≤ m + n0 ↔ n ≤ n0; (s)%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic%c: ⊦ m + n = n + m; from specification nat-basic% ⊦ EB_PAGE_SIZE ≠ 0; (s)%n ≠ 0 ⊦ is-aligned(n0 * n, n); (s)%mult-a: ⊦ m0 * m * n = (m0 * m) * n; from specification nat-mult%mult-c: ⊦ m * n = n * m; from specification nat-mult%m ≠ 0, is-aligned(n1, m) ⊦ is-aligned(n0 + n1, m) ↔ is-aligned(n0, m); (s)% ⊦ m ≤ n ↔ ¬ n < m; (ss)% ⊦ m ≤ LEB_SIZE → ¬ PEB_SIZE < m + 2 * EB_PAGE_SIZE; (s)