| # pebs0 = n + m1, # pebs1 = n + m1, # buf1 = EB_PAGE_SIZE, pebs1[m1] = mkpeb(buf0, m2, false), buf = buf1, m = 0, m0 = m1, n0 = EB_PAGE_SIZE, n1 = 0, pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], m0 < # pebs, is-aligned(m, EB_PAGE_SIZE), is-aligned(n0, EB_PAGE_SIZE), is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), mtd-cons(pebs0), mtd-cons(pebs1), mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), ubi-io-initial(subarray(pebs1, 0, m1)), pebs[m0].fill ≤ m, m + n0 ≤ PEB_SIZE, n1 + n0 ≤ # buf, EB_PAGE_SIZE ≤ PEB_SIZE, m0 < # pebs → m0 < # pebs ∧ (¬ pebs[m0].bad → m0 < # pebs) ⊦ [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}] ( mtd-cons(pebs) → ⟪m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n + m1)), n = 0, pebs[m0].bad |
# pebs0 = n + m1, # pebs1 = n + m1, # buf1 = EB_PAGE_SIZE, pebs1[m1] = mkpeb(buf0, m2, false), n ≠ 0, is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), mtd-cons(pebs0), mtd-cons(pebs1), mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), ubi-io-initial(subarray(pebs1, 0, m1)), EB_PAGE_SIZE ≤ PEB_SIZE ⊦ [fail_or_success#(; ; err); pebs := pebs1[m1, mkpeb(emptypeb, 0, false)]; if err = ESUCCESS then {pebs[m1].data := copy(buf1, 0, pebs[m1].data, 0, EB_PAGE_SIZE); pebs[m1].fill := EB_PAGE_SIZE} else {n1 := 0; n0 := EB_PAGE_SIZE; m0 := m1; m := 0; choose n with (n < n0 ∨ n = 0 ∧ n0 = 0) ∧ is-aligned(n, EB_PAGE_SIZE) in if n ≠ 0 then {pebs[m0].data := copy(buf1, n1, pebs[m0].data, m, n); pebs[m0].fill := m + n}}] ( mtd-cons(pebs) → ⟪m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n + m1))
Used simplifier rules: ⊦ m ≤ m; (s)% ⊦ m < m + n ↔ n ≠ 0; (s)% ⊦ m < n → n ≠ 0; (s)%f: ⊦ m < n → n ≠ 0; (forward) from specification nat-basic% ⊦ mkpeb(buf, m, boolvar).bad ↔ boolvar; (s)% ⊦ m < # pebs → pebs[m, peb][m] = peb; (s)% ⊦ # pebs[n, peb] = # pebs; (s)%n ≠ 0 ⊦ is-aligned(0, n); (s)%n ≠ 0 ⊦ is-aligned(n, n); (s)% ⊦ EB_PAGE_SIZE ≠ 0; (s)% ⊦ mkpeb(buf, m, boolvar).fill = m; (s)%m < # pebs ⊦ pebs[m, peb][m] = peb; (s)% ⊦ m + m0 ≤ m ↔ m0 = 0; (s)% ⊦ m < n ↔ ¬ n ≤ m; (ss)%c: ⊦ m + n = n + m; from specification nat-basic%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic% ⊦ n + 0 = n; (s)