Documentation

CslibFrontier.DataStructure.PriorityQueue.FibonacciHeap.Native.ScatterList

Native root preparation and root-list scattering #

prepareRoot names the existing preparation prefix in scatterListStep: clear the parent and mark, and subtract that mark from the counter. It is the same effectful source program, not a new heap representation. Native preparation keeps the exact subtraction domain. The complete list traversal also requires the original scattering forest and its reached-state domains.

Main definitions #

Main results #

The original scatterListStep preparation, factored for source/certificate reuse.

The mark to clear is at most the counter at the actual prefix entry.

Preparation uses the original memory source, with paid arithmetic and no change to the width, layout or history conventions of the surrounding realization.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.prepareSafe_of_scattering {n sz w base md : ℕ} {z : Fin n} {mem : Memory.State} {T : WordRAM.FibonacciHeap.FHTree n} {slots rest : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (h : Scattering sz z true (view n ((layout n base).abs mem)) slots (T :: rest) md) :
prepareSafe w ![n, base, ↑T.root] mem

The existing source scattering forest supplies preparation's exact mark/count domain.

The original next-root query precedes optional preparation and scattering. Every inner loop domain refers to its actual entry memory; the next root is only retained as a word.

The complete original list-step source for either fixed extraction phase. The emitter may be selected for prep before runtime capacity/layout/handle/maximum words, as in extractMin.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.scatterListStepSafe_of_scattering {n sz w base md : ℕ} {z : Fin n} {prep : Bool} {mem : Memory.State} {T : WordRAM.FibonacciHeap.FHTree n} {slots rest : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (halloc : (layout n base).Inv mem) (h : Scattering sz z prep (view n ((layout n base).abs mem)) slots (T :: rest) md) :
scatterListStepSafe prep w ![n, base, ↑T.root, md] mem

The original scattering forest supplies the native step domain, including the state after making a child an unmarked root. No new heap invariant or subtraction premise is assumed.

Every executed root-list step has its domain at the reached memory. The count, cursor and maximum degree are runtime words; the preparation phase is fixed by the extraction source.

The complete original list traversal. Each root's actual next-pointer query pays loop control, while preparation and inner consolidation retain their original source histories.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.scatterListSafe_of_scattering {n sz w base k x md : ℕ} {z : Fin n} {prep : Bool} {mem : Memory.State} {slots rest : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (halloc : (layout n base).Inv mem) (h : Scattering sz z prep (view n ((layout n base).abs mem)) slots rest md) (hlen : rest.length = k) (hx : ∀ y ∈ (List.map WordRAM.FibonacciHeap.FHTree.root rest).head?, x = ↑y) :
scatterListSafe prep w ![n, base, k, x, md] mem

The original forest/list invariant supplies every reached native step domain. A final cursor is ignored once the list is exhausted, so no extra handle bound is imposed on it.