| istore = (∅)[n, indexblock([], [], 0)], pstate = index(n), syn, inv((∅)[n, indexblock([], [], 0)]), indexnode(mkbrarray(BRANCH_SIZE), true, 0).flashsize ≤ LEB_SIZE ⊦ [apersistence_add_ind#(indexnode(mkbrarray(BRANCH_SIZE), true, 0), adr, ∅, ∅, ∅, ∅, [], maxino4, ∅; adr0, istore, pstate, syn; err)] ( inv(istore) ∧ ¬ pstate.journal? ∧ (pstate.index? → pstate.lnum ∈ istore) ∧ (pstate = unbuffered → syn) → ⟪nx := []; maxino := maxino4; istore0 := ∅; gstore0 := ∅; gstore := ∅; ginval0 := ∅; ginval := ∅; if err = ESUCCESS then apersistence_set_iblock_refsize# (adr0.lnum, indexnode(mkbrarray(BRANCH_SIZE), true, 0).flashsize, adr, istore0, ginval0, gstore0, gstore, nx, maxino, ginval, pstate, syn ; istore); if err = ESUCCESS then apersistence_sync#(adr, istore, istore0, ginval0, gstore0, gstore, nx, maxino, ginval; pstate, syn; err); if err = ESUCCESS then let ns = ∅ in apersistence_commit#(adr0, maxino4, syn; ns, istore, ginval0, gstore0, adr, istore0, gstore, nx, maxino, ginval; pstate, err)⟫ ( ( err = ESUCCESS → syn ∧ (∃ ri, fi. btree-inv(null, adr, istore, istore0, zh, ri, fi)) ∧ inv(gstore0 \ ginval0) ∧ inv(gstore) ∧ elems nx ∩ ginval0 = ∅ ∧ ¬ dups(nx) ∧ dom gstore ∪ elems nx = dom gstore0 ∪ ginval0 ∧ remove-refsize0(gstore) = gstore ∧ inv(istore) ∧ inv(istore0) ∧ istore0 ⊑ istore ∧ remove-refsize0(istore0) = istore0 ∧ (pstate.journal? → nx ≠ [] ∧ pstate.lnum = nx.last ∧ pstate.lnum ∈ gstore0) ∧ (pstate.index? → pstate.lnum ∈ istore)) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ (err = ESUCCESS → btree-inv(null, adr, istore, istore0, zh, ∅, ∅) ∧ gstore0 = ∅ ∧ ginval0 = ∅ ∧ maxino = maxino4 ∧ nx = [] ∧ ginval = ∅))) |
adr = adr2, adr0 = adr1, ginval = ∅, ginval0 = ∅, gstore = ∅, gstore0 = ∅, ind = indexnode(mkbrarray(BRANCH_SIZE), true, 0), istore = (∅)[n, indexblock([], [], 0)], istore0 = ∅, maxino0 = maxino4, nx = [], pstate = index(n), syn, inv((∅)[n, indexblock([], [], 0)]), indexnode(mkbrarray(BRANCH_SIZE), true, 0).flashsize ≤ LEB_SIZE ⊦ [if pstate.index? ∨ pstate = readonly then if pstate = readonly then err0 := EROFS else {choose maxino, err with ¬ @(pstate.lnum, maxino, ind.flashsize) ∈ istore ∧ err = ESUCCESS ∨ ⌊err⌋ in adr := @(pstate.lnum, maxino, 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; syn := ?} else abort] ( inv(istore) ∧ ¬ pstate.journal? ∧ (pstate.index? → pstate.lnum ∈ istore) ∧ (pstate = unbuffered → syn) → ⟪nx := []; maxino := maxino4; istore0 := ∅; gstore0 := ∅; gstore := ∅; ginval0 := ∅; ginval := ∅; err := err0, adr2 := adr; if err = ESUCCESS then apersistence_set_iblock_refsize# (adr2.lnum, indexnode(mkbrarray(BRANCH_SIZE), true, 0).flashsize, adr1, istore0, ginval0, gstore0, gstore, nx, maxino, ginval, pstate, syn ; istore); if err = ESUCCESS then apersistence_sync#(adr1, istore, istore0, ginval0, gstore0, gstore, nx, maxino, ginval; pstate, syn; err); if err = ESUCCESS then let ns = ∅ in apersistence_commit#(adr2, maxino4, syn; ns, istore, ginval0, gstore0, adr1, istore0, gstore, nx, maxino, ginval; pstate, err)⟫ ( ( err = ESUCCESS → syn ∧ (∃ ri, fi. btree-inv(null, adr1, istore, istore0, zh, ri, fi)) ∧ inv(gstore0 \ ginval0) ∧ inv(gstore) ∧ elems nx ∩ ginval0 = ∅ ∧ ¬ dups(nx) ∧ dom gstore ∪ elems nx = dom gstore0 ∪ ginval0 ∧ remove-refsize0(gstore) = gstore ∧ inv(istore) ∧ inv(istore0) ∧ istore0 ⊑ istore ∧ remove-refsize0(istore0) = istore0 ∧ (pstate.journal? → nx ≠ [] ∧ pstate.lnum = nx.last ∧ pstate.lnum ∈ gstore0) ∧ (pstate.index? → pstate.lnum ∈ istore)) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ (err = ESUCCESS → btree-inv(null, adr1, istore, istore0, zh, ∅, ∅) ∧ gstore0 = ∅ ∧ ginval0 = ∅ ∧ maxino = maxino4 ∧ nx = [] ∧ ginval = ∅)))
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 };