| # lpt1 = # avol, # lpt0 = # avol, # buf0 = gndx0.flashsize, # gndx0 = # lax0, (elems nx ∪ dom gstore0) ++ n1 = dom gstore ∪ ginval, gstore[n1] = groupblock(gndx, lax, m1), lpt1[n1] = mklp(m1, # buf1, LP_GROUP_NODES, m2), avol[n1] = mapped(buf1), keyset(gch) = gc-heap(lpt1, nx + n1 '), pstate = journal(n1), remove-refsize0(istore0) = istore0, remove-refsize0(gstore0) = gstore0, ginval ∩ elems nx = ∅, gndx0 ≠ [], n ≠ 0, n < gndx0.flashsize, ginval < # avol, n1 < # avol, abs-gstore(avol, lpt1, gstore, ginval), abs-istore(avol, lpt1, istore), abs-nodes(buf0, # buf1, gndx0, lax0, false), awbuf-inv(avol[n1, mapped(buf1 + subarray(buf0, 0, n))], buffered(n1)), awbuf-inv(avol, buffered(n1)), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(false, buffered(n1), lpt1, avol), bufs-log-only(buffered(n1), nx + n1 ', lpt1), flash-lpt-cons(lpt0, istore0, gstore0), freelist-cons(lpt1, freelist), inv(groupblock(gndx, lax, m1)), inv(istore0), inv(istore), inv(gstore0), inv(gstore \ ginval), is-aligned(# buf1 + n, EB_PAGE_SIZE), log-group-block(nx + n1 ', lpt1), lpt-free-unref(lpt1), lpt-free-unref(lpt0), lpt-leb-size(lpt1), lpt-leb-size(lpt0), lpt-ram-flash(lpt1, lpt0, nx + n1 '), n1 ∈ gstore, # buf1 + gndx0.flashsize ≤ LEB_SIZE, istore0 ⊑ istore, ⌊err0⌋ , ¬ dups(nx), ¬ n1 ∈ nx, ¬ n1 ∈ ginval, isbuf1 → synced(avol) ⊦ ⟨apersistence_add_gnds#(gndx0, adr0, istore, istore0, ginval, gstore0, nx + n1 ', m0, ns0; ax0, gstore, pstate, isbuf1; err1)⟩ ( abs-gstore (avol[n1, mapped(avol[n1].data + subarray(buf0, 0, n))], lpt1[n1, mklp(lpt1[n1].ref-size, LEB_SIZE, lpt1[n1].flags, lpt1[n1].gcheapidx)], gstore, ginval) ∧ pstate = readonly ∧ lax0.to-adr(n1) = ax0 ∧ err0 = err1) |
# gndx0 = # lax0, # buf0 = gndx0.flashsize, # lpt0 = # avol, # lpt1 = # avol, (elems nx ∪ dom gstore0) ++ n1 = dom gstore ∪ ginval, isbuf ↔ isbuf1, avol[n1] = mapped(buf1), lpt1[n1] = mklp(m1, # buf1, LP_GROUP_NODES, m2), gstore[n1] = groupblock(gndx1, lax, m1), adr = adr0, ax = ax0, gndx = gndx0, istore = istore1, istore0 = istore2, keyset(gch) = gc-heap(lpt1, nx + n1 '), log = nx + n1 ', maxino = m0, ns = ns0, pstate = journal(n1), remove-refsize0(gstore0) = gstore0, remove-refsize0(istore1) = istore1, ginval ∩ elems nx = ∅, n1 < # avol, ginval < # avol, n < gndx0.flashsize, abs-gstore(avol, lpt1, gstore, ginval), abs-istore(avol, lpt1, istore2), abs-nodes(buf0, # buf1, gndx0, lax0, false), awbuf-inv(avol, buffered(n1)), awbuf-inv(avol[n1, mapped(buf1 + subarray(buf0, 0, n))], buffered(n1)), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(false, buffered(n1), lpt1, avol), bufs-log-only(buffered(n1), nx + n1 ', lpt1), flash-lpt-cons(lpt0, istore1, gstore0), freelist-cons(lpt1, freelist), inv(gstore \ ginval), inv(gstore0), inv(istore2), inv(istore1), inv(groupblock(gndx1, lax, m1)), is-aligned(# buf1 + n, EB_PAGE_SIZE), log-group-block(nx + n1 ', lpt1), lpt-free-unref(lpt0), lpt-free-unref(lpt1), lpt-leb-size(lpt0), lpt-leb-size(lpt1), lpt-ram-flash(lpt1, lpt0, nx + n1 '), n1 ∈ gstore, # buf1 + gndx0.flashsize ≤ LEB_SIZE, istore1 ⊑ istore2, ⌊err⌋ , isbuf1 → synced(avol) ⊦ ⟨if pstate.journal? ∨ pstate = readonly then if pstate = readonly then err0 := EROFS else {choose lax, err with (⌊err⌋ ∨ err = ESUCCESS) ∧ ¬ dups(gstore[pstate.lnum].ladrlist + lax) ∧ # lax ≤ # gndx ∧ inv-flashsize(prefixn(# lax, gndx), lax) ∧ (err = ESUCCESS ↔ # lax = # gndx) in {ax := lax.to-adr(pstate.lnum), err0 := err; gstore[pstate.lnum].gndlist := gstore[pstate.lnum].gndlist + prefixn(# lax, gndx); gstore[pstate.lnum].ladrlist := gstore[pstate.lnum].ladrlist + lax; if err0 ≠ ESUCCESS then ax := ?, pstate := readonly}; isbuf := ?} else abort⟩ ( abs-gstore (avol[n1, mapped(avol[n1].data + subarray(buf0, 0, n))], lpt1[n1, mklp(lpt1[n1].ref-size, LEB_SIZE, lpt1[n1].flags, lpt1[n1].gcheapidx)], gstore, ginval) ∧ pstate = readonly ∧ lax0.to-adr(n1) = ax ∧ err = err0), gndx0 = [], n = 0, dups(nx), n1 ∈ nx, n1 ∈ ginval
Used simplifier rules: apersistence_add_gnds# (GNDLIST, ROOTADR, ISTORE, ISTORE0, GINVAL, GSTORE0, NL, MAXINO, OS ; ADRLIST, GSTORE, PSTATE, PSYNCED ; ERR ) {if PSTATE.journal? ∨ PSTATE = readonly then if PSTATE = readonly then ERR := EROFS else {choose LADRLIST, ERR0 with (⌊ERR0⌋ ∨ ERR0 = ESUCCESS) ∧ ¬ dups(GSTORE[PSTATE.lnum].ladrlist + LADRLIST) ∧ # LADRLIST ≤ # GNDLIST ∧ inv-flashsize (prefixn(# LADRLIST, GNDLIST), LADRLIST) ∧ (ERR0 = ESUCCESS ↔ # LADRLIST = # GNDLIST) in {ADRLIST := LADRLIST.to-adr(PSTATE.lnum), ERR := ERR0; GSTORE[PSTATE.lnum].gndlist := GSTORE[PSTATE.lnum].gndlist + prefixn(# LADRLIST, GNDLIST); GSTORE[PSTATE.lnum].ladrlist := GSTORE[PSTATE.lnum].ladrlist + LADRLIST; if ERR ≠ ESUCCESS then ADRLIST := ?, PSTATE := readonly}; PSYNCED := ?} else abort };