| # lpt1 = # avol, # buf1 = 2 * NODE_HEADER_SIZE + ind.alignedsize, # lpt0 = # avol, avol[m1] = mapped(buf0), istore[m1] = indexblock(indx, lax, m), lpt1[m1] = mklp(m, # buf0, LP_INDEX_NODES, m5), adr = adr2, keyset(gch) = gc-heap(lpt1, log1), pstate = index(m1), remove-refsize0(istore0) = istore0, remove-refsize0(gstore0) = gstore0, elems log1 ∩ ginval = ∅, dom gstore0 ∪ elems log1 = dom gstore ∪ ginval, ginval < # avol, m1 < # avol, abs-gstore(avol, lpt1, gstore, ginval), abs-istore(avol, lpt1, istore), abs-node(buf1, ind), awbuf-inv(avol, buffered(m1)), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(false, buffered(m1), lpt1, avol), bufs-log-only(buffered(m1), log1, lpt1), flash-lpt-cons(lpt0, istore0, gstore0), freelist-cons(lpt1, freelist), inv(istore0), inv(istore), inv(gstore0), inv(gstore \ ginval), inv(indexblock(indx, lax, m)), log-group-block(log1, lpt1), lpt-free-unref(lpt1), lpt-free-unref(lpt0), lpt-leb-size(lpt1), lpt-leb-size(lpt0), lpt-ram-flash(lpt1, lpt0, log1), lpt-ram-flash(lpt1[m1, mklp(m, LEB_SIZE, LP_INDEX_NODES, m5)], lpt0, log1), m1 ∈ istore, # buf0 + # buf1 ≤ LEB_SIZE, istore0 ⊑ istore, ⌊err0⌋ , ¬ dups(log1), isbuf1 → synced(avol) ⊦ ⟨apersistence_add_ind#(ind, adr0, istore0, ginval, gstore, gstore0, log1, m0, ns0; adr2, istore, pstate, isbuf1; err1)⟩ ( abs-istore(avol, lpt1[m1, mklp(m, LEB_SIZE, LP_INDEX_NODES, m5)], istore) ∧ (isbuf1 → synced(avol)) ∧ pstate = readonly ∧ adr = adr2 ∧ err0 = err1) |
# lpt0 = # avol, # buf1 = 2 * NODE_HEADER_SIZE + ind.alignedsize, # lpt1 = # avol, isbuf ↔ isbuf1, lpt1[m1] = mklp(m, # buf0, LP_INDEX_NODES, m5), istore[m1] = indexblock(indx, lax, m), avol[m1] = mapped(buf0), adr = adr2, adr1 = adr2, gstore = gstore1, gstore0 = gstore2, keyset(gch) = gc-heap(lpt1, log1), log = log1, maxino = m0, ns = ns0, pstate = index(m1), remove-refsize0(gstore1) = gstore1, remove-refsize0(istore0) = istore0, elems log1 ∩ ginval = ∅, dom gstore1 ∪ elems log1 = dom gstore2 ∪ ginval, m1 < # avol, ginval < # avol, abs-gstore(avol, lpt1, gstore2, ginval), abs-istore(avol, lpt1, istore), abs-node(buf1, ind), awbuf-inv(avol, buffered(m1)), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(false, buffered(m1), lpt1, avol), bufs-log-only(buffered(m1), log1, lpt1), flash-lpt-cons(lpt0, istore0, gstore1), freelist-cons(lpt1, freelist), inv(indexblock(indx, lax, m)), inv(gstore2 \ ginval), inv(gstore1), inv(istore), inv(istore0), log-group-block(log1, lpt1), lpt-free-unref(lpt0), lpt-free-unref(lpt1), lpt-leb-size(lpt0), lpt-leb-size(lpt1), lpt-ram-flash(lpt1[m1, mklp(m, LEB_SIZE, LP_INDEX_NODES, m5)], lpt0, log1), lpt-ram-flash(lpt1, lpt0, log1), m1 ∈ istore, # buf0 + # buf1 ≤ LEB_SIZE, istore0 ⊑ istore, ⌊err⌋ , isbuf1 → synced(avol) ⊦ ⟨if pstate.index? ∨ pstate = readonly then if pstate = readonly then err0 := EROFS else {choose m, err with ¬ @(pstate.lnum, m, ind.flashsize) ∈ istore ∧ err = ESUCCESS ∨ ⌊err⌋ in adr := @(pstate.lnum, m, ind.flashsize), err0 := err; if err0 = ESUCCESS then {istore[pstate.lnum].indlist := istore[pstate.lnum].indlist + ind; istore[pstate.lnum].ladrlist := istore[pstate.lnum].ladrlist + @(adr.pos, adr.size)} else adr := ?, pstate := readonly; isbuf := ?} else abort⟩ (abs-istore(avol, lpt1[m1, mklp(m, LEB_SIZE, LP_INDEX_NODES, m5)], istore) ∧ (isbuf → synced(avol)) ∧ pstate = readonly ∧ adr1 = adr ∧ err = err0), dups(log1)
Used simplifier rules: apersistence_add_ind# (IND, ROOTADR, ISTORE0, GINVAL, GSTORE, GSTORE0, NL, MAXINO, OS ; ADR, ISTORE, PSTATE, PSYNCED ; ERR ) {if PSTATE.index? ∨ PSTATE = readonly then if PSTATE = readonly then ERR := EROFS else {choose OFFSET, ERR0 with ¬ @(PSTATE.lnum, OFFSET, IND.flashsize) ∈ ISTORE ∧ ERR0 = ESUCCESS ∨ ⌊ERR0⌋ in ADR := @(PSTATE.lnum, OFFSET, IND.flashsize), ERR := ERR0; if ERR = ESUCCESS then {ISTORE[PSTATE.lnum].indlist := ISTORE[PSTATE.lnum].indlist + IND; ISTORE[PSTATE.lnum].ladrlist := ISTORE[PSTATE.lnum].ladrlist + @(ADR.pos, ADR.size)} else ADR := ?, PSTATE := readonly; PSYNCED := ?} else abort };