| # lpt1 = # avol, # lpt0 = # avol, # buf1 = 2 * NODE_HEADER_SIZE + ind.alignedsize, istore[m0] = indexblock(indx, lax, m4), lpt1[m0] = mklp(m4, m3, LP_INDEX_NODES, m2), avol[m0] = mapped(buf0), adr1 = adr2, keyset(gch) = gc-heap(lpt1, log1), pstate = index(m0), remove-refsize0(istore0) = istore0, remove-refsize0(gstore0) = gstore0, elems log1 ∩ ginval = ∅, dom gstore0 ∪ elems log1 = dom gstore ∪ ginval, ginval < # avol, m0 < # avol, abs-gstore(avol, lpt1, gstore, ginval), abs-istore(avol, lpt1, istore), awbuf-inv(avol, buffered(m0)), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(false, buffered(m0), lpt1, avol), bufs-log-only(buffered(m0), 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, m4)), 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), m0 ∈ istore, istore0 ⊑ istore, ⌊err⌋ , ¬ dups(log1), m3 + # buf1 ≤ LEB_SIZE → m3 = # buf0, isbuf1 → synced(avol) ⊦ ⟨apersistence_add_ind#(ind, adr0, istore0, ginval, gstore, gstore0, log1, m, ns0; adr2, istore, pstate, isbuf1; err0)⟩ (abs-istore(avol, lpt1, istore) ∧ (isbuf1 → synced(avol)) ∧ pstate = readonly ∧ adr1 = adr2 ∧ err = err0) |
# buf1 = 2 * NODE_HEADER_SIZE + ind.alignedsize, # lpt0 = # avol, # lpt1 = # avol, isbuf ↔ isbuf1, avol[m0] = mapped(buf0), lpt1[m0] = mklp(m4, m3, LP_INDEX_NODES, m2), istore[m0] = indexblock(indx, lax, m4), adr = adr2, adr1 = adr2, gstore = gstore1, gstore0 = gstore2, keyset(gch) = gc-heap(lpt1, log1), log = log1, maxino = m, ns = ns0, pstate = index(m0), remove-refsize0(gstore1) = gstore1, remove-refsize0(istore0) = istore0, elems log1 ∩ ginval = ∅, dom gstore1 ∪ elems log1 = dom gstore2 ∪ ginval, m0 < # avol, ginval < # avol, abs-gstore(avol, lpt1, gstore2, ginval), abs-istore(avol, lpt1, istore), awbuf-inv(avol, buffered(m0)), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(false, buffered(m0), lpt1, avol), bufs-log-only(buffered(m0), log1, lpt1), flash-lpt-cons(lpt0, istore0, gstore1), freelist-cons(lpt1, freelist), inv(indexblock(indx, lax, m4)), 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, lpt0, log1), m0 ∈ istore, istore0 ⊑ istore, ⌊err⌋ , isbuf1 → synced(avol), m3 + # buf1 ≤ LEB_SIZE → m3 = # buf0 ⊦ ⟨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, 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 };