Documentation

CslibFrontier.DataStructure.PriorityQueue.FibonacciHeap.Native.Consolidate

Native extraction-phase assembly #

The final phase resets the original root-list header and gathers the consolidation table. Its runtime maximum-degree word remains the one computed by scattering. These source pieces retain the original memory program, query history and forest invariants.

Main definitions #

Main results #

The original final extraction phase: clear the old root-list header, then gather the table.

Entry envelope and the gather domain at the actual two-write endpoint.

The original final phase, with charged runtime-count staging and no new layout assumption.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.finishSafe_of_gathering {n sz w base md : ℕ} {mem : Memory.State} {slots : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (halloc : (layout n base).Inv mem) (h : Gathering sz (have __src := view n ((layout n base).abs mem); { key := __src.key, par := __src.par, child := __src.child, left := __src.left, right := __src.right, deg := __src.deg, mark := __src.mark, inHeap := __src.inHeap, cons := __src.cons, minRoot := 0, numRoots := 0, numMarked := __src.numMarked, sz := __src.sz }) [] slots md) :
finishSafe w ![n, base, md] mem

The original final-phase forest supplies the actual cleared-header gather domain. The maximum degree bound comes from its table invariant, rather than a new word-size assumption.

The original three consolidation phases after detaching the minimum. Arguments are the old root count/right pointer and the minimum's child count/child pointer.

Domains of the three original phases at their actual source entry states.

Both list traversals and the final gather use their original source and reached-state conditions. This is the consolidation tail, before packaging the complete extraction method.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.forestSafe_of_detached {n K w base : ℕ} {s : IndexedMinPQ.State n} {st : WordRAM.FibonacciHeap.RawState n} {m : Fin n} {cs roots : List (WordRAM.FibonacciHeap.FHTree n)} {mem : Memory.State} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (halloc : (layout n base).Inv mem) (hD : Detached n K s st m cs roots) (ha : view n ((layout n base).abs mem) = detachState st m) :
forestSafe w ![n, base, roots.length + 1, st.right m, cs.length, st.child m] mem

The original detached-heap forest supplies all three consolidation domains. Its original child/root counts and pointer observations are retained, including empty child lists.