| # pebs0 = n0 + m1, # pebs = n0 + m1, pebs[m1] = mkpeb(buf, m, false), n0 ≠ 0, mtd-cons(pebs0), mtd-cons(pebs), ubi-io-initial(subarray(pebs, 0, m1)) ⊦ ⟪ubi_io_read_echdr#(m1, EB_PAGE_SIZE, pebs; aehdr; bitflips, err0); let n = (err0 = ESUCCESS ∧ aehdr.valid? ⊃ aehdr.ec + 1;0) in {mtd_asm_erase#(m1; pebs; err0); if err0 = ESUCCESS then ubi_io_write_echdr#(m1, aechdr(n), EB_PAGE_SIZE; pebs; err0)}; m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ mtd-cons(pebs) ∧ (err0 = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err0 = ESUCCESS ∨ ⌊err0⌋ ) ∧ # pebs0 < n0 + m1) |
m = EB_PAGE_SIZE, mtd-cons(pebs), m0 < # pebs, ¬ pebs[m0].bad ⊦ ⟪ubi_io_read_echdr#(m0, m, pebs; aehdr; bitflips, err)⟫ true
# pebs = n0 + m1, # pebs0 = n0 + m1, EB_PAGE_SIZE = EB_PAGE_SIZE, pebs[m1] = mkpeb(buf, m, false), m2 = EB_PAGE_SIZE, m3 = m1, pebs1 = pebs, m1 < # pebs, mtd-cons(pebs0), mtd-cons(pebs), ubi-io-initial(subarray(pebs, 0, m1)) ⊦ [ubi_io_read_echdr#(m1, EB_PAGE_SIZE, pebs; aehdr; bitflips, err0)] ( true → ⟪let n = (err0 = ESUCCESS ∧ aehdr.valid? ⊃ aehdr.ec + 1;0) in {mtd_asm_erase#(m1; pebs; err0); if err0 = ESUCCESS then ubi_io_write_echdr#(m1, aechdr(n), EB_PAGE_SIZE; pebs; err0)}; m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ mtd-cons(pebs) ∧ (err0 = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err0 = ESUCCESS ∨ ⌊err0⌋ ) ∧ # pebs0 < n0 + m1)), n0 = 0, pebs[m1].bad
Used simplifier rules: ⊦ m < m + n ↔ n ≠ 0; (s)%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic%c: ⊦ m + n = n + m; from specification nat-basic% ⊦ mkpeb(buf, m, boolvar).bad ↔ boolvar; (s)