| # lpt0 = # avol, # lpt1 = # avol, lpt1[bleb.leb] = mklp(m4, m3, lpf, m2), adr = adr2, keyset(gch) = gc-heap(lpt1, log1), pstate = readonly, remove-refsize0(gstore0) = gstore0, remove-refsize0(istore0) = istore0, elems log1 ∩ ginval = ∅, dom gstore0 ∪ elems log1 = dom gstore ∪ ginval, ginval < # avol, abs-gstore(avol, lpt1, gstore, ginval), abs-istore(avol, lpt1, istore), awbuf-inv(avol, bleb), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(true, bleb, lpt1, avol), bufs-log-only(bleb, log1, lpt1), flash-lpt-cons(lpt0, istore0, gstore0), freelist-cons(lpt1, freelist), inv(gstore \ ginval), inv(gstore0), 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), istore0 ⊑ istore, ¬ dups(log1), 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 ∧ adr = adr2 ∧ EROFS = err0) |
# lpt1 = # avol, # lpt0 = # avol, isbuf ↔ isbuf1, lpt1[bleb.leb] = mklp(m4, m3, lpf, m2), adr = adr2, adr1 = adr2, gstore = gstore1, gstore0 = gstore2, keyset(gch) = gc-heap(lpt1, log1), log = log1, maxino = m, ns = ns0, pstate = readonly, remove-refsize0(istore0) = istore0, remove-refsize0(gstore1) = gstore1, elems log1 ∩ ginval = ∅, dom gstore1 ∪ elems log1 = dom gstore2 ∪ ginval, ginval < # avol, abs-gstore(avol, lpt1, gstore2, ginval), abs-istore(avol, lpt1, istore), awbuf-inv(avol, bleb), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(true, bleb, lpt1, avol), bufs-log-only(bleb, log1, lpt1), flash-lpt-cons(lpt0, istore0, gstore1), freelist-cons(lpt1, freelist), inv(istore0), inv(istore), inv(gstore1), inv(gstore2 \ ginval), 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), istore0 ⊑ istore, 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, istore) ∧ (isbuf → synced(avol)) ∧ pstate = readonly ∧ adr1 = adr ∧ EROFS = 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 };