| # buf1 = EB_PAGE_SIZE, # pebs1 = n0 + m1, # pebs0 = n0 + m1, pebs1[m1] = mkpeb(buf0, m2, false), err = ESUCCESS, pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], m1 < # pebs1, mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), mtd-cons(pebs1), mtd-cons(pebs0), ubi-io-initial(subarray(pebs1, 0, m1)), err = ESUCCESS → is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), err = ESUCCESS ∨ ⌊err⌋ ⊦ ⟪mtd_asm_write#(m1, 0, 0, EB_PAGE_SIZE, buf1; pebs; err); m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ mtd-cons(pebs) ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n0 + m1), n0 = 0 |
# buf1 = EB_PAGE_SIZE, # pebs1 = n0 + m1, # pebs0 = n0 + m1, pebs1[m1] = mkpeb(buf0, m2, false), pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], n0 ≠ 0, is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), mtd-cons(pebs1), mtd-cons(pebs0), ubi-io-initial(subarray(pebs1, 0, m1)) ⊦ ⟪mtd_asm_write#(m1, 0, 0, EB_PAGE_SIZE, buf1; pebs; err); m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ mtd-cons(pebs) ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n0 + m1)
Used simplifier rules: c: ⊦ m + n = n + m; from specification nat-basic%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic% ⊦ m < m + n ↔ n ≠ 0; (s)%is-encoded-size: ⊦ is-encoded(ehdr, buf) → # buf = EB_PAGE_SIZE; (forward) from specification encoding-page-size-nonempty[encoding-echeader]