| # gndx0 = # lax0, # buf0 = gndx0.flashsize, # lpt0 = # avol, # lpt1 = # avol, (elems nx ∪ dom gstore0) ++ n = dom gstore ∪ ginval, lpt1[n] = mklp(m1, # buf1, LP_GROUP_NODES, m2), gstore[n] = groupblock(gndx, lax, m1), avol[n] = mapped(buf1), keyset(gch) = gc-heap(lpt1, nx + n '), remove-refsize0(gstore0) = gstore0, remove-refsize0(istore0) = istore0, str0 = "persistence: adding group node to LEB " + buffered((nx + n ').last).leb.toString + " failed", ginval ∩ elems nx = ∅, buffered((nx + n ').last).isbuf?, n < # avol, ginval < # avol, abs-gstore(avol, lpt1, gstore, ginval), abs-istore(avol, lpt1, istore), abs-nodes(buf0, # buf1, gndx0, lax0, false), awbuf-inv(avol, buffered(n)), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(false, buffered(n), lpt1, avol), bufs-log-only(buffered(n), nx + n ', lpt1), flash-lpt-cons(lpt0, istore0, gstore0), freelist-cons(lpt1, freelist), inv(gstore \ ginval), inv(gstore0), inv(istore), inv(istore0), inv(groupblock(gndx, lax, m1)), log-group-block(nx + n ', lpt1), lpt-free-unref(lpt0), lpt-free-unref(lpt1), lpt-leb-size(lpt0), lpt-leb-size(lpt1), lpt-ram-flash(lpt1, lpt0, nx + n '), n ∈ gstore, # buf1 + gndx0.flashsize ≤ LEB_SIZE, istore0 ⊑ istore, ⌊err0⌋ , isbuf1 → synced(avol), ∀ n0. n0 = 0 ∨ ¬ n0 < gndx0.flashsize ∨ ¬ is-aligned(# buf1 + n0, EB_PAGE_SIZE) ⊦ ∀ . true → [lpt1[buffered((nx + n ').last).leb] := mklp (lpt1[buffered((nx + n ').last).leb].ref-size, LEB_SIZE, lpt1[buffered((nx + n ').last).leb].flags, lpt1[buffered((nx + n ').last).leb].gcheapidx)] ( lpt-free-unref(lpt1) ∧ freelist-cons(lpt1, freelist) ∧ bin-heap-inv(gch, lpt1) ∧ keyset(gch) = gc-heap(lpt1, nx + n ') ∧ bufs-log-only(buffered(n), nx + n ', lpt1) ∧ # lpt1 = # avol ∧ log-group-block(nx + n ', lpt1) ∧ buf-ro-rw-mode(true, buffered(n), lpt1, avol) ∧ lpt-leb-size(lpt1) ∧ lpt-ram-flash(lpt1, lpt0, nx + n ') → ⟨pstate := journal((nx + n ').last); apersistence_add_gnds#(gndx0, adr0, istore, istore0, ginval, gstore0, nx + n ', m0, ns0; ax0, gstore, pstate, isbuf1; err1)⟩ ( abs-istore(avol, lpt1, istore) ∧ abs-gstore(avol, lpt1, gstore, ginval) ∧ ginval < # lpt1 ∧ (isbuf1 → synced(avol)) ∧ pstate = readonly ∧ lax0.to-adr(n) = ax0 ∧ err0 = err1)), nx + n ' = [], gndx0 = [], dups(nx), n ∈ nx, n ∈ ginval |
# lpt1 = # avol, # lpt0 = # avol, # buf0 = gndx0.flashsize, # gndx0 = # lax0, (elems nx ∪ dom gstore0) ++ n = dom gstore ∪ ginval, avol[n] = mapped(buf1), gstore[n] = groupblock(gndx, lax, m1), lpt1[n] = mklp(m1, # buf1, LP_GROUP_NODES, m2), keyset(gch) = gc-heap(lpt1, nx + n '), remove-refsize0(istore0) = istore0, remove-refsize0(gstore0) = gstore0, ginval ∩ elems nx = ∅, gndx0 ≠ [], ginval < # avol, n < # avol, abs-gstore(avol, lpt1, gstore, ginval), abs-istore(avol, lpt1, istore), abs-nodes(buf0, # buf1, gndx0, lax0, false), awbuf-inv(avol, buffered(n)), bin-heap-inv(gch, lpt1), buf-ro-rw-mode(false, buffered(n), lpt1, avol), bufs-log-only(buffered(n), nx + n ', 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), log-group-block(nx + n ', lpt1), lpt-free-unref(lpt1), lpt-free-unref(lpt0), lpt-leb-size(lpt1), lpt-leb-size(lpt0), lpt-ram-flash(lpt1, lpt0, nx + n '), n ∈ gstore, # buf1 + gndx0.flashsize ≤ LEB_SIZE, istore0 ⊑ istore, ⌊err0⌋ , ¬ dups(nx), ¬ n ∈ ginval, ¬ n ∈ nx, isbuf1 → synced(avol), ∀ n0. n0 = 0 ∨ ¬ n0 < gndx0.flashsize ∨ ¬ is-aligned(# buf1 + n0, EB_PAGE_SIZE) ⊦ [lpt1[buffered((nx + n ').last).leb] := mklp (lpt1[buffered((nx + n ').last).leb].ref-size, LEB_SIZE, lpt1[buffered((nx + n ').last).leb].flags, lpt1[buffered((nx + n ').last).leb].gcheapidx)] ( lpt-free-unref(lpt1) ∧ freelist-cons(lpt1, freelist) ∧ bin-heap-inv(gch, lpt1) ∧ keyset(gch) = gc-heap(lpt1, nx + n ') ∧ bufs-log-only(buffered(n), nx + n ', lpt1) ∧ # lpt1 = # avol ∧ log-group-block(nx + n ', lpt1) ∧ buf-ro-rw-mode(true, buffered(n), lpt1, avol) ∧ lpt-leb-size(lpt1) ∧ lpt-ram-flash(lpt1, lpt0, nx + n ') → ⟨pstate := journal((nx + n ').last); apersistence_add_gnds#(gndx0, adr0, istore, istore0, ginval, gstore0, nx + n ', m0, ns0; ax0, gstore, pstate, isbuf1; err1)⟩ ( abs-istore(avol, lpt1, istore) ∧ abs-gstore(avol, lpt1, gstore, ginval) ∧ ginval < # lpt1 ∧ (isbuf1 → synced(avol)) ∧ pstate = readonly ∧ lax0.to-adr(n) = ax0 ∧ err0 = err1))
Used simplifier rules: ⊦ buffered(m).isbuf?; (s)% ⊦ (nx + n ').last = n; (s)%a: ⊦ (nx + nx0) + nx1 = nx + nx0 + nx1; from specification list[nat-list-set]% ⊦ nx + n ' ≠ []; (s)